1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-30 04:19:30 +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);
++$stackPos;
$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;
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
array(
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](
name: foo
)
name: Expr_Error[3:1 - 3:1](
name: Expr_Error[3:1 - 2:6](
)
)
)
@ -310,12 +310,12 @@ array(
)
returnType: null
stmts: array(
0: Stmt_Expression[3:5 - 3:10](
expr: Expr_PropertyFetch[3:5 - 4:1](
0: Stmt_Expression[3:5 - 4:1](
expr: Expr_PropertyFetch[3:5 - 3:10](
var: Expr_Variable[3:5 - 3:8](
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
array(
0: Stmt_Expression[2:1 - 2:4](
expr: Expr_New[2:1 - 2:4](
class: Expr_Error[2:4 - 2:4](
expr: Expr_New[2:1 - 2:3](
class: Expr_Error[2:4 - 2:3](
)
args: array(
)
@ -917,8 +917,8 @@ array(
)
)
args: array(
0: Arg[3:5 - 3:10](
value: Expr_ClassConstFetch[3:5 - 3:10](
0: Arg[3:5 - 3:9](
value: Expr_ClassConstFetch[3:5 - 3:9](
class: Name[3:5 - 3:7](
parts: array(
0: Bar