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