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 $inner_str = substr($qstr, 3, strlen($qstr)-6);
149 return stripcslashes($inner_str);
152 private function set_var(Array $var, Array &$target_array) {
154 $value = $var["value"];
156 if ($this->smarty->config_overwrite || !isset($target_array['vars'][$key])) {
157 $target_array['vars'][$key] = $value;
159 settype($target_array['vars'][$key], 'array');
160 $target_array['vars'][$key][] = $value;
164 private function add_global_vars(Array $vars) {
165 if (!isset($this->compiler->config_data['vars'])) {
166 $this->compiler->config_data['vars'] = Array();
168 foreach ($vars as $var) {
169 $this->set_var($var, $this->compiler->config_data);
173 private function add_section_vars($section_name, Array $vars) {
174 if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
175 $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
177 foreach ($vars as $var) {
178 $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
181 #line 174 "smarty_internal_configfileparser.php"
184 const TPC_SECTION = 2;
185 const TPC_CLOSEB = 3;
192 const TPC_SINGLE_QUOTED_STRING = 10;
193 const TPC_DOUBLE_QUOTED_STRING = 11;
194 const TPC_TRIPPLE_DOUBLE_QUOTED_STRING = 12;
195 const TPC_NAKED_STRING = 13;
196 const TPC_NEWLINE = 14;
197 const TPC_COMMENTSTART = 15;
198 const YY_NO_ACTION = 54;
199 const YY_ACCEPT_ACTION = 53;
200 const YY_ERROR_ACTION = 52;
202 const YY_SZ_ACTTAB = 35;
203 static public $yy_action = array(
204 /* 0 */ 26, 27, 21, 30, 29, 28, 31, 16, 53, 8,
205 /* 10 */ 19, 2, 20, 11, 24, 23, 20, 11, 17, 15,
206 /* 20 */ 3, 14, 13, 18, 4, 6, 5, 1, 12, 22,
207 /* 30 */ 9, 47, 10, 25, 7,
209 static public $yy_lookahead = array(
210 /* 0 */ 7, 8, 9, 10, 11, 12, 13, 5, 17, 18,
211 /* 10 */ 14, 20, 14, 15, 22, 23, 14, 15, 2, 2,
212 /* 20 */ 20, 4, 13, 14, 6, 3, 3, 20, 1, 24,
213 /* 30 */ 22, 25, 22, 21, 19,
215 const YY_SHIFT_USE_DFLT = -8;
216 const YY_SHIFT_MAX = 17;
217 static public $yy_shift_ofst = array(
218 /* 0 */ -8, 2, 2, 2, -7, -2, -2, 27, -8, -8,
219 /* 10 */ -8, 9, 17, -4, 16, 23, 18, 22,
221 const YY_REDUCE_USE_DFLT = -10;
222 const YY_REDUCE_MAX = 10;
223 static public $yy_reduce_ofst = array(
224 /* 0 */ -9, -8, -8, -8, 5, 10, 8, 12, 15, 0,
227 static public $yyExpectedTokens = array(
229 /* 1 */ array(5, 14, 15, ),
230 /* 2 */ array(5, 14, 15, ),
231 /* 3 */ array(5, 14, 15, ),
232 /* 4 */ array(7, 8, 9, 10, 11, 12, 13, ),
233 /* 5 */ array(14, 15, ),
234 /* 6 */ array(14, 15, ),
239 /* 11 */ array(13, 14, ),
240 /* 12 */ array(2, 4, ),
241 /* 13 */ array(14, ),
261 static public $yy_default = array(
262 /* 0 */ 40, 36, 33, 37, 52, 52, 52, 32, 35, 40,
263 /* 10 */ 40, 52, 52, 52, 52, 52, 52, 52, 50, 51,
264 /* 20 */ 49, 44, 41, 39, 38, 34, 42, 43, 47, 46,
268 const YYSTACKDEPTH = 100;
271 const YYERRORSYMBOL = 16;
272 const YYERRSYMDT = 'yy0';
273 const YYFALLBACK = 0;
274 static public $yyFallback = array(
276 static function Trace($TraceFILE, $zTracePrompt)
280 } elseif (!$zTracePrompt) {
283 self::$yyTraceFILE = $TraceFILE;
284 self::$yyTracePrompt = $zTracePrompt;
287 static function PrintTrace()
289 self::$yyTraceFILE = fopen('php://output', 'w');
290 self::$yyTracePrompt = '<br>';
293 static public $yyTraceFILE;
294 static public $yyTracePrompt;
295 public $yyidx; /* Index of top element in stack */
296 public $yyerrcnt; /* Shifts left before out of the error */
297 public $yystack = array(); /* The parser's stack */
299 public $yyTokenName = array(
300 '$', 'OPENB', 'SECTION', 'CLOSEB',
301 'DOT', 'ID', 'EQUAL', 'FLOAT',
302 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
303 'TRIPPLE_DOUBLE_QUOTED_STRING', 'NAKED_STRING', 'NEWLINE', 'COMMENTSTART',
304 'error', 'start', 'global_vars', 'sections',
305 'var_list', 'section', 'newline', 'var',
309 static public $yyRuleName = array(
310 /* 0 */ "start ::= global_vars sections",
311 /* 1 */ "global_vars ::= var_list",
312 /* 2 */ "sections ::= sections section",
313 /* 3 */ "sections ::=",
314 /* 4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
315 /* 5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
316 /* 6 */ "var_list ::= var_list newline",
317 /* 7 */ "var_list ::= var_list var",
318 /* 8 */ "var_list ::=",
319 /* 9 */ "var ::= ID EQUAL value",
320 /* 10 */ "value ::= FLOAT",
321 /* 11 */ "value ::= INT",
322 /* 12 */ "value ::= BOOL",
323 /* 13 */ "value ::= SINGLE_QUOTED_STRING",
324 /* 14 */ "value ::= DOUBLE_QUOTED_STRING",
325 /* 15 */ "value ::= TRIPPLE_DOUBLE_QUOTED_STRING",
326 /* 16 */ "value ::= NAKED_STRING",
327 /* 17 */ "newline ::= NEWLINE",
328 /* 18 */ "newline ::= COMMENTSTART NEWLINE",
329 /* 19 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
332 function tokenName($tokenType)
334 if ($tokenType === 0) {
335 return 'End of Input';
337 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
338 return $this->yyTokenName[$tokenType];
344 static function yy_destructor($yymajor, $yypminor)
347 default: break; /* If no destructor action specified: do nothing */
351 function yy_pop_parser_stack()
353 if (!count($this->yystack)) {
356 $yytos = array_pop($this->yystack);
357 if (self::$yyTraceFILE && $this->yyidx >= 0) {
358 fwrite(self::$yyTraceFILE,
359 self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
362 $yymajor = $yytos->major;
363 self::yy_destructor($yymajor, $yytos->minor);
368 function __destruct()
370 while ($this->yystack !== Array()) {
371 $this->yy_pop_parser_stack();
373 if (is_resource(self::$yyTraceFILE)) {
374 fclose(self::$yyTraceFILE);
378 function yy_get_expected_tokens($token)
380 $state = $this->yystack[$this->yyidx]->stateno;
381 $expected = self::$yyExpectedTokens[$state];
382 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
385 $stack = $this->yystack;
386 $yyidx = $this->yyidx;
388 $yyact = $this->yy_find_shift_action($token);
389 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
393 if ($done++ == 100) {
394 $this->yyidx = $yyidx;
395 $this->yystack = $stack;
396 // too much recursion prevents proper detection
398 return array_unique($expected);
400 $yyruleno = $yyact - self::YYNSTATE;
401 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
402 $nextstate = $this->yy_find_reduce_action(
403 $this->yystack[$this->yyidx]->stateno,
404 self::$yyRuleInfo[$yyruleno]['lhs']);
405 if (isset(self::$yyExpectedTokens[$nextstate])) {
406 $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
408 self::$yyExpectedTokens[$nextstate], true)) {
409 $this->yyidx = $yyidx;
410 $this->yystack = $stack;
411 return array_unique($expected);
414 if ($nextstate < self::YYNSTATE) {
415 // we need to shift a non-terminal
417 $x = new TPC_yyStackEntry;
418 $x->stateno = $nextstate;
419 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
420 $this->yystack[$this->yyidx] = $x;
422 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
423 $this->yyidx = $yyidx;
424 $this->yystack = $stack;
425 // the last token was just ignored, we can't accept
426 // by ignoring input, this is in essence ignoring a
428 return array_unique($expected);
429 } elseif ($nextstate === self::YY_NO_ACTION) {
430 $this->yyidx = $yyidx;
431 $this->yystack = $stack;
432 // input accepted, but not shifted (I guess)
441 $this->yyidx = $yyidx;
442 $this->yystack = $stack;
443 return array_unique($expected);
446 function yy_is_expected_token($token)
449 return true; // 0 is not part of this
451 $state = $this->yystack[$this->yyidx]->stateno;
452 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
455 $stack = $this->yystack;
456 $yyidx = $this->yyidx;
458 $yyact = $this->yy_find_shift_action($token);
459 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
463 if ($done++ == 100) {
464 $this->yyidx = $yyidx;
465 $this->yystack = $stack;
466 // too much recursion prevents proper detection
470 $yyruleno = $yyact - self::YYNSTATE;
471 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
472 $nextstate = $this->yy_find_reduce_action(
473 $this->yystack[$this->yyidx]->stateno,
474 self::$yyRuleInfo[$yyruleno]['lhs']);
475 if (isset(self::$yyExpectedTokens[$nextstate]) &&
476 in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
477 $this->yyidx = $yyidx;
478 $this->yystack = $stack;
481 if ($nextstate < self::YYNSTATE) {
482 // we need to shift a non-terminal
484 $x = new TPC_yyStackEntry;
485 $x->stateno = $nextstate;
486 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
487 $this->yystack[$this->yyidx] = $x;
489 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
490 $this->yyidx = $yyidx;
491 $this->yystack = $stack;
493 // end of input: this is valid
496 // the last token was just ignored, we can't accept
497 // by ignoring input, this is in essence ignoring a
500 } elseif ($nextstate === self::YY_NO_ACTION) {
501 $this->yyidx = $yyidx;
502 $this->yystack = $stack;
503 // input accepted, but not shifted (I guess)
512 $this->yyidx = $yyidx;
513 $this->yystack = $stack;
517 function yy_find_shift_action($iLookAhead)
519 $stateno = $this->yystack[$this->yyidx]->stateno;
521 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
522 if (!isset(self::$yy_shift_ofst[$stateno])) {
524 return self::$yy_default[$stateno];
526 $i = self::$yy_shift_ofst[$stateno];
527 if ($i === self::YY_SHIFT_USE_DFLT) {
528 return self::$yy_default[$stateno];
530 if ($iLookAhead == self::YYNOCODE) {
531 return self::YY_NO_ACTION;
534 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
535 self::$yy_lookahead[$i] != $iLookAhead) {
536 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
537 && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
538 if (self::$yyTraceFILE) {
539 fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
540 $this->yyTokenName[$iLookAhead] . " => " .
541 $this->yyTokenName[$iFallback] . "\n");
543 return $this->yy_find_shift_action($iFallback);
545 return self::$yy_default[$stateno];
547 return self::$yy_action[$i];
551 function yy_find_reduce_action($stateno, $iLookAhead)
553 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
555 if (!isset(self::$yy_reduce_ofst[$stateno])) {
556 return self::$yy_default[$stateno];
558 $i = self::$yy_reduce_ofst[$stateno];
559 if ($i == self::YY_REDUCE_USE_DFLT) {
560 return self::$yy_default[$stateno];
562 if ($iLookAhead == self::YYNOCODE) {
563 return self::YY_NO_ACTION;
566 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
567 self::$yy_lookahead[$i] != $iLookAhead) {
568 return self::$yy_default[$stateno];
570 return self::$yy_action[$i];
574 function yy_shift($yyNewState, $yyMajor, $yypMinor)
577 if ($this->yyidx >= self::YYSTACKDEPTH) {
579 if (self::$yyTraceFILE) {
580 fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
582 while ($this->yyidx >= 0) {
583 $this->yy_pop_parser_stack();
585 #line 126 "smarty_internal_configfileparser.y"
587 $this->internalError = true;
588 $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
589 #line 585 "smarty_internal_configfileparser.php"
592 $yytos = new TPC_yyStackEntry;
593 $yytos->stateno = $yyNewState;
594 $yytos->major = $yyMajor;
595 $yytos->minor = $yypMinor;
596 array_push($this->yystack, $yytos);
597 if (self::$yyTraceFILE && $this->yyidx > 0) {
598 fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
600 fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
601 for($i = 1; $i <= $this->yyidx; $i++) {
602 fprintf(self::$yyTraceFILE, " %s",
603 $this->yyTokenName[$this->yystack[$i]->major]);
605 fwrite(self::$yyTraceFILE,"\n");
609 static public $yyRuleInfo = array(
610 array( 'lhs' => 17, 'rhs' => 2 ),
611 array( 'lhs' => 18, 'rhs' => 1 ),
612 array( 'lhs' => 19, 'rhs' => 2 ),
613 array( 'lhs' => 19, 'rhs' => 0 ),
614 array( 'lhs' => 21, 'rhs' => 5 ),
615 array( 'lhs' => 21, 'rhs' => 6 ),
616 array( 'lhs' => 20, 'rhs' => 2 ),
617 array( 'lhs' => 20, 'rhs' => 2 ),
618 array( 'lhs' => 20, 'rhs' => 0 ),
619 array( 'lhs' => 23, 'rhs' => 3 ),
620 array( 'lhs' => 24, 'rhs' => 1 ),
621 array( 'lhs' => 24, 'rhs' => 1 ),
622 array( 'lhs' => 24, 'rhs' => 1 ),
623 array( 'lhs' => 24, 'rhs' => 1 ),
624 array( 'lhs' => 24, 'rhs' => 1 ),
625 array( 'lhs' => 24, 'rhs' => 1 ),
626 array( 'lhs' => 24, 'rhs' => 1 ),
627 array( 'lhs' => 22, 'rhs' => 1 ),
628 array( 'lhs' => 22, 'rhs' => 2 ),
629 array( 'lhs' => 22, 'rhs' => 3 ),
632 static public $yyReduceMap = array(
654 #line 132 "smarty_internal_configfileparser.y"
655 function yy_r0(){ $this->_retvalue = null; }
656 #line 652 "smarty_internal_configfileparser.php"
657 #line 135 "smarty_internal_configfileparser.y"
658 function yy_r1(){ $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; }
659 #line 655 "smarty_internal_configfileparser.php"
660 #line 141 "smarty_internal_configfileparser.y"
661 function yy_r4(){ $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; }
662 #line 658 "smarty_internal_configfileparser.php"
663 #line 142 "smarty_internal_configfileparser.y"
664 function yy_r5(){ if ($this->smarty->config_read_hidden) { $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); } $this->_retvalue = null; }
665 #line 661 "smarty_internal_configfileparser.php"
666 #line 145 "smarty_internal_configfileparser.y"
667 function yy_r6(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
668 #line 664 "smarty_internal_configfileparser.php"
669 #line 146 "smarty_internal_configfileparser.y"
670 function yy_r7(){ $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor)); }
671 #line 667 "smarty_internal_configfileparser.php"
672 #line 147 "smarty_internal_configfileparser.y"
673 function yy_r8(){ $this->_retvalue = Array(); }
674 #line 670 "smarty_internal_configfileparser.php"
675 #line 151 "smarty_internal_configfileparser.y"
676 function yy_r9(){ $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor); }
677 #line 673 "smarty_internal_configfileparser.php"
678 #line 153 "smarty_internal_configfileparser.y"
679 function yy_r10(){ $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; }
680 #line 676 "smarty_internal_configfileparser.php"
681 #line 154 "smarty_internal_configfileparser.y"
682 function yy_r11(){ $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; }
683 #line 679 "smarty_internal_configfileparser.php"
684 #line 155 "smarty_internal_configfileparser.y"
685 function yy_r12(){ $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); }
686 #line 682 "smarty_internal_configfileparser.php"
687 #line 156 "smarty_internal_configfileparser.y"
688 function yy_r13(){ $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
689 #line 685 "smarty_internal_configfileparser.php"
690 #line 157 "smarty_internal_configfileparser.y"
691 function yy_r14(){ $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
692 #line 688 "smarty_internal_configfileparser.php"
693 #line 158 "smarty_internal_configfileparser.y"
694 function yy_r15(){ $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
695 #line 691 "smarty_internal_configfileparser.php"
696 #line 159 "smarty_internal_configfileparser.y"
697 function yy_r16(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
698 #line 694 "smarty_internal_configfileparser.php"
702 function yy_reduce($yyruleno)
704 $yymsp = $this->yystack[$this->yyidx];
705 if (self::$yyTraceFILE && $yyruleno >= 0
706 && $yyruleno < count(self::$yyRuleName)) {
707 fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
708 self::$yyTracePrompt, $yyruleno,
709 self::$yyRuleName[$yyruleno]);
712 $this->_retvalue = $yy_lefthand_side = null;
713 if (array_key_exists($yyruleno, self::$yyReduceMap)) {
715 $this->_retvalue = null;
716 $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
717 $yy_lefthand_side = $this->_retvalue;
719 $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
720 $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
721 $this->yyidx -= $yysize;
722 for($i = $yysize; $i; $i--) {
723 // pop all of the right-hand side parameters
724 array_pop($this->yystack);
726 $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
727 if ($yyact < self::YYNSTATE) {
728 if (!self::$yyTraceFILE && $yysize) {
730 $x = new TPC_yyStackEntry;
731 $x->stateno = $yyact;
733 $x->minor = $yy_lefthand_side;
734 $this->yystack[$this->yyidx] = $x;
736 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
738 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
743 function yy_parse_failed()
745 if (self::$yyTraceFILE) {
746 fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
748 while ($this->yyidx >= 0) {
749 $this->yy_pop_parser_stack();
753 function yy_syntax_error($yymajor, $TOKEN)
755 #line 119 "smarty_internal_configfileparser.y"
757 $this->internalError = true;
758 $this->yymajor = $yymajor;
759 $this->compiler->trigger_config_file_error();
760 #line 757 "smarty_internal_configfileparser.php"
765 if (self::$yyTraceFILE) {
766 fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
768 while ($this->yyidx >= 0) {
769 $stack = $this->yy_pop_parser_stack();
771 #line 111 "smarty_internal_configfileparser.y"
773 $this->successful = !$this->internalError;
774 $this->internalError = false;
775 $this->retvalue = $this->_retvalue;
776 //echo $this->retvalue."\n\n";
777 #line 775 "smarty_internal_configfileparser.php"
780 function doParse($yymajor, $yytokenvalue)
782 $yyerrorhit = 0; /* True if yymajor has invoked an error */
784 if ($this->yyidx === null || $this->yyidx < 0) {
786 $this->yyerrcnt = -1;
787 $x = new TPC_yyStackEntry;
790 $this->yystack = array();
791 array_push($this->yystack, $x);
793 $yyendofinput = ($yymajor==0);
795 if (self::$yyTraceFILE) {
796 fprintf(self::$yyTraceFILE, "%sInput %s\n",
797 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
801 $yyact = $this->yy_find_shift_action($yymajor);
802 if ($yymajor < self::YYERRORSYMBOL &&
803 !$this->yy_is_expected_token($yymajor)) {
804 // force a syntax error
805 $yyact = self::YY_ERROR_ACTION;
807 if ($yyact < self::YYNSTATE) {
808 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
810 if ($yyendofinput && $this->yyidx >= 0) {
813 $yymajor = self::YYNOCODE;
815 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
816 $this->yy_reduce($yyact - self::YYNSTATE);
817 } elseif ($yyact == self::YY_ERROR_ACTION) {
818 if (self::$yyTraceFILE) {
819 fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
820 self::$yyTracePrompt);
822 if (self::YYERRORSYMBOL) {
823 if ($this->yyerrcnt < 0) {
824 $this->yy_syntax_error($yymajor, $yytokenvalue);
826 $yymx = $this->yystack[$this->yyidx]->major;
827 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
828 if (self::$yyTraceFILE) {
829 fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
830 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
832 $this->yy_destructor($yymajor, $yytokenvalue);
833 $yymajor = self::YYNOCODE;
835 while ($this->yyidx >= 0 &&
836 $yymx != self::YYERRORSYMBOL &&
837 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
839 $this->yy_pop_parser_stack();
841 if ($this->yyidx < 0 || $yymajor==0) {
842 $this->yy_destructor($yymajor, $yytokenvalue);
843 $this->yy_parse_failed();
844 $yymajor = self::YYNOCODE;
845 } elseif ($yymx != self::YYERRORSYMBOL) {
847 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
853 if ($this->yyerrcnt <= 0) {
854 $this->yy_syntax_error($yymajor, $yytokenvalue);
857 $this->yy_destructor($yymajor, $yytokenvalue);
859 $this->yy_parse_failed();
861 $yymajor = self::YYNOCODE;
865 $yymajor = self::YYNOCODE;
867 } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);