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