update to smarty 3.1.22
[GitHub/Stricted/Domain-Control-Panel.git] / lib / api / smarty / sysplugins / smarty_internal_configfileparser.php
1 <?php
2 class TPC_yyToken implements ArrayAccess
3 {
4 public $string = '';
5 public $metadata = array();
6
7 public function __construct($s, $m = array())
8 {
9 if ($s instanceof TPC_yyToken) {
10 $this->string = $s->string;
11 $this->metadata = $s->metadata;
12 } else {
13 $this->string = (string) $s;
14 if ($m instanceof TPC_yyToken) {
15 $this->metadata = $m->metadata;
16 } elseif (is_array($m)) {
17 $this->metadata = $m;
18 }
19 }
20 }
21
22 public function __toString()
23 {
24 return $this->string;
25 }
26
27 public function offsetExists($offset)
28 {
29 return isset($this->metadata[$offset]);
30 }
31
32 public function offsetGet($offset)
33 {
34 return $this->metadata[$offset];
35 }
36
37 public function offsetSet($offset, $value)
38 {
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);
44
45 return;
46 }
47 $offset = count($this->metadata);
48 }
49 if ($value === null) {
50 return;
51 }
52 if ($value instanceof TPC_yyToken) {
53 if ($value->metadata) {
54 $this->metadata[$offset] = $value->metadata;
55 }
56 } elseif ($value) {
57 $this->metadata[$offset] = $value;
58 }
59 }
60
61 public function offsetUnset($offset)
62 {
63 unset($this->metadata[$offset]);
64 }
65 }
66
67 class TPC_yyStackEntry
68 {
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 */
74 };
75
76
77 #line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
78
79 /**
80 * Smarty Internal Plugin Configfileparse
81 *
82 * This is the config file parser.
83 * It is generated from the smarty_internal_configfileparser.y file
84 * @package Smarty
85 * @subpackage Compiler
86 * @author Uwe Tews
87 */
88 class Smarty_Internal_Configfileparser
89 {
90 #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
91
92 /**
93 * result status
94 *
95 * @var bool
96 */
97 public $successful = true;
98 /**
99 * return value
100 *
101 * @var mixed
102 */
103 public $retvalue = 0;
104 /**
105 * @var
106 */
107 public $yymajor;
108 /**
109 * lexer object
110 *
111 * @var Smarty_Internal_Configfilelexer
112 */
113 private $lex;
114 /**
115 * internal error flag
116 *
117 * @var bool
118 */
119 private $internalError = false;
120 /**
121 * compiler object
122 *
123 * @var Smarty_Internal_Config_File_Compiler
124 */
125 public $compiler = null;
126 /**
127 * smarty object
128 *
129 * @var Smarty
130 */
131 public $smarty = null;
132 /**
133 * copy of config_overwrite property
134 *
135 * @var bool
136 */
137 private $configOverwrite = false;
138 /**
139 * copy of config_read_hidden property
140 *
141 * @var bool
142 */
143 private $configReadHidden = false;
144 /**
145 * helper map
146 *
147 * @var array
148 */
149 private static $escapes_single = Array('\\' => '\\',
150 '\'' => '\'');
151
152 /**
153 * constructor
154 *
155 * @param Smarty_Internal_Configfilelexer $lex
156 * @param Smarty_Internal_Config_File_Compiler $compiler
157 */
158 function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
159 {
160 // set instance object
161 self::instance($this);
162 $this->lex = $lex;
163 $this->smarty = $compiler->smarty;
164 $this->compiler = $compiler;
165 $this->configOverwrite = $this->smarty->config_overwrite;
166 $this->configReadHidden = $this->smarty->config_read_hidden;
167 }
168
169 /**
170 * @param null $new_instance
171 *
172 * @return null
173 */
174 public static function &instance($new_instance = null)
175 {
176 static $instance = null;
177 if (isset($new_instance) && is_object($new_instance)) {
178 $instance = $new_instance;
179 }
180 return $instance;
181 }
182
183 /**
184 * parse optional boolean keywords
185 *
186 * @param string $str
187 *
188 * @return bool
189 */
190 private function parse_bool($str)
191 {
192 $str = strtolower($str);
193 if (in_array($str, array('on', 'yes', 'true'))) {
194 $res = true;
195 } else {
196 $res = false;
197 }
198 return $res;
199 }
200
201 /**
202 * parse single quoted string
203 * remove outer quotes
204 * unescape inner quotes
205 *
206 * @param string $qstr
207 *
208 * @return string
209 */
210 private static function parse_single_quoted_string($qstr)
211 {
212 $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
213
214 $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
215
216 $str = "";
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]];
221 }
222 }
223 $str .= $s;
224 }
225 return $str;
226 }
227
228 /**
229 * parse double quoted string
230 *
231 * @param string $qstr
232 *
233 * @return string
234 */
235 private static function parse_double_quoted_string($qstr)
236 {
237 $inner_str = substr($qstr, 1, strlen($qstr) - 2);
238 return stripcslashes($inner_str);
239 }
240
241 /**
242 * parse triple quoted string
243 *
244 * @param string $qstr
245 *
246 * @return string
247 */
248 private static function parse_tripple_double_quoted_string($qstr)
249 {
250 return stripcslashes($qstr);
251 }
252
253 /**
254 * set a config variable in target array
255 *
256 * @param array $var
257 * @param array $target_array
258 */
259 private function set_var(Array $var, Array &$target_array)
260 {
261 $key = $var["key"];
262 $value = $var["value"];
263
264 if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
265 $target_array['vars'][$key] = $value;
266 } else {
267 settype($target_array['vars'][$key], 'array');
268 $target_array['vars'][$key][] = $value;
269 }
270 }
271
272 /**
273 * add config variable to global vars
274 *
275 * @param array $vars
276 */
277 private function add_global_vars(Array $vars)
278 {
279 if (!isset($this->compiler->config_data['vars'])) {
280 $this->compiler->config_data['vars'] = Array();
281 }
282 foreach ($vars as $var) {
283 $this->set_var($var, $this->compiler->config_data);
284 }
285 }
286
287 /**
288 * add config variable to section
289 *
290 * @param string $section_name
291 * @param array $vars
292 */
293 private function add_section_vars($section_name, Array $vars)
294 {
295 if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
296 $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
297 }
298 foreach ($vars as $var) {
299 $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
300 }
301 }
302
303 const TPC_OPENB = 1;
304 const TPC_SECTION = 2;
305 const TPC_CLOSEB = 3;
306 const TPC_DOT = 4;
307 const TPC_ID = 5;
308 const TPC_EQUAL = 6;
309 const TPC_FLOAT = 7;
310 const TPC_INT = 8;
311 const TPC_BOOL = 9;
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;
324
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,
331 );
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,
337 );
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,
343 );
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,
348 -11,
349 );
350 static public $yyExpectedTokens = array(
351 array(),
352 array(5, 17, 18, ),
353 array(5, 17, 18, ),
354 array(5, 17, 18, ),
355 array(7, 8, 9, 10, 11, 12, 15, 16, ),
356 array(17, 18, ),
357 array(17, 18, ),
358 array(1, ),
359 array(),
360 array(),
361 array(),
362 array(2, 4, ),
363 array(15, 17, ),
364 array(13, 14, ),
365 array(14, ),
366 array(17, ),
367 array(3, ),
368 array(3, ),
369 array(2, ),
370 array(6, ),
371 array(),
372 array(),
373 array(),
374 array(),
375 array(),
376 array(),
377 array(),
378 array(),
379 array(),
380 array(),
381 array(),
382 array(),
383 array(),
384 array(),
385 array(),
386 array(),
387 );
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,
393 );
394 const YYNOCODE = 29;
395 const YYSTACKDEPTH = 100;
396 const YYNSTATE = 36;
397 const YYNRULE = 22;
398 const YYERRORSYMBOL = 19;
399 const YYERRSYMDT = 'yy0';
400 const YYFALLBACK = 0;
401 public static $yyFallback = array(
402 );
403 public function Trace($TraceFILE, $zTracePrompt)
404 {
405 if (!$TraceFILE) {
406 $zTracePrompt = 0;
407 } elseif (!$zTracePrompt) {
408 $TraceFILE = 0;
409 }
410 $this->yyTraceFILE = $TraceFILE;
411 $this->yyTracePrompt = $zTracePrompt;
412 }
413
414 public function PrintTrace()
415 {
416 $this->yyTraceFILE = fopen('php://output', 'w');
417 $this->yyTracePrompt = '<br>';
418 }
419
420 public $yyTraceFILE;
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 */
425
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',
434 );
435
436 public static $yyRuleName = array(
437 "start ::= global_vars sections",
438 "global_vars ::= var_list",
439 "sections ::= sections section",
440 "sections ::=",
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",
445 "var_list ::=",
446 "var ::= ID EQUAL value",
447 "value ::= FLOAT",
448 "value ::= INT",
449 "value ::= BOOL",
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",
455 "value ::= OTHER",
456 "newline ::= NEWLINE",
457 "newline ::= COMMENTSTART NEWLINE",
458 "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
459 );
460
461 public function tokenName($tokenType)
462 {
463 if ($tokenType === 0) {
464 return 'End of Input';
465 }
466 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
467 return $this->yyTokenName[$tokenType];
468 } else {
469 return "Unknown";
470 }
471 }
472
473 public static function yy_destructor($yymajor, $yypminor)
474 {
475 switch ($yymajor) {
476 default: break; /* If no destructor action specified: do nothing */
477 }
478 }
479
480 public function yy_pop_parser_stack()
481 {
482 if (!count($this->yystack)) {
483 return;
484 }
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] .
489 "\n");
490 }
491 $yymajor = $yytos->major;
492 self::yy_destructor($yymajor, $yytos->minor);
493 $this->yyidx--;
494
495 return $yymajor;
496 }
497
498 public function __destruct()
499 {
500 while ($this->yystack !== Array()) {
501 $this->yy_pop_parser_stack();
502 }
503 if (is_resource($this->yyTraceFILE)) {
504 fclose($this->yyTraceFILE);
505 }
506 }
507
508 public function yy_get_expected_tokens($token)
509 {
510 $state = $this->yystack[$this->yyidx]->stateno;
511 $expected = self::$yyExpectedTokens[$state];
512 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
513 return $expected;
514 }
515 $stack = $this->yystack;
516 $yyidx = $this->yyidx;
517 do {
518 $yyact = $this->yy_find_shift_action($token);
519 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
520 // reduce action
521 $done = 0;
522 do {
523 if ($done++ == 100) {
524 $this->yyidx = $yyidx;
525 $this->yystack = $stack;
526 // too much recursion prevents proper detection
527 // so give up
528 return array_unique($expected);
529 }
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]);
537 if (in_array($token,
538 self::$yyExpectedTokens[$nextstate], true)) {
539 $this->yyidx = $yyidx;
540 $this->yystack = $stack;
541
542 return array_unique($expected);
543 }
544 }
545 if ($nextstate < self::YYNSTATE) {
546 // we need to shift a non-terminal
547 $this->yyidx++;
548 $x = new TPC_yyStackEntry;
549 $x->stateno = $nextstate;
550 $x->major = self::$yyRuleInfo[$yyruleno][0];
551 $this->yystack[$this->yyidx] = $x;
552 continue 2;
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
558 // syntax error!
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)
564 return $expected;
565 } else {
566 $yyact = $nextstate;
567 }
568 } while (true);
569 }
570 break;
571 } while (true);
572 $this->yyidx = $yyidx;
573 $this->yystack = $stack;
574
575 return array_unique($expected);
576 }
577
578 public function yy_is_expected_token($token)
579 {
580 if ($token === 0) {
581 return true; // 0 is not part of this
582 }
583 $state = $this->yystack[$this->yyidx]->stateno;
584 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
585 return true;
586 }
587 $stack = $this->yystack;
588 $yyidx = $this->yyidx;
589 do {
590 $yyact = $this->yy_find_shift_action($token);
591 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
592 // reduce action
593 $done = 0;
594 do {
595 if ($done++ == 100) {
596 $this->yyidx = $yyidx;
597 $this->yystack = $stack;
598 // too much recursion prevents proper detection
599 // so give up
600 return true;
601 }
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;
611
612 return true;
613 }
614 if ($nextstate < self::YYNSTATE) {
615 // we need to shift a non-terminal
616 $this->yyidx++;
617 $x = new TPC_yyStackEntry;
618 $x->stateno = $nextstate;
619 $x->major = self::$yyRuleInfo[$yyruleno][0];
620 $this->yystack[$this->yyidx] = $x;
621 continue 2;
622 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
623 $this->yyidx = $yyidx;
624 $this->yystack = $stack;
625 if (!$token) {
626 // end of input: this is valid
627 return true;
628 }
629 // the last token was just ignored, we can't accept
630 // by ignoring input, this is in essence ignoring a
631 // syntax error!
632 return false;
633 } elseif ($nextstate === self::YY_NO_ACTION) {
634 $this->yyidx = $yyidx;
635 $this->yystack = $stack;
636 // input accepted, but not shifted (I guess)
637 return true;
638 } else {
639 $yyact = $nextstate;
640 }
641 } while (true);
642 }
643 break;
644 } while (true);
645 $this->yyidx = $yyidx;
646 $this->yystack = $stack;
647
648 return true;
649 }
650
651 public function yy_find_shift_action($iLookAhead)
652 {
653 $stateno = $this->yystack[$this->yyidx]->stateno;
654
655 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
656 if (!isset(self::$yy_shift_ofst[$stateno])) {
657 // no shift actions
658 return self::$yy_default[$stateno];
659 }
660 $i = self::$yy_shift_ofst[$stateno];
661 if ($i === self::YY_SHIFT_USE_DFLT) {
662 return self::$yy_default[$stateno];
663 }
664 if ($iLookAhead == self::YYNOCODE) {
665 return self::YY_NO_ACTION;
666 }
667 $i += $iLookAhead;
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");
676 }
677
678 return $this->yy_find_shift_action($iFallback);
679 }
680
681 return self::$yy_default[$stateno];
682 } else {
683 return self::$yy_action[$i];
684 }
685 }
686
687 public function yy_find_reduce_action($stateno, $iLookAhead)
688 {
689 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
690
691 if (!isset(self::$yy_reduce_ofst[$stateno])) {
692 return self::$yy_default[$stateno];
693 }
694 $i = self::$yy_reduce_ofst[$stateno];
695 if ($i == self::YY_REDUCE_USE_DFLT) {
696 return self::$yy_default[$stateno];
697 }
698 if ($iLookAhead == self::YYNOCODE) {
699 return self::YY_NO_ACTION;
700 }
701 $i += $iLookAhead;
702 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
703 self::$yy_lookahead[$i] != $iLookAhead) {
704 return self::$yy_default[$stateno];
705 } else {
706 return self::$yy_action[$i];
707 }
708 }
709
710 public function yy_shift($yyNewState, $yyMajor, $yypMinor)
711 {
712 $this->yyidx++;
713 if ($this->yyidx >= self::YYSTACKDEPTH) {
714 $this->yyidx--;
715 if ($this->yyTraceFILE) {
716 fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
717 }
718 while ($this->yyidx >= 0) {
719 $this->yy_pop_parser_stack();
720 }
721 #line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
722
723 $this->internalError = true;
724 $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
725
726 return;
727 }
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,
735 $yyNewState);
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]);
740 }
741 fwrite($this->yyTraceFILE,"\n");
742 }
743 }
744
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 ),
768 );
769
770 public static $yyReduceMap = array(
771 0 => 0,
772 2 => 0,
773 3 => 0,
774 19 => 0,
775 20 => 0,
776 21 => 0,
777 1 => 1,
778 4 => 4,
779 5 => 5,
780 6 => 6,
781 7 => 7,
782 8 => 8,
783 9 => 9,
784 10 => 10,
785 11 => 11,
786 12 => 12,
787 13 => 13,
788 14 => 14,
789 15 => 15,
790 16 => 16,
791 17 => 17,
792 18 => 17,
793 );
794 #line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
795 function yy_r0(){
796 $this->_retvalue = null;
797 }
798 #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
799 function yy_r1(){
800 $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor);
801 $this->_retvalue = null;
802 }
803 #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
804 function yy_r4(){
805 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
806 $this->_retvalue = null;
807 }
808 #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
809 function yy_r5(){
810 if ($this->configReadHidden) {
811 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
812 }
813 $this->_retvalue = null;
814 }
815 #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
816 function yy_r6(){
817 $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
818 }
819 #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
820 function yy_r7(){
821 $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
822 }
823 #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
824 function yy_r8(){
825 $this->_retvalue = Array();
826 }
827 #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
828 function yy_r9(){
829 $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
830 }
831 #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
832 function yy_r10(){
833 $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
834 }
835 #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
836 function yy_r11(){
837 $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
838 }
839 #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
840 function yy_r12(){
841 $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
842 }
843 #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
844 function yy_r13(){
845 $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
846 }
847 #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
848 function yy_r14(){
849 $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
850 }
851 #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
852 function yy_r15(){
853 $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
854 }
855 #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
856 function yy_r16(){
857 $this->_retvalue = '';
858 }
859 #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
860 function yy_r17(){
861 $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
862 }
863
864 private $_retvalue;
865
866 public function yy_reduce($yyruleno)
867 {
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]);
874 }
875
876 $this->_retvalue = $yy_lefthand_side = null;
877 if (array_key_exists($yyruleno, self::$yyReduceMap)) {
878 // call the action
879 $this->_retvalue = null;
880 $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
881 $yy_lefthand_side = $this->_retvalue;
882 }
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);
889 }
890 $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
891 if ($yyact < self::YYNSTATE) {
892 if (!$this->yyTraceFILE && $yysize) {
893 $this->yyidx++;
894 $x = new TPC_yyStackEntry;
895 $x->stateno = $yyact;
896 $x->major = $yygoto;
897 $x->minor = $yy_lefthand_side;
898 $this->yystack[$this->yyidx] = $x;
899 } else {
900 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
901 }
902 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
903 $this->yy_accept();
904 }
905 }
906
907 public function yy_parse_failed()
908 {
909 if ($this->yyTraceFILE) {
910 fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
911 } while ($this->yyidx >= 0) {
912 $this->yy_pop_parser_stack();
913 }
914 }
915
916 public function yy_syntax_error($yymajor, $TOKEN)
917 {
918 #line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
919
920 $this->internalError = true;
921 $this->yymajor = $yymajor;
922 $this->compiler->trigger_config_file_error();
923 }
924
925 public function yy_accept()
926 {
927 if ($this->yyTraceFILE) {
928 fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
929 } while ($this->yyidx >= 0) {
930 $this->yy_pop_parser_stack();
931 }
932 #line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
933
934 $this->successful = !$this->internalError;
935 $this->internalError = false;
936 $this->retvalue = $this->_retvalue;
937 }
938
939 public function doParse($yymajor, $yytokenvalue)
940 {
941 $yyerrorhit = 0; /* True if yymajor has invoked an error */
942
943 if ($this->yyidx === null || $this->yyidx < 0) {
944 $this->yyidx = 0;
945 $this->yyerrcnt = -1;
946 $x = new TPC_yyStackEntry;
947 $x->stateno = 0;
948 $x->major = 0;
949 $this->yystack = array();
950 array_push($this->yystack, $x);
951 }
952 $yyendofinput = ($yymajor==0);
953
954 if ($this->yyTraceFILE) {
955 fprintf($this->yyTraceFILE, "%sInput %s\n",
956 $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
957 }
958
959 do {
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;
965 }
966 if ($yyact < self::YYNSTATE) {
967 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
968 $this->yyerrcnt--;
969 if ($yyendofinput && $this->yyidx >= 0) {
970 $yymajor = 0;
971 } else {
972 $yymajor = self::YYNOCODE;
973 }
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);
980 }
981 if (self::YYERRORSYMBOL) {
982 if ($this->yyerrcnt < 0) {
983 $this->yy_syntax_error($yymajor, $yytokenvalue);
984 }
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]);
990 }
991 $this->yy_destructor($yymajor, $yytokenvalue);
992 $yymajor = self::YYNOCODE;
993 } else {
994 while ($this->yyidx >= 0 &&
995 $yymx != self::YYERRORSYMBOL &&
996 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
997 ){
998 $this->yy_pop_parser_stack();
999 }
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) {
1005 $u2 = 0;
1006 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
1007 }
1008 }
1009 $this->yyerrcnt = 3;
1010 $yyerrorhit = 1;
1011 } else {
1012 if ($this->yyerrcnt <= 0) {
1013 $this->yy_syntax_error($yymajor, $yytokenvalue);
1014 }
1015 $this->yyerrcnt = 3;
1016 $this->yy_destructor($yymajor, $yytokenvalue);
1017 if ($yyendofinput) {
1018 $this->yy_parse_failed();
1019 }
1020 $yymajor = self::YYNOCODE;
1021 }
1022 } else {
1023 $this->yy_accept();
1024 $yymajor = self::YYNOCODE;
1025 }
1026 } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
1027 }
1028 }
1029