- replacement of " by '

This commit is contained in:
Uwe Tews
2017-11-20 12:26:48 +01:00
parent fcf108b33f
commit 40ea5d89da
7 changed files with 33 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
20.11.2017
- bugfix rework of newline spacing between tag code and template text.
now again identical with Smarty2 (forum topic 26878)
- bugfix variable filter might not have been loaded in cache file for use in nocache sections.
- replacement of " by '
05.11.2017
- lexer/parser optimization

View File

@@ -530,7 +530,7 @@ class Smarty_Internal_Templatelexer
attr {
// resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) {
preg_match("/\s+/",$this->value,$match);
preg_match('/\s+/',$this->value,$match);
$this->value = $match[0];
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} else {

View File

@@ -220,7 +220,7 @@ class Smarty_Internal_Templateparser
%stack_overflow
{
$this->internalError = true;
$this->compiler->trigger_template_error("Stack overflow in template parser");
$this->compiler->trigger_template_error('Stack overflow in template parser');
}
@@ -317,7 +317,7 @@ smartytag(A)::= SIMPLETAG(B). {
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'"));
A = $this->compiler->compileTag($match[1],array('\'nocache\''));
} else {
A = $this->compiler->compileTag($tag,array());
}
@@ -785,7 +785,7 @@ value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
res = c.'::'.s[0].s[1];
}
} else {
$this->compiler->trigger_template_error ("static class '".c."' is undefined or not allowed by security setting");
$this->compiler->trigger_template_error ('static class \''.c.'\' is undefined or not allowed by security setting');
}
}
//
@@ -1235,7 +1235,7 @@ doublequotedcontent(res) ::= BACKTICK variable(v) BACKTICK. {
}
doublequotedcontent(res) ::= BACKTICK expr(e) BACKTICK. {
res = new Smarty_Internal_ParseTree_Code('(string)'.e);
res = new Smarty_Internal_ParseTree_Code('(string)('.e.')');
}
doublequotedcontent(res) ::= DOLLARID(i). {

View File

@@ -33,8 +33,8 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
$_attr = $this->getAttributes($compiler, $args);
$this->openTag($compiler, 'while', $compiler->nocache);
if (!array_key_exists("if condition", $parameter)) {
$compiler->trigger_template_error("missing while condition", null, true);
if (!array_key_exists('if condition', $parameter)) {
$compiler->trigger_template_error('missing while condition', null, true);
}
// maybe nocache because of nocache variables
@@ -52,7 +52,7 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
$prefixVar = $compiler->getNewPrefixVariable();
$assignCompiler = new Smarty_Internal_Compile_Assign();
$assignAttr = array();
$assignAttr[][ 'value' ] = "{$prefixVar}";
$assignAttr[][ 'value' ] = $prefixVar;
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
$_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>";

View File

@@ -9,7 +9,6 @@ class TPC_yyStackEntry
** is the value of the token */
}
;
#line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
/**
@@ -365,7 +364,7 @@ class Smarty_Internal_Configfileparser
if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
return $this->yyTokenName[ $tokenType ];
} else {
return "Unknown";
return 'Unknown';
}
}
@@ -591,8 +590,8 @@ class Smarty_Internal_Configfileparser
&& ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
if ($this->yyTraceFILE) {
fwrite($this->yyTraceFILE,
$this->yyTracePrompt . "FALLBACK " .
$this->yyTokenName[ $iLookAhead ] . " => " .
$this->yyTracePrompt . 'FALLBACK ' .
$this->yyTokenName[ $iLookAhead ] . ' => ' .
$this->yyTokenName[ $iFallback ] . "\n");
}
return $this->yy_find_shift_action($iFallback);

View File

@@ -761,7 +761,7 @@ class Smarty_Internal_Templatelexer
// resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
$this->smarty->getRightDelimiter()) {
preg_match("/\s+/", $this->value, $match);
preg_match('/\s+/', $this->value, $match);
$this->value = $match[ 0 ];
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} else {

View File

@@ -9,6 +9,8 @@ class TP_yyStackEntry
** is the value of the token */
}
#line 11 "../smarty/lexer/smarty_internal_templateparser.y"
/**
* Smarty Template Parser Class
*
@@ -1451,10 +1453,10 @@ class Smarty_Internal_Templateparser
176 => 176,
177 => 177,
178 => 178,
179 => 178,
181 => 178,
179 => 179,
182 => 179,
180 => 180,
182 => 182,
183 => 183,
184 => 184,
);
@@ -1683,7 +1685,7 @@ class Smarty_Internal_Templateparser
if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
return $this->yyTokenName[ $tokenType ];
} else {
return "Unknown";
return 'Unknown';
}
}
@@ -1909,8 +1911,8 @@ class Smarty_Internal_Templateparser
&& ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
if ($this->yyTraceFILE) {
fwrite($this->yyTraceFILE,
$this->yyTracePrompt . "FALLBACK " .
$this->yyTokenName[ $iLookAhead ] . " => " .
$this->yyTracePrompt . 'FALLBACK ' .
$this->yyTokenName[ $iLookAhead ] . ' => ' .
$this->yyTokenName[ $iFallback ] . "\n");
}
return $this->yy_find_shift_action($iFallback);
@@ -1957,7 +1959,7 @@ class Smarty_Internal_Templateparser
}
#line 221 "../smarty/lexer/smarty_internal_templateparser.y"
$this->internalError = true;
$this->compiler->trigger_template_error("Stack overflow in template parser");
$this->compiler->trigger_template_error('Stack overflow in template parser');
return;
}
$yytos = new TP_yyStackEntry;
@@ -2111,7 +2113,7 @@ class Smarty_Internal_Templateparser
$this->compiler->compileTag('private_print_expression', array(), array('value' => $tag));
} else {
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
$this->_retvalue = $this->compiler->compileTag($match[ 1 ], array("'nocache'"));
$this->_retvalue = $this->compiler->compileTag($match[ 1 ], array('\'nocache\''));
} else {
$this->_retvalue = $this->compiler->compileTag($tag, array());
}
@@ -2711,8 +2713,8 @@ class Smarty_Internal_Templateparser
$this->yystack[ $this->yyidx + 0 ]->minor[ 1 ];
}
} else {
$this->compiler->trigger_template_error("static class '" . $this->yystack[ $this->yyidx + -2 ]->minor .
"' is undefined or not allowed by security setting");
$this->compiler->trigger_template_error('static class \'' . $this->yystack[ $this->yyidx + -2 ]->minor .
'\' is undefined or not allowed by security setting');
}
}
@@ -3197,13 +3199,20 @@ class Smarty_Internal_Templateparser
$this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor);
}
#line 1241 "../smarty/lexer/smarty_internal_templateparser.y"
#line 1237 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r178()
{
$this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor);
}
#line 1249 "../smarty/lexer/smarty_internal_templateparser.y"
#line 1241 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r179()
{
$this->_retvalue =
new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')');
}
#line 1253 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r180()
{
$this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' .
@@ -3211,13 +3220,6 @@ class Smarty_Internal_Templateparser
'\']->value');
}
#line 1253 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r182()
{
$this->_retvalue =
new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')');
}
#line 1257 "../smarty/lexer/smarty_internal_templateparser.y"
function yy_r183()
{