mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02: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:
@@ -1,6 +1,10 @@
|
||||
===== 3.1.32 - dev ===
|
||||
21.10.2017
|
||||
- bugfix custom delimiters could fail since modification of version 3.1.32-dev-23
|
||||
https://github.com/smarty-php/smarty/issues/394
|
||||
|
||||
18.10.2017
|
||||
-bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017
|
||||
- bugfix fix implementation of unclosed block tag in double quoted string of 12.10.2017
|
||||
https://github.com/smarty-php/smarty/issues/396 https://github.com/smarty-php/smarty/issues/397
|
||||
https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392
|
||||
|
||||
|
@@ -74,42 +74,7 @@ class Smarty_Internal_Templatelexer
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @var int
|
||||
@@ -202,13 +167,6 @@ class Smarty_Internal_Templatelexer
|
||||
'SCOND' => '"is even" ... if condition',
|
||||
);
|
||||
|
||||
/**
|
||||
* preg string of user defined litereals
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $literals = '';
|
||||
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
@@ -266,29 +224,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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,15 +244,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,8 +260,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;
|
||||
}
|
||||
|
||||
/*!lex2php
|
||||
@@ -332,22 +270,22 @@ class Smarty_Internal_Templatelexer
|
||||
%token $this->token
|
||||
%value $this->value
|
||||
%line $this->line
|
||||
userliteral = ~SMARTYliteral~
|
||||
userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~
|
||||
char = ~[\S\s]~
|
||||
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYliteral|SMARTYldel|\$|`\$|"))~
|
||||
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~
|
||||
namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
|
||||
emptyjava = ~[{][}]~
|
||||
phptag = ~(SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[/]phpSMARTYrdel)~
|
||||
phpstart = ~([<][?]((php\s+|=)|\s+))|([<][%])|([<][?]xml\s+)|([<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>])|([?][>])|([%][>])~
|
||||
phptag = ~(SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[/]phpSMARTYrdel~
|
||||
phpstart = ~[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]~
|
||||
slash = ~[/]~
|
||||
ldel = ~SMARTYldel~
|
||||
ldel = ~(SMARTYldel)SMARTYal~
|
||||
rdel = ~\s*SMARTYrdel~
|
||||
nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
|
||||
notblockid = ~(?:(?!block)[0-9]*[a-zA-Z_]\w*)~
|
||||
integer = ~\d+~
|
||||
hex = ~0[xX][0-9a-fA-F]+~
|
||||
math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~
|
||||
comment = ~SMARTYldel[*]~
|
||||
comment = ~(SMARTYldel)SMARTYal[*]~
|
||||
incdec = ~([+]|[-]){2}~
|
||||
unimath = ~\s*([+]|[-])\s*~
|
||||
openP = ~\s*[(]\s*~
|
||||
@@ -370,14 +308,14 @@ class Smarty_Internal_Templatelexer
|
||||
backtick = ~[`]~
|
||||
vert = ~[|]~
|
||||
qmark = ~\s*[?]\s*~
|
||||
constant = ~([_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*)(?![0-9A-Z_]*[a-z])~
|
||||
constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~
|
||||
attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~
|
||||
id = ~[0-9]*[a-zA-Z_]\w*~
|
||||
literal = ~literal~
|
||||
strip = ~strip~
|
||||
lop = ~\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\s*~
|
||||
lop = ~\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\s*~
|
||||
slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~
|
||||
tlop = ~\s+(is\s+(not\s+)?(odd|even|div)\s+by)\s+~
|
||||
tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~
|
||||
scond = ~\s+is\s+(not\s+)?(odd|even)~
|
||||
isin = ~\s+is\s+in\s+~
|
||||
as = ~\s+as\s+~
|
||||
@@ -390,12 +328,11 @@ class Smarty_Internal_Templatelexer
|
||||
foreach = ~foreach(?![^\s])~
|
||||
setfilter = ~setfilter\s+~
|
||||
instanceof = ~\s+instanceof\s+~
|
||||
not = ~([!]\s*)|(not\s+)~
|
||||
not = ~[!]\s*|not\s+~
|
||||
typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
|
||||
double_quote = ~["]~
|
||||
text = ~((.*?)(?=(SMARTYliteral|[{]|([<][?]((php\s+|=)|\s+))|([<][%])|([<][?]xml\s+)|([<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>])|([?][>])|([%][>]))))|(.*)~
|
||||
literaltext = ~(.*?)(?=SMARTYldel[/]?literalSMARTYrdel)~
|
||||
anytext = ~.*~
|
||||
text = ~(.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+~
|
||||
literaltext = ~(.*?)(?=(SMARTYldel)SMARTYal[/]?literalSMARTYrdel)~
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TEXT
|
||||
@@ -403,11 +340,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
comment {
|
||||
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;
|
||||
@@ -475,12 +412,12 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel dollar id nocacherdel {
|
||||
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;
|
||||
@@ -592,7 +529,7 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
attr {
|
||||
// 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;
|
||||
@@ -663,9 +600,6 @@ class Smarty_Internal_Templatelexer
|
||||
literaltext {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
anytext {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename DOUBLEQUOTEDSTRING
|
||||
|
@@ -157,7 +157,7 @@ class Smarty_Internal_Templateparser
|
||||
$this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* insert PHP code in current buffer
|
||||
*
|
||||
* @param string $code
|
||||
@@ -167,7 +167,21 @@ class Smarty_Internal_Templateparser
|
||||
$this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $code));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* error rundown
|
||||
*
|
||||
*/
|
||||
public function errorRunDown()
|
||||
{
|
||||
while ($this->yystack !== Array()) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
if (is_resource($this->yyTraceFILE)) {
|
||||
fclose($this->yyTraceFILE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* merge PHP code with prefix code and return parse tree tag object
|
||||
*
|
||||
* @param string $code
|
||||
@@ -176,13 +190,13 @@ class Smarty_Internal_Templateparser
|
||||
*/
|
||||
public function mergePrefixCode($code)
|
||||
{
|
||||
$tmp ='';
|
||||
$tmp = '';
|
||||
foreach ($this->compiler->prefix_code as $preCode) {
|
||||
$tmp .= $preCode;
|
||||
}
|
||||
$this->compiler->prefix_code=array();
|
||||
$this->compiler->prefix_code = array();
|
||||
$tmp .= $code;
|
||||
return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp,true));
|
||||
return new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp, true));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -327,7 +341,7 @@ smartytag(res) ::= tag(t) RDEL. {
|
||||
// output tags start here
|
||||
//
|
||||
smartytag(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
$var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
|
||||
res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
|
||||
} else {
|
||||
@@ -381,8 +395,8 @@ tag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). {
|
||||
|
||||
// simple tag like {name}
|
||||
smartytag(res)::= SIMPLETAG(t). {
|
||||
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length));
|
||||
if ($tag == 'strip') {
|
||||
$tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
|
||||
if ($tag === 'strip') {
|
||||
$this->strip = true;
|
||||
res = null;;
|
||||
} else {
|
||||
@@ -453,23 +467,23 @@ tag(res) ::= LDELMAKENOCACHE DOLLARID(i). {
|
||||
|
||||
// {if}, {elseif} and {while} tag
|
||||
tag(res) ::= LDELIF(i) expr(ie). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
$tag = trim(substr(i,$this->compiler->getLdelLength()));
|
||||
res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
}
|
||||
|
||||
tag(res) ::= LDELIF(i) expr(ie) attributes(a). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
$tag = trim(substr(i,$this->compiler->getLdelLength()));
|
||||
res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
}
|
||||
|
||||
tag(res) ::= LDELIF(i) statement(ie). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
$tag = trim(substr(i,$this->compiler->getLdelLength()));
|
||||
res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,array(),array('if condition'=>ie));
|
||||
}
|
||||
|
||||
tag(res) ::= LDELIF(i) statement(ie) attributes(a). {
|
||||
$tag = trim(substr(i,$this->lex->ldel_length));
|
||||
res = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
$tag = trim(substr(i,$this->compiler->getLdelLength()));
|
||||
res = $this->compiler->compileTag(($tag === 'else if')? 'elseif' : $tag,a,array('if condition'=>ie));
|
||||
}
|
||||
|
||||
// {for} tag
|
||||
@@ -517,8 +531,8 @@ tag(res) ::= LDELSETFILTER ID(m) modparameters(p) modifierlist(l). {
|
||||
|
||||
// end of block tag {/....}
|
||||
smartytag(res)::= CLOSETAG(t). {
|
||||
$tag = trim(substr(t, $this->lex->ldel_length, -$this->lex->rdel_length), ' /');
|
||||
if ($tag == 'strip') {
|
||||
$tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' /');
|
||||
if ($tag === 'strip') {
|
||||
$this->strip = false;
|
||||
res = null;
|
||||
} else {
|
||||
@@ -785,7 +799,7 @@ value(res) ::= doublequoted_with_quotes(s). {
|
||||
|
||||
value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
if (vi['var'] == '\'smarty\'') {
|
||||
if (vi['var'] === '\'smarty\'') {
|
||||
$this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>');
|
||||
} else {
|
||||
$this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>');
|
||||
@@ -845,7 +859,7 @@ variable(res) ::= DOLLARID(i). {
|
||||
res = $this->compiler->compileVariable('\''.substr(i,1).'\'');
|
||||
}
|
||||
variable(res) ::= varindexed(vi). {
|
||||
if (vi['var'] == '\'smarty\'') {
|
||||
if (vi['var'] === '\'smarty\'') {
|
||||
$smarty_var = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']);
|
||||
res = $smarty_var;
|
||||
} else {
|
||||
@@ -987,7 +1001,7 @@ varvarele(res) ::= ID(s). {
|
||||
res = '\''.s.'\'';
|
||||
}
|
||||
varvarele(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
$var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
|
||||
res = $this->compiler->compileVariable('\''.$var.'\'');
|
||||
}
|
||||
|
||||
@@ -1000,7 +1014,7 @@ varvarele(res) ::= LDEL expr(e) RDEL. {
|
||||
// objects
|
||||
//
|
||||
object(res) ::= varindexed(vi) objectchain(oc). {
|
||||
if (vi['var'] == '\'smarty\'') {
|
||||
if (vi['var'] === '\'smarty\'') {
|
||||
res = $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).oc;
|
||||
} else {
|
||||
res = $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].oc;
|
||||
@@ -1019,7 +1033,7 @@ objectchain(res) ::= objectchain(oc) objectelement(oe). {
|
||||
|
||||
// variable
|
||||
objectelement(res)::= PTR ID(i) arrayindex(a). {
|
||||
if ($this->security && substr(i,0,1) == '_') {
|
||||
if ($this->security && substr(i,0,1) === '_') {
|
||||
$this->compiler->trigger_template_error (self::Err1);
|
||||
}
|
||||
res = '->'.i.a;
|
||||
@@ -1064,7 +1078,7 @@ function(res) ::= ns1(f) OPENP params(p) CLOSEP. {
|
||||
// method
|
||||
//
|
||||
method(res) ::= ID(f) OPENP params(p) CLOSEP. {
|
||||
if ($this->security && substr(f,0,1) == '_') {
|
||||
if ($this->security && substr(f,0,1) === '_') {
|
||||
$this->compiler->trigger_template_error (self::Err1);
|
||||
}
|
||||
res = f . "(". implode(',',p) .")";
|
||||
|
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