3 class TPC_yyToken implements ArrayAccess
7 public $metadata = array();
9 public function __construct($s, $m = array())
11 if ($s instanceof TPC_yyToken) {
12 $this->string = $s->string;
13 $this->metadata = $s->metadata;
15 $this->string = (string) $s;
16 if ($m instanceof TPC_yyToken) {
17 $this->metadata = $m->metadata;
18 } elseif (is_array($m)) {
24 public function __toString()
29 public function offsetExists($offset)
31 return isset($this->metadata[ $offset ]);
34 public function offsetGet($offset)
36 return $this->metadata[ $offset ];
39 public function offsetSet($offset, $value)
41 if ($offset === null) {
42 if (isset($value[ 0 ])) {
43 $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value;
44 $this->metadata = array_merge($this->metadata, $x);
48 $offset = count($this->metadata);
50 if ($value === null) {
53 if ($value instanceof TPC_yyToken) {
54 if ($value->metadata) {
55 $this->metadata[ $offset ] = $value->metadata;
58 $this->metadata[ $offset ] = $value;
62 public function offsetUnset($offset)
64 unset($this->metadata[ $offset ]);
68 class TPC_yyStackEntry
70 public $stateno; /* The state-number */
71 public $major; /* The major token value. This is the code
72 ** number for the token at this stack level */
73 public $minor; /* The user-supplied minor token value. This
74 ** is the value of the token */
79 #line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
82 * Smarty Internal Plugin Configfileparse
84 * This is the config file parser.
85 * It is generated from the smarty_internal_configfileparser.y file
88 * @subpackage Compiler
91 class Smarty_Internal_Configfileparser
93 #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
100 public $successful = true;
107 public $retvalue = 0;
117 * @var Smarty_Internal_Configfilelexer
122 * internal error flag
126 private $internalError = false;
131 * @var Smarty_Internal_Config_File_Compiler
133 public $compiler = null;
140 public $smarty = null;
143 * copy of config_overwrite property
147 private $configOverwrite = false;
150 * copy of config_read_hidden property
154 private $configReadHidden = false;
161 private static $escapes_single = Array('\\' => '\\', '\'' => '\'');
166 * @param Smarty_Internal_Configfilelexer $lex
167 * @param Smarty_Internal_Config_File_Compiler $compiler
169 function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
172 $this->smarty = $compiler->smarty;
173 $this->compiler = $compiler;
174 $this->configOverwrite = $this->smarty->config_overwrite;
175 $this->configReadHidden = $this->smarty->config_read_hidden;
179 * parse optional boolean keywords
185 private function parse_bool($str)
187 $str = strtolower($str);
188 if (in_array($str, array('on', 'yes', 'true'))) {
197 * parse single quoted string
198 * remove outer quotes
199 * unescape inner quotes
201 * @param string $qstr
205 private static function parse_single_quoted_string($qstr)
207 $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
209 $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
212 foreach ($ss as $s) {
213 if (strlen($s) === 2 && $s[ 0 ] === '\\') {
214 if (isset(self::$escapes_single[ $s[ 1 ] ])) {
215 $s = self::$escapes_single[ $s[ 1 ] ];
224 * parse double quoted string
226 * @param string $qstr
230 private static function parse_double_quoted_string($qstr)
232 $inner_str = substr($qstr, 1, strlen($qstr) - 2);
233 return stripcslashes($inner_str);
237 * parse triple quoted string
239 * @param string $qstr
243 private static function parse_tripple_double_quoted_string($qstr)
245 return stripcslashes($qstr);
249 * set a config variable in target array
252 * @param array $target_array
254 private function set_var(Array $var, Array &$target_array)
256 $key = $var[ "key" ];
257 $value = $var[ "value" ];
259 if ($this->configOverwrite || !isset($target_array[ 'vars' ][ $key ])) {
260 $target_array[ 'vars' ][ $key ] = $value;
262 settype($target_array[ 'vars' ][ $key ], 'array');
263 $target_array[ 'vars' ][ $key ][] = $value;
268 * add config variable to global vars
272 private function add_global_vars(Array $vars)
274 if (!isset($this->compiler->config_data[ 'vars' ])) {
275 $this->compiler->config_data[ 'vars' ] = Array();
277 foreach ($vars as $var) {
278 $this->set_var($var, $this->compiler->config_data);
283 * add config variable to section
285 * @param string $section_name
288 private function add_section_vars($section_name, Array $vars)
290 if (!isset($this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ])) {
291 $this->compiler->config_data[ 'sections' ][ $section_name ][ 'vars' ] = Array();
293 foreach ($vars as $var) {
294 $this->set_var($var, $this->compiler->config_data[ 'sections' ][ $section_name ]);
300 const TPC_SECTION = 2;
302 const TPC_CLOSEB = 3;
316 const TPC_SINGLE_QUOTED_STRING = 10;
318 const TPC_DOUBLE_QUOTED_STRING = 11;
320 const TPC_TRIPPLE_QUOTES = 12;
322 const TPC_TRIPPLE_TEXT = 13;
324 const TPC_TRIPPLE_QUOTES_END = 14;
326 const TPC_NAKED_STRING = 15;
328 const TPC_OTHER = 16;
330 const TPC_NEWLINE = 17;
332 const TPC_COMMENTSTART = 18;
334 const YY_NO_ACTION = 60;
336 const YY_ACCEPT_ACTION = 59;
338 const YY_ERROR_ACTION = 58;
340 const YY_SZ_ACTTAB = 38;
342 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,
343 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
345 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,
346 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
348 const YY_SHIFT_USE_DFLT = - 8;
350 const YY_SHIFT_MAX = 19;
352 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,
355 const YY_REDUCE_USE_DFLT = - 21;
357 const YY_REDUCE_MAX = 10;
359 static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
361 static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
362 array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,),
363 array(1,), array(), array(), array(), array(2, 4,), array(15, 17,),
364 array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
365 array(6,), array(), array(), array(), array(), array(), array(), array(),
366 array(), array(), array(), array(), array(), array(), array(), array(),
369 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,
370 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
374 const YYSTACKDEPTH = 100;
380 const YYERRORSYMBOL = 19;
382 const YYERRSYMDT = 'yy0';
384 const YYFALLBACK = 0;
386 public static $yyFallback = array();
388 public function Trace($TraceFILE, $zTracePrompt)
392 } elseif (!$zTracePrompt) {
395 $this->yyTraceFILE = $TraceFILE;
396 $this->yyTracePrompt = $zTracePrompt;
399 public function PrintTrace()
401 $this->yyTraceFILE = fopen('php://output', 'w');
402 $this->yyTracePrompt = '<br>';
407 public $yyTracePrompt;
409 public $yyidx; /* Index of top element in stack */
410 public $yyerrcnt; /* Shifts left before out of the error */
411 public $yystack = array(); /* The parser's stack */
413 public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
414 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT',
415 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
416 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
418 public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list',
419 'sections ::= sections section', 'sections ::=',
420 'section ::= OPENB SECTION CLOSEB newline var_list',
421 'section ::= OPENB DOT SECTION CLOSEB newline var_list',
422 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=',
423 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL',
424 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
425 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
426 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING',
427 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
428 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
430 public function tokenName($tokenType)
432 if ($tokenType === 0) {
433 return 'End of Input';
435 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
436 return $this->yyTokenName[ $tokenType ];
442 public static function yy_destructor($yymajor, $yypminor)
446 break; /* If no destructor action specified: do nothing */
450 public function yy_pop_parser_stack()
452 if (empty($this->yystack)) {
455 $yytos = array_pop($this->yystack);
456 if ($this->yyTraceFILE && $this->yyidx >= 0) {
457 fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . "\n");
459 $yymajor = $yytos->major;
460 self::yy_destructor($yymajor, $yytos->minor);
466 public function __destruct()
468 while ($this->yystack !== Array()) {
469 $this->yy_pop_parser_stack();
471 if (is_resource($this->yyTraceFILE)) {
472 fclose($this->yyTraceFILE);
476 public function yy_get_expected_tokens($token)
478 static $res3 = array();
479 static $res4 = array();
480 $state = $this->yystack[ $this->yyidx ]->stateno;
481 $expected = self::$yyExpectedTokens[ $state ];
482 if (isset($res3[ $state ][ $token ])) {
483 if ($res3[ $state ][ $token ]) {
487 if ($res3[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
491 $stack = $this->yystack;
492 $yyidx = $this->yyidx;
494 $yyact = $this->yy_find_shift_action($token);
495 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
499 if ($done ++ == 100) {
500 $this->yyidx = $yyidx;
501 $this->yystack = $stack;
502 // too much recursion prevents proper detection
504 return array_unique($expected);
506 $yyruleno = $yyact - self::YYNSTATE;
507 $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
508 $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
509 self::$yyRuleInfo[ $yyruleno ][ 0 ]);
510 if (isset(self::$yyExpectedTokens[ $nextstate ])) {
511 $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]);
512 if (isset($res4[ $nextstate ][ $token ])) {
513 if ($res4[ $nextstate ][ $token ]) {
514 $this->yyidx = $yyidx;
515 $this->yystack = $stack;
516 return array_unique($expected);
519 if ($res4[ $nextstate ][ $token ] =
520 in_array($token, self::$yyExpectedTokens[ $nextstate ], true)
522 $this->yyidx = $yyidx;
523 $this->yystack = $stack;
524 return array_unique($expected);
528 if ($nextstate < self::YYNSTATE) {
529 // we need to shift a non-terminal
531 $x = new TPC_yyStackEntry;
532 $x->stateno = $nextstate;
533 $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
534 $this->yystack[ $this->yyidx ] = $x;
536 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
537 $this->yyidx = $yyidx;
538 $this->yystack = $stack;
539 // the last token was just ignored, we can't accept
540 // by ignoring input, this is in essence ignoring a
542 return array_unique($expected);
543 } elseif ($nextstate === self::YY_NO_ACTION) {
544 $this->yyidx = $yyidx;
545 $this->yystack = $stack;
546 // input accepted, but not shifted (I guess)
557 $this->yyidx = $yyidx;
558 $this->yystack = $stack;
560 return array_unique($expected);
563 public function yy_is_expected_token($token)
565 static $res = array();
566 static $res2 = array();
568 return true; // 0 is not part of this
570 $state = $this->yystack[ $this->yyidx ]->stateno;
571 if (isset($res[ $state ][ $token ])) {
572 if ($res[ $state ][ $token ]) {
576 if ($res[ $state ][ $token ] = in_array($token, self::$yyExpectedTokens[ $state ], true)) {
580 $stack = $this->yystack;
581 $yyidx = $this->yyidx;
583 $yyact = $this->yy_find_shift_action($token);
584 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
588 if ($done ++ == 100) {
589 $this->yyidx = $yyidx;
590 $this->yystack = $stack;
591 // too much recursion prevents proper detection
595 $yyruleno = $yyact - self::YYNSTATE;
596 $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ];
597 $nextstate = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno,
598 self::$yyRuleInfo[ $yyruleno ][ 0 ]);
599 if (isset($res2[ $nextstate ][ $token ])) {
600 if ($res2[ $nextstate ][ $token ]) {
601 $this->yyidx = $yyidx;
602 $this->yystack = $stack;
606 if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) &&
607 in_array($token, self::$yyExpectedTokens[ $nextstate ],
610 $this->yyidx = $yyidx;
611 $this->yystack = $stack;
615 if ($nextstate < self::YYNSTATE) {
616 // we need to shift a non-terminal
618 $x = new TPC_yyStackEntry;
619 $x->stateno = $nextstate;
620 $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ];
621 $this->yystack[ $this->yyidx ] = $x;
623 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
624 $this->yyidx = $yyidx;
625 $this->yystack = $stack;
627 // end of input: this is valid
630 // the last token was just ignored, we can't accept
631 // by ignoring input, this is in essence ignoring a
634 } elseif ($nextstate === self::YY_NO_ACTION) {
635 $this->yyidx = $yyidx;
636 $this->yystack = $stack;
637 // input accepted, but not shifted (I guess)
648 $this->yyidx = $yyidx;
649 $this->yystack = $stack;
654 public function yy_find_shift_action($iLookAhead)
656 $stateno = $this->yystack[ $this->yyidx ]->stateno;
658 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
659 if (!isset(self::$yy_shift_ofst[ $stateno ])) {
661 return self::$yy_default[ $stateno ];
663 $i = self::$yy_shift_ofst[ $stateno ];
664 if ($i === self::YY_SHIFT_USE_DFLT) {
665 return self::$yy_default[ $stateno ];
667 if ($iLookAhead == self::YYNOCODE) {
668 return self::YY_NO_ACTION;
671 if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
672 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) &&
673 ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0
675 if ($this->yyTraceFILE) {
676 fwrite($this->yyTraceFILE,
677 $this->yyTracePrompt . "FALLBACK " . $this->yyTokenName[ $iLookAhead ] . " => " .
678 $this->yyTokenName[ $iFallback ] . "\n");
681 return $this->yy_find_shift_action($iFallback);
684 return self::$yy_default[ $stateno ];
686 return self::$yy_action[ $i ];
690 public function yy_find_reduce_action($stateno, $iLookAhead)
692 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
694 if (!isset(self::$yy_reduce_ofst[ $stateno ])) {
695 return self::$yy_default[ $stateno ];
697 $i = self::$yy_reduce_ofst[ $stateno ];
698 if ($i == self::YY_REDUCE_USE_DFLT) {
699 return self::$yy_default[ $stateno ];
701 if ($iLookAhead == self::YYNOCODE) {
702 return self::YY_NO_ACTION;
705 if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[ $i ] != $iLookAhead) {
706 return self::$yy_default[ $stateno ];
708 return self::$yy_action[ $i ];
712 public function yy_shift($yyNewState, $yyMajor, $yypMinor)
715 if ($this->yyidx >= self::YYSTACKDEPTH) {
717 if ($this->yyTraceFILE) {
718 fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
720 while ($this->yyidx >= 0) {
721 $this->yy_pop_parser_stack();
723 #line 239 "../smarty/lexer/smarty_internal_configfileparser.y"
725 $this->internalError = true;
726 $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
730 $yytos = new TPC_yyStackEntry;
731 $yytos->stateno = $yyNewState;
732 $yytos->major = $yyMajor;
733 $yytos->minor = $yypMinor;
734 $this->yystack[] = $yytos;
735 if ($this->yyTraceFILE && $this->yyidx > 0) {
736 fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt, $yyNewState);
737 fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
738 for ($i = 1; $i <= $this->yyidx; $i ++) {
739 fprintf($this->yyTraceFILE, " %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]);
741 fwrite($this->yyTraceFILE, "\n");
745 public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
746 array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6),
747 array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0),
748 array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
749 array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
750 array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1),
751 array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2),
752 array(0 => 25, 1 => 3),);
754 public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
755 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14,
756 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
758 #line 245 "../smarty/lexer/smarty_internal_configfileparser.y"
761 $this->_retvalue = null;
764 #line 250 "../smarty/lexer/smarty_internal_configfileparser.y"
767 $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
768 $this->_retvalue = null;
771 #line 264 "../smarty/lexer/smarty_internal_configfileparser.y"
774 $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
775 $this->_retvalue = null;
778 #line 269 "../smarty/lexer/smarty_internal_configfileparser.y"
781 if ($this->configReadHidden) {
782 $this->add_section_vars($this->yystack[ $this->yyidx + - 3 ]->minor,
783 $this->yystack[ $this->yyidx + 0 ]->minor);
785 $this->_retvalue = null;
788 #line 277 "../smarty/lexer/smarty_internal_configfileparser.y"
791 $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor;
794 #line 281 "../smarty/lexer/smarty_internal_configfileparser.y"
798 array_merge($this->yystack[ $this->yyidx + - 1 ]->minor, Array($this->yystack[ $this->yyidx + 0 ]->minor));
801 #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
804 $this->_retvalue = Array();
807 #line 291 "../smarty/lexer/smarty_internal_configfileparser.y"
810 $this->_retvalue = Array("key" => $this->yystack[ $this->yyidx + - 2 ]->minor,
811 "value" => $this->yystack[ $this->yyidx + 0 ]->minor);
814 #line 296 "../smarty/lexer/smarty_internal_configfileparser.y"
817 $this->_retvalue = (float) $this->yystack[ $this->yyidx + 0 ]->minor;
820 #line 300 "../smarty/lexer/smarty_internal_configfileparser.y"
823 $this->_retvalue = (int) $this->yystack[ $this->yyidx + 0 ]->minor;
826 #line 304 "../smarty/lexer/smarty_internal_configfileparser.y"
829 $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
832 #line 308 "../smarty/lexer/smarty_internal_configfileparser.y"
835 $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
838 #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
841 $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
844 #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
847 $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + - 1 ]->minor);
850 #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
853 $this->_retvalue = '';
856 #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
859 $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
864 public function yy_reduce($yyruleno)
866 if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) {
867 fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
868 self::$yyRuleName[ $yyruleno ]);
871 $this->_retvalue = $yy_lefthand_side = null;
872 if (isset(self::$yyReduceMap[ $yyruleno ])) {
874 $this->_retvalue = null;
875 $this->{'yy_r' . self::$yyReduceMap[ $yyruleno ]}();
876 $yy_lefthand_side = $this->_retvalue;
878 $yygoto = self::$yyRuleInfo[ $yyruleno ][ 0 ];
879 $yysize = self::$yyRuleInfo[ $yyruleno ][ 1 ];
880 $this->yyidx -= $yysize;
881 for ($i = $yysize; $i; $i --) {
882 // pop all of the right-hand side parameters
883 array_pop($this->yystack);
885 $yyact = $this->yy_find_reduce_action($this->yystack[ $this->yyidx ]->stateno, $yygoto);
886 if ($yyact < self::YYNSTATE) {
887 if (!$this->yyTraceFILE && $yysize) {
889 $x = new TPC_yyStackEntry;
890 $x->stateno = $yyact;
892 $x->minor = $yy_lefthand_side;
893 $this->yystack[ $this->yyidx ] = $x;
895 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
897 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
902 public function yy_parse_failed()
904 if ($this->yyTraceFILE) {
905 fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
907 while ($this->yyidx >= 0) {
908 $this->yy_pop_parser_stack();
912 public function yy_syntax_error($yymajor, $TOKEN)
914 #line 232 "../smarty/lexer/smarty_internal_configfileparser.y"
916 $this->internalError = true;
917 $this->yymajor = $yymajor;
918 $this->compiler->trigger_config_file_error();
921 public function yy_accept()
923 if ($this->yyTraceFILE) {
924 fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
926 while ($this->yyidx >= 0) {
927 $this->yy_pop_parser_stack();
929 #line 225 "../smarty/lexer/smarty_internal_configfileparser.y"
931 $this->successful = !$this->internalError;
932 $this->internalError = false;
933 $this->retvalue = $this->_retvalue;
936 public function doParse($yymajor, $yytokenvalue)
938 $yyerrorhit = 0; /* True if yymajor has invoked an error */
940 if ($this->yyidx === null || $this->yyidx < 0) {
942 $this->yyerrcnt = - 1;
943 $x = new TPC_yyStackEntry;
946 $this->yystack = array();
947 $this->yystack[] = $x;
949 $yyendofinput = ($yymajor == 0);
951 if ($this->yyTraceFILE) {
952 fprintf($this->yyTraceFILE, "%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
956 $yyact = $this->yy_find_shift_action($yymajor);
957 if ($yymajor < self::YYERRORSYMBOL && !$this->yy_is_expected_token($yymajor)) {
958 // force a syntax error
959 $yyact = self::YY_ERROR_ACTION;
961 if ($yyact < self::YYNSTATE) {
962 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
964 if ($yyendofinput && $this->yyidx >= 0) {
967 $yymajor = self::YYNOCODE;
969 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
970 $this->yy_reduce($yyact - self::YYNSTATE);
971 } elseif ($yyact == self::YY_ERROR_ACTION) {
972 if ($this->yyTraceFILE) {
973 fprintf($this->yyTraceFILE, "%sSyntax Error!\n", $this->yyTracePrompt);
975 if (self::YYERRORSYMBOL) {
976 if ($this->yyerrcnt < 0) {
977 $this->yy_syntax_error($yymajor, $yytokenvalue);
979 $yymx = $this->yystack[ $this->yyidx ]->major;
980 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
981 if ($this->yyTraceFILE) {
982 fprintf($this->yyTraceFILE, "%sDiscard input token %s\n", $this->yyTracePrompt,
983 $this->yyTokenName[ $yymajor ]);
985 $this->yy_destructor($yymajor, $yytokenvalue);
986 $yymajor = self::YYNOCODE;
988 while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL &&
989 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
990 $this->yy_pop_parser_stack();
992 if ($this->yyidx < 0 || $yymajor == 0) {
993 $this->yy_destructor($yymajor, $yytokenvalue);
994 $this->yy_parse_failed();
995 $yymajor = self::YYNOCODE;
996 } elseif ($yymx != self::YYERRORSYMBOL) {
998 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
1001 $this->yyerrcnt = 3;
1004 if ($this->yyerrcnt <= 0) {
1005 $this->yy_syntax_error($yymajor, $yytokenvalue);
1007 $this->yyerrcnt = 3;
1008 $this->yy_destructor($yymajor, $yytokenvalue);
1009 if ($yyendofinput) {
1010 $this->yy_parse_failed();
1012 $yymajor = self::YYNOCODE;
1016 $yymajor = self::YYNOCODE;
1019 while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);