3 * This file is part of Smarty.
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * Smarty_Internal_Templatelexer
13 * This is the template file lexer.
14 * It is generated from the smarty_internal_templatelexer.plex file
17 * @author Uwe Tews <uwe.tews@googlemail.com>
19 class Smarty_Internal_Templatelexer
33 public $dataLength = null;
78 * escaped left delimiter
85 * escaped left delimiter length
89 public $ldel_length = 0;
92 * escaped right delimiter
99 * escaped right delimiter length
103 public $rdel_length = 0;
117 public $smarty = null;
122 * @var Smarty_Internal_TemplateCompilerBase
124 public $compiler = null;
127 * literal tag nesting level
131 private $literal_cnt = 0;
134 * PHP start tag string
151 public $yyTracePrompt;
154 * XML flag true while processing xml
158 public $is_xml = false;
165 public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
168 * storage for assembled token patterns
172 private $yy_global_pattern1 = null;
174 private $yy_global_pattern2 = null;
176 private $yy_global_pattern3 = null;
178 private $yy_global_pattern4 = null;
180 private $yy_global_pattern5 = null;
187 public $smarty_token_names = array( // Text for parser error messages
188 'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[',
189 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=',
190 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%',
191 'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$',
192 'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@',
193 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`',
194 'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","',
195 'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text',
196 'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag',
197 'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',
198 'PHP' => '"<?php", "<%", "{php}" tag',
199 'LOGOP' => '"<", "==" ... logical operator',
200 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
201 'SCOND' => '"is even" ... if condition',);
206 * @param string $data template source
207 * @param Smarty_Internal_TemplateCompilerBase $compiler
209 function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler)
212 $this->dataLength = strlen($data);
214 if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
215 $this->counter += strlen($match[ 0 ]);
218 $this->smarty = $compiler->smarty;
219 $this->compiler = $compiler;
220 $this->ldel = preg_quote($this->smarty->left_delimiter, '/');
221 $this->ldel_length = strlen($this->smarty->left_delimiter);
222 $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
223 $this->rdel_length = strlen($this->smarty->right_delimiter);
224 $this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter;
225 $this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter;
228 public function PrintTrace()
230 $this->yyTraceFILE = fopen('php://output', 'w');
231 $this->yyTracePrompt = '<br>';
235 * Check if this tag is autoliteral
237 public function isAutoLiteral()
239 return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
240 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false;
243 private $_yy_state = 1;
245 private $_yy_stack = array();
247 public function yylex()
249 return $this->{'yylex' . $this->_yy_state}();
252 public function yypushstate($state)
254 if ($this->yyTraceFILE) {
255 fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
256 isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
259 array_push($this->_yy_stack, $this->_yy_state);
260 $this->_yy_state = $state;
261 if ($this->yyTraceFILE) {
262 fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
263 isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
268 public function yypopstate()
270 if ($this->yyTraceFILE) {
271 fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
272 isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
275 $this->_yy_state = array_pop($this->_yy_stack);
276 if ($this->yyTraceFILE) {
277 fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
278 isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
283 public function yybegin($state)
285 $this->_yy_state = $state;
286 if ($this->yyTraceFILE) {
287 fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
288 isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
293 public function yylex1()
295 if (!isset($this->yy_global_pattern1)) {
296 $this->yy_global_pattern1 =
297 "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php([ ].*?)?" . $this->rdel . ")|(" .
298 $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel .
299 ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel .
300 ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS";
302 if (!isset($this->dataLength)) {
303 $this->dataLength = strlen($this->data);
305 if ($this->counter >= $this->dataLength) {
306 return false; // end of input
310 if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
311 if (!isset($yymatches[ 0 ][ 1 ])) {
312 $yymatches = preg_grep("/(.|\s)+/", $yymatches);
314 $yymatches = array_filter($yymatches);
316 if (empty($yymatches)) {
317 throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
318 substr($this->data, $this->counter, 5) . '... state TEXT');
320 next($yymatches); // skip global match
321 $this->token = key($yymatches); // token number
322 $this->value = current($yymatches); // token value
323 $r = $this->{'yy_r1_' . $this->token}();
325 $this->counter += strlen($this->value);
326 $this->line += substr_count($this->value, "\n");
329 } elseif ($r === true) {
330 // we have changed state
331 // process this token in the new state
332 return $this->yylex();
333 } elseif ($r === false) {
334 $this->counter += strlen($this->value);
335 $this->line += substr_count($this->value, "\n");
336 if ($this->counter >= $this->dataLength) {
337 return false; // end of input
343 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
355 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
361 preg_match("/[*]{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
362 if (isset($match[ 0 ][ 1 ])) {
363 $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
365 $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'");
367 $this->value = substr($this->data, $this->counter, $to - $this->counter);
374 $this->compiler->getTagCompiler('private_php')->parsePhp($this);
380 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
381 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
383 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
385 $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
386 $this->yypushstate(self::LITERAL);
393 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
394 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
396 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
398 $this->yypushstate(self::TAG);
406 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
412 $this->compiler->getTagCompiler('private_php')->parsePhp($this);
418 $to = $this->dataLength;
419 preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i",
420 $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
421 if (isset($match[ 0 ][ 1 ])) {
422 $to = $match[ 0 ][ 1 ];
424 $this->value = substr($this->data, $this->counter, $to - $this->counter);
425 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
428 public function yylex2()
430 if (!isset($this->yy_global_pattern2)) {
431 $this->yy_global_pattern2 =
432 "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" .
433 $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel .
434 "\\s*make_nocache\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel .
435 ")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" .
436 $this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel .
437 "\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS";
439 if (!isset($this->dataLength)) {
440 $this->dataLength = strlen($this->data);
442 if ($this->counter >= $this->dataLength) {
443 return false; // end of input
447 if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
448 if (!isset($yymatches[ 0 ][ 1 ])) {
449 $yymatches = preg_grep("/(.|\s)+/", $yymatches);
451 $yymatches = array_filter($yymatches);
453 if (empty($yymatches)) {
454 throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
455 substr($this->data, $this->counter, 5) . '... state TAG');
457 next($yymatches); // skip global match
458 $this->token = key($yymatches); // token number
459 $this->value = current($yymatches); // token value
460 $r = $this->{'yy_r2_' . $this->token}();
462 $this->counter += strlen($this->value);
463 $this->line += substr_count($this->value, "\n");
466 } elseif ($r === true) {
467 // we have changed state
468 // process this token in the new state
469 return $this->yylex();
470 } elseif ($r === false) {
471 $this->counter += strlen($this->value);
472 $this->line += substr_count($this->value, "\n");
473 if ($this->counter >= $this->dataLength) {
474 return false; // end of input
480 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
492 $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
493 $this->yybegin(self::TAGBODY);
494 $this->taglineno = $this->line;
500 $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
501 $this->yybegin(self::TAGBODY);
502 $this->taglineno = $this->line;
508 $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
509 $this->yybegin(self::TAGBODY);
510 $this->taglineno = $this->line;
516 $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
517 $this->yybegin(self::TAGBODY);
518 $this->taglineno = $this->line;
524 $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
525 $this->yybegin(self::TAGBODY);
526 $this->taglineno = $this->line;
533 $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
534 $this->taglineno = $this->line;
541 $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
542 $this->taglineno = $this->line;
548 if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) {
550 $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
551 $this->taglineno = $this->line;
553 $this->value = $this->smarty->left_delimiter;
554 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
555 $this->yybegin(self::TAGBODY);
556 $this->taglineno = $this->line;
563 $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
564 $this->yybegin(self::TAGBODY);
565 $this->taglineno = $this->line;
571 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
572 $this->yybegin(self::TAGBODY);
573 $this->taglineno = $this->line;
576 public function yylex3()
578 if (!isset($this->yy_global_pattern3)) {
579 $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel .
580 "\\s*)|\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|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+(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([\S\s])/isS";
582 if (!isset($this->dataLength)) {
583 $this->dataLength = strlen($this->data);
585 if ($this->counter >= $this->dataLength) {
586 return false; // end of input
590 if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
591 if (!isset($yymatches[ 0 ][ 1 ])) {
592 $yymatches = preg_grep("/(.|\s)+/", $yymatches);
594 $yymatches = array_filter($yymatches);
596 if (empty($yymatches)) {
597 throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
598 substr($this->data, $this->counter, 5) . '... state TAGBODY');
600 next($yymatches); // skip global match
601 $this->token = key($yymatches); // token number
602 $this->value = current($yymatches); // token value
603 $r = $this->{'yy_r3_' . $this->token}();
605 $this->counter += strlen($this->value);
606 $this->line += substr_count($this->value, "\n");
609 } elseif ($r === true) {
610 // we have changed state
611 // process this token in the new state
612 return $this->yylex();
613 } elseif ($r === false) {
614 $this->counter += strlen($this->value);
615 $this->line += substr_count($this->value, "\n");
616 if ($this->counter >= $this->dataLength) {
617 return false; // end of input
623 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
635 $this->token = Smarty_Internal_Templateparser::TP_RDEL;
642 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
643 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
645 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
647 $this->yypushstate(self::TAG);
655 $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
656 $this->yypushstate(self::DOUBLEQUOTEDSTRING);
662 $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
668 $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
669 $this->taglineno = $this->line;
675 $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
681 $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
687 $this->token = Smarty_Internal_Templateparser::TP_ISIN;
693 $this->token = Smarty_Internal_Templateparser::TP_AS;
699 $this->token = Smarty_Internal_Templateparser::TP_TO;
705 $this->token = Smarty_Internal_Templateparser::TP_STEP;
711 $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
717 $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
723 $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
729 $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
735 $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
741 $this->token = Smarty_Internal_Templateparser::TP_NOT;
747 $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
753 $this->token = Smarty_Internal_Templateparser::TP_OPENP;
759 $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
765 $this->token = Smarty_Internal_Templateparser::TP_OPENB;
771 $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
777 $this->token = Smarty_Internal_Templateparser::TP_PTR;
783 $this->token = Smarty_Internal_Templateparser::TP_APTR;
789 $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
795 $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
801 $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
807 $this->token = Smarty_Internal_Templateparser::TP_MATH;
813 $this->token = Smarty_Internal_Templateparser::TP_AT;
819 $this->token = Smarty_Internal_Templateparser::TP_HATCH;
825 // resolve conflicts with shorttag and right_delimiter starting with '='
826 if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) ==
827 $this->smarty->right_delimiter
829 preg_match("/\s+/", $this->value, $match);
830 $this->value = $match[ 0 ];
831 $this->token = Smarty_Internal_Templateparser::TP_SPACE;
833 $this->token = Smarty_Internal_Templateparser::TP_ATTR;
840 $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
846 $this->token = Smarty_Internal_Templateparser::TP_ID;
852 $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
858 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
865 $this->token = Smarty_Internal_Templateparser::TP_VERT;
871 $this->token = Smarty_Internal_Templateparser::TP_DOT;
877 $this->token = Smarty_Internal_Templateparser::TP_COMMA;
883 $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
889 $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
895 $this->token = Smarty_Internal_Templateparser::TP_COLON;
901 $this->token = Smarty_Internal_Templateparser::TP_QMARK;
907 $this->token = Smarty_Internal_Templateparser::TP_HEX;
913 $this->token = Smarty_Internal_Templateparser::TP_SPACE;
919 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
922 public function yylex4()
924 if (!isset($this->yy_global_pattern4)) {
925 $this->yy_global_pattern4 =
926 "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" .
927 $this->rdel . ")|\G([\S\s])/isS";
929 if (!isset($this->dataLength)) {
930 $this->dataLength = strlen($this->data);
932 if ($this->counter >= $this->dataLength) {
933 return false; // end of input
937 if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
938 if (!isset($yymatches[ 0 ][ 1 ])) {
939 $yymatches = preg_grep("/(.|\s)+/", $yymatches);
941 $yymatches = array_filter($yymatches);
943 if (empty($yymatches)) {
944 throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
945 substr($this->data, $this->counter, 5) . '... state LITERAL');
947 next($yymatches); // skip global match
948 $this->token = key($yymatches); // token number
949 $this->value = current($yymatches); // token value
950 $r = $this->{'yy_r4_' . $this->token}();
952 $this->counter += strlen($this->value);
953 $this->line += substr_count($this->value, "\n");
956 } elseif ($r === true) {
957 // we have changed state
958 // process this token in the new state
959 return $this->yylex();
960 } elseif ($r === false) {
961 $this->counter += strlen($this->value);
962 $this->line += substr_count($this->value, "\n");
963 if ($this->counter >= $this->dataLength) {
964 return false; // end of input
970 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
982 $this->literal_cnt ++;
983 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
989 if ($this->literal_cnt) {
990 $this->literal_cnt --;
991 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
993 $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
1001 $to = $this->dataLength;
1002 preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE,
1004 if (isset($match[ 0 ][ 1 ])) {
1005 $to = $match[ 0 ][ 1 ];
1007 $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
1009 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1010 $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
1013 public function yylex5()
1015 if (!isset($this->yy_global_pattern5)) {
1016 $this->yy_global_pattern5 =
1017 "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" .
1018 $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" .
1020 "\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" .
1021 $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS";
1023 if (!isset($this->dataLength)) {
1024 $this->dataLength = strlen($this->data);
1026 if ($this->counter >= $this->dataLength) {
1027 return false; // end of input
1031 if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
1032 if (!isset($yymatches[ 0 ][ 1 ])) {
1033 $yymatches = preg_grep("/(.|\s)+/", $yymatches);
1035 $yymatches = array_filter($yymatches);
1037 if (empty($yymatches)) {
1038 throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
1039 substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
1041 next($yymatches); // skip global match
1042 $this->token = key($yymatches); // token number
1043 $this->value = current($yymatches); // token value
1044 $r = $this->{'yy_r5_' . $this->token}();
1046 $this->counter += strlen($this->value);
1047 $this->line += substr_count($this->value, "\n");
1048 // accept this token
1050 } elseif ($r === true) {
1051 // we have changed state
1052 // process this token in the new state
1053 return $this->yylex();
1054 } elseif ($r === false) {
1055 $this->counter += strlen($this->value);
1056 $this->line += substr_count($this->value, "\n");
1057 if ($this->counter >= $this->dataLength) {
1058 return false; // end of input
1064 throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
1071 const DOUBLEQUOTEDSTRING = 5;
1076 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1082 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1088 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
1089 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
1091 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1093 $this->yypushstate(self::TAG);
1101 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
1102 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
1104 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1106 $this->yypushstate(self::TAG);
1114 if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
1115 strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
1117 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1119 $this->token = Smarty_Internal_Templateparser::TP_LDEL;
1120 $this->taglineno = $this->line;
1121 $this->yypushstate(self::TAGBODY);
1128 $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
1129 $this->yypopstate();
1135 $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
1136 $this->value = substr($this->value, 0, - 1);
1137 $this->yypushstate(self::TAGBODY);
1138 $this->taglineno = $this->line;
1144 $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
1150 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1156 $this->token = Smarty_Internal_Templateparser::TP_TEXT;
1162 $to = $this->dataLength;
1163 $this->value = substr($this->data, $this->counter, $to - $this->counter);
1164 $this->token = Smarty_Internal_Templateparser::TP_TEXT;