2015-08-23 22:38:18 +02:00
|
|
|
<?php
|
2016-01-12 02:47:38 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Smarty.
|
|
|
|
*
|
|
|
|
* (c) 2015 Uwe Tews
|
2015-08-23 22:38:18 +02:00
|
|
|
*
|
2016-01-12 02:47:38 +01:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2015-08-23 22:38:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-01-12 02:47:38 +01:00
|
|
|
* Smarty_Internal_Templatelexer
|
|
|
|
* This is the template file lexer.
|
|
|
|
* It is generated from the smarty_internal_templatelexer.plex file
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Uwe Tews <uwe.tews@googlemail.com>
|
2015-08-23 22:38:18 +02:00
|
|
|
*/
|
|
|
|
class Smarty_Internal_Templatelexer
|
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
/**
|
|
|
|
* Source
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $data;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* byte counter
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $counter;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* token number
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $token;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* token value
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $value;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* current line
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $line;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* tag start line
|
|
|
|
*
|
|
|
|
* @var
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $taglineno;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* php code type
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $phpType = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* escaped left delimiter
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $ldel = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* escaped left delimiter length
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
public $ldel_length = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* escaped right delimiter
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $rdel = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* escaped right delimiter length
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
public $rdel_length = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* state number
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $state = 1;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $yyTraceFILE;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* trace prompt
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $yyTracePrompt;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2015-08-23 22:38:18 +02:00
|
|
|
public $smarty_token_names = array( // Text for parser error messages
|
2016-01-12 02:47:38 +01:00
|
|
|
'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',);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* constructor
|
|
|
|
*
|
|
|
|
* @param string $data template source
|
|
|
|
* @param Smarty_Internal_TemplateCompilerBase $compiler
|
|
|
|
*/
|
|
|
|
function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler)
|
|
|
|
{
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->data = $data;
|
|
|
|
$this->counter = 0;
|
2016-01-12 02:47:38 +01:00
|
|
|
if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) {
|
|
|
|
$this->counter += strlen($match[ 0 ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
$this->line = 1;
|
|
|
|
$this->smarty = $compiler->smarty;
|
|
|
|
$this->compiler = $compiler;
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->ldel = preg_quote($this->smarty->left_delimiter, '~');
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->rdel = preg_quote($this->smarty->right_delimiter, '~');
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter;
|
|
|
|
$this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function PrintTrace()
|
|
|
|
{
|
|
|
|
$this->yyTraceFILE = fopen('php://output', 'w');
|
|
|
|
$this->yyTracePrompt = '<br>';
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2015-08-23 22:38:18 +02:00
|
|
|
private $_yy_state = 1;
|
2016-01-12 02:47:38 +01:00
|
|
|
|
2015-08-23 22:38:18 +02:00
|
|
|
private $_yy_stack = array();
|
|
|
|
|
|
|
|
public function yylex()
|
|
|
|
{
|
|
|
|
return $this->{'yylex' . $this->_yy_state}();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function yypushstate($state)
|
|
|
|
{
|
|
|
|
if ($this->yyTraceFILE) {
|
2016-01-12 02:47:38 +01:00
|
|
|
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);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
array_push($this->_yy_stack, $this->_yy_state);
|
|
|
|
$this->_yy_state = $state;
|
|
|
|
if ($this->yyTraceFILE) {
|
2016-01-12 02:47:38 +01:00
|
|
|
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);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function yypopstate()
|
|
|
|
{
|
|
|
|
if ($this->yyTraceFILE) {
|
2016-01-12 02:47:38 +01:00
|
|
|
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);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
$this->_yy_state = array_pop($this->_yy_stack);
|
|
|
|
if ($this->yyTraceFILE) {
|
2016-01-12 02:47:38 +01:00
|
|
|
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);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function yybegin($state)
|
|
|
|
{
|
|
|
|
$this->_yy_state = $state;
|
|
|
|
if ($this->yyTraceFILE) {
|
2016-01-12 02:47:38 +01:00
|
|
|
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);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function yylex1()
|
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
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";
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2016-01-12 02:47:38 +01:00
|
|
|
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$yysubmatches = $yymatches;
|
2016-01-12 02:47:38 +01:00
|
|
|
if (strlen($yysubmatches[ 0 ]) < 200) {
|
|
|
|
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
|
|
|
} else {
|
|
|
|
$yymatches = array_filter($yymatches, 'strlen');
|
|
|
|
}
|
|
|
|
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');
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
next($yymatches); // skip global match
|
|
|
|
$this->token = key($yymatches); // token number
|
|
|
|
$this->value = current($yymatches); // token value
|
2016-01-12 02:47:38 +01:00
|
|
|
$r = $this->{'yy_r1_' . $this->token}();
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($r === null) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
// accept this token
|
|
|
|
return true;
|
|
|
|
} elseif ($r === true) {
|
|
|
|
// we have changed state
|
|
|
|
// process this token in the new state
|
|
|
|
return $this->yylex();
|
|
|
|
} elseif ($r === false) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
// skip this token
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (true);
|
|
|
|
} // end function
|
|
|
|
|
|
|
|
const TEXT = 1;
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_1()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_2()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
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 ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'");
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
|
|
|
return false;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$obj = new Smarty_Internal_Compile_Private_Php();
|
|
|
|
$obj->parsePhp($this);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_7()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
|
|
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
|
|
|
|
) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
} else {
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
|
|
|
$this->yypushstate(self::LITERAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_8()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
|
|
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
|
|
|
|
) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypushstate(self::TAG);
|
|
|
|
return true;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_9()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_10()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$obj = new Smarty_Internal_Compile_Private_Php();
|
|
|
|
$obj->parsePhp($this);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r1_19()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$to = strlen($this->data);
|
2016-01-12 02:47:38 +01:00
|
|
|
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 ];
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function yylex2()
|
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
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*[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";
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2016-01-12 02:47:38 +01:00
|
|
|
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$yysubmatches = $yymatches;
|
2016-01-12 02:47:38 +01:00
|
|
|
if (strlen($yysubmatches[ 0 ]) < 200) {
|
|
|
|
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
|
|
|
} else {
|
|
|
|
$yymatches = array_filter($yymatches, 'strlen');
|
|
|
|
}
|
|
|
|
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');
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
next($yymatches); // skip global match
|
|
|
|
$this->token = key($yymatches); // token number
|
|
|
|
$this->value = current($yymatches); // token value
|
2016-01-12 02:47:38 +01:00
|
|
|
$r = $this->{'yy_r2_' . $this->token}();
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($r === null) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
// accept this token
|
|
|
|
return true;
|
|
|
|
} elseif ($r === true) {
|
|
|
|
// we have changed state
|
|
|
|
// process this token in the new state
|
|
|
|
return $this->yylex();
|
|
|
|
} elseif ($r === false) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
// skip this token
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (true);
|
|
|
|
} // end function
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
const TAG = 2;
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_1()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_4()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->taglineno = $this->line;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_5()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_6()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->yypopstate();
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_8()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypopstate();
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_9()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
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;
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_11()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r2_12()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
|
|
|
$this->yybegin(self::TAGBODY);
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
public function yylex3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
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|(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 ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
do {
|
|
|
|
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
|
|
|
|
$yysubmatches = $yymatches;
|
|
|
|
if (strlen($yysubmatches[ 0 ]) < 200) {
|
|
|
|
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
|
|
|
} else {
|
|
|
|
$yymatches = array_filter($yymatches, 'strlen');
|
|
|
|
}
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
next($yymatches); // skip global match
|
|
|
|
$this->token = key($yymatches); // token number
|
|
|
|
$this->value = current($yymatches); // token value
|
|
|
|
$r = $this->{'yy_r3_' . $this->token}();
|
|
|
|
if ($r === null) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
// accept this token
|
|
|
|
return true;
|
|
|
|
} elseif ($r === true) {
|
|
|
|
// we have changed state
|
|
|
|
// process this token in the new state
|
|
|
|
return $this->yylex();
|
|
|
|
} elseif ($r === false) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
// skip this token
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (true);
|
|
|
|
} // end function
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
const TAGBODY = 3;
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_1()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
|
|
|
|
$this->yypopstate();
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_2()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
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;
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
|
|
|
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_4()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_5()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
|
|
|
|
$this->taglineno = $this->line;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_7()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_8()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_9()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_10()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_AS;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_11()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TO;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_12()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_STEP;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_13()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_14()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_19()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_24()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_27()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_NOT;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_30()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_34()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_35()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_36()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_37()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_38()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_PTR;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_39()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_APTR;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_40()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_41()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_43()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_45()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_MATH;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_47()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_AT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_48()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_49()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
// resolve conflicts with shorttag and right_delimiter starting with '='
|
2016-01-12 02:47:38 +01:00
|
|
|
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 ];
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
|
|
|
} else {
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_ATTR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_50()
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
function yy_r3_53()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_ID;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_54()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_55()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
|
|
|
$this->yypopstate();
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_56()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_VERT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_57()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_DOT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_58()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_59()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_60()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_61()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_COLON;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_62()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_63()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_HEX;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_64()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r3_65()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
public function yylex4()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
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";
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2016-01-12 02:47:38 +01:00
|
|
|
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$yysubmatches = $yymatches;
|
2016-01-12 02:47:38 +01:00
|
|
|
if (strlen($yysubmatches[ 0 ]) < 200) {
|
|
|
|
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
|
|
|
} else {
|
|
|
|
$yymatches = array_filter($yymatches, 'strlen');
|
|
|
|
}
|
|
|
|
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');
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
next($yymatches); // skip global match
|
|
|
|
$this->token = key($yymatches); // token number
|
|
|
|
$this->value = current($yymatches); // token value
|
2016-01-12 02:47:38 +01:00
|
|
|
$r = $this->{'yy_r4_' . $this->token}();
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($r === null) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
// accept this token
|
|
|
|
return true;
|
|
|
|
} elseif ($r === true) {
|
|
|
|
// we have changed state
|
|
|
|
// process this token in the new state
|
|
|
|
return $this->yylex();
|
|
|
|
} elseif ($r === false) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
// skip this token
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (true);
|
|
|
|
} // end function
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
const LITERAL = 4;
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r4_1()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->literal_cnt ++;
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r4_2()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
if ($this->literal_cnt) {
|
|
|
|
$this->literal_cnt --;
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
|
|
|
} else {
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
|
|
|
$this->yypopstate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r4_3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$to = strlen($this->data);
|
2016-01-12 02:47:38 +01:00
|
|
|
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 ];
|
2015-08-23 22:38:18 +02:00
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
public function yylex5()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
2016-01-12 02:47:38 +01:00
|
|
|
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";
|
|
|
|
}
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
2016-01-12 02:47:38 +01:00
|
|
|
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$yysubmatches = $yymatches;
|
2016-01-12 02:47:38 +01:00
|
|
|
if (strlen($yysubmatches[ 0 ]) < 200) {
|
|
|
|
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
|
|
|
} else {
|
|
|
|
$yymatches = array_filter($yymatches, 'strlen');
|
|
|
|
}
|
|
|
|
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');
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
next($yymatches); // skip global match
|
|
|
|
$this->token = key($yymatches); // token number
|
|
|
|
$this->value = current($yymatches); // token value
|
2016-01-12 02:47:38 +01:00
|
|
|
$r = $this->{'yy_r5_' . $this->token}();
|
2015-08-23 22:38:18 +02:00
|
|
|
if ($r === null) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
// accept this token
|
|
|
|
return true;
|
|
|
|
} elseif ($r === true) {
|
|
|
|
// we have changed state
|
|
|
|
// process this token in the new state
|
|
|
|
return $this->yylex();
|
|
|
|
} elseif ($r === false) {
|
|
|
|
$this->counter += strlen($this->value);
|
|
|
|
$this->line += substr_count($this->value, "\n");
|
|
|
|
if ($this->counter >= strlen($this->data)) {
|
|
|
|
return false; // end of input
|
|
|
|
}
|
|
|
|
// skip this token
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
} while (true);
|
|
|
|
} // end function
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
const DOUBLEQUOTEDSTRING = 5;
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_1()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_2()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_3()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
|
|
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
|
|
|
|
) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypushstate(self::TAG);
|
|
|
|
return true;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_4()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
|
|
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
|
|
|
|
) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
} else {
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypushstate(self::TAG);
|
|
|
|
return true;
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_5()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
if ($this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
|
|
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false
|
|
|
|
) {
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
} else {
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
|
|
|
$this->taglineno = $this->line;
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypushstate(self::TAGBODY);
|
2015-08-23 22:38:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_6()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
|
|
|
$this->yypopstate();
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_7()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
|
|
|
$this->value = substr($this->value, 0, - 1);
|
2016-01-12 02:47:38 +01:00
|
|
|
$this->yypushstate(self::TAGBODY);
|
2015-08-23 22:38:18 +02:00
|
|
|
$this->taglineno = $this->line;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_8()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_9()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_10()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
2016-01-12 02:47:38 +01:00
|
|
|
function yy_r5_14()
|
2015-08-23 22:38:18 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
$to = strlen($this->data);
|
|
|
|
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
|
|
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|