|
1 <?php |
|
2 /** |
|
3 * Smarty Internal Plugin Templatelexer |
|
4 * This is the lexer to break the template source into tokens |
|
5 * |
|
6 * @package Smarty |
|
7 * @subpackage Compiler |
|
8 * @author Uwe Tews |
|
9 */ |
|
10 |
|
11 /** |
|
12 * Smarty_Internal_Templatelexer |
|
13 * This is the template file lexer. |
|
14 * It is generated from the smarty_internal_templatelexer.plex file |
|
15 * |
|
16 * @package Smarty |
|
17 * @subpackage Compiler |
|
18 * @author Uwe Tews |
|
19 */ |
|
20 class Smarty_Internal_Templatelexer |
|
21 { |
|
22 /** |
|
23 * Source |
|
24 * |
|
25 * @var string |
|
26 */ |
|
27 public $data; |
|
28 /** |
|
29 * byte counter |
|
30 * |
|
31 * @var int |
|
32 */ |
|
33 public $counter; |
|
34 /** |
|
35 * token number |
|
36 * |
|
37 * @var int |
|
38 */ |
|
39 public $token; |
|
40 /** |
|
41 * token value |
|
42 * |
|
43 * @var string |
|
44 */ |
|
45 public $value; |
|
46 /** |
|
47 * current line |
|
48 * |
|
49 * @var int |
|
50 */ |
|
51 public $line; |
|
52 /** |
|
53 * tag start line |
|
54 * |
|
55 * @var |
|
56 */ |
|
57 public $taglineno; |
|
58 /** |
|
59 * php code type |
|
60 * |
|
61 * @var string |
|
62 */ |
|
63 public $phpType = ''; |
|
64 /** |
|
65 * escaped left delimiter |
|
66 * |
|
67 * @var string |
|
68 */ |
|
69 public $ldel = ''; |
|
70 /** |
|
71 * escaped left delimiter length |
|
72 * |
|
73 * @var int |
|
74 */ |
|
75 public $ldel_length = 0; |
|
76 /** |
|
77 * escaped right delimiter |
|
78 * |
|
79 * @var string |
|
80 */ |
|
81 public $rdel = ''; |
|
82 /** |
|
83 * escaped right delimiter length |
|
84 * |
|
85 * @var int |
|
86 */ |
|
87 public $rdel_length = 0; |
|
88 /** |
|
89 * state number |
|
90 * |
|
91 * @var int |
|
92 */ |
|
93 public $state = 1; |
|
94 /** |
|
95 * Smarty object |
|
96 * |
|
97 * @var Smarty |
|
98 */ |
|
99 public $smarty = null; |
|
100 /** |
|
101 * compiler object |
|
102 * |
|
103 * @var Smarty_Internal_TemplateCompilerBase |
|
104 */ |
|
105 public $compiler = null; |
|
106 /** |
|
107 * literal tag nesting level |
|
108 * |
|
109 * @var int |
|
110 */ |
|
111 private $literal_cnt = 0; |
|
112 |
|
113 /** |
|
114 * PHP start tag string |
|
115 * |
|
116 * @var string |
|
117 */ |
|
118 |
|
119 /** |
|
120 * trace file |
|
121 * |
|
122 * @var resource |
|
123 */ |
|
124 public $yyTraceFILE; |
|
125 |
|
126 /** |
|
127 * trace prompt |
|
128 * |
|
129 * @var string |
|
130 */ |
|
131 public $yyTracePrompt; |
|
132 |
|
133 /** |
|
134 * XML flag true while processing xml |
|
135 * |
|
136 * @var bool |
|
137 */ |
|
138 public $is_xml = false; |
|
139 |
|
140 /** |
|
141 * state names |
|
142 * |
|
143 * @var array |
|
144 */ |
|
145 public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING', |
|
146 6 => 'CHILDBODY', 7 => 'CHILDBLOCK', 8 => 'CHILDLITERAL'); |
|
147 |
|
148 /** |
|
149 * storage for assembled token patterns |
|
150 * |
|
151 * @var string |
|
152 */ |
|
153 private $yy_global_pattern1 = null; |
|
154 |
|
155 private $yy_global_pattern2 = null; |
|
156 |
|
157 private $yy_global_pattern3 = null; |
|
158 |
|
159 private $yy_global_pattern4 = null; |
|
160 |
|
161 private $yy_global_pattern5 = null; |
|
162 |
|
163 private $yy_global_pattern6 = null; |
|
164 |
|
165 private $yy_global_pattern7 = null; |
|
166 |
|
167 private $yy_global_pattern8 = null; |
|
168 |
|
169 /** |
|
170 * token names |
|
171 * |
|
172 * @var array |
|
173 */ |
|
174 public $smarty_token_names = array( // Text for parser error messages |
|
175 'NOT' => '(!,not)', |
|
176 'OPENP' => '(', |
|
177 'CLOSEP' => ')', |
|
178 'OPENB' => '[', |
|
179 'CLOSEB' => ']', |
|
180 'PTR' => '->', |
|
181 'APTR' => '=>', |
|
182 'EQUAL' => '=', |
|
183 'NUMBER' => 'number', |
|
184 'UNIMATH' => '+" , "-', |
|
185 'MATH' => '*" , "/" , "%', |
|
186 'INCDEC' => '++" , "--', |
|
187 'SPACE' => ' ', |
|
188 'DOLLAR' => '$', |
|
189 'SEMICOLON' => ';', |
|
190 'COLON' => ':', |
|
191 'DOUBLECOLON' => '::', |
|
192 'AT' => '@', |
|
193 'HATCH' => '#', |
|
194 'QUOTE' => '"', |
|
195 'BACKTICK' => '`', |
|
196 'VERT' => '"|" modifier', |
|
197 'DOT' => '.', |
|
198 'COMMA' => '","', |
|
199 'QMARK' => '"?"', |
|
200 'ID' => 'id, name', |
|
201 'TEXT' => 'text', |
|
202 'LDELSLASH' => '{/..} closing tag', |
|
203 'LDEL' => '{...} Smarty tag', |
|
204 'COMMENT' => 'comment', |
|
205 'AS' => 'as', |
|
206 'TO' => 'to', |
|
207 'PHP' => '"<?php", "<%", "{php}" tag', |
|
208 'LOGOP' => '"<", "==" ... logical operator', |
|
209 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', |
|
210 'SCOND' => '"is even" ... if condition', |
|
211 ); |
|
212 |
|
213 /** |
|
214 * constructor |
|
215 * |
|
216 * @param string $data template source |
|
217 * @param Smarty_Internal_TemplateCompilerBase $compiler |
|
218 */ |
|
219 function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler) |
|
220 { |
|
221 $this->data = $data; |
|
222 $this->counter = 0; |
|
223 if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) { |
|
224 $this->counter += strlen($match[0]); |
|
225 } |
|
226 $this->line = 1; |
|
227 $this->smarty = $compiler->smarty; |
|
228 $this->compiler = $compiler; |
|
229 $this->ldel = preg_quote($this->smarty->left_delimiter, '~'); |
|
230 $this->ldel_length = strlen($this->smarty->left_delimiter); |
|
231 $this->rdel = preg_quote($this->smarty->right_delimiter, '~'); |
|
232 $this->rdel_length = strlen($this->smarty->right_delimiter); |
|
233 $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter; |
|
234 $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter; |
|
235 } |
|
236 |
|
237 public function PrintTrace() |
|
238 { |
|
239 $this->yyTraceFILE = fopen('php://output', 'w'); |
|
240 $this->yyTracePrompt = '<br>'; |
|
241 } |
|
242 |
|
243 /* |
|
244 * Check if this tag is autoliteral |
|
245 */ |
|
246 public function isAutoLiteral () |
|
247 { |
|
248 return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false; |
|
249 } |
|
250 |
|
251 /*!lex2php |
|
252 %input $this->data |
|
253 %counter $this->counter |
|
254 %token $this->token |
|
255 %value $this->value |
|
256 %line $this->line |
|
257 linebreak = ~[\t ]*[\r\n]+[\t ]*~ |
|
258 text = ~[\S\s]~ |
|
259 textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYldel|\$|`\$|"))~ |
|
260 namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~ |
|
261 all = ~[\S\s]+~ |
|
262 emptyjava = ~[{][}]~ |
|
263 phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*["']?\s*php\s*["']?\s*>)|([?][>])|([%][>])|(SMARTYldel\s*php(.*?)SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~ |
|
264 slash = ~[/]~ |
|
265 ldel = ~SMARTYldel\s*~ |
|
266 rdel = ~\s*SMARTYrdel~ |
|
267 nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~ |
|
268 notblockid = ~(?:(?!block)[0-9]*[a-zA-Z_]\w*)~ |
|
269 smartyblockchildparent = ~[\$]smarty\.block\.(child|parent)~ |
|
270 integer = ~\d+~ |
|
271 hex = ~0[xX][0-9a-fA-F]+~ |
|
272 math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~ |
|
273 comment = ~SMARTYldel[*]~ |
|
274 incdec = ~([+]|[-]){2}~ |
|
275 unimath = ~\s*([+]|[-])\s*~ |
|
276 openP = ~\s*[(]\s*~ |
|
277 closeP = ~\s*[)]~ |
|
278 openB = ~\[\s*~ |
|
279 closeB = ~\s*\]~ |
|
280 dollar = ~[$]~ |
|
281 dot = ~[.]~ |
|
282 comma = ~\s*[,]\s*~ |
|
283 doublecolon = ~[:]{2}~ |
|
284 colon = ~\s*[:]\s*~ |
|
285 at = ~[@]~ |
|
286 hatch = ~[#]~ |
|
287 semicolon = ~\s*[;]\s*~ |
|
288 equal = ~\s*[=]\s*~ |
|
289 space = ~\s+~ |
|
290 ptr = ~\s*[-][>]\s*~ |
|
291 aptr = ~\s*[=][>]\s*~ |
|
292 singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~ |
|
293 backtick = ~[`]~ |
|
294 vert = ~[|]~ |
|
295 qmark = ~\s*[?]\s*~ |
|
296 constant = ~([_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*)(?![0-9A-Z_]*[a-z])~ |
|
297 attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~ |
|
298 id = ~[0-9]*[a-zA-Z_]\w*~ |
|
299 literal = ~literal~ |
|
300 strip = ~strip~ |
|
301 lop = ~\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\s*~ |
|
302 tlop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\s+(not\s+)?(odd|even|div)\s+by))\s+~ |
|
303 scond = ~\s+is\s+(not\s+)?(odd|even)~ |
|
304 isin = ~\s+is\s+in\s+~ |
|
305 as = ~\s+as\s+~ |
|
306 to = ~\s+to\s+~ |
|
307 step = ~\s+step\s+~ |
|
308 block = ~block~ |
|
309 if = ~(if|elseif|else if|while)\s+~ |
|
310 for = ~for\s+~ |
|
311 foreach = ~foreach(?![^\s])~ |
|
312 setfilter = ~setfilter\s+~ |
|
313 instanceof = ~\s+instanceof\s+~ |
|
314 not = ~([!]\s*)|(not\s+)~ |
|
315 typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~ |
|
316 double_quote = ~["]~ |
|
317 single_quote = ~[']~ |
|
318 */ |
|
319 /*!lex2php |
|
320 %statename TEXT |
|
321 emptyjava { |
|
322 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
323 } |
|
324 comment { |
|
325 preg_match("~[*]{$this->rdel}~",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
326 if (isset($match[0][1])) { |
|
327 $to = $match[0][1] + strlen($match[0][0]); |
|
328 } else { |
|
329 $this->compiler->trigger_template_error ("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'"); |
|
330 } |
|
331 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
332 return false; |
|
333 } |
|
334 phpstart { |
|
335 $obj = new Smarty_Internal_Compile_Private_Php(); |
|
336 $obj->parsePhp($this); |
|
337 } |
|
338 ldel literal rdel { |
|
339 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
340 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
341 } else { |
|
342 $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; |
|
343 $this->yypushstate(self::LITERAL); |
|
344 } |
|
345 } |
|
346 ldel { |
|
347 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
348 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
349 } else { |
|
350 $this->yypushstate(self::TAG); |
|
351 return true; |
|
352 } |
|
353 } |
|
354 rdel { |
|
355 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
356 } |
|
357 text { |
|
358 $to = strlen($this->data); |
|
359 preg_match("~($this->ldel)|([<]script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*[>])|([<][?])|([<][%])|([?][>])|([%][>])~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
360 if (isset($match[0][1])) { |
|
361 $to = $match[0][1]; |
|
362 } |
|
363 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
364 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
365 } |
|
366 */ |
|
367 /*!lex2php |
|
368 %statename TAG |
|
369 ldel if { |
|
370 $this->token = Smarty_Internal_Templateparser::TP_LDELIF; |
|
371 $this->yybegin(self::TAGBODY); |
|
372 $this->taglineno = $this->line; |
|
373 } |
|
374 ldel for { |
|
375 $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; |
|
376 $this->yybegin(self::TAGBODY); |
|
377 $this->taglineno = $this->line; |
|
378 } |
|
379 ldel foreach { |
|
380 $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; |
|
381 $this->yybegin(self::TAGBODY); |
|
382 $this->taglineno = $this->line; |
|
383 } |
|
384 ldel setfilter { |
|
385 $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; |
|
386 $this->yybegin(self::TAGBODY); |
|
387 $this->taglineno = $this->line; |
|
388 } |
|
389 ldel id nocacherdel { |
|
390 $this->yypopstate(); |
|
391 $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; |
|
392 $this->taglineno = $this->line; |
|
393 } |
|
394 ldel slash notblockid rdel { |
|
395 $this->yypopstate(); |
|
396 $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; |
|
397 $this->taglineno = $this->line; |
|
398 } |
|
399 ldel dollar id nocacherdel { |
|
400 if ($this->_yy_stack[count($this->_yy_stack)-1] == self::TEXT) { |
|
401 $this->yypopstate(); |
|
402 $this->token = Smarty_Internal_Templateparser::TP_SIMPLEOUTPUT; |
|
403 $this->taglineno = $this->line; |
|
404 } else { |
|
405 $this->value = $this->smarty->left_delimiter; |
|
406 $this->token = Smarty_Internal_Templateparser::TP_LDEL; |
|
407 $this->yybegin(self::TAGBODY); |
|
408 $this->taglineno = $this->line; |
|
409 } |
|
410 } |
|
411 ldel slash { |
|
412 $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; |
|
413 $this->yybegin(self::TAGBODY); |
|
414 $this->taglineno = $this->line; |
|
415 } |
|
416 ldel { |
|
417 $this->token = Smarty_Internal_Templateparser::TP_LDEL; |
|
418 $this->yybegin(self::TAGBODY); |
|
419 $this->taglineno = $this->line; |
|
420 } |
|
421 */ |
|
422 /*!lex2php |
|
423 %statename TAGBODY |
|
424 rdel { |
|
425 $this->token = Smarty_Internal_Templateparser::TP_RDEL; |
|
426 $this->yypopstate(); |
|
427 } |
|
428 double_quote { |
|
429 $this->token = Smarty_Internal_Templateparser::TP_QUOTE; |
|
430 $this->yypushstate(self::DOUBLEQUOTEDSTRING); |
|
431 } |
|
432 singlequotestring { |
|
433 $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; |
|
434 } |
|
435 smartyblockchildparent { |
|
436 $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; |
|
437 $this->taglineno = $this->line; |
|
438 } |
|
439 dollar id { |
|
440 $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; |
|
441 } |
|
442 dollar { |
|
443 $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; |
|
444 } |
|
445 isin { |
|
446 $this->token = Smarty_Internal_Templateparser::TP_ISIN; |
|
447 } |
|
448 as { |
|
449 $this->token = Smarty_Internal_Templateparser::TP_AS; |
|
450 } |
|
451 to { |
|
452 $this->token = Smarty_Internal_Templateparser::TP_TO; |
|
453 } |
|
454 step { |
|
455 $this->token = Smarty_Internal_Templateparser::TP_STEP; |
|
456 } |
|
457 instanceof { |
|
458 $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; |
|
459 } |
|
460 lop { |
|
461 $this->token = Smarty_Internal_Templateparser::TP_LOGOP; |
|
462 } |
|
463 tlop { |
|
464 $this->token = Smarty_Internal_Templateparser::TP_TLOGOP; |
|
465 } |
|
466 scond { |
|
467 $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; |
|
468 } |
|
469 not{ |
|
470 $this->token = Smarty_Internal_Templateparser::TP_NOT; |
|
471 } |
|
472 typecast { |
|
473 $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; |
|
474 } |
|
475 openP { |
|
476 $this->token = Smarty_Internal_Templateparser::TP_OPENP; |
|
477 } |
|
478 closeP { |
|
479 $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; |
|
480 } |
|
481 openB { |
|
482 $this->token = Smarty_Internal_Templateparser::TP_OPENB; |
|
483 } |
|
484 closeB { |
|
485 $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; |
|
486 } |
|
487 ptr { |
|
488 $this->token = Smarty_Internal_Templateparser::TP_PTR; |
|
489 } |
|
490 aptr { |
|
491 $this->token = Smarty_Internal_Templateparser::TP_APTR; |
|
492 } |
|
493 equal { |
|
494 $this->token = Smarty_Internal_Templateparser::TP_EQUAL; |
|
495 } |
|
496 incdec { |
|
497 $this->token = Smarty_Internal_Templateparser::TP_INCDEC; |
|
498 } |
|
499 unimath { |
|
500 $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; |
|
501 } |
|
502 math { |
|
503 $this->token = Smarty_Internal_Templateparser::TP_MATH; |
|
504 } |
|
505 at { |
|
506 $this->token = Smarty_Internal_Templateparser::TP_AT; |
|
507 } |
|
508 hatch { |
|
509 $this->token = Smarty_Internal_Templateparser::TP_HATCH; |
|
510 } |
|
511 attr { |
|
512 // resolve conflicts with shorttag and right_delimiter starting with '=' |
|
513 if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) { |
|
514 preg_match("~\s+~",$this->value,$match); |
|
515 $this->value = $match[0]; |
|
516 $this->token = Smarty_Internal_Templateparser::TP_SPACE; |
|
517 } else { |
|
518 $this->token = Smarty_Internal_Templateparser::TP_ATTR; |
|
519 } |
|
520 } |
|
521 namespace { |
|
522 $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; |
|
523 } |
|
524 id { |
|
525 $this->token = Smarty_Internal_Templateparser::TP_ID; |
|
526 } |
|
527 integer { |
|
528 $this->token = Smarty_Internal_Templateparser::TP_INTEGER; |
|
529 } |
|
530 backtick { |
|
531 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; |
|
532 $this->yypopstate(); |
|
533 } |
|
534 vert { |
|
535 $this->token = Smarty_Internal_Templateparser::TP_VERT; |
|
536 } |
|
537 dot { |
|
538 $this->token = Smarty_Internal_Templateparser::TP_DOT; |
|
539 } |
|
540 comma { |
|
541 $this->token = Smarty_Internal_Templateparser::TP_COMMA; |
|
542 } |
|
543 semicolon { |
|
544 $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; |
|
545 } |
|
546 doublecolon { |
|
547 $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; |
|
548 } |
|
549 colon { |
|
550 $this->token = Smarty_Internal_Templateparser::TP_COLON; |
|
551 } |
|
552 qmark { |
|
553 $this->token = Smarty_Internal_Templateparser::TP_QMARK; |
|
554 } |
|
555 hex { |
|
556 $this->token = Smarty_Internal_Templateparser::TP_HEX; |
|
557 } |
|
558 space { |
|
559 $this->token = Smarty_Internal_Templateparser::TP_SPACE; |
|
560 } |
|
561 ldel { |
|
562 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
563 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
564 } else { |
|
565 $this->yypushstate(self::TAG); |
|
566 return true; |
|
567 } |
|
568 } |
|
569 text { |
|
570 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
571 } |
|
572 */ |
|
573 |
|
574 /*!lex2php |
|
575 %statename LITERAL |
|
576 ldel literal rdel { |
|
577 $this->literal_cnt++; |
|
578 $this->token = Smarty_Internal_Templateparser::TP_LITERAL; |
|
579 } |
|
580 ldel slash literal rdel { |
|
581 if ($this->literal_cnt) { |
|
582 $this->literal_cnt--; |
|
583 $this->token = Smarty_Internal_Templateparser::TP_LITERAL; |
|
584 } else { |
|
585 $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; |
|
586 $this->yypopstate(); |
|
587 } |
|
588 } |
|
589 text { |
|
590 $to = strlen($this->data); |
|
591 preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
592 if (isset($match[0][1])) { |
|
593 $to = $match[0][1]; |
|
594 } else { |
|
595 $this->compiler->trigger_template_error ("missing or misspelled literal closing tag"); |
|
596 } |
|
597 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
598 $this->token = Smarty_Internal_Templateparser::TP_LITERAL; |
|
599 } |
|
600 */ |
|
601 /*!lex2php |
|
602 %statename DOUBLEQUOTEDSTRING |
|
603 ldel literal rdel { |
|
604 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
605 } |
|
606 ldel slash literal rdel { |
|
607 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
608 } |
|
609 ldel slash { |
|
610 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
611 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
612 } else { |
|
613 $this->yypushstate(self::TAG); |
|
614 return true; |
|
615 } |
|
616 } |
|
617 ldel id { |
|
618 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
619 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
620 } else { |
|
621 $this->yypushstate(self::TAG); |
|
622 return true; |
|
623 } |
|
624 } |
|
625 ldel { |
|
626 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
627 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
628 } else { |
|
629 $this->token = Smarty_Internal_Templateparser::TP_LDEL; |
|
630 $this->taglineno = $this->line; |
|
631 $this->yypushstate(self::TAGBODY); |
|
632 } |
|
633 } |
|
634 double_quote { |
|
635 $this->token = Smarty_Internal_Templateparser::TP_QUOTE; |
|
636 $this->yypopstate(); |
|
637 } |
|
638 backtick dollar { |
|
639 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; |
|
640 $this->value = substr($this->value,0,-1); |
|
641 $this->yypushstate(self::TAGBODY); |
|
642 $this->taglineno = $this->line; |
|
643 } |
|
644 dollar id { |
|
645 $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; |
|
646 } |
|
647 dollar { |
|
648 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
649 } |
|
650 textdoublequoted { |
|
651 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
652 } |
|
653 text { |
|
654 $to = strlen($this->data); |
|
655 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
656 $this->token = Smarty_Internal_Templateparser::TP_TEXT; |
|
657 } |
|
658 */ |
|
659 /*!lex2php |
|
660 %statename CHILDBODY |
|
661 ldel strip rdel { |
|
662 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
663 return false; |
|
664 } else { |
|
665 $this->token = Smarty_Internal_Templateparser::TP_STRIPON; |
|
666 } |
|
667 } |
|
668 ldel slash strip rdel { |
|
669 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
670 return false; |
|
671 } else { |
|
672 $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; |
|
673 } |
|
674 } |
|
675 ldel block { |
|
676 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
677 return false; |
|
678 } else { |
|
679 $this->yypopstate(); |
|
680 return true; |
|
681 } |
|
682 } |
|
683 text { |
|
684 $to = strlen($this->data); |
|
685 preg_match("~SMARTYldel\s*(([/])?strip\s*SMARTYrdel|block\s+)~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
686 if (isset($match[0][1])) { |
|
687 $to = $match[0][1]; |
|
688 } |
|
689 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
690 return false; |
|
691 } |
|
692 |
|
693 */ |
|
694 /*!lex2php |
|
695 %statename CHILDBLOCK |
|
696 ldel literal rdel { |
|
697 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
698 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
699 } else { |
|
700 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
701 $this->yypushstate(self::CHILDLITERAL); |
|
702 } |
|
703 } |
|
704 ldel block { |
|
705 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
706 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
707 } else { |
|
708 $this->yypopstate(); |
|
709 return true; |
|
710 } |
|
711 } |
|
712 ldel slash block { |
|
713 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
714 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
715 } else { |
|
716 $this->yypopstate(); |
|
717 return true; |
|
718 } |
|
719 } |
|
720 ldel smartyblockchildparent { |
|
721 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
722 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
723 } else { |
|
724 $this->yypopstate(); |
|
725 return true; |
|
726 } |
|
727 } |
|
728 text { |
|
729 $to = strlen($this->data); |
|
730 preg_match("~SMARTYldel\s*(literal\s*SMARTYrdel|([/])?block(\s|SMARTYrdel)|[\$]smarty\.block\.(child|parent))~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
731 if (isset($match[0][1])) { |
|
732 $to = $match[0][1]; |
|
733 } |
|
734 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
735 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
736 } |
|
737 */ |
|
738 /*!lex2php |
|
739 %statename CHILDLITERAL |
|
740 ldel literal rdel { |
|
741 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
742 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
743 } else { |
|
744 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
745 $this->yypushstate(self::CHILDLITERAL); |
|
746 } |
|
747 } |
|
748 ldel slash literal rdel { |
|
749 if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { |
|
750 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
751 } else { |
|
752 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
753 $this->yypopstate(); |
|
754 } |
|
755 } |
|
756 text { |
|
757 $to = strlen($this->data); |
|
758 preg_match("~{$this->ldel}[/]?literal\s*{$this->rdel}~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); |
|
759 if (isset($match[0][1])) { |
|
760 $to = $match[0][1]; |
|
761 } else { |
|
762 $this->compiler->trigger_template_error ("missing or misspelled literal closing tag"); |
|
763 } |
|
764 $this->value = substr($this->data,$this->counter,$to-$this->counter); |
|
765 $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; |
|
766 } |
|
767 */ |
|
768 } |
|
769 |
|
770 |