summaryrefslogtreecommitdiff
path: root/lib/smarty3/sysplugins/smarty_internal_templatelexer.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_internal_templatelexer.php')
-rw-r--r--lib/smarty3/sysplugins/smarty_internal_templatelexer.php1100
1 files changed, 549 insertions, 551 deletions
diff --git a/lib/smarty3/sysplugins/smarty_internal_templatelexer.php b/lib/smarty3/sysplugins/smarty_internal_templatelexer.php
index be8a35d..c6c49ef 100644
--- a/lib/smarty3/sysplugins/smarty_internal_templatelexer.php
+++ b/lib/smarty3/sysplugins/smarty_internal_templatelexer.php
@@ -18,6 +18,12 @@
*/
class Smarty_Internal_Templatelexer
{
+ const TEXT = 1;
+ const TAG = 2;
+ const TAGBODY = 3;
+ const LITERAL = 4;
+ const DOUBLEQUOTEDSTRING = 5;
+
/**
* Source
*
@@ -26,6 +32,13 @@ class Smarty_Internal_Templatelexer
public $data;
/**
+ * Source length
+ *
+ * @var int
+ */
+ public $dataLength = null;
+
+ /**
* byte counter
*
* @var int
@@ -68,34 +81,6 @@ class Smarty_Internal_Templatelexer
public $phpType = '';
/**
- * escaped left delimiter
- *
- * @var string
- */
- public $ldel = '';
-
- /**
- * escaped left delimiter length
- *
- * @var int
- */
- public $ldel_length = 0;
-
- /**
- * escaped right delimiter
- *
- * @var string
- */
- public $rdel = '';
-
- /**
- * escaped right delimiter length
- *
- * @var int
- */
- public $rdel_length = 0;
-
- /**
* state number
*
* @var int
@@ -117,19 +102,6 @@ class Smarty_Internal_Templatelexer
public $compiler = null;
/**
- * literal tag nesting level
- *
- * @var int
- */
- private $literal_cnt = 0;
-
- /**
- * PHP start tag string
- *
- * @var string
- */
-
- /**
* trace file
*
* @var resource
@@ -144,10 +116,10 @@ class Smarty_Internal_Templatelexer
public $yyTracePrompt;
/**
- * XML flag true while processing xml
- *
- * @var bool
- */
+ * XML flag true while processing xml
+ *
+ * @var bool
+ */
public $is_xml = false;
/**
@@ -158,105 +130,149 @@ class Smarty_Internal_Templatelexer
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
/**
- * storage for assembled token patterns
+ * 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',
+ );
+
+ /**
+ * literal tag nesting level
+ *
+ * @var int
+ */
+ private $literal_cnt = 0;
+
+ /**
+ * preg token pattern for state TEXT
*
* @var string
*/
private $yy_global_pattern1 = null;
+ /**
+ * preg token pattern for state TAG
+ *
+ * @var string
+ */
private $yy_global_pattern2 = null;
+ /**
+ * preg token pattern for state TAGBODY
+ *
+ * @var string
+ */
private $yy_global_pattern3 = null;
+ /**
+ * preg token pattern for state LITERAL
+ *
+ * @var string
+ */
private $yy_global_pattern4 = null;
- private $yy_global_pattern5 = null;
-
/**
- * token names
+ * preg token pattern for state DOUBLEQUOTEDSTRING
*
- * @var array
+ * @var null
*/
- 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',
- );
+ private $yy_global_pattern5 = null;
+
+ private $_yy_state = 1;
+
+ private $_yy_stack = array();
/**
* constructor
*
- * @param string $data template source
+ * @param string $source template source
* @param Smarty_Internal_TemplateCompilerBase $compiler
*/
- function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler)
+ public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
{
- $this->data = $data;
+ $this->data = $source;
+ $this->dataLength = strlen($this->data);
$this->counter = 0;
if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
- $this->counter += strlen($match[0]);
+ $this->counter += strlen($match[ 0 ]);
}
$this->line = 1;
- $this->smarty = $compiler->smarty;
+ $this->smarty = $compiler->template->smarty;
$this->compiler = $compiler;
- $this->ldel = preg_quote($this->smarty->left_delimiter, '/');
- $this->ldel_length = strlen($this->smarty->left_delimiter);
- $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
- $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;
+ $this->compiler->initDelimiterPreg();
+ $this->smarty_token_names[ 'LDEL' ] = $this->smarty->getLeftDelimiter();
+ $this->smarty_token_names[ 'RDEL' ] = $this->smarty->getRightDelimiter();
}
- public function PrintTrace()
- {
+ /**
+ * open lexer/parser trace file
+ *
+ */
+ public function PrintTrace()
+ {
$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;
- }
+ /**
+ * replace placeholders with runtime preg code
+ *
+ * @param string $preg
+ *
+ * @return string
+ */
+ public function replace($preg)
+ {
+ return $this->compiler->replaceDelimiter($preg);
+ }
-
- private $_yy_state = 1;
- private $_yy_stack = array();
+ /**
+ * check if current value is an autoliteral left delimiter
+ *
+ * @return bool
+ */
+ public function isAutoLiteral()
+ {
+ return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
+ strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
+ } // end function
public function yylex()
{
@@ -266,56 +282,65 @@ class Smarty_Internal_Templatelexer
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);
+ 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);
+ 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);
+ 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);
+ $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);
+ 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;
+ $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()
{
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)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS");
}
- if (!isset($this->dataLenght)) {
- $this->dataLenght = strlen($this->data);
+ if (!isset($this->dataLength)) {
+ $this->dataLength = strlen($this->data);
}
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
-
do {
- if (preg_match($this->yy_global_pattern1,$this->data, $yymatches, null, $this->counter)) {
- $yymatches = array_filter($yymatches);
- if (empty($yymatches)) {
+ if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
+ if (!isset($yymatches[ 0 ][ 1 ])) {
+ $yymatches = preg_grep("/(.|\s)+/", $yymatches);
+ } else {
+ $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');
+ ' an empty string. Input "' . substr(
+ $this->data,
+ $this->counter,
+ 5
+ ) . '... state TEXT');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -333,108 +358,102 @@ class Smarty_Internal_Templatelexer
} elseif ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[ $this->counter ]);
}
break;
} while (true);
+ }
- } // end function
-
-
- const TEXT = 1;
- function yy_r1_1()
+ public function yy_r1_1()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r1_2()
+ public function yy_r1_2()
{
-
- preg_match("/[*]{$this->rdel}/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
- if (isset($match[0][1])) {
- $to = $match[0][1] + strlen($match[0][0]);
+ preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $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->right_delimiter}'");
+ $this->compiler->trigger_template_error("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
}
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
return false;
- }
- function yy_r1_3()
+ }
+
+ public function yy_r1_4()
{
+ $this->compiler->getTagCompiler('private_php')->parsePhp($this);
+ }
- $obj = new Smarty_Internal_Compile_Private_Php();
- $obj->parsePhp($this);
- }
- function yy_r1_7()
+ public function yy_r1_8()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- 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);
- }
- }
- function yy_r1_8()
+ public function yy_r1_10()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+ $this->yypushstate(self::LITERAL);
+ }
- 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;
- }
- }
- function yy_r1_9()
+ public function yy_r1_12()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+ $this->yypushstate(self::LITERAL);
+ } // end function
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r1_10()
+ public function yy_r1_14()
{
+ $this->yypushstate(self::TAG);
+ return true;
+ }
- $obj = new Smarty_Internal_Compile_Private_Php();
- $obj->parsePhp($this);
- }
- function yy_r1_19()
+ public function yy_r1_16()
{
+ $this->compiler->getTagCompiler('private_php')->parsePhp($this);
+ }
- $to = strlen($this->data);
- 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);
- if (isset($match[0][1])) {
- $to = $match[0][1];
- }
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
+ public function yy_r1_19()
+ {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
-
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)SMARTYal(if|elseif|else if|while)\\s+)|\G((SMARTYldel)SMARTYalfor\\s+)|\G((SMARTYldel)SMARTYalforeach(?![^\s]))|\G((SMARTYldel)SMARTYalsetfilter\\s+)|\G((SMARTYldel)SMARTYalmake_nocache\\s+)|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$]smarty\\.block\\.(child|parent)\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/][0-9]*[a-zA-Z_]\\w*\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal)/isS");
}
- if (!isset($this->dataLenght)) {
- $this->dataLenght = strlen($this->data);
+ if (!isset($this->dataLength)) {
+ $this->dataLength = strlen($this->data);
}
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
-
do {
- if (preg_match($this->yy_global_pattern2,$this->data, $yymatches, null, $this->counter)) {
- $yymatches = array_filter($yymatches);
- if (empty($yymatches)) {
+ if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
+ if (!isset($yymatches[ 0 ][ 1 ])) {
+ $yymatches = preg_grep("/(.|\s)+/", $yymatches);
+ } else {
+ $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');
+ ' an empty string. Input "' . substr(
+ $this->data,
+ $this->counter,
+ 5
+ ) . '... state TAG');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -452,120 +471,130 @@ class Smarty_Internal_Templatelexer
} elseif ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[ $this->counter ]);
}
break;
} while (true);
+ }
- } // end function
-
-
- const TAG = 2;
- function yy_r2_1()
+ public function yy_r2_1()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_3()
+ public function yy_r2_4()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_4()
+ public function yy_r2_6()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_5()
+ public function yy_r2_8()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_6()
+ public function yy_r2_10()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_7()
+ public function yy_r2_12()
{
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
+ $this->taglineno = $this->line;
+ }
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
- $this->taglineno = $this->line;
- }
- function yy_r2_9()
+ public function yy_r2_15()
{
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
+ $this->taglineno = $this->line;
+ }
- $this->yypopstate();
- $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
- $this->taglineno = $this->line;
- }
- function yy_r2_10()
+ public function yy_r2_18()
{
+ $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
+ $this->taglineno = $this->line;
+ }
- if ($this->_yy_stack[count($this->_yy_stack)-1] == self::TEXT) {
+ public function yy_r2_20()
+ {
+ if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) {
$this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
$this->taglineno = $this->line;
- } else {
- $this->value = $this->smarty->left_delimiter;
+ } else {
+ $this->value = $this->smarty->getLeftDelimiter();
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY);
$this->taglineno = $this->line;
- }
- }
- function yy_r2_12()
- {
+ }
+ } // end function
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r2_13()
+ public function yy_r2_23()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yybegin(self::TAGBODY);
- $this->taglineno = $this->line;
- }
+ public function yy_r2_25()
+ {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yybegin(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
-
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)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->dataLenght)) {
- $this->dataLenght = strlen($this->data);
+ if (!isset($this->dataLength)) {
+ $this->dataLength = strlen($this->data);
}
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
-
do {
- if (preg_match($this->yy_global_pattern3,$this->data, $yymatches, null, $this->counter)) {
- $yymatches = array_filter($yymatches);
- if (empty($yymatches)) {
+ if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
+ if (!isset($yymatches[ 0 ][ 1 ])) {
+ $yymatches = preg_grep("/(.|\s)+/", $yymatches);
+ } else {
+ $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');
+ ' an empty string. Input "' . substr(
+ $this->data,
+ $this->counter,
+ 5
+ ) . '... state TAGBODY');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -583,285 +612,279 @@ class Smarty_Internal_Templatelexer
} elseif ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[ $this->counter ]);
}
break;
} while (true);
+ }
- } // end function
-
-
- const TAGBODY = 3;
- function yy_r3_1()
- {
-
- $this->token = Smarty_Internal_Templateparser::TP_RDEL;
- $this->yypopstate();
- }
- function yy_r3_2()
+ public function yy_r3_1()
{
+ $this->token = Smarty_Internal_Templateparser::TP_RDEL;
+ $this->yypopstate();
+ }
- 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;
- }
- }
- function yy_r3_3()
+ public function yy_r3_2()
{
+ $this->yypushstate(self::TAG);
+ return true;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypushstate(self::DOUBLEQUOTEDSTRING);
- }
- function yy_r3_4()
+ public function yy_r3_4()
{
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypushstate(self::DOUBLEQUOTEDSTRING);
+ $this->compiler->enterDoubleQuote();
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
- }
- function yy_r3_5()
+ public function yy_r3_5()
{
+ $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
- $this->taglineno = $this->line;
- }
- function yy_r3_7()
+ public function yy_r3_6()
{
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
- }
- function yy_r3_8()
+ public function yy_r3_7()
{
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
- }
- function yy_r3_9()
+ public function yy_r3_8()
{
+ $this->token = Smarty_Internal_Templateparser::TP_ISIN;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_ISIN;
- }
- function yy_r3_10()
+ public function yy_r3_9()
{
+ $this->token = Smarty_Internal_Templateparser::TP_AS;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_AS;
- }
- function yy_r3_11()
+ public function yy_r3_10()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TO;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TO;
- }
- function yy_r3_12()
+ public function yy_r3_11()
{
+ $this->token = Smarty_Internal_Templateparser::TP_STEP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_STEP;
- }
- function yy_r3_13()
+ public function yy_r3_12()
{
+ $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
- }
- function yy_r3_14()
+ public function yy_r3_13()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
- }
- function yy_r3_19()
+ public function yy_r3_15()
{
+ $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
- }
- function yy_r3_21()
+ public function yy_r3_17()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
- }
- function yy_r3_25()
+ public function yy_r3_20()
{
+ $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
- }
- function yy_r3_28()
+ public function yy_r3_23()
{
+ $this->token = Smarty_Internal_Templateparser::TP_NOT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_NOT;
- }
- function yy_r3_31()
+ public function yy_r3_24()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
- }
- function yy_r3_35()
+ public function yy_r3_28()
{
+ $this->token = Smarty_Internal_Templateparser::TP_OPENP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_OPENP;
- }
- function yy_r3_36()
+ public function yy_r3_29()
{
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
- }
- function yy_r3_37()
+ public function yy_r3_30()
{
+ $this->token = Smarty_Internal_Templateparser::TP_OPENB;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_OPENB;
- }
- function yy_r3_38()
+ public function yy_r3_31()
{
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
- }
- function yy_r3_39()
+ public function yy_r3_32()
{
+ $this->token = Smarty_Internal_Templateparser::TP_PTR;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_PTR;
- }
- function yy_r3_40()
+ public function yy_r3_33()
{
+ $this->token = Smarty_Internal_Templateparser::TP_APTR;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_APTR;
- }
- function yy_r3_41()
+ public function yy_r3_34()
{
+ $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
- }
- function yy_r3_42()
+ public function yy_r3_35()
{
+ $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
- }
- function yy_r3_44()
+ public function yy_r3_37()
{
+ $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
- }
- function yy_r3_46()
+ public function yy_r3_39()
{
+ $this->token = Smarty_Internal_Templateparser::TP_MATH;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_MATH;
- }
- function yy_r3_48()
+ public function yy_r3_41()
{
+ $this->token = Smarty_Internal_Templateparser::TP_AT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_AT;
- }
- function yy_r3_49()
+ public function yy_r3_42()
{
+ $this->token = Smarty_Internal_Templateparser::TP_HATCH;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_HATCH;
- }
- function yy_r3_50()
+ public function yy_r3_43()
{
+ // 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);
+ $this->value = $match[ 0 ];
+ $this->token = Smarty_Internal_Templateparser::TP_SPACE;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_ATTR;
+ }
+ }
- // 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) {
- preg_match("/\s+/",$this->value,$match);
- $this->value = $match[0];
- $this->token = Smarty_Internal_Templateparser::TP_SPACE;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_ATTR;
- }
- }
- function yy_r3_51()
+ public function yy_r3_44()
{
-
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
- }
- function yy_r3_54()
- {
+ }
- $this->token = Smarty_Internal_Templateparser::TP_ID;
- }
- function yy_r3_55()
+ public function yy_r3_47()
{
+ $this->token = Smarty_Internal_Templateparser::TP_ID;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
- }
- function yy_r3_56()
+ public function yy_r3_48()
{
+ $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->yypopstate();
- }
- function yy_r3_57()
+ public function yy_r3_49()
{
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->yypopstate();
+ }
- $this->token = Smarty_Internal_Templateparser::TP_VERT;
- }
- function yy_r3_58()
+ public function yy_r3_50()
{
+ $this->token = Smarty_Internal_Templateparser::TP_VERT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_DOT;
- }
- function yy_r3_59()
+ public function yy_r3_51()
{
+ $this->token = Smarty_Internal_Templateparser::TP_DOT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_COMMA;
- }
- function yy_r3_60()
+ public function yy_r3_52()
{
+ $this->token = Smarty_Internal_Templateparser::TP_COMMA;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
- }
- function yy_r3_61()
+ public function yy_r3_53()
{
+ $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
- }
- function yy_r3_62()
+ public function yy_r3_54()
{
+ $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_COLON;
- }
- function yy_r3_63()
+ public function yy_r3_55()
{
+ $this->token = Smarty_Internal_Templateparser::TP_COLON;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_QMARK;
- }
- function yy_r3_64()
+ public function yy_r3_56()
{
+ $this->token = Smarty_Internal_Templateparser::TP_QMARK;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_HEX;
- }
- function yy_r3_65()
+ public function yy_r3_57()
{
+ $this->token = Smarty_Internal_Templateparser::TP_HEX;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_SPACE;
- }
- function yy_r3_66()
+ public function yy_r3_58()
{
+ $this->token = Smarty_Internal_Templateparser::TP_SPACE;
+ } // end function
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
+ public function yy_r3_59()
+ {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
-
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((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS");
}
- if (!isset($this->dataLenght)) {
- $this->dataLenght = strlen($this->data);
+ if (!isset($this->dataLength)) {
+ $this->dataLength = strlen($this->data);
}
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
-
do {
- if (preg_match($this->yy_global_pattern4,$this->data, $yymatches, null, $this->counter)) {
- $yymatches = array_filter($yymatches);
- if (empty($yymatches)) {
+ if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
+ if (!isset($yymatches[ 0 ][ 1 ])) {
+ $yymatches = preg_grep("/(.|\s)+/", $yymatches);
+ } else {
+ $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');
+ ' an empty string. Input "' . substr(
+ $this->data,
+ $this->counter,
+ 5
+ ) . '... state LITERAL');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -879,73 +902,68 @@ class Smarty_Internal_Templatelexer
} elseif ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[ $this->counter ]);
}
break;
} while (true);
+ }
- } // end function
-
-
- const LITERAL = 4;
- function yy_r4_1()
+ public function yy_r4_1()
{
+ $this->literal_cnt++;
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ }
- $this->literal_cnt++;
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- }
- function yy_r4_2()
+ public function yy_r4_3()
{
+ if ($this->literal_cnt) {
+ $this->literal_cnt--;
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+ $this->yypopstate();
+ }
+ }
- if ($this->literal_cnt) {
- $this->literal_cnt--;
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
- $this->yypopstate();
- }
- }
- function yy_r4_3()
+ public function yy_r4_5()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ } // end function
- $to = strlen($this->data);
- 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 {
- $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_Templateparser::TP_LITERAL;
- }
-
-
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((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS");
}
- if (!isset($this->dataLenght)) {
- $this->dataLenght = strlen($this->data);
+ if (!isset($this->dataLength)) {
+ $this->dataLength = strlen($this->data);
}
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
-
do {
- if (preg_match($this->yy_global_pattern5,$this->data, $yymatches, null, $this->counter)) {
- $yymatches = array_filter($yymatches);
- if (empty($yymatches)) {
+ if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
+ if (!isset($yymatches[ 0 ][ 1 ])) {
+ $yymatches = preg_grep("/(.|\s)+/", $yymatches);
+ } else {
+ $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');
+ ' an empty string. Input "' . substr(
+ $this->data,
+ $this->counter,
+ 5
+ ) . '... state DOUBLEQUOTEDSTRING');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -963,100 +981,80 @@ class Smarty_Internal_Templatelexer
} elseif ($r === false) {
$this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= $this->dataLenght) {
+ if ($this->counter >= $this->dataLength) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[ $this->counter ]);
}
break;
} while (true);
+ }
- } // end function
-
-
- const DOUBLEQUOTEDSTRING = 5;
- function yy_r5_1()
+ public function yy_r5_1()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r5_2()
+ public function yy_r5_3()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r5_3()
+ public function yy_r5_5()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- 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;
- }
- }
- function yy_r5_4()
+ public function yy_r5_7()
{
+ $this->yypushstate(self::TAG);
+ return true;
+ }
- 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;
- }
- }
- function yy_r5_5()
+ public function yy_r5_9()
{
+ $this->yypushstate(self::TAG);
+ return true;
+ }
- 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);
- }
- }
- function yy_r5_6()
+ public function yy_r5_11()
{
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->taglineno = $this->line;
+ $this->yypushstate(self::TAGBODY);
+ }
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypopstate();
- }
- function yy_r5_7()
+ public function yy_r5_13()
{
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypopstate();
+ }
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->value = substr($this->value,0,-1);
- $this->yypushstate(self::TAGBODY);
- $this->taglineno = $this->line;
- }
- function yy_r5_8()
+ public function yy_r5_14()
{
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->value = substr($this->value, 0, -1);
+ $this->yypushstate(self::TAGBODY);
+ $this->taglineno = $this->line;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
- }
- function yy_r5_9()
+ public function yy_r5_15()
{
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r5_10()
+ public function yy_r5_16()
{
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
- function yy_r5_14()
+ public function yy_r5_17()
{
-
- $to = strlen($this->data);
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
- }
-
- \ No newline at end of file
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+}