3 * Smarty Internal Plugin Configfileparser
5 * This is the config file parser.
6 * It is generated from the internal.configfileparser.y file
12 class TPC_yyToken implements ArrayAccess
15 public $metadata = array();
17 function __construct($s, $m = array())
19 if ($s instanceof TPC_yyToken) {
20 $this->string = $s->string;
21 $this->metadata = $s->metadata;
23 $this->string = (string) $s;
24 if ($m instanceof TPC_yyToken) {
25 $this->metadata = $m->metadata;
26 } elseif (is_array($m)) {
34 return $this->_string;
37 function offsetExists($offset)
39 return isset($this->metadata[$offset]);
42 function offsetGet($offset)
44 return $this->metadata[$offset];
47 function offsetSet($offset, $value)
49 if ($offset === null) {
50 if (isset($value[0])) {
51 $x = ($value instanceof TPC_yyToken) ?
52 $value->metadata : $value;
53 $this->metadata = array_merge($this->metadata, $x);
56 $offset = count($this->metadata);
58 if ($value === null) {
61 if ($value instanceof TPC_yyToken) {
62 if ($value->metadata) {
63 $this->metadata[$offset] = $value->metadata;
66 $this->metadata[$offset] = $value;
70 function offsetUnset($offset)
72 unset($this->metadata[$offset]);
76 class TPC_yyStackEntry
78 public $stateno; /* The state-number */
79 public $major; /* The major token value. This is the code
80 ** number for the token at this stack level */
81 public $minor; /* The user-supplied minor token value. This
82 ** is the value of the token */
86 #line 12 "smarty_internal_configfileparser.y"
87 class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php"
89 #line 14 "smarty_internal_configfileparser.y"
91 // states whether the parse was successful or not
92 public $successful = true;
95 private $internalError = false;
97 function __construct($lex, $compiler) {
98 // set instance object
99 self::instance($this);
101 $this->smarty = $compiler->smarty;
102 $this->compiler = $compiler;
104 public static function &instance($new_instance = null)
106 static $instance = null;
107 if (isset($new_instance) && is_object($new_instance))
108 $instance = $new_instance;
112 private function parse_bool($str) {
113 if (in_array(strtolower($str) ,array('on','yes','true'))) {
121 private static $escapes_single = Array('\\' => '\\',
123 private static function parse_single_quoted_string($qstr) {
124 $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes
126 $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
129 foreach ($ss as $s) {
130 if (strlen($s) === 2 && $s[0] === '\\') {
131 if (isset(self::$escapes_single[$s[1]])) {
132 $s = self::$escapes_single[$s[1]];
142 private static function parse_double_quoted_string($qstr) {
143 $inner_str = substr($qstr, 1, strlen($qstr)-2);
144 return stripcslashes($inner_str);
147 private static function parse_tripple_double_quoted_string($qstr) {
148 return stripcslashes($qstr);
151 private function set_var(Array $var, Array &$target_array) {
153 $value = $var["value"];
155 if ($this->smarty->config_overwrite || !isset($target_array['vars'][$key])) {
156 $target_array['vars'][$key] = $value;
158 settype($target_array['vars'][$key], 'array');
159 $target_array['vars'][$key][] = $value;
163 private function add_global_vars(Array $vars) {
164 if (!isset($this->compiler->config_data['vars'])) {
165 $this->compiler->config_data['vars'] = Array();
167 foreach ($vars as $var) {
168 $this->set_var($var, $this->compiler->config_data);
172 private function add_section_vars($section_name, Array $vars) {
173 if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
174 $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
176 foreach ($vars as $var) {
177 $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
180 #line 173 "smarty_internal_configfileparser.php"
183 const TPC_SECTION = 2;
184 const TPC_CLOSEB = 3;
191 const TPC_SINGLE_QUOTED_STRING = 10;
192 const TPC_DOUBLE_QUOTED_STRING = 11;
193 const TPC_TRIPPLE_QUOTES = 12;
194 const TPC_TRIPPLE_TEXT = 13;
195 const TPC_TRIPPLE_QUOTES_END = 14;
196 const TPC_NAKED_STRING = 15;
197 const TPC_OTHER = 16;
198 const TPC_NEWLINE = 17;
199 const TPC_COMMENTSTART = 18;
200 const YY_NO_ACTION = 60;
201 const YY_ACCEPT_ACTION = 59;
202 const YY_ERROR_ACTION = 58;
204 const YY_SZ_ACTTAB = 38;
205 static public $yy_action = array(
206 /* 0 */ 29, 30, 34, 33, 24, 13, 19, 25, 35, 21,
207 /* 10 */ 59, 8, 3, 1, 20, 12, 14, 31, 20, 12,
208 /* 20 */ 15, 17, 23, 18, 27, 26, 4, 5, 6, 32,
209 /* 30 */ 2, 11, 28, 22, 16, 9, 7, 10,
211 static public $yy_lookahead = array(
212 /* 0 */ 7, 8, 9, 10, 11, 12, 5, 27, 15, 16,
213 /* 10 */ 20, 21, 23, 23, 17, 18, 13, 14, 17, 18,
214 /* 20 */ 15, 2, 17, 4, 25, 26, 6, 3, 3, 14,
215 /* 30 */ 23, 1, 24, 17, 2, 25, 22, 25,
217 const YY_SHIFT_USE_DFLT = -8;
218 const YY_SHIFT_MAX = 19;
219 static public $yy_shift_ofst = array(
220 /* 0 */ -8, 1, 1, 1, -7, -3, -3, 30, -8, -8,
221 /* 10 */ -8, 19, 5, 3, 15, 16, 24, 25, 32, 20,
223 const YY_REDUCE_USE_DFLT = -21;
224 const YY_REDUCE_MAX = 10;
225 static public $yy_reduce_ofst = array(
226 /* 0 */ -10, -1, -1, -1, -20, 10, 12, 8, 14, 7,
229 static public $yyExpectedTokens = array(
231 /* 1 */ array(5, 17, 18, ),
232 /* 2 */ array(5, 17, 18, ),
233 /* 3 */ array(5, 17, 18, ),
234 /* 4 */ array(7, 8, 9, 10, 11, 12, 15, 16, ),
235 /* 5 */ array(17, 18, ),
236 /* 6 */ array(17, 18, ),
241 /* 11 */ array(2, 4, ),
242 /* 12 */ array(15, 17, ),
243 /* 13 */ array(13, 14, ),
244 /* 14 */ array(14, ),
245 /* 15 */ array(17, ),
267 static public $yy_default = array(
268 /* 0 */ 44, 37, 41, 40, 58, 58, 58, 36, 39, 44,
269 /* 10 */ 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
270 /* 20 */ 55, 54, 57, 56, 50, 45, 43, 42, 38, 46,
271 /* 30 */ 47, 52, 51, 49, 48, 53,
274 const YYSTACKDEPTH = 100;
277 const YYERRORSYMBOL = 19;
278 const YYERRSYMDT = 'yy0';
279 const YYFALLBACK = 0;
280 static public $yyFallback = array(
282 static function Trace($TraceFILE, $zTracePrompt)
286 } elseif (!$zTracePrompt) {
289 self::$yyTraceFILE = $TraceFILE;
290 self::$yyTracePrompt = $zTracePrompt;
293 static function PrintTrace()
295 self::$yyTraceFILE = fopen('php://output', 'w');
296 self::$yyTracePrompt = '<br>';
299 static public $yyTraceFILE;
300 static public $yyTracePrompt;
301 public $yyidx; /* Index of top element in stack */
302 public $yyerrcnt; /* Shifts left before out of the error */
303 public $yystack = array(); /* The parser's stack */
305 public $yyTokenName = array(
306 '$', 'OPENB', 'SECTION', 'CLOSEB',
307 'DOT', 'ID', 'EQUAL', 'FLOAT',
308 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
309 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING',
310 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
311 'start', 'global_vars', 'sections', 'var_list',
312 'section', 'newline', 'var', 'value',
315 static public $yyRuleName = array(
316 /* 0 */ "start ::= global_vars sections",
317 /* 1 */ "global_vars ::= var_list",
318 /* 2 */ "sections ::= sections section",
319 /* 3 */ "sections ::=",
320 /* 4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
321 /* 5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
322 /* 6 */ "var_list ::= var_list newline",
323 /* 7 */ "var_list ::= var_list var",
324 /* 8 */ "var_list ::=",
325 /* 9 */ "var ::= ID EQUAL value",
326 /* 10 */ "value ::= FLOAT",
327 /* 11 */ "value ::= INT",
328 /* 12 */ "value ::= BOOL",
329 /* 13 */ "value ::= SINGLE_QUOTED_STRING",
330 /* 14 */ "value ::= DOUBLE_QUOTED_STRING",
331 /* 15 */ "value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END",
332 /* 16 */ "value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END",
333 /* 17 */ "value ::= NAKED_STRING",
334 /* 18 */ "value ::= OTHER",
335 /* 19 */ "newline ::= NEWLINE",
336 /* 20 */ "newline ::= COMMENTSTART NEWLINE",
337 /* 21 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
340 function tokenName($tokenType)
342 if ($tokenType === 0) {
343 return 'End of Input';
345 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
346 return $this->yyTokenName[$tokenType];
352 static function yy_destructor($yymajor, $yypminor)
355 default: break; /* If no destructor action specified: do nothing */
359 function yy_pop_parser_stack()
361 if (!count($this->yystack)) {
364 $yytos = array_pop($this->yystack);
365 if (self::$yyTraceFILE && $this->yyidx >= 0) {
366 fwrite(self::$yyTraceFILE,
367 self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
370 $yymajor = $yytos->major;
371 self::yy_destructor($yymajor, $yytos->minor);
376 function __destruct()
378 while ($this->yystack !== Array()) {
379 $this->yy_pop_parser_stack();
381 if (is_resource(self::$yyTraceFILE)) {
382 fclose(self::$yyTraceFILE);
386 function yy_get_expected_tokens($token)
388 $state = $this->yystack[$this->yyidx]->stateno;
389 $expected = self::$yyExpectedTokens[$state];
390 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
393 $stack = $this->yystack;
394 $yyidx = $this->yyidx;
396 $yyact = $this->yy_find_shift_action($token);
397 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
401 if ($done++ == 100) {
402 $this->yyidx = $yyidx;
403 $this->yystack = $stack;
404 // too much recursion prevents proper detection
406 return array_unique($expected);
408 $yyruleno = $yyact - self::YYNSTATE;
409 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
410 $nextstate = $this->yy_find_reduce_action(
411 $this->yystack[$this->yyidx]->stateno,
412 self::$yyRuleInfo[$yyruleno]['lhs']);
413 if (isset(self::$yyExpectedTokens[$nextstate])) {
414 $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
416 self::$yyExpectedTokens[$nextstate], true)) {
417 $this->yyidx = $yyidx;
418 $this->yystack = $stack;
419 return array_unique($expected);
422 if ($nextstate < self::YYNSTATE) {
423 // we need to shift a non-terminal
425 $x = new TPC_yyStackEntry;
426 $x->stateno = $nextstate;
427 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
428 $this->yystack[$this->yyidx] = $x;
430 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
431 $this->yyidx = $yyidx;
432 $this->yystack = $stack;
433 // the last token was just ignored, we can't accept
434 // by ignoring input, this is in essence ignoring a
436 return array_unique($expected);
437 } elseif ($nextstate === self::YY_NO_ACTION) {
438 $this->yyidx = $yyidx;
439 $this->yystack = $stack;
440 // input accepted, but not shifted (I guess)
449 $this->yyidx = $yyidx;
450 $this->yystack = $stack;
451 return array_unique($expected);
454 function yy_is_expected_token($token)
457 return true; // 0 is not part of this
459 $state = $this->yystack[$this->yyidx]->stateno;
460 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
463 $stack = $this->yystack;
464 $yyidx = $this->yyidx;
466 $yyact = $this->yy_find_shift_action($token);
467 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
471 if ($done++ == 100) {
472 $this->yyidx = $yyidx;
473 $this->yystack = $stack;
474 // too much recursion prevents proper detection
478 $yyruleno = $yyact - self::YYNSTATE;
479 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
480 $nextstate = $this->yy_find_reduce_action(
481 $this->yystack[$this->yyidx]->stateno,
482 self::$yyRuleInfo[$yyruleno]['lhs']);
483 if (isset(self::$yyExpectedTokens[$nextstate]) &&
484 in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
485 $this->yyidx = $yyidx;
486 $this->yystack = $stack;
489 if ($nextstate < self::YYNSTATE) {
490 // we need to shift a non-terminal
492 $x = new TPC_yyStackEntry;
493 $x->stateno = $nextstate;
494 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
495 $this->yystack[$this->yyidx] = $x;
497 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
498 $this->yyidx = $yyidx;
499 $this->yystack = $stack;
501 // end of input: this is valid
504 // the last token was just ignored, we can't accept
505 // by ignoring input, this is in essence ignoring a
508 } elseif ($nextstate === self::YY_NO_ACTION) {
509 $this->yyidx = $yyidx;
510 $this->yystack = $stack;
511 // input accepted, but not shifted (I guess)
520 $this->yyidx = $yyidx;
521 $this->yystack = $stack;
525 function yy_find_shift_action($iLookAhead)
527 $stateno = $this->yystack[$this->yyidx]->stateno;
529 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
530 if (!isset(self::$yy_shift_ofst[$stateno])) {
532 return self::$yy_default[$stateno];
534 $i = self::$yy_shift_ofst[$stateno];
535 if ($i === self::YY_SHIFT_USE_DFLT) {
536 return self::$yy_default[$stateno];
538 if ($iLookAhead == self::YYNOCODE) {
539 return self::YY_NO_ACTION;
542 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
543 self::$yy_lookahead[$i] != $iLookAhead) {
544 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
545 && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
546 if (self::$yyTraceFILE) {
547 fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
548 $this->yyTokenName[$iLookAhead] . " => " .
549 $this->yyTokenName[$iFallback] . "\n");
551 return $this->yy_find_shift_action($iFallback);
553 return self::$yy_default[$stateno];
555 return self::$yy_action[$i];
559 function yy_find_reduce_action($stateno, $iLookAhead)
561 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
563 if (!isset(self::$yy_reduce_ofst[$stateno])) {
564 return self::$yy_default[$stateno];
566 $i = self::$yy_reduce_ofst[$stateno];
567 if ($i == self::YY_REDUCE_USE_DFLT) {
568 return self::$yy_default[$stateno];
570 if ($iLookAhead == self::YYNOCODE) {
571 return self::YY_NO_ACTION;
574 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
575 self::$yy_lookahead[$i] != $iLookAhead) {
576 return self::$yy_default[$stateno];
578 return self::$yy_action[$i];
582 function yy_shift($yyNewState, $yyMajor, $yypMinor)
585 if ($this->yyidx >= self::YYSTACKDEPTH) {
587 if (self::$yyTraceFILE) {
588 fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
590 while ($this->yyidx >= 0) {
591 $this->yy_pop_parser_stack();
593 #line 125 "smarty_internal_configfileparser.y"
595 $this->internalError = true;
596 $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
597 #line 593 "smarty_internal_configfileparser.php"
600 $yytos = new TPC_yyStackEntry;
601 $yytos->stateno = $yyNewState;
602 $yytos->major = $yyMajor;
603 $yytos->minor = $yypMinor;
604 array_push($this->yystack, $yytos);
605 if (self::$yyTraceFILE && $this->yyidx > 0) {
606 fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
608 fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
609 for($i = 1; $i <= $this->yyidx; $i++) {
610 fprintf(self::$yyTraceFILE, " %s",
611 $this->yyTokenName[$this->yystack[$i]->major]);
613 fwrite(self::$yyTraceFILE,"\n");
617 static public $yyRuleInfo = array(
618 array( 'lhs' => 20, 'rhs' => 2 ),
619 array( 'lhs' => 21, 'rhs' => 1 ),
620 array( 'lhs' => 22, 'rhs' => 2 ),
621 array( 'lhs' => 22, 'rhs' => 0 ),
622 array( 'lhs' => 24, 'rhs' => 5 ),
623 array( 'lhs' => 24, 'rhs' => 6 ),
624 array( 'lhs' => 23, 'rhs' => 2 ),
625 array( 'lhs' => 23, 'rhs' => 2 ),
626 array( 'lhs' => 23, 'rhs' => 0 ),
627 array( 'lhs' => 26, 'rhs' => 3 ),
628 array( 'lhs' => 27, 'rhs' => 1 ),
629 array( 'lhs' => 27, 'rhs' => 1 ),
630 array( 'lhs' => 27, 'rhs' => 1 ),
631 array( 'lhs' => 27, 'rhs' => 1 ),
632 array( 'lhs' => 27, 'rhs' => 1 ),
633 array( 'lhs' => 27, 'rhs' => 3 ),
634 array( 'lhs' => 27, 'rhs' => 2 ),
635 array( 'lhs' => 27, 'rhs' => 1 ),
636 array( 'lhs' => 27, 'rhs' => 1 ),
637 array( 'lhs' => 25, 'rhs' => 1 ),
638 array( 'lhs' => 25, 'rhs' => 2 ),
639 array( 'lhs' => 25, 'rhs' => 3 ),
642 static public $yyReduceMap = array(
666 #line 131 "smarty_internal_configfileparser.y"
668 $this->_retvalue = null;
670 #line 666 "smarty_internal_configfileparser.php"
671 #line 136 "smarty_internal_configfileparser.y"
673 $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
675 #line 671 "smarty_internal_configfileparser.php"
676 #line 149 "smarty_internal_configfileparser.y"
678 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
679 $this->_retvalue = null;
681 #line 677 "smarty_internal_configfileparser.php"
682 #line 154 "smarty_internal_configfileparser.y"
684 if ($this->smarty->config_read_hidden) {
685 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
687 $this->_retvalue = null;
689 #line 685 "smarty_internal_configfileparser.php"
690 #line 162 "smarty_internal_configfileparser.y"
692 $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
694 #line 690 "smarty_internal_configfileparser.php"
695 #line 166 "smarty_internal_configfileparser.y"
697 $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
699 #line 695 "smarty_internal_configfileparser.php"
700 #line 170 "smarty_internal_configfileparser.y"
702 $this->_retvalue = Array();
704 #line 700 "smarty_internal_configfileparser.php"
705 #line 176 "smarty_internal_configfileparser.y"
707 $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
709 #line 705 "smarty_internal_configfileparser.php"
710 #line 181 "smarty_internal_configfileparser.y"
712 $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
714 #line 710 "smarty_internal_configfileparser.php"
715 #line 185 "smarty_internal_configfileparser.y"
717 $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
719 #line 715 "smarty_internal_configfileparser.php"
720 #line 189 "smarty_internal_configfileparser.y"
722 $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
724 #line 720 "smarty_internal_configfileparser.php"
725 #line 193 "smarty_internal_configfileparser.y"
727 $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
729 #line 725 "smarty_internal_configfileparser.php"
730 #line 197 "smarty_internal_configfileparser.y"
732 $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
734 #line 730 "smarty_internal_configfileparser.php"
735 #line 201 "smarty_internal_configfileparser.y"
737 $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
739 #line 735 "smarty_internal_configfileparser.php"
740 #line 205 "smarty_internal_configfileparser.y"
742 $this->_retvalue = '';
744 #line 740 "smarty_internal_configfileparser.php"
745 #line 209 "smarty_internal_configfileparser.y"
747 $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
749 #line 745 "smarty_internal_configfileparser.php"
753 function yy_reduce($yyruleno)
755 $yymsp = $this->yystack[$this->yyidx];
756 if (self::$yyTraceFILE && $yyruleno >= 0
757 && $yyruleno < count(self::$yyRuleName)) {
758 fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
759 self::$yyTracePrompt, $yyruleno,
760 self::$yyRuleName[$yyruleno]);
763 $this->_retvalue = $yy_lefthand_side = null;
764 if (array_key_exists($yyruleno, self::$yyReduceMap)) {
766 $this->_retvalue = null;
767 $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
768 $yy_lefthand_side = $this->_retvalue;
770 $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
771 $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
772 $this->yyidx -= $yysize;
773 for($i = $yysize; $i; $i--) {
774 // pop all of the right-hand side parameters
775 array_pop($this->yystack);
777 $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
778 if ($yyact < self::YYNSTATE) {
779 if (!self::$yyTraceFILE && $yysize) {
781 $x = new TPC_yyStackEntry;
782 $x->stateno = $yyact;
784 $x->minor = $yy_lefthand_side;
785 $this->yystack[$this->yyidx] = $x;
787 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
789 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
794 function yy_parse_failed()
796 if (self::$yyTraceFILE) {
797 fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
799 while ($this->yyidx >= 0) {
800 $this->yy_pop_parser_stack();
804 function yy_syntax_error($yymajor, $TOKEN)
806 #line 118 "smarty_internal_configfileparser.y"
808 $this->internalError = true;
809 $this->yymajor = $yymajor;
810 $this->compiler->trigger_config_file_error();
811 #line 808 "smarty_internal_configfileparser.php"
816 if (self::$yyTraceFILE) {
817 fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
819 while ($this->yyidx >= 0) {
820 $stack = $this->yy_pop_parser_stack();
822 #line 110 "smarty_internal_configfileparser.y"
824 $this->successful = !$this->internalError;
825 $this->internalError = false;
826 $this->retvalue = $this->_retvalue;
827 //echo $this->retvalue."\n\n";
828 #line 826 "smarty_internal_configfileparser.php"
831 function doParse($yymajor, $yytokenvalue)
833 $yyerrorhit = 0; /* True if yymajor has invoked an error */
835 if ($this->yyidx === null || $this->yyidx < 0) {
837 $this->yyerrcnt = -1;
838 $x = new TPC_yyStackEntry;
841 $this->yystack = array();
842 array_push($this->yystack, $x);
844 $yyendofinput = ($yymajor==0);
846 if (self::$yyTraceFILE) {
847 fprintf(self::$yyTraceFILE, "%sInput %s\n",
848 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
852 $yyact = $this->yy_find_shift_action($yymajor);
853 if ($yymajor < self::YYERRORSYMBOL &&
854 !$this->yy_is_expected_token($yymajor)) {
855 // force a syntax error
856 $yyact = self::YY_ERROR_ACTION;
858 if ($yyact < self::YYNSTATE) {
859 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
861 if ($yyendofinput && $this->yyidx >= 0) {
864 $yymajor = self::YYNOCODE;
866 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
867 $this->yy_reduce($yyact - self::YYNSTATE);
868 } elseif ($yyact == self::YY_ERROR_ACTION) {
869 if (self::$yyTraceFILE) {
870 fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
871 self::$yyTracePrompt);
873 if (self::YYERRORSYMBOL) {
874 if ($this->yyerrcnt < 0) {
875 $this->yy_syntax_error($yymajor, $yytokenvalue);
877 $yymx = $this->yystack[$this->yyidx]->major;
878 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
879 if (self::$yyTraceFILE) {
880 fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
881 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
883 $this->yy_destructor($yymajor, $yytokenvalue);
884 $yymajor = self::YYNOCODE;
886 while ($this->yyidx >= 0 &&
887 $yymx != self::YYERRORSYMBOL &&
888 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
890 $this->yy_pop_parser_stack();
892 if ($this->yyidx < 0 || $yymajor==0) {
893 $this->yy_destructor($yymajor, $yytokenvalue);
894 $this->yy_parse_failed();
895 $yymajor = self::YYNOCODE;
896 } elseif ($yymx != self::YYERRORSYMBOL) {
898 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
904 if ($this->yyerrcnt <= 0) {
905 $this->yy_syntax_error($yymajor, $yytokenvalue);
908 $this->yy_destructor($yymajor, $yytokenvalue);
910 $this->yy_parse_failed();
912 $yymajor = self::YYNOCODE;
916 $yymajor = self::YYNOCODE;
918 } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);