php/php-langspec

Incorrect print precedence

nikic opened this issue · 4 comments

nikic commented

print should be between and and yield, currently it's spec'd as taking an arbitrary expression. https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#grammar-print-intrinsic

nikic commented

yield from also has incorrect precedence.

nikic commented

Also the yield precedence is not correctly specified, in particular regarding the interaction with arrays, that is [yield "foo" => "bar"], which is [(yield "foo" => "bar")] rather than [(yield "foo") => "bar"].

nikic commented

Precedence fixed for by-ref assign (1058a50), yield from (b0dadd5) and print (63d72a6).

The issue with the yield vs array literal precedence remains, and I'm not sure if there's any reasonable way to specify that in grammar. I didn't manage to get this to work without precedence annotations in the parser.

nikic commented

Opened #235 for the yield issue, closing this one.