1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-26 20:04:48 +01:00

Merge branch '3.x'

Conflicts:
	lib/PhpParser/ParserAbstract.php
	test/code/parser/errorHandling/recovery.test
This commit is contained in:
Nikita Popov 2017-02-26 23:40:32 +01:00
commit da97f78e25
2 changed files with 13 additions and 10 deletions

View File

@ -331,7 +331,10 @@ abstract class ParserAbstract implements Parser
//$this->traceShift($this->errorSymbol); //$this->traceShift($this->errorSymbol);
++$stackPos; ++$stackPos;
$stateStack[$stackPos] = $state = $action; $stateStack[$stackPos] = $state = $action;
$this->endAttributes = $this->endAttributeStack[$stackPos];
// We treat the error symbol as being empty, so we reset the end attributes
// to the end attributes of the last non-error symbol
$this->endAttributes = $this->endAttributeStack[$stackPos - 1];
break; break;
case 3: case 3:

View File

@ -285,11 +285,11 @@ $foo->
Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1 Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1
array( array(
0: Stmt_Expression[2:1 - 3:1]( 0: Stmt_Expression[2:1 - 3:1](
expr: Expr_PropertyFetch[2:1 - 3:1]( expr: Expr_PropertyFetch[2:1 - 2:6](
var: Expr_Variable[2:1 - 2:4]( var: Expr_Variable[2:1 - 2:4](
name: foo name: foo
) )
name: Expr_Error[3:1 - 3:1]( name: Expr_Error[3:1 - 2:6](
) )
) )
) )
@ -310,12 +310,12 @@ array(
) )
returnType: null returnType: null
stmts: array( stmts: array(
0: Stmt_Expression[3:5 - 3:10]( 0: Stmt_Expression[3:5 - 4:1](
expr: Expr_PropertyFetch[3:5 - 4:1]( expr: Expr_PropertyFetch[3:5 - 3:10](
var: Expr_Variable[3:5 - 3:8]( var: Expr_Variable[3:5 - 3:8](
name: bar name: bar
) )
name: Expr_Error[4:1 - 4:1]( name: Expr_Error[4:1 - 3:10](
) )
) )
) )
@ -348,8 +348,8 @@ new
Syntax error, unexpected EOF from 2:4 to 2:4 Syntax error, unexpected EOF from 2:4 to 2:4
array( array(
0: Stmt_Expression[2:1 - 2:4]( 0: Stmt_Expression[2:1 - 2:4](
expr: Expr_New[2:1 - 2:4]( expr: Expr_New[2:1 - 2:3](
class: Expr_Error[2:4 - 2:4]( class: Expr_Error[2:4 - 2:3](
) )
args: array( args: array(
) )
@ -917,8 +917,8 @@ array(
) )
) )
args: array( args: array(
0: Arg[3:5 - 3:10]( 0: Arg[3:5 - 3:9](
value: Expr_ClassConstFetch[3:5 - 3:10]( value: Expr_ClassConstFetch[3:5 - 3:9](
class: Name[3:5 - 3:7]( class: Name[3:5 - 3:7](
parts: array( parts: array(
0: Bar 0: Bar