library/smarty/libs/sysplugins/smarty_internal_configfilelexer.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 Configfilelexer
       
     4  *
       
     5  * This is the lexer to break the config file source into tokens
       
     6  *
       
     7  * @package    Smarty
       
     8  * @subpackage Config
       
     9  * @author     Uwe Tews
       
    10  */
       
    11 
       
    12 /**
       
    13  * Smarty_Internal_Configfilelexer
       
    14  *
       
    15  * This is the config file lexer.
       
    16  * It is generated from the smarty_internal_configfilelexer.plex file
       
    17  *
       
    18  * @package    Smarty
       
    19  * @subpackage Compiler
       
    20  * @author     Uwe Tews
       
    21  */
       
    22 class Smarty_Internal_Configfilelexer {
       
    23     /**
       
    24      * Source
       
    25      *
       
    26      * @var string
       
    27      */
       
    28     public $data;
       
    29 
       
    30     /**
       
    31      * byte counter
       
    32      *
       
    33      * @var int
       
    34      */
       
    35     public $counter;
       
    36 
       
    37     /**
       
    38      * token number
       
    39      *
       
    40      * @var int
       
    41      */
       
    42     public $token;
       
    43 
       
    44     /**
       
    45      * token value
       
    46      *
       
    47      * @var string
       
    48      */
       
    49     public $value;
       
    50 
       
    51     /**
       
    52      * current line
       
    53      *
       
    54      * @var int
       
    55      */
       
    56     public $line;
       
    57 
       
    58     /**
       
    59      * state number
       
    60      *
       
    61      * @var int
       
    62      */
       
    63     public $state = 1;
       
    64 
       
    65     /**
       
    66      * Smarty object
       
    67      *
       
    68      * @var Smarty
       
    69      */
       
    70     public $smarty = null;
       
    71 
       
    72     /**
       
    73      * compiler object
       
    74      *
       
    75      * @var Smarty_Internal_Config_File_Compiler
       
    76      */
       
    77     private $compiler = null;
       
    78 
       
    79     /**
       
    80      * copy of config_booleanize
       
    81      *
       
    82      * @var bool
       
    83      */
       
    84     private $configBooleanize = false;
       
    85 
       
    86     /**
       
    87      * trace file
       
    88      *
       
    89      * @var resource
       
    90      */
       
    91     public $yyTraceFILE;
       
    92 
       
    93     /**
       
    94      * trace prompt
       
    95      *
       
    96      * @var string
       
    97      */
       
    98     public $yyTracePrompt;
       
    99 
       
   100     /**
       
   101      * state names
       
   102      *
       
   103      * @var array
       
   104      */
       
   105     public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION',
       
   106         6 => 'TRIPPLE');
       
   107 
       
   108     /**
       
   109      * storage for assembled token patterns
       
   110      *
       
   111      * @var sring
       
   112      */
       
   113     private $yy_global_pattern1 = null;
       
   114 
       
   115     private $yy_global_pattern2 = null;
       
   116 
       
   117     private $yy_global_pattern3 = null;
       
   118 
       
   119     private $yy_global_pattern4 = null;
       
   120 
       
   121     private $yy_global_pattern5 = null;
       
   122 
       
   123     private $yy_global_pattern6 = null;
       
   124 
       
   125     /**
       
   126      * token names
       
   127      *
       
   128      * @var array
       
   129      */
       
   130     public $smarty_token_names = array(        // Text for parser error messages
       
   131     );
       
   132 
       
   133     /**
       
   134      * constructor
       
   135      *
       
   136      * @param   string $data template source
       
   137      * @param Smarty_Internal_Config_File_Compiler $compiler
       
   138      */
       
   139     function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) {
       
   140         // set instance object
       
   141         self::instance($this);
       
   142         $this->data = $data . "\n"; //now all lines are \n-terminated
       
   143         $this->counter = 0;
       
   144         if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
       
   145             $this->counter += strlen($match[0]);
       
   146         }
       
   147         $this->line = 1;
       
   148         $this->compiler = $compiler;
       
   149         $this->smarty = $compiler->smarty;
       
   150         $this->configBooleanize = $this->smarty->config_booleanize;
       
   151     }
       
   152 
       
   153     public static function &instance($new_instance = null) {
       
   154         static $instance = null;
       
   155         if (isset($new_instance) && is_object($new_instance)) {
       
   156             $instance = $new_instance;
       
   157         }
       
   158         return $instance;
       
   159     }
       
   160 
       
   161     public function PrintTrace() {
       
   162         $this->yyTraceFILE = fopen('php://output', 'w');
       
   163         $this->yyTracePrompt = '<br>';
       
   164     }
       
   165 
       
   166     private $_yy_state = 1;
       
   167 
       
   168     private $_yy_stack = array();
       
   169 
       
   170     public function yylex() {
       
   171         return $this->{'yylex' . $this->_yy_state}();
       
   172     }
       
   173 
       
   174     public function yypushstate($state) {
       
   175         if ($this->yyTraceFILE) {
       
   176             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);
       
   177         }
       
   178         array_push($this->_yy_stack, $this->_yy_state);
       
   179         $this->_yy_state = $state;
       
   180         if ($this->yyTraceFILE) {
       
   181             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);
       
   182         }
       
   183     }
       
   184 
       
   185     public function yypopstate() {
       
   186         if ($this->yyTraceFILE) {
       
   187             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);
       
   188         }
       
   189         $this->_yy_state = array_pop($this->_yy_stack);
       
   190         if ($this->yyTraceFILE) {
       
   191             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);
       
   192         }
       
   193     }
       
   194 
       
   195     public function yybegin($state) {
       
   196         $this->_yy_state = $state;
       
   197         if ($this->yyTraceFILE) {
       
   198             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);
       
   199         }
       
   200     }
       
   201 
       
   202     public function yylex1() {
       
   203         if (!isset($this->yy_global_pattern1)) {
       
   204             $this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS";
       
   205         }
       
   206         if ($this->counter >= strlen($this->data)) {
       
   207             return false; // end of input
       
   208         }
       
   209 
       
   210         do {
       
   211             if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
       
   212                 $yysubmatches = $yymatches;
       
   213                 if (strlen($yysubmatches[0]) < 200) {
       
   214                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   215                 } else {
       
   216                     $yymatches = array_filter($yymatches, 'strlen');
       
   217                 }
       
   218                 if (empty($yymatches)) {
       
   219                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state START');
       
   220                 }
       
   221                 next($yymatches); // skip global match
       
   222                 $this->token = key($yymatches); // token number
       
   223                 $this->value = current($yymatches); // token value
       
   224                 $r = $this->{'yy_r1_' . $this->token}();
       
   225                 if ($r === null) {
       
   226                     $this->counter += strlen($this->value);
       
   227                     $this->line += substr_count($this->value, "\n");
       
   228                     // accept this token
       
   229                     return true;
       
   230                 } elseif ($r === true) {
       
   231                     // we have changed state
       
   232                     // process this token in the new state
       
   233                     return $this->yylex();
       
   234                 } elseif ($r === false) {
       
   235                     $this->counter += strlen($this->value);
       
   236                     $this->line += substr_count($this->value, "\n");
       
   237                     if ($this->counter >= strlen($this->data)) {
       
   238                         return false; // end of input
       
   239                     }
       
   240                     // skip this token
       
   241                     continue;
       
   242                 }
       
   243             } else {
       
   244                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   245             }
       
   246             break;
       
   247         } while (true);
       
   248     } // end function
       
   249 
       
   250     const START = 1;
       
   251 
       
   252     function yy_r1_1() {
       
   253 
       
   254         $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
       
   255         $this->yypushstate(self::COMMENT);
       
   256     }
       
   257 
       
   258     function yy_r1_2() {
       
   259 
       
   260         $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
       
   261         $this->yypushstate(self::SECTION);
       
   262     }
       
   263 
       
   264     function yy_r1_3() {
       
   265 
       
   266         $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
       
   267     }
       
   268 
       
   269     function yy_r1_4() {
       
   270 
       
   271         $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
       
   272         $this->yypushstate(self::VALUE);
       
   273     }
       
   274 
       
   275     function yy_r1_5() {
       
   276 
       
   277         return false;
       
   278     }
       
   279 
       
   280     function yy_r1_6() {
       
   281 
       
   282         $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
       
   283     }
       
   284 
       
   285     function yy_r1_7() {
       
   286 
       
   287         $this->token = Smarty_Internal_Configfileparser::TPC_ID;
       
   288     }
       
   289 
       
   290     function yy_r1_8() {
       
   291 
       
   292         $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
       
   293     }
       
   294 
       
   295     public function yylex2() {
       
   296         if (!isset($this->yy_global_pattern2)) {
       
   297             $this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
       
   298         }
       
   299         if ($this->counter >= strlen($this->data)) {
       
   300             return false; // end of input
       
   301         }
       
   302 
       
   303         do {
       
   304             if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
       
   305                 $yysubmatches = $yymatches;
       
   306                 if (strlen($yysubmatches[0]) < 200) {
       
   307                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   308                 } else {
       
   309                     $yymatches = array_filter($yymatches, 'strlen');
       
   310                 }
       
   311                 if (empty($yymatches)) {
       
   312                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state VALUE');
       
   313                 }
       
   314                 next($yymatches); // skip global match
       
   315                 $this->token = key($yymatches); // token number
       
   316                 $this->value = current($yymatches); // token value
       
   317                 $r = $this->{'yy_r2_' . $this->token}();
       
   318                 if ($r === null) {
       
   319                     $this->counter += strlen($this->value);
       
   320                     $this->line += substr_count($this->value, "\n");
       
   321                     // accept this token
       
   322                     return true;
       
   323                 } elseif ($r === true) {
       
   324                     // we have changed state
       
   325                     // process this token in the new state
       
   326                     return $this->yylex();
       
   327                 } elseif ($r === false) {
       
   328                     $this->counter += strlen($this->value);
       
   329                     $this->line += substr_count($this->value, "\n");
       
   330                     if ($this->counter >= strlen($this->data)) {
       
   331                         return false; // end of input
       
   332                     }
       
   333                     // skip this token
       
   334                     continue;
       
   335                 }
       
   336             } else {
       
   337                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   338             }
       
   339             break;
       
   340         } while (true);
       
   341     } // end function
       
   342 
       
   343     const VALUE = 2;
       
   344 
       
   345     function yy_r2_1() {
       
   346 
       
   347         return false;
       
   348     }
       
   349 
       
   350     function yy_r2_2() {
       
   351 
       
   352         $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
       
   353         $this->yypopstate();
       
   354     }
       
   355 
       
   356     function yy_r2_3() {
       
   357 
       
   358         $this->token = Smarty_Internal_Configfileparser::TPC_INT;
       
   359         $this->yypopstate();
       
   360     }
       
   361 
       
   362     function yy_r2_4() {
       
   363 
       
   364         $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
       
   365         $this->yypushstate(self::TRIPPLE);
       
   366     }
       
   367 
       
   368     function yy_r2_5() {
       
   369 
       
   370         $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
       
   371         $this->yypopstate();
       
   372     }
       
   373 
       
   374     function yy_r2_6() {
       
   375 
       
   376         $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
       
   377         $this->yypopstate();
       
   378     }
       
   379 
       
   380     function yy_r2_7() {
       
   381 
       
   382         if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes",
       
   383                 "no"))
       
   384         ) {
       
   385             $this->yypopstate();
       
   386             $this->yypushstate(self::NAKED_STRING_VALUE);
       
   387             return true; //reprocess in new state
       
   388         } else {
       
   389             $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
       
   390             $this->yypopstate();
       
   391         }
       
   392     }
       
   393 
       
   394     function yy_r2_8() {
       
   395 
       
   396         $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
       
   397         $this->yypopstate();
       
   398     }
       
   399 
       
   400     function yy_r2_9() {
       
   401 
       
   402         $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
       
   403         $this->value = "";
       
   404         $this->yypopstate();
       
   405     }
       
   406 
       
   407     public function yylex3() {
       
   408         if (!isset($this->yy_global_pattern3)) {
       
   409             $this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS";
       
   410         }
       
   411         if ($this->counter >= strlen($this->data)) {
       
   412             return false; // end of input
       
   413         }
       
   414 
       
   415         do {
       
   416             if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
       
   417                 $yysubmatches = $yymatches;
       
   418                 if (strlen($yysubmatches[0]) < 200) {
       
   419                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   420                 } else {
       
   421                     $yymatches = array_filter($yymatches, 'strlen');
       
   422                 }
       
   423                 if (empty($yymatches)) {
       
   424                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE');
       
   425                 }
       
   426                 next($yymatches); // skip global match
       
   427                 $this->token = key($yymatches); // token number
       
   428                 $this->value = current($yymatches); // token value
       
   429                 $r = $this->{'yy_r3_' . $this->token}();
       
   430                 if ($r === null) {
       
   431                     $this->counter += strlen($this->value);
       
   432                     $this->line += substr_count($this->value, "\n");
       
   433                     // accept this token
       
   434                     return true;
       
   435                 } elseif ($r === true) {
       
   436                     // we have changed state
       
   437                     // process this token in the new state
       
   438                     return $this->yylex();
       
   439                 } elseif ($r === false) {
       
   440                     $this->counter += strlen($this->value);
       
   441                     $this->line += substr_count($this->value, "\n");
       
   442                     if ($this->counter >= strlen($this->data)) {
       
   443                         return false; // end of input
       
   444                     }
       
   445                     // skip this token
       
   446                     continue;
       
   447                 }
       
   448             } else {
       
   449                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   450             }
       
   451             break;
       
   452         } while (true);
       
   453     } // end function
       
   454 
       
   455     const NAKED_STRING_VALUE = 3;
       
   456 
       
   457     function yy_r3_1() {
       
   458 
       
   459         $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
       
   460         $this->yypopstate();
       
   461     }
       
   462 
       
   463     public function yylex4() {
       
   464         if (!isset($this->yy_global_pattern4)) {
       
   465             $this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
       
   466         }
       
   467         if ($this->counter >= strlen($this->data)) {
       
   468             return false; // end of input
       
   469         }
       
   470 
       
   471         do {
       
   472             if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
       
   473                 $yysubmatches = $yymatches;
       
   474                 if (strlen($yysubmatches[0]) < 200) {
       
   475                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   476                 } else {
       
   477                     $yymatches = array_filter($yymatches, 'strlen');
       
   478                 }
       
   479                 if (empty($yymatches)) {
       
   480                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state COMMENT');
       
   481                 }
       
   482                 next($yymatches); // skip global match
       
   483                 $this->token = key($yymatches); // token number
       
   484                 $this->value = current($yymatches); // token value
       
   485                 $r = $this->{'yy_r4_' . $this->token}();
       
   486                 if ($r === null) {
       
   487                     $this->counter += strlen($this->value);
       
   488                     $this->line += substr_count($this->value, "\n");
       
   489                     // accept this token
       
   490                     return true;
       
   491                 } elseif ($r === true) {
       
   492                     // we have changed state
       
   493                     // process this token in the new state
       
   494                     return $this->yylex();
       
   495                 } elseif ($r === false) {
       
   496                     $this->counter += strlen($this->value);
       
   497                     $this->line += substr_count($this->value, "\n");
       
   498                     if ($this->counter >= strlen($this->data)) {
       
   499                         return false; // end of input
       
   500                     }
       
   501                     // skip this token
       
   502                     continue;
       
   503                 }
       
   504             } else {
       
   505                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   506             }
       
   507             break;
       
   508         } while (true);
       
   509     } // end function
       
   510 
       
   511     const COMMENT = 4;
       
   512 
       
   513     function yy_r4_1() {
       
   514 
       
   515         return false;
       
   516     }
       
   517 
       
   518     function yy_r4_2() {
       
   519 
       
   520         $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
       
   521     }
       
   522 
       
   523     function yy_r4_3() {
       
   524 
       
   525         $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
       
   526         $this->yypopstate();
       
   527     }
       
   528 
       
   529     public function yylex5() {
       
   530         if (!isset($this->yy_global_pattern5)) {
       
   531             $this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS";
       
   532         }
       
   533         if ($this->counter >= strlen($this->data)) {
       
   534             return false; // end of input
       
   535         }
       
   536 
       
   537         do {
       
   538             if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
       
   539                 $yysubmatches = $yymatches;
       
   540                 if (strlen($yysubmatches[0]) < 200) {
       
   541                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   542                 } else {
       
   543                     $yymatches = array_filter($yymatches, 'strlen');
       
   544                 }
       
   545                 if (empty($yymatches)) {
       
   546                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state SECTION');
       
   547                 }
       
   548                 next($yymatches); // skip global match
       
   549                 $this->token = key($yymatches); // token number
       
   550                 $this->value = current($yymatches); // token value
       
   551                 $r = $this->{'yy_r5_' . $this->token}();
       
   552                 if ($r === null) {
       
   553                     $this->counter += strlen($this->value);
       
   554                     $this->line += substr_count($this->value, "\n");
       
   555                     // accept this token
       
   556                     return true;
       
   557                 } elseif ($r === true) {
       
   558                     // we have changed state
       
   559                     // process this token in the new state
       
   560                     return $this->yylex();
       
   561                 } elseif ($r === false) {
       
   562                     $this->counter += strlen($this->value);
       
   563                     $this->line += substr_count($this->value, "\n");
       
   564                     if ($this->counter >= strlen($this->data)) {
       
   565                         return false; // end of input
       
   566                     }
       
   567                     // skip this token
       
   568                     continue;
       
   569                 }
       
   570             } else {
       
   571                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   572             }
       
   573             break;
       
   574         } while (true);
       
   575     } // end function
       
   576 
       
   577     const SECTION = 5;
       
   578 
       
   579     function yy_r5_1() {
       
   580 
       
   581         $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
       
   582     }
       
   583 
       
   584     function yy_r5_2() {
       
   585 
       
   586         $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
       
   587         $this->yypopstate();
       
   588     }
       
   589 
       
   590     public function yylex6() {
       
   591         if (!isset($this->yy_global_pattern6)) {
       
   592             $this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS";
       
   593         }
       
   594         if ($this->counter >= strlen($this->data)) {
       
   595             return false; // end of input
       
   596         }
       
   597 
       
   598         do {
       
   599             if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) {
       
   600                 $yysubmatches = $yymatches;
       
   601                 if (strlen($yysubmatches[0]) < 200) {
       
   602                     $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
       
   603                 } else {
       
   604                     $yymatches = array_filter($yymatches, 'strlen');
       
   605                 }
       
   606                 if (empty($yymatches)) {
       
   607                     throw new Exception('Error: lexing failed because a rule matched' . ' an empty string.  Input "' . substr($this->data, $this->counter, 5) . '... state TRIPPLE');
       
   608                 }
       
   609                 next($yymatches); // skip global match
       
   610                 $this->token = key($yymatches); // token number
       
   611                 $this->value = current($yymatches); // token value
       
   612                 $r = $this->{'yy_r6_' . $this->token}();
       
   613                 if ($r === null) {
       
   614                     $this->counter += strlen($this->value);
       
   615                     $this->line += substr_count($this->value, "\n");
       
   616                     // accept this token
       
   617                     return true;
       
   618                 } elseif ($r === true) {
       
   619                     // we have changed state
       
   620                     // process this token in the new state
       
   621                     return $this->yylex();
       
   622                 } elseif ($r === false) {
       
   623                     $this->counter += strlen($this->value);
       
   624                     $this->line += substr_count($this->value, "\n");
       
   625                     if ($this->counter >= strlen($this->data)) {
       
   626                         return false; // end of input
       
   627                     }
       
   628                     // skip this token
       
   629                     continue;
       
   630                 }
       
   631             } else {
       
   632                 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]);
       
   633             }
       
   634             break;
       
   635         } while (true);
       
   636     } // end function
       
   637 
       
   638     const TRIPPLE = 6;
       
   639 
       
   640     function yy_r6_1() {
       
   641 
       
   642         $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
       
   643         $this->yypopstate();
       
   644         $this->yypushstate(self::START);
       
   645     }
       
   646 
       
   647     function yy_r6_2() {
       
   648 
       
   649         $to = strlen($this->data);
       
   650         preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
       
   651         if (isset($match[0][1])) {
       
   652             $to = $match[0][1];
       
   653         } else {
       
   654             $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
       
   655         }
       
   656         $this->value = substr($this->data, $this->counter, $to - $this->counter);
       
   657         $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
       
   658     }
       
   659 
       
   660 }