mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 05:11:36 +01:00
- bugfix custom delimiters could fail since modification of version 3.1.32-dev-23
https://github.com/smarty-php/smarty/issues/394
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -270,6 +270,36 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
* @var array
|
||||
*/
|
||||
public $_cache = array();
|
||||
/**
|
||||
* Lexer preg pattern for left delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ldelPreg = '[{]';
|
||||
/**
|
||||
* Lexer preg pattern for right delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $rdelPreg = '[}]';
|
||||
/**
|
||||
* Length of right delimiter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $rdelLength = 0;
|
||||
/**
|
||||
* Length of left delimiter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $ldelLength = 0;
|
||||
/**
|
||||
* Lexer preg pattern for user literals
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $literalPreg = '';
|
||||
|
||||
/**
|
||||
* Initialize compiler
|
||||
@@ -1002,6 +1032,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
$error_text .= ', expected one of: ' . implode(' , ', $expect);
|
||||
}
|
||||
}
|
||||
if ($this->smarty->_parserdebug) {
|
||||
$this->parser->errorRunDown();
|
||||
echo ob_get_clean();
|
||||
flush();
|
||||
}
|
||||
$e = new SmartyCompilerException($error_text);
|
||||
$e->line = $line;
|
||||
$e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ]));
|
||||
@@ -1041,6 +1076,52 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
return count($this->_tag_stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $lexerPreg
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function replaceDelimiter($lexerPreg)
|
||||
{
|
||||
return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'),
|
||||
array($this->ldelPreg, $this->literalPreg, $this->rdelPreg,
|
||||
$this->smarty->getAutoLiteral() ? '{1,}' : '{9}',
|
||||
$this->smarty->getAutoLiteral() ? '' : '\\s*'),
|
||||
$lexerPreg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build lexer regular expressions for left and right delimiter and user defined literals
|
||||
*/
|
||||
public function initDelimiterPreg()
|
||||
{
|
||||
$ldel = $this->smarty->getLeftDelimiter();
|
||||
$this->ldelLength = strlen($ldel);
|
||||
$this->ldelPreg = '';
|
||||
foreach (str_split($ldel, 1) as $chr) {
|
||||
$this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']';
|
||||
}
|
||||
$rdel = $this->smarty->getRightDelimiter();
|
||||
$this->rdelLength = strlen($rdel);
|
||||
$this->rdelPreg = '';
|
||||
foreach (str_split($rdel, 1) as $chr) {
|
||||
$this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']';
|
||||
}
|
||||
$literals = $this->smarty->getLiterals();
|
||||
if (!empty($literals)) {
|
||||
foreach ($literals as $key => $literal) {
|
||||
$literalPreg = '';
|
||||
foreach (str_split($literal, 1) as $chr) {
|
||||
$literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']';
|
||||
}
|
||||
$literals[ $key ] = $literalPreg;
|
||||
}
|
||||
$this->literalPreg = '|' . implode('|', $literals);
|
||||
} else {
|
||||
$this->literalPreg = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* leave double quoted string
|
||||
* - throw exception if block in string was not closed
|
||||
@@ -1057,6 +1138,46 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get left delimiter preg
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLdelPreg()
|
||||
{
|
||||
return $this->ldelPreg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get right delimiter preg
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRdelPreg()
|
||||
{
|
||||
return $this->rdelPreg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get length of left delimiter
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLdelLength()
|
||||
{
|
||||
return $this->ldelLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get length of right delimiter
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRdelLength()
|
||||
{
|
||||
return $this->rdelLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of current open block tag
|
||||
*
|
||||
|
||||
@@ -71,36 +71,6 @@ class Smarty_Internal_Templatelexer
|
||||
* @var string
|
||||
*/
|
||||
public $phpType = '';
|
||||
/**
|
||||
* escaped left delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ldel = '';
|
||||
/**
|
||||
* escaped left delimiter with space
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ldel_q = '';
|
||||
/**
|
||||
* escaped left delimiter length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $ldel_length = 0;
|
||||
/**
|
||||
* escaped right delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $rdel = '';
|
||||
/**
|
||||
* escaped right delimiter length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $rdel_length = 0;
|
||||
/**
|
||||
* state number
|
||||
*
|
||||
@@ -186,12 +156,6 @@ class Smarty_Internal_Templatelexer
|
||||
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
|
||||
'SCOND' => '"is even" ... if condition',
|
||||
);
|
||||
/**
|
||||
* preg string of user defined litereals
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $literals = '';
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
@@ -246,28 +210,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->counter += strlen($match[ 0 ]);
|
||||
}
|
||||
$this->line = 1;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->smarty = $compiler->template->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter, '/') . ($this->smarty->auto_literal ? '' : '\\s*');
|
||||
$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;
|
||||
$literals = $this->smarty->getLiterals();
|
||||
if (!empty($literals)) {
|
||||
foreach ($literals as $key => $literal) {
|
||||
$literals[ $key ] = preg_quote($literal, '/');
|
||||
}
|
||||
}
|
||||
if ($this->smarty->auto_literal) {
|
||||
$literals[] = $this->ldel . '{1,}\\s+';
|
||||
}
|
||||
if (!empty($literals)) {
|
||||
$this->literals = implode('|', $literals);
|
||||
} else {
|
||||
$this->literals = preg_quote('^$', '/');
|
||||
}
|
||||
$this->compiler->initDelimiterPreg();
|
||||
$this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
|
||||
$this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,15 +230,13 @@ class Smarty_Internal_Templatelexer
|
||||
/**
|
||||
* replace placeholders with runtime preg code
|
||||
*
|
||||
* @param string $input
|
||||
* @param string $preg
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function replace($input)
|
||||
public function replace($preg)
|
||||
{
|
||||
return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel'),
|
||||
array($this->ldel, $this->literals, $this->rdel),
|
||||
$input);
|
||||
return $this->compiler->replaceDelimiter($preg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,8 +246,8 @@ class Smarty_Internal_Templatelexer
|
||||
*/
|
||||
public function isAutoLiteral()
|
||||
{
|
||||
return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
||||
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false;
|
||||
return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
|
||||
strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
|
||||
} // end function
|
||||
|
||||
public function yylex()
|
||||
@@ -365,7 +310,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
$this->yy_global_pattern1 =
|
||||
$this->replace("/\G([{][}])|\G(SMARTYldel[*])|\G((SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[\/]phpSMARTYrdel))|\G(SMARTYliteral)|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel)|\G(([<][?]((php\\s+|=)|\\s+))|([<][%])|([<][?]xml\\s+)|([<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>])|([?][>])|([%][>]))|\G(((.*?)(?=(SMARTYliteral|[{]|([<][?]((php\\s+|=)|\\s+))|([<][%])|([<][?]xml\\s+)|([<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>])|([?][>])|([%][>]))))|(.*))/isS");
|
||||
$this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -423,50 +368,50 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
function yy_r1_2()
|
||||
{
|
||||
preg_match("/[*]{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
preg_match("/[*]{$this->compiler->getRdelPreg()}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
if (isset($match[ 0 ][ 1 ])) {
|
||||
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
||||
} else {
|
||||
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'");
|
||||
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->getRightDelimiter()}'");
|
||||
}
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
return false;
|
||||
}
|
||||
|
||||
function yy_r1_3()
|
||||
function yy_r1_4()
|
||||
{
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
}
|
||||
|
||||
function yy_r1_7()
|
||||
function yy_r1_8()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r1_8()
|
||||
function yy_r1_10()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
|
||||
function yy_r1_9()
|
||||
function yy_r1_12()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
} // end function
|
||||
|
||||
function yy_r1_10()
|
||||
function yy_r1_14()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r1_11()
|
||||
function yy_r1_16()
|
||||
{
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
}
|
||||
|
||||
function yy_r1_20()
|
||||
function yy_r1_19()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
@@ -475,7 +420,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
$this->yy_global_pattern2 =
|
||||
$this->replace("/\G(SMARTYldel(if|elseif|else if|while)\\s+)|\G(SMARTYldelfor\\s+)|\G(SMARTYldelforeach(?![^\s]))|\G(SMARTYldelsetfilter\\s+)|\G(SMARTYldelmake_nocache\\s+)|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G(SMARTYldel[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel)/isS");
|
||||
$this->replace("/\G((SMARTYldel)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -533,70 +478,70 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_3()
|
||||
function yy_r2_4()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_4()
|
||||
function yy_r2_6()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_5()
|
||||
function yy_r2_8()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_6()
|
||||
function yy_r2_10()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_7()
|
||||
function yy_r2_12()
|
||||
{
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_9()
|
||||
function yy_r2_15()
|
||||
{
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_10()
|
||||
function yy_r2_17()
|
||||
{
|
||||
if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) {
|
||||
if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
} else {
|
||||
$this->value = $this->smarty->left_delimiter;
|
||||
$this->value = $this->smarty->getLeftDelimiter();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r2_12()
|
||||
function yy_r2_20()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r2_13()
|
||||
function yy_r2_22()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
@@ -607,7 +552,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 =
|
||||
$this->replace("/\G(\\s*SMARTYrdel)|\G(SMARTYldel)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+(is\\s+(not\\s+)?(odd|even|div)\\s+by)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
|
||||
$this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -670,148 +615,148 @@ class Smarty_Internal_Templatelexer
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r3_3()
|
||||
function yy_r3_4()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
|
||||
$this->compiler->enterDoubleQuote();
|
||||
}
|
||||
|
||||
function yy_r3_4()
|
||||
function yy_r3_5()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
|
||||
}
|
||||
|
||||
function yy_r3_5()
|
||||
function yy_r3_6()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
|
||||
function yy_r3_6()
|
||||
function yy_r3_7()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
|
||||
}
|
||||
|
||||
function yy_r3_7()
|
||||
function yy_r3_8()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
|
||||
}
|
||||
|
||||
function yy_r3_8()
|
||||
function yy_r3_9()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_AS;
|
||||
}
|
||||
|
||||
function yy_r3_9()
|
||||
function yy_r3_10()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TO;
|
||||
}
|
||||
|
||||
function yy_r3_10()
|
||||
function yy_r3_11()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_STEP;
|
||||
}
|
||||
|
||||
function yy_r3_11()
|
||||
function yy_r3_12()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
|
||||
}
|
||||
|
||||
function yy_r3_12()
|
||||
function yy_r3_13()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
|
||||
}
|
||||
|
||||
function yy_r3_17()
|
||||
function yy_r3_15()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
|
||||
}
|
||||
|
||||
function yy_r3_19()
|
||||
function yy_r3_17()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
|
||||
}
|
||||
|
||||
function yy_r3_23()
|
||||
function yy_r3_20()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
|
||||
}
|
||||
|
||||
function yy_r3_26()
|
||||
function yy_r3_23()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_NOT;
|
||||
}
|
||||
|
||||
function yy_r3_29()
|
||||
function yy_r3_24()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
|
||||
}
|
||||
|
||||
function yy_r3_33()
|
||||
function yy_r3_28()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
|
||||
}
|
||||
|
||||
function yy_r3_34()
|
||||
function yy_r3_29()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
|
||||
}
|
||||
|
||||
function yy_r3_35()
|
||||
function yy_r3_30()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
|
||||
}
|
||||
|
||||
function yy_r3_36()
|
||||
function yy_r3_31()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
|
||||
}
|
||||
|
||||
function yy_r3_37()
|
||||
function yy_r3_32()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PTR;
|
||||
}
|
||||
|
||||
function yy_r3_38()
|
||||
function yy_r3_33()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_APTR;
|
||||
}
|
||||
|
||||
function yy_r3_39()
|
||||
function yy_r3_34()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
|
||||
}
|
||||
|
||||
function yy_r3_40()
|
||||
function yy_r3_35()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
|
||||
}
|
||||
|
||||
function yy_r3_42()
|
||||
function yy_r3_37()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
|
||||
}
|
||||
|
||||
function yy_r3_44()
|
||||
function yy_r3_39()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_MATH;
|
||||
}
|
||||
|
||||
function yy_r3_46()
|
||||
function yy_r3_41()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_AT;
|
||||
}
|
||||
|
||||
function yy_r3_47()
|
||||
function yy_r3_42()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
|
||||
}
|
||||
|
||||
function yy_r3_48()
|
||||
function yy_r3_43()
|
||||
{
|
||||
// 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) {
|
||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
|
||||
$this->smarty->getRightDelimiter()) {
|
||||
preg_match("/\s+/", $this->value, $match);
|
||||
$this->value = $match[ 0 ];
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
@@ -820,73 +765,73 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
}
|
||||
|
||||
function yy_r3_49()
|
||||
function yy_r3_44()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
|
||||
}
|
||||
|
||||
function yy_r3_52()
|
||||
function yy_r3_47()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ID;
|
||||
}
|
||||
|
||||
function yy_r3_53()
|
||||
function yy_r3_48()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
|
||||
}
|
||||
|
||||
function yy_r3_54()
|
||||
function yy_r3_49()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r3_55()
|
||||
function yy_r3_50()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_VERT;
|
||||
}
|
||||
|
||||
function yy_r3_56()
|
||||
function yy_r3_51()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOT;
|
||||
}
|
||||
|
||||
function yy_r3_57()
|
||||
function yy_r3_52()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
|
||||
}
|
||||
|
||||
function yy_r3_58()
|
||||
function yy_r3_53()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
|
||||
}
|
||||
|
||||
function yy_r3_59()
|
||||
function yy_r3_54()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
|
||||
}
|
||||
|
||||
function yy_r3_60()
|
||||
function yy_r3_55()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COLON;
|
||||
}
|
||||
|
||||
function yy_r3_61()
|
||||
function yy_r3_56()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
|
||||
}
|
||||
|
||||
function yy_r3_62()
|
||||
function yy_r3_57()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_HEX;
|
||||
}
|
||||
|
||||
function yy_r3_63()
|
||||
function yy_r3_58()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
} // end function
|
||||
|
||||
function yy_r3_64()
|
||||
function yy_r3_59()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
@@ -895,7 +840,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
$this->yy_global_pattern4 =
|
||||
$this->replace("/\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=SMARTYldel[\/]?literalSMARTYrdel))|\G(.*)/isS");
|
||||
$this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -952,7 +897,7 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
|
||||
function yy_r4_2()
|
||||
function yy_r4_3()
|
||||
{
|
||||
if ($this->literal_cnt) {
|
||||
$this->literal_cnt--;
|
||||
@@ -963,11 +908,6 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
}
|
||||
|
||||
function yy_r4_3()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
|
||||
function yy_r4_5()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
@@ -977,7 +917,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
$this->yy_global_pattern5 =
|
||||
$this->replace("/\G(SMARTYliteral)|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*)|\G(SMARTYldel)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(SMARTYliteral|SMARTYldel|\\$|`\\$|\")))/isS");
|
||||
$this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -1033,42 +973,42 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_2()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_3()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_4()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r5_5()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_7()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r5_6()
|
||||
function yy_r5_9()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r5_11()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
|
||||
function yy_r5_7()
|
||||
function yy_r5_13()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r5_8()
|
||||
function yy_r5_14()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
$this->value = substr($this->value, 0, -1);
|
||||
@@ -1076,17 +1016,17 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r5_9()
|
||||
function yy_r5_15()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
|
||||
function yy_r5_10()
|
||||
function yy_r5_16()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_11()
|
||||
function yy_r5_17()
|
||||
{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user