2 class TPC_yyToken
implements ArrayAccess
5 public $metadata = array();
7 public function __construct($s, $m = array())
9 if ($s instanceof TPC_yyToken
) {
10 $this->string = $s->string;
11 $this->metadata
= $s->metadata
;
13 $this->string = (string) $s;
14 if ($m instanceof TPC_yyToken
) {
15 $this->metadata
= $m->metadata
;
16 } elseif (is_array($m)) {
22 public function __toString()
27 public function offsetExists($offset)
29 return isset($this->metadata
[$offset]);
32 public function offsetGet($offset)
34 return $this->metadata
[$offset];
37 public function offsetSet($offset, $value)
39 if ($offset === null) {
40 if (isset($value[0])) {
41 $x = ($value instanceof TPC_yyToken
) ?
42 $value->metadata
: $value;
43 $this->metadata
= array_merge($this->metadata
, $x);
47 $offset = count($this->metadata
);
49 if ($value === null) {
52 if ($value instanceof TPC_yyToken
) {
53 if ($value->metadata
) {
54 $this->metadata
[$offset] = $value->metadata
;
57 $this->metadata
[$offset] = $value;
61 public function offsetUnset($offset)
63 unset($this->metadata
[$offset]);
67 class TPC_yyStackEntry
69 public $stateno; /* The state-number */
70 public $major; /* The major token value. This is the code
71 ** number for the token at this stack level */
72 public $minor; /* The user-supplied minor token value. This
73 ** is the value of the token */
77 #line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
80 * Smarty Internal Plugin Configfileparse
82 * This is the config file parser.
83 * It is generated from the smarty_internal_configfileparser.y file
85 * @subpackage Compiler
88 class Smarty_Internal_Configfileparser
90 #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
97 public $successful = true;
103 public $retvalue = 0;
111 * @var Smarty_Internal_Configfilelexer
115 * internal error flag
119 private $internalError = false;
123 * @var Smarty_Internal_Config_File_Compiler
125 public $compiler = null;
131 public $smarty = null;
133 * copy of config_overwrite property
137 private $configOverwrite = false;
139 * copy of config_read_hidden property
143 private $configReadHidden = false;
149 private static $escapes_single = Array('\\' => '\\',
155 * @param Smarty_Internal_Configfilelexer $lex
156 * @param Smarty_Internal_Config_File_Compiler $compiler
158 function __construct(Smarty_Internal_Configfilelexer
$lex, Smarty_Internal_Config_File_Compiler
$compiler)
160 // set instance object
161 self
::instance($this);
163 $this->smarty
= $compiler->smarty
;
164 $this->compiler
= $compiler;
165 $this->configOverwrite
= $this->smarty
->config_overwrite
;
166 $this->configReadHidden
= $this->smarty
->config_read_hidden
;
170 * @param null $new_instance
174 public static function &instance($new_instance = null)
176 static $instance = null;
177 if (isset($new_instance) && is_object($new_instance)) {
178 $instance = $new_instance;
184 * parse optional boolean keywords
190 private function parse_bool($str)
192 $str = strtolower($str);
193 if (in_array($str, array('on', 'yes', 'true'))) {
202 * parse single quoted string
203 * remove outer quotes
204 * unescape inner quotes
206 * @param string $qstr
210 private static function parse_single_quoted_string($qstr)
212 $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
214 $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE
);
217 foreach ($ss as $s) {
218 if (strlen($s) === 2 && $s[0] === '\\') {
219 if (isset(self
::$escapes_single[$s[1]])) {
220 $s = self
::$escapes_single[$s[1]];
229 * parse double quoted string
231 * @param string $qstr
235 private static function parse_double_quoted_string($qstr)
237 $inner_str = substr($qstr, 1, strlen($qstr) - 2);
238 return stripcslashes($inner_str);
242 * parse triple quoted string
244 * @param string $qstr
248 private static function parse_tripple_double_quoted_string($qstr)
250 return stripcslashes($qstr);
254 * set a config variable in target array
257 * @param array $target_array
259 private function set_var(Array $var, Array &$target_array)
262 $value = $var["value"];
264 if ($this->configOverwrite ||
!isset($target_array['vars'][$key])) {
265 $target_array['vars'][$key] = $value;
267 settype($target_array['vars'][$key], 'array');
268 $target_array['vars'][$key][] = $value;
273 * add config variable to global vars
277 private function add_global_vars(Array $vars)
279 if (!isset($this->compiler
->config_data
['vars'])) {
280 $this->compiler
->config_data
['vars'] = Array();
282 foreach ($vars as $var) {
283 $this->set_var($var, $this->compiler
->config_data
);
288 * add config variable to section
290 * @param string $section_name
293 private function add_section_vars($section_name, Array $vars)
295 if (!isset($this->compiler
->config_data
['sections'][$section_name]['vars'])) {
296 $this->compiler
->config_data
['sections'][$section_name]['vars'] = Array();
298 foreach ($vars as $var) {
299 $this->set_var($var, $this->compiler
->config_data
['sections'][$section_name]);
304 const TPC_SECTION
= 2;
305 const TPC_CLOSEB
= 3;
312 const TPC_SINGLE_QUOTED_STRING
= 10;
313 const TPC_DOUBLE_QUOTED_STRING
= 11;
314 const TPC_TRIPPLE_QUOTES
= 12;
315 const TPC_TRIPPLE_TEXT
= 13;
316 const TPC_TRIPPLE_QUOTES_END
= 14;
317 const TPC_NAKED_STRING
= 15;
318 const TPC_OTHER
= 16;
319 const TPC_NEWLINE
= 17;
320 const TPC_COMMENTSTART
= 18;
321 const YY_NO_ACTION
= 60;
322 const YY_ACCEPT_ACTION
= 59;
323 const YY_ERROR_ACTION
= 58;
325 const YY_SZ_ACTTAB
= 38;
326 static public $yy_action = array(
327 29, 30, 34, 33, 24, 13, 19, 25, 35, 21,
328 59, 8, 3, 1, 20, 12, 14, 31, 20, 12,
329 15, 17, 23, 18, 27, 26, 4, 5, 6, 32,
330 2, 11, 28, 22, 16, 9, 7, 10,
332 static public $yy_lookahead = array(
333 7, 8, 9, 10, 11, 12, 5, 27, 15, 16,
334 20, 21, 23, 23, 17, 18, 13, 14, 17, 18,
335 15, 2, 17, 4, 25, 26, 6, 3, 3, 14,
336 23, 1, 24, 17, 2, 25, 22, 25,
338 const YY_SHIFT_USE_DFLT
= -8;
339 const YY_SHIFT_MAX
= 19;
340 static public $yy_shift_ofst = array(
341 -8, 1, 1, 1, -7, -3, -3, 30, -8, -8,
342 -8, 19, 5, 3, 15, 16, 24, 25, 32, 20,
344 const YY_REDUCE_USE_DFLT
= -21;
345 const YY_REDUCE_MAX
= 10;
346 static public $yy_reduce_ofst = array(
347 -10, -1, -1, -1, -20, 10, 12, 8, 14, 7,
350 static public $yyExpectedTokens = array(
355 array(7, 8, 9, 10, 11, 12, 15, 16, ),
388 static public $yy_default = array(
389 44, 37, 41, 40, 58, 58, 58, 36, 39, 44,
390 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
391 55, 54, 57, 56, 50, 45, 43, 42, 38, 46,
392 47, 52, 51, 49, 48, 53,
395 const YYSTACKDEPTH
= 100;
398 const YYERRORSYMBOL
= 19;
399 const YYERRSYMDT
= 'yy0';
400 const YYFALLBACK
= 0;
401 public static $yyFallback = array(
403 public function Trace($TraceFILE, $zTracePrompt)
407 } elseif (!$zTracePrompt) {
410 $this->yyTraceFILE
= $TraceFILE;
411 $this->yyTracePrompt
= $zTracePrompt;
414 public function PrintTrace()
416 $this->yyTraceFILE
= fopen('php://output', 'w');
417 $this->yyTracePrompt
= '<br>';
421 public $yyTracePrompt;
422 public $yyidx; /* Index of top element in stack */
423 public $yyerrcnt; /* Shifts left before out of the error */
424 public $yystack = array(); /* The parser's stack */
426 public $yyTokenName = array(
427 '$', 'OPENB', 'SECTION', 'CLOSEB',
428 'DOT', 'ID', 'EQUAL', 'FLOAT',
429 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
430 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING',
431 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
432 'start', 'global_vars', 'sections', 'var_list',
433 'section', 'newline', 'var', 'value',
436 public static $yyRuleName = array(
437 "start ::= global_vars sections",
438 "global_vars ::= var_list",
439 "sections ::= sections section",
441 "section ::= OPENB SECTION CLOSEB newline var_list",
442 "section ::= OPENB DOT SECTION CLOSEB newline var_list",
443 "var_list ::= var_list newline",
444 "var_list ::= var_list var",
446 "var ::= ID EQUAL value",
450 "value ::= SINGLE_QUOTED_STRING",
451 "value ::= DOUBLE_QUOTED_STRING",
452 "value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END",
453 "value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END",
454 "value ::= NAKED_STRING",
456 "newline ::= NEWLINE",
457 "newline ::= COMMENTSTART NEWLINE",
458 "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
461 public function tokenName($tokenType)
463 if ($tokenType === 0) {
464 return 'End of Input';
466 if ($tokenType > 0 && $tokenType < count($this->yyTokenName
)) {
467 return $this->yyTokenName
[$tokenType];
473 public static function yy_destructor($yymajor, $yypminor)
476 default: break; /* If no destructor action specified: do nothing */
480 public function yy_pop_parser_stack()
482 if (!count($this->yystack
)) {
485 $yytos = array_pop($this->yystack
);
486 if ($this->yyTraceFILE
&& $this->yyidx
>= 0) {
487 fwrite($this->yyTraceFILE
,
488 $this->yyTracePrompt
. 'Popping ' . $this->yyTokenName
[$yytos->major
] .
491 $yymajor = $yytos->major
;
492 self
::yy_destructor($yymajor, $yytos->minor
);
498 public function __destruct()
500 while ($this->yystack
!== Array()) {
501 $this->yy_pop_parser_stack();
503 if (is_resource($this->yyTraceFILE
)) {
504 fclose($this->yyTraceFILE
);
508 public function yy_get_expected_tokens($token)
510 $state = $this->yystack
[$this->yyidx
]->stateno
;
511 $expected = self
::$yyExpectedTokens[$state];
512 if (in_array($token, self
::$yyExpectedTokens[$state], true)) {
515 $stack = $this->yystack
;
516 $yyidx = $this->yyidx
;
518 $yyact = $this->yy_find_shift_action($token);
519 if ($yyact >= self
::YYNSTATE
&& $yyact < self
::YYNSTATE + self
::YYNRULE
) {
523 if ($done++
== 100) {
524 $this->yyidx
= $yyidx;
525 $this->yystack
= $stack;
526 // too much recursion prevents proper detection
528 return array_unique($expected);
530 $yyruleno = $yyact - self
::YYNSTATE
;
531 $this->yyidx
-= self
::$yyRuleInfo[$yyruleno][1];
532 $nextstate = $this->yy_find_reduce_action(
533 $this->yystack
[$this->yyidx
]->stateno
,
534 self
::$yyRuleInfo[$yyruleno][0]);
535 if (isset(self
::$yyExpectedTokens[$nextstate])) {
536 $expected = array_merge($expected, self
::$yyExpectedTokens[$nextstate]);
538 self
::$yyExpectedTokens[$nextstate], true)) {
539 $this->yyidx
= $yyidx;
540 $this->yystack
= $stack;
542 return array_unique($expected);
545 if ($nextstate < self
::YYNSTATE
) {
546 // we need to shift a non-terminal
548 $x = new TPC_yyStackEntry
;
549 $x->stateno
= $nextstate;
550 $x->major
= self
::$yyRuleInfo[$yyruleno][0];
551 $this->yystack
[$this->yyidx
] = $x;
553 } elseif ($nextstate == self
::YYNSTATE + self
::YYNRULE +
1) {
554 $this->yyidx
= $yyidx;
555 $this->yystack
= $stack;
556 // the last token was just ignored, we can't accept
557 // by ignoring input, this is in essence ignoring a
559 return array_unique($expected);
560 } elseif ($nextstate === self
::YY_NO_ACTION
) {
561 $this->yyidx
= $yyidx;
562 $this->yystack
= $stack;
563 // input accepted, but not shifted (I guess)
572 $this->yyidx
= $yyidx;
573 $this->yystack
= $stack;
575 return array_unique($expected);
578 public function yy_is_expected_token($token)
581 return true; // 0 is not part of this
583 $state = $this->yystack
[$this->yyidx
]->stateno
;
584 if (in_array($token, self
::$yyExpectedTokens[$state], true)) {
587 $stack = $this->yystack
;
588 $yyidx = $this->yyidx
;
590 $yyact = $this->yy_find_shift_action($token);
591 if ($yyact >= self
::YYNSTATE
&& $yyact < self
::YYNSTATE + self
::YYNRULE
) {
595 if ($done++
== 100) {
596 $this->yyidx
= $yyidx;
597 $this->yystack
= $stack;
598 // too much recursion prevents proper detection
602 $yyruleno = $yyact - self
::YYNSTATE
;
603 $this->yyidx
-= self
::$yyRuleInfo[$yyruleno][1];
604 $nextstate = $this->yy_find_reduce_action(
605 $this->yystack
[$this->yyidx
]->stateno
,
606 self
::$yyRuleInfo[$yyruleno][0]);
607 if (isset(self
::$yyExpectedTokens[$nextstate]) &&
608 in_array($token, self
::$yyExpectedTokens[$nextstate], true)) {
609 $this->yyidx
= $yyidx;
610 $this->yystack
= $stack;
614 if ($nextstate < self
::YYNSTATE
) {
615 // we need to shift a non-terminal
617 $x = new TPC_yyStackEntry
;
618 $x->stateno
= $nextstate;
619 $x->major
= self
::$yyRuleInfo[$yyruleno][0];
620 $this->yystack
[$this->yyidx
] = $x;
622 } elseif ($nextstate == self
::YYNSTATE + self
::YYNRULE +
1) {
623 $this->yyidx
= $yyidx;
624 $this->yystack
= $stack;
626 // end of input: this is valid
629 // the last token was just ignored, we can't accept
630 // by ignoring input, this is in essence ignoring a
633 } elseif ($nextstate === self
::YY_NO_ACTION
) {
634 $this->yyidx
= $yyidx;
635 $this->yystack
= $stack;
636 // input accepted, but not shifted (I guess)
645 $this->yyidx
= $yyidx;
646 $this->yystack
= $stack;
651 public function yy_find_shift_action($iLookAhead)
653 $stateno = $this->yystack
[$this->yyidx
]->stateno
;
655 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
656 if (!isset(self
::$yy_shift_ofst[$stateno])) {
658 return self
::$yy_default[$stateno];
660 $i = self
::$yy_shift_ofst[$stateno];
661 if ($i === self
::YY_SHIFT_USE_DFLT
) {
662 return self
::$yy_default[$stateno];
664 if ($iLookAhead == self
::YYNOCODE
) {
665 return self
::YY_NO_ACTION
;
668 if ($i < 0 ||
$i >= self
::YY_SZ_ACTTAB ||
669 self
::$yy_lookahead[$i] != $iLookAhead) {
670 if (count(self
::$yyFallback) && $iLookAhead < count(self
::$yyFallback)
671 && ($iFallback = self
::$yyFallback[$iLookAhead]) != 0) {
672 if ($this->yyTraceFILE
) {
673 fwrite($this->yyTraceFILE
, $this->yyTracePrompt
. "FALLBACK " .
674 $this->yyTokenName
[$iLookAhead] . " => " .
675 $this->yyTokenName
[$iFallback] . "\n");
678 return $this->yy_find_shift_action($iFallback);
681 return self
::$yy_default[$stateno];
683 return self
::$yy_action[$i];
687 public function yy_find_reduce_action($stateno, $iLookAhead)
689 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
691 if (!isset(self
::$yy_reduce_ofst[$stateno])) {
692 return self
::$yy_default[$stateno];
694 $i = self
::$yy_reduce_ofst[$stateno];
695 if ($i == self
::YY_REDUCE_USE_DFLT
) {
696 return self
::$yy_default[$stateno];
698 if ($iLookAhead == self
::YYNOCODE
) {
699 return self
::YY_NO_ACTION
;
702 if ($i < 0 ||
$i >= self
::YY_SZ_ACTTAB ||
703 self
::$yy_lookahead[$i] != $iLookAhead) {
704 return self
::$yy_default[$stateno];
706 return self
::$yy_action[$i];
710 public function yy_shift($yyNewState, $yyMajor, $yypMinor)
713 if ($this->yyidx
>= self
::YYSTACKDEPTH
) {
715 if ($this->yyTraceFILE
) {
716 fprintf($this->yyTraceFILE
, "%sStack Overflow!\n", $this->yyTracePrompt
);
718 while ($this->yyidx
>= 0) {
719 $this->yy_pop_parser_stack();
721 #line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
723 $this->internalError
= true;
724 $this->compiler
->trigger_config_file_error("Stack overflow in configfile parser");
728 $yytos = new TPC_yyStackEntry
;
729 $yytos->stateno
= $yyNewState;
730 $yytos->major
= $yyMajor;
731 $yytos->minor
= $yypMinor;
732 array_push($this->yystack
, $yytos);
733 if ($this->yyTraceFILE
&& $this->yyidx
> 0) {
734 fprintf($this->yyTraceFILE
, "%sShift %d\n", $this->yyTracePrompt
,
736 fprintf($this->yyTraceFILE
, "%sStack:", $this->yyTracePrompt
);
737 for ($i = 1; $i <= $this->yyidx
; $i++
) {
738 fprintf($this->yyTraceFILE
, " %s",
739 $this->yyTokenName
[$this->yystack
[$i]->major
]);
741 fwrite($this->yyTraceFILE
,"\n");
745 public static $yyRuleInfo = array(
746 array( 0 => 20, 1 => 2 ),
747 array( 0 => 21, 1 => 1 ),
748 array( 0 => 22, 1 => 2 ),
749 array( 0 => 22, 1 => 0 ),
750 array( 0 => 24, 1 => 5 ),
751 array( 0 => 24, 1 => 6 ),
752 array( 0 => 23, 1 => 2 ),
753 array( 0 => 23, 1 => 2 ),
754 array( 0 => 23, 1 => 0 ),
755 array( 0 => 26, 1 => 3 ),
756 array( 0 => 27, 1 => 1 ),
757 array( 0 => 27, 1 => 1 ),
758 array( 0 => 27, 1 => 1 ),
759 array( 0 => 27, 1 => 1 ),
760 array( 0 => 27, 1 => 1 ),
761 array( 0 => 27, 1 => 3 ),
762 array( 0 => 27, 1 => 2 ),
763 array( 0 => 27, 1 => 1 ),
764 array( 0 => 27, 1 => 1 ),
765 array( 0 => 25, 1 => 1 ),
766 array( 0 => 25, 1 => 2 ),
767 array( 0 => 25, 1 => 3 ),
770 public static $yyReduceMap = array(
794 #line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
796 $this->_retvalue
= null;
798 #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
800 $this->add_global_vars($this->yystack
[$this->yyidx +
0]->minor
);
801 $this->_retvalue
= null;
803 #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
805 $this->add_section_vars($this->yystack
[$this->yyidx +
-3]->minor
, $this->yystack
[$this->yyidx +
0]->minor
);
806 $this->_retvalue
= null;
808 #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
810 if ($this->configReadHidden
) {
811 $this->add_section_vars($this->yystack
[$this->yyidx +
-3]->minor
, $this->yystack
[$this->yyidx +
0]->minor
);
813 $this->_retvalue
= null;
815 #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
817 $this->_retvalue
= $this->yystack
[$this->yyidx +
-1]->minor
;
819 #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
821 $this->_retvalue
= array_merge($this->yystack
[$this->yyidx +
-1]->minor
, Array($this->yystack
[$this->yyidx +
0]->minor
));
823 #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
825 $this->_retvalue
= Array();
827 #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
829 $this->_retvalue
= Array("key" => $this->yystack
[$this->yyidx +
-2]->minor
, "value" => $this->yystack
[$this->yyidx +
0]->minor
);
831 #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
833 $this->_retvalue
= (float) $this->yystack
[$this->yyidx +
0]->minor
;
835 #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
837 $this->_retvalue
= (int) $this->yystack
[$this->yyidx +
0]->minor
;
839 #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
841 $this->_retvalue
= $this->parse_bool($this->yystack
[$this->yyidx +
0]->minor
);
843 #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
845 $this->_retvalue
= self
::parse_single_quoted_string($this->yystack
[$this->yyidx +
0]->minor
);
847 #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
849 $this->_retvalue
= self
::parse_double_quoted_string($this->yystack
[$this->yyidx +
0]->minor
);
851 #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
853 $this->_retvalue
= self
::parse_tripple_double_quoted_string($this->yystack
[$this->yyidx +
-1]->minor
);
855 #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
857 $this->_retvalue
= '';
859 #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
861 $this->_retvalue
= $this->yystack
[$this->yyidx +
0]->minor
;
866 public function yy_reduce($yyruleno)
868 $yymsp = $this->yystack
[$this->yyidx
];
869 if ($this->yyTraceFILE
&& $yyruleno >= 0
870 && $yyruleno < count(self
::$yyRuleName)) {
871 fprintf($this->yyTraceFILE
, "%sReduce (%d) [%s].\n",
872 $this->yyTracePrompt
, $yyruleno,
873 self
::$yyRuleName[$yyruleno]);
876 $this->_retvalue
= $yy_lefthand_side = null;
877 if (array_key_exists($yyruleno, self
::$yyReduceMap)) {
879 $this->_retvalue
= null;
880 $this->{'yy_r' . self
::$yyReduceMap[$yyruleno]}();
881 $yy_lefthand_side = $this->_retvalue
;
883 $yygoto = self
::$yyRuleInfo[$yyruleno][0];
884 $yysize = self
::$yyRuleInfo[$yyruleno][1];
885 $this->yyidx
-= $yysize;
886 for ($i = $yysize; $i; $i--) {
887 // pop all of the right-hand side parameters
888 array_pop($this->yystack
);
890 $yyact = $this->yy_find_reduce_action($this->yystack
[$this->yyidx
]->stateno
, $yygoto);
891 if ($yyact < self
::YYNSTATE
) {
892 if (!$this->yyTraceFILE
&& $yysize) {
894 $x = new TPC_yyStackEntry
;
895 $x->stateno
= $yyact;
897 $x->minor
= $yy_lefthand_side;
898 $this->yystack
[$this->yyidx
] = $x;
900 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
902 } elseif ($yyact == self
::YYNSTATE + self
::YYNRULE +
1) {
907 public function yy_parse_failed()
909 if ($this->yyTraceFILE
) {
910 fprintf($this->yyTraceFILE
, "%sFail!\n", $this->yyTracePrompt
);
911 } while ($this->yyidx
>= 0) {
912 $this->yy_pop_parser_stack();
916 public function yy_syntax_error($yymajor, $TOKEN)
918 #line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
920 $this->internalError
= true;
921 $this->yymajor
= $yymajor;
922 $this->compiler
->trigger_config_file_error();
925 public function yy_accept()
927 if ($this->yyTraceFILE
) {
928 fprintf($this->yyTraceFILE
, "%sAccept!\n", $this->yyTracePrompt
);
929 } while ($this->yyidx
>= 0) {
930 $this->yy_pop_parser_stack();
932 #line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
934 $this->successful
= !$this->internalError
;
935 $this->internalError
= false;
936 $this->retvalue
= $this->_retvalue
;
939 public function doParse($yymajor, $yytokenvalue)
941 $yyerrorhit = 0; /* True if yymajor has invoked an error */
943 if ($this->yyidx
=== null ||
$this->yyidx
< 0) {
945 $this->yyerrcnt
= -1;
946 $x = new TPC_yyStackEntry
;
949 $this->yystack
= array();
950 array_push($this->yystack
, $x);
952 $yyendofinput = ($yymajor==0);
954 if ($this->yyTraceFILE
) {
955 fprintf($this->yyTraceFILE
, "%sInput %s\n",
956 $this->yyTracePrompt
, $this->yyTokenName
[$yymajor]);
960 $yyact = $this->yy_find_shift_action($yymajor);
961 if ($yymajor < self
::YYERRORSYMBOL
&&
962 !$this->yy_is_expected_token($yymajor)) {
963 // force a syntax error
964 $yyact = self
::YY_ERROR_ACTION
;
966 if ($yyact < self
::YYNSTATE
) {
967 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
969 if ($yyendofinput && $this->yyidx
>= 0) {
972 $yymajor = self
::YYNOCODE
;
974 } elseif ($yyact < self
::YYNSTATE + self
::YYNRULE
) {
975 $this->yy_reduce($yyact - self
::YYNSTATE
);
976 } elseif ($yyact == self
::YY_ERROR_ACTION
) {
977 if ($this->yyTraceFILE
) {
978 fprintf($this->yyTraceFILE
, "%sSyntax Error!\n",
979 $this->yyTracePrompt
);
981 if (self
::YYERRORSYMBOL
) {
982 if ($this->yyerrcnt
< 0) {
983 $this->yy_syntax_error($yymajor, $yytokenvalue);
985 $yymx = $this->yystack
[$this->yyidx
]->major
;
986 if ($yymx == self
::YYERRORSYMBOL ||
$yyerrorhit) {
987 if ($this->yyTraceFILE
) {
988 fprintf($this->yyTraceFILE
, "%sDiscard input token %s\n",
989 $this->yyTracePrompt
, $this->yyTokenName
[$yymajor]);
991 $this->yy_destructor($yymajor, $yytokenvalue);
992 $yymajor = self
::YYNOCODE
;
994 while ($this->yyidx
>= 0 &&
995 $yymx != self
::YYERRORSYMBOL
&&
996 ($yyact = $this->yy_find_shift_action(self
::YYERRORSYMBOL
)) >= self
::YYNSTATE
998 $this->yy_pop_parser_stack();
1000 if ($this->yyidx
< 0 ||
$yymajor==0) {
1001 $this->yy_destructor($yymajor, $yytokenvalue);
1002 $this->yy_parse_failed();
1003 $yymajor = self
::YYNOCODE
;
1004 } elseif ($yymx != self
::YYERRORSYMBOL
) {
1006 $this->yy_shift($yyact, self
::YYERRORSYMBOL
, $u2);
1009 $this->yyerrcnt
= 3;
1012 if ($this->yyerrcnt
<= 0) {
1013 $this->yy_syntax_error($yymajor, $yytokenvalue);
1015 $this->yyerrcnt
= 3;
1016 $this->yy_destructor($yymajor, $yytokenvalue);
1017 if ($yyendofinput) {
1018 $this->yy_parse_failed();
1020 $yymajor = self
::YYNOCODE
;
1024 $yymajor = self
::YYNOCODE
;
1026 } while ($yymajor != self
::YYNOCODE
&& $this->yyidx
>= 0);