Skip to content

ambiguity, complication in the lexer ? #17614

@SVGAnimate

Description

@SVGAnimate

Description

Hello,

In the file /Zend/zend_language_scanner.l

Isn't the following code redundant?

<ST_IN_SCRIPTING>"&"{OPTIONAL_WHITESPACE_OR_COMMENTS}("$"|"...") {
	yyless(1);
	RETURN_TOKEN(T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG);
}

<ST_IN_SCRIPTING>"&" {
	RETURN_TOKEN(T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG);
}

If so, this complicates the reading of rules parser (/Zend/zend_language_parser.y)

ampersand: ...
is_reference: ...
...

why not just use the token T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG (T_AMPERSAND) ?

Thank you for your explanations

PHP Version

PHP 8

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions