3 * Smarty Internal Plugin Templatelexer
4 * This is the lexer to break the template source into tokens
12 * Smarty_Internal_Templatelexer
13 * This is the template file lexer.
14 * It is generated from the smarty_internal_templatelexer.plex file
17 * @subpackage Compiler
20 class Smarty_Internal_Templatelexer
59 * flag if parsing php script
63 public $is_phpScript = false;
71 * escaped left delimiter
77 * escaped left delimiter length
81 public $ldel_length = 0;
83 * escaped right delimiter
89 * escaped right delimiter length
93 public $rdel_length = 0;
105 public $smarty = null;
109 * @var Smarty_Internal_TemplateCompilerBase
111 private $compiler = null;
113 * literal tag nesting level
117 private $literal_cnt = 0;
129 public $yyTracePrompt;
135 public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY');
141 public $smarty_token_names = array( // Text for parser error messages
143 'NONEIDENTITY' => '!==',
146 'GREATEREQUAL' => '(>=,ge)',
147 'LESSEQUAL' => '(<=,le)',
148 'GREATERTHAN' => '(>,gt)',
149 'LESSTHAN' => '(<,lt)',
152 'LAND' => '(&&,and)',
162 'NUMBER' => 'number',
163 'UNIMATH' => '+" , "-',
164 'MATH' => '*" , "/" , "%',
165 'INCDEC' => '++" , "--',
170 'DOUBLECOLON' => '::',
180 'ID' => 'identifier',
182 'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
183 'PHPSTARTTAG' => 'PHP start tag',
184 'PHPENDTAG' => 'PHP end tag',
185 'LITERALSTART' => 'Literal start',
186 'LITERALEND' => 'Literal end',
187 'LDELSLASH' => 'closing tag',
188 'COMMENT' => 'comment',
196 * @param string $data template source
197 * @param Smarty_Internal_TemplateCompilerBase $compiler
199 function __construct($data, Smarty_Internal_TemplateCompilerBase
$compiler)
203 if (preg_match('/^\xEF\xBB\xBF/', $this->data
, $match)) {
204 $this->counter +
= strlen($match[0]);
207 $this->smarty
= $compiler->smarty
;
208 $this->compiler
= $compiler;
209 $this->ldel
= preg_quote($this->smarty
->left_delimiter
, '/');
210 $this->ldel_length
= strlen($this->smarty
->left_delimiter
);
211 $this->rdel
= preg_quote($this->smarty
->right_delimiter
, '/');
212 $this->rdel_length
= strlen($this->smarty
->right_delimiter
);
213 $this->smarty_token_names
['LDEL'] = $this->smarty
->left_delimiter
;
214 $this->smarty_token_names
['RDEL'] = $this->smarty
->right_delimiter
;
217 public function PrintTrace()
219 $this->yyTraceFILE
= fopen('php://output', 'w');
220 $this->yyTracePrompt
= '<br>';
223 private $_yy_state = 1;
224 private $_yy_stack = array();
226 public function yylex()
228 return $this->{'yylex' . $this->_yy_state
}();
231 public function yypushstate($state)
233 if ($this->yyTraceFILE
) {
234 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
);
236 array_push($this->_yy_stack
, $this->_yy_state
);
237 $this->_yy_state
= $state;
238 if ($this->yyTraceFILE
) {
239 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
);
243 public function yypopstate()
245 if ($this->yyTraceFILE
) {
246 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
);
248 $this->_yy_state
= array_pop($this->_yy_stack
);
249 if ($this->yyTraceFILE
) {
250 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
);
254 public function yybegin($state)
256 $this->_yy_state
= $state;
257 if ($this->yyTraceFILE
) {
258 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
);
262 public function yylex1()
285 if ($this->counter
>= strlen($this->data
)) {
286 return false; // end of input
288 $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*php\\s*(.)*?" . $this->rdel
. "((.)*?)" . $this->ldel
. "\\s*\/php\\s*" . $this->rdel
. ")|(" . $this->ldel
. "\\s*[\/]?php\\s*(.)*?" . $this->rdel
. "))|\G(" . $this->ldel
. "\\s*\/)|\G(" . $this->ldel
. "\\s*)|\G(\\s*" . $this->rdel
. ")|\G(<\\?xml\\s+([\S\s]*?)\\?>)|\G(<%((('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")|(\/\\*(.)*?\\*\/)|.)*?)%>)|\G((<\\?(?:php\\s+|=)?)((('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")|(\/\\*(.)*?\\*\/)|.)*?)\\?>)|\G(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>((('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")|(\/\\*(.)*?\\*\/)|.)*?)<\/script>)|\G((<(\\?(?:php\\s+|=)?|(script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|%))|\\?>|%>)|\G([\S\s])/iS";
291 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
292 $yysubmatches = $yymatches;
293 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
294 if (!count($yymatches)) {
295 throw new Exception('Error: lexing failed because a rule matched' .
296 ' an empty string. Input "' . substr($this->data
,
297 $this->counter
, 5) . '... state TEXT');
299 next($yymatches); // skip global match
300 $this->token
= key($yymatches); // token number
301 if ($tokenMap[$this->token
]) {
302 // extract sub-patterns for passing to lex function
303 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
304 $tokenMap[$this->token
]);
306 $yysubmatches = array();
308 $this->value
= current($yymatches); // token value
309 $r = $this->{'yy_r1_' . $this->token
}($yysubmatches);
311 $this->counter +
= strlen($this->value
);
312 $this->line +
= substr_count($this->value
, "\n");
315 } elseif ($r === true) {
316 // we have changed state
317 // process this token in the new state
318 return $this->yylex();
319 } elseif ($r === false) {
320 $this->counter +
= strlen($this->value
);
321 $this->line +
= substr_count($this->value
, "\n");
322 if ($this->counter
>= strlen($this->data
)) {
323 return false; // end of input
329 throw new Exception('Unexpected input at line' . $this->line
.
330 ': ' . $this->data
[$this->counter
]);
338 function yy_r1_1($yy_subpatterns)
341 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
344 function yy_r1_2($yy_subpatterns)
347 $this->token
= Smarty_Internal_Templateparser
::TP_COMMENT
;
350 function yy_r1_4($yy_subpatterns)
353 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
354 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
356 $this->token
= Smarty_Internal_Templateparser
::TP_STRIPON
;
360 function yy_r1_5($yy_subpatterns)
363 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
364 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
366 $this->token
= Smarty_Internal_Templateparser
::TP_STRIPOFF
;
370 function yy_r1_6($yy_subpatterns)
373 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
374 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
376 $this->token
= Smarty_Internal_Templateparser
::TP_LITERALSTART
;
377 $this->yypushstate(self
::LITERAL
);
381 function yy_r1_7($yy_subpatterns)
384 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
385 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
387 $this->token
= Smarty_Internal_Templateparser
::TP_LDELIF
;
388 $this->yypushstate(self
::SMARTY
);
389 $this->taglineno
= $this->line
;
393 function yy_r1_9($yy_subpatterns)
396 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
397 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
399 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOR
;
400 $this->yypushstate(self
::SMARTY
);
401 $this->taglineno
= $this->line
;
405 function yy_r1_10($yy_subpatterns)
408 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
409 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
411 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOREACH
;
412 $this->yypushstate(self
::SMARTY
);
413 $this->taglineno
= $this->line
;
417 function yy_r1_11($yy_subpatterns)
420 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
421 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
423 $this->token
= Smarty_Internal_Templateparser
::TP_LDELSETFILTER
;
424 $this->yypushstate(self
::SMARTY
);
425 $this->taglineno
= $this->line
;
429 function yy_r1_12($yy_subpatterns)
432 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
433 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
435 $this->token
= Smarty_Internal_Templateparser
::TP_PHP
;
436 $this->phpType
= 'tag';
437 $this->taglineno
= $this->line
;
441 function yy_r1_19($yy_subpatterns)
444 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
445 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
447 $this->token
= Smarty_Internal_Templateparser
::TP_LDELSLASH
;
448 $this->yypushstate(self
::SMARTY
);
449 $this->taglineno
= $this->line
;
453 function yy_r1_20($yy_subpatterns)
456 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
457 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
459 $this->token
= Smarty_Internal_Templateparser
::TP_LDEL
;
460 $this->yypushstate(self
::SMARTY
);
461 $this->taglineno
= $this->line
;
465 function yy_r1_21($yy_subpatterns)
468 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
471 function yy_r1_22($yy_subpatterns)
474 $this->token
= Smarty_Internal_Templateparser
::TP_XMLTAG
;
475 $this->taglineno
= $this->line
;
478 function yy_r1_24($yy_subpatterns)
481 $this->phpType
= 'asp';
482 $this->taglineno
= $this->line
;
483 $this->token
= Smarty_Internal_Templateparser
::TP_PHP
;
486 function yy_r1_31($yy_subpatterns)
489 $this->phpType
= 'php';
490 $this->taglineno
= $this->line
;
491 $this->token
= Smarty_Internal_Templateparser
::TP_PHP
;
494 function yy_r1_39($yy_subpatterns)
497 $this->phpType
= 'script';
498 $this->taglineno
= $this->line
;
499 $this->token
= Smarty_Internal_Templateparser
::TP_PHP
;
502 function yy_r1_46($yy_subpatterns)
505 $this->phpType
= 'unmatched';
506 $this->taglineno
= $this->line
;
507 $this->token
= Smarty_Internal_Templateparser
::TP_PHP
;
510 function yy_r1_50($yy_subpatterns)
513 $to = strlen($this->data
);
514 preg_match("/{$this->ldel}|<\?|<%|\?>|%>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>/", $this->data
, $match, PREG_OFFSET_CAPTURE
, $this->counter
);
515 if (isset($match[0][1])) {
518 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
519 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
522 public function yylex2()
593 if ($this->counter
>= strlen($this->data
)) {
594 return false; // end of input
596 $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*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\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";
599 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
600 $yysubmatches = $yymatches;
601 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
602 if (!count($yymatches)) {
603 throw new Exception('Error: lexing failed because a rule matched' .
604 ' an empty string. Input "' . substr($this->data
,
605 $this->counter
, 5) . '... state SMARTY');
607 next($yymatches); // skip global match
608 $this->token
= key($yymatches); // token number
609 if ($tokenMap[$this->token
]) {
610 // extract sub-patterns for passing to lex function
611 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
612 $tokenMap[$this->token
]);
614 $yysubmatches = array();
616 $this->value
= current($yymatches); // token value
617 $r = $this->{'yy_r2_' . $this->token
}($yysubmatches);
619 $this->counter +
= strlen($this->value
);
620 $this->line +
= substr_count($this->value
, "\n");
623 } elseif ($r === true) {
624 // we have changed state
625 // process this token in the new state
626 return $this->yylex();
627 } elseif ($r === false) {
628 $this->counter +
= strlen($this->value
);
629 $this->line +
= substr_count($this->value
, "\n");
630 if ($this->counter
>= strlen($this->data
)) {
631 return false; // end of input
637 throw new Exception('Unexpected input at line' . $this->line
.
638 ': ' . $this->data
[$this->counter
]);
646 function yy_r2_1($yy_subpatterns)
649 $this->token
= Smarty_Internal_Templateparser
::TP_QUOTE
;
650 $this->yypushstate(self
::DOUBLEQUOTEDSTRING
);
653 function yy_r2_2($yy_subpatterns)
656 $this->token
= Smarty_Internal_Templateparser
::TP_SINGLEQUOTESTRING
;
659 function yy_r2_3($yy_subpatterns)
662 $this->token
= Smarty_Internal_Templateparser
::TP_SMARTYBLOCKCHILDPARENT
;
663 $this->taglineno
= $this->line
;
666 function yy_r2_5($yy_subpatterns)
669 $this->token
= Smarty_Internal_Templateparser
::TP_DOLLAR
;
672 function yy_r2_6($yy_subpatterns)
675 $this->token
= Smarty_Internal_Templateparser
::TP_RDEL
;
679 function yy_r2_7($yy_subpatterns)
682 $this->token
= Smarty_Internal_Templateparser
::TP_ISIN
;
685 function yy_r2_8($yy_subpatterns)
688 $this->token
= Smarty_Internal_Templateparser
::TP_AS
;
691 function yy_r2_9($yy_subpatterns)
694 $this->token
= Smarty_Internal_Templateparser
::TP_TO
;
697 function yy_r2_10($yy_subpatterns)
700 $this->token
= Smarty_Internal_Templateparser
::TP_STEP
;
703 function yy_r2_11($yy_subpatterns)
706 $this->token
= Smarty_Internal_Templateparser
::TP_INSTANCEOF
;
709 function yy_r2_12($yy_subpatterns)
712 $this->token
= Smarty_Internal_Templateparser
::TP_IDENTITY
;
715 function yy_r2_13($yy_subpatterns)
718 $this->token
= Smarty_Internal_Templateparser
::TP_NONEIDENTITY
;
721 function yy_r2_14($yy_subpatterns)
724 $this->token
= Smarty_Internal_Templateparser
::TP_EQUALS
;
727 function yy_r2_15($yy_subpatterns)
730 $this->token
= Smarty_Internal_Templateparser
::TP_NOTEQUALS
;
733 function yy_r2_17($yy_subpatterns)
736 $this->token
= Smarty_Internal_Templateparser
::TP_GREATEREQUAL
;
739 function yy_r2_19($yy_subpatterns)
742 $this->token
= Smarty_Internal_Templateparser
::TP_LESSEQUAL
;
745 function yy_r2_21($yy_subpatterns)
748 $this->token
= Smarty_Internal_Templateparser
::TP_GREATERTHAN
;
751 function yy_r2_22($yy_subpatterns)
754 $this->token
= Smarty_Internal_Templateparser
::TP_LESSTHAN
;
757 function yy_r2_23($yy_subpatterns)
760 $this->token
= Smarty_Internal_Templateparser
::TP_MOD
;
763 function yy_r2_24($yy_subpatterns)
766 $this->token
= Smarty_Internal_Templateparser
::TP_NOT
;
769 function yy_r2_25($yy_subpatterns)
772 $this->token
= Smarty_Internal_Templateparser
::TP_LAND
;
775 function yy_r2_26($yy_subpatterns)
778 $this->token
= Smarty_Internal_Templateparser
::TP_LOR
;
781 function yy_r2_27($yy_subpatterns)
784 $this->token
= Smarty_Internal_Templateparser
::TP_LXOR
;
787 function yy_r2_28($yy_subpatterns)
790 $this->token
= Smarty_Internal_Templateparser
::TP_ISODDBY
;
793 function yy_r2_29($yy_subpatterns)
796 $this->token
= Smarty_Internal_Templateparser
::TP_ISNOTODDBY
;
799 function yy_r2_30($yy_subpatterns)
802 $this->token
= Smarty_Internal_Templateparser
::TP_ISODD
;
805 function yy_r2_31($yy_subpatterns)
808 $this->token
= Smarty_Internal_Templateparser
::TP_ISNOTODD
;
811 function yy_r2_32($yy_subpatterns)
814 $this->token
= Smarty_Internal_Templateparser
::TP_ISEVENBY
;
817 function yy_r2_33($yy_subpatterns)
820 $this->token
= Smarty_Internal_Templateparser
::TP_ISNOTEVENBY
;
823 function yy_r2_34($yy_subpatterns)
826 $this->token
= Smarty_Internal_Templateparser
::TP_ISEVEN
;
829 function yy_r2_35($yy_subpatterns)
832 $this->token
= Smarty_Internal_Templateparser
::TP_ISNOTEVEN
;
835 function yy_r2_36($yy_subpatterns)
838 $this->token
= Smarty_Internal_Templateparser
::TP_ISDIVBY
;
841 function yy_r2_37($yy_subpatterns)
844 $this->token
= Smarty_Internal_Templateparser
::TP_ISNOTDIVBY
;
847 function yy_r2_38($yy_subpatterns)
850 $this->token
= Smarty_Internal_Templateparser
::TP_TYPECAST
;
853 function yy_r2_42($yy_subpatterns)
856 $this->token
= Smarty_Internal_Templateparser
::TP_OPENP
;
859 function yy_r2_43($yy_subpatterns)
862 $this->token
= Smarty_Internal_Templateparser
::TP_CLOSEP
;
865 function yy_r2_44($yy_subpatterns)
868 $this->token
= Smarty_Internal_Templateparser
::TP_OPENB
;
871 function yy_r2_45($yy_subpatterns)
874 $this->token
= Smarty_Internal_Templateparser
::TP_CLOSEB
;
877 function yy_r2_46($yy_subpatterns)
880 $this->token
= Smarty_Internal_Templateparser
::TP_PTR
;
883 function yy_r2_47($yy_subpatterns)
886 $this->token
= Smarty_Internal_Templateparser
::TP_APTR
;
889 function yy_r2_48($yy_subpatterns)
892 $this->token
= Smarty_Internal_Templateparser
::TP_EQUAL
;
895 function yy_r2_49($yy_subpatterns)
898 $this->token
= Smarty_Internal_Templateparser
::TP_INCDEC
;
901 function yy_r2_50($yy_subpatterns)
904 $this->token
= Smarty_Internal_Templateparser
::TP_UNIMATH
;
907 function yy_r2_52($yy_subpatterns)
910 $this->token
= Smarty_Internal_Templateparser
::TP_MATH
;
913 function yy_r2_54($yy_subpatterns)
916 $this->token
= Smarty_Internal_Templateparser
::TP_AT
;
919 function yy_r2_55($yy_subpatterns)
922 $this->token
= Smarty_Internal_Templateparser
::TP_HATCH
;
925 function yy_r2_56($yy_subpatterns)
928 // resolve conflicts with shorttag and right_delimiter starting with '='
929 if (substr($this->data
, $this->counter +
strlen($this->value
) - 1, $this->rdel_length
) == $this->smarty
->right_delimiter
) {
930 preg_match("/\s+/", $this->value
, $match);
931 $this->value
= $match[0];
932 $this->token
= Smarty_Internal_Templateparser
::TP_SPACE
;
934 $this->token
= Smarty_Internal_Templateparser
::TP_ATTR
;
938 function yy_r2_57($yy_subpatterns)
941 $this->token
= Smarty_Internal_Templateparser
::TP_NAMESPACE
;
944 function yy_r2_60($yy_subpatterns)
947 $this->token
= Smarty_Internal_Templateparser
::TP_ID
;
950 function yy_r2_61($yy_subpatterns)
953 $this->token
= Smarty_Internal_Templateparser
::TP_INTEGER
;
956 function yy_r2_62($yy_subpatterns)
959 $this->token
= Smarty_Internal_Templateparser
::TP_BACKTICK
;
963 function yy_r2_63($yy_subpatterns)
966 $this->token
= Smarty_Internal_Templateparser
::TP_VERT
;
969 function yy_r2_64($yy_subpatterns)
972 $this->token
= Smarty_Internal_Templateparser
::TP_DOT
;
975 function yy_r2_65($yy_subpatterns)
978 $this->token
= Smarty_Internal_Templateparser
::TP_COMMA
;
981 function yy_r2_66($yy_subpatterns)
984 $this->token
= Smarty_Internal_Templateparser
::TP_SEMICOLON
;
987 function yy_r2_67($yy_subpatterns)
990 $this->token
= Smarty_Internal_Templateparser
::TP_DOUBLECOLON
;
993 function yy_r2_68($yy_subpatterns)
996 $this->token
= Smarty_Internal_Templateparser
::TP_COLON
;
999 function yy_r2_69($yy_subpatterns)
1002 $this->token
= Smarty_Internal_Templateparser
::TP_ANDSYM
;
1005 function yy_r2_70($yy_subpatterns)
1008 $this->token
= Smarty_Internal_Templateparser
::TP_QMARK
;
1011 function yy_r2_71($yy_subpatterns)
1014 $this->token
= Smarty_Internal_Templateparser
::TP_HEX
;
1017 function yy_r2_72($yy_subpatterns)
1020 $this->token
= Smarty_Internal_Templateparser
::TP_SPACE
;
1023 function yy_r2_73($yy_subpatterns)
1026 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1027 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1029 $this->token
= Smarty_Internal_Templateparser
::TP_LDELIF
;
1030 $this->yypushstate(self
::SMARTY
);
1031 $this->taglineno
= $this->line
;
1035 function yy_r2_75($yy_subpatterns)
1038 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1039 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1041 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOR
;
1042 $this->yypushstate(self
::SMARTY
);
1043 $this->taglineno
= $this->line
;
1047 function yy_r2_76($yy_subpatterns)
1050 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1051 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1053 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOREACH
;
1054 $this->yypushstate(self
::SMARTY
);
1055 $this->taglineno
= $this->line
;
1059 function yy_r2_77($yy_subpatterns)
1062 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1063 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1065 $this->token
= Smarty_Internal_Templateparser
::TP_LDELSLASH
;
1066 $this->yypushstate(self
::SMARTY
);
1067 $this->taglineno
= $this->line
;
1071 function yy_r2_78($yy_subpatterns)
1074 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1075 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1077 $this->token
= Smarty_Internal_Templateparser
::TP_LDEL
;
1078 $this->yypushstate(self
::SMARTY
);
1079 $this->taglineno
= $this->line
;
1083 function yy_r2_79($yy_subpatterns)
1086 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1089 public function yylex3()
1096 if ($this->counter
>= strlen($this->data
)) {
1097 return false; // end of input
1099 $yy_global_pattern = "/\G(" . $this->ldel
. "\\s*literal\\s*" . $this->rdel
. ")|\G(" . $this->ldel
. "\\s*\/literal\\s*" . $this->rdel
. ")|\G([\S\s])/iS";
1102 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
1103 $yysubmatches = $yymatches;
1104 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
1105 if (!count($yymatches)) {
1106 throw new Exception('Error: lexing failed because a rule matched' .
1107 ' an empty string. Input "' . substr($this->data
,
1108 $this->counter
, 5) . '... state LITERAL');
1110 next($yymatches); // skip global match
1111 $this->token
= key($yymatches); // token number
1112 if ($tokenMap[$this->token
]) {
1113 // extract sub-patterns for passing to lex function
1114 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
1115 $tokenMap[$this->token
]);
1117 $yysubmatches = array();
1119 $this->value
= current($yymatches); // token value
1120 $r = $this->{'yy_r3_' . $this->token
}($yysubmatches);
1122 $this->counter +
= strlen($this->value
);
1123 $this->line +
= substr_count($this->value
, "\n");
1124 // accept this token
1126 } elseif ($r === true) {
1127 // we have changed state
1128 // process this token in the new state
1129 return $this->yylex();
1130 } elseif ($r === false) {
1131 $this->counter +
= strlen($this->value
);
1132 $this->line +
= substr_count($this->value
, "\n");
1133 if ($this->counter
>= strlen($this->data
)) {
1134 return false; // end of input
1140 throw new Exception('Unexpected input at line' . $this->line
.
1141 ': ' . $this->data
[$this->counter
]);
1149 function yy_r3_1($yy_subpatterns)
1152 $this->literal_cnt ++
;
1153 $this->token
= Smarty_Internal_Templateparser
::TP_LITERAL
;
1156 function yy_r3_2($yy_subpatterns)
1159 if ($this->literal_cnt
) {
1160 $this->literal_cnt
--;
1161 $this->token
= Smarty_Internal_Templateparser
::TP_LITERAL
;
1163 $this->token
= Smarty_Internal_Templateparser
::TP_LITERALEND
;
1164 $this->yypopstate();
1168 function yy_r3_3($yy_subpatterns)
1171 $to = strlen($this->data
);
1172 preg_match("/{$this->ldel}\/?literal{$this->rdel}/", $this->data
, $match, PREG_OFFSET_CAPTURE
, $this->counter
);
1173 if (isset($match[0][1])) {
1176 $this->compiler
->trigger_template_error("missing or misspelled literal closing tag");
1178 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
1179 $this->token
= Smarty_Internal_Templateparser
::TP_LITERAL
;
1182 public function yylex4()
1199 if ($this->counter
>= strlen($this->data
)) {
1200 return false; // end of input
1202 $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";
1205 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
1206 $yysubmatches = $yymatches;
1207 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
1208 if (!count($yymatches)) {
1209 throw new Exception('Error: lexing failed because a rule matched' .
1210 ' an empty string. Input "' . substr($this->data
,
1211 $this->counter
, 5) . '... state DOUBLEQUOTEDSTRING');
1213 next($yymatches); // skip global match
1214 $this->token
= key($yymatches); // token number
1215 if ($tokenMap[$this->token
]) {
1216 // extract sub-patterns for passing to lex function
1217 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
1218 $tokenMap[$this->token
]);
1220 $yysubmatches = array();
1222 $this->value
= current($yymatches); // token value
1223 $r = $this->{'yy_r4_' . $this->token
}($yysubmatches);
1225 $this->counter +
= strlen($this->value
);
1226 $this->line +
= substr_count($this->value
, "\n");
1227 // accept this token
1229 } elseif ($r === true) {
1230 // we have changed state
1231 // process this token in the new state
1232 return $this->yylex();
1233 } elseif ($r === false) {
1234 $this->counter +
= strlen($this->value
);
1235 $this->line +
= substr_count($this->value
, "\n");
1236 if ($this->counter
>= strlen($this->data
)) {
1237 return false; // end of input
1243 throw new Exception('Unexpected input at line' . $this->line
.
1244 ': ' . $this->data
[$this->counter
]);
1250 const DOUBLEQUOTEDSTRING
= 4;
1252 function yy_r4_1($yy_subpatterns)
1255 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1256 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1258 $this->token
= Smarty_Internal_Templateparser
::TP_LDELIF
;
1259 $this->yypushstate(self
::SMARTY
);
1260 $this->taglineno
= $this->line
;
1264 function yy_r4_3($yy_subpatterns)
1267 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1268 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1270 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOR
;
1271 $this->yypushstate(self
::SMARTY
);
1272 $this->taglineno
= $this->line
;
1276 function yy_r4_4($yy_subpatterns)
1279 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1280 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1282 $this->token
= Smarty_Internal_Templateparser
::TP_LDELFOREACH
;
1283 $this->yypushstate(self
::SMARTY
);
1284 $this->taglineno
= $this->line
;
1288 function yy_r4_5($yy_subpatterns)
1291 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1294 function yy_r4_6($yy_subpatterns)
1297 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1300 function yy_r4_7($yy_subpatterns)
1303 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1304 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1306 $this->token
= Smarty_Internal_Templateparser
::TP_LDELSLASH
;
1307 $this->yypushstate(self
::SMARTY
);
1308 $this->taglineno
= $this->line
;
1312 function yy_r4_8($yy_subpatterns)
1315 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1316 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1318 $this->token
= Smarty_Internal_Templateparser
::TP_LDEL
;
1319 $this->yypushstate(self
::SMARTY
);
1320 $this->taglineno
= $this->line
;
1324 function yy_r4_9($yy_subpatterns)
1327 $this->token
= Smarty_Internal_Templateparser
::TP_QUOTE
;
1328 $this->yypopstate();
1331 function yy_r4_10($yy_subpatterns)
1334 $this->token
= Smarty_Internal_Templateparser
::TP_BACKTICK
;
1335 $this->value
= substr($this->value
, 0, - 1);
1336 $this->yypushstate(self
::SMARTY
);
1337 $this->taglineno
= $this->line
;
1340 function yy_r4_11($yy_subpatterns)
1343 $this->token
= Smarty_Internal_Templateparser
::TP_DOLLARID
;
1346 function yy_r4_12($yy_subpatterns)
1349 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1352 function yy_r4_13($yy_subpatterns)
1355 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1358 function yy_r4_17($yy_subpatterns)
1361 $to = strlen($this->data
);
1362 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
1363 $this->token
= Smarty_Internal_Templateparser
::TP_TEXT
;
1366 public function yylex5()
1374 if ($this->counter
>= strlen($this->data
)) {
1375 return false; // end of input
1377 $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";
1380 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
1381 $yysubmatches = $yymatches;
1382 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
1383 if (!count($yymatches)) {
1384 throw new Exception('Error: lexing failed because a rule matched' .
1385 ' an empty string. Input "' . substr($this->data
,
1386 $this->counter
, 5) . '... state CHILDBODY');
1388 next($yymatches); // skip global match
1389 $this->token
= key($yymatches); // token number
1390 if ($tokenMap[$this->token
]) {
1391 // extract sub-patterns for passing to lex function
1392 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
1393 $tokenMap[$this->token
]);
1395 $yysubmatches = array();
1397 $this->value
= current($yymatches); // token value
1398 $r = $this->{'yy_r5_' . $this->token
}($yysubmatches);
1400 $this->counter +
= strlen($this->value
);
1401 $this->line +
= substr_count($this->value
, "\n");
1402 // accept this token
1404 } elseif ($r === true) {
1405 // we have changed state
1406 // process this token in the new state
1407 return $this->yylex();
1408 } elseif ($r === false) {
1409 $this->counter +
= strlen($this->value
);
1410 $this->line +
= substr_count($this->value
, "\n");
1411 if ($this->counter
>= strlen($this->data
)) {
1412 return false; // end of input
1418 throw new Exception('Unexpected input at line' . $this->line
.
1419 ': ' . $this->data
[$this->counter
]);
1425 const CHILDBODY
= 5;
1427 function yy_r5_1($yy_subpatterns)
1430 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1433 $this->token
= Smarty_Internal_Templateparser
::TP_STRIPON
;
1437 function yy_r5_2($yy_subpatterns)
1440 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1443 $this->token
= Smarty_Internal_Templateparser
::TP_STRIPOFF
;
1447 function yy_r5_3($yy_subpatterns)
1450 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1453 $this->yypopstate();
1458 function yy_r5_4($yy_subpatterns)
1461 $to = strlen($this->data
);
1462 preg_match("/" . $this->ldel
. "\s*((\/)?strip\s*" . $this->rdel
. "|block\s+)/", $this->data
, $match, PREG_OFFSET_CAPTURE
, $this->counter
);
1463 if (isset($match[0][1])) {
1466 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
1470 public function yylex6()
1479 if ($this->counter
>= strlen($this->data
)) {
1480 return false; // end of input
1482 $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";
1485 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
1486 $yysubmatches = $yymatches;
1487 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
1488 if (!count($yymatches)) {
1489 throw new Exception('Error: lexing failed because a rule matched' .
1490 ' an empty string. Input "' . substr($this->data
,
1491 $this->counter
, 5) . '... state CHILDBLOCK');
1493 next($yymatches); // skip global match
1494 $this->token
= key($yymatches); // token number
1495 if ($tokenMap[$this->token
]) {
1496 // extract sub-patterns for passing to lex function
1497 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
1498 $tokenMap[$this->token
]);
1500 $yysubmatches = array();
1502 $this->value
= current($yymatches); // token value
1503 $r = $this->{'yy_r6_' . $this->token
}($yysubmatches);
1505 $this->counter +
= strlen($this->value
);
1506 $this->line +
= substr_count($this->value
, "\n");
1507 // accept this token
1509 } elseif ($r === true) {
1510 // we have changed state
1511 // process this token in the new state
1512 return $this->yylex();
1513 } elseif ($r === false) {
1514 $this->counter +
= strlen($this->value
);
1515 $this->line +
= substr_count($this->value
, "\n");
1516 if ($this->counter
>= strlen($this->data
)) {
1517 return false; // end of input
1523 throw new Exception('Unexpected input at line' . $this->line
.
1524 ': ' . $this->data
[$this->counter
]);
1530 const CHILDBLOCK
= 6;
1532 function yy_r6_1($yy_subpatterns)
1535 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1536 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1538 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1539 $this->yypushstate(self
::CHILDLITERAL
);
1543 function yy_r6_2($yy_subpatterns)
1546 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1547 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1549 $this->yypopstate();
1554 function yy_r6_3($yy_subpatterns)
1557 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1558 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1560 $this->yypopstate();
1565 function yy_r6_4($yy_subpatterns)
1568 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1569 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1571 $this->yypopstate();
1576 function yy_r6_6($yy_subpatterns)
1579 $to = strlen($this->data
);
1580 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
);
1581 if (isset($match[0][1])) {
1584 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
1585 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1588 public function yylex7()
1595 if ($this->counter
>= strlen($this->data
)) {
1596 return false; // end of input
1598 $yy_global_pattern = "/\G(" . $this->ldel
. "\\s*literal\\s*" . $this->rdel
. ")|\G(" . $this->ldel
. "\\s*\/literal\\s*" . $this->rdel
. ")|\G([\S\s])/iS";
1601 if (preg_match($yy_global_pattern, $this->data
, $yymatches, null, $this->counter
)) {
1602 $yysubmatches = $yymatches;
1603 $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
1604 if (!count($yymatches)) {
1605 throw new Exception('Error: lexing failed because a rule matched' .
1606 ' an empty string. Input "' . substr($this->data
,
1607 $this->counter
, 5) . '... state CHILDLITERAL');
1609 next($yymatches); // skip global match
1610 $this->token
= key($yymatches); // token number
1611 if ($tokenMap[$this->token
]) {
1612 // extract sub-patterns for passing to lex function
1613 $yysubmatches = array_slice($yysubmatches, $this->token +
1,
1614 $tokenMap[$this->token
]);
1616 $yysubmatches = array();
1618 $this->value
= current($yymatches); // token value
1619 $r = $this->{'yy_r7_' . $this->token
}($yysubmatches);
1621 $this->counter +
= strlen($this->value
);
1622 $this->line +
= substr_count($this->value
, "\n");
1623 // accept this token
1625 } elseif ($r === true) {
1626 // we have changed state
1627 // process this token in the new state
1628 return $this->yylex();
1629 } elseif ($r === false) {
1630 $this->counter +
= strlen($this->value
);
1631 $this->line +
= substr_count($this->value
, "\n");
1632 if ($this->counter
>= strlen($this->data
)) {
1633 return false; // end of input
1639 throw new Exception('Unexpected input at line' . $this->line
.
1640 ': ' . $this->data
[$this->counter
]);
1646 const CHILDLITERAL
= 7;
1648 function yy_r7_1($yy_subpatterns)
1651 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1652 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1654 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1655 $this->yypushstate(self
::CHILDLITERAL
);
1659 function yy_r7_2($yy_subpatterns)
1662 if ($this->smarty
->auto_literal
&& isset($this->value
[$this->ldel_length
]) ?
strpos(" \n\t\r", $this->value
[$this->ldel_length
]) !== false : false) {
1663 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1665 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;
1666 $this->yypopstate();
1670 function yy_r7_3($yy_subpatterns)
1673 $to = strlen($this->data
);
1674 preg_match("/{$this->ldel}\/?literal\s*{$this->rdel}/", $this->data
, $match, PREG_OFFSET_CAPTURE
, $this->counter
);
1675 if (isset($match[0][1])) {
1678 $this->compiler
->trigger_template_error("missing or misspelled literal closing tag");
1680 $this->value
= substr($this->data
, $this->counter
, $to - $this->counter
);
1681 $this->token
= Smarty_Internal_Templateparser
::TP_BLOCKSOURCE
;