Skip to content

Commit

Permalink
Fix #275 - The ast parser >=8.1 cannot correctly handle T_REFERENCE_F…
Browse files Browse the repository at this point in the history
…OLLOWED_BY_VAR_OR_VARARG
  • Loading branch information
zulus committed May 25, 2024
1 parent 0b23569 commit cdabb00
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3019,6 +3019,11 @@ T_LIST:s T_OPEN_PARENTHESE assignment_list:varList T_CLOSE_PARENTHESE:close T_EQ
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_REFERENCE_FOLLOWED_BY_VAR_OR_VARARG expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_KOVA expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_XOR, expr2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,11 @@ T_LIST:s T_OPEN_PARENTHESE assignment_list:varList T_CLOSE_PARENTHESE:close T_EQ
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_REFERENCE_FOLLOWED_BY_VAR_OR_VARARG expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_KOVA expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_XOR, expr2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3099,6 +3099,11 @@ T_LIST:s T_OPEN_PARENTHESE assignment_list:varList T_CLOSE_PARENTHESE:close T_EQ
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_REFERENCE_FOLLOWED_BY_VAR_OR_VARARG expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_AND, expr2);
:}

| expr:expr1 T_KOVA expr:expr2
{:
RESULT = new InfixExpression(expr1left, expr2right, parser.ast, expr1, InfixExpression.OP_XOR, expr2);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
PHP 8.1
--FILE--
<?php
$a & $b;
?>
--EXPECT--
<Program start='0' length='17'>
<Statements>
<ExpressionStatement start='6' length='8'>
<InfixExpression start='6' length='7' operator='&amp;'>
<Variable start='6' length='2' isDollared='true'>
<Identifier start='7' length='1' name='a'/>
</Variable>
<Variable start='11' length='2' isDollared='true'>
<Identifier start='12' length='1' name='b'/>
</Variable>
</InfixExpression>
</ExpressionStatement>
<EmptyStatement start='15' length='2'/>
</Statements>
<Comments>
</Comments>
</Program>

0 comments on commit cdabb00

Please sign in to comment.