diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex index a74c4038..3c6d9ca9 100644 --- a/lexer/smarty_internal_templatelexer.plex +++ b/lexer/smarty_internal_templatelexer.plex @@ -260,7 +260,8 @@ class Smarty_Internal_Templatelexer namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~ all = ~[\S\s]+~ emptyjava = ~[{][}]~ - phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|()|([?][>])|([%][>])|(SMARTYldel\s*php(.*?)SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~ + phptag = ~(SMARTYldel\s*php(.*?)SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~ + phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|()|([?][>])|([%][>])~ slash = ~[/]~ ldel = ~SMARTYldel\s*~ rdel = ~\s*SMARTYrdel~ @@ -331,6 +332,10 @@ class Smarty_Internal_Templatelexer $this->value = substr($this->data,$this->counter,$to-$this->counter); return false; } + phptag { + $obj = new Smarty_Internal_Compile_Private_Php(); + $obj->parsePhp($this); + } ldel literal rdel { 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; diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 701d7b7d..1e6d03fa 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -277,7 +277,7 @@ class Smarty_Internal_Templatelexer public function yylex1() { if (!isset($this->yy_global_pattern1)) { - $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|()|([?][>])|([%][>])|(" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G([\S\s])/isS"; + $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|()|([?][>])|([%][>]))|\G([\S\s])/isS"; } if ($this->counter >= strlen($this->data)) { return false; // end of input @@ -345,6 +345,13 @@ class Smarty_Internal_Templatelexer } function yy_r1_3() + { + + $obj = new Smarty_Internal_Compile_Private_Php(); + $obj->parsePhp($this); + } + + function yy_r1_7() { if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { @@ -355,7 +362,7 @@ class Smarty_Internal_Templatelexer } } - function yy_r1_4() + function yy_r1_8() { if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { @@ -366,20 +373,20 @@ class Smarty_Internal_Templatelexer } } - function yy_r1_5() + function yy_r1_9() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_6() + function yy_r1_10() { $obj = new Smarty_Internal_Compile_Private_Php(); $obj->parsePhp($this); } - function yy_r1_18() + function yy_r1_19() { $to = strlen($this->data);