3 class TPC_yyToken
implements ArrayAccess
8 public $metadata = array();
10 public function __construct($s, $m = array())
12 if ($s instanceof TPC_yyToken
) {
13 $this->string = $s->string;
14 $this->metadata
= $s->metadata
;
16 $this->string = (string) $s;
17 if ($m instanceof TPC_yyToken
) {
18 $this->metadata
= $m->metadata
;
19 } elseif (is_array($m)) {
25 public function __toString()
30 public function offsetExists($offset)
32 return isset($this->metadata
[$offset]);
35 public function offsetGet($offset)
37 return $this->metadata
[$offset];
40 public function offsetSet($offset, $value)
42 if ($offset === null) {
43 if (isset($value[0])) {
44 $x = ($value instanceof TPC_yyToken
) ?
$value->metadata
: $value;
45 $this->metadata
= array_merge($this->metadata
, $x);
49 $offset = count($this->metadata
);
51 if ($value === null) {
54 if ($value instanceof TPC_yyToken
) {
55 if ($value->metadata
) {
56 $this->metadata
[$offset] = $value->metadata
;
59 $this->metadata
[$offset] = $value;
63 public function offsetUnset($offset)
65 unset($this->metadata
[$offset]);
69 class TPC_yyStackEntry
72 public $stateno; /* The state-number */
73 public $major; /* The major token value. This is the code
74 ** number for the token at this stack level */
75 public $minor; /* The user-supplied minor token value. This
76 ** is the value of the token */
81 #line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
84 * Smarty Internal Plugin Configfileparse
86 * This is the config file parser.
87 * It is generated from the smarty_internal_configfileparser.y file
90 * @subpackage Compiler
93 class Smarty_Internal_Configfileparser
95 #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
102 public $successful = true;
109 public $retvalue = 0;
119 * @var Smarty_Internal_Configfilelexer
124 * internal error flag
128 private $internalError = false;
133 * @var Smarty_Internal_Config_File_Compiler
135 public $compiler = null;
142 public $smarty = null;
145 * copy of config_overwrite property
149 private $configOverwrite = false;
152 * copy of config_read_hidden property
156 private $configReadHidden = false;
163 private static $escapes_single = Array('\\' => '\\', '\'' => '\'');
168 * @param Smarty_Internal_Configfilelexer $lex
169 * @param Smarty_Internal_Config_File_Compiler $compiler
171 function __construct(Smarty_Internal_Configfilelexer
$lex, Smarty_Internal_Config_File_Compiler
$compiler)
173 // set instance object
174 self
::instance($this);
176 $this->smarty
= $compiler->smarty
;
177 $this->compiler
= $compiler;
178 $this->configOverwrite
= $this->smarty
->config_overwrite
;
179 $this->configReadHidden
= $this->smarty
->config_read_hidden
;
183 * @param null $new_instance
187 public static function &instance($new_instance = null)
189 static $instance = null;
190 if (isset($new_instance) && is_object($new_instance)) {
191 $instance = $new_instance;
197 * parse optional boolean keywords
203 private function parse_bool($str)
205 $str = strtolower($str);
206 if (in_array($str, array('on', 'yes', 'true'))) {
215 * parse single quoted string
216 * remove outer quotes
217 * unescape inner quotes
219 * @param string $qstr
223 private static function parse_single_quoted_string($qstr)
225 $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
227 $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE
);
230 foreach ($ss as $s) {
231 if (strlen($s) === 2 && $s[0] === '\\') {
232 if (isset(self
::$escapes_single[$s[1]])) {
233 $s = self
::$escapes_single[$s[1]];
242 * parse double quoted string
244 * @param string $qstr
248 private static function parse_double_quoted_string($qstr)
250 $inner_str = substr($qstr, 1, strlen($qstr) - 2);
251 return stripcslashes($inner_str);
255 * parse triple quoted string
257 * @param string $qstr
261 private static function parse_tripple_double_quoted_string($qstr)
263 return stripcslashes($qstr);
267 * set a config variable in target array
270 * @param array $target_array
272 private function set_var(Array $var, Array &$target_array)
275 $value = $var["value"];
277 if ($this->configOverwrite ||
!isset($target_array['vars'][$key])) {
278 $target_array['vars'][$key] = $value;
280 settype($target_array['vars'][$key], 'array');
281 $target_array['vars'][$key][] = $value;
286 * add config variable to global vars
290 private function add_global_vars(Array $vars)
292 if (!isset($this->compiler
->config_data
['vars'])) {
293 $this->compiler
->config_data
['vars'] = Array();
295 foreach ($vars as $var) {
296 $this->set_var($var, $this->compiler
->config_data
);
301 * add config variable to section
303 * @param string $section_name
306 private function add_section_vars($section_name, Array $vars)
308 if (!isset($this->compiler
->config_data
['sections'][$section_name]['vars'])) {
309 $this->compiler
->config_data
['sections'][$section_name]['vars'] = Array();
311 foreach ($vars as $var) {
312 $this->set_var($var, $this->compiler
->config_data
['sections'][$section_name]);
318 const TPC_SECTION
= 2;
320 const TPC_CLOSEB
= 3;
334 const TPC_SINGLE_QUOTED_STRING
= 10;
336 const TPC_DOUBLE_QUOTED_STRING
= 11;
338 const TPC_TRIPPLE_QUOTES
= 12;
340 const TPC_TRIPPLE_TEXT
= 13;
342 const TPC_TRIPPLE_QUOTES_END
= 14;
344 const TPC_NAKED_STRING
= 15;
346 const TPC_OTHER
= 16;
348 const TPC_NEWLINE
= 17;
350 const TPC_COMMENTSTART
= 18;
352 const YY_NO_ACTION
= 60;
354 const YY_ACCEPT_ACTION
= 59;
356 const YY_ERROR_ACTION
= 58;
358 const YY_SZ_ACTTAB
= 38;
360 static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15, 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
362 static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15, 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
364 const YY_SHIFT_USE_DFLT
= - 8;
366 const YY_SHIFT_MAX
= 19;
368 static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, 20,);
370 const YY_REDUCE_USE_DFLT
= - 21;
372 const YY_REDUCE_MAX
= 10;
374 static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
376 static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), array(1,), array(), array(), array(), array(2, 4,), array(15, 17,), array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,), array(6,), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(),);
378 static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
382 const YYSTACKDEPTH
= 100;
388 const YYERRORSYMBOL
= 19;
390 const YYERRSYMDT
= 'yy0';
392 const YYFALLBACK
= 0;
394 public static $yyFallback = array();
396 public function Trace($TraceFILE, $zTracePrompt)
400 } elseif (!$zTracePrompt) {
403 $this->yyTraceFILE
= $TraceFILE;
404 $this->yyTracePrompt
= $zTracePrompt;
407 public function PrintTrace()
409 $this->yyTraceFILE
= fopen('php://output', 'w');
410 $this->yyTracePrompt
= '<br>';
415 public $yyTracePrompt;
417 public $yyidx; /* Index of top element in stack */
418 public $yyerrcnt; /* Shifts left before out of the error */
419 public $yystack = array(); /* The parser's stack */
421 public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
423 public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list', 'sections ::= sections section', 'sections ::=', 'section ::= OPENB SECTION CLOSEB newline var_list', 'section ::= OPENB DOT SECTION CLOSEB newline var_list', 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=', 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL', 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING', 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING', 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE', 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
425 public function tokenName($tokenType)
427 if ($tokenType === 0) {
428 return 'End of Input';
430 if ($tokenType > 0 && $tokenType < count($this->yyTokenName
)) {
431 return $this->yyTokenName
[$tokenType];
437 public static function yy_destructor($yymajor, $yypminor)
441 break; /* If no destructor action specified: do nothing */
445 public function yy_pop_parser_stack()
447 if (empty($this->yystack
)) {
450 $yytos = array_pop($this->yystack
);
451 if ($this->yyTraceFILE
&& $this->yyidx
>= 0) {
452 fwrite($this->yyTraceFILE
, $this->yyTracePrompt
. 'Popping ' . $this->yyTokenName
[$yytos->major
] . "\n");
454 $yymajor = $yytos->major
;
455 self
::yy_destructor($yymajor, $yytos->minor
);
461 public function __destruct()
463 while ($this->yystack
!== Array()) {
464 $this->yy_pop_parser_stack();
466 if (is_resource($this->yyTraceFILE
)) {
467 fclose($this->yyTraceFILE
);
471 public function yy_get_expected_tokens($token)
473 static $res3 = array();
474 static $res4 = array();
475 $state = $this->yystack
[$this->yyidx
]->stateno
;
476 $expected = self
::$yyExpectedTokens[$state];
477 if (isset($res3[$state][$token])) {
478 if ($res3[$state][$token]) {
482 if ($res3[$state][$token] = in_array($token, self
::$yyExpectedTokens[$state], true)) {
486 $stack = $this->yystack
;
487 $yyidx = $this->yyidx
;
489 $yyact = $this->yy_find_shift_action($token);
490 if ($yyact >= self
::YYNSTATE
&& $yyact < self
::YYNSTATE + self
::YYNRULE
) {
494 if ($done ++
== 100) {
495 $this->yyidx
= $yyidx;
496 $this->yystack
= $stack;
497 // too much recursion prevents proper detection
499 return array_unique($expected);
501 $yyruleno = $yyact - self
::YYNSTATE
;
502 $this->yyidx
-= self
::$yyRuleInfo[$yyruleno][1];
503 $nextstate = $this->yy_find_reduce_action($this->yystack
[$this->yyidx
]->stateno
, self
::$yyRuleInfo[$yyruleno][0]);
504 if (isset(self
::$yyExpectedTokens[$nextstate])) {
505 $expected = array_merge($expected, self
::$yyExpectedTokens[$nextstate]);
506 if (isset($res4[$nextstate][$token])) {
507 if ($res4[$nextstate][$token]) {
508 $this->yyidx
= $yyidx;
509 $this->yystack
= $stack;
510 return array_unique($expected);
513 if ($res4[$nextstate][$token] = in_array($token, self
::$yyExpectedTokens[$nextstate], true)) {
514 $this->yyidx
= $yyidx;
515 $this->yystack
= $stack;
516 return array_unique($expected);
520 if ($nextstate < self
::YYNSTATE
) {
521 // we need to shift a non-terminal
523 $x = new TPC_yyStackEntry
;
524 $x->stateno
= $nextstate;
525 $x->major
= self
::$yyRuleInfo[$yyruleno][0];
526 $this->yystack
[$this->yyidx
] = $x;
528 } elseif ($nextstate == self
::YYNSTATE + self
::YYNRULE +
1) {
529 $this->yyidx
= $yyidx;
530 $this->yystack
= $stack;
531 // the last token was just ignored, we can't accept
532 // by ignoring input, this is in essence ignoring a
534 return array_unique($expected);
535 } elseif ($nextstate === self
::YY_NO_ACTION
) {
536 $this->yyidx
= $yyidx;
537 $this->yystack
= $stack;
538 // input accepted, but not shifted (I guess)
547 $this->yyidx
= $yyidx;
548 $this->yystack
= $stack;
550 return array_unique($expected);
553 public function yy_is_expected_token($token)
555 static $res = array();
556 static $res2 = array();
558 return true; // 0 is not part of this
560 $state = $this->yystack
[$this->yyidx
]->stateno
;
561 if (isset($res[$state][$token])) {
562 if ($res[$state][$token]) {
566 if ($res[$state][$token] = in_array($token, self
::$yyExpectedTokens[$state], true)) {
570 $stack = $this->yystack
;
571 $yyidx = $this->yyidx
;
573 $yyact = $this->yy_find_shift_action($token);
574 if ($yyact >= self
::YYNSTATE
&& $yyact < self
::YYNSTATE + self
::YYNRULE
) {
578 if ($done ++
== 100) {
579 $this->yyidx
= $yyidx;
580 $this->yystack
= $stack;
581 // too much recursion prevents proper detection
585 $yyruleno = $yyact - self
::YYNSTATE
;
586 $this->yyidx
-= self
::$yyRuleInfo[$yyruleno][1];
587 $nextstate = $this->yy_find_reduce_action($this->yystack
[$this->yyidx
]->stateno
, self
::$yyRuleInfo[$yyruleno][0]);
588 if (isset($res2[$nextstate][$token])) {
589 if ($res2[$nextstate][$token]) {
590 $this->yyidx
= $yyidx;
591 $this->yystack
= $stack;
595 if ($res2[$nextstate][$token] = (isset(self
::$yyExpectedTokens[$nextstate]) && in_array($token, self
::$yyExpectedTokens[$nextstate], true))) {
596 $this->yyidx
= $yyidx;
597 $this->yystack
= $stack;
601 if ($nextstate < self
::YYNSTATE
) {
602 // we need to shift a non-terminal
604 $x = new TPC_yyStackEntry
;
605 $x->stateno
= $nextstate;
606 $x->major
= self
::$yyRuleInfo[$yyruleno][0];
607 $this->yystack
[$this->yyidx
] = $x;
609 } elseif ($nextstate == self
::YYNSTATE + self
::YYNRULE +
1) {
610 $this->yyidx
= $yyidx;
611 $this->yystack
= $stack;
613 // end of input: this is valid
616 // the last token was just ignored, we can't accept
617 // by ignoring input, this is in essence ignoring a
620 } elseif ($nextstate === self
::YY_NO_ACTION
) {
621 $this->yyidx
= $yyidx;
622 $this->yystack
= $stack;
623 // input accepted, but not shifted (I guess)
632 $this->yyidx
= $yyidx;
633 $this->yystack
= $stack;
638 public function yy_find_shift_action($iLookAhead)
640 $stateno = $this->yystack
[$this->yyidx
]->stateno
;
642 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
643 if (!isset(self
::$yy_shift_ofst[$stateno])) {
645 return self
::$yy_default[$stateno];
647 $i = self
::$yy_shift_ofst[$stateno];
648 if ($i === self
::YY_SHIFT_USE_DFLT
) {
649 return self
::$yy_default[$stateno];
651 if ($iLookAhead == self
::YYNOCODE
) {
652 return self
::YY_NO_ACTION
;
655 if ($i < 0 ||
$i >= self
::YY_SZ_ACTTAB || self
::$yy_lookahead[$i] != $iLookAhead) {
656 if (count(self
::$yyFallback) && $iLookAhead < count(self
::$yyFallback) && ($iFallback = self
::$yyFallback[$iLookAhead]) != 0) {
657 if ($this->yyTraceFILE
) {
658 fwrite($this->yyTraceFILE
, $this->yyTracePrompt
. "FALLBACK " . $this->yyTokenName
[$iLookAhead] . " => " . $this->yyTokenName
[$iFallback] . "\n");
661 return $this->yy_find_shift_action($iFallback);
664 return self
::$yy_default[$stateno];
666 return self
::$yy_action[$i];
670 public function yy_find_reduce_action($stateno, $iLookAhead)
672 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
674 if (!isset(self
::$yy_reduce_ofst[$stateno])) {
675 return self
::$yy_default[$stateno];
677 $i = self
::$yy_reduce_ofst[$stateno];
678 if ($i == self
::YY_REDUCE_USE_DFLT
) {
679 return self
::$yy_default[$stateno];
681 if ($iLookAhead == self
::YYNOCODE
) {
682 return self
::YY_NO_ACTION
;
685 if ($i < 0 ||
$i >= self
::YY_SZ_ACTTAB || self
::$yy_lookahead[$i] != $iLookAhead) {
686 return self
::$yy_default[$stateno];
688 return self
::$yy_action[$i];
692 public function yy_shift($yyNewState, $yyMajor, $yypMinor)
695 if ($this->yyidx
>= self
::YYSTACKDEPTH
) {
697 if ($this->yyTraceFILE
) {
698 fprintf($this->yyTraceFILE
, "%sStack Overflow!\n", $this->yyTracePrompt
);
700 while ($this->yyidx
>= 0) {
701 $this->yy_pop_parser_stack();
703 #line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
705 $this->internalError
= true;
706 $this->compiler
->trigger_config_file_error("Stack overflow in configfile parser");
710 $yytos = new TPC_yyStackEntry
;
711 $yytos->stateno
= $yyNewState;
712 $yytos->major
= $yyMajor;
713 $yytos->minor
= $yypMinor;
714 $this->yystack
[] = $yytos;
715 if ($this->yyTraceFILE
&& $this->yyidx
> 0) {
716 fprintf($this->yyTraceFILE
, "%sShift %d\n", $this->yyTracePrompt
, $yyNewState);
717 fprintf($this->yyTraceFILE
, "%sStack:", $this->yyTracePrompt
);
718 for ($i = 1; $i <= $this->yyidx
; $i ++
) {
719 fprintf($this->yyTraceFILE
, " %s", $this->yyTokenName
[$this->yystack
[$i]->major
]);
721 fwrite($this->yyTraceFILE
, "\n");
725 public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2), array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), array(0 => 25, 1 => 3),);
727 public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
729 #line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
732 $this->_retvalue
= null;
735 #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
738 $this->add_global_vars($this->yystack
[$this->yyidx +
0]->minor
);
739 $this->_retvalue
= null;
742 #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
745 $this->add_section_vars($this->yystack
[$this->yyidx +
- 3]->minor
, $this->yystack
[$this->yyidx +
0]->minor
);
746 $this->_retvalue
= null;
749 #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
752 if ($this->configReadHidden
) {
753 $this->add_section_vars($this->yystack
[$this->yyidx +
- 3]->minor
, $this->yystack
[$this->yyidx +
0]->minor
);
755 $this->_retvalue
= null;
758 #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
761 $this->_retvalue
= $this->yystack
[$this->yyidx +
- 1]->minor
;
764 #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
767 $this->_retvalue
= array_merge($this->yystack
[$this->yyidx +
- 1]->minor
, Array($this->yystack
[$this->yyidx +
0]->minor
));
770 #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
773 $this->_retvalue
= Array();
776 #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
779 $this->_retvalue
= Array("key" => $this->yystack
[$this->yyidx +
- 2]->minor
, "value" => $this->yystack
[$this->yyidx +
0]->minor
);
782 #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
785 $this->_retvalue
= (float) $this->yystack
[$this->yyidx +
0]->minor
;
788 #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
791 $this->_retvalue
= (int) $this->yystack
[$this->yyidx +
0]->minor
;
794 #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
797 $this->_retvalue
= $this->parse_bool($this->yystack
[$this->yyidx +
0]->minor
);
800 #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
803 $this->_retvalue
= self
::parse_single_quoted_string($this->yystack
[$this->yyidx +
0]->minor
);
806 #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
809 $this->_retvalue
= self
::parse_double_quoted_string($this->yystack
[$this->yyidx +
0]->minor
);
812 #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
815 $this->_retvalue
= self
::parse_tripple_double_quoted_string($this->yystack
[$this->yyidx +
- 1]->minor
);
818 #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
821 $this->_retvalue
= '';
824 #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
827 $this->_retvalue
= $this->yystack
[$this->yyidx +
0]->minor
;
832 public function yy_reduce($yyruleno)
834 if ($this->yyTraceFILE
&& $yyruleno >= 0 && $yyruleno < count(self
::$yyRuleName)) {
835 fprintf($this->yyTraceFILE
, "%sReduce (%d) [%s].\n", $this->yyTracePrompt
, $yyruleno, self
::$yyRuleName[$yyruleno]);
838 $this->_retvalue
= $yy_lefthand_side = null;
839 if (isset(self
::$yyReduceMap[$yyruleno])) {
841 $this->_retvalue
= null;
842 $this->{'yy_r' . self
::$yyReduceMap[$yyruleno]}();
843 $yy_lefthand_side = $this->_retvalue
;
845 $yygoto = self
::$yyRuleInfo[$yyruleno][0];
846 $yysize = self
::$yyRuleInfo[$yyruleno][1];
847 $this->yyidx
-= $yysize;
848 for ($i = $yysize; $i; $i --) {
849 // pop all of the right-hand side parameters
850 array_pop($this->yystack
);
852 $yyact = $this->yy_find_reduce_action($this->yystack
[$this->yyidx
]->stateno
, $yygoto);
853 if ($yyact < self
::YYNSTATE
) {
854 if (!$this->yyTraceFILE
&& $yysize) {
856 $x = new TPC_yyStackEntry
;
857 $x->stateno
= $yyact;
859 $x->minor
= $yy_lefthand_side;
860 $this->yystack
[$this->yyidx
] = $x;
862 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
864 } elseif ($yyact == self
::YYNSTATE + self
::YYNRULE +
1) {
869 public function yy_parse_failed()
871 if ($this->yyTraceFILE
) {
872 fprintf($this->yyTraceFILE
, "%sFail!\n", $this->yyTracePrompt
);
874 while ($this->yyidx
>= 0) {
875 $this->yy_pop_parser_stack();
879 public function yy_syntax_error($yymajor, $TOKEN)
881 #line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
883 $this->internalError
= true;
884 $this->yymajor
= $yymajor;
885 $this->compiler
->trigger_config_file_error();
888 public function yy_accept()
890 if ($this->yyTraceFILE
) {
891 fprintf($this->yyTraceFILE
, "%sAccept!\n", $this->yyTracePrompt
);
893 while ($this->yyidx
>= 0) {
894 $this->yy_pop_parser_stack();
896 #line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
898 $this->successful
= !$this->internalError
;
899 $this->internalError
= false;
900 $this->retvalue
= $this->_retvalue
;
903 public function doParse($yymajor, $yytokenvalue)
905 $yyerrorhit = 0; /* True if yymajor has invoked an error */
907 if ($this->yyidx
=== null ||
$this->yyidx
< 0) {
909 $this->yyerrcnt
= - 1;
910 $x = new TPC_yyStackEntry
;
913 $this->yystack
= array();
914 $this->yystack
[] = $x;
916 $yyendofinput = ($yymajor == 0);
918 if ($this->yyTraceFILE
) {
919 fprintf($this->yyTraceFILE
, "%sInput %s\n", $this->yyTracePrompt
, $this->yyTokenName
[$yymajor]);
923 $yyact = $this->yy_find_shift_action($yymajor);
924 if ($yymajor < self
::YYERRORSYMBOL
&& !$this->yy_is_expected_token($yymajor)) {
925 // force a syntax error
926 $yyact = self
::YY_ERROR_ACTION
;
928 if ($yyact < self
::YYNSTATE
) {
929 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
931 if ($yyendofinput && $this->yyidx
>= 0) {
934 $yymajor = self
::YYNOCODE
;
936 } elseif ($yyact < self
::YYNSTATE + self
::YYNRULE
) {
937 $this->yy_reduce($yyact - self
::YYNSTATE
);
938 } elseif ($yyact == self
::YY_ERROR_ACTION
) {
939 if ($this->yyTraceFILE
) {
940 fprintf($this->yyTraceFILE
, "%sSyntax Error!\n", $this->yyTracePrompt
);
942 if (self
::YYERRORSYMBOL
) {
943 if ($this->yyerrcnt
< 0) {
944 $this->yy_syntax_error($yymajor, $yytokenvalue);
946 $yymx = $this->yystack
[$this->yyidx
]->major
;
947 if ($yymx == self
::YYERRORSYMBOL ||
$yyerrorhit) {
948 if ($this->yyTraceFILE
) {
949 fprintf($this->yyTraceFILE
, "%sDiscard input token %s\n", $this->yyTracePrompt
, $this->yyTokenName
[$yymajor]);
951 $this->yy_destructor($yymajor, $yytokenvalue);
952 $yymajor = self
::YYNOCODE
;
954 while ($this->yyidx
>= 0 && $yymx != self
::YYERRORSYMBOL
&& ($yyact = $this->yy_find_shift_action(self
::YYERRORSYMBOL
)) >= self
::YYNSTATE
) {
955 $this->yy_pop_parser_stack();
957 if ($this->yyidx
< 0 ||
$yymajor == 0) {
958 $this->yy_destructor($yymajor, $yytokenvalue);
959 $this->yy_parse_failed();
960 $yymajor = self
::YYNOCODE
;
961 } elseif ($yymx != self
::YYERRORSYMBOL
) {
963 $this->yy_shift($yyact, self
::YYERRORSYMBOL
, $u2);
969 if ($this->yyerrcnt
<= 0) {
970 $this->yy_syntax_error($yymajor, $yytokenvalue);
973 $this->yy_destructor($yymajor, $yytokenvalue);
975 $this->yy_parse_failed();
977 $yymajor = self
::YYNOCODE
;
981 $yymajor = self
::YYNOCODE
;
983 } while ($yymajor != self
::YYNOCODE
&& $this->yyidx
>= 0);