mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Avoid default action for error production
error is not necessarily going to have a semantic value, make sure that the default action $$=$1 is not used. Fixes #551.
This commit is contained in:
parent
ebf6b1c33b
commit
f42bbc2403
@ -959,6 +959,7 @@ array_pair_list:
|
||||
comma_or_error:
|
||||
','
|
||||
| error
|
||||
{ /* do nothing -- prevent default action of $$=$1. See #551. */ }
|
||||
;
|
||||
|
||||
inner_array_pair_list:
|
||||
|
@ -2361,7 +2361,7 @@ class Php7 extends \PhpParser\ParserAbstract
|
||||
$this->semValue = $this->semStack[$stackPos];
|
||||
},
|
||||
498 => function ($stackPos) {
|
||||
$this->semValue = $this->semStack[$stackPos];
|
||||
/* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */
|
||||
},
|
||||
499 => function ($stackPos) {
|
||||
$this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)];
|
||||
|
@ -1400,4 +1400,10 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
$a = ["a "thing"];
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_STRING, expecting ',' or ')' or ']' from 2:11 to 2:15
|
Loading…
Reference in New Issue
Block a user