mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- improvement remove not needed ?><?php transitions from compiled code
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.24.dev ===== (xx.xx.2015)
|
||||
13.05.2015
|
||||
- improvement remove not needed ?><?php transitions from compiled code
|
||||
|
||||
12.05.2015
|
||||
- bugfix {$smarty.constant.TEST} did fail on undefined constant https://github.com/smarty-php/smarty/issues/28
|
||||
- bugfix access to undefined config variable like {#undef#} did fail https://github.com/smarty-php/smarty/issues/29
|
||||
- bugfix in nested {foreach} saved item attributes got overwritten https://github.com/smarty-php/smarty/issues/33
|
||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.24-dev/2';
|
||||
const SMARTY_VERSION = '3.1.24-dev/3';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
@@ -155,22 +155,23 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
|
||||
} else {
|
||||
$tmp = '';
|
||||
foreach ($compiler->prefix_code as $code) {
|
||||
$tmp .= $code;
|
||||
}
|
||||
$tmp = $compiler->appendCode($tmp, $code);
|
||||
}
|
||||
$compiler->prefix_code = array();
|
||||
$tmp = $compiler->appendCode("<?php } else {?>", $tmp);
|
||||
$this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
|
||||
if ($condition_by_assign) {
|
||||
if (is_array($parameter['if condition']['var'])) {
|
||||
$_output = "<?php } else {?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
|
||||
$_output = $compiler->appendCode($tmp, "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n");
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . ") {?>";
|
||||
} else {
|
||||
$_output = "<?php } else {?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output = $compiler->appendCode($tmp, "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});");
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
} else {
|
||||
return "<?php } else {?>{$tmp}<?php if ({$parameter['if condition']}) {?>";
|
||||
return $compiler->appendCode($tmp, "<?php if ({$parameter['if condition']}) {?>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@
|
||||
/**
|
||||
* Class Smarty_Internal_Extension_CodeFrame
|
||||
* Create code frame for compiled and cached templates
|
||||
|
||||
*/
|
||||
class Smarty_Internal_Extension_CodeFrame
|
||||
{
|
||||
@@ -78,11 +77,19 @@ class Smarty_Internal_Extension_CodeFrame
|
||||
$output .= "?>/*/%%SmartyNocache:{$_template->properties['nocache_hash']}%%*/';\n";
|
||||
}
|
||||
}
|
||||
$output .= "?>\n" . $content;
|
||||
$output .= "<?php }\n}\n?>";
|
||||
return $output;
|
||||
$output .= "?>\n";
|
||||
$output = self::appendCode($output, $content);
|
||||
return self::appendCode($output, "<?php }\n}\n?>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create code frame of compiled template function
|
||||
*
|
||||
* @param \Smarty_Internal_Template $_template
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function createFunctionFrame(Smarty_Internal_Template $_template, $content = '')
|
||||
{
|
||||
if (!isset($_template->properties['unifunc'])) {
|
||||
@@ -98,4 +105,23 @@ class Smarty_Internal_Extension_CodeFrame
|
||||
$output .= "}\n}\n?>";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append code segments and remove unneeded ?> <?php transitions
|
||||
*
|
||||
* @param string $left
|
||||
* @param string $right
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function appendCode($left, $right)
|
||||
{
|
||||
if (preg_match('/\s*\?>$/', $left) && preg_match('/^<\?php\s+/', $right)) {
|
||||
$left = preg_replace('/\s*\?>$/', "\n", $left);
|
||||
$left .= preg_replace('/^<\?php\s+/', '', $right);
|
||||
} else {
|
||||
$left .= $right;
|
||||
}
|
||||
return $left;
|
||||
}
|
||||
}
|
@@ -16,12 +16,14 @@
|
||||
*/
|
||||
abstract class Smarty_Internal_ParseTree
|
||||
{
|
||||
|
||||
/**
|
||||
* Parser object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
public $parser;
|
||||
|
||||
/**
|
||||
* Buffer content
|
||||
*
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Templateparser Parsetrees
|
||||
* These are classes to build parsetrees in the template parser
|
||||
* Smarty Internal Plugin Templateparser Parse Tree
|
||||
* These are classes to build parse trees in the template parser
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
|
@@ -7,6 +7,7 @@
|
||||
* @subpackage Compiler
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
/**
|
||||
* Double quoted string inside a tag.
|
||||
*
|
||||
@@ -19,8 +20,8 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
|
||||
/**
|
||||
* Create parse tree buffer for double quoted string subtrees
|
||||
*
|
||||
* @param object $parser parser object
|
||||
* @param Smarty_Internal_ParseTree $subtree parsetree buffer
|
||||
* @param object $parser parser object
|
||||
* @param Smarty_Internal_ParseTree $subtree parse tree buffer
|
||||
*/
|
||||
public function __construct($parser, Smarty_Internal_ParseTree $subtree)
|
||||
{
|
||||
@@ -34,18 +35,18 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
|
||||
/**
|
||||
* Append buffer to subtree
|
||||
*
|
||||
* @param Smarty_Internal_ParseTree $subtree parsetree buffer
|
||||
* @param Smarty_Internal_ParseTree $subtree parse tree buffer
|
||||
*/
|
||||
public function append_subtree(Smarty_Internal_ParseTree $subtree)
|
||||
{
|
||||
$last_subtree = count($this->subtrees) - 1;
|
||||
if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof Smarty_Internal_ParseTree_Tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {
|
||||
if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
|
||||
$this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';
|
||||
$this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo ' . $subtree->data . ';?>');
|
||||
} elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
|
||||
$this->subtrees[$last_subtree]->data .= '<?php echo "' . $subtree->data . '";?>';
|
||||
$this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo "' . $subtree->data . '";?>');
|
||||
} else {
|
||||
$this->subtrees[$last_subtree]->data .= $subtree->data;
|
||||
$this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, $subtree->data);
|
||||
}
|
||||
} else {
|
||||
$this->subtrees[] = $subtree;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Templateparser Parsetrees
|
||||
* These are classes to build parsetrees in the template parser
|
||||
* Smarty Internal Plugin Templateparser Parse Tree
|
||||
* These are classes to build parse tree in the template parser
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
@@ -9,7 +9,6 @@
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Raw chars as part of a double quoted string.
|
||||
*
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Templateparser Parsetrees
|
||||
* These are classes to build parsetrees in the template parser
|
||||
* Smarty Internal Plugin Templateparser Parse Tree
|
||||
* These are classes to build parse tree in the template parser
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree
|
||||
{
|
||||
|
||||
/**
|
||||
* Saved block nesting level
|
||||
*
|
||||
@@ -56,7 +57,9 @@ class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree
|
||||
public function assign_to_var()
|
||||
{
|
||||
$var = sprintf('$_tmp%d', ++ Smarty_Internal_Templateparser::$prefix_number);
|
||||
$this->parser->compiler->prefix_code[] = sprintf("<?php ob_start();?>%s<?php %s=ob_get_clean();?>", $this->data, $var);
|
||||
$tmp = $this->parser->compiler->appendCode('<?php ob_start();?>', $this->data);
|
||||
$tmp = $this->parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
|
||||
$this->parser->compiler->prefix_code[] = sprintf("%s", $tmp);
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Templateparser Parsetrees
|
||||
* These are classes to build parsetrees in the template parser
|
||||
* Smarty Internal Plugin Templateparser Parse Tree
|
||||
* These are classes to build parse tree in the template parser
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
|
||||
{
|
||||
|
||||
/**
|
||||
* Array of template elements
|
||||
*
|
||||
@@ -44,8 +45,10 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
|
||||
{
|
||||
if (!empty($subtree->subtrees)) {
|
||||
$this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
|
||||
} else if ($subtree->data !== '') {
|
||||
$this->subtrees[] = $subtree;
|
||||
} else {
|
||||
if ($subtree->data !== '') {
|
||||
$this->subtrees[] = $subtree;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,13 +83,7 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
|
||||
if ($this->subtrees[$key]->data == '') {
|
||||
continue;
|
||||
}
|
||||
$newCode = $this->subtrees[$key]->to_smarty_php();
|
||||
if ((preg_match('/^\s*<\?php\s+/', $newCode) && preg_match('/\s*\?>\s*$/', $subtree))) {
|
||||
$subtree = preg_replace('/\s*\?>\s*$/', "\n", $subtree);
|
||||
$subtree .= preg_replace('/^\s*<\?php\s+/', '', $newCode);
|
||||
} else {
|
||||
$subtree .= $newCode;
|
||||
}
|
||||
$subtree = $this->parser->compiler->appendCode($subtree, $this->subtrees[$key]->to_smarty_php());
|
||||
}
|
||||
if ($subtree == '') {
|
||||
continue;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Templateparser Parsetrees
|
||||
* These are classes to build parsetrees in the template parser
|
||||
* Smarty Internal Plugin Templateparser Parse Tree
|
||||
* These are classes to build parse tree in the template parser
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
|
@@ -19,176 +19,147 @@
|
||||
*/
|
||||
class Smarty_Internal_Templatelexer
|
||||
{
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* byte counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $counter;
|
||||
|
||||
/**
|
||||
* token number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* token value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* current line
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $line;
|
||||
|
||||
/**
|
||||
* tag start line
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
public $taglineno;
|
||||
|
||||
/**
|
||||
* flag if parsing php script
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $is_phpScript = false;
|
||||
|
||||
/**
|
||||
* php code type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $phpType = '';
|
||||
|
||||
/**
|
||||
* escaped left delimiter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ldel = '';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public $state = 1;
|
||||
|
||||
/**
|
||||
* Smarty object
|
||||
*
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty = null;
|
||||
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_TemplateCompilerBase
|
||||
*/
|
||||
private $compiler = null;
|
||||
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $literal_cnt = 0;
|
||||
|
||||
/**
|
||||
* trace file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
public $yyTraceFILE;
|
||||
|
||||
/**
|
||||
* trace prompt
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $yyTracePrompt;
|
||||
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY');
|
||||
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
'IDENTITY' => '===',
|
||||
'NONEIDENTITY' => '!==',
|
||||
'EQUALS' => '==',
|
||||
'NOTEQUALS' => '!=',
|
||||
'GREATEREQUAL' => '(>=,ge)',
|
||||
'LESSEQUAL' => '(<=,le)',
|
||||
'GREATERTHAN' => '(>,gt)',
|
||||
'LESSTHAN' => '(<,lt)',
|
||||
'MOD' => '(%,mod)',
|
||||
'NOT' => '(!,not)',
|
||||
'LAND' => '(&&,and)',
|
||||
'LOR' => '(||,or)',
|
||||
'LXOR' => 'xor',
|
||||
'OPENP' => '(',
|
||||
'CLOSEP' => ')',
|
||||
'OPENB' => '[',
|
||||
'CLOSEB' => ']',
|
||||
'PTR' => '->',
|
||||
'APTR' => '=>',
|
||||
'EQUAL' => '=',
|
||||
'NUMBER' => 'number',
|
||||
'UNIMATH' => '+" , "-',
|
||||
'MATH' => '*" , "/" , "%',
|
||||
'INCDEC' => '++" , "--',
|
||||
'SPACE' => ' ',
|
||||
'DOLLAR' => '$',
|
||||
'SEMICOLON' => ';',
|
||||
'COLON' => ':',
|
||||
'DOUBLECOLON' => '::',
|
||||
'AT' => '@',
|
||||
'HATCH' => '#',
|
||||
'QUOTE' => '"',
|
||||
'BACKTICK' => '`',
|
||||
'VERT' => '|',
|
||||
'DOT' => '.',
|
||||
'COMMA' => '","',
|
||||
'ANDSYM' => '"&"',
|
||||
'QMARK' => '"?"',
|
||||
'ID' => 'identifier',
|
||||
'TEXT' => 'text',
|
||||
'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
|
||||
'PHPSTARTTAG' => 'PHP start tag',
|
||||
'PHPENDTAG' => 'PHP end tag',
|
||||
'LITERALSTART' => 'Literal start',
|
||||
'LITERALEND' => 'Literal end',
|
||||
'LDELSLASH' => 'closing tag',
|
||||
'COMMENT' => 'comment',
|
||||
'AS' => 'as',
|
||||
'TO' => 'to',
|
||||
);
|
||||
'IDENTITY' => '===', 'NONEIDENTITY' => '!==', 'EQUALS' => '==', 'NOTEQUALS' => '!=', 'GREATEREQUAL' => '(>=,ge)', 'LESSEQUAL' => '(<=,le)', 'GREATERTHAN' => '(>,gt)', 'LESSTHAN' => '(<,lt)', 'MOD' => '(%,mod)', 'NOT' => '(!,not)', 'LAND' => '(&&,and)', 'LOR' => '(||,or)', 'LXOR' => 'xor', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=', 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%', 'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$', 'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@', 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', 'VERT' => '|', 'DOT' => '.', 'COMMA' => '","', 'ANDSYM' => '"&"', 'QMARK' => '"?"', 'ID' => 'identifier', 'TEXT' => 'text', 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', 'PHPSTARTTAG' => 'PHP start tag', 'PHPENDTAG' => 'PHP end tag', 'LITERALSTART' => 'Literal start', 'LITERALEND' => 'Literal end', 'LDELSLASH' => 'closing tag', 'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -221,6 +192,7 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
|
||||
private $_yy_state = 1;
|
||||
|
||||
private $_yy_stack = array();
|
||||
|
||||
public function yylex()
|
||||
@@ -261,27 +233,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex1()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
4 => 0,
|
||||
5 => 0,
|
||||
6 => 0,
|
||||
7 => 1,
|
||||
9 => 0,
|
||||
10 => 0,
|
||||
11 => 0,
|
||||
12 => 6,
|
||||
19 => 0,
|
||||
20 => 0,
|
||||
21 => 0,
|
||||
22 => 1,
|
||||
24 => 6,
|
||||
31 => 7,
|
||||
39 => 6,
|
||||
46 => 3,
|
||||
50 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 1, 9 => 0, 10 => 0, 11 => 0, 12 => 6, 19 => 0, 20 => 0, 21 => 0, 22 => 1, 24 => 6, 31 => 7, 39 => 6, 46 => 3, 50 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -292,16 +244,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state TEXT');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TEXT');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -326,8 +275,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -521,75 +469,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex2()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 1,
|
||||
5 => 0,
|
||||
6 => 0,
|
||||
7 => 0,
|
||||
8 => 0,
|
||||
9 => 0,
|
||||
10 => 0,
|
||||
11 => 0,
|
||||
12 => 0,
|
||||
13 => 0,
|
||||
14 => 0,
|
||||
15 => 1,
|
||||
17 => 1,
|
||||
19 => 1,
|
||||
21 => 0,
|
||||
22 => 0,
|
||||
23 => 0,
|
||||
24 => 0,
|
||||
25 => 0,
|
||||
26 => 0,
|
||||
27 => 0,
|
||||
28 => 0,
|
||||
29 => 0,
|
||||
30 => 0,
|
||||
31 => 0,
|
||||
32 => 0,
|
||||
33 => 0,
|
||||
34 => 0,
|
||||
35 => 0,
|
||||
36 => 0,
|
||||
37 => 0,
|
||||
38 => 3,
|
||||
42 => 0,
|
||||
43 => 0,
|
||||
44 => 0,
|
||||
45 => 0,
|
||||
46 => 0,
|
||||
47 => 0,
|
||||
48 => 0,
|
||||
49 => 0,
|
||||
50 => 1,
|
||||
52 => 1,
|
||||
54 => 0,
|
||||
55 => 0,
|
||||
56 => 0,
|
||||
57 => 2,
|
||||
60 => 0,
|
||||
61 => 0,
|
||||
62 => 0,
|
||||
63 => 0,
|
||||
64 => 0,
|
||||
65 => 0,
|
||||
66 => 0,
|
||||
67 => 0,
|
||||
68 => 0,
|
||||
69 => 0,
|
||||
70 => 0,
|
||||
71 => 0,
|
||||
72 => 0,
|
||||
73 => 1,
|
||||
75 => 0,
|
||||
76 => 0,
|
||||
77 => 0,
|
||||
78 => 0,
|
||||
79 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 0, 3 => 1, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 1, 17 => 1, 19 => 1, 21 => 0, 22 => 0, 23 => 0, 24 => 0, 25 => 0, 26 => 0, 27 => 0, 28 => 0, 29 => 0, 30 => 0, 31 => 0, 32 => 0, 33 => 0, 34 => 0, 35 => 0, 36 => 0, 37 => 0, 38 => 3, 42 => 0, 43 => 0, 44 => 0, 45 => 0, 46 => 0, 47 => 0, 48 => 0, 49 => 0, 50 => 1, 52 => 1, 54 => 0, 55 => 0, 56 => 0, 57 => 2, 60 => 0, 61 => 0, 62 => 0, 63 => 0, 64 => 0, 65 => 0, 66 => 0, 67 => 0, 68 => 0, 69 => 0, 70 => 0, 71 => 0, 72 => 0, 73 => 1, 75 => 0, 76 => 0, 77 => 0, 78 => 0, 79 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -600,16 +480,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state SMARTY');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state SMARTY');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -634,8 +511,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -1088,11 +964,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex3()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 0, 3 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -1103,16 +975,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state LITERAL');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state LITERAL');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -1137,8 +1006,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -1181,21 +1049,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex4()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 1,
|
||||
3 => 0,
|
||||
4 => 0,
|
||||
5 => 0,
|
||||
6 => 0,
|
||||
7 => 0,
|
||||
8 => 0,
|
||||
9 => 0,
|
||||
10 => 0,
|
||||
11 => 0,
|
||||
12 => 0,
|
||||
13 => 3,
|
||||
17 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 1, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, 13 => 3, 17 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -1206,16 +1060,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -1240,8 +1091,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -1365,12 +1215,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex5()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
4 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 0, 3 => 0, 4 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -1381,16 +1226,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state CHILDBODY');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBODY');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -1415,8 +1257,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -1469,13 +1310,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex6()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
4 => 1,
|
||||
6 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 0, 3 => 0, 4 => 1, 6 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -1486,16 +1321,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state CHILDBLOCK');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBLOCK');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -1520,8 +1352,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
@@ -1587,11 +1418,7 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
public function yylex7()
|
||||
{
|
||||
$tokenMap = array(
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
);
|
||||
$tokenMap = array(1 => 0, 2 => 0, 3 => 0,);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
@@ -1602,16 +1429,13 @@ class Smarty_Internal_Templatelexer
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state CHILDLITERAL');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDLITERAL');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1, $tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
@@ -1636,8 +1460,7 @@ class Smarty_Internal_Templatelexer
|
||||
continue;
|
||||
}
|
||||
} 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;
|
||||
} while (true);
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user