11/06/2010

- bugfix the lexer did fail on larger {literal} ... {/literal} sections
This commit is contained in:
Uwe.Tews
2010-06-11 13:01:36 +00:00
parent 968deec9a4
commit 538708d344
2 changed files with 18 additions and 9 deletions

View File

@@ -1,3 +1,6 @@
11/06/2010
- bugfix the lexer did fail on larger {literal} ... {/literal} sections
03/06/2010 03/06/2010
- bugfix on calling template functions like Smarty tags - bugfix on calling template functions like Smarty tags

View File

@@ -842,13 +842,14 @@ class Smarty_Internal_Templatelexer
2 => 0, 2 => 0,
3 => 0, 3 => 0,
4 => 0, 4 => 0,
5 => 2, 5 => 0,
8 => 0, 6 => 2,
9 => 0,
); );
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
} }
$yy_global_pattern = "/^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\/literal".$this->rdel.")|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(([\S\s]*?)(?=(".$this->ldel."\/?literal".$this->rdel."|<\\?)))|^([\S\s]+)/"; $yy_global_pattern = "/^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\/literal".$this->rdel.")|^([\t ]*[\r\n]+[\t ]*)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."\/?literal".$this->rdel."|<\\?)))|^([\S\s]+)/";
do { do {
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) { if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
@@ -913,24 +914,29 @@ class Smarty_Internal_Templatelexer
function yy_r3_3($yy_subpatterns) function yy_r3_3($yy_subpatterns)
{ {
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
}
function yy_r3_4($yy_subpatterns)
{
if (in_array($this->value, Array('<?', '<?=', '<?php'))) { if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
$this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG; $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG; $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
$this->value = substr($this->value, 0, 2); $this->value = substr($this->value, 0, 2);
} }
}
function yy_r3_4($yy_subpatterns)
{
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} }
function yy_r3_5($yy_subpatterns) function yy_r3_5($yy_subpatterns)
{ {
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} }
function yy_r3_8($yy_subpatterns) function yy_r3_6($yy_subpatterns)
{
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
}
function yy_r3_9($yy_subpatterns)
{ {
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag"); $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");