source: pro-violet-viettel/sourcecode/application/third_party/Smarty/sysplugins/smarty_internal_configfileparser.php @ 914

Last change on this file since 914 was 345, checked in by quyenla, 11 years ago

collaborator page

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