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

View File

@@ -205,7 +205,7 @@ class Smarty_Internal_Templatelexer
$this->data = $data; $this->data = $data;
$this->counter = 0; $this->counter = 0;
if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) { if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) {
$this->counter += strlen($match[0]); $this->counter += strlen($match[ 0 ]);
} }
$this->line = 1; $this->line = 1;
$this->smarty = $compiler->smarty; $this->smarty = $compiler->smarty;
@@ -214,8 +214,8 @@ class Smarty_Internal_Templatelexer
$this->ldel_length = strlen($this->smarty->left_delimiter); $this->ldel_length = strlen($this->smarty->left_delimiter);
$this->rdel = preg_quote($this->smarty->right_delimiter, '~'); $this->rdel = preg_quote($this->smarty->right_delimiter, '~');
$this->rdel_length = strlen($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[ 'LDEL' ] = $this->smarty->left_delimiter;
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter; $this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter;
} }
public function PrintTrace() public function PrintTrace()
@@ -229,8 +229,8 @@ class Smarty_Internal_Templatelexer
*/ */
public function isAutoLiteral() public function isAutoLiteral()
{ {
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false; strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false;
} }
private $_yy_state = 1; private $_yy_state = 1;
@@ -246,14 +246,14 @@ class Smarty_Internal_Templatelexer
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state); $this->_yy_state);
} }
array_push($this->_yy_stack, $this->_yy_state); array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state); $this->_yy_state);
} }
} }
@@ -262,13 +262,13 @@ class Smarty_Internal_Templatelexer
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state); $this->_yy_state);
} }
$this->_yy_state = array_pop($this->_yy_stack); $this->_yy_state = array_pop($this->_yy_stack);
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state); $this->_yy_state);
} }
} }
@@ -278,7 +278,7 @@ class Smarty_Internal_Templatelexer
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
$this->_yy_state); $this->_yy_state);
} }
} }
@@ -299,7 +299,7 @@ class Smarty_Internal_Templatelexer
do { do {
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches; $yysubmatches = $yymatches;
if (strlen($yysubmatches[0]) < 200) { if (strlen($yysubmatches[ 0 ]) < 200) {
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches); $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
} else { } else {
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
@@ -331,7 +331,7 @@ class Smarty_Internal_Templatelexer
continue; continue;
} }
} else { } else {
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
} }
break; break;
} while (true); } while (true);
@@ -349,8 +349,8 @@ class Smarty_Internal_Templatelexer
{ {
preg_match("~[*]{$this->rdel}~", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); preg_match("~[*]{$this->rdel}~", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[0][1])) { if (isset($match[ 0 ][ 1 ])) {
$to = $match[0][1] + strlen($match[0][0]); $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
} else { } 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->right_delimiter}'");
} }
@@ -368,8 +368,8 @@ class Smarty_Internal_Templatelexer
function yy_r1_7() function yy_r1_7()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
) { ) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
@@ -381,8 +381,8 @@ class Smarty_Internal_Templatelexer
function yy_r1_8() function yy_r1_8()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
) { ) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
@@ -410,8 +410,8 @@ class Smarty_Internal_Templatelexer
$to = strlen($this->data); $to = strlen($this->data);
preg_match("~($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])~i", preg_match("~($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])~i",
$this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[0][1])) { if (isset($match[ 0 ][ 1 ])) {
$to = $match[0][1]; $to = $match[ 0 ][ 1 ];
} }
$this->value = substr($this->data, $this->counter, $to - $this->counter); $this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
@@ -435,7 +435,7 @@ class Smarty_Internal_Templatelexer
do { do {
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches; $yysubmatches = $yymatches;
if (strlen($yysubmatches[0]) < 200) { if (strlen($yysubmatches[ 0 ]) < 200) {
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches); $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
} else { } else {
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
@@ -467,7 +467,7 @@ class Smarty_Internal_Templatelexer
continue; continue;
} }
} else { } else {
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
} }
break; break;
} while (true); } while (true);
@@ -526,7 +526,7 @@ class Smarty_Internal_Templatelexer
function yy_r2_9() function yy_r2_9()
{ {
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->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
$this->taglineno = $this->line; $this->taglineno = $this->line;
@@ -557,9 +557,8 @@ class Smarty_Internal_Templatelexer
public function yylex3() public function yylex3()
{ {
if (!isset($this->yy_global_pattern3)) { if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel .
")|\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*)|\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";
$this->ldel . "\\s*)|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -568,7 +567,7 @@ class Smarty_Internal_Templatelexer
do { do {
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches; $yysubmatches = $yymatches;
if (strlen($yysubmatches[0]) < 200) { if (strlen($yysubmatches[ 0 ]) < 200) {
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches); $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
} else { } else {
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
@@ -600,7 +599,7 @@ class Smarty_Internal_Templatelexer
continue; continue;
} }
} else { } else {
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
} }
break; break;
} while (true); } while (true);
@@ -618,168 +617,181 @@ class Smarty_Internal_Templatelexer
function yy_r3_2() function yy_r3_2()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
$this->yypushstate(self::DOUBLEQUOTEDSTRING); 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() 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() function yy_r3_4()
{
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
}
function yy_r3_5()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r3_6() function yy_r3_7()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID; $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
} }
function yy_r3_7() function yy_r3_8()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR; $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
} }
function yy_r3_8() function yy_r3_9()
{ {
$this->token = Smarty_Internal_Templateparser::TP_ISIN; $this->token = Smarty_Internal_Templateparser::TP_ISIN;
} }
function yy_r3_9() function yy_r3_10()
{ {
$this->token = Smarty_Internal_Templateparser::TP_AS; $this->token = Smarty_Internal_Templateparser::TP_AS;
} }
function yy_r3_10() function yy_r3_11()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TO; $this->token = Smarty_Internal_Templateparser::TP_TO;
} }
function yy_r3_11() function yy_r3_12()
{ {
$this->token = Smarty_Internal_Templateparser::TP_STEP; $this->token = Smarty_Internal_Templateparser::TP_STEP;
} }
function yy_r3_12() function yy_r3_13()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
} }
function yy_r3_13() function yy_r3_14()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LOGOP; $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
} }
function yy_r3_18() function yy_r3_19()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP; $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
} }
function yy_r3_23() function yy_r3_24()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
} }
function yy_r3_26() function yy_r3_27()
{ {
$this->token = Smarty_Internal_Templateparser::TP_NOT; $this->token = Smarty_Internal_Templateparser::TP_NOT;
} }
function yy_r3_29() function yy_r3_30()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST; $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
} }
function yy_r3_33() function yy_r3_34()
{ {
$this->token = Smarty_Internal_Templateparser::TP_OPENP; $this->token = Smarty_Internal_Templateparser::TP_OPENP;
} }
function yy_r3_34() function yy_r3_35()
{ {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP; $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
} }
function yy_r3_35() function yy_r3_36()
{ {
$this->token = Smarty_Internal_Templateparser::TP_OPENB; $this->token = Smarty_Internal_Templateparser::TP_OPENB;
} }
function yy_r3_36() function yy_r3_37()
{ {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB; $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
} }
function yy_r3_37() function yy_r3_38()
{ {
$this->token = Smarty_Internal_Templateparser::TP_PTR; $this->token = Smarty_Internal_Templateparser::TP_PTR;
} }
function yy_r3_38() function yy_r3_39()
{ {
$this->token = Smarty_Internal_Templateparser::TP_APTR; $this->token = Smarty_Internal_Templateparser::TP_APTR;
} }
function yy_r3_39() function yy_r3_40()
{ {
$this->token = Smarty_Internal_Templateparser::TP_EQUAL; $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
} }
function yy_r3_40() function yy_r3_41()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INCDEC; $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
} }
function yy_r3_42() function yy_r3_43()
{ {
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH; $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
} }
function yy_r3_44() function yy_r3_45()
{ {
$this->token = Smarty_Internal_Templateparser::TP_MATH; $this->token = Smarty_Internal_Templateparser::TP_MATH;
} }
function yy_r3_46() function yy_r3_47()
{ {
$this->token = Smarty_Internal_Templateparser::TP_AT; $this->token = Smarty_Internal_Templateparser::TP_AT;
} }
function yy_r3_47() function yy_r3_48()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HATCH; $this->token = Smarty_Internal_Templateparser::TP_HATCH;
} }
function yy_r3_48() function yy_r3_49()
{ {
// resolve conflicts with shorttag and right_delimiter starting with '=' // resolve conflicts with shorttag and right_delimiter starting with '='
@@ -787,103 +799,90 @@ class Smarty_Internal_Templatelexer
$this->smarty->right_delimiter $this->smarty->right_delimiter
) { ) {
preg_match("~\s+~", $this->value, $match); preg_match("~\s+~", $this->value, $match);
$this->value = $match[0]; $this->value = $match[ 0 ];
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = Smarty_Internal_Templateparser::TP_SPACE;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_ATTR; $this->token = Smarty_Internal_Templateparser::TP_ATTR;
} }
} }
function yy_r3_49() function yy_r3_50()
{ {
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
} }
function yy_r3_52() function yy_r3_53()
{ {
$this->token = Smarty_Internal_Templateparser::TP_ID; $this->token = Smarty_Internal_Templateparser::TP_ID;
} }
function yy_r3_53() function yy_r3_54()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INTEGER; $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
} }
function yy_r3_54() function yy_r3_55()
{ {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r3_55() function yy_r3_56()
{ {
$this->token = Smarty_Internal_Templateparser::TP_VERT; $this->token = Smarty_Internal_Templateparser::TP_VERT;
} }
function yy_r3_56() function yy_r3_57()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOT; $this->token = Smarty_Internal_Templateparser::TP_DOT;
} }
function yy_r3_57() function yy_r3_58()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COMMA; $this->token = Smarty_Internal_Templateparser::TP_COMMA;
} }
function yy_r3_58() function yy_r3_59()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
} }
function yy_r3_59() function yy_r3_60()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
} }
function yy_r3_60() function yy_r3_61()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COLON; $this->token = Smarty_Internal_Templateparser::TP_COLON;
} }
function yy_r3_61() function yy_r3_62()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QMARK; $this->token = Smarty_Internal_Templateparser::TP_QMARK;
} }
function yy_r3_62() function yy_r3_63()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HEX; $this->token = Smarty_Internal_Templateparser::TP_HEX;
} }
function yy_r3_63()
{
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
function yy_r3_64() function yy_r3_64()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? $this->token = Smarty_Internal_Templateparser::TP_SPACE;
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_65() function yy_r3_65()
@@ -906,7 +905,7 @@ class Smarty_Internal_Templatelexer
do { do {
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches; $yysubmatches = $yymatches;
if (strlen($yysubmatches[0]) < 200) { if (strlen($yysubmatches[ 0 ]) < 200) {
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches); $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
} else { } else {
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
@@ -938,7 +937,7 @@ class Smarty_Internal_Templatelexer
continue; continue;
} }
} else { } else {
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
} }
break; break;
} while (true); } while (true);
@@ -971,8 +970,8 @@ class Smarty_Internal_Templatelexer
$to = strlen($this->data); $to = strlen($this->data);
preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i", $this->data, $match, PREG_OFFSET_CAPTURE, preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i", $this->data, $match, PREG_OFFSET_CAPTURE,
$this->counter); $this->counter);
if (isset($match[0][1])) { if (isset($match[ 0 ][ 1 ])) {
$to = $match[0][1]; $to = $match[ 0 ][ 1 ];
} else { } else {
$this->compiler->trigger_template_error("missing or misspelled literal closing tag"); $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
} }
@@ -997,7 +996,7 @@ class Smarty_Internal_Templatelexer
do { do {
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches; $yysubmatches = $yymatches;
if (strlen($yysubmatches[0]) < 200) { if (strlen($yysubmatches[ 0 ]) < 200) {
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches); $yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
} else { } else {
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
@@ -1029,7 +1028,7 @@ class Smarty_Internal_Templatelexer
continue; continue;
} }
} else { } else {
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[$this->counter]); throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
} }
break; break;
} while (true); } while (true);
@@ -1052,8 +1051,8 @@ class Smarty_Internal_Templatelexer
function yy_r5_3() function yy_r5_3()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
) { ) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
@@ -1065,8 +1064,8 @@ class Smarty_Internal_Templatelexer
function yy_r5_4() function yy_r5_4()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
) { ) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
@@ -1078,8 +1077,8 @@ class Smarty_Internal_Templatelexer
function yy_r5_5() function yy_r5_5()
{ {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
) { ) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {