2009-03-22 16:09:05 +00:00
< ? php
2014-06-08 16:00:56 +00:00
/**
* Smarty Internal Plugin Templatelexer
* This is the lexer to break the template source into tokens
*
* @ package Smarty
* @ subpackage Compiler
* @ author Uwe Tews
*/
/**
2014-12-13 23:02:29 +01:00
* Smarty_Internal_Templatelexer
* This is the template file lexer .
* It is generated from the smarty_internal_templatelexer . plex file
*
* @ package Smarty
* @ subpackage Compiler
* @ author Uwe Tews
2014-06-08 16:00:56 +00:00
*/
class Smarty_Internal_Templatelexer
{
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* Source
*
* @ var string
*/
2014-06-08 16:00:56 +00:00
public $data ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* byte counter
*
* @ var int
*/
2014-06-08 16:00:56 +00:00
public $counter ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* token number
*
* @ var int
*/
2014-06-08 16:00:56 +00:00
public $token ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* token value
*
* @ var string
*/
2014-06-08 16:00:56 +00:00
public $value ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* current line
*
* @ var int
*/
2014-06-08 16:00:56 +00:00
public $line ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* tag start line
*
* @ var
*/
2014-06-08 16:00:56 +00:00
public $taglineno ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* flag if parsing php script
*
* @ var bool
*/
2014-10-07 22:07:15 +00:00
public $is_phpScript = false ;
2015-05-13 02:06:33 +02:00
2015-05-06 00:03:26 +02:00
/**
* php code type
*
* @ var string
*/
public $phpType = '' ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* escaped left delimiter
*
* @ var string
*/
public $ldel = '' ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* escaped left delimiter length
*
* @ var int
*/
public $ldel_length = 0 ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* escaped right delimiter
*
* @ var string
*/
public $rdel = '' ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* escaped right delimiter length
*
* @ var int
*/
public $rdel_length = 0 ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* state number
*
* @ var int
*/
2014-06-08 16:00:56 +00:00
public $state = 1 ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* Smarty object
*
* @ var Smarty
*/
public $smarty = null ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* compiler object
*
* @ var Smarty_Internal_TemplateCompilerBase
*/
private $compiler = null ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* literal tag nesting level
*
* @ var int
*/
private $literal_cnt = 0 ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* trace file
*
* @ var resource
*/
2014-06-08 16:00:56 +00:00
public $yyTraceFILE ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* trace prompt
*
* @ var string
*/
2014-06-08 16:00:56 +00:00
public $yyTracePrompt ;
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* state names
*
* @ var array
*/
2014-06-08 16:00:56 +00:00
public $state_name = array ( 1 => 'TEXT' , 2 => 'SMARTY' , 3 => 'LITERAL' , 4 => 'DOUBLEQUOTEDSTRING' , 5 => 'CHILDBODY' );
2015-05-13 02:06:33 +02:00
2014-12-13 23:02:29 +01:00
/**
* token names
*
* @ var array
*/
2014-10-07 22:07:15 +00:00
public $smarty_token_names = array ( // Text for parser error messages
2015-05-13 02:06:33 +02:00
'IDENTITY' => '===' , 'NONEIDENTITY' => '!==' , 'EQUALS' => '==' , 'NOTEQUALS' => '!=' , 'GREATEREQUAL' => '(>=,ge)' , 'LESSEQUAL' => '(<=,le)' , 'GREATERTHAN' => '(>,gt)' , 'LESSTHAN' => '(<,lt)' , 'MOD' => '(%,mod)' , 'NOT' => '(!,not)' , 'LAND' => '(&&,and)' , 'LOR' => '(||,or)' , 'LXOR' => 'xor' , 'OPENP' => '(' , 'CLOSEP' => ')' , 'OPENB' => '[' , 'CLOSEB' => ']' , 'PTR' => '->' , 'APTR' => '=>' , 'EQUAL' => '=' , 'NUMBER' => 'number' , 'UNIMATH' => '+" , "-' , 'MATH' => '*" , "/" , "%' , 'INCDEC' => '++" , "--' , 'SPACE' => ' ' , 'DOLLAR' => '$' , 'SEMICOLON' => ';' , 'COLON' => ':' , 'DOUBLECOLON' => '::' , 'AT' => '@' , 'HATCH' => '#' , 'QUOTE' => '"' , 'BACKTICK' => '`' , 'VERT' => '|' , 'DOT' => '.' , 'COMMA' => '","' , 'ANDSYM' => '"&"' , 'QMARK' => '"?"' , 'ID' => 'identifier' , 'TEXT' => 'text' , 'FAKEPHPSTARTTAG' => 'Fake PHP start tag' , 'PHPSTARTTAG' => 'PHP start tag' , 'PHPENDTAG' => 'PHP end tag' , 'LITERALSTART' => 'Literal start' , 'LITERALEND' => 'Literal end' , 'LDELSLASH' => 'closing tag' , 'COMMENT' => 'comment' , 'AS' => 'as' , 'TO' => 'to' ,);
2014-06-08 16:00:56 +00:00
2014-12-13 23:02:29 +01:00
/**
* constructor
*
* @ param string $data template source
* @ param Smarty_Internal_TemplateCompilerBase $compiler
*/
function __construct ( $data , Smarty_Internal_TemplateCompilerBase $compiler )
2014-06-08 16:00:56 +00:00
{
$this -> data = $data ;
$this -> counter = 0 ;
2014-07-16 21:40:57 +00:00
if ( preg_match ( '/^\xEF\xBB\xBF/' , $this -> data , $match )) {
2014-07-16 18:21:25 +00:00
$this -> counter += strlen ( $match [ 0 ]);
}
2014-06-08 16:00:56 +00:00
$this -> line = 1 ;
$this -> smarty = $compiler -> smarty ;
$this -> compiler = $compiler ;
$this -> ldel = preg_quote ( $this -> smarty -> left_delimiter , '/' );
$this -> ldel_length = strlen ( $this -> smarty -> left_delimiter );
$this -> rdel = preg_quote ( $this -> smarty -> right_delimiter , '/' );
$this -> rdel_length = strlen ( $this -> smarty -> right_delimiter );
$this -> smarty_token_names [ 'LDEL' ] = $this -> smarty -> left_delimiter ;
$this -> smarty_token_names [ 'RDEL' ] = $this -> smarty -> right_delimiter ;
}
public function PrintTrace ()
{
$this -> yyTraceFILE = fopen ( 'php://output' , 'w' );
$this -> yyTracePrompt = '<br>' ;
}
2009-03-22 16:09:05 +00:00
private $_yy_state = 1 ;
2015-05-13 02:06:33 +02:00
2009-03-22 16:09:05 +00:00
private $_yy_stack = array ();
2013-07-14 21:12:08 +00:00
public function yylex ()
2009-03-22 16:09:05 +00:00
{
return $this -> { 'yylex' . $this -> _yy_state }();
}
2013-07-14 21:12:08 +00:00
public function yypushstate ( $state )
2009-03-22 16:09:05 +00:00
{
2013-12-15 15:25:50 +00:00
if ( $this -> yyTraceFILE ) {
2014-06-08 16:00:56 +00:00
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 );
2013-12-15 15:25:50 +00:00
}
2009-03-22 16:09:05 +00:00
array_push ( $this -> _yy_stack , $this -> _yy_state );
$this -> _yy_state = $state ;
2013-12-15 15:25:50 +00:00
if ( $this -> yyTraceFILE ) {
2014-06-08 16:00:56 +00:00
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 );
2013-12-15 15:25:50 +00:00
}
2009-03-22 16:09:05 +00:00
}
2013-07-14 21:12:08 +00:00
public function yypopstate ()
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> yyTraceFILE ) {
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 );
2013-12-15 15:25:50 +00:00
}
2014-06-08 16:00:56 +00:00
$this -> _yy_state = array_pop ( $this -> _yy_stack );
2013-12-15 15:25:50 +00:00
if ( $this -> yyTraceFILE ) {
2014-06-08 16:00:56 +00:00
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 );
2013-12-15 15:25:50 +00:00
}
2009-03-22 16:09:05 +00:00
}
2013-07-14 21:12:08 +00:00
public function yybegin ( $state )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> _yy_state = $state ;
2013-12-15 15:25:50 +00:00
if ( $this -> yyTraceFILE ) {
2014-06-08 16:00:56 +00:00
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 );
2013-12-15 15:25:50 +00:00
}
2009-03-22 16:09:05 +00:00
}
2013-07-14 21:12:08 +00:00
public function yylex1 ()
2009-03-22 16:09:05 +00:00
{
2015-05-16 13:33:04 +02:00
$tokenMap = array ( 1 => 0 , 2 => 1 , 4 => 0 , 5 => 0 , 6 => 0 , 7 => 1 , 9 => 0 , 10 => 0 , 11 => 0 , 12 => 5 , 18 => 0 , 19 => 0 , 20 => 0 , 21 => 1 , 23 => 5 , 29 => 6 , 36 => 5 , 42 => 3 , 46 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-10-31 00:44:58 +00:00
return false ; // end of input
}
2015-05-16 13:33:04 +02:00
$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 . " ([ \ S \ s]*?) " . $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(<%((('[^' \\ \\ ]*(?: \\ \\ .[^' \\ \\ ]*)*')|( \" [^ \" \\ \\ ]*(?: \\ \\ .[^ \" \\ \\ ]*)* \" )|( \ / \\ *[ \ S \ s]*? \\ * \ /)|[ \ S \ s])*?)%>)| \ G((< \\ ?(?:php \\ s+|=)?)((('[^' \\ \\ ]*(?: \\ \\ .[^' \\ \\ ]*)*')|( \" [^ \" \\ \\ ]*(?: \\ \\ .[^ \" \\ \\ ]*)* \" )|( \ / \\ *[ \ S \ s]*? \\ * \ /)|[ \ S \ s])*?) \\ ?>)| \ G(<script \\ s+language \\ s*= \\ s*[ \" ']? \\ s*php \\ s*[ \" ']? \\ s*>((('[^' \\ \\ ]*(?: \\ \\ .[^' \\ \\ ]*)*')|( \" [^ \" \\ \\ ]*(?: \\ \\ .[^ \" \\ \\ ]*)* \" )|( \ / \\ *[ \ S \ s]*? \\ * \ /)|[ \ S \ s])*?)< \ /script>)| \ G((<( \\ ?(?:php \\ s+|=)?|(script \\ s+language \\ s*= \\ s*[ \" ']? \\ s*php \\ s*[ \" ']? \\ s*>)|%))| \\ ?>|%>)| \ G([ \ S \ s])/iS " ;
2009-10-31 00:44:58 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2009-10-31 00:44:58 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state TEXT' );
2009-10-31 00:44:58 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2009-10-31 00:44:58 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
$r = $this -> { 'yy_r1_' . $this -> token }( $yysubmatches );
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-10-31 00:44:58 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-10-31 00:44:58 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-10-31 00:44:58 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2009-10-31 00:44:58 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const TEXT = 1 ;
2014-06-08 16:00:56 +00:00
2013-08-12 21:09:29 +00:00
function yy_r1_1 ( $yy_subpatterns )
2009-10-31 00:44:58 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2013-08-24 18:46:31 +00:00
function yy_r1_2 ( $yy_subpatterns )
2010-11-11 21:34:36 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_COMMENT ;
}
2013-08-24 18:46:31 +00:00
function yy_r1_4 ( $yy_subpatterns )
2009-11-25 20:56:51 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_STRIPON ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_5 ( $yy_subpatterns )
2010-07-20 16:19:54 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_STRIPOFF ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_6 ( $yy_subpatterns )
2009-11-08 16:17:51 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LITERALSTART ;
$this -> yypushstate ( self :: LITERAL );
2014-03-18 18:22:33 +00:00
}
2014-06-08 16:00:56 +00:00
}
2013-08-24 18:46:31 +00:00
function yy_r1_7 ( $yy_subpatterns )
2009-11-08 16:17:51 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELIF ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_9 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOR ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_10 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOREACH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_11 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELSETFILTER ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r1_12 ( $yy_subpatterns )
2015-05-06 00:03:26 +02:00
{
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_PHP ;
$this -> phpType = 'tag' ;
$this -> taglineno = $this -> line ;
}
}
2015-05-16 13:33:04 +02:00
function yy_r1_18 ( $yy_subpatterns )
2011-09-16 14:19:56 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELSLASH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2015-05-16 13:33:04 +02:00
function yy_r1_19 ( $yy_subpatterns )
2009-11-08 16:17:51 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDEL ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2015-05-16 13:33:04 +02:00
function yy_r1_20 ( $yy_subpatterns )
2010-09-15 15:17:28 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
2014-06-08 16:00:56 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_21 ( $yy_subpatterns )
2010-09-15 15:17:28 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> token = Smarty_Internal_Templateparser :: TP_XMLTAG ;
$this -> taglineno = $this -> line ;
2014-06-08 16:00:56 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_23 ( $yy_subpatterns )
2014-10-07 22:07:15 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> phpType = 'asp' ;
$this -> taglineno = $this -> line ;
$this -> token = Smarty_Internal_Templateparser :: TP_PHP ;
2014-10-07 22:07:15 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_29 ( $yy_subpatterns )
2010-09-15 15:17:28 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> phpType = 'php' ;
$this -> taglineno = $this -> line ;
$this -> token = Smarty_Internal_Templateparser :: TP_PHP ;
2014-06-08 16:00:56 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_36 ( $yy_subpatterns )
2010-09-15 15:17:28 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> phpType = 'script' ;
$this -> taglineno = $this -> line ;
$this -> token = Smarty_Internal_Templateparser :: TP_PHP ;
2014-06-08 16:00:56 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_42 ( $yy_subpatterns )
2011-01-31 14:15:12 +00:00
{
2015-05-06 00:03:26 +02:00
$this -> phpType = 'unmatched' ;
$this -> taglineno = $this -> line ;
$this -> token = Smarty_Internal_Templateparser :: TP_PHP ;
2014-06-08 16:00:56 +00:00
}
2015-05-16 13:33:04 +02:00
function yy_r1_46 ( $yy_subpatterns )
2012-08-21 21:54:30 +00:00
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
2015-05-06 00:03:26 +02:00
preg_match ( " / { $this -> ldel } |< \ ?|<%| \ ?>|%>|<script \ s+language \ s*= \ s*[ \" \ ']? \ s*php \ s*[ \" \ ']? \ s*>/ " , $this -> data , $match , PREG_OFFSET_CAPTURE , $this -> counter );
2014-06-08 16:00:56 +00:00
if ( isset ( $match [ 0 ][ 1 ])) {
$to = $match [ 0 ][ 1 ];
}
2014-06-17 20:24:20 +00:00
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2013-07-14 21:12:08 +00:00
public function yylex2 ()
2009-10-31 00:44:58 +00:00
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 0 , 2 => 0 , 3 => 1 , 5 => 0 , 6 => 0 , 7 => 0 , 8 => 0 , 9 => 0 , 10 => 0 , 11 => 0 , 12 => 0 , 13 => 0 , 14 => 0 , 15 => 1 , 17 => 1 , 19 => 1 , 21 => 0 , 22 => 0 , 23 => 0 , 24 => 0 , 25 => 0 , 26 => 0 , 27 => 0 , 28 => 0 , 29 => 0 , 30 => 0 , 31 => 0 , 32 => 0 , 33 => 0 , 34 => 0 , 35 => 0 , 36 => 0 , 37 => 0 , 38 => 3 , 42 => 0 , 43 => 0 , 44 => 0 , 45 => 0 , 46 => 0 , 47 => 0 , 48 => 0 , 49 => 0 , 50 => 1 , 52 => 1 , 54 => 0 , 55 => 0 , 56 => 0 , 57 => 2 , 60 => 0 , 61 => 0 , 62 => 0 , 63 => 0 , 64 => 0 , 65 => 0 , 66 => 0 , 67 => 0 , 68 => 0 , 69 => 0 , 70 => 0 , 71 => 0 , 72 => 0 , 73 => 1 , 75 => 0 , 76 => 0 , 77 => 0 , 78 => 0 , 79 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-03-22 16:09:05 +00:00
return false ; // end of input
}
2014-11-12 19:07:00 +01:00
$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 " ;
2009-03-22 16:09:05 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2009-03-22 16:09:05 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state SMARTY' );
2009-03-22 16:09:05 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2009-03-22 16:09:05 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
2009-10-31 00:44:58 +00:00
$r = $this -> { 'yy_r2_' . $this -> token }( $yysubmatches );
2009-03-22 16:09:05 +00:00
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-03-22 16:09:05 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-03-22 16:09:05 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-03-22 16:09:05 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2009-03-22 16:09:05 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const SMARTY = 2 ;
2014-06-08 16:00:56 +00:00
2013-08-12 21:09:29 +00:00
function yy_r2_1 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_QUOTE ;
$this -> yypushstate ( self :: DOUBLEQUOTEDSTRING );
}
2013-08-12 21:09:29 +00:00
function yy_r2_2 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_SINGLEQUOTESTRING ;
}
2013-08-12 21:09:29 +00:00
function yy_r2_3 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_SMARTYBLOCKCHILDPARENT ;
$this -> taglineno = $this -> line ;
}
2013-08-12 21:09:29 +00:00
function yy_r2_5 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_DOLLAR ;
}
2013-08-12 21:09:29 +00:00
function yy_r2_6 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_RDEL ;
$this -> yypopstate ();
}
2013-08-24 18:46:31 +00:00
function yy_r2_7 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISIN ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_8 ( $yy_subpatterns )
2009-06-14 13:08:13 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_AS ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_9 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TO ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_10 ( $yy_subpatterns )
2010-02-10 20:51:36 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_STEP ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_11 ( $yy_subpatterns )
2009-12-03 22:39:45 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_INSTANCEOF ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_12 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_IDENTITY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_13 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_NONEIDENTITY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_14 ( $yy_subpatterns )
2009-10-05 18:55:22 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_EQUALS ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_15 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_NOTEQUALS ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_17 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_GREATEREQUAL ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_19 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LESSEQUAL ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_21 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_GREATERTHAN ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_22 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LESSTHAN ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_23 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_MOD ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_24 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_NOT ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_25 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LAND ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_26 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LOR ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_27 ( $yy_subpatterns )
2009-09-19 13:22:32 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LXOR ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_28 ( $yy_subpatterns )
2009-11-02 17:49:57 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISODDBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_29 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISNOTODDBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_30 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISODD ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_31 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISNOTODD ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_32 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISEVENBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_33 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISNOTEVENBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_34 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISEVEN ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_35 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISNOTEVEN ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_36 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISDIVBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_37 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ISNOTDIVBY ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_38 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TYPECAST ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_42 ( $yy_subpatterns )
2009-11-04 16:03:25 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_OPENP ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_43 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_CLOSEP ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_44 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_OPENB ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_45 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_CLOSEB ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_46 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_PTR ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_47 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_APTR ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_48 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_EQUAL ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_49 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_INCDEC ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_50 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_UNIMATH ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_52 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_MATH ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_54 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_AT ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_55 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_HATCH ;
}
2013-08-24 18:46:31 +00:00
function yy_r2_56 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
// resolve conflicts with shorttag and right_delimiter starting with '='
if ( substr ( $this -> data , $this -> counter + strlen ( $this -> value ) - 1 , $this -> rdel_length ) == $this -> smarty -> right_delimiter ) {
preg_match ( " / \ s+/ " , $this -> value , $match );
$this -> value = $match [ 0 ];
$this -> token = Smarty_Internal_Templateparser :: TP_SPACE ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_ATTR ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r2_57 ( $yy_subpatterns )
{
2014-11-12 19:07:00 +01:00
$this -> token = Smarty_Internal_Templateparser :: TP_NAMESPACE ;
2014-06-08 16:00:56 +00:00
}
2014-11-12 19:07:00 +01:00
function yy_r2_60 ( $yy_subpatterns )
{
2014-12-09 23:33:11 +01:00
$this -> token = Smarty_Internal_Templateparser :: TP_ID ;
2014-11-12 19:07:00 +01:00
}
function yy_r2_61 ( $yy_subpatterns )
2013-08-24 18:46:31 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_INTEGER ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_62 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_BACKTICK ;
$this -> yypopstate ();
}
2014-11-12 19:07:00 +01:00
function yy_r2_63 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_VERT ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_64 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_DOT ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_65 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_COMMA ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_66 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_SEMICOLON ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_67 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_DOUBLECOLON ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_68 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_COLON ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_69 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_ANDSYM ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_70 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_QMARK ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_71 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_HEX ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_72 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_SPACE ;
}
2014-11-12 19:07:00 +01:00
function yy_r2_73 ( $yy_subpatterns )
2009-03-22 16:09:05 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELIF ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-11-12 19:07:00 +01:00
function yy_r2_75 ( $yy_subpatterns )
2009-11-28 18:48:02 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOR ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-11-12 19:07:00 +01:00
function yy_r2_76 ( $yy_subpatterns )
2009-11-28 18:48:02 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOREACH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-11-12 19:07:00 +01:00
function yy_r2_77 ( $yy_subpatterns )
2009-11-28 18:48:02 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELSLASH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-11-12 19:07:00 +01:00
function yy_r2_78 ( $yy_subpatterns )
2009-11-28 18:48:02 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDEL ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-11-12 19:07:00 +01:00
function yy_r2_79 ( $yy_subpatterns )
2010-06-13 12:52:36 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2013-08-12 21:09:29 +00:00
2013-07-14 21:12:08 +00:00
public function yylex3 ()
2009-10-31 00:44:58 +00:00
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 0 , 2 => 0 , 3 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-10-31 00:44:58 +00:00
return false ; // end of input
}
2014-10-16 22:53:22 +00:00
$yy_global_pattern = " / \ G( " . $this -> ldel . " \\ s*literal \\ s* " . $this -> rdel . " )| \ G( " . $this -> ldel . " \\ s* \ /literal \\ s* " . $this -> rdel . " )| \ G([ \ S \ s])/iS " ;
2009-10-31 00:44:58 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2009-10-31 00:44:58 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state LITERAL' );
2009-10-31 00:44:58 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2009-10-31 00:44:58 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
$r = $this -> { 'yy_r3_' . $this -> token }( $yysubmatches );
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-10-31 00:44:58 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2009-10-31 00:44:58 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2009-10-31 00:44:58 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2009-10-31 00:44:58 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const LITERAL = 3 ;
2014-06-08 16:00:56 +00:00
2013-08-12 21:09:29 +00:00
function yy_r3_1 ( $yy_subpatterns )
2009-10-31 00:44:58 +00:00
{
2014-10-16 22:53:22 +00:00
$this -> literal_cnt ++ ;
$this -> token = Smarty_Internal_Templateparser :: TP_LITERAL ;
2014-06-08 16:00:56 +00:00
}
2013-08-12 21:09:29 +00:00
function yy_r3_2 ( $yy_subpatterns )
2009-10-31 00:44:58 +00:00
{
2014-10-16 22:53:22 +00:00
if ( $this -> literal_cnt ) {
$this -> literal_cnt -- ;
$this -> token = Smarty_Internal_Templateparser :: TP_LITERAL ;
2014-06-08 16:00:56 +00:00
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LITERALEND ;
$this -> yypopstate ();
}
}
2013-08-12 21:09:29 +00:00
function yy_r3_3 ( $yy_subpatterns )
2010-02-24 18:01:03 +00:00
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
2014-10-16 22:53:22 +00:00
preg_match ( " / { $this -> ldel } \ /?literal { $this -> rdel } / " , $this -> data , $match , PREG_OFFSET_CAPTURE , $this -> counter );
2014-06-08 16:00:56 +00:00
if ( isset ( $match [ 0 ][ 1 ])) {
$to = $match [ 0 ][ 1 ];
} else {
$this -> compiler -> trigger_template_error ( " missing or misspelled literal closing tag " );
}
2014-06-17 20:24:20 +00:00
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_LITERAL ;
}
2013-07-14 21:12:08 +00:00
public function yylex4 ()
2010-02-24 18:01:03 +00:00
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 1 , 3 => 0 , 4 => 0 , 5 => 0 , 6 => 0 , 7 => 0 , 8 => 0 , 9 => 0 , 10 => 0 , 11 => 0 , 12 => 0 , 13 => 3 , 17 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2010-02-24 18:01:03 +00:00
return false ; // end of input
}
2014-10-16 22:53:22 +00:00
$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 " ;
2010-02-24 18:01:03 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2010-02-24 18:01:03 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state DOUBLEQUOTEDSTRING' );
2010-02-24 18:01:03 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2010-02-24 18:01:03 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
2010-03-11 22:26:46 +00:00
$r = $this -> { 'yy_r4_' . $this -> token }( $yysubmatches );
2010-02-24 18:01:03 +00:00
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2010-02-24 18:01:03 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2010-02-24 18:01:03 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2010-02-24 18:01:03 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2010-02-24 18:01:03 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const DOUBLEQUOTEDSTRING = 4 ;
2014-06-08 16:00:56 +00:00
2013-08-12 21:09:29 +00:00
function yy_r4_1 ( $yy_subpatterns )
2010-02-24 18:01:03 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELIF ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r4_3 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOR ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-12 21:09:29 +00:00
function yy_r4_4 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELFOREACH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2013-08-12 21:09:29 +00:00
function yy_r4_5 ( $yy_subpatterns )
2014-10-16 22:53:22 +00:00
{
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
function yy_r4_6 ( $yy_subpatterns )
{
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
function yy_r4_7 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDELSLASH ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-10-16 22:53:22 +00:00
function yy_r4_8 ( $yy_subpatterns )
2010-05-31 17:58:23 +00:00
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_LDEL ;
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
}
2014-10-16 22:53:22 +00:00
function yy_r4_9 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_QUOTE ;
$this -> yypopstate ();
}
2014-10-16 22:53:22 +00:00
function yy_r4_10 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_BACKTICK ;
$this -> value = substr ( $this -> value , 0 , - 1 );
$this -> yypushstate ( self :: SMARTY );
$this -> taglineno = $this -> line ;
}
2014-10-16 22:53:22 +00:00
function yy_r4_11 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_DOLLARID ;
}
2014-10-16 22:53:22 +00:00
function yy_r4_12 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2014-10-16 22:53:22 +00:00
function yy_r4_13 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2014-10-16 22:53:22 +00:00
function yy_r4_17 ( $yy_subpatterns )
2010-01-11 20:44:01 +00:00
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_TEXT ;
}
2013-08-24 18:46:31 +00:00
public function yylex5 ()
2009-11-15 19:05:53 +00:00
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 0 , 2 => 0 , 3 => 0 , 4 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2013-08-24 18:46:31 +00:00
return false ; // end of input
}
2014-06-08 16:00:56 +00:00
$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 " ;
2009-11-15 19:05:53 +00:00
2013-08-24 18:46:31 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2013-08-24 18:46:31 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state CHILDBODY' );
2013-08-24 18:46:31 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2013-08-24 18:46:31 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
$r = $this -> { 'yy_r5_' . $this -> token }( $yysubmatches );
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2013-08-24 18:46:31 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2013-08-24 18:46:31 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2013-08-24 18:46:31 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2013-08-24 18:46:31 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const CHILDBODY = 5 ;
2014-06-08 16:00:56 +00:00
2013-08-24 18:46:31 +00:00
function yy_r5_1 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
return false ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_STRIPON ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r5_2 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
return false ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_STRIPOFF ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r5_3 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
return false ;
} else {
$this -> yypopstate ();
return true ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r5_4 ( $yy_subpatterns )
2009-11-15 19:05:53 +00:00
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
2014-06-08 16:00:56 +00:00
preg_match ( " / " . $this -> ldel . " \ s*(( \ /)?strip \ s* " . $this -> rdel . " |block \ s+)/ " , $this -> data , $match , PREG_OFFSET_CAPTURE , $this -> counter );
if ( isset ( $match [ 0 ][ 1 ])) {
$to = $match [ 0 ][ 1 ];
}
2014-06-17 20:24:20 +00:00
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
return false ;
}
2013-08-24 18:46:31 +00:00
public function yylex6 ()
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 0 , 2 => 0 , 3 => 0 , 4 => 1 , 6 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2013-08-24 18:46:31 +00:00
return false ; // end of input
}
2014-06-08 16:00:56 +00:00
$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 " ;
2013-08-24 18:46:31 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2013-08-24 18:46:31 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-06 02:40:04 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state CHILDBLOCK' );
2013-08-24 18:46:31 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2013-08-24 18:46:31 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
$r = $this -> { 'yy_r6_' . $this -> token }( $yysubmatches );
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2013-08-24 18:46:31 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2013-08-24 18:46:31 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2013-08-24 18:46:31 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2013-08-24 18:46:31 +00:00
}
break ;
} while ( true );
} // end function
2014-06-08 15:52:08 +00:00
const CHILDBLOCK = 6 ;
2014-06-08 16:00:56 +00:00
2013-08-24 18:46:31 +00:00
function yy_r6_1 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
$this -> yypushstate ( self :: CHILDLITERAL );
2014-03-20 22:07:26 +00:00
}
2014-06-08 16:00:56 +00:00
}
2013-08-24 18:46:31 +00:00
function yy_r6_2 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> yypopstate ();
return true ;
}
}
2013-08-24 18:46:31 +00:00
function yy_r6_3 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> yypopstate ();
return true ;
}
}
2014-06-08 15:52:08 +00:00
function yy_r6_4 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> yypopstate ();
return true ;
}
}
2014-06-08 15:52:08 +00:00
function yy_r6_6 ( $yy_subpatterns )
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
2014-06-08 16:00:56 +00:00
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 );
if ( isset ( $match [ 0 ][ 1 ])) {
$to = $match [ 0 ][ 1 ];
}
2014-06-17 20:24:20 +00:00
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
}
2014-06-08 15:52:08 +00:00
public function yylex7 ()
{
2015-05-13 02:06:33 +02:00
$tokenMap = array ( 1 => 0 , 2 => 0 , 3 => 0 ,);
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2014-06-08 15:52:08 +00:00
return false ; // end of input
2014-03-20 22:07:26 +00:00
}
2014-06-08 16:00:56 +00:00
$yy_global_pattern = " / \ G( " . $this -> ldel . " \\ s*literal \\ s* " . $this -> rdel . " )| \ G( " . $this -> ldel . " \\ s* \ /literal \\ s* " . $this -> rdel . " )| \ G([ \ S \ s])/iS " ;
2014-03-20 22:07:26 +00:00
2014-06-08 15:52:08 +00:00
do {
2014-06-17 20:24:20 +00:00
if ( preg_match ( $yy_global_pattern , $this -> data , $yymatches , null , $this -> counter )) {
2014-06-08 15:52:08 +00:00
$yysubmatches = $yymatches ;
2014-12-13 23:02:29 +01:00
$yymatches = preg_grep ( " /(.| \ s)+/ " , $yysubmatches );
2014-06-08 15:52:08 +00:00
if ( ! count ( $yymatches )) {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr ( $this -> data , $this -> counter , 5 ) . '... state CHILDLITERAL' );
2014-06-08 15:52:08 +00:00
}
next ( $yymatches ); // skip global match
$this -> token = key ( $yymatches ); // token number
if ( $tokenMap [ $this -> token ]) {
// extract sub-patterns for passing to lex function
2015-05-13 02:06:33 +02:00
$yysubmatches = array_slice ( $yysubmatches , $this -> token + 1 , $tokenMap [ $this -> token ]);
2014-06-08 15:52:08 +00:00
} else {
$yysubmatches = array ();
}
$this -> value = current ( $yymatches ); // token value
$r = $this -> { 'yy_r7_' . $this -> token }( $yysubmatches );
if ( $r === null ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2014-06-08 15:52:08 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
// accept this token
return true ;
} elseif ( $r === true ) {
// we have changed state
// process this token in the new state
return $this -> yylex ();
} elseif ( $r === false ) {
2014-06-17 20:24:20 +00:00
$this -> counter += strlen ( $this -> value );
2014-06-08 15:52:08 +00:00
$this -> line += substr_count ( $this -> value , " \n " );
2014-06-17 20:24:20 +00:00
if ( $this -> counter >= strlen ( $this -> data )) {
2014-06-08 15:52:08 +00:00
return false ; // end of input
}
// skip this token
continue ;
2014-06-08 16:00:56 +00:00
}
} else {
2015-05-13 02:06:33 +02:00
throw new Exception ( 'Unexpected input at line' . $this -> line . ': ' . $this -> data [ $this -> counter ]);
2014-06-08 15:52:08 +00:00
}
break ;
} while ( true );
} // end function
const CHILDLITERAL = 7 ;
2014-06-08 16:00:56 +00:00
2014-06-08 15:52:08 +00:00
function yy_r7_1 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
$this -> yypushstate ( self :: CHILDLITERAL );
}
}
2014-06-08 15:52:08 +00:00
function yy_r7_2 ( $yy_subpatterns )
{
2014-06-08 16:00:56 +00:00
if ( $this -> smarty -> auto_literal && isset ( $this -> value [ $this -> ldel_length ]) ? strpos ( " \n \t \r " , $this -> value [ $this -> ldel_length ]) !== false : false ) {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
} else {
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
$this -> yypopstate ();
}
}
2014-06-08 15:52:08 +00:00
function yy_r7_3 ( $yy_subpatterns )
{
2014-06-17 20:24:20 +00:00
$to = strlen ( $this -> data );
2014-06-08 16:00:56 +00:00
preg_match ( " / { $this -> ldel } \ /?literal \ s* { $this -> rdel } / " , $this -> data , $match , PREG_OFFSET_CAPTURE , $this -> counter );
if ( isset ( $match [ 0 ][ 1 ])) {
$to = $match [ 0 ][ 1 ];
} else {
$this -> compiler -> trigger_template_error ( " missing or misspelled literal closing tag " );
}
2014-06-17 20:24:20 +00:00
$this -> value = substr ( $this -> data , $this -> counter , $to - $this -> counter );
2014-06-08 16:00:56 +00:00
$this -> token = Smarty_Internal_Templateparser :: TP_BLOCKSOURCE ;
}
}
2014-06-08 15:52:08 +00:00