Initial repo created
[timetracker.git] / WEB-INF / lib / smarty / sysplugins / smarty_internal_templatelexer.php
1 <?php
2 /**
3 * Smarty Internal Plugin Templatelexer
4 *
5 * This is the lexer to break the template source into tokens 
6 * @package Smarty
7 * @subpackage Compiler
8 * @author Uwe Tews 
9 */
10 /**
11 * Smarty Internal Plugin Templatelexer
12 */
13 class Smarty_Internal_Templatelexer
14 {
15     public $data;
16     public $counter;
17     public $token;
18     public $value;
19     public $node;
20     public $line;
21     public $taglineno;
22     public $state = 1;
23     public $strip = false;
24     private $heredoc_id_stack = Array();
25     public $smarty_token_names = array (                // Text for parser error messages
26                                 'IDENTITY'      => '===',
27                                 'NONEIDENTITY'  => '!==',
28                                 'EQUALS'        => '==',
29                                 'NOTEQUALS'     => '!=',
30                                 'GREATEREQUAL' => '(>=,ge)',
31                                 'LESSEQUAL' => '(<=,le)',
32                                 'GREATERTHAN' => '(>,gt)',
33                                 'LESSTHAN' => '(<,lt)',
34                                 'MOD' => '(%,mod)',
35                                 'NOT'                   => '(!,not)',
36                                 'LAND'          => '(&&,and)',
37                                 'LOR'                   => '(||,or)',
38                                 'LXOR'                  => 'xor',
39                                 'OPENP'         => '(',
40                                 'CLOSEP'        => ')',
41                                 'OPENB'         => '[',
42                                 'CLOSEB'        => ']',
43                                 'PTR'                   => '->',
44                                 'APTR'          => '=>',
45                                 'EQUAL'         => '=',
46                                 'NUMBER'        => 'number',
47                                 'UNIMATH'       => '+" , "-',
48                                 'MATH'          => '*" , "/" , "%',
49                                 'INCDEC'        => '++" , "--',
50                                 'SPACE'         => ' ',
51                                 'DOLLAR'        => '$',
52                                 'SEMICOLON' => ';',
53                                 'COLON'         => ':',
54                                 'DOUBLECOLON'           => '::',
55                                 'AT'            => '@',
56                                 'HATCH'         => '#',
57                                 'QUOTE'         => '"',
58                                 'BACKTICK'              => '`',
59                                 'VERT'          => '|',
60                                 'DOT'                   => '.',
61                                 'COMMA'         => '","',
62                                 'ANDSYM'                => '"&"',
63                                 'QMARK'         => '"?"',
64                                 'ID'                    => 'identifier',
65                                 'OTHER'         => 'text',
66                                 'LINEBREAK'             => 'newline',
67                                 'FAKEPHPSTARTTAG'       => 'Fake PHP start tag',
68                                 'PHPSTARTTAG'   => 'PHP start tag',
69                                 'PHPENDTAG'     => 'PHP end tag',
70                                                 'LITERALSTART'  => 'Literal start',
71                                                 'LITERALEND'    => 'Literal end',
72                                 'LDELSLASH' => 'closing tag',
73                                 'COMMENT' => 'comment',
74                                 'LITERALEND' => 'literal close',
75                                 'AS' => 'as',
76                                 'TO' => 'to',
77                                 );
78                                 
79                                 
80     function __construct($data,$compiler)
81     {
82 //        $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
83         $this->data = $data;
84         $this->counter = 0;
85         $this->line = 1;
86         $this->smarty = $compiler->smarty;
87         $this->compiler = $compiler;
88         $this->ldel = preg_quote($this->smarty->left_delimiter,'/'); 
89         $this->ldel_length = strlen($this->smarty->left_delimiter); 
90         $this->rdel = preg_quote($this->smarty->right_delimiter,'/');
91         $this->smarty_token_names['LDEL'] =     $this->smarty->left_delimiter;
92         $this->smarty_token_names['RDEL'] =     $this->smarty->right_delimiter;
93      }
94
95
96     private $_yy_state = 1;
97     private $_yy_stack = array();
98
99     function yylex()
100     {
101         return $this->{'yylex' . $this->_yy_state}();
102     }
103
104     function yypushstate($state)
105     {
106         array_push($this->_yy_stack, $this->_yy_state);
107         $this->_yy_state = $state;
108     }
109
110     function yypopstate()
111     {
112         $this->_yy_state = array_pop($this->_yy_stack);
113     }
114
115     function yybegin($state)
116     {
117         $this->_yy_state = $state;
118     }
119
120
121
122     function yylex1()
123     {
124         $tokenMap = array (
125               1 => 0,
126               2 => 0,
127               3 => 1,
128               5 => 0,
129               6 => 0,
130               7 => 0,
131               8 => 0,
132               9 => 0,
133               10 => 0,
134               11 => 0,
135               12 => 1,
136               14 => 0,
137               15 => 0,
138               16 => 0,
139               17 => 0,
140               18 => 0,
141               19 => 0,
142               20 => 0,
143               21 => 0,
144               22 => 0,
145               23 => 2,
146               26 => 0,
147               27 => 0,
148             );
149         if ($this->counter >= strlen($this->data)) {
150             return false; // end of input
151         }
152         $yy_global_pattern = "/^(".$this->ldel."[$]smarty\\.block\\.child".$this->rdel.")|^(\\{\\})|^(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel.")|^([\t ]*[\r\n]+[\t ]*)|^(".$this->ldel."strip".$this->rdel.")|^(".$this->ldel."\\s{1,}strip\\s{1,}".$this->rdel.")|^(".$this->ldel."\/strip".$this->rdel.")|^(".$this->ldel."\\s{1,}\/strip\\s{1,}".$this->rdel.")|^(".$this->ldel."\\s*literal\\s*".$this->rdel.")|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s*(if|elseif|else if|while)(?![^\s]))|^(".$this->ldel."\\s*for(?![^\s]))|^(".$this->ldel."\\s*foreach(?![^\s]))|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."|<\\?|\\?>|<%|%>)))|^([\S\s]+)|^(.)/iS";
153
154         do {
155             if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
156                 $yysubmatches = $yymatches;
157                 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
158                 if (!count($yymatches)) {
159                     throw new Exception('Error: lexing failed because a rule matched' .
160                         'an empty string.  Input "' . substr($this->data,
161                         $this->counter, 5) . '... state TEXT');
162                 }
163                 next($yymatches); // skip global match
164                 $this->token = key($yymatches); // token number
165                 if ($tokenMap[$this->token]) {
166                     // extract sub-patterns for passing to lex function
167                     $yysubmatches = array_slice($yysubmatches, $this->token + 1,
168                         $tokenMap[$this->token]);
169                 } else {
170                     $yysubmatches = array();
171                 }
172                 $this->value = current($yymatches); // token value
173                 $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
174                 if ($r === null) {
175                     $this->counter += strlen($this->value);
176                     $this->line += substr_count($this->value, "\n");
177                     // accept this token
178                     return true;
179                 } elseif ($r === true) {
180                     // we have changed state
181                     // process this token in the new state
182                     return $this->yylex();
183                 } elseif ($r === false) {
184                     $this->counter += strlen($this->value);
185                     $this->line += substr_count($this->value, "\n");
186                     if ($this->counter >= strlen($this->data)) {
187                         return false; // end of input
188                     }
189                     // skip this token
190                     continue;
191                 }            } else {
192                 throw new Exception('Unexpected input at line' . $this->line .
193                     ': ' . $this->data[$this->counter]);
194             }
195             break;
196         } while (true);
197
198     } // end function
199
200
201     const TEXT = 1;
202     function yy_r1_1($yy_subpatterns)
203     {
204
205   $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILD;
206     }
207     function yy_r1_2($yy_subpatterns)
208     {
209
210   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
211     }
212     function yy_r1_3($yy_subpatterns)
213     {
214
215   $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
216     }
217     function yy_r1_5($yy_subpatterns)
218     {
219
220   if ($this->strip) {
221      return false;
222   } else {
223      $this->token = Smarty_Internal_Templateparser::TP_LINEBREAK;
224   }
225     }
226     function yy_r1_6($yy_subpatterns)
227     {
228
229   $this->strip = true;
230   return false;
231     }
232     function yy_r1_7($yy_subpatterns)
233     {
234
235   if ($this->smarty->auto_literal) {
236      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
237   } else {
238     $this->strip = true;
239     return false;
240   }
241     }
242     function yy_r1_8($yy_subpatterns)
243     {
244
245   $this->strip = false;
246   return false;
247     }
248     function yy_r1_9($yy_subpatterns)
249     {
250
251   if ($this->smarty->auto_literal) {
252      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
253   } else {
254     $this->strip = false;
255     return false;
256   }
257     }
258     function yy_r1_10($yy_subpatterns)
259     {
260
261    $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
262    $this->yypushstate(self::LITERAL);
263     }
264     function yy_r1_11($yy_subpatterns)
265     {
266
267   if ($this->smarty->auto_literal) {
268      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
269   } else {
270      $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
271      $this->yypushstate(self::SMARTY);
272      $this->taglineno = $this->line;
273   }
274     }
275     function yy_r1_12($yy_subpatterns)
276     {
277
278   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
279      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
280   } else {
281      $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
282      $this->yypushstate(self::SMARTY);
283      $this->taglineno = $this->line;
284   }
285     }
286     function yy_r1_14($yy_subpatterns)
287     {
288
289   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
290      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
291   } else {
292      $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
293      $this->yypushstate(self::SMARTY);
294      $this->taglineno = $this->line;
295   }
296     }
297     function yy_r1_15($yy_subpatterns)
298     {
299
300   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
301      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
302   } else {
303      $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
304      $this->yypushstate(self::SMARTY);
305      $this->taglineno = $this->line;
306   }
307     }
308     function yy_r1_16($yy_subpatterns)
309     {
310
311   if ($this->smarty->auto_literal) {
312      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
313   } else {
314      $this->token = Smarty_Internal_Templateparser::TP_LDEL;
315      $this->yypushstate(self::SMARTY);
316      $this->taglineno = $this->line;
317   }
318     }
319     function yy_r1_17($yy_subpatterns)
320     {
321
322   $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
323      $this->yypushstate(self::SMARTY);
324      $this->taglineno = $this->line;
325     }
326     function yy_r1_18($yy_subpatterns)
327     {
328
329   $this->token = Smarty_Internal_Templateparser::TP_LDEL;
330      $this->yypushstate(self::SMARTY);
331      $this->taglineno = $this->line;
332     }
333     function yy_r1_19($yy_subpatterns)
334     {
335
336   if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
337     $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
338   } elseif ($this->value == '<?xml') {
339       $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
340   } else {
341     $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
342     $this->value = substr($this->value, 0, 2);
343   }
344      }
345     function yy_r1_20($yy_subpatterns)
346     {
347
348   $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
349     }
350     function yy_r1_21($yy_subpatterns)
351     {
352
353   $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
354     }
355     function yy_r1_22($yy_subpatterns)
356     {
357
358   $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
359     }
360     function yy_r1_23($yy_subpatterns)
361     {
362
363   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
364     }
365     function yy_r1_26($yy_subpatterns)
366     {
367
368   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
369     }
370     function yy_r1_27($yy_subpatterns)
371     {
372
373   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
374     }
375
376
377     function yylex2()
378     {
379         $tokenMap = array (
380               1 => 0,
381               2 => 0,
382               3 => 1,
383               5 => 0,
384               6 => 0,
385               7 => 0,
386               8 => 0,
387               9 => 0,
388               10 => 0,
389               11 => 0,
390               12 => 0,
391               13 => 0,
392               14 => 0,
393               15 => 0,
394               16 => 0,
395               17 => 0,
396               18 => 0,
397               19 => 0,
398               20 => 1,
399               22 => 1,
400               24 => 1,
401               26 => 0,
402               27 => 0,
403               28 => 0,
404               29 => 0,
405               30 => 0,
406               31 => 0,
407               32 => 0,
408               33 => 0,
409               34 => 0,
410               35 => 0,
411               36 => 0,
412               37 => 0,
413               38 => 0,
414               39 => 0,
415               40 => 0,
416               41 => 0,
417               42 => 0,
418               43 => 3,
419               47 => 0,
420               48 => 0,
421               49 => 0,
422               50 => 0,
423               51 => 0,
424               52 => 0,
425               53 => 0,
426               54 => 0,
427               55 => 1,
428               57 => 1,
429               59 => 0,
430               60 => 0,
431               61 => 0,
432               62 => 0,
433               63 => 0,
434               64 => 0,
435               65 => 0,
436               66 => 0,
437               67 => 0,
438               68 => 0,
439               69 => 0,
440               70 => 0,
441               71 => 0,
442               72 => 0,
443               73 => 0,
444               74 => 0,
445               75 => 0,
446               76 => 0,
447             );
448         if ($this->counter >= strlen($this->data)) {
449             return false; // end of input
450         }
451         $yy_global_pattern = "/^('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s*(if|elseif|else if|while)(?![^\s]))|^(".$this->ldel."\\s*for(?![^\s]))|^(".$this->ldel."\\s*foreach(?![^\s]))|^(".$this->ldel."\\s{1,})|^(\\s{1,}".$this->rdel.")|^(".$this->ldel."\/)|^(".$this->ldel.")|^(".$this->rdel.")|^(\\s+is\\s+in\\s+)|^(\\s+as\\s+)|^(\\s+to\\s+)|^(\\s+step\\s+)|^(\\s+instanceof\\s+)|^(\\s*===\\s*)|^(\\s*!==\\s*)|^(\\s*==\\s*|\\s+eq\\s+)|^(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|^(\\s*>=\\s*|\\s+(ge|gte)\\s+)|^(\\s*<=\\s*|\\s+(le|lte)\\s+)|^(\\s*>\\s*|\\s+gt\\s+)|^(\\s*<\\s*|\\s+lt\\s+)|^(\\s+mod\\s+)|^(!\\s*|not\\s+)|^(\\s*&&\\s*|\\s*and\\s+)|^(\\s*\\|\\|\\s*|\\s*or\\s+)|^(\\s*xor\\s+)|^(\\s+is\\s+odd\\s+by\\s+)|^(\\s+is\\s+not\\s+odd\\s+by\\s+)|^(\\s+is\\s+odd)|^(\\s+is\\s+not\\s+odd)|^(\\s+is\\s+even\\s+by\\s+)|^(\\s+is\\s+not\\s+even\\s+by\\s+)|^(\\s+is\\s+even)|^(\\s+is\\s+not\\s+even)|^(\\s+is\\s+div\\s+by\\s+)|^(\\s+is\\s+not\\s+div\\s+by\\s+)|^(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\)\\s*)|^(\\(\\s*)|^(\\s*\\))|^(\\[\\s*)|^(\\s*\\])|^(\\s*->\\s*)|^(\\s*=>\\s*)|^(\\s*=\\s*)|^(\\+\\+|--)|^(\\s*(\\+|-)\\s*)|^(\\s*(\\*|\/|%)\\s*)|^(\\$)|^(\\s*;)|^(::)|^(\\s*:\\s*)|^(@)|^(#)|^(\")|^(`)|^(\\|)|^(\\.)|^(\\s*,\\s*)|^(\\s*&\\s*)|^(\\s*\\?\\s*)|^(0[xX][0-9a-fA-F]+)|^([0-9]*[a-zA-Z_]\\w*)|^(\\d+)|^(\\s+)|^(.)/iS";
452
453         do {
454             if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
455                 $yysubmatches = $yymatches;
456                 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
457                 if (!count($yymatches)) {
458                     throw new Exception('Error: lexing failed because a rule matched' .
459                         'an empty string.  Input "' . substr($this->data,
460                         $this->counter, 5) . '... state SMARTY');
461                 }
462                 next($yymatches); // skip global match
463                 $this->token = key($yymatches); // token number
464                 if ($tokenMap[$this->token]) {
465                     // extract sub-patterns for passing to lex function
466                     $yysubmatches = array_slice($yysubmatches, $this->token + 1,
467                         $tokenMap[$this->token]);
468                 } else {
469                     $yysubmatches = array();
470                 }
471                 $this->value = current($yymatches); // token value
472                 $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
473                 if ($r === null) {
474                     $this->counter += strlen($this->value);
475                     $this->line += substr_count($this->value, "\n");
476                     // accept this token
477                     return true;
478                 } elseif ($r === true) {
479                     // we have changed state
480                     // process this token in the new state
481                     return $this->yylex();
482                 } elseif ($r === false) {
483                     $this->counter += strlen($this->value);
484                     $this->line += substr_count($this->value, "\n");
485                     if ($this->counter >= strlen($this->data)) {
486                         return false; // end of input
487                     }
488                     // skip this token
489                     continue;
490                 }            } else {
491                 throw new Exception('Unexpected input at line' . $this->line .
492                     ': ' . $this->data[$this->counter]);
493             }
494             break;
495         } while (true);
496
497     } // end function
498
499
500     const SMARTY = 2;
501     function yy_r2_1($yy_subpatterns)
502     {
503
504   $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
505     }
506     function yy_r2_2($yy_subpatterns)
507     {
508
509   if ($this->smarty->auto_literal) {
510      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
511   } else {
512      $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
513      $this->yypushstate(self::SMARTY);
514      $this->taglineno = $this->line;
515   }
516     }
517     function yy_r2_3($yy_subpatterns)
518     {
519
520   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
521      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
522   } else {
523      $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
524      $this->yypushstate(self::SMARTY);
525      $this->taglineno = $this->line;
526   }
527     }
528     function yy_r2_5($yy_subpatterns)
529     {
530
531   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
532      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
533   } else {
534      $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
535      $this->yypushstate(self::SMARTY);
536      $this->taglineno = $this->line;
537   }
538     }
539     function yy_r2_6($yy_subpatterns)
540     {
541
542   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
543      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
544   } else {
545      $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
546      $this->yypushstate(self::SMARTY);
547      $this->taglineno = $this->line;
548   }
549     }
550     function yy_r2_7($yy_subpatterns)
551     {
552
553   if ($this->smarty->auto_literal) {
554      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
555   } else {
556      $this->token = Smarty_Internal_Templateparser::TP_LDEL;
557      $this->yypushstate(self::SMARTY);
558      $this->taglineno = $this->line;
559   }
560     }
561     function yy_r2_8($yy_subpatterns)
562     {
563
564   if ($this->smarty->auto_literal) {
565      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
566   } else {
567      $this->token = Smarty_Internal_Templateparser::TP_RDEL;
568      $this->yypopstate();
569   }
570     }
571     function yy_r2_9($yy_subpatterns)
572     {
573
574   $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
575      $this->yypushstate(self::SMARTY);
576      $this->taglineno = $this->line;
577     }
578     function yy_r2_10($yy_subpatterns)
579     {
580
581   $this->token = Smarty_Internal_Templateparser::TP_LDEL;
582      $this->yypushstate(self::SMARTY);
583      $this->taglineno = $this->line;
584     }
585     function yy_r2_11($yy_subpatterns)
586     {
587
588   $this->token = Smarty_Internal_Templateparser::TP_RDEL;
589      $this->yypopstate();
590     }
591     function yy_r2_12($yy_subpatterns)
592     {
593
594   $this->token = Smarty_Internal_Templateparser::TP_ISIN;
595     }
596     function yy_r2_13($yy_subpatterns)
597     {
598
599   $this->token = Smarty_Internal_Templateparser::TP_AS;
600     }
601     function yy_r2_14($yy_subpatterns)
602     {
603
604   $this->token = Smarty_Internal_Templateparser::TP_TO;
605     }
606     function yy_r2_15($yy_subpatterns)
607     {
608
609   $this->token = Smarty_Internal_Templateparser::TP_STEP;
610     }
611     function yy_r2_16($yy_subpatterns)
612     {
613
614   $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
615     }
616     function yy_r2_17($yy_subpatterns)
617     {
618
619   $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
620     }
621     function yy_r2_18($yy_subpatterns)
622     {
623
624   $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
625     }
626     function yy_r2_19($yy_subpatterns)
627     {
628
629   $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
630     }
631     function yy_r2_20($yy_subpatterns)
632     {
633
634   $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
635     }
636     function yy_r2_22($yy_subpatterns)
637     {
638
639   $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
640     }
641     function yy_r2_24($yy_subpatterns)
642     {
643
644   $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
645     }
646     function yy_r2_26($yy_subpatterns)
647     {
648
649   $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
650     }
651     function yy_r2_27($yy_subpatterns)
652     {
653
654   $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
655     }
656     function yy_r2_28($yy_subpatterns)
657     {
658
659   $this->token = Smarty_Internal_Templateparser::TP_MOD;
660     }
661     function yy_r2_29($yy_subpatterns)
662     {
663
664   $this->token = Smarty_Internal_Templateparser::TP_NOT;
665     }
666     function yy_r2_30($yy_subpatterns)
667     {
668
669   $this->token = Smarty_Internal_Templateparser::TP_LAND;
670     }
671     function yy_r2_31($yy_subpatterns)
672     {
673
674   $this->token = Smarty_Internal_Templateparser::TP_LOR;
675     }
676     function yy_r2_32($yy_subpatterns)
677     {
678
679   $this->token = Smarty_Internal_Templateparser::TP_LXOR;
680     }
681     function yy_r2_33($yy_subpatterns)
682     {
683
684   $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
685     }
686     function yy_r2_34($yy_subpatterns)
687     {
688
689   $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
690     }
691     function yy_r2_35($yy_subpatterns)
692     {
693
694   $this->token = Smarty_Internal_Templateparser::TP_ISODD;
695     }
696     function yy_r2_36($yy_subpatterns)
697     {
698
699   $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
700     }
701     function yy_r2_37($yy_subpatterns)
702     {
703
704   $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
705     }
706     function yy_r2_38($yy_subpatterns)
707     {
708
709   $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
710     }
711     function yy_r2_39($yy_subpatterns)
712     {
713
714   $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
715     }
716     function yy_r2_40($yy_subpatterns)
717     {
718
719   $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
720     }
721     function yy_r2_41($yy_subpatterns)
722     {
723
724   $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
725     }
726     function yy_r2_42($yy_subpatterns)
727     {
728
729   $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
730     }
731     function yy_r2_43($yy_subpatterns)
732     {
733
734   $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
735     }
736     function yy_r2_47($yy_subpatterns)
737     {
738
739   $this->token = Smarty_Internal_Templateparser::TP_OPENP;
740     }
741     function yy_r2_48($yy_subpatterns)
742     {
743
744   $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
745     }
746     function yy_r2_49($yy_subpatterns)
747     {
748
749   $this->token = Smarty_Internal_Templateparser::TP_OPENB;
750     }
751     function yy_r2_50($yy_subpatterns)
752     {
753
754   $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
755     }
756     function yy_r2_51($yy_subpatterns)
757     {
758
759   $this->token = Smarty_Internal_Templateparser::TP_PTR; 
760     }
761     function yy_r2_52($yy_subpatterns)
762     {
763
764   $this->token = Smarty_Internal_Templateparser::TP_APTR;
765     }
766     function yy_r2_53($yy_subpatterns)
767     {
768
769   $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
770     }
771     function yy_r2_54($yy_subpatterns)
772     {
773
774   $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
775     }
776     function yy_r2_55($yy_subpatterns)
777     {
778
779   $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
780     }
781     function yy_r2_57($yy_subpatterns)
782     {
783
784   $this->token = Smarty_Internal_Templateparser::TP_MATH;
785     }
786     function yy_r2_59($yy_subpatterns)
787     {
788
789   $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
790     }
791     function yy_r2_60($yy_subpatterns)
792     {
793
794   $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
795     }
796     function yy_r2_61($yy_subpatterns)
797     {
798
799   $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
800     }
801     function yy_r2_62($yy_subpatterns)
802     {
803
804   $this->token = Smarty_Internal_Templateparser::TP_COLON;
805     }
806     function yy_r2_63($yy_subpatterns)
807     {
808
809   $this->token = Smarty_Internal_Templateparser::TP_AT;
810     }
811     function yy_r2_64($yy_subpatterns)
812     {
813
814   $this->token = Smarty_Internal_Templateparser::TP_HATCH;
815     }
816     function yy_r2_65($yy_subpatterns)
817     {
818
819   $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
820   $this->yypushstate(self::DOUBLEQUOTEDSTRING);
821     }
822     function yy_r2_66($yy_subpatterns)
823     {
824
825   $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
826   $this->yypopstate();
827     }
828     function yy_r2_67($yy_subpatterns)
829     {
830
831   $this->token = Smarty_Internal_Templateparser::TP_VERT;
832     }
833     function yy_r2_68($yy_subpatterns)
834     {
835
836   $this->token = Smarty_Internal_Templateparser::TP_DOT;
837     }
838     function yy_r2_69($yy_subpatterns)
839     {
840
841   $this->token = Smarty_Internal_Templateparser::TP_COMMA;
842     }
843     function yy_r2_70($yy_subpatterns)
844     {
845
846   $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
847     }
848     function yy_r2_71($yy_subpatterns)
849     {
850
851   $this->token = Smarty_Internal_Templateparser::TP_QMARK;
852     }
853     function yy_r2_72($yy_subpatterns)
854     {
855
856   $this->token = Smarty_Internal_Templateparser::TP_HEX;
857     }
858     function yy_r2_73($yy_subpatterns)
859     {
860
861   $this->token = Smarty_Internal_Templateparser::TP_ID;
862     }
863     function yy_r2_74($yy_subpatterns)
864     {
865
866   $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
867     }
868     function yy_r2_75($yy_subpatterns)
869     {
870
871   $this->token = Smarty_Internal_Templateparser::TP_SPACE;
872     }
873     function yy_r2_76($yy_subpatterns)
874     {
875
876   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
877     }
878
879
880
881     function yylex3()
882     {
883         $tokenMap = array (
884               1 => 0,
885               2 => 0,
886               3 => 0,
887               4 => 0,
888               5 => 0,
889               6 => 0,
890               7 => 0,
891               8 => 2,
892               11 => 0,
893             );
894         if ($this->counter >= strlen($this->data)) {
895             return false; // end of input
896         }
897         $yy_global_pattern = "/^(".$this->ldel."\\s*literal\\s*".$this->rdel.")|^(".$this->ldel."\\s*\/literal\\s*".$this->rdel.")|^([\t ]*[\r\n]+[\t ]*)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."\/?literal".$this->rdel."|<\\?|<%)))|^(.)/iS";
898
899         do {
900             if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
901                 $yysubmatches = $yymatches;
902                 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
903                 if (!count($yymatches)) {
904                     throw new Exception('Error: lexing failed because a rule matched' .
905                         'an empty string.  Input "' . substr($this->data,
906                         $this->counter, 5) . '... state LITERAL');
907                 }
908                 next($yymatches); // skip global match
909                 $this->token = key($yymatches); // token number
910                 if ($tokenMap[$this->token]) {
911                     // extract sub-patterns for passing to lex function
912                     $yysubmatches = array_slice($yysubmatches, $this->token + 1,
913                         $tokenMap[$this->token]);
914                 } else {
915                     $yysubmatches = array();
916                 }
917                 $this->value = current($yymatches); // token value
918                 $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
919                 if ($r === null) {
920                     $this->counter += strlen($this->value);
921                     $this->line += substr_count($this->value, "\n");
922                     // accept this token
923                     return true;
924                 } elseif ($r === true) {
925                     // we have changed state
926                     // process this token in the new state
927                     return $this->yylex();
928                 } elseif ($r === false) {
929                     $this->counter += strlen($this->value);
930                     $this->line += substr_count($this->value, "\n");
931                     if ($this->counter >= strlen($this->data)) {
932                         return false; // end of input
933                     }
934                     // skip this token
935                     continue;
936                 }            } else {
937                 throw new Exception('Unexpected input at line' . $this->line .
938                     ': ' . $this->data[$this->counter]);
939             }
940             break;
941         } while (true);
942
943     } // end function
944
945
946     const LITERAL = 3;
947     function yy_r3_1($yy_subpatterns)
948     {
949
950   $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
951   $this->yypushstate(self::LITERAL);
952     }
953     function yy_r3_2($yy_subpatterns)
954     {
955
956   $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
957   $this->yypopstate();
958     }
959     function yy_r3_3($yy_subpatterns)
960     {
961
962   $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
963     }
964     function yy_r3_4($yy_subpatterns)
965     {
966
967   if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
968     $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
969    } else {
970     $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
971     $this->value = substr($this->value, 0, 2);
972    }
973     }
974     function yy_r3_5($yy_subpatterns)
975     {
976
977   $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
978     }
979     function yy_r3_6($yy_subpatterns)
980     {
981
982   $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
983     }
984     function yy_r3_7($yy_subpatterns)
985     {
986
987   $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
988     }
989     function yy_r3_8($yy_subpatterns)
990     {
991
992   $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
993     }
994     function yy_r3_11($yy_subpatterns)
995     {
996
997   $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
998     }
999
1000
1001     function yylex4()
1002     {
1003         $tokenMap = array (
1004               1 => 0,
1005               2 => 1,
1006               4 => 0,
1007               5 => 0,
1008               6 => 0,
1009               7 => 0,
1010               8 => 0,
1011               9 => 0,
1012               10 => 0,
1013               11 => 0,
1014               12 => 0,
1015               13 => 3,
1016               17 => 0,
1017               18 => 0,
1018             );
1019         if ($this->counter >= strlen($this->data)) {
1020             return false; // end of input
1021         }
1022         $yy_global_pattern = "/^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s*(if|elseif|else if|while)(?![^\s]))|^(".$this->ldel."\\s*for(?![^\s]))|^(".$this->ldel."\\s*foreach(?![^\s]))|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(\")|^(`\\$)|^(\\$[0-9]*[a-zA-Z_]\\w*)|^(\\$)|^(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(".$this->ldel."|\\$|`\\$|\")))|^([\S\s]+)|^(.)/iS";
1023
1024         do {
1025             if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
1026                 $yysubmatches = $yymatches;
1027                 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1028                 if (!count($yymatches)) {
1029                     throw new Exception('Error: lexing failed because a rule matched' .
1030                         'an empty string.  Input "' . substr($this->data,
1031                         $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
1032                 }
1033                 next($yymatches); // skip global match
1034                 $this->token = key($yymatches); // token number
1035                 if ($tokenMap[$this->token]) {
1036                     // extract sub-patterns for passing to lex function
1037                     $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1038                         $tokenMap[$this->token]);
1039                 } else {
1040                     $yysubmatches = array();
1041                 }
1042                 $this->value = current($yymatches); // token value
1043                 $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
1044                 if ($r === null) {
1045                     $this->counter += strlen($this->value);
1046                     $this->line += substr_count($this->value, "\n");
1047                     // accept this token
1048                     return true;
1049                 } elseif ($r === true) {
1050                     // we have changed state
1051                     // process this token in the new state
1052                     return $this->yylex();
1053                 } elseif ($r === false) {
1054                     $this->counter += strlen($this->value);
1055                     $this->line += substr_count($this->value, "\n");
1056                     if ($this->counter >= strlen($this->data)) {
1057                         return false; // end of input
1058                     }
1059                     // skip this token
1060                     continue;
1061                 }            } else {
1062                 throw new Exception('Unexpected input at line' . $this->line .
1063                     ': ' . $this->data[$this->counter]);
1064             }
1065             break;
1066         } while (true);
1067
1068     } // end function
1069
1070
1071     const DOUBLEQUOTEDSTRING = 4;
1072     function yy_r4_1($yy_subpatterns)
1073     {
1074
1075   if ($this->smarty->auto_literal) {
1076      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1077   } else {
1078      $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
1079      $this->yypushstate(self::SMARTY);
1080      $this->taglineno = $this->line;
1081   }
1082     }
1083     function yy_r4_2($yy_subpatterns)
1084     {
1085
1086   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
1087      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1088   } else {
1089      $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
1090      $this->yypushstate(self::SMARTY);
1091      $this->taglineno = $this->line;
1092   }
1093     }
1094     function yy_r4_4($yy_subpatterns)
1095     {
1096
1097   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
1098      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1099   } else {
1100      $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
1101      $this->yypushstate(self::SMARTY);
1102      $this->taglineno = $this->line;
1103   }
1104     }
1105     function yy_r4_5($yy_subpatterns)
1106     {
1107
1108   if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
1109      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1110   } else {
1111      $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
1112      $this->yypushstate(self::SMARTY);
1113      $this->taglineno = $this->line;
1114   }
1115     }
1116     function yy_r4_6($yy_subpatterns)
1117     {
1118
1119   if ($this->smarty->auto_literal) {
1120      $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1121   } else {
1122      $this->token = Smarty_Internal_Templateparser::TP_LDEL;
1123      $this->yypushstate(self::SMARTY);
1124      $this->taglineno = $this->line;
1125   }
1126     }
1127     function yy_r4_7($yy_subpatterns)
1128     {
1129
1130   $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
1131      $this->yypushstate(self::SMARTY);
1132      $this->taglineno = $this->line;
1133     }
1134     function yy_r4_8($yy_subpatterns)
1135     {
1136
1137   $this->token = Smarty_Internal_Templateparser::TP_LDEL;
1138      $this->yypushstate(self::SMARTY);
1139      $this->taglineno = $this->line;
1140     }
1141     function yy_r4_9($yy_subpatterns)
1142     {
1143
1144   $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
1145   $this->yypopstate();
1146     }
1147     function yy_r4_10($yy_subpatterns)
1148     {
1149
1150   $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
1151   $this->value = substr($this->value,0,-1);
1152   $this->yypushstate(self::SMARTY);
1153   $this->taglineno = $this->line;
1154     }
1155     function yy_r4_11($yy_subpatterns)
1156     {
1157
1158   $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
1159     }
1160     function yy_r4_12($yy_subpatterns)
1161     {
1162
1163   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1164     }
1165     function yy_r4_13($yy_subpatterns)
1166     {
1167
1168   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1169     }
1170     function yy_r4_17($yy_subpatterns)
1171     {
1172
1173   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1174     }
1175     function yy_r4_18($yy_subpatterns)
1176     {
1177
1178   $this->token = Smarty_Internal_Templateparser::TP_OTHER;
1179     }
1180
1181 }
1182 ?>