library/smarty/libs/sysplugins/smarty_internal_templatelexer.php
changeset 46 f11c31f7fa3e
parent 45 a56e7f9a0463
child 47 03388ec805b4
equal deleted inserted replaced
45:a56e7f9a0463 46:f11c31f7fa3e
     1 <?php
       
     2 /**
       
     3  * Smarty Internal Plugin Templatelexer
       
     4  * This is the lexer to break the template source into tokens
       
     5  *
       
     6  * @package    Smarty
       
     7  * @subpackage Compiler
       
     8  * @author     Uwe Tews
       
     9  */
       
    10 
       
    11 /**
       
    12  * Smarty_Internal_Templatelexer
       
    13  * This is the template file lexer.
       
    14  * It is generated from the smarty_internal_templatelexer.plex file
       
    15  *
       
    16  * @package    Smarty
       
    17  * @subpackage Compiler
       
    18  * @author     Uwe Tews
       
    19  */
       
    20 class Smarty_Internal_Templatelexer {
       
    21     /**
       
    22      * Source
       
    23      *
       
    24      * @var string
       
    25      */
       
    26     public $data;
       
    27 
       
    28     /**
       
    29      * byte counter
       
    30      *
       
    31      * @var int
       
    32      */
       
    33     public $counter;
       
    34 
       
    35     /**
       
    36      * token number
       
    37      *
       
    38      * @var int
       
    39      */
       
    40     public $token;
       
    41 
       
    42     /**
       
    43      * token value
       
    44      *
       
    45      * @var string
       
    46      */
       
    47     public $value;
       
    48 
       
    49     /**
       
    50      * current line
       
    51      *
       
    52      * @var int
       
    53      */
       
    54     public $line;
       
    55 
       
    56     /**
       
    57      * tag start line
       
    58      *
       
    59      * @var
       
    60      */
       
    61     public $taglineno;
       
    62 
       
    63     /**
       
    64      * php code type
       
    65      *
       
    66      * @var string
       
    67      */
       
    68     public $phpType = '';
       
    69 
       
    70     /**
       
    71      * escaped left delimiter
       
    72      *
       
    73      * @var string
       
    74      */
       
    75     public $ldel = '';
       
    76 
       
    77     /**
       
    78      * escaped left delimiter length
       
    79      *
       
    80      * @var int
       
    81      */
       
    82     public $ldel_length = 0;
       
    83 
       
    84     /**
       
    85      * escaped right delimiter
       
    86      *
       
    87      * @var string
       
    88      */
       
    89     public $rdel = '';
       
    90 
       
    91     /**
       
    92      * escaped right delimiter length
       
    93      *
       
    94      * @var int
       
    95      */
       
    96     public $rdel_length = 0;
       
    97 
       
    98     /**
       
    99      * state number
       
   100      *
       
   101      * @var int
       
   102      */
       
   103     public $state = 1;
       
   104 
       
   105     /**
       
   106      * Smarty object
       
   107      *
       
   108      * @var Smarty
       
   109      */
       
   110     public $smarty = null;
       
   111 
       
   112     /**
       
   113      * compiler object
       
   114      *
       
   115      * @var Smarty_Internal_TemplateCompilerBase
       
   116      */
       
   117     public $compiler = null;
       
   118 
       
   119     /**
       
   120      * literal tag nesting level
       
   121      *
       
   122      * @var int
       
   123      */
       
   124     private $literal_cnt = 0;
       
   125 
       
   126     /**
       
   127      * PHP start tag string
       
   128      *
       
   129      * @var string
       
   130      */
       
   131 
       
   132     /**
       
   133      * trace file
       
   134      *
       
   135      * @var resource
       
   136      */
       
   137     public $yyTraceFILE;
       
   138 
       
   139     /**
       
   140      * trace prompt
       
   141      *
       
   142      * @var string
       
   143      */
       
   144     public $yyTracePrompt;
       
   145 
       
   146     /**
       
   147      * XML flag true while processing xml
       
   148      *
       
   149      * @var bool
       
   150      */
       
   151     public $is_xml = false;
       
   152 
       
   153     /**
       
   154      * state names
       
   155      *
       
   156      * @var array
       
   157      */
       
   158     public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',
       
   159         6 => 'CHILDBODY', 7 => 'CHILDBLOCK', 8 => 'CHILDLITERAL');
       
   160 
       
   161     /**
       
   162      * storage for assembled token patterns
       
   163      *
       
   164      * @var string
       
   165      */
       
   166     private $yy_global_pattern1 = null;
       
   167 
       
   168     private $yy_global_pattern2 = null;
       
   169 
       
   170     private $yy_global_pattern3 = null;
       
   171 
       
   172     private $yy_global_pattern4 = null;
       
   173 
       
   174     private $yy_global_pattern5 = null;
       
   175 
       
   176     private $yy_global_pattern6 = null;
       
   177 
       
   178     private $yy_global_pattern7 = null;
       
   179 
       
   180     private $yy_global_pattern8 = null;
       
   181 
       
   182     /**
       
   183      * token names
       
   184      *
       
   185      * @var array
       
   186      */
       
   187     public $smarty_token_names = array(        // Text for parser error messages
       
   188         'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', 'CLOSEB' => ']', 'PTR' => '->',
       
   189         'APTR' => '=>', 'EQUAL' => '=', 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%',
       
   190         'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$', 'SEMICOLON' => ';', 'COLON' => ':',
       
   191         'DOUBLECOLON' => '::', 'AT' => '@', 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', 'VERT' => '"|" modifier',
       
   192         'DOT' => '.', 'COMMA' => '","', 'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text',
       
   193         'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag', 'COMMENT' => 'comment', 'AS' => 'as',
       
   194         'TO' => 'to', 'PHP' => '"<?php", "<%", "{php}" tag', 'LOGOP' => '"<", "==" ... logical operator',
       
   195         'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
       
   196         'SCOND' => '"is even" ... if condition',);
       
   197 
       
   198     /**
       
   199      * constructor
       
   200      *
       
   201      * @param   string $data template source
       
   202      * @param Smarty_Internal_TemplateCompilerBase $compiler
       
   203      */
       
   204     function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler) {
       
   205         $this->data = $data;
       
   206         $this->counter = 0;
       
   207         if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) {
       
   208             $this->counter += strlen($match[0]);
       
   209         }
       
   210         $this->line = 1;
       
   211         $this->smarty = $compiler->smarty;
       
   212         $this->compiler = $compiler;
       
   213         $this->ldel = preg_quote($this->smarty->left_delimiter, '~');
       
   214         $this->ldel_length = strlen($this->smarty->left_delimiter);
       
   215         $this->rdel = preg_quote($this->smarty->right_delimiter, '~');
       
   216         $this->rdel_length = strlen($this->smarty->right_delimiter);
       
   217         $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
       
   218         $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
       
   219     }
       
   220 
       
   221     public function PrintTrace() {
       
   222         $this->yyTraceFILE = fopen('php://output', 'w');
       
   223         $this->yyTracePrompt = '<br>';
       
   224     }
       
   225 
       
   226     /*
       
   227      * Check if this tag is autoliteral
       
   228      */
       
   229     public function isAutoLiteral() {
       
   230         return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
       
   231     }
       
   232 
       
   233     private $_yy_state = 1;
       
   234 
       
   235     private $_yy_stack = array();
       
   236 
       
   237     public function yylex() {
       
   238         return $this->{'yylex' . $this->_yy_state}();
       
   239     }
       
   240 
       
   241     public function yypushstate($state) {
       
   242         if ($this->yyTraceFILE) {
       
   243             fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
       
   244         }
       
   245         array_push($this->_yy_stack, $this->_yy_state);
       
   246         $this->_yy_state = $state;
       
   247         if ($this->yyTraceFILE) {
       
   248             fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
       
   249         }
       
   250     }
       
   251 
       
   252     public function yypopstate() {
       
   253         if ($this->yyTraceFILE) {
       
   254             fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
       
   255         }
       
   256         $this->_yy_state = array_pop($this->_yy_stack);
       
   257         if ($this->yyTraceFILE) {
       
   258             fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
       
   259         }
       
   260     }
       
   261 
       
   262     public function yybegin($state) {
       
   263         $this->_yy_state = $state;
       
   264         if ($this->yyTraceFILE) {
       
   265             fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
       
   266         }
       
   267     }
       
   268 
       
   269     public function yylex1() {
       
   270         if (!isset($this->yy_global_pattern1)) {
       
   271             $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>])|(" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G([\S\s])/isS";
       
   272         }
       
   273         if ($this->counter >= strlen($this->data)) {
       
   274             return false; // end of input
       
   275         }
       
   276 
       
   277         do {
       
   278             if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
       
   279                 $yysubmatches = $yymatches;
       
   280                 if (strlen($yysubmatches[0]) < 200) {
       
   281                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   282                 } else {
       
   283                     $yymatches = array_filter($yymatches, 'strlen');
       
   284                 }
       
   285                 if (empty($yymatches)) {
       
   286                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state TEXT');
       
   287                 }
       
   288                 next($yymatches); // skip global match
       
   289                 $this->token = key($yymatches); // token number
       
   290                 $this->value = current($yymatches); // token value
       
   291                 $r = $this->{'yy_r1_' . $this->token}();
       
   292                 if ($r === null) {
       
   293                     $this->counter += strlen($this->value);
       
   294                     $this->line += substr_count($this->value, "\n");
       
   295                     // accept this token
       
   296                     return true;
       
   297                 } elseif ($r === true) {
       
   298                     // we have changed state
       
   299                     // process this token in the new state
       
   300                     return $this->yylex();
       
   301                 } elseif ($r === false) {
       
   302                     $this->counter += strlen($this->value);
       
   303                     $this->line += substr_count($this->value, "\n");
       
   304                     if ($this->counter >= strlen($this->data)) {
       
   305                         return false; // end of input
       
   306                     }
       
   307                     // skip this token
       
   308                     continue;
       
   309                 }
       
   310             } else {
       
   311                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   312             }
       
   313             break;
       
   314         } while (true);
       
   315     } // end function
       
   316 
       
   317     const TEXT = 1;
       
   318 
       
   319     function yy_r1_1() {
       
   320 
       
   321         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   322     }
       
   323 
       
   324     function yy_r1_2() {
       
   325 
       
   326         preg_match("~[*]{$this->rdel}~", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
   327         if (isset($match[0][1])) {
       
   328             $to = $match[0][1] + strlen($match[0][0]);
       
   329         } else {
       
   330             $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'");
       
   331         }
       
   332         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
   333         return false;
       
   334     }
       
   335 
       
   336     function yy_r1_3() {
       
   337 
       
   338         $obj = new Smarty_Internal_Compile_Private_Php();
       
   339         $obj->parsePhp($this);
       
   340     }
       
   341 
       
   342     function yy_r1_15() {
       
   343 
       
   344         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   345             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   346         } else {
       
   347             $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
       
   348             $this->yypushstate(self::LITERAL);
       
   349         }
       
   350     }
       
   351 
       
   352     function yy_r1_16() {
       
   353 
       
   354         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   355             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   356         } else {
       
   357             $this->yypushstate(self::TAG);
       
   358             return true;
       
   359         }
       
   360     }
       
   361 
       
   362     function yy_r1_17() {
       
   363 
       
   364         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   365     }
       
   366 
       
   367     function yy_r1_18() {
       
   368 
       
   369         $to = strlen($this->data);
       
   370         preg_match("~($this->ldel)|([<]script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*[>])|([<][?])|([<][%])|([?][>])|([%][>])~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
   371         if (isset($match[0][1])) {
       
   372             $to = $match[0][1];
       
   373         }
       
   374         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
   375         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   376     }
       
   377 
       
   378     public function yylex2() {
       
   379         if (!isset($this->yy_global_pattern2)) {
       
   380             $this->yy_global_pattern2 = "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS";
       
   381         }
       
   382         if ($this->counter >= strlen($this->data)) {
       
   383             return false; // end of input
       
   384         }
       
   385 
       
   386         do {
       
   387             if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
       
   388                 $yysubmatches = $yymatches;
       
   389                 if (strlen($yysubmatches[0]) < 200) {
       
   390                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   391                 } else {
       
   392                     $yymatches = array_filter($yymatches, 'strlen');
       
   393                 }
       
   394                 if (empty($yymatches)) {
       
   395                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state TAG');
       
   396                 }
       
   397                 next($yymatches); // skip global match
       
   398                 $this->token = key($yymatches); // token number
       
   399                 $this->value = current($yymatches); // token value
       
   400                 $r = $this->{'yy_r2_' . $this->token}();
       
   401                 if ($r === null) {
       
   402                     $this->counter += strlen($this->value);
       
   403                     $this->line += substr_count($this->value, "\n");
       
   404                     // accept this token
       
   405                     return true;
       
   406                 } elseif ($r === true) {
       
   407                     // we have changed state
       
   408                     // process this token in the new state
       
   409                     return $this->yylex();
       
   410                 } elseif ($r === false) {
       
   411                     $this->counter += strlen($this->value);
       
   412                     $this->line += substr_count($this->value, "\n");
       
   413                     if ($this->counter >= strlen($this->data)) {
       
   414                         return false; // end of input
       
   415                     }
       
   416                     // skip this token
       
   417                     continue;
       
   418                 }
       
   419             } else {
       
   420                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   421             }
       
   422             break;
       
   423         } while (true);
       
   424     } // end function
       
   425 
       
   426     const TAG = 2;
       
   427 
       
   428     function yy_r2_1() {
       
   429 
       
   430         $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
       
   431         $this->yybegin(self::TAGBODY);
       
   432         $this->taglineno = $this->line;
       
   433     }
       
   434 
       
   435     function yy_r2_3() {
       
   436 
       
   437         $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
       
   438         $this->yybegin(self::TAGBODY);
       
   439         $this->taglineno = $this->line;
       
   440     }
       
   441 
       
   442     function yy_r2_4() {
       
   443 
       
   444         $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
       
   445         $this->yybegin(self::TAGBODY);
       
   446         $this->taglineno = $this->line;
       
   447     }
       
   448 
       
   449     function yy_r2_5() {
       
   450 
       
   451         $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
       
   452         $this->yybegin(self::TAGBODY);
       
   453         $this->taglineno = $this->line;
       
   454     }
       
   455 
       
   456     function yy_r2_6() {
       
   457 
       
   458         $this->yypopstate();
       
   459         $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
       
   460         $this->taglineno = $this->line;
       
   461     }
       
   462 
       
   463     function yy_r2_8() {
       
   464 
       
   465         $this->yypopstate();
       
   466         $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
       
   467         $this->taglineno = $this->line;
       
   468     }
       
   469 
       
   470     function yy_r2_9() {
       
   471 
       
   472         if ($this->_yy_stack[count($this->_yy_stack) - 1] == self::TEXT) {
       
   473             $this->yypopstate();
       
   474             $this->token = Smarty_Internal_Templateparser::TP_SIMPLEOUTPUT;
       
   475             $this->taglineno = $this->line;
       
   476         } else {
       
   477             $this->value = $this->smarty->left_delimiter;
       
   478             $this->token = Smarty_Internal_Templateparser::TP_LDEL;
       
   479             $this->yybegin(self::TAGBODY);
       
   480             $this->taglineno = $this->line;
       
   481         }
       
   482     }
       
   483 
       
   484     function yy_r2_11() {
       
   485 
       
   486         $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
       
   487         $this->yybegin(self::TAGBODY);
       
   488         $this->taglineno = $this->line;
       
   489     }
       
   490 
       
   491     function yy_r2_12() {
       
   492 
       
   493         $this->token = Smarty_Internal_Templateparser::TP_LDEL;
       
   494         $this->yybegin(self::TAGBODY);
       
   495         $this->taglineno = $this->line;
       
   496     }
       
   497 
       
   498     public function yylex3() {
       
   499         if (!isset($this->yy_global_pattern3)) {
       
   500             $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\\s+(not\\s+)?(odd|even|div)\\s+by))\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/isS";
       
   501         }
       
   502         if ($this->counter >= strlen($this->data)) {
       
   503             return false; // end of input
       
   504         }
       
   505 
       
   506         do {
       
   507             if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
       
   508                 $yysubmatches = $yymatches;
       
   509                 if (strlen($yysubmatches[0]) < 200) {
       
   510                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   511                 } else {
       
   512                     $yymatches = array_filter($yymatches, 'strlen');
       
   513                 }
       
   514                 if (empty($yymatches)) {
       
   515                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state TAGBODY     ');
       
   516                 }
       
   517                 next($yymatches); // skip global match
       
   518                 $this->token = key($yymatches); // token number
       
   519                 $this->value = current($yymatches); // token value
       
   520                 $r = $this->{'yy_r3_' . $this->token}();
       
   521                 if ($r === null) {
       
   522                     $this->counter += strlen($this->value);
       
   523                     $this->line += substr_count($this->value, "\n");
       
   524                     // accept this token
       
   525                     return true;
       
   526                 } elseif ($r === true) {
       
   527                     // we have changed state
       
   528                     // process this token in the new state
       
   529                     return $this->yylex();
       
   530                 } elseif ($r === false) {
       
   531                     $this->counter += strlen($this->value);
       
   532                     $this->line += substr_count($this->value, "\n");
       
   533                     if ($this->counter >= strlen($this->data)) {
       
   534                         return false; // end of input
       
   535                     }
       
   536                     // skip this token
       
   537                     continue;
       
   538                 }
       
   539             } else {
       
   540                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   541             }
       
   542             break;
       
   543         } while (true);
       
   544     } // end function
       
   545 
       
   546     const TAGBODY = 3;
       
   547 
       
   548     function yy_r3_1() {
       
   549 
       
   550         $this->token = Smarty_Internal_Templateparser::TP_RDEL;
       
   551         $this->yypopstate();
       
   552     }
       
   553 
       
   554     function yy_r3_2() {
       
   555 
       
   556         $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
       
   557         $this->yypushstate(self::DOUBLEQUOTEDSTRING);
       
   558     }
       
   559 
       
   560     function yy_r3_3() {
       
   561 
       
   562         $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
       
   563     }
       
   564 
       
   565     function yy_r3_4() {
       
   566 
       
   567         $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
       
   568         $this->taglineno = $this->line;
       
   569     }
       
   570 
       
   571     function yy_r3_6() {
       
   572 
       
   573         $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
       
   574     }
       
   575 
       
   576     function yy_r3_7() {
       
   577 
       
   578         $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
       
   579     }
       
   580 
       
   581     function yy_r3_8() {
       
   582 
       
   583         $this->token = Smarty_Internal_Templateparser::TP_ISIN;
       
   584     }
       
   585 
       
   586     function yy_r3_9() {
       
   587 
       
   588         $this->token = Smarty_Internal_Templateparser::TP_AS;
       
   589     }
       
   590 
       
   591     function yy_r3_10() {
       
   592 
       
   593         $this->token = Smarty_Internal_Templateparser::TP_TO;
       
   594     }
       
   595 
       
   596     function yy_r3_11() {
       
   597 
       
   598         $this->token = Smarty_Internal_Templateparser::TP_STEP;
       
   599     }
       
   600 
       
   601     function yy_r3_12() {
       
   602 
       
   603         $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
       
   604     }
       
   605 
       
   606     function yy_r3_13() {
       
   607 
       
   608         $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
       
   609     }
       
   610 
       
   611     function yy_r3_18() {
       
   612 
       
   613         $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
       
   614     }
       
   615 
       
   616     function yy_r3_23() {
       
   617 
       
   618         $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
       
   619     }
       
   620 
       
   621     function yy_r3_26() {
       
   622 
       
   623         $this->token = Smarty_Internal_Templateparser::TP_NOT;
       
   624     }
       
   625 
       
   626     function yy_r3_29() {
       
   627 
       
   628         $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
       
   629     }
       
   630 
       
   631     function yy_r3_33() {
       
   632 
       
   633         $this->token = Smarty_Internal_Templateparser::TP_OPENP;
       
   634     }
       
   635 
       
   636     function yy_r3_34() {
       
   637 
       
   638         $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
       
   639     }
       
   640 
       
   641     function yy_r3_35() {
       
   642 
       
   643         $this->token = Smarty_Internal_Templateparser::TP_OPENB;
       
   644     }
       
   645 
       
   646     function yy_r3_36() {
       
   647 
       
   648         $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
       
   649     }
       
   650 
       
   651     function yy_r3_37() {
       
   652 
       
   653         $this->token = Smarty_Internal_Templateparser::TP_PTR;
       
   654     }
       
   655 
       
   656     function yy_r3_38() {
       
   657 
       
   658         $this->token = Smarty_Internal_Templateparser::TP_APTR;
       
   659     }
       
   660 
       
   661     function yy_r3_39() {
       
   662 
       
   663         $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
       
   664     }
       
   665 
       
   666     function yy_r3_40() {
       
   667 
       
   668         $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
       
   669     }
       
   670 
       
   671     function yy_r3_42() {
       
   672 
       
   673         $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
       
   674     }
       
   675 
       
   676     function yy_r3_44() {
       
   677 
       
   678         $this->token = Smarty_Internal_Templateparser::TP_MATH;
       
   679     }
       
   680 
       
   681     function yy_r3_46() {
       
   682 
       
   683         $this->token = Smarty_Internal_Templateparser::TP_AT;
       
   684     }
       
   685 
       
   686     function yy_r3_47() {
       
   687 
       
   688         $this->token = Smarty_Internal_Templateparser::TP_HATCH;
       
   689     }
       
   690 
       
   691     function yy_r3_48() {
       
   692 
       
   693         // resolve conflicts with shorttag and right_delimiter starting with '='
       
   694         if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) {
       
   695             preg_match("~\s+~", $this->value, $match);
       
   696             $this->value = $match[0];
       
   697             $this->token = Smarty_Internal_Templateparser::TP_SPACE;
       
   698         } else {
       
   699             $this->token = Smarty_Internal_Templateparser::TP_ATTR;
       
   700         }
       
   701     }
       
   702 
       
   703     function yy_r3_49() {
       
   704 
       
   705         $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
       
   706     }
       
   707 
       
   708     function yy_r3_52() {
       
   709 
       
   710         $this->token = Smarty_Internal_Templateparser::TP_ID;
       
   711     }
       
   712 
       
   713     function yy_r3_53() {
       
   714 
       
   715         $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
       
   716     }
       
   717 
       
   718     function yy_r3_54() {
       
   719 
       
   720         $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
       
   721         $this->yypopstate();
       
   722     }
       
   723 
       
   724     function yy_r3_55() {
       
   725 
       
   726         $this->token = Smarty_Internal_Templateparser::TP_VERT;
       
   727     }
       
   728 
       
   729     function yy_r3_56() {
       
   730 
       
   731         $this->token = Smarty_Internal_Templateparser::TP_DOT;
       
   732     }
       
   733 
       
   734     function yy_r3_57() {
       
   735 
       
   736         $this->token = Smarty_Internal_Templateparser::TP_COMMA;
       
   737     }
       
   738 
       
   739     function yy_r3_58() {
       
   740 
       
   741         $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
       
   742     }
       
   743 
       
   744     function yy_r3_59() {
       
   745 
       
   746         $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
       
   747     }
       
   748 
       
   749     function yy_r3_60() {
       
   750 
       
   751         $this->token = Smarty_Internal_Templateparser::TP_COLON;
       
   752     }
       
   753 
       
   754     function yy_r3_61() {
       
   755 
       
   756         $this->token = Smarty_Internal_Templateparser::TP_QMARK;
       
   757     }
       
   758 
       
   759     function yy_r3_62() {
       
   760 
       
   761         $this->token = Smarty_Internal_Templateparser::TP_HEX;
       
   762     }
       
   763 
       
   764     function yy_r3_63() {
       
   765 
       
   766         $this->token = Smarty_Internal_Templateparser::TP_SPACE;
       
   767     }
       
   768 
       
   769     function yy_r3_64() {
       
   770 
       
   771         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   772             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   773         } else {
       
   774             $this->yypushstate(self::TAG);
       
   775             return true;
       
   776         }
       
   777     }
       
   778 
       
   779     function yy_r3_65() {
       
   780 
       
   781         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   782     }
       
   783 
       
   784     public function yylex4() {
       
   785         if (!isset($this->yy_global_pattern4)) {
       
   786             $this->yy_global_pattern4 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS";
       
   787         }
       
   788         if ($this->counter >= strlen($this->data)) {
       
   789             return false; // end of input
       
   790         }
       
   791 
       
   792         do {
       
   793             if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
       
   794                 $yysubmatches = $yymatches;
       
   795                 if (strlen($yysubmatches[0]) < 200) {
       
   796                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   797                 } else {
       
   798                     $yymatches = array_filter($yymatches, 'strlen');
       
   799                 }
       
   800                 if (empty($yymatches)) {
       
   801                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state LITERAL');
       
   802                 }
       
   803                 next($yymatches); // skip global match
       
   804                 $this->token = key($yymatches); // token number
       
   805                 $this->value = current($yymatches); // token value
       
   806                 $r = $this->{'yy_r4_' . $this->token}();
       
   807                 if ($r === null) {
       
   808                     $this->counter += strlen($this->value);
       
   809                     $this->line += substr_count($this->value, "\n");
       
   810                     // accept this token
       
   811                     return true;
       
   812                 } elseif ($r === true) {
       
   813                     // we have changed state
       
   814                     // process this token in the new state
       
   815                     return $this->yylex();
       
   816                 } elseif ($r === false) {
       
   817                     $this->counter += strlen($this->value);
       
   818                     $this->line += substr_count($this->value, "\n");
       
   819                     if ($this->counter >= strlen($this->data)) {
       
   820                         return false; // end of input
       
   821                     }
       
   822                     // skip this token
       
   823                     continue;
       
   824                 }
       
   825             } else {
       
   826                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   827             }
       
   828             break;
       
   829         } while (true);
       
   830     } // end function
       
   831 
       
   832     const LITERAL = 4;
       
   833 
       
   834     function yy_r4_1() {
       
   835 
       
   836         $this->literal_cnt++;
       
   837         $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
       
   838     }
       
   839 
       
   840     function yy_r4_2() {
       
   841 
       
   842         if ($this->literal_cnt) {
       
   843             $this->literal_cnt--;
       
   844             $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
       
   845         } else {
       
   846             $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
       
   847             $this->yypopstate();
       
   848         }
       
   849     }
       
   850 
       
   851     function yy_r4_3() {
       
   852 
       
   853         $to = strlen($this->data);
       
   854         preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
   855         if (isset($match[0][1])) {
       
   856             $to = $match[0][1];
       
   857         } else {
       
   858             $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
       
   859         }
       
   860         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
   861         $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
       
   862     }
       
   863 
       
   864     public function yylex5() {
       
   865         if (!isset($this->yy_global_pattern5)) {
       
   866             $this->yy_global_pattern5 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" . $this->ldel . "\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS";
       
   867         }
       
   868         if ($this->counter >= strlen($this->data)) {
       
   869             return false; // end of input
       
   870         }
       
   871 
       
   872         do {
       
   873             if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
       
   874                 $yysubmatches = $yymatches;
       
   875                 if (strlen($yysubmatches[0]) < 200) {
       
   876                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   877                 } else {
       
   878                     $yymatches = array_filter($yymatches, 'strlen');
       
   879                 }
       
   880                 if (empty($yymatches)) {
       
   881                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
       
   882                 }
       
   883                 next($yymatches); // skip global match
       
   884                 $this->token = key($yymatches); // token number
       
   885                 $this->value = current($yymatches); // token value
       
   886                 $r = $this->{'yy_r5_' . $this->token}();
       
   887                 if ($r === null) {
       
   888                     $this->counter += strlen($this->value);
       
   889                     $this->line += substr_count($this->value, "\n");
       
   890                     // accept this token
       
   891                     return true;
       
   892                 } elseif ($r === true) {
       
   893                     // we have changed state
       
   894                     // process this token in the new state
       
   895                     return $this->yylex();
       
   896                 } elseif ($r === false) {
       
   897                     $this->counter += strlen($this->value);
       
   898                     $this->line += substr_count($this->value, "\n");
       
   899                     if ($this->counter >= strlen($this->data)) {
       
   900                         return false; // end of input
       
   901                     }
       
   902                     // skip this token
       
   903                     continue;
       
   904                 }
       
   905             } else {
       
   906                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   907             }
       
   908             break;
       
   909         } while (true);
       
   910     } // end function
       
   911 
       
   912     const DOUBLEQUOTEDSTRING = 5;
       
   913 
       
   914     function yy_r5_1() {
       
   915 
       
   916         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   917     }
       
   918 
       
   919     function yy_r5_2() {
       
   920 
       
   921         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   922     }
       
   923 
       
   924     function yy_r5_3() {
       
   925 
       
   926         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   927             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   928         } else {
       
   929             $this->yypushstate(self::TAG);
       
   930             return true;
       
   931         }
       
   932     }
       
   933 
       
   934     function yy_r5_4() {
       
   935 
       
   936         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   937             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   938         } else {
       
   939             $this->yypushstate(self::TAG);
       
   940             return true;
       
   941         }
       
   942     }
       
   943 
       
   944     function yy_r5_5() {
       
   945 
       
   946         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
   947             $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   948         } else {
       
   949             $this->token = Smarty_Internal_Templateparser::TP_LDEL;
       
   950             $this->taglineno = $this->line;
       
   951             $this->yypushstate(self::TAGBODY);
       
   952         }
       
   953     }
       
   954 
       
   955     function yy_r5_6() {
       
   956 
       
   957         $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
       
   958         $this->yypopstate();
       
   959     }
       
   960 
       
   961     function yy_r5_7() {
       
   962 
       
   963         $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
       
   964         $this->value = substr($this->value, 0, -1);
       
   965         $this->yypushstate(self::TAGBODY);
       
   966         $this->taglineno = $this->line;
       
   967     }
       
   968 
       
   969     function yy_r5_8() {
       
   970 
       
   971         $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
       
   972     }
       
   973 
       
   974     function yy_r5_9() {
       
   975 
       
   976         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   977     }
       
   978 
       
   979     function yy_r5_10() {
       
   980 
       
   981         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   982     }
       
   983 
       
   984     function yy_r5_14() {
       
   985 
       
   986         $to = strlen($this->data);
       
   987         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
   988         $this->token = Smarty_Internal_Templateparser::TP_TEXT;
       
   989     }
       
   990 
       
   991     public function yylex6() {
       
   992         if (!isset($this->yy_global_pattern6)) {
       
   993             $this->yy_global_pattern6 = "/\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G([\S\s])/isS";
       
   994         }
       
   995         if ($this->counter >= strlen($this->data)) {
       
   996             return false; // end of input
       
   997         }
       
   998 
       
   999         do {
       
  1000             if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) {
       
  1001                 $yysubmatches = $yymatches;
       
  1002                 if (strlen($yysubmatches[0]) < 200) {
       
  1003                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
  1004                 } else {
       
  1005                     $yymatches = array_filter($yymatches, 'strlen');
       
  1006                 }
       
  1007                 if (empty($yymatches)) {
       
  1008                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBODY');
       
  1009                 }
       
  1010                 next($yymatches); // skip global match
       
  1011                 $this->token = key($yymatches); // token number
       
  1012                 $this->value = current($yymatches); // token value
       
  1013                 $r = $this->{'yy_r6_' . $this->token}();
       
  1014                 if ($r === null) {
       
  1015                     $this->counter += strlen($this->value);
       
  1016                     $this->line += substr_count($this->value, "\n");
       
  1017                     // accept this token
       
  1018                     return true;
       
  1019                 } elseif ($r === true) {
       
  1020                     // we have changed state
       
  1021                     // process this token in the new state
       
  1022                     return $this->yylex();
       
  1023                 } elseif ($r === false) {
       
  1024                     $this->counter += strlen($this->value);
       
  1025                     $this->line += substr_count($this->value, "\n");
       
  1026                     if ($this->counter >= strlen($this->data)) {
       
  1027                         return false; // end of input
       
  1028                     }
       
  1029                     // skip this token
       
  1030                     continue;
       
  1031                 }
       
  1032             } else {
       
  1033                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
  1034             }
       
  1035             break;
       
  1036         } while (true);
       
  1037     } // end function
       
  1038 
       
  1039     const CHILDBODY = 6;
       
  1040 
       
  1041     function yy_r6_1() {
       
  1042 
       
  1043         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1044             return false;
       
  1045         } else {
       
  1046             $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
       
  1047         }
       
  1048     }
       
  1049 
       
  1050     function yy_r6_2() {
       
  1051 
       
  1052         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1053             return false;
       
  1054         } else {
       
  1055             $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
       
  1056         }
       
  1057     }
       
  1058 
       
  1059     function yy_r6_3() {
       
  1060 
       
  1061         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1062             return false;
       
  1063         } else {
       
  1064             $this->yypopstate();
       
  1065             return true;
       
  1066         }
       
  1067     }
       
  1068 
       
  1069     function yy_r6_4() {
       
  1070 
       
  1071         $to = strlen($this->data);
       
  1072         preg_match("~" . $this->ldel . "\s*(([/])?strip\s*" . $this->rdel . "|block\s+)~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
  1073         if (isset($match[0][1])) {
       
  1074             $to = $match[0][1];
       
  1075         }
       
  1076         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
  1077         return false;
       
  1078     }
       
  1079 
       
  1080     public function yylex7() {
       
  1081         if (!isset($this->yy_global_pattern7)) {
       
  1082             $this->yy_global_pattern7 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G(" . $this->ldel . "\\s*[\/]block)|\G(" . $this->ldel . "\\s*[$]smarty\\.block\\.(child|parent))|\G([\S\s])/isS";
       
  1083         }
       
  1084         if ($this->counter >= strlen($this->data)) {
       
  1085             return false; // end of input
       
  1086         }
       
  1087 
       
  1088         do {
       
  1089             if (preg_match($this->yy_global_pattern7, $this->data, $yymatches, null, $this->counter)) {
       
  1090                 $yysubmatches = $yymatches;
       
  1091                 if (strlen($yysubmatches[0]) < 200) {
       
  1092                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
  1093                 } else {
       
  1094                     $yymatches = array_filter($yymatches, 'strlen');
       
  1095                 }
       
  1096                 if (empty($yymatches)) {
       
  1097                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBLOCK');
       
  1098                 }
       
  1099                 next($yymatches); // skip global match
       
  1100                 $this->token = key($yymatches); // token number
       
  1101                 $this->value = current($yymatches); // token value
       
  1102                 $r = $this->{'yy_r7_' . $this->token}();
       
  1103                 if ($r === null) {
       
  1104                     $this->counter += strlen($this->value);
       
  1105                     $this->line += substr_count($this->value, "\n");
       
  1106                     // accept this token
       
  1107                     return true;
       
  1108                 } elseif ($r === true) {
       
  1109                     // we have changed state
       
  1110                     // process this token in the new state
       
  1111                     return $this->yylex();
       
  1112                 } elseif ($r === false) {
       
  1113                     $this->counter += strlen($this->value);
       
  1114                     $this->line += substr_count($this->value, "\n");
       
  1115                     if ($this->counter >= strlen($this->data)) {
       
  1116                         return false; // end of input
       
  1117                     }
       
  1118                     // skip this token
       
  1119                     continue;
       
  1120                 }
       
  1121             } else {
       
  1122                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
  1123             }
       
  1124             break;
       
  1125         } while (true);
       
  1126     } // end function
       
  1127 
       
  1128     const CHILDBLOCK = 7;
       
  1129 
       
  1130     function yy_r7_1() {
       
  1131 
       
  1132         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1133             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1134         } else {
       
  1135             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1136             $this->yypushstate(self::CHILDLITERAL);
       
  1137         }
       
  1138     }
       
  1139 
       
  1140     function yy_r7_2() {
       
  1141 
       
  1142         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1143             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1144         } else {
       
  1145             $this->yypopstate();
       
  1146             return true;
       
  1147         }
       
  1148     }
       
  1149 
       
  1150     function yy_r7_3() {
       
  1151 
       
  1152         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1153             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1154         } else {
       
  1155             $this->yypopstate();
       
  1156             return true;
       
  1157         }
       
  1158     }
       
  1159 
       
  1160     function yy_r7_4() {
       
  1161 
       
  1162         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1163             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1164         } else {
       
  1165             $this->yypopstate();
       
  1166             return true;
       
  1167         }
       
  1168     }
       
  1169 
       
  1170     function yy_r7_6() {
       
  1171 
       
  1172         $to = strlen($this->data);
       
  1173         preg_match("~" . $this->ldel . "\s*(literal\s*" . $this->rdel . "|([/])?block(\s|" . $this->rdel . ")|[\$]smarty\.block\.(child|parent))~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
  1174         if (isset($match[0][1])) {
       
  1175             $to = $match[0][1];
       
  1176         }
       
  1177         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
  1178         $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1179     }
       
  1180 
       
  1181     public function yylex8() {
       
  1182         if (!isset($this->yy_global_pattern8)) {
       
  1183             $this->yy_global_pattern8 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS";
       
  1184         }
       
  1185         if ($this->counter >= strlen($this->data)) {
       
  1186             return false; // end of input
       
  1187         }
       
  1188 
       
  1189         do {
       
  1190             if (preg_match($this->yy_global_pattern8, $this->data, $yymatches, null, $this->counter)) {
       
  1191                 $yysubmatches = $yymatches;
       
  1192                 if (strlen($yysubmatches[0]) < 200) {
       
  1193                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
  1194                 } else {
       
  1195                     $yymatches = array_filter($yymatches, 'strlen');
       
  1196                 }
       
  1197                 if (empty($yymatches)) {
       
  1198                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state CHILDLITERAL');
       
  1199                 }
       
  1200                 next($yymatches); // skip global match
       
  1201                 $this->token = key($yymatches); // token number
       
  1202                 $this->value = current($yymatches); // token value
       
  1203                 $r = $this->{'yy_r8_' . $this->token}();
       
  1204                 if ($r === null) {
       
  1205                     $this->counter += strlen($this->value);
       
  1206                     $this->line += substr_count($this->value, "\n");
       
  1207                     // accept this token
       
  1208                     return true;
       
  1209                 } elseif ($r === true) {
       
  1210                     // we have changed state
       
  1211                     // process this token in the new state
       
  1212                     return $this->yylex();
       
  1213                 } elseif ($r === false) {
       
  1214                     $this->counter += strlen($this->value);
       
  1215                     $this->line += substr_count($this->value, "\n");
       
  1216                     if ($this->counter >= strlen($this->data)) {
       
  1217                         return false; // end of input
       
  1218                     }
       
  1219                     // skip this token
       
  1220                     continue;
       
  1221                 }
       
  1222             } else {
       
  1223                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
  1224             }
       
  1225             break;
       
  1226         } while (true);
       
  1227     } // end function
       
  1228 
       
  1229     const CHILDLITERAL = 8;
       
  1230 
       
  1231     function yy_r8_1() {
       
  1232 
       
  1233         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1234             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1235         } else {
       
  1236             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1237             $this->yypushstate(self::CHILDLITERAL);
       
  1238         }
       
  1239     }
       
  1240 
       
  1241     function yy_r8_2() {
       
  1242 
       
  1243         if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
       
  1244             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1245         } else {
       
  1246             $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1247             $this->yypopstate();
       
  1248         }
       
  1249     }
       
  1250 
       
  1251     function yy_r8_3() {
       
  1252 
       
  1253         $to = strlen($this->data);
       
  1254         preg_match("~{$this->ldel}[/]?literal\s*{$this->rdel}~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
  1255         if (isset($match[0][1])) {
       
  1256             $to = $match[0][1];
       
  1257         } else {
       
  1258             $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
       
  1259         }
       
  1260         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
  1261         $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
       
  1262     }
       
  1263 
       
  1264 }
       
  1265 
       
  1266