gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

smarty_internal_configfileparser.php (33814B)


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