4de8a9c06b45ed365e1ce34b7ddbc6b10afc6827
[GitHub/Stricted/Domain-Control-Panel.git] / lib / api / smarty / sysplugins / smarty_internal_templatelexer.php
1 <?php
2 /**
3 * Smarty Internal Plugin Templatelexer
4 * This is the lexer to break the template source into tokens
5 *
6 * @package Smarty
7 * @subpackage Compiler
8 * @author Uwe Tews
9 */
10
11 /**
12 * Smarty Internal Plugin Templatelexer
13 */
14 class Smarty_Internal_Templatelexer
15 {
16 public $data;
17 public $counter;
18 public $token;
19 public $value;
20 public $node;
21 public $line;
22 public $taglineno;
23 public $is_phpScript = false;
24 public $state = 1;
25 public $smarty;
26 public $literal_cnt = 0;
27 private $heredoc_id_stack = Array();
28 public $yyTraceFILE;
29 public $yyTracePrompt;
30 public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY');
31 public $smarty_token_names = array( // Text for parser error messages
32 'IDENTITY' => '===',
33 'NONEIDENTITY' => '!==',
34 'EQUALS' => '==',
35 'NOTEQUALS' => '!=',
36 'GREATEREQUAL' => '(>=,ge)',
37 'LESSEQUAL' => '(<=,le)',
38 'GREATERTHAN' => '(>,gt)',
39 'LESSTHAN' => '(<,lt)',
40 'MOD' => '(%,mod)',
41 'NOT' => '(!,not)',
42 'LAND' => '(&&,and)',
43 'LOR' => '(||,or)',
44 'LXOR' => 'xor',
45 'OPENP' => '(',
46 'CLOSEP' => ')',
47 'OPENB' => '[',
48 'CLOSEB' => ']',
49 'PTR' => '->',
50 'APTR' => '=>',
51 'EQUAL' => '=',
52 'NUMBER' => 'number',
53 'UNIMATH' => '+" , "-',
54 'MATH' => '*" , "/" , "%',
55 'INCDEC' => '++" , "--',
56 'SPACE' => ' ',
57 'DOLLAR' => '$',
58 'SEMICOLON' => ';',
59 'COLON' => ':',
60 'DOUBLECOLON' => '::',
61 'AT' => '@',
62 'HATCH' => '#',
63 'QUOTE' => '"',
64 'BACKTICK' => '`',
65 'VERT' => '|',
66 'DOT' => '.',
67 'COMMA' => '","',
68 'ANDSYM' => '"&"',
69 'QMARK' => '"?"',
70 'ID' => 'identifier',
71 'TEXT' => 'text',
72 'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
73 'PHPSTARTTAG' => 'PHP start tag',
74 'PHPENDTAG' => 'PHP end tag',
75 'LITERALSTART' => 'Literal start',
76 'LITERALEND' => 'Literal end',
77 'LDELSLASH' => 'closing tag',
78 'COMMENT' => 'comment',
79 'AS' => 'as',
80 'TO' => 'to',
81 );
82
83 function __construct($data, $compiler)
84 {
85 // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
86 $this->data = $data;
87 $this->counter = 0;
88 if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
89 $this->counter += strlen($match[0]);
90 }
91 $this->line = 1;
92 $this->smarty = $compiler->smarty;
93 $this->compiler = $compiler;
94 $this->ldel = preg_quote($this->smarty->left_delimiter, '/');
95 $this->ldel_length = strlen($this->smarty->left_delimiter);
96 $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
97 $this->rdel_length = strlen($this->smarty->right_delimiter);
98 $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
99 $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
100 }
101
102 public function PrintTrace()
103 {
104 $this->yyTraceFILE = fopen('php://output', 'w');
105 $this->yyTracePrompt = '<br>';
106 }
107
108 private $_yy_state = 1;
109 private $_yy_stack = array();
110
111 public function yylex()
112 {
113 return $this->{'yylex' . $this->_yy_state}();
114 }
115
116 public function yypushstate($state)
117 {
118 if ($this->yyTraceFILE) {
119 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);
120 }
121 array_push($this->_yy_stack, $this->_yy_state);
122 $this->_yy_state = $state;
123 if ($this->yyTraceFILE) {
124 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);
125 }
126 }
127
128 public function yypopstate()
129 {
130 if ($this->yyTraceFILE) {
131 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);
132 }
133 $this->_yy_state = array_pop($this->_yy_stack);
134 if ($this->yyTraceFILE) {
135 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);
136 }
137 }
138
139 public function yybegin($state)
140 {
141 $this->_yy_state = $state;
142 if ($this->yyTraceFILE) {
143 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);
144 }
145 }
146
147 public function yylex1()
148 {
149 $tokenMap = array(
150 1 => 0,
151 2 => 1,
152 4 => 0,
153 5 => 0,
154 6 => 0,
155 7 => 1,
156 9 => 0,
157 10 => 0,
158 11 => 0,
159 12 => 0,
160 13 => 0,
161 14 => 2,
162 17 => 0,
163 18 => 0,
164 19 => 0,
165 20 => 0,
166 21 => 0,
167 22 => 0,
168 );
169 if ($this->counter >= strlen($this->data)) {
170 return false; // end of input
171 }
172 $yy_global_pattern = "/\G(\\{\\})|\G(" . $this->ldel . "\\*([\S\s]*?)\\*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\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*\/)|\G(" . $this->ldel . "\\s*)|\G((<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|(<\\?(?:php\\w+|=|[a-zA-Z]+)?))|\G(\\?>)|\G(<\/script>)|\G(\\s*" . $this->rdel . ")|\G(<%)|\G(%>)|\G([\S\s])/iS";
173
174 do {
175 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
176 $yysubmatches = $yymatches;
177 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
178 if (!count($yymatches)) {
179 throw new Exception('Error: lexing failed because a rule matched' .
180 ' an empty string. Input "' . substr($this->data,
181 $this->counter, 5) . '... state TEXT');
182 }
183 next($yymatches); // skip global match
184 $this->token = key($yymatches); // token number
185 if ($tokenMap[$this->token]) {
186 // extract sub-patterns for passing to lex function
187 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
188 $tokenMap[$this->token]);
189 } else {
190 $yysubmatches = array();
191 }
192 $this->value = current($yymatches); // token value
193 $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
194 if ($r === null) {
195 $this->counter += strlen($this->value);
196 $this->line += substr_count($this->value, "\n");
197 // accept this token
198 return true;
199 } elseif ($r === true) {
200 // we have changed state
201 // process this token in the new state
202 return $this->yylex();
203 } elseif ($r === false) {
204 $this->counter += strlen($this->value);
205 $this->line += substr_count($this->value, "\n");
206 if ($this->counter >= strlen($this->data)) {
207 return false; // end of input
208 }
209 // skip this token
210 continue;
211 }
212 } else {
213 throw new Exception('Unexpected input at line' . $this->line .
214 ': ' . $this->data[$this->counter]);
215 }
216 break;
217 } while (true);
218 } // end function
219
220 const TEXT = 1;
221
222 function yy_r1_1($yy_subpatterns)
223 {
224
225 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
226 }
227
228 function yy_r1_2($yy_subpatterns)
229 {
230
231 $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
232 }
233
234 function yy_r1_4($yy_subpatterns)
235 {
236
237 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
238 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
239 } else {
240 $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
241 }
242 }
243
244 function yy_r1_5($yy_subpatterns)
245 {
246
247 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
248 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
249 } else {
250 $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
251 }
252 }
253
254 function yy_r1_6($yy_subpatterns)
255 {
256
257 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
258 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
259 } else {
260 $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
261 $this->yypushstate(self::LITERAL);
262 }
263 }
264
265 function yy_r1_7($yy_subpatterns)
266 {
267
268 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
269 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
270 } else {
271 $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
272 $this->yypushstate(self::SMARTY);
273 $this->taglineno = $this->line;
274 }
275 }
276
277 function yy_r1_9($yy_subpatterns)
278 {
279
280 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
281 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
282 } else {
283 $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
284 $this->yypushstate(self::SMARTY);
285 $this->taglineno = $this->line;
286 }
287 }
288
289 function yy_r1_10($yy_subpatterns)
290 {
291
292 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
293 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
294 } else {
295 $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
296 $this->yypushstate(self::SMARTY);
297 $this->taglineno = $this->line;
298 }
299 }
300
301 function yy_r1_11($yy_subpatterns)
302 {
303
304 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
305 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
306 } else {
307 $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
308 $this->yypushstate(self::SMARTY);
309 $this->taglineno = $this->line;
310 }
311 }
312
313 function yy_r1_12($yy_subpatterns)
314 {
315
316 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
317 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
318 } else {
319 $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
320 $this->yypushstate(self::SMARTY);
321 $this->taglineno = $this->line;
322 }
323 }
324
325 function yy_r1_13($yy_subpatterns)
326 {
327
328 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
329 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
330 } else {
331 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
332 $this->yypushstate(self::SMARTY);
333 $this->taglineno = $this->line;
334 }
335 }
336
337 function yy_r1_14($yy_subpatterns)
338 {
339
340 if (($script = strpos($this->value, '<s') === 0) || in_array($this->value, Array('<?', '<?=', '<?php'))) {
341 if ($script) {
342 $this->is_phpScript = true;
343 }
344 $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
345 } elseif ($this->value == '<?xml') {
346 $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
347 } else {
348 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
349 //$this->value = substr($this->value, 0, 2);
350 }
351 }
352
353 function yy_r1_17($yy_subpatterns)
354 {
355
356 $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
357 }
358
359 function yy_r1_18($yy_subpatterns)
360 {
361
362 $this->token = Smarty_Internal_Templateparser::TP_PHPENDSCRIPT;
363 }
364
365 function yy_r1_19($yy_subpatterns)
366 {
367
368 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
369 }
370
371 function yy_r1_20($yy_subpatterns)
372 {
373
374 $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
375 }
376
377 function yy_r1_21($yy_subpatterns)
378 {
379
380 $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
381 }
382
383 function yy_r1_22($yy_subpatterns)
384 {
385
386 $phpEndScript = $this->is_phpScript ? '|<\\/script>' : '';
387 $to = strlen($this->data);
388 preg_match("/{$this->ldel}|<\?|<%|\?>|%>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>{$phpEndScript}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
389 if (isset($match[0][1])) {
390 $to = $match[0][1];
391 }
392 $this->value = substr($this->data, $this->counter, $to - $this->counter);
393 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
394 }
395
396 public function yylex2()
397 {
398 $tokenMap = array(
399 1 => 0,
400 2 => 0,
401 3 => 1,
402 5 => 0,
403 6 => 0,
404 7 => 0,
405 8 => 0,
406 9 => 0,
407 10 => 0,
408 11 => 0,
409 12 => 0,
410 13 => 0,
411 14 => 0,
412 15 => 1,
413 17 => 1,
414 19 => 1,
415 21 => 0,
416 22 => 0,
417 23 => 0,
418 24 => 0,
419 25 => 0,
420 26 => 0,
421 27 => 0,
422 28 => 0,
423 29 => 0,
424 30 => 0,
425 31 => 0,
426 32 => 0,
427 33 => 0,
428 34 => 0,
429 35 => 0,
430 36 => 0,
431 37 => 0,
432 38 => 3,
433 42 => 0,
434 43 => 0,
435 44 => 0,
436 45 => 0,
437 46 => 0,
438 47 => 0,
439 48 => 0,
440 49 => 0,
441 50 => 1,
442 52 => 1,
443 54 => 0,
444 55 => 0,
445 56 => 0,
446 57 => 0,
447 58 => 0,
448 59 => 0,
449 60 => 0,
450 61 => 0,
451 62 => 0,
452 63 => 0,
453 64 => 0,
454 65 => 0,
455 66 => 0,
456 67 => 0,
457 68 => 0,
458 69 => 0,
459 70 => 1,
460 72 => 0,
461 73 => 0,
462 74 => 0,
463 75 => 0,
464 76 => 0,
465 );
466 if ($this->counter >= strlen($this->data)) {
467 return false; // end of input
468 }
469 $yy_global_pattern = "/\G(\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G(\\$)|\G(\\s*" . $this->rdel . ")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\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(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(@)|\G(#)|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*=\\s*)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\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*\/)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/iS";
470
471 do {
472 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
473 $yysubmatches = $yymatches;
474 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
475 if (!count($yymatches)) {
476 throw new Exception('Error: lexing failed because a rule matched' .
477 ' an empty string. Input "' . substr($this->data,
478 $this->counter, 5) . '... state SMARTY');
479 }
480 next($yymatches); // skip global match
481 $this->token = key($yymatches); // token number
482 if ($tokenMap[$this->token]) {
483 // extract sub-patterns for passing to lex function
484 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
485 $tokenMap[$this->token]);
486 } else {
487 $yysubmatches = array();
488 }
489 $this->value = current($yymatches); // token value
490 $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
491 if ($r === null) {
492 $this->counter += strlen($this->value);
493 $this->line += substr_count($this->value, "\n");
494 // accept this token
495 return true;
496 } elseif ($r === true) {
497 // we have changed state
498 // process this token in the new state
499 return $this->yylex();
500 } elseif ($r === false) {
501 $this->counter += strlen($this->value);
502 $this->line += substr_count($this->value, "\n");
503 if ($this->counter >= strlen($this->data)) {
504 return false; // end of input
505 }
506 // skip this token
507 continue;
508 }
509 } else {
510 throw new Exception('Unexpected input at line' . $this->line .
511 ': ' . $this->data[$this->counter]);
512 }
513 break;
514 } while (true);
515 } // end function
516
517 const SMARTY = 2;
518
519 function yy_r2_1($yy_subpatterns)
520 {
521
522 $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
523 $this->yypushstate(self::DOUBLEQUOTEDSTRING);
524 }
525
526 function yy_r2_2($yy_subpatterns)
527 {
528
529 $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
530 }
531
532 function yy_r2_3($yy_subpatterns)
533 {
534
535 $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
536 $this->taglineno = $this->line;
537 }
538
539 function yy_r2_5($yy_subpatterns)
540 {
541
542 $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
543 }
544
545 function yy_r2_6($yy_subpatterns)
546 {
547
548 $this->token = Smarty_Internal_Templateparser::TP_RDEL;
549 $this->yypopstate();
550 }
551
552 function yy_r2_7($yy_subpatterns)
553 {
554
555 $this->token = Smarty_Internal_Templateparser::TP_ISIN;
556 }
557
558 function yy_r2_8($yy_subpatterns)
559 {
560
561 $this->token = Smarty_Internal_Templateparser::TP_AS;
562 }
563
564 function yy_r2_9($yy_subpatterns)
565 {
566
567 $this->token = Smarty_Internal_Templateparser::TP_TO;
568 }
569
570 function yy_r2_10($yy_subpatterns)
571 {
572
573 $this->token = Smarty_Internal_Templateparser::TP_STEP;
574 }
575
576 function yy_r2_11($yy_subpatterns)
577 {
578
579 $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
580 }
581
582 function yy_r2_12($yy_subpatterns)
583 {
584
585 $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
586 }
587
588 function yy_r2_13($yy_subpatterns)
589 {
590
591 $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
592 }
593
594 function yy_r2_14($yy_subpatterns)
595 {
596
597 $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
598 }
599
600 function yy_r2_15($yy_subpatterns)
601 {
602
603 $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
604 }
605
606 function yy_r2_17($yy_subpatterns)
607 {
608
609 $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
610 }
611
612 function yy_r2_19($yy_subpatterns)
613 {
614
615 $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
616 }
617
618 function yy_r2_21($yy_subpatterns)
619 {
620
621 $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
622 }
623
624 function yy_r2_22($yy_subpatterns)
625 {
626
627 $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
628 }
629
630 function yy_r2_23($yy_subpatterns)
631 {
632
633 $this->token = Smarty_Internal_Templateparser::TP_MOD;
634 }
635
636 function yy_r2_24($yy_subpatterns)
637 {
638
639 $this->token = Smarty_Internal_Templateparser::TP_NOT;
640 }
641
642 function yy_r2_25($yy_subpatterns)
643 {
644
645 $this->token = Smarty_Internal_Templateparser::TP_LAND;
646 }
647
648 function yy_r2_26($yy_subpatterns)
649 {
650
651 $this->token = Smarty_Internal_Templateparser::TP_LOR;
652 }
653
654 function yy_r2_27($yy_subpatterns)
655 {
656
657 $this->token = Smarty_Internal_Templateparser::TP_LXOR;
658 }
659
660 function yy_r2_28($yy_subpatterns)
661 {
662
663 $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
664 }
665
666 function yy_r2_29($yy_subpatterns)
667 {
668
669 $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
670 }
671
672 function yy_r2_30($yy_subpatterns)
673 {
674
675 $this->token = Smarty_Internal_Templateparser::TP_ISODD;
676 }
677
678 function yy_r2_31($yy_subpatterns)
679 {
680
681 $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
682 }
683
684 function yy_r2_32($yy_subpatterns)
685 {
686
687 $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
688 }
689
690 function yy_r2_33($yy_subpatterns)
691 {
692
693 $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
694 }
695
696 function yy_r2_34($yy_subpatterns)
697 {
698
699 $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
700 }
701
702 function yy_r2_35($yy_subpatterns)
703 {
704
705 $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
706 }
707
708 function yy_r2_36($yy_subpatterns)
709 {
710
711 $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
712 }
713
714 function yy_r2_37($yy_subpatterns)
715 {
716
717 $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
718 }
719
720 function yy_r2_38($yy_subpatterns)
721 {
722
723 $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
724 }
725
726 function yy_r2_42($yy_subpatterns)
727 {
728
729 $this->token = Smarty_Internal_Templateparser::TP_OPENP;
730 }
731
732 function yy_r2_43($yy_subpatterns)
733 {
734
735 $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
736 }
737
738 function yy_r2_44($yy_subpatterns)
739 {
740
741 $this->token = Smarty_Internal_Templateparser::TP_OPENB;
742 }
743
744 function yy_r2_45($yy_subpatterns)
745 {
746
747 $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
748 }
749
750 function yy_r2_46($yy_subpatterns)
751 {
752
753 $this->token = Smarty_Internal_Templateparser::TP_PTR;
754 }
755
756 function yy_r2_47($yy_subpatterns)
757 {
758
759 $this->token = Smarty_Internal_Templateparser::TP_APTR;
760 }
761
762 function yy_r2_48($yy_subpatterns)
763 {
764
765 $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
766 }
767
768 function yy_r2_49($yy_subpatterns)
769 {
770
771 $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
772 }
773
774 function yy_r2_50($yy_subpatterns)
775 {
776
777 $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
778 }
779
780 function yy_r2_52($yy_subpatterns)
781 {
782
783 $this->token = Smarty_Internal_Templateparser::TP_MATH;
784 }
785
786 function yy_r2_54($yy_subpatterns)
787 {
788
789 $this->token = Smarty_Internal_Templateparser::TP_AT;
790 }
791
792 function yy_r2_55($yy_subpatterns)
793 {
794
795 $this->token = Smarty_Internal_Templateparser::TP_HATCH;
796 }
797
798 function yy_r2_56($yy_subpatterns)
799 {
800
801 // resolve conflicts with shorttag and right_delimiter starting with '='
802 if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) {
803 preg_match("/\s+/", $this->value, $match);
804 $this->value = $match[0];
805 $this->token = Smarty_Internal_Templateparser::TP_SPACE;
806 } else {
807 $this->token = Smarty_Internal_Templateparser::TP_ATTR;
808 }
809 }
810
811 function yy_r2_57($yy_subpatterns)
812 {
813
814 $this->token = Smarty_Internal_Templateparser::TP_ID;
815 }
816
817 function yy_r2_58($yy_subpatterns)
818 {
819
820 $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
821 }
822
823 function yy_r2_59($yy_subpatterns)
824 {
825
826 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
827 $this->yypopstate();
828 }
829
830 function yy_r2_60($yy_subpatterns)
831 {
832
833 $this->token = Smarty_Internal_Templateparser::TP_VERT;
834 }
835
836 function yy_r2_61($yy_subpatterns)
837 {
838
839 $this->token = Smarty_Internal_Templateparser::TP_DOT;
840 }
841
842 function yy_r2_62($yy_subpatterns)
843 {
844
845 $this->token = Smarty_Internal_Templateparser::TP_COMMA;
846 }
847
848 function yy_r2_63($yy_subpatterns)
849 {
850
851 $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
852 }
853
854 function yy_r2_64($yy_subpatterns)
855 {
856
857 $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
858 }
859
860 function yy_r2_65($yy_subpatterns)
861 {
862
863 $this->token = Smarty_Internal_Templateparser::TP_COLON;
864 }
865
866 function yy_r2_66($yy_subpatterns)
867 {
868
869 $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
870 }
871
872 function yy_r2_67($yy_subpatterns)
873 {
874
875 $this->token = Smarty_Internal_Templateparser::TP_QMARK;
876 }
877
878 function yy_r2_68($yy_subpatterns)
879 {
880
881 $this->token = Smarty_Internal_Templateparser::TP_HEX;
882 }
883
884 function yy_r2_69($yy_subpatterns)
885 {
886
887 $this->token = Smarty_Internal_Templateparser::TP_SPACE;
888 }
889
890 function yy_r2_70($yy_subpatterns)
891 {
892
893 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
894 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
895 } else {
896 $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
897 $this->yypushstate(self::SMARTY);
898 $this->taglineno = $this->line;
899 }
900 }
901
902 function yy_r2_72($yy_subpatterns)
903 {
904
905 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
906 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
907 } else {
908 $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
909 $this->yypushstate(self::SMARTY);
910 $this->taglineno = $this->line;
911 }
912 }
913
914 function yy_r2_73($yy_subpatterns)
915 {
916
917 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
918 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
919 } else {
920 $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
921 $this->yypushstate(self::SMARTY);
922 $this->taglineno = $this->line;
923 }
924 }
925
926 function yy_r2_74($yy_subpatterns)
927 {
928
929 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
930 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
931 } else {
932 $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
933 $this->yypushstate(self::SMARTY);
934 $this->taglineno = $this->line;
935 }
936 }
937
938 function yy_r2_75($yy_subpatterns)
939 {
940
941 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
942 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
943 } else {
944 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
945 $this->yypushstate(self::SMARTY);
946 $this->taglineno = $this->line;
947 }
948 }
949
950 function yy_r2_76($yy_subpatterns)
951 {
952
953 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
954 }
955
956 public function yylex3()
957 {
958 $tokenMap = array(
959 1 => 0,
960 2 => 0,
961 3 => 0,
962 );
963 if ($this->counter >= strlen($this->data)) {
964 return false; // end of input
965 }
966 $yy_global_pattern = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/literal\\s*" . $this->rdel . ")|\G([\S\s])/iS";
967
968 do {
969 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
970 $yysubmatches = $yymatches;
971 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
972 if (!count($yymatches)) {
973 throw new Exception('Error: lexing failed because a rule matched' .
974 ' an empty string. Input "' . substr($this->data,
975 $this->counter, 5) . '... state LITERAL');
976 }
977 next($yymatches); // skip global match
978 $this->token = key($yymatches); // token number
979 if ($tokenMap[$this->token]) {
980 // extract sub-patterns for passing to lex function
981 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
982 $tokenMap[$this->token]);
983 } else {
984 $yysubmatches = array();
985 }
986 $this->value = current($yymatches); // token value
987 $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
988 if ($r === null) {
989 $this->counter += strlen($this->value);
990 $this->line += substr_count($this->value, "\n");
991 // accept this token
992 return true;
993 } elseif ($r === true) {
994 // we have changed state
995 // process this token in the new state
996 return $this->yylex();
997 } elseif ($r === false) {
998 $this->counter += strlen($this->value);
999 $this->line += substr_count($this->value, "\n");
1000 if ($this->counter >= strlen($this->data)) {
1001 return false; // end of input
1002 }
1003 // skip this token
1004 continue;
1005 }
1006 } else {
1007 throw new Exception('Unexpected input at line' . $this->line .
1008 ': ' . $this->data[$this->counter]);
1009 }
1010 break;
1011 } while (true);
1012 } // end function
1013
1014 const LITERAL = 3;
1015
1016 function yy_r3_1($yy_subpatterns)
1017 {
1018
1019 $this->literal_cnt ++;
1020 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
1021 }
1022
1023 function yy_r3_2($yy_subpatterns)
1024 {
1025
1026 if ($this->literal_cnt) {
1027 $this->literal_cnt --;
1028 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
1029 } else {
1030 $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
1031 $this->yypopstate();
1032 }
1033 }
1034
1035 function yy_r3_3($yy_subpatterns)
1036 {
1037
1038 $to = strlen($this->data);
1039 preg_match("/{$this->ldel}\/?literal{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
1040 if (isset($match[0][1])) {
1041 $to = $match[0][1];
1042 } else {
1043 $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
1044 }
1045 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1046 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
1047 }
1048
1049 public function yylex4()
1050 {
1051 $tokenMap = array(
1052 1 => 1,
1053 3 => 0,
1054 4 => 0,
1055 5 => 0,
1056 6 => 0,
1057 7 => 0,
1058 8 => 0,
1059 9 => 0,
1060 10 => 0,
1061 11 => 0,
1062 12 => 0,
1063 13 => 3,
1064 17 => 0,
1065 );
1066 if ($this->counter >= strlen($this->data)) {
1067 return false; // end of input
1068 }
1069 $yy_global_pattern = "/\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*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/)|\G(" . $this->ldel . "\\s*)|\G(\")|\G(`\\$)|\G(\\$[0-9]*[a-zA-Z_]\\w*)|\G(\\$)|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/iS";
1070
1071 do {
1072 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
1073 $yysubmatches = $yymatches;
1074 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1075 if (!count($yymatches)) {
1076 throw new Exception('Error: lexing failed because a rule matched' .
1077 ' an empty string. Input "' . substr($this->data,
1078 $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
1079 }
1080 next($yymatches); // skip global match
1081 $this->token = key($yymatches); // token number
1082 if ($tokenMap[$this->token]) {
1083 // extract sub-patterns for passing to lex function
1084 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1085 $tokenMap[$this->token]);
1086 } else {
1087 $yysubmatches = array();
1088 }
1089 $this->value = current($yymatches); // token value
1090 $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
1091 if ($r === null) {
1092 $this->counter += strlen($this->value);
1093 $this->line += substr_count($this->value, "\n");
1094 // accept this token
1095 return true;
1096 } elseif ($r === true) {
1097 // we have changed state
1098 // process this token in the new state
1099 return $this->yylex();
1100 } elseif ($r === false) {
1101 $this->counter += strlen($this->value);
1102 $this->line += substr_count($this->value, "\n");
1103 if ($this->counter >= strlen($this->data)) {
1104 return false; // end of input
1105 }
1106 // skip this token
1107 continue;
1108 }
1109 } else {
1110 throw new Exception('Unexpected input at line' . $this->line .
1111 ': ' . $this->data[$this->counter]);
1112 }
1113 break;
1114 } while (true);
1115 } // end function
1116
1117 const DOUBLEQUOTEDSTRING = 4;
1118
1119 function yy_r4_1($yy_subpatterns)
1120 {
1121
1122 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1123 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1124 } else {
1125 $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
1126 $this->yypushstate(self::SMARTY);
1127 $this->taglineno = $this->line;
1128 }
1129 }
1130
1131 function yy_r4_3($yy_subpatterns)
1132 {
1133
1134 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1135 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1136 } else {
1137 $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
1138 $this->yypushstate(self::SMARTY);
1139 $this->taglineno = $this->line;
1140 }
1141 }
1142
1143 function yy_r4_4($yy_subpatterns)
1144 {
1145
1146 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1147 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1148 } else {
1149 $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
1150 $this->yypushstate(self::SMARTY);
1151 $this->taglineno = $this->line;
1152 }
1153 }
1154
1155 function yy_r4_5($yy_subpatterns)
1156 {
1157
1158 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1159 }
1160
1161 function yy_r4_6($yy_subpatterns)
1162 {
1163
1164 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1165 }
1166
1167 function yy_r4_7($yy_subpatterns)
1168 {
1169
1170 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1171 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1172 } else {
1173 $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
1174 $this->yypushstate(self::SMARTY);
1175 $this->taglineno = $this->line;
1176 }
1177 }
1178
1179 function yy_r4_8($yy_subpatterns)
1180 {
1181
1182 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1183 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1184 } else {
1185 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
1186 $this->yypushstate(self::SMARTY);
1187 $this->taglineno = $this->line;
1188 }
1189 }
1190
1191 function yy_r4_9($yy_subpatterns)
1192 {
1193
1194 $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
1195 $this->yypopstate();
1196 }
1197
1198 function yy_r4_10($yy_subpatterns)
1199 {
1200
1201 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
1202 $this->value = substr($this->value, 0, - 1);
1203 $this->yypushstate(self::SMARTY);
1204 $this->taglineno = $this->line;
1205 }
1206
1207 function yy_r4_11($yy_subpatterns)
1208 {
1209
1210 $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
1211 }
1212
1213 function yy_r4_12($yy_subpatterns)
1214 {
1215
1216 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1217 }
1218
1219 function yy_r4_13($yy_subpatterns)
1220 {
1221
1222 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1223 }
1224
1225 function yy_r4_17($yy_subpatterns)
1226 {
1227
1228 $to = strlen($this->data);
1229 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1230 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1231 }
1232
1233 public function yylex5()
1234 {
1235 $tokenMap = array(
1236 1 => 0,
1237 2 => 0,
1238 3 => 0,
1239 4 => 0,
1240 );
1241 if ($this->counter >= strlen($this->data)) {
1242 return false; // end of input
1243 }
1244 $yy_global_pattern = "/\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G([\S\s])/iS";
1245
1246 do {
1247 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
1248 $yysubmatches = $yymatches;
1249 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1250 if (!count($yymatches)) {
1251 throw new Exception('Error: lexing failed because a rule matched' .
1252 ' an empty string. Input "' . substr($this->data,
1253 $this->counter, 5) . '... state CHILDBODY');
1254 }
1255 next($yymatches); // skip global match
1256 $this->token = key($yymatches); // token number
1257 if ($tokenMap[$this->token]) {
1258 // extract sub-patterns for passing to lex function
1259 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1260 $tokenMap[$this->token]);
1261 } else {
1262 $yysubmatches = array();
1263 }
1264 $this->value = current($yymatches); // token value
1265 $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
1266 if ($r === null) {
1267 $this->counter += strlen($this->value);
1268 $this->line += substr_count($this->value, "\n");
1269 // accept this token
1270 return true;
1271 } elseif ($r === true) {
1272 // we have changed state
1273 // process this token in the new state
1274 return $this->yylex();
1275 } elseif ($r === false) {
1276 $this->counter += strlen($this->value);
1277 $this->line += substr_count($this->value, "\n");
1278 if ($this->counter >= strlen($this->data)) {
1279 return false; // end of input
1280 }
1281 // skip this token
1282 continue;
1283 }
1284 } else {
1285 throw new Exception('Unexpected input at line' . $this->line .
1286 ': ' . $this->data[$this->counter]);
1287 }
1288 break;
1289 } while (true);
1290 } // end function
1291
1292 const CHILDBODY = 5;
1293
1294 function yy_r5_1($yy_subpatterns)
1295 {
1296
1297 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1298 return false;
1299 } else {
1300 $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
1301 }
1302 }
1303
1304 function yy_r5_2($yy_subpatterns)
1305 {
1306
1307 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1308 return false;
1309 } else {
1310 $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
1311 }
1312 }
1313
1314 function yy_r5_3($yy_subpatterns)
1315 {
1316
1317 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1318 return false;
1319 } else {
1320 $this->yypopstate();
1321 return true;
1322 }
1323 }
1324
1325 function yy_r5_4($yy_subpatterns)
1326 {
1327
1328 $to = strlen($this->data);
1329 preg_match("/" . $this->ldel . "\s*((\/)?strip\s*" . $this->rdel . "|block\s+)/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
1330 if (isset($match[0][1])) {
1331 $to = $match[0][1];
1332 }
1333 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1334 return false;
1335 }
1336
1337 public function yylex6()
1338 {
1339 $tokenMap = array(
1340 1 => 0,
1341 2 => 0,
1342 3 => 0,
1343 4 => 1,
1344 6 => 0,
1345 );
1346 if ($this->counter >= strlen($this->data)) {
1347 return false; // end of input
1348 }
1349 $yy_global_pattern = "/\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])/iS";
1350
1351 do {
1352 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
1353 $yysubmatches = $yymatches;
1354 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1355 if (!count($yymatches)) {
1356 throw new Exception('Error: lexing failed because a rule matched' .
1357 ' an empty string. Input "' . substr($this->data,
1358 $this->counter, 5) . '... state CHILDBLOCK');
1359 }
1360 next($yymatches); // skip global match
1361 $this->token = key($yymatches); // token number
1362 if ($tokenMap[$this->token]) {
1363 // extract sub-patterns for passing to lex function
1364 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1365 $tokenMap[$this->token]);
1366 } else {
1367 $yysubmatches = array();
1368 }
1369 $this->value = current($yymatches); // token value
1370 $r = $this->{'yy_r6_' . $this->token}($yysubmatches);
1371 if ($r === null) {
1372 $this->counter += strlen($this->value);
1373 $this->line += substr_count($this->value, "\n");
1374 // accept this token
1375 return true;
1376 } elseif ($r === true) {
1377 // we have changed state
1378 // process this token in the new state
1379 return $this->yylex();
1380 } elseif ($r === false) {
1381 $this->counter += strlen($this->value);
1382 $this->line += substr_count($this->value, "\n");
1383 if ($this->counter >= strlen($this->data)) {
1384 return false; // end of input
1385 }
1386 // skip this token
1387 continue;
1388 }
1389 } else {
1390 throw new Exception('Unexpected input at line' . $this->line .
1391 ': ' . $this->data[$this->counter]);
1392 }
1393 break;
1394 } while (true);
1395 } // end function
1396
1397 const CHILDBLOCK = 6;
1398
1399 function yy_r6_1($yy_subpatterns)
1400 {
1401
1402 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1403 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1404 } else {
1405 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1406 $this->yypushstate(self::CHILDLITERAL);
1407 }
1408 }
1409
1410 function yy_r6_2($yy_subpatterns)
1411 {
1412
1413 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1414 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1415 } else {
1416 $this->yypopstate();
1417 return true;
1418 }
1419 }
1420
1421 function yy_r6_3($yy_subpatterns)
1422 {
1423
1424 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1425 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1426 } else {
1427 $this->yypopstate();
1428 return true;
1429 }
1430 }
1431
1432 function yy_r6_4($yy_subpatterns)
1433 {
1434
1435 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1436 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1437 } else {
1438 $this->yypopstate();
1439 return true;
1440 }
1441 }
1442
1443 function yy_r6_6($yy_subpatterns)
1444 {
1445
1446 $to = strlen($this->data);
1447 preg_match("/" . $this->ldel . "\s*(literal\s*" . $this->rdel . "|(\/)?block(\s|" . $this->rdel . ")|[\$]smarty\.block\.(child|parent))/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
1448 if (isset($match[0][1])) {
1449 $to = $match[0][1];
1450 }
1451 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1452 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1453 }
1454
1455 public function yylex7()
1456 {
1457 $tokenMap = array(
1458 1 => 0,
1459 2 => 0,
1460 3 => 0,
1461 );
1462 if ($this->counter >= strlen($this->data)) {
1463 return false; // end of input
1464 }
1465 $yy_global_pattern = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/literal\\s*" . $this->rdel . ")|\G([\S\s])/iS";
1466
1467 do {
1468 if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
1469 $yysubmatches = $yymatches;
1470 $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
1471 if (!count($yymatches)) {
1472 throw new Exception('Error: lexing failed because a rule matched' .
1473 ' an empty string. Input "' . substr($this->data,
1474 $this->counter, 5) . '... state CHILDLITERAL');
1475 }
1476 next($yymatches); // skip global match
1477 $this->token = key($yymatches); // token number
1478 if ($tokenMap[$this->token]) {
1479 // extract sub-patterns for passing to lex function
1480 $yysubmatches = array_slice($yysubmatches, $this->token + 1,
1481 $tokenMap[$this->token]);
1482 } else {
1483 $yysubmatches = array();
1484 }
1485 $this->value = current($yymatches); // token value
1486 $r = $this->{'yy_r7_' . $this->token}($yysubmatches);
1487 if ($r === null) {
1488 $this->counter += strlen($this->value);
1489 $this->line += substr_count($this->value, "\n");
1490 // accept this token
1491 return true;
1492 } elseif ($r === true) {
1493 // we have changed state
1494 // process this token in the new state
1495 return $this->yylex();
1496 } elseif ($r === false) {
1497 $this->counter += strlen($this->value);
1498 $this->line += substr_count($this->value, "\n");
1499 if ($this->counter >= strlen($this->data)) {
1500 return false; // end of input
1501 }
1502 // skip this token
1503 continue;
1504 }
1505 } else {
1506 throw new Exception('Unexpected input at line' . $this->line .
1507 ': ' . $this->data[$this->counter]);
1508 }
1509 break;
1510 } while (true);
1511 } // end function
1512
1513 const CHILDLITERAL = 7;
1514
1515 function yy_r7_1($yy_subpatterns)
1516 {
1517
1518 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1519 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1520 } else {
1521 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1522 $this->yypushstate(self::CHILDLITERAL);
1523 }
1524 }
1525
1526 function yy_r7_2($yy_subpatterns)
1527 {
1528
1529 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
1530 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1531 } else {
1532 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1533 $this->yypopstate();
1534 }
1535 }
1536
1537 function yy_r7_3($yy_subpatterns)
1538 {
1539
1540 $to = strlen($this->data);
1541 preg_match("/{$this->ldel}\/?literal\s*{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
1542 if (isset($match[0][1])) {
1543 $to = $match[0][1];
1544 } else {
1545 $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
1546 }
1547 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1548 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
1549 }
1550 }
1551
1552