mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-30 04:19:30 +01:00
Rename YYNLSTATES to numNonLeafStates
This commit is contained in:
parent
c59e75f873
commit
a75164c77e
@ -32,8 +32,8 @@ class #(-p) extends \PhpParser\ParserAbstract
|
||||
protected $defaultAction = #(YYDEFAULT);
|
||||
protected $unexpectedTokenRule = #(YYUNEXPECTED);
|
||||
|
||||
protected $YY2TBLSTATE = #(YY2TBLSTATE);
|
||||
protected $YYNLSTATES = #(YYNLSTATES);
|
||||
protected $YY2TBLSTATE = #(YY2TBLSTATE);
|
||||
protected $numNonLeafStates = #(YYNLSTATES);
|
||||
|
||||
protected $symbolToName = array(
|
||||
#listvar terminals
|
||||
|
@ -26,8 +26,8 @@ class Php5 extends \PhpParser\ParserAbstract
|
||||
protected $defaultAction = -32766;
|
||||
protected $unexpectedTokenRule = 32767;
|
||||
|
||||
protected $YY2TBLSTATE = 404;
|
||||
protected $YYNLSTATES = 669;
|
||||
protected $YY2TBLSTATE = 404;
|
||||
protected $numNonLeafStates = 669;
|
||||
|
||||
protected $symbolToName = array(
|
||||
"EOF",
|
||||
|
@ -26,8 +26,8 @@ class Php7 extends \PhpParser\ParserAbstract
|
||||
protected $defaultAction = -32766;
|
||||
protected $unexpectedTokenRule = 32767;
|
||||
|
||||
protected $YY2TBLSTATE = 328;
|
||||
protected $YYNLSTATES = 578;
|
||||
protected $YY2TBLSTATE = 328;
|
||||
protected $numNonLeafStates = 578;
|
||||
|
||||
protected $symbolToName = array(
|
||||
"EOF",
|
||||
|
@ -46,7 +46,8 @@ abstract class ParserAbstract implements Parser
|
||||
protected $unexpectedTokenRule;
|
||||
|
||||
protected $YY2TBLSTATE;
|
||||
protected $YYNLSTATES;
|
||||
/** @var int Number of non-leaf states */
|
||||
protected $numNonLeafStates;
|
||||
|
||||
/** @var int[] Map of lexer tokens to internal symbols */
|
||||
protected $tokenToSymbol;
|
||||
@ -231,11 +232,11 @@ abstract class ParserAbstract implements Parser
|
||||
$idx = $this->actionBase[$state] + $symbol;
|
||||
if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol)
|
||||
|| ($state < $this->YY2TBLSTATE
|
||||
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0
|
||||
&& ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0
|
||||
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol))
|
||||
&& ($action = $this->action[$idx]) !== $this->defaultAction) {
|
||||
/*
|
||||
* >= YYNLSTATES: shift and reduce
|
||||
* >= numNonLeafStates: shift and reduce
|
||||
* > 0: shift
|
||||
* = 0: accept
|
||||
* < 0: reduce
|
||||
@ -257,12 +258,12 @@ abstract class ParserAbstract implements Parser
|
||||
--$this->errorState;
|
||||
}
|
||||
|
||||
if ($action < $this->YYNLSTATES) {
|
||||
if ($action < $this->numNonLeafStates) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* $yyn >= YYNLSTATES means shift-and-reduce */
|
||||
$rule = $action - $this->YYNLSTATES;
|
||||
/* $yyn >= numNonLeafStates means shift-and-reduce */
|
||||
$rule = $action - $this->numNonLeafStates;
|
||||
} else {
|
||||
$rule = -$action;
|
||||
}
|
||||
@ -323,7 +324,7 @@ abstract class ParserAbstract implements Parser
|
||||
(($idx = $this->actionBase[$state] + $this->errorSymbol) >= 0
|
||||
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol)
|
||||
|| ($state < $this->YY2TBLSTATE
|
||||
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $this->errorSymbol) >= 0
|
||||
&& ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $this->errorSymbol) >= 0
|
||||
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol)
|
||||
) || ($action = $this->action[$idx]) === $this->defaultAction) { // Not totally sure about this
|
||||
if ($stackPos <= 0) {
|
||||
@ -356,12 +357,12 @@ abstract class ParserAbstract implements Parser
|
||||
}
|
||||
}
|
||||
|
||||
if ($state < $this->YYNLSTATES) {
|
||||
if ($state < $this->numNonLeafStates) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* >= YYNLSTATES means shift-and-reduce */
|
||||
$rule = $state - $this->YYNLSTATES;
|
||||
/* >= numNonLeafStates means shift-and-reduce */
|
||||
$rule = $state - $this->numNonLeafStates;
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,7 +405,7 @@ abstract class ParserAbstract implements Parser
|
||||
$idx = $base + $symbol;
|
||||
if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
|
||||
|| $state < $this->YY2TBLSTATE
|
||||
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0
|
||||
&& ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0
|
||||
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
|
||||
) {
|
||||
if ($this->action[$idx] !== $this->unexpectedTokenRule
|
||||
|
Loading…
Reference in New Issue
Block a user