Use normal properties instead of static ones

This commit is contained in:
nikic 2014-04-20 00:34:31 +02:00
parent 0faa844a75
commit 1edbc89749
3 changed files with 65 additions and 65 deletions

View File

@ -30,57 +30,57 @@ class Parser extends ParserAbstract
const %s = %n;
#endtokenval
protected static $terminals = array(
protected $terminals = array(
#listvar terminals
, "???"
);
protected static $translate = array(
protected $translate = array(
#listvar yytranslate
);
protected static $yyaction = array(
protected $yyaction = array(
#listvar yyaction
);
protected static $yycheck = array(
protected $yycheck = array(
#listvar yycheck
);
protected static $yybase = array(
protected $yybase = array(
#listvar yybase
);
protected static $yydefault = array(
protected $yydefault = array(
#listvar yydefault
);
protected static $yygoto = array(
protected $yygoto = array(
#listvar yygoto
);
protected static $yygcheck = array(
protected $yygcheck = array(
#listvar yygcheck
);
protected static $yygbase = array(
protected $yygbase = array(
#listvar yygbase
);
protected static $yygdefault = array(
protected $yygdefault = array(
#listvar yygdefault
);
protected static $yylhs = array(
protected $yylhs = array(
#listvar yylhs
);
protected static $yylen = array(
protected $yylen = array(
#listvar yylen
);
#if -t
protected static $yyproduction = array(
protected $yyproduction = array(
#production-strings;
);
#endif

View File

@ -154,7 +154,7 @@ class Parser extends ParserAbstract
const T_NS_SEPARATOR = 387;
const T_ELLIPSIS = 388;
protected static $terminals = array(
protected $terminals = array(
"EOF",
"error",
"T_INCLUDE",
@ -312,7 +312,7 @@ class Parser extends ParserAbstract
, "???"
);
protected static $translate = array(
protected $translate = array(
0, 154, 154, 154, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
@ -354,7 +354,7 @@ class Parser extends ParserAbstract
136, 137, 138, 139, 140, 141, 142, 143, 144
);
protected static $yyaction = array(
protected $yyaction = array(
59, 60, 410, 61, 62,-32766,-32766,-32766,-32766, 63,
64, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
@ -467,7 +467,7 @@ class Parser extends ParserAbstract
899
);
protected static $yycheck = array(
protected $yycheck = array(
2, 3, 4, 5, 6, 28, 29, 30, 31, 11,
12, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
@ -580,7 +580,7 @@ class Parser extends ParserAbstract
152
);
protected static $yybase = array(
protected $yybase = array(
0, 763, 746, 780, 838, 851, 899, -1, 929, 834,
821, 230, 224, 925, 868, 881, 956, 956, 956, 956,
956, 468, 445, 434, 524, 434, 482, -2, -2, -2,
@ -686,7 +686,7 @@ class Parser extends ParserAbstract
0, 0, 245, 0, 0, 197
);
protected static $yydefault = array(
protected $yydefault = array(
3,32767,32767, 1,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767, 111, 103, 117, 102,
113,32767,32767,32767,32767,32767,32767,32767,32767,32767,
@ -752,7 +752,7 @@ class Parser extends ParserAbstract
156, 28, 28, 28, 28, 28
);
protected static $yygoto = array(
protected $yygoto = array(
168, 168, 138, 138, 143, 138, 139, 140, 141, 146,
148, 186, 170, 166, 166, 166, 166, 143, 143, 167,
167, 167, 167, 167, 167, 167, 167, 167, 167, 162,
@ -812,7 +812,7 @@ class Parser extends ParserAbstract
500, 0, 0, 0, 0, 0, 0, 0, 0, 523
);
protected static $yygcheck = array(
protected $yygcheck = array(
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
@ -872,7 +872,7 @@ class Parser extends ParserAbstract
4, -1, -1, -1, -1, -1, -1, -1, -1, 4
);
protected static $yygbase = array(
protected $yygbase = array(
0, 0, -361, 0, 145, -99, 458, 119, 195, -11,
-53, 1, -26, 216, -301, 0, 88, 0, 0, 0,
0, 0, 202, 0, 0, -30, 370, 0, 0, 196,
@ -887,7 +887,7 @@ class Parser extends ParserAbstract
0, 0, 0, 31, 0, 173, -117, 0
);
protected static $yygdefault = array(
protected $yygdefault = array(
-32768, 446, 3, 628, 463, 497, 655, 656, 657, 366,
365, 645, 651, 156, 4, 653, 866, 352, 660, 353,
563, 662, 509, 664, 665, 136, 464, 367, 368, 510,
@ -902,7 +902,7 @@ class Parser extends ParserAbstract
472, 361, 378, 1039, 421, 1046, 1053, 544
);
protected static $yylhs = array(
protected $yylhs = array(
0, 1, 2, 2, 4, 4, 5, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 9, 9,
11, 11, 11, 11, 10, 10, 12, 14, 14, 15,
@ -949,7 +949,7 @@ class Parser extends ParserAbstract
116, 116, 116, 116, 116, 116, 117, 117, 117
);
protected static $yylen = array(
protected $yylen = array(
1, 1, 2, 0, 1, 3, 1, 1, 1, 1,
1, 3, 5, 4, 3, 4, 4, 3, 3, 1,
1, 3, 2, 4, 3, 1, 3, 2, 0, 1,

View File

@ -21,23 +21,23 @@ abstract class ParserAbstract
const YYDEFAULT = 0;
/* @var array Map of token ids to their respective names */
protected static $terminals;
protected $terminals;
/* @var array Map which translates lexer tokens to internal tokens */
protected static $translate;
protected $translate;
protected static $yyaction;
protected static $yycheck;
protected static $yybase;
protected static $yydefault;
protected static $yygoto;
protected static $yygcheck;
protected static $yygbase;
protected static $yygdefault;
protected static $yylhs;
protected static $yylen;
protected $yyaction;
protected $yycheck;
protected $yybase;
protected $yydefault;
protected $yygoto;
protected $yygcheck;
protected $yygbase;
protected $yygdefault;
protected $yylhs;
protected $yylen;
/* This is optional data only necessary when debugging */
protected static $yyproduction;
protected $yyproduction;
/* End of dummy data */
@ -93,8 +93,8 @@ abstract class ParserAbstract
for (;;) {
//$this->traceNewState($state, $tokenId);
if (static::$yybase[$state] == 0) {
$yyn = static::$yydefault[$state];
if ($this->yybase[$state] == 0) {
$yyn = $this->yydefault[$state];
} else {
if ($tokenId === self::TOKEN_NONE) {
// Fetch the next token id from the lexer and fetch additional info by-ref.
@ -105,7 +105,7 @@ abstract class ParserAbstract
// map the lexer token id to the internally used token id's
$tokenId = $origTokenId >= 0 && $origTokenId < static::TOKEN_MAP_SIZE
? static::$translate[$origTokenId]
? $this->translate[$origTokenId]
: static::TOKEN_INVALID;
if ($tokenId === static::TOKEN_INVALID) {
@ -120,13 +120,13 @@ abstract class ParserAbstract
//$this->traceRead($tokenId);
}
if ((($yyn = static::$yybase[$state] + $tokenId) >= 0
&& $yyn < static::YYLAST && static::$yycheck[$yyn] == $tokenId
if ((($yyn = $this->yybase[$state] + $tokenId) >= 0
&& $yyn < static::YYLAST && $this->yycheck[$yyn] == $tokenId
|| ($state < static::YY2TBLSTATE
&& ($yyn = static::$yybase[$state + static::YYNLSTATES] + $tokenId) >= 0
&& ($yyn = $this->yybase[$state + static::YYNLSTATES] + $tokenId) >= 0
&& $yyn < static::YYLAST
&& static::$yycheck[$yyn] == $tokenId))
&& ($yyn = static::$yyaction[$yyn]) != static::YYDEFAULT) {
&& $this->yycheck[$yyn] == $tokenId))
&& ($yyn = $this->yyaction[$yyn]) != static::YYDEFAULT) {
/*
* >= YYNLSTATE: shift and reduce
* > 0: shift
@ -154,7 +154,7 @@ abstract class ParserAbstract
$yyn = -$yyn;
}
} else {
$yyn = static::$yydefault[$state];
$yyn = $this->yydefault[$state];
}
}
@ -170,7 +170,7 @@ abstract class ParserAbstract
try {
$this->{'yyn' . $yyn}(
$attributeStack[$this->stackPos - static::$yylen[$yyn]]
$attributeStack[$this->stackPos - $this->yylen[$yyn]]
+ $endAttributes
);
} catch (Error $e) {
@ -182,14 +182,14 @@ abstract class ParserAbstract
}
/* Goto - shift nonterminal */
$this->stackPos -= static::$yylen[$yyn];
$yyn = static::$yylhs[$yyn];
if (($yyp = static::$yygbase[$yyn] + $stateStack[$this->stackPos]) >= 0
$this->stackPos -= $this->yylen[$yyn];
$yyn = $this->yylhs[$yyn];
if (($yyp = $this->yygbase[$yyn] + $stateStack[$this->stackPos]) >= 0
&& $yyp < static::YYGLAST
&& static::$yygcheck[$yyp] == $yyn) {
$state = static::$yygoto[$yyp];
&& $this->yygcheck[$yyp] == $yyn) {
$state = $this->yygoto[$yyp];
} else {
$state = static::$yygdefault[$yyn];
$state = $this->yygdefault[$yyn];
}
++$this->stackPos;
@ -201,22 +201,22 @@ abstract class ParserAbstract
/* error */
$expected = array();
$base = static::$yybase[$state];
$base = $this->yybase[$state];
for ($i = 0; $i < static::TOKEN_MAP_SIZE; ++$i) {
$n = $base + $i;
if ($n >= 0 && $n < static::YYLAST && static::$yycheck[$n] == $i
if ($n >= 0 && $n < static::YYLAST && $this->yycheck[$n] == $i
|| $state < static::YY2TBLSTATE
&& ($n = static::$yybase[$state + static::YYNLSTATES] + $i) >= 0
&& $n < static::YYLAST && static::$yycheck[$n] == $i
&& ($n = $this->yybase[$state + static::YYNLSTATES] + $i) >= 0
&& $n < static::YYLAST && $this->yycheck[$n] == $i
) {
if (static::$yyaction[$n] != static::YYUNEXPECTED) {
if ($this->yyaction[$n] != static::YYUNEXPECTED) {
if (count($expected) == 4) {
/* Too many expected tokens */
$expected = array();
break;
}
$expected[] = static::$terminals[$i];
$expected[] = $this->terminals[$i];
}
}
}
@ -227,7 +227,7 @@ abstract class ParserAbstract
}
throw new Error(
'Syntax error, unexpected ' . static::$terminals[$tokenId] . $expectedString,
'Syntax error, unexpected ' . $this->terminals[$tokenId] . $expectedString,
$startAttributes['startLine']
);
}
@ -242,15 +242,15 @@ abstract class ParserAbstract
protected function traceNewState($state, $tokenId) {
echo '% State ' . $state
. ', Lookahead ' . ($tokenId == self::TOKEN_NONE ? '--none--' : static::$terminals[$tokenId]) . "\n";
. ', Lookahead ' . ($tokenId == self::TOKEN_NONE ? '--none--' : $this->terminals[$tokenId]) . "\n";
}
protected function traceRead($tokenId) {
echo '% Reading ' . static::$terminals[$tokenId] . "\n";
echo '% Reading ' . $this->terminals[$tokenId] . "\n";
}
protected function traceShift($tokenId) {
echo '% Shift ' . static::$terminals[$tokenId] . "\n";
echo '% Shift ' . $this->terminals[$tokenId] . "\n";
}
protected function traceAccept() {
@ -258,6 +258,6 @@ abstract class ParserAbstract
}
protected function traceReduce($n) {
echo '% Reduce by (' . $n . ') ' . static::$yyproduction[$n] . "\n";
echo '% Reduce by (' . $n . ') ' . $this->yyproduction[$n] . "\n";
}
}