#
d3ae2ed6 |
| 21-Jul-2024 |
Nikita Popov |
Respect version mode line in pretty printer tests By default parser uses newest supported and pretty printer uses its default version. If version is specified, it's used for both par
Respect version mode line in pretty printer tests By default parser uses newest supported and pretty printer uses its default version. If version is specified, it's used for both parser and printer. Additionally, parserVersion can be used to specify a different version for parser and printer.
show more ...
|
#
698ff1ca |
| 04-Mar-2023 |
Nikita Popov |
Don't always omit parentheses for argument-less yield We may need parentheses around an argument-less yield to distinguish (yield) - $a from yield -$a and similar. Treat argumen
Don't always omit parentheses for argument-less yield We may need parentheses around an argument-less yield to distinguish (yield) - $a from yield -$a and similar. Treat argument-less yield like a prefix operator. This will print parentheses a bit more often than is really required, because the arity ambiguity only exists for certain operators. This seems like a reasonably good approximation through, as it only affects argument-less yield on the LHS of infix operators.
show more ...
|
#
8e100f1e |
| 27-Feb-2023 |
Nikita Popov |
Handle another yield edge case match also uses =>, so we need to make sure that a trailing yield is wrapped in parentheses.
|
#
cb60eda7 |
| 26-Feb-2023 |
Nikita Popov |
Support yield precedence Since PHP 7.0 yield is a proper expression, so print it with proper precedence. If the pretty printer is configured for older version (non-default), then alw
Support yield precedence Since PHP 7.0 yield is a proper expression, so print it with proper precedence. If the pretty printer is configured for older version (non-default), then always print parentheses. There is an interesting interaction here, in that => is resolved in favor of yield if the yield occurs as part of an array (or outer yield). This kind of bypasses the entire precedence hierarchy and *only* affects yield expressions. For the sake of simplicity this is modeled via normal LHS precedence, because this will only add unnecessary parentheses to a handful of low precedence unary operators. If desired, a special marker for this purpose could be added though.
show more ...
|
#
3bd38c5b |
| 25-Feb-2023 |
Nikita Popov |
Properly support prefix operator precedence printing The pretty printer is supposed to produce a minimal-parentheses printing for expressions. However, for prefix operators, we were
Properly support prefix operator precedence printing The pretty printer is supposed to produce a minimal-parentheses printing for expressions. However, for prefix operators, we were failing to do so in ways that are practically meaningful, e.g. $a = yield from $b produced redundant parentheses around the yield from. For prefix operators, the precedence of the direct parent operator is not actually relevant: What matters is the precedence of any infix operator whose LHS it appears on. For example, $a . include $b does not require parentheses, but (include $a) . $b does. To handle this, keep separate track of the parent operator precedence, and a special LHS precedence which is used for unary operator printing only. Because the LHS precedence may not come from the direct parent, we have to pass it down the call stack. And if we do that, we may as well do the same for the parent precedence. This also fixes an integration test failure with php-src, because arrow function precedence was previously not respected (and would be ugly to respect without this change).
show more ...
|
#
d3d1297c |
| 06-Jun-2022 |
Nikita Popov |
Remove PHP 5 parser
|
Revision tags: v4.3.0, v4.2.5, v4.2.4, v4.2.3, v4.2.2, v4.2.1, v4.2.0, v4.1.1, v4.1.0, v4.0.4, v4.0.3, v4.0.2, v4.0.1, v4.0.0, v3.1.5, v4.0.0beta1, v3.1.4, v4.0.0alpha3, v3.1.3, v4.0.0alpha2, v3.1.2, v4.0.0alpha1, v3.1.1, v3.1.0, v3.0.6, v3.0.5, v3.0.4, v3.0.3, v3.0.2, v3.0.1, v3.0.0, v3.0.0beta2, v3.0.0beta1, v2.1.1, v3.0.0alpha1, v2.1.0, v2.0.1, v2.0.0, v2.0.0beta1 |
|
#
7eac2cfd |
| 02-Oct-2015 |
Nikita Popov |
Introduce Nop statement to collect dangling comments A Nop statement will be inserted into statement lists if there are any trailing comments in the list (which would otherwise not be
Introduce Nop statement to collect dangling comments A Nop statement will be inserted into statement lists if there are any trailing comments in the list (which would otherwise not be associated with any node). The pretty printer output currently still contains a superfluous newline.
show more ...
|
#
a73aa7ee |
| 20-Feb-2016 |
Nikita Popov |
Pretty printer test coverage Our output for yield / yield from is currently not very nice, but also not easy to change.
|