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