-bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798)

This commit is contained in:
uwetews
2015-11-25 21:19:23 +01:00
parent 5ca1cd485f
commit e0fc310b6e
3 changed files with 106 additions and 104 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.28-dev===== (xx.xx.2015)
25.11.2015
-bugfix a left delimter like '[%' did fail on [%$var_[%$variable%]%] (forum topic 25798)
02.11.2015
- bugfix {include} with variable file name like {include file="foo_`$bar`.tpl"} did fail in 3.1.28-dev https://github.com/smarty-php/smarty/issues/102

View File

@@ -436,6 +436,14 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
$this->yypopstate();
}
ldel {
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->yypushstate(self::TAG);
return true;
}
}
double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
@@ -569,14 +577,6 @@ class Smarty_Internal_Templatelexer
space {
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
ldel {
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->yypushstate(self::TAG);
return true;
}
}
text {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}

View File

@@ -557,9 +557,8 @@ class Smarty_Internal_Templatelexer
public function yylex3()
{
if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel .
")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(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(" .
$this->ldel . "\\s*)|\G([\S\s])/isS";
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(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 ($this->counter >= strlen($this->data)) {
return false; // end of input
@@ -618,168 +617,181 @@ class Smarty_Internal_Templatelexer
function yy_r3_2()
{
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
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->yypushstate(self::TAG);
return true;
}
}
function yy_r3_3()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
}
function yy_r3_4()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
}
function yy_r3_5()
{
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line;
}
function yy_r3_6()
function yy_r3_7()
{
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
function yy_r3_7()
function yy_r3_8()
{
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
}
function yy_r3_8()
function yy_r3_9()
{
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
}
function yy_r3_9()
function yy_r3_10()
{
$this->token = Smarty_Internal_Templateparser::TP_AS;
}
function yy_r3_10()
function yy_r3_11()
{
$this->token = Smarty_Internal_Templateparser::TP_TO;
}
function yy_r3_11()
function yy_r3_12()
{
$this->token = Smarty_Internal_Templateparser::TP_STEP;
}
function yy_r3_12()
function yy_r3_13()
{
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
}
function yy_r3_13()
function yy_r3_14()
{
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
}
function yy_r3_18()
function yy_r3_19()
{
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
}
function yy_r3_23()
function yy_r3_24()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
}
function yy_r3_26()
function yy_r3_27()
{
$this->token = Smarty_Internal_Templateparser::TP_NOT;
}
function yy_r3_29()
function yy_r3_30()
{
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
}
function yy_r3_33()
function yy_r3_34()
{
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
}
function yy_r3_34()
function yy_r3_35()
{
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
}
function yy_r3_35()
function yy_r3_36()
{
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
}
function yy_r3_36()
function yy_r3_37()
{
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
}
function yy_r3_37()
function yy_r3_38()
{
$this->token = Smarty_Internal_Templateparser::TP_PTR;
}
function yy_r3_38()
function yy_r3_39()
{
$this->token = Smarty_Internal_Templateparser::TP_APTR;
}
function yy_r3_39()
function yy_r3_40()
{
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
}
function yy_r3_40()
function yy_r3_41()
{
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
}
function yy_r3_42()
function yy_r3_43()
{
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
}
function yy_r3_44()
function yy_r3_45()
{
$this->token = Smarty_Internal_Templateparser::TP_MATH;
}
function yy_r3_46()
function yy_r3_47()
{
$this->token = Smarty_Internal_Templateparser::TP_AT;
}
function yy_r3_47()
function yy_r3_48()
{
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
function yy_r3_48()
function yy_r3_49()
{
// resolve conflicts with shorttag and right_delimiter starting with '='
@@ -794,96 +806,83 @@ class Smarty_Internal_Templatelexer
}
}
function yy_r3_49()
function yy_r3_50()
{
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
}
function yy_r3_52()
function yy_r3_53()
{
$this->token = Smarty_Internal_Templateparser::TP_ID;
}
function yy_r3_53()
function yy_r3_54()
{
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
}
function yy_r3_54()
function yy_r3_55()
{
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate();
}
function yy_r3_55()
function yy_r3_56()
{
$this->token = Smarty_Internal_Templateparser::TP_VERT;
}
function yy_r3_56()
function yy_r3_57()
{
$this->token = Smarty_Internal_Templateparser::TP_DOT;
}
function yy_r3_57()
function yy_r3_58()
{
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
}
function yy_r3_58()
function yy_r3_59()
{
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
}
function yy_r3_59()
function yy_r3_60()
{
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
}
function yy_r3_60()
function yy_r3_61()
{
$this->token = Smarty_Internal_Templateparser::TP_COLON;
}
function yy_r3_61()
function yy_r3_62()
{
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
}
function yy_r3_62()
function yy_r3_63()
{
$this->token = Smarty_Internal_Templateparser::TP_HEX;
}
function yy_r3_63()
{
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
function yy_r3_64()
{
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->yypushstate(self::TAG);
return true;
}
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
function yy_r3_65()