-
Notifications
You must be signed in to change notification settings - Fork 79
Bug fixes for parsing associativity #268
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
Bug fixes for parsing associativity #268
Conversation
I ran a test of all valid combinations of a subset of binary operators (according to what php-ast said was valid) to check for false positives. (not including assignment by ref)
(The 4 remaining edge cases include The number of errors in the validation tests is still 3, and I think those were pre-existing (for the symfony edge cases) |
This fixes the most common cases for microsoft#19 (there may be other edge cases I haven't considered yet) This also fixes incorrect precedence for `<=>`. It has the same precedence as `==` - https://secure.php.net/manual/en/language.operators.precedence.php has correct information for the `<=>` operator.
ceef8c3
to
c64dbb2
Compare
Is there anything else that should be done in this PR? |
Sorry, I will look at it soon. Been busy/on vacation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good but I don't understand why $x == $y <=> $z;
is a syntax error but $x < $a <=> $b;
is not? I must be missing something.
This is part of the standard that most programmers normally don't need to think about. The PHP manual mentions this (replace
The below two groups have the same precedences within the groups:
I'm assuming this is so that expressions such as
|
That's kind of crazy but makes sense, thanks! |
This fixes the most common cases for #19
(there may be other edge cases I haven't considered yet)
This also fixes incorrect precedence for
<=>
.It has the same precedence as
==
-https://secure.php.net/manual/en/language.operators.precedence.php
has correct information for the
<=>
operator.