8000 zend_language_scanner: Lex `clone` as identifier when followed by `(` by TimWolla · Pull Request #18981 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

zend_language_scanner: Lex clone as identifier when followed by ( #18981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

TimWolla
Copy link
Member

This greatly simplifies the parser to support clone() as a function and effectively reverts #18938.

This greatly simplifies the parser to support `clone()` as a function and
effectively reverts php#18938.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
@TimWolla
Copy link
Member Author

Okay, it appears that this doesn't actually work, because it breaks reserved_non_modifiers.

@iluuu1994
Copy link
Member

I just saw. I'm ok keeping it the way it is.

@TimWolla TimWolla closed this Jun 30, 2025
@TimWolla TimWolla deleted the clone-all-syntax-simplify branch June 30, 2025 13:05
@@ -1613,6 +1613,11 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
RETURN_TOKEN_WITH_IDENT(T_NEW);
}

<ST_IN_SCRIPTING>"clone"{OPTIONAL_WHITESPACE_OR_COMMENTS}"(" {
yyless(5);
RETURN_TOKEN_WITH_STR(T_NAME_FULLY_QUALIFIED, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would lexing it as T_STRING instead work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would work, but “require” a special case in the compiler to treat clone($x, $y) in a namespace as a fully-qualified call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0