mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- improvement repeated delimiter like {{ and }} will be treated as literal
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.32 - dev ===
|
||||
09.8.2017
|
||||
- improvement repeated delimiter like {{ and }} will be treated as literal
|
||||
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
|
||||
|
||||
05.8.2017
|
||||
- bugfix wordwrap modifier could fail if used in nocache code.
|
||||
converted plugin file shared.mb_wordwrap.php into modifier.mb_wordwrap.php
|
||||
|
@@ -138,6 +138,10 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->configBooleanize = $this->smarty->config_booleanize;
|
||||
}
|
||||
|
||||
public function replace ($input) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function PrintTrace()
|
||||
{
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
|
@@ -240,9 +240,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line = 1;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter, '/');
|
||||
$this->pldel = preg_quote($this->smarty->left_delimiter, '/');
|
||||
$this->ldel = $this->pldel . ($this->smarty->auto_literal ? '(?!\\s+)' : '\\s*');
|
||||
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
||||
$this->rdel = preg_quote($this->smarty->right_delimiter, '/');
|
||||
$rdel = preg_quote($this->smarty->right_delimiter, '/');
|
||||
$this->rdel = "(?<!{$rdel}){$rdel}(?!{$rdel})";
|
||||
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
||||
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
||||
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
|
||||
@@ -253,13 +255,8 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
$this->yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this tag is autoliteral
|
||||
*/
|
||||
public function isAutoLiteral ()
|
||||
{
|
||||
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
|
||||
public function replace ($input) {
|
||||
return str_replace(array('SMARTYldel','SMARTYrawldel','SMARTYrdel'),array($this->ldel,$this->pldel,$this->rdel),$input);
|
||||
}
|
||||
|
||||
/*!lex2php
|
||||
@@ -269,15 +266,16 @@ class Smarty_Internal_Templatelexer
|
||||
%value $this->value
|
||||
%line $this->line
|
||||
linebreak = ~[\t ]*[\r\n]+[\t ]*~
|
||||
ldelrepeat = ~SMARTYrawldel{2,}~
|
||||
text = ~[\S\s]~
|
||||
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYldel|\$|`\$|"))~
|
||||
namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
|
||||
all = ~[\S\s]+~
|
||||
emptyjava = ~[{][}]~
|
||||
phptag = ~(SMARTYldel\s*php([ ].*?)?SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~
|
||||
phptag = ~(SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[/]phpSMARTYrdel)~
|
||||
phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*["']?\s*php\s*["']?\s*>)|([?][>])|([%][>])~
|
||||
slash = ~[/]~
|
||||
ldel = ~SMARTYldel\s*~
|
||||
ldel = ~SMARTYldel~
|
||||
rdel = ~\s*SMARTYrdel~
|
||||
nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
|
||||
notblockid = ~(?:(?!block)[0-9]*[a-zA-Z_]\w*)~
|
||||
@@ -351,31 +349,27 @@ class Smarty_Internal_Templatelexer
|
||||
phptag {
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
}
|
||||
ldelrepeat {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
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;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
}
|
||||
ldel slash literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
ldel {
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
phpstart {
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
}
|
||||
text {
|
||||
$to = $this->dataLength;
|
||||
preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
preg_match("/((?<!$this->pldel){$this->ldel})|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
}
|
||||
@@ -450,12 +444,8 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
ldel {
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
@@ -627,6 +617,9 @@ class Smarty_Internal_Templatelexer
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename DOUBLEQUOTEDSTRING
|
||||
ldelrepeat {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
@@ -634,29 +627,17 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel slash {
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ldel id {
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ldel {
|
||||
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;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
|
@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.32-dev-18';
|
||||
const SMARTY_VERSION = '3.1.32-dev-19';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
@@ -3,9 +3,10 @@
|
||||
* Smarty Internal Plugin Configfilelexer
|
||||
*
|
||||
* This is the lexer to break the config file source into tokens
|
||||
* @package Smarty
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -14,12 +15,18 @@
|
||||
* This is the config file lexer.
|
||||
* It is generated from the smarty_internal_configfilelexer.plex file
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
const START = 1;
|
||||
const VALUE = 2;
|
||||
const NAKED_STRING_VALUE = 3;
|
||||
const COMMENT = 4;
|
||||
const SECTION = 5;
|
||||
const TRIPPLE = 6;
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
@@ -68,18 +75,6 @@ class Smarty_Internal_Configfilelexer
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty = null;
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_Config_File_Compiler
|
||||
*/
|
||||
private $compiler = null;
|
||||
/**
|
||||
* copy of config_booleanize
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $configBooleanize = false;
|
||||
/**
|
||||
* trace file
|
||||
*
|
||||
@@ -97,8 +92,27 @@ class Smarty_Internal_Configfilelexer
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
|
||||
|
||||
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION',
|
||||
6 => 'TRIPPLE');
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
);
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_Config_File_Compiler
|
||||
*/
|
||||
private $compiler = null;
|
||||
/**
|
||||
* copy of config_booleanize
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $configBooleanize = false;
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
*
|
||||
@@ -110,14 +124,8 @@ class Smarty_Internal_Configfilelexer
|
||||
private $yy_global_pattern4 = null;
|
||||
private $yy_global_pattern5 = null;
|
||||
private $yy_global_pattern6 = null;
|
||||
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
);
|
||||
private $_yy_state = 1;
|
||||
private $_yy_stack = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -143,54 +151,25 @@ class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
$this->yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
|
||||
private $_yy_state = 1;
|
||||
private $_yy_stack = array();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
} // end function
|
||||
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState set %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function yylex1()
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
$this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern1 =
|
||||
$this->replace("/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -207,9 +186,10 @@ 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,
|
||||
$this->counter, 5) . '... state START');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state START');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -220,11 +200,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -234,16 +214,22 @@ 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);
|
||||
|
||||
} // end function
|
||||
}
|
||||
|
||||
public function replace($input)
|
||||
{
|
||||
return $input;
|
||||
}
|
||||
|
||||
const START = 1;
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
function yy_r1_1()
|
||||
{
|
||||
@@ -252,6 +238,26 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->yypushstate(self::COMMENT);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -276,7 +282,7 @@ class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r1_6()
|
||||
{
|
||||
@@ -296,11 +302,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
|
||||
}
|
||||
|
||||
|
||||
public function yylex2()
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
$this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
$this->yy_global_pattern2 =
|
||||
$this->replace("/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -317,9 +323,10 @@ 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,
|
||||
$this->counter, 5) . '... state VALUE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state VALUE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -330,11 +337,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -344,16 +351,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const VALUE = 2;
|
||||
}
|
||||
|
||||
function yy_r2_1()
|
||||
{
|
||||
@@ -368,6 +371,26 @@ class Smarty_Internal_Configfilelexer
|
||||
$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()
|
||||
{
|
||||
|
||||
@@ -394,12 +417,13 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r2_7()
|
||||
{
|
||||
|
||||
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
|
||||
@@ -422,13 +446,12 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->value = "";
|
||||
$this->yypopstate();
|
||||
}
|
||||
} // end function
|
||||
|
||||
|
||||
public function yylex3()
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS";
|
||||
$this->yy_global_pattern3 = $this->replace("/\G([^\n]+?(?=[ \t\r]*\n))/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -445,9 +468,10 @@ 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,
|
||||
$this->counter, 5) . '... state NAKED_STRING_VALUE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state NAKED_STRING_VALUE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -458,11 +482,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -472,16 +496,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const NAKED_STRING_VALUE = 3;
|
||||
}
|
||||
|
||||
function yy_r3_1()
|
||||
{
|
||||
@@ -490,11 +510,10 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
public function yylex4()
|
||||
public function yylex4()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
$this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
$this->yy_global_pattern4 = $this->replace("/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -511,9 +530,10 @@ 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,
|
||||
$this->counter, 5) . '... state COMMENT');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state COMMENT');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -524,11 +544,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -538,16 +558,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const COMMENT = 4;
|
||||
}
|
||||
|
||||
function yy_r4_1()
|
||||
{
|
||||
@@ -559,7 +575,7 @@ class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r4_3()
|
||||
{
|
||||
@@ -568,11 +584,10 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
public function yylex5()
|
||||
public function yylex5()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
$this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS";
|
||||
$this->yy_global_pattern5 = $this->replace("/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -589,9 +604,10 @@ 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,
|
||||
$this->counter, 5) . '... state SECTION');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state SECTION');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -602,11 +618,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -616,16 +632,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const SECTION = 5;
|
||||
}
|
||||
|
||||
function yy_r5_1()
|
||||
{
|
||||
@@ -638,13 +650,12 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
|
||||
$this->yypopstate();
|
||||
}
|
||||
} // end function
|
||||
|
||||
|
||||
public function yylex6()
|
||||
public function yylex6()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern6)) {
|
||||
$this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern6 = $this->replace("/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -661,9 +672,10 @@ 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,
|
||||
$this->counter, 5) . '... state TRIPPLE');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state TRIPPLE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -674,11 +686,11 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -688,16 +700,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const TRIPPLE = 6;
|
||||
}
|
||||
|
||||
function yy_r6_1()
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -18,76 +18,71 @@
|
||||
*/
|
||||
class Smarty_Internal_Templatelexer
|
||||
{
|
||||
const TEXT = 1;
|
||||
const TAG = 2;
|
||||
const TAGBODY = 3;
|
||||
const LITERAL = 4;
|
||||
const DOUBLEQUOTEDSTRING = 5;
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Source length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $dataLength = null;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
@@ -95,133 +90,97 @@ class Smarty_Internal_Templatelexer
|
||||
*/
|
||||
public $rdel = '';
|
||||
|
||||
/**
|
||||
* PHP start tag string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public $compiler = null;
|
||||
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $literal_cnt = 0;
|
||||
|
||||
/**
|
||||
* PHP start tag string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
/**
|
||||
* trace file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
public $yyTraceFILE;
|
||||
|
||||
/**
|
||||
* trace prompt
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $yyTracePrompt;
|
||||
|
||||
/**
|
||||
* XML flag true while processing xml
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $is_xml = false;
|
||||
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
|
||||
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern1 = null;
|
||||
|
||||
private $yy_global_pattern2 = null;
|
||||
|
||||
private $yy_global_pattern3 = null;
|
||||
|
||||
private $yy_global_pattern4 = null;
|
||||
|
||||
private $yy_global_pattern5 = null;
|
||||
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
'NOT' => '(!,not)',
|
||||
'OPENP' => '(',
|
||||
'CLOSEP' => ')',
|
||||
'OPENB' => '[',
|
||||
'CLOSEB' => ']',
|
||||
'PTR' => '->',
|
||||
'APTR' => '=>',
|
||||
'EQUAL' => '=',
|
||||
'NUMBER' => 'number',
|
||||
'UNIMATH' => '+" , "-',
|
||||
'MATH' => '*" , "/" , "%',
|
||||
'INCDEC' => '++" , "--',
|
||||
'SPACE' => ' ',
|
||||
'DOLLAR' => '$',
|
||||
'SEMICOLON' => ';',
|
||||
'COLON' => ':',
|
||||
'DOUBLECOLON' => '::',
|
||||
'AT' => '@',
|
||||
'HATCH' => '#',
|
||||
'QUOTE' => '"',
|
||||
'BACKTICK' => '`',
|
||||
'VERT' => '"|" modifier',
|
||||
'DOT' => '.',
|
||||
'COMMA' => '","',
|
||||
'QMARK' => '"?"',
|
||||
'ID' => 'id, name',
|
||||
'TEXT' => 'text',
|
||||
'LDELSLASH' => '{/..} closing tag',
|
||||
'LDEL' => '{...} Smarty tag',
|
||||
'COMMENT' => 'comment',
|
||||
'AS' => 'as',
|
||||
'TO' => 'to',
|
||||
'PHP' => '"<?php", "<%", "{php}" tag',
|
||||
'LOGOP' => '"<", "==" ... logical operator',
|
||||
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
|
||||
'SCOND' => '"is even" ... if condition',
|
||||
);
|
||||
'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[',
|
||||
'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=',
|
||||
'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%',
|
||||
'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$',
|
||||
'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@',
|
||||
'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`',
|
||||
'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","',
|
||||
'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text',
|
||||
'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag',
|
||||
'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',
|
||||
'PHP' => '"<?php", "<%", "{php}" tag',
|
||||
'LOGOP' => '"<", "==" ... logical operator',
|
||||
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
|
||||
'SCOND' => '"is even" ... if condition',);
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $literal_cnt = 0;
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern1 = null;
|
||||
private $yy_global_pattern2 = null;
|
||||
private $yy_global_pattern3 = null;
|
||||
private $yy_global_pattern4 = null;
|
||||
private $yy_global_pattern5 = null;
|
||||
private $_yy_state = 1;
|
||||
private $_yy_stack = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
@@ -240,9 +199,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line = 1;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->ldel = preg_quote($this->smarty->left_delimiter, '/');
|
||||
$this->pldel = preg_quote($this->smarty->left_delimiter, '/');
|
||||
$this->ldel = $this->pldel . ($this->smarty->auto_literal ? '(?!\\s+)' : '\\s*');
|
||||
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
||||
$this->rdel = preg_quote($this->smarty->right_delimiter, '/');
|
||||
$rdel = preg_quote($this->smarty->right_delimiter, '/');
|
||||
$this->rdel = "(?<!{$rdel}){$rdel}(?!{$rdel})";
|
||||
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
||||
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
||||
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
|
||||
@@ -254,60 +215,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if this tag is autoliteral
|
||||
*/
|
||||
public function isAutoLiteral()
|
||||
{
|
||||
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
|
||||
}
|
||||
|
||||
|
||||
private $_yy_state = 1;
|
||||
private $_yy_stack = array();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function yylex1()
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
$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+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern1 =
|
||||
$this->replace("/\G([{][}])|\G(SMARTYldel[*])|\G((SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[\/]phpSMARTYrdel))|\G(SMARTYrawldel{2,})|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel)|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -324,9 +236,10 @@ class Smarty_Internal_Templatelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($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
|
||||
@@ -337,11 +250,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -351,16 +264,24 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
public function replace($input)
|
||||
{
|
||||
return str_replace(array('SMARTYldel', 'SMARTYrawldel', 'SMARTYrdel'),
|
||||
array($this->ldel, $this->pldel, $this->rdel),
|
||||
$input);
|
||||
}
|
||||
|
||||
const TEXT = 1;
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
function yy_r1_1()
|
||||
{
|
||||
@@ -390,42 +311,65 @@ class Smarty_Internal_Templatelexer
|
||||
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) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
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) {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
|
||||
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_9()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
|
||||
function yy_r1_10()
|
||||
{
|
||||
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r1_19()
|
||||
function yy_r1_11()
|
||||
{
|
||||
|
||||
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
|
||||
} // end function
|
||||
|
||||
function yy_r1_20()
|
||||
{
|
||||
|
||||
$to = $this->dataLength;
|
||||
preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
preg_match("/((?<!$this->pldel){$this->ldel})|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i",
|
||||
$this->data,
|
||||
$match,
|
||||
PREG_OFFSET_CAPTURE,
|
||||
$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
}
|
||||
@@ -433,11 +377,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
|
||||
public function yylex2()
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
$this->yy_global_pattern2 = "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel . "\\s*make_nocache\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS";
|
||||
$this->yy_global_pattern2 =
|
||||
$this->replace("/\G(SMARTYldel(if|elseif|else if|while)\\s+)|\G(SMARTYldelfor\\s+)|\G(SMARTYldelforeach(?![^\s]))|\G(SMARTYldelsetfilter\\s+)|\G(SMARTYldelmake_nocache\\s+)|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*SMARTYrdel)|\G(SMARTYldel[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel)/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -454,9 +398,10 @@ class Smarty_Internal_Templatelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state TAG');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state TAG');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -467,11 +412,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -481,16 +426,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const TAG = 2;
|
||||
}
|
||||
|
||||
function yy_r2_1()
|
||||
{
|
||||
@@ -500,6 +441,18 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
if ($this->yyTraceFILE) {
|
||||
fprintf($this->yyTraceFILE,
|
||||
"%sState set %s\n",
|
||||
$this->yyTracePrompt,
|
||||
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] :
|
||||
$this->_yy_state);
|
||||
}
|
||||
}
|
||||
|
||||
function yy_r2_3()
|
||||
{
|
||||
|
||||
@@ -540,6 +493,26 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
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_9()
|
||||
{
|
||||
|
||||
@@ -551,7 +524,7 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r2_10()
|
||||
{
|
||||
|
||||
if ($this->_yy_stack[count($this->_yy_stack) - 1] == self::TEXT) {
|
||||
if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
@@ -561,7 +534,7 @@ class Smarty_Internal_Templatelexer
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r2_12()
|
||||
{
|
||||
@@ -579,11 +552,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
|
||||
public function yylex3()
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\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->yy_global_pattern3 =
|
||||
$this->replace("/\G(\\s*SMARTYrdel)|\G(SMARTYldel)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\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);
|
||||
@@ -600,9 +573,10 @@ class Smarty_Internal_Templatelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state TAGBODY');
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
|
||||
substr($this->data,
|
||||
$this->counter,
|
||||
5) . '... state TAGBODY');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
@@ -613,11 +587,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -627,16 +601,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const TAGBODY = 3;
|
||||
}
|
||||
|
||||
function yy_r3_1()
|
||||
{
|
||||
@@ -648,12 +618,8 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r3_2()
|
||||
{
|
||||
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r3_3()
|
||||
@@ -830,7 +796,8 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
|
||||
// resolve conflicts with shorttag and right_delimiter starting with '='
|
||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) {
|
||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) ==
|
||||
$this->smarty->right_delimiter) {
|
||||
preg_match("/\s+/", $this->value, $match);
|
||||
$this->value = $match[0];
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
@@ -916,7 +883,7 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
}
|
||||
} // end function
|
||||
|
||||
function yy_r3_66()
|
||||
{
|
||||
@@ -924,11 +891,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
|
||||
public function yylex4()
|
||||
public function yylex4()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
$this->yy_global_pattern4 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern4 =
|
||||
$this->replace("/\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -945,9 +912,10 @@ class Smarty_Internal_Templatelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($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
|
||||
@@ -958,11 +926,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -972,16 +940,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const LITERAL = 4;
|
||||
}
|
||||
|
||||
function yy_r4_1()
|
||||
{
|
||||
@@ -1006,7 +970,11 @@ class Smarty_Internal_Templatelexer
|
||||
{
|
||||
|
||||
$to = $this->dataLength;
|
||||
preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||
preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i",
|
||||
$this->data,
|
||||
$match,
|
||||
PREG_OFFSET_CAPTURE,
|
||||
$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
} else {
|
||||
@@ -1014,13 +982,13 @@ class Smarty_Internal_Templatelexer
|
||||
}
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
} // end function
|
||||
|
||||
|
||||
public function yylex5()
|
||||
public function yylex5()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
$this->yy_global_pattern5 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" . $this->ldel . "\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern5 =
|
||||
$this->replace("/\G(SMARTYrawldel{2,})|\G(SMARTYldelliteral\\s*SMARTYrdel)|\G(SMARTYldel[\/]literal\\s*SMARTYrdel)|\G(SMARTYldel[\/])|\G(SMARTYldel[0-9]*[a-zA-Z_]\\w*)|\G(SMARTYldel)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(SMARTYldel|\\$|`\\$|\")))|\G([\S\s])/isS");
|
||||
}
|
||||
if (!isset($this->dataLength)) {
|
||||
$this->dataLength = strlen($this->data);
|
||||
@@ -1037,9 +1005,10 @@ class Smarty_Internal_Templatelexer
|
||||
$yymatches = array_filter($yymatches);
|
||||
}
|
||||
if (empty($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
|
||||
@@ -1050,11 +1019,11 @@ class Smarty_Internal_Templatelexer
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
} else if ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
} else if ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= $this->dataLength) {
|
||||
@@ -1064,16 +1033,12 @@ 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);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const DOUBLEQUOTEDSTRING = 5;
|
||||
}
|
||||
|
||||
function yy_r5_1()
|
||||
{
|
||||
@@ -1090,45 +1055,39 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r5_3()
|
||||
{
|
||||
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_4()
|
||||
{
|
||||
|
||||
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;
|
||||
} else {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r5_5()
|
||||
{
|
||||
|
||||
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;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_r5_6()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
|
||||
function yy_r5_7()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
function yy_r5_7()
|
||||
function yy_r5_8()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
@@ -1137,16 +1096,10 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
|
||||
function yy_r5_8()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
|
||||
function yy_r5_9()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
|
||||
function yy_r5_10()
|
||||
@@ -1155,7 +1108,13 @@ class Smarty_Internal_Templatelexer
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_14()
|
||||
function yy_r5_11()
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
|
||||
function yy_r5_15()
|
||||
{
|
||||
|
||||
$to = $this->dataLength;
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user