diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index cf8023b..e9101f2 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -312,7 +312,9 @@ abstract class ParserAbstract implements Parser } //$this->traceShift($this->errorSymbol); - $stateStack[++$this->stackPos] = $state = $action; + ++$this->stackPos; + $stateStack[$this->stackPos] = $state = $action; + $this->endAttributes = $this->endAttributeStack[$this->stackPos]; break; case 3: diff --git a/test/PhpParser/NodeDumperTest.php b/test/PhpParser/NodeDumperTest.php index 4574a31..9bb65a7 100644 --- a/test/PhpParser/NodeDumperTest.php +++ b/test/PhpParser/NodeDumperTest.php @@ -2,8 +2,6 @@ namespace PhpParser; -use SebastianBergmann\Diff\Parser; - class NodeDumperTest extends \PHPUnit_Framework_TestCase { private function canonicalize($string) { diff --git a/test/code/parser/errorHandling/recovery.test b/test/code/parser/errorHandling/recovery.test index a5d9019..5800ce3 100644 --- a/test/code/parser/errorHandling/recovery.test +++ b/test/code/parser/errorHandling/recovery.test @@ -245,13 +245,14 @@ Syntax error, unexpected EOF from 8:12 to 8:12 $foo-> ; ----- +!!positions Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1 array( - 0: Expr_PropertyFetch( - var: Expr_Variable( + 0: Expr_PropertyFetch[2:1 - 3:1]( + var: Expr_Variable[2:1 - 2:4]( name: foo ) - name: Expr_Error( + name: Expr_Error[3:1 - 3:1]( ) ) ) @@ -261,20 +262,21 @@ function foo() { $bar-> } ----- +!!positions Syntax error, unexpected '}', expecting T_STRING or T_VARIABLE or '{' or '$' from 4:1 to 4:1 array( - 0: Stmt_Function( + 0: Stmt_Function[2:1 - 4:1]( byRef: false name: foo params: array( ) returnType: null stmts: array( - 0: Expr_PropertyFetch( - var: Expr_Variable( + 0: Expr_PropertyFetch[3:5 - 4:1]( + var: Expr_Variable[3:5 - 3:8]( name: bar ) - name: Expr_Error( + name: Expr_Error[4:1 - 4:1]( ) ) ) @@ -300,11 +302,11 @@ array(