mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
lexer/parser optimization
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== 3.1.32 - dev ===
|
||||
05.11.2017 3.1.32-dev-32
|
||||
- lexer/parser optimization
|
||||
|
||||
26.10.2017 3.1.32-dev-28
|
||||
- bugfix Smarty version was not filled in header comment of compiled and cached files
|
||||
- optimization replace internal Smarty::$ds property by DIRECTORY_SEPARATOR
|
||||
|
@@ -235,7 +235,7 @@ double_quoted_string {
|
||||
$this->yypopstate();
|
||||
}
|
||||
maybe_bool {
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) {
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||
return true; //reprocess in new state
|
||||
@@ -250,7 +250,7 @@ naked_string {
|
||||
}
|
||||
newline {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->value = "";
|
||||
$this->value = '';
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ text {
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
|
||||
$this->compiler->trigger_template_error ('missing or misspelled literal closing tag');
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
|
||||
|
@@ -80,7 +80,7 @@ class Smarty_Internal_Configfileparser
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $escapes_single = Array('\\' => '\\',
|
||||
private static $escapes_single = array('\\' => '\\',
|
||||
'\'' => '\'');
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ class Smarty_Internal_Configfileparser
|
||||
|
||||
$ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
$str = "";
|
||||
$str = '';
|
||||
foreach ($ss as $s) {
|
||||
if (strlen($s) === 2 && $s[0] === '\\') {
|
||||
if (isset(self::$escapes_single[$s[1]])) {
|
||||
@@ -174,10 +174,10 @@ class Smarty_Internal_Configfileparser
|
||||
* @param array $var
|
||||
* @param array $target_array
|
||||
*/
|
||||
private function set_var(Array $var, Array &$target_array)
|
||||
private function set_var(array $var, array &$target_array)
|
||||
{
|
||||
$key = $var["key"];
|
||||
$value = $var["value"];
|
||||
$key = $var['key'];
|
||||
$value = $var['value'];
|
||||
|
||||
if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
|
||||
$target_array['vars'][$key] = $value;
|
||||
@@ -192,10 +192,10 @@ class Smarty_Internal_Configfileparser
|
||||
*
|
||||
* @param array $vars
|
||||
*/
|
||||
private function add_global_vars(Array $vars)
|
||||
private function add_global_vars(array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['vars'])) {
|
||||
$this->compiler->config_data['vars'] = Array();
|
||||
$this->compiler->config_data['vars'] = array();
|
||||
}
|
||||
foreach ($vars as $var) {
|
||||
$this->set_var($var, $this->compiler->config_data);
|
||||
@@ -208,10 +208,10 @@ class Smarty_Internal_Configfileparser
|
||||
* @param string $section_name
|
||||
* @param array $vars
|
||||
*/
|
||||
private function add_section_vars($section_name, Array $vars)
|
||||
private function add_section_vars($section_name, array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
|
||||
$this->compiler->config_data['sections'][$section_name]['vars'] = Array();
|
||||
$this->compiler->config_data['sections'][$section_name]['vars'] = array();
|
||||
}
|
||||
foreach ($vars as $var) {
|
||||
$this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
|
||||
@@ -238,7 +238,7 @@ class Smarty_Internal_Configfileparser
|
||||
%stack_overflow
|
||||
{
|
||||
$this->internalError = true;
|
||||
$this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
|
||||
$this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
|
||||
}
|
||||
|
||||
// Complete config file
|
||||
@@ -279,17 +279,17 @@ var_list(res) ::= var_list(vl) newline. {
|
||||
}
|
||||
|
||||
var_list(res) ::= var_list(vl) var(v). {
|
||||
res = array_merge(vl, Array(v));
|
||||
res = array_merge(vl, array(v));
|
||||
}
|
||||
|
||||
var_list(res) ::= . {
|
||||
res = Array();
|
||||
res = array();
|
||||
}
|
||||
|
||||
|
||||
// Var
|
||||
var(res) ::= ID(id) EQUAL value(v). {
|
||||
res = Array("key" => id, "value" => v);
|
||||
res = array('key' => id, 'value' => v);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -306,7 +306,7 @@ class Smarty_Internal_Templatelexer
|
||||
aptr = ~\s*[=][>]\s*~
|
||||
singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~
|
||||
backtick = ~[`]~
|
||||
vert = ~[|]~
|
||||
vert = ~[|][@]?~
|
||||
qmark = ~\s*[?]\s*~
|
||||
constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~
|
||||
attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~
|
||||
@@ -344,7 +344,7 @@ class Smarty_Internal_Templatelexer
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1] + strlen($match[0][0]);
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ("missing or misspelled comment closing tag '*{$this->smarty->getRightDelimiter()}'");
|
||||
$this->compiler->trigger_template_error ("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
return false;
|
||||
|
@@ -173,7 +173,7 @@ class Smarty_Internal_Templateparser
|
||||
*/
|
||||
public function errorRunDown()
|
||||
{
|
||||
while ($this->yystack !== Array()) {
|
||||
while ($this->yystack !== array()) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
if (is_resource($this->yyTraceFILE)) {
|
||||
@@ -237,139 +237,103 @@ start(res) ::= template. {
|
||||
res = $this->root_buffer->to_smarty_php($this);
|
||||
}
|
||||
|
||||
//
|
||||
// loop over template elements
|
||||
//
|
||||
// single template element
|
||||
template ::= template_element(e). {
|
||||
if (e != null) {
|
||||
$this->current_buffer->append_subtree($this, e);
|
||||
|
||||
// php tags
|
||||
template ::= template PHP(B). {
|
||||
$code = $this->compiler->compileTag('private_php',array(array('code' => B), array('type' => $this->lex->phpType )),array());
|
||||
if ($this->compiler->has_code && !empty($code)) {
|
||||
$tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();
|
||||
$this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp.$code,true)));
|
||||
}
|
||||
}
|
||||
|
||||
// loop of elements
|
||||
template ::= template template_element(e). {
|
||||
if (e != null) {
|
||||
// because of possible code injection
|
||||
$this->current_buffer->append_subtree($this, e);
|
||||
// template text
|
||||
template ::= template TEXT(B). {
|
||||
$this->current_buffer->append_subtree($this, $this->compiler->processText(B));
|
||||
}
|
||||
// strip on
|
||||
template ::= template STRIPON. {
|
||||
$this->strip = true;
|
||||
}
|
||||
// strip off
|
||||
template ::= template STRIPOFF. {
|
||||
$this->strip = false;
|
||||
}
|
||||
|
||||
// empty template
|
||||
template ::= .
|
||||
// Literal
|
||||
template ::= template LITERALSTART literal_e2(B) LITERALEND. {
|
||||
$this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text(B));
|
||||
}
|
||||
|
||||
//
|
||||
// template elements
|
||||
//
|
||||
|
||||
literal_e2(A) ::= literal_e1(B) LITERALSTART literal_e1(C) LITERALEND. {
|
||||
A = B.C;
|
||||
}
|
||||
literal_e2(A) ::= literal_e1(B). {
|
||||
A = B;
|
||||
}
|
||||
|
||||
literal_e1(A) ::= literal_e1(B) LITERAL(C). {
|
||||
A = B.C;
|
||||
|
||||
}
|
||||
|
||||
literal_e1(A) ::= . {
|
||||
A = '';
|
||||
}
|
||||
// Smarty tag
|
||||
template_element(res)::= smartytag(st). {
|
||||
template ::= template smartytag(B). {
|
||||
if ($this->compiler->has_code) {
|
||||
res = $this->mergePrefixCode(st);
|
||||
} else {
|
||||
res = null;
|
||||
$this->current_buffer->append_subtree($this, $this->mergePrefixCode(B));
|
||||
}
|
||||
$this->compiler->has_variable_string = false;
|
||||
$this->block_nesting_level = count($this->compiler->_tag_stack);
|
||||
}
|
||||
|
||||
// Literal
|
||||
template_element(res) ::= literal(l). {
|
||||
res = new Smarty_Internal_ParseTree_Text(l);
|
||||
}
|
||||
// php tags
|
||||
template_element(res)::= PHP(o). {
|
||||
$code = $this->compiler->compileTag('private_php',array(array('code' => o), array('type' => $this->lex->phpType )),array());
|
||||
if ($this->compiler->has_code && !empty($code)) {
|
||||
$tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();
|
||||
res = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp.$code,true));
|
||||
} else {
|
||||
res = null;
|
||||
}
|
||||
}
|
||||
|
||||
// template text
|
||||
template_element(res)::= text_content(t). {
|
||||
res = $this->compiler->processText(t);
|
||||
}
|
||||
// empty template
|
||||
template ::= .
|
||||
|
||||
text_content(res) ::= TEXT(o). {
|
||||
res = o;
|
||||
}
|
||||
|
||||
text_content(res) ::= text_content(t) TEXT(o). {
|
||||
res = t . o;
|
||||
}
|
||||
|
||||
// strip on
|
||||
template_element ::= STRIPON(d). {
|
||||
$this->strip = true;
|
||||
}
|
||||
// strip off
|
||||
template_element ::= STRIPOFF(d). {
|
||||
$this->strip = false;
|
||||
}
|
||||
|
||||
// Litteral
|
||||
literal(res) ::= LITERALSTART LITERALEND. {
|
||||
res = '';
|
||||
}
|
||||
|
||||
literal(res) ::= LITERALSTART literal_elements(l) LITERALEND. {
|
||||
res = l;
|
||||
}
|
||||
|
||||
literal_elements(res) ::= literal_elements(l1) literal_element(l2). {
|
||||
res = l1.l2;
|
||||
}
|
||||
|
||||
literal_elements(res) ::= . {
|
||||
res = '';
|
||||
}
|
||||
|
||||
literal_element(res) ::= literal(l). {
|
||||
res = l;
|
||||
}
|
||||
|
||||
literal_element(res) ::= LITERAL(l). {
|
||||
res = l;
|
||||
}
|
||||
|
||||
smartytag(res) ::= tag(t) RDEL. {
|
||||
res = t;
|
||||
}
|
||||
//
|
||||
// output tags start here
|
||||
//
|
||||
smartytag(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
|
||||
smartytag(A) ::= SIMPELOUTPUT(B). {
|
||||
$var = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()), ' $');
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
|
||||
res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
|
||||
A = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
|
||||
} else {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\'')));
|
||||
A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->compiler->compileVariable('\''.$var.'\'')));
|
||||
}
|
||||
}
|
||||
|
||||
// simple tag like {name}
|
||||
smartytag(A)::= SIMPLETAG(B). {
|
||||
$tag = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
|
||||
if ($tag == 'strip') {
|
||||
$this->strip = true;
|
||||
A = null;;
|
||||
} else {
|
||||
if (defined($tag)) {
|
||||
if ($this->security) {
|
||||
$this->security->isTrustedConstant($tag, $this->compiler);
|
||||
}
|
||||
A = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
|
||||
} else {
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
|
||||
A = $this->compiler->compileTag($match[1],array("'nocache'"));
|
||||
} else {
|
||||
A = $this->compiler->compileTag($tag,array());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
smartytag(A) ::= LDEL tagbody(B) RDEL. {
|
||||
A = B;
|
||||
}
|
||||
|
||||
smartytag(A) ::= tag(B) RDEL. {
|
||||
A = B;
|
||||
}
|
||||
// output with optional attributes
|
||||
tag(res) ::= LDEL variable(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL variable(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL expr(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
tagbody(A) ::= outattr(B). {
|
||||
A = $this->compiler->compileTag('private_print_expression',B[1],array('value'=>B[0]));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -377,42 +341,30 @@ tag(res) ::= LDEL expr(e) attributes(a). {
|
||||
//
|
||||
|
||||
// assign new style
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL value(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')));
|
||||
tagbody(A) ::= DOLLARID(B) eqoutattr(C). {
|
||||
A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>'\''.substr(B,1).'\'')),C[1]));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e). {
|
||||
res = $this->compiler->compileTag('assign',array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')));
|
||||
tagbody(A) ::= varindexed(B) eqoutattr(C). {
|
||||
A = $this->compiler->compileTag('assign',array_merge(array(array('value'=>C[0]),array('var'=>B['var'])),C[1]),array('smarty_internal_index'=>B['smarty_internal_index']));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL DOLLARID(i) EQUAL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>'\''.substr(i,1).'\'')),a));
|
||||
eqoutattr(A) ::= EQUAL outattr(B). {
|
||||
A = B;
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL varindexed(vi) EQUAL expr(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('assign',array_merge(array(array('value'=>e),array('var'=>vi['var'])),a),array('smarty_internal_index'=>vi['smarty_internal_index']));
|
||||
outattr(A) ::= output(B) attributes(C). {
|
||||
A = array(B,C);
|
||||
}
|
||||
|
||||
// simple tag like {name}
|
||||
smartytag(res)::= SIMPLETAG(t). {
|
||||
$tag = trim(substr(t, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
|
||||
if ($tag === 'strip') {
|
||||
$this->strip = true;
|
||||
res = null;;
|
||||
} else {
|
||||
if (defined($tag)) {
|
||||
if ($this->security) {
|
||||
$this->security->isTrustedConstant($tag, $this->compiler);
|
||||
}
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
|
||||
} else {
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
|
||||
res = $this->compiler->compileTag($match[1],array("'nocache'"));
|
||||
} else {
|
||||
res = $this->compiler->compileTag($tag,array());
|
||||
}
|
||||
output(A) ::= variable(B). {
|
||||
A = B;
|
||||
}
|
||||
output(A) ::= value(B). {
|
||||
A = B;
|
||||
}
|
||||
output(A) ::= expr(B). {
|
||||
A = B;
|
||||
}
|
||||
|
||||
// tag with optional Smarty2 style attributes
|
||||
@@ -776,7 +728,7 @@ value(res) ::= function(f). {
|
||||
|
||||
// expression
|
||||
value(res) ::= OPENP expr(e) CLOSEP. {
|
||||
res = "(". e .")";
|
||||
res = '('. e .')';
|
||||
}
|
||||
|
||||
value(res) ::= variable(v1) INSTANCEOF(i) ns1(v2). {
|
||||
@@ -800,9 +752,9 @@ value(res) ::= doublequoted_with_quotes(s). {
|
||||
value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
if (vi['var'] === '\'smarty\'') {
|
||||
$this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>');
|
||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ". $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>');
|
||||
} else {
|
||||
$this->compiler->appendPrefixCode("<?php $prefixVar" .' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>');
|
||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ". $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>');
|
||||
}
|
||||
res = $prefixVar .'::'.r[0].r[1];
|
||||
}
|
||||
@@ -811,7 +763,7 @@ value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
value(res) ::= smartytag(st). {
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
$tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
|
||||
$this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php $prefixVar" .'=ob_get_clean();?>'));
|
||||
$this->compiler->appendPrefixCode($this->compiler->appendCode($tmp, "<?php {$prefixVar} = ob_get_clean();?>"));
|
||||
res = $prefixVar;
|
||||
}
|
||||
|
||||
@@ -882,11 +834,11 @@ variable(res) ::= object(o). {
|
||||
|
||||
// config variable
|
||||
variable(res) ::= HATCH ID(i) HATCH. {
|
||||
res = $this->compiler->compileConfigVariable("'" . i . "'");
|
||||
res = $this->compiler->compileConfigVariable('\'' . i . '\'');
|
||||
}
|
||||
|
||||
variable(res) ::= HATCH ID(i) HATCH arrayindex(a). {
|
||||
res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable("'" . i . "'") . ') ? $tmp'.a.' :null)';
|
||||
res = '(is_array($tmp = ' . $this->compiler->compileConfigVariable('\'' . i . '\'') . ') ? $tmp'.a.' :null)';
|
||||
}
|
||||
|
||||
variable(res) ::= HATCH variable(v) HATCH. {
|
||||
@@ -931,7 +883,7 @@ indexdef(res) ::= DOT varvar(v) AT ID(p). {
|
||||
}
|
||||
|
||||
indexdef(res) ::= DOT ID(i). {
|
||||
res = "['". i ."']";
|
||||
res = '[\''. i .'\']';
|
||||
}
|
||||
|
||||
indexdef(res) ::= DOT INTEGER(n). {
|
||||
@@ -988,7 +940,7 @@ varvar(res) ::= DOLLARID(i). {
|
||||
}
|
||||
// single $
|
||||
varvar(res) ::= DOLLAR. {
|
||||
res = "''";
|
||||
res = '\'\'';
|
||||
}
|
||||
|
||||
// sequence of identifier elements
|
||||
@@ -1081,7 +1033,7 @@ method(res) ::= ID(f) OPENP params(p) CLOSEP. {
|
||||
if ($this->security && substr(f,0,1) === '_') {
|
||||
$this->compiler->trigger_template_error (self::Err1);
|
||||
}
|
||||
res = f . "(". implode(',',p) .")";
|
||||
res = f . '('. implode(',',p) .')';
|
||||
}
|
||||
|
||||
method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
|
||||
@@ -1089,7 +1041,7 @@ method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
|
||||
$this->compiler->trigger_template_error (self::Err2);
|
||||
}
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
$this->compiler->appendPrefixCode("<?php $prefixVar" .'='.$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
|
||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
|
||||
res = $prefixVar .'('. implode(',',p) .')';
|
||||
}
|
||||
|
||||
@@ -1260,7 +1212,7 @@ arrayelement(res) ::= expr(e). {
|
||||
// double quoted strings
|
||||
//
|
||||
doublequoted_with_quotes(res) ::= QUOTE QUOTE. {
|
||||
res = "''";
|
||||
res = '\'\'';
|
||||
}
|
||||
|
||||
doublequoted_with_quotes(res) ::= QUOTE doublequoted(s) QUOTE. {
|
||||
|
@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.32-dev-31';
|
||||
const SMARTY_VERSION = '3.1.32-dev-32';
|
||||
/**
|
||||
* define variable scopes
|
||||
*/
|
||||
|
@@ -147,15 +147,61 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->configBooleanize = $this->smarty->config_booleanize;
|
||||
}
|
||||
|
||||
public function replace($input)
|
||||
{
|
||||
return $input;
|
||||
} // end function
|
||||
|
||||
public function PrintTrace()
|
||||
{
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
$this->yyTracePrompt = '<br>';
|
||||
} // end function
|
||||
}
|
||||
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
public function yypushstate($state)
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState push %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
array_push($this->_yy_stack, $this->_yy_state);
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%snew State %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
public function yypopstate()
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState pop %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
$this->_yy_state = array_pop($this->_yy_stack);
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%snew State %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*/
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
@@ -168,10 +214,6 @@ class Smarty_Internal_Configfilelexer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
@@ -184,7 +226,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -193,8 +234,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state START');
|
||||
}
|
||||
@@ -221,112 +262,56 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function replace($input)
|
||||
{
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
function yy_r1_1()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
|
||||
$this->yypushstate(self::COMMENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*/
|
||||
public function yypushstate($state)
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState push %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
array_push($this->_yy_stack, $this->_yy_state);
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%snew State %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
function yy_r1_2()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
|
||||
$this->yypushstate(self::SECTION);
|
||||
}
|
||||
|
||||
function yy_r1_3()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
|
||||
}
|
||||
|
||||
function yy_r1_4()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
|
||||
$this->yypushstate(self::VALUE);
|
||||
}
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r1_5()
|
||||
{
|
||||
|
||||
return false;
|
||||
} // end function
|
||||
}
|
||||
|
||||
function yy_r1_6()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
}
|
||||
|
||||
function yy_r1_7()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_ID;
|
||||
}
|
||||
|
||||
function yy_r1_8()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
@@ -339,7 +324,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -348,8 +332,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state VALUE');
|
||||
}
|
||||
@@ -376,85 +360,52 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r2_1()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function yy_r2_2()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
public function yypopstate()
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState pop %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
$this->_yy_state = array_pop($this->_yy_stack);
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%snew State %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function yy_r2_3()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_INT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r2_4()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
|
||||
$this->yypushstate(self::TRIPPLE);
|
||||
}
|
||||
|
||||
function yy_r2_5()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r2_6()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r2_7()
|
||||
{
|
||||
|
||||
if (!$this->configBooleanize ||
|
||||
!in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))) {
|
||||
!in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) {
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||
return true; //reprocess in new state
|
||||
@@ -466,23 +417,17 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
function yy_r2_8()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r2_9()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->value = "";
|
||||
$this->value = '';
|
||||
$this->yypopstate();
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
@@ -494,7 +439,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -503,8 +447,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state NAKED_STRING_VALUE');
|
||||
}
|
||||
@@ -531,24 +475,19 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
function yy_r3_1()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex4()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
@@ -560,7 +499,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -569,8 +507,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state COMMENT');
|
||||
}
|
||||
@@ -597,39 +535,29 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r4_1()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function yy_r4_2()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
} // end function
|
||||
|
||||
function yy_r4_3()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex5()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
@@ -641,7 +569,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -650,8 +577,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state SECTION');
|
||||
}
|
||||
@@ -678,30 +605,24 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
function yy_r5_1()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOT;
|
||||
}
|
||||
|
||||
function yy_r5_2()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
|
||||
$this->yypopstate();
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex6()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern6)) {
|
||||
@@ -713,7 +634,6 @@ class Smarty_Internal_Configfilelexer
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
return false; // end of input
|
||||
}
|
||||
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, 0, $this->counter)) {
|
||||
if (!isset($yymatches[ 0 ][ 1 ])) {
|
||||
@@ -722,8 +642,8 @@ class Smarty_Internal_Configfilelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state TRIPPLE');
|
||||
}
|
||||
@@ -750,16 +670,15 @@ class Smarty_Internal_Configfilelexer
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
function yy_r6_1()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::START);
|
||||
@@ -767,17 +686,14 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
function yy_r6_2()
|
||||
{
|
||||
|
||||
$to = strlen($this->data);
|
||||
preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
if (isset($match[ 0 ][ 1 ])) {
|
||||
$to = $match[ 0 ][ 1 ];
|
||||
} else {
|
||||
$this->compiler->trigger_template_error("missing or misspelled literal closing tag");
|
||||
$this->compiler->trigger_template_error('missing or misspelled literal closing tag');
|
||||
}
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -250,17 +250,11 @@ class Smarty_Internal_Templatelexer
|
||||
strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*/
|
||||
public function yypushstate($state)
|
||||
{
|
||||
if ($this->yyTraceFILE) {
|
||||
@@ -300,9 +294,6 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*/
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
@@ -315,10 +306,6 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
@@ -379,17 +366,13 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \SmartyCompilerException
|
||||
*/
|
||||
function yy_r1_2()
|
||||
{
|
||||
preg_match("/[*]{$this->compiler->getRdelPreg()}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
if (isset($match[ 0 ][ 1 ])) {
|
||||
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
||||
} else {
|
||||
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->getRightDelimiter()}'");
|
||||
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
|
||||
}
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
return false;
|
||||
@@ -417,9 +400,6 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yypushstate(self::LITERAL);
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r1_14()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
@@ -436,10 +416,6 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
@@ -572,15 +548,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 =
|
||||
$this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\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)\\s+)|\G(\\s+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->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\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)\\s+)|\G(\\s+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 (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -637,9 +609,6 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r3_2()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
@@ -867,10 +836,6 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex4()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
@@ -948,10 +913,6 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function yylex5()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
@@ -1022,18 +983,12 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r5_7()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function yy_r5_9()
|
||||
{
|
||||
$this->yypushstate(self::TAG);
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user