- PSR-2 code style fixes for config and template file Lexer/Parser generated with

the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer
    https://github.com/smarty-php/smarty/pull/483
This commit is contained in:
uwetews
2018-08-31 02:37:47 +02:00
parent 3a78a21f14
commit 7a8607fe17
8 changed files with 629 additions and 595 deletions

View File

@@ -1,4 +1,9 @@
===== 3.1.33-dev-7 ===== ===== 3.1.33-dev-8 =====
31.08.2018
- PSR-2 code style fixes for config and template file Lexer/Parser generated with
the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer
https://github.com/smarty-php/smarty/pull/483
26.08.2018 26.08.2018
- bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable - bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable
like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481 like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481

View File

@@ -308,7 +308,7 @@ text {
if (isset($match[0][1])) { if (isset($match[0][1])) {
$to = $match[0][1]; $to = $match[0][1];
} else { } else {
$this->compiler->trigger_template_error ('missing or misspelled literal closing tag'); $this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
} }
$this->value = substr($this->data,$this->counter,$to-$this->counter); $this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;

View File

@@ -61,7 +61,7 @@ class Smarty_Internal_Templateparser
/** /**
* root parse tree buffer * root parse tree buffer
* *
* @var Smarty_Internal_ParseTree * @var Smarty_Internal_ParseTree_Template
*/ */
public $root_buffer; public $root_buffer;

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.33-dev-7'; const SMARTY_VERSION = '3.1.33-dev-8';
/** /**
* define variable scopes * define variable scopes
*/ */

View File

@@ -27,73 +27,86 @@ class Smarty_Internal_Configfilelexer
const COMMENT = 4; const COMMENT = 4;
const SECTION = 5; const SECTION = 5;
const TRIPPLE = 6; const TRIPPLE = 6;
/** /**
* Source * Source
* *
* @var string * @var string
*/ */
public $data; public $data;
/** /**
* Source length * Source length
* *
* @var int * @var int
*/ */
public $dataLength = null; public $dataLength = null;
/** /**
* byte counter * byte counter
* *
* @var int * @var int
*/ */
public $counter; public $counter;
/** /**
* token number * token number
* *
* @var int * @var int
*/ */
public $token; public $token;
/** /**
* token value * token value
* *
* @var string * @var string
*/ */
public $value; public $value;
/** /**
* current line * current line
* *
* @var int * @var int
*/ */
public $line; public $line;
/** /**
* state number * state number
* *
* @var int * @var int
*/ */
public $state = 1; public $state = 1;
/** /**
* Smarty object * Smarty object
* *
* @var Smarty * @var Smarty
*/ */
public $smarty = null; public $smarty = null;
/** /**
* trace file * trace file
* *
* @var resource * @var resource
*/ */
public $yyTraceFILE; public $yyTraceFILE;
/** /**
* trace prompt * trace prompt
* *
* @var string * @var string
*/ */
public $yyTracePrompt; public $yyTracePrompt;
/** /**
* state names * state names
* *
* @var array * @var array
*/ */
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', public $state_name = array(
6 => 'TRIPPLE'); 1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'
);
/** /**
* token names * token names
* *
@@ -101,30 +114,40 @@ class Smarty_Internal_Configfilelexer
*/ */
public $smarty_token_names = array( // Text for parser error messages public $smarty_token_names = array( // Text for parser error messages
); );
/** /**
* compiler object * compiler object
* *
* @var Smarty_Internal_Config_File_Compiler * @var Smarty_Internal_Config_File_Compiler
*/ */
private $compiler = null; private $compiler = null;
/** /**
* copy of config_booleanize * copy of config_booleanize
* *
* @var bool * @var bool
*/ */
private $configBooleanize = false; private $configBooleanize = false;
/** /**
* storage for assembled token patterns * storage for assembled token patterns
* *
* @var string * @var string
*/ */
private $yy_global_pattern1 = null; private $yy_global_pattern1 = null;
private $yy_global_pattern2 = null; private $yy_global_pattern2 = null;
private $yy_global_pattern3 = null; private $yy_global_pattern3 = null;
private $yy_global_pattern4 = null; private $yy_global_pattern4 = null;
private $yy_global_pattern5 = null; private $yy_global_pattern5 = null;
private $yy_global_pattern6 = null; private $yy_global_pattern6 = null;
private $_yy_state = 1; private $_yy_state = 1;
private $_yy_stack = array(); private $_yy_stack = array();
/** /**
@@ -166,35 +189,27 @@ class Smarty_Internal_Configfilelexer
public function yypushstate($state) public function yypushstate($state)
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
"%sState push %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$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); array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
"%snew State %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
public function yypopstate() public function yypopstate()
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
"%sState pop %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$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) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
"%snew State %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
@@ -202,10 +217,8 @@ class Smarty_Internal_Configfilelexer
{ {
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
"%sState set %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
@@ -231,8 +244,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state START');
5) . '... state START');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -264,45 +276,45 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r1_1() public function yy_r1_1()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
$this->yypushstate(self::COMMENT); $this->yypushstate(self::COMMENT);
} }
function yy_r1_2() public function yy_r1_2()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB; $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
$this->yypushstate(self::SECTION); $this->yypushstate(self::SECTION);
} }
function yy_r1_3() public function yy_r1_3()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
} }
function yy_r1_4() public function yy_r1_4()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
$this->yypushstate(self::VALUE); $this->yypushstate(self::VALUE);
} // end function } // end function
function yy_r1_5() public function yy_r1_5()
{ {
return false; return false;
} }
function yy_r1_6() public function yy_r1_6()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
} }
function yy_r1_7() public function yy_r1_7()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_ID; $this->token = Smarty_Internal_Configfileparser::TPC_ID;
} }
function yy_r1_8() public function yy_r1_8()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER; $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
} }
@@ -329,8 +341,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state VALUE');
5) . '... state VALUE');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -362,42 +373,42 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r2_1() public function yy_r2_1()
{ {
return false; return false;
} }
function yy_r2_2() public function yy_r2_2()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_3() public function yy_r2_3()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_INT; $this->token = Smarty_Internal_Configfileparser::TPC_INT;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_4() public function yy_r2_4()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
$this->yypushstate(self::TRIPPLE); $this->yypushstate(self::TRIPPLE);
} }
function yy_r2_5() public function yy_r2_5()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_6() public function yy_r2_6()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
$this->yypopstate(); $this->yypopstate();
} // end function } // end function
function yy_r2_7() public function yy_r2_7()
{ {
if (!$this->configBooleanize || if (!$this->configBooleanize ||
!in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) { !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) {
@@ -410,13 +421,13 @@ class Smarty_Internal_Configfilelexer
} }
} }
function yy_r2_8() public function yy_r2_8()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_9() public function yy_r2_9()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->value = ''; $this->value = '';
@@ -444,8 +455,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state NAKED_STRING_VALUE');
5) . '... state NAKED_STRING_VALUE');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -477,7 +487,7 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r3_1() public function yy_r3_1()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate(); $this->yypopstate();
@@ -504,8 +514,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state COMMENT');
5) . '... state COMMENT');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -537,17 +546,17 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r4_1() public function yy_r4_1()
{ {
return false; return false;
} }
function yy_r4_2() public function yy_r4_2()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
} // end function } // end function
function yy_r4_3() public function yy_r4_3()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
$this->yypopstate(); $this->yypopstate();
@@ -574,8 +583,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state SECTION');
5) . '... state SECTION');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -607,12 +615,12 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r5_1() public function yy_r5_1()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_DOT; $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
} }
function yy_r5_2() public function yy_r5_2()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION; $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
$this->yypopstate(); $this->yypopstate();
@@ -639,8 +647,7 @@ class Smarty_Internal_Configfilelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state TRIPPLE');
5) . '... state TRIPPLE');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -672,21 +679,21 @@ class Smarty_Internal_Configfilelexer
} while (true); } while (true);
} }
function yy_r6_1() public function yy_r6_1()
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
$this->yypopstate(); $this->yypopstate();
$this->yypushstate(self::START); $this->yypushstate(self::START);
} }
function yy_r6_2() public function yy_r6_2()
{ {
$to = strlen($this->data); $to = strlen($this->data);
preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[ 0 ][ 1 ])) { if (isset($match[ 0 ][ 1 ])) {
$to = $match[ 0 ][ 1 ]; $to = $match[ 0 ][ 1 ];
} else { } else {
$this->compiler->trigger_template_error('missing or misspelled literal closing tag'); $this->compiler->trigger_config_file_error('missing or misspelled literal closing tag');
} }
$this->value = substr($this->data, $this->counter, $to - $this->counter); $this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;

View File

@@ -57,27 +57,32 @@ class Smarty_Internal_Configfileparser
const YYERRORSYMBOL = 19; const YYERRORSYMBOL = 19;
const YYERRSYMDT = 'yy0'; const YYERRSYMDT = 'yy0';
const YYFALLBACK = 0; const YYFALLBACK = 0;
static public $yy_action = array(
public static $yy_action = array(
32, 31, 30, 29, 35, 13, 19, 3, 24, 26, 32, 31, 30, 29, 35, 13, 19, 3, 24, 26,
59, 9, 14, 1, 16, 25, 11, 28, 25, 11, 59, 9, 14, 1, 16, 25, 11, 28, 25, 11,
17, 27, 34, 20, 18, 15, 23, 5, 6, 22, 17, 27, 34, 20, 18, 15, 23, 5, 6, 22,
10, 8, 4, 12, 2, 33, 7, 21, 10, 8, 4, 12, 2, 33, 7, 21,
); );
static public $yy_lookahead = array(
public static $yy_lookahead = array(
7, 8, 9, 10, 11, 12, 5, 23, 15, 16, 7, 8, 9, 10, 11, 12, 5, 23, 15, 16,
20, 21, 2, 23, 4, 17, 18, 14, 17, 18, 20, 21, 2, 23, 4, 17, 18, 14, 17, 18,
13, 14, 25, 26, 15, 2, 17, 3, 3, 17, 13, 14, 25, 26, 15, 2, 17, 3, 3, 17,
25, 25, 6, 1, 23, 27, 22, 24, 25, 25, 6, 1, 23, 27, 22, 24,
); );
static public $yy_shift_ofst = array(
public static $yy_shift_ofst = array(
-8, 1, 1, 1, -7, -2, -2, 32, -8, -8, -8, 1, 1, 1, -7, -2, -2, 32, -8, -8,
-8, 9, 10, 7, 25, 24, 23, 3, 12, 26, -8, 9, 10, 7, 25, 24, 23, 3, 12, 26,
); );
static public $yy_reduce_ofst = array(
public static $yy_reduce_ofst = array(
-10, -3, -3, -3, 8, 6, 5, 13, 11, 14, -10, -3, -3, -3, 8, 6, 5, 13, 11, 14,
-16, -16,
); );
static public $yyExpectedTokens = array(
public static $yyExpectedTokens = array(
array(), array(),
array(5, 17, 18,), array(5, 17, 18,),
array(5, 17, 18,), array(5, 17, 18,),
@@ -115,13 +120,16 @@ class Smarty_Internal_Configfileparser
array(), array(),
array(), array(),
); );
static public $yy_default = array(
public static $yy_default = array(
44, 37, 41, 40, 58, 58, 58, 36, 44, 39, 44, 37, 41, 40, 58, 58, 58, 36, 44, 39,
44, 58, 58, 58, 58, 58, 58, 58, 58, 58, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
43, 38, 57, 56, 53, 55, 54, 52, 51, 49, 43, 38, 57, 56, 53, 55, 54, 52, 51, 49,
48, 47, 46, 45, 42, 50, 48, 47, 46, 45, 42, 50,
); );
public static $yyFallback = array(); public static $yyFallback = array();
public static $yyRuleName = array( public static $yyRuleName = array(
'start ::= global_vars sections', 'start ::= global_vars sections',
'global_vars ::= var_list', 'global_vars ::= var_list',
@@ -146,6 +154,7 @@ class Smarty_Internal_Configfileparser
'newline ::= COMMENTSTART NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
'newline ::= COMMENTSTART NAKED_STRING NEWLINE', 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',
); );
public static $yyRuleInfo = array( public static $yyRuleInfo = array(
array(0 => 20, 1 => 2), array(0 => 20, 1 => 2),
array(0 => 21, 1 => 1), array(0 => 21, 1 => 1),
@@ -170,6 +179,7 @@ class Smarty_Internal_Configfileparser
array(0 => 25, 1 => 2), array(0 => 25, 1 => 2),
array(0 => 25, 1 => 3), array(0 => 25, 1 => 3),
); );
public static $yyReduceMap = array( public static $yyReduceMap = array(
0 => 0, 0 => 0,
2 => 0, 2 => 0,
@@ -194,46 +204,60 @@ class Smarty_Internal_Configfileparser
17 => 17, 17 => 17,
18 => 17, 18 => 17,
); );
/** /**
* helper map * helper map
* *
* @var array * @var array
*/ */
private static $escapes_single = array('\\' => '\\', private static $escapes_single = array(
'\'' => '\''); '\\' => '\\',
'\'' => '\''
);
/** /**
* result status * result status
* *
* @var bool * @var bool
*/ */
public $successful = true; public $successful = true;
/** /**
* return value * return value
* *
* @var mixed * @var mixed
*/ */
public $retvalue = 0; public $retvalue = 0;
/** /**
* @var * @var
*/ */
public $yymajor; public $yymajor;
/** /**
* compiler object * compiler object
* *
* @var Smarty_Internal_Config_File_Compiler * @var Smarty_Internal_Config_File_Compiler
*/ */
public $compiler = null; public $compiler = null;
/** /**
* smarty object * smarty object
* *
* @var Smarty * @var Smarty
*/ */
public $smarty = null; public $smarty = null;
public $yyTraceFILE; public $yyTraceFILE;
public $yyTracePrompt; public $yyTracePrompt;
public $yyidx; public $yyidx;
public $yyerrcnt; public $yyerrcnt;
public $yystack = array(); public $yystack = array();
public $yyTokenName = array( public $yyTokenName = array(
'$', 'OPENB', 'SECTION', 'CLOSEB', '$', 'OPENB', 'SECTION', 'CLOSEB',
'DOT', 'ID', 'EQUAL', 'FLOAT', 'DOT', 'ID', 'EQUAL', 'FLOAT',
@@ -243,30 +267,35 @@ class Smarty_Internal_Configfileparser
'start', 'global_vars', 'sections', 'var_list', 'start', 'global_vars', 'sections', 'var_list',
'section', 'newline', 'var', 'value', 'section', 'newline', 'var', 'value',
); );
/** /**
* lexer object * lexer object
* *
* @var Smarty_Internal_Configfilelexer * @var Smarty_Internal_Configfilelexer
*/ */
private $lex; private $lex;
/** /**
* internal error flag * internal error flag
* *
* @var bool * @var bool
*/ */
private $internalError = false; private $internalError = false;
/** /**
* copy of config_overwrite property * copy of config_overwrite property
* *
* @var bool * @var bool
*/ */
private $configOverwrite = false; private $configOverwrite = false;
/** /**
* copy of config_read_hidden property * copy of config_read_hidden property
* *
* @var bool * @var bool
*/ */
private $configReadHidden = false; private $configReadHidden = false;
private $_retvalue; private $_retvalue;
/** /**
@@ -376,8 +405,8 @@ class Smarty_Internal_Configfileparser
$yytos = array_pop($this->yystack); $yytos = array_pop($this->yystack);
if ($this->yyTraceFILE && $this->yyidx >= 0) { if ($this->yyTraceFILE && $this->yyidx >= 0) {
fwrite($this->yyTraceFILE, fwrite($this->yyTraceFILE,
$this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] .
"\n"); "\n");
} }
$yymajor = $yytos->major; $yymajor = $yytos->major;
self::yy_destructor($yymajor, $yytos->minor); self::yy_destructor($yymajor, $yytos->minor);
@@ -588,10 +617,9 @@ class Smarty_Internal_Configfileparser
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
&& ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fwrite($this->yyTraceFILE, fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' .
$this->yyTracePrompt . 'FALLBACK ' . $this->yyTokenName[ $iLookAhead ] . ' => ' .
$this->yyTokenName[ $iLookAhead ] . ' => ' . $this->yyTokenName[ $iFallback ] . "\n");
$this->yyTokenName[ $iFallback ] . "\n");
} }
return $this->yy_find_shift_action($iFallback); return $this->yy_find_shift_action($iFallback);
} }
@@ -645,118 +673,117 @@ class Smarty_Internal_Configfileparser
$yytos->minor = $yypMinor; $yytos->minor = $yypMinor;
$this->yystack[] = $yytos; $this->yystack[] = $yytos;
if ($this->yyTraceFILE && $this->yyidx > 0) { if ($this->yyTraceFILE && $this->yyidx > 0) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt,
"%sShift %d\n", $yyNewState);
$this->yyTracePrompt,
$yyNewState);
fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
for ($i = 1; $i <= $this->yyidx; $i++) { for ($i = 1; $i <= $this->yyidx; $i++) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, " %s",
" %s", $this->yyTokenName[ $this->yystack[ $i ]->major ]);
$this->yyTokenName[ $this->yystack[ $i ]->major ]);
} }
fwrite($this->yyTraceFILE, "\n"); fwrite($this->yyTraceFILE, "\n");
} }
} }
function yy_r0() public function yy_r0()
{ {
$this->_retvalue = null; $this->_retvalue = null;
} }
function yy_r1() public function yy_r1()
{ {
$this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor);
$this->_retvalue = null; $this->_retvalue = null;
} }
function yy_r4() public function yy_r4()
{ {
$this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor);
$this->_retvalue = null; $this->_retvalue = null;
} }
// line 245 "../smarty/lexer/smarty_internal_configfileparser.y" // line 245 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r5() public function yy_r5()
{ {
if ($this->configReadHidden) { if ($this->configReadHidden) {
$this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor,
$this->yystack[ $this->yyidx + 0 ]->minor); $this->yystack[ $this->yyidx + 0 ]->minor);
} }
$this->_retvalue = null; $this->_retvalue = null;
} }
// line 250 "../smarty/lexer/smarty_internal_configfileparser.y" // line 250 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r6() public function yy_r6()
{ {
$this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor;
} }
// line 264 "../smarty/lexer/smarty_internal_configfileparser.y" // line 264 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r7() public function yy_r7()
{ {
$this->_retvalue = $this->_retvalue =
array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor));
} }
// line 269 "../smarty/lexer/smarty_internal_configfileparser.y" // line 269 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r8() public function yy_r8()
{ {
$this->_retvalue = array(); $this->_retvalue = array();
} }
// line 277 "../smarty/lexer/smarty_internal_configfileparser.y" // line 277 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r9() public function yy_r9()
{ {
$this->_retvalue = $this->_retvalue =
array('key' => $this->yystack[ $this->yyidx + -2 ]->minor, array(
'value' => $this->yystack[ $this->yyidx + 0 ]->minor); 'key' => $this->yystack[ $this->yyidx + -2 ]->minor,
'value' => $this->yystack[ $this->yyidx + 0 ]->minor
);
} }
// line 281 "../smarty/lexer/smarty_internal_configfileparser.y" // line 281 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r10() public function yy_r10()
{ {
$this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor; $this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor;
} }
// line 285 "../smarty/lexer/smarty_internal_configfileparser.y" // line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r11() public function yy_r11()
{ {
$this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor; $this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor;
} }
// line 291 "../smarty/lexer/smarty_internal_configfileparser.y" // line 291 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r12() public function yy_r12()
{ {
$this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor);
} }
// line 296 "../smarty/lexer/smarty_internal_configfileparser.y" // line 296 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r13() public function yy_r13()
{ {
$this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
} }
// line 300 "../smarty/lexer/smarty_internal_configfileparser.y" // line 300 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r14() public function yy_r14()
{ {
$this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor);
} }
// line 304 "../smarty/lexer/smarty_internal_configfileparser.y" // line 304 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r15() public function yy_r15()
{ {
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor); $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor);
} }
// line 308 "../smarty/lexer/smarty_internal_configfileparser.y" // line 308 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r16() public function yy_r16()
{ {
$this->_retvalue = ''; $this->_retvalue = '';
} }
// line 312 "../smarty/lexer/smarty_internal_configfileparser.y" // line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
function yy_r17() public function yy_r17()
{ {
$this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor;
} }
@@ -766,11 +793,9 @@ class Smarty_Internal_Configfileparser
{ {
if ($this->yyTraceFILE && $yyruleno >= 0 if ($this->yyTraceFILE && $yyruleno >= 0
&& $yyruleno < count(self::$yyRuleName)) { && $yyruleno < count(self::$yyRuleName)) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n",
"%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno,
$this->yyTracePrompt, self::$yyRuleName[ $yyruleno ]);
$yyruleno,
self::$yyRuleName[ $yyruleno ]);
} }
$this->_retvalue = $yy_lefthand_side = null; $this->_retvalue = $yy_lefthand_side = null;
if (isset(self::$yyReduceMap[ $yyruleno ])) { if (isset(self::$yyReduceMap[ $yyruleno ])) {
@@ -851,10 +876,8 @@ class Smarty_Internal_Configfileparser
} }
$yyendofinput = ($yymajor == 0); $yyendofinput = ($yymajor == 0);
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sInput %s\n",
"%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
$this->yyTracePrompt,
$this->yyTokenName[ $yymajor ]);
} }
do { do {
$yyact = $this->yy_find_shift_action($yymajor); $yyact = $this->yy_find_shift_action($yymajor);
@@ -875,9 +898,8 @@ class Smarty_Internal_Configfileparser
$this->yy_reduce($yyact - self::YYNSTATE); $this->yy_reduce($yyact - self::YYNSTATE);
} elseif ($yyact === self::YY_ERROR_ACTION) { } elseif ($yyact === self::YY_ERROR_ACTION) {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sSyntax Error!\n",
"%sSyntax Error!\n", $this->yyTracePrompt);
$this->yyTracePrompt);
} }
if (self::YYERRORSYMBOL) { if (self::YYERRORSYMBOL) {
if ($this->yyerrcnt < 0) { if ($this->yyerrcnt < 0) {
@@ -886,10 +908,8 @@ class Smarty_Internal_Configfileparser
$yymx = $this->yystack[ $this->yyidx ]->major; $yymx = $this->yystack[ $this->yyidx ]->major;
if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sDiscard input token %s\n",
"%sDiscard input token %s\n", $this->yyTracePrompt, $this->yyTokenName[ $yymajor ]);
$this->yyTracePrompt,
$this->yyTokenName[ $yymajor ]);
} }
$this->yy_destructor($yymajor, $yytokenvalue); $this->yy_destructor($yymajor, $yytokenvalue);
$yymajor = self::YYNOCODE; $yymajor = self::YYNOCODE;

View File

@@ -23,96 +23,112 @@ class Smarty_Internal_Templatelexer
const TAGBODY = 3; const TAGBODY = 3;
const LITERAL = 4; const LITERAL = 4;
const DOUBLEQUOTEDSTRING = 5; const DOUBLEQUOTEDSTRING = 5;
/** /**
* Source * Source
* *
* @var string * @var string
*/ */
public $data; public $data;
/** /**
* Source length * Source length
* *
* @var int * @var int
*/ */
public $dataLength = null; public $dataLength = null;
/** /**
* byte counter * byte counter
* *
* @var int * @var int
*/ */
public $counter; public $counter;
/** /**
* token number * token number
* *
* @var int * @var int
*/ */
public $token; public $token;
/** /**
* token value * token value
* *
* @var string * @var string
*/ */
public $value; public $value;
/** /**
* current line * current line
* *
* @var int * @var int
*/ */
public $line; public $line;
/** /**
* tag start line * tag start line
* *
* @var * @var
*/ */
public $taglineno; public $taglineno;
/** /**
* php code type * php code type
* *
* @var string * @var string
*/ */
public $phpType = ''; public $phpType = '';
/** /**
* state number * state number
* *
* @var int * @var int
*/ */
public $state = 1; public $state = 1;
/** /**
* Smarty object * Smarty object
* *
* @var Smarty * @var Smarty
*/ */
public $smarty = null; public $smarty = null;
/** /**
* compiler object * compiler object
* *
* @var Smarty_Internal_TemplateCompilerBase * @var Smarty_Internal_TemplateCompilerBase
*/ */
public $compiler = null; public $compiler = null;
/** /**
* trace file * trace file
* *
* @var resource * @var resource
*/ */
public $yyTraceFILE; public $yyTraceFILE;
/** /**
* trace prompt * trace prompt
* *
* @var string * @var string
*/ */
public $yyTracePrompt; public $yyTracePrompt;
/** /**
* XML flag true while processing xml * XML flag true while processing xml
* *
* @var bool * @var bool
*/ */
public $is_xml = false; public $is_xml = false;
/** /**
* state names * state names
* *
* @var array * @var array
*/ */
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',); public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
/** /**
* token names * token names
* *
@@ -156,43 +172,51 @@ class Smarty_Internal_Templatelexer
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
'SCOND' => '"is even" ... if condition', 'SCOND' => '"is even" ... if condition',
); );
/** /**
* literal tag nesting level * literal tag nesting level
* *
* @var int * @var int
*/ */
private $literal_cnt = 0; private $literal_cnt = 0;
/** /**
* preg token pattern for state TEXT * preg token pattern for state TEXT
* *
* @var string * @var string
*/ */
private $yy_global_pattern1 = null; private $yy_global_pattern1 = null;
/** /**
* preg token pattern for state TAG * preg token pattern for state TAG
* *
* @var string * @var string
*/ */
private $yy_global_pattern2 = null; private $yy_global_pattern2 = null;
/** /**
* preg token pattern for state TAGBODY * preg token pattern for state TAGBODY
* *
* @var string * @var string
*/ */
private $yy_global_pattern3 = null; private $yy_global_pattern3 = null;
/** /**
* preg token pattern for state LITERAL * preg token pattern for state LITERAL
* *
* @var string * @var string
*/ */
private $yy_global_pattern4 = null; private $yy_global_pattern4 = null;
/** /**
* preg token pattern for state DOUBLEQUOTEDSTRING * preg token pattern for state DOUBLEQUOTEDSTRING
* *
* @var null * @var null
*/ */
private $yy_global_pattern5 = null; private $yy_global_pattern5 = null;
private $_yy_state = 1; private $_yy_state = 1;
private $_yy_stack = array(); private $_yy_stack = array();
/** /**
@@ -258,35 +282,27 @@ class Smarty_Internal_Templatelexer
public function yypushstate($state) public function yypushstate($state)
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt,
"%sState push %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$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); array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
"%snew State %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
public function yypopstate() public function yypopstate()
{ {
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt,
"%sState pop %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$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) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt,
"%snew State %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
@@ -294,10 +310,8 @@ class Smarty_Internal_Templatelexer
{ {
$this->_yy_state = $state; $this->_yy_state = $state;
if ($this->yyTraceFILE) { if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt,
"%sState set %s\n", isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
$this->yyTracePrompt,
isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state);
} }
} }
@@ -323,8 +337,7 @@ class Smarty_Internal_Templatelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state TEXT');
5) . '... state TEXT');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -356,18 +369,15 @@ class Smarty_Internal_Templatelexer
} while (true); } while (true);
} }
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->compiler->getRdelPreg()}[\n]?/", preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE,
$this->data, $this->counter);
$match,
PREG_OFFSET_CAPTURE,
$this->counter);
if (isset($match[ 0 ][ 1 ])) { if (isset($match[ 0 ][ 1 ])) {
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]); $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
} else { } else {
@@ -377,40 +387,40 @@ class Smarty_Internal_Templatelexer
return false; return false;
} }
function yy_r1_4() public function yy_r1_4()
{ {
$this->compiler->getTagCompiler('private_php')->parsePhp($this); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
} }
function yy_r1_8() public function yy_r1_8()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
function yy_r1_10() public function yy_r1_10()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
$this->yypushstate(self::LITERAL); $this->yypushstate(self::LITERAL);
} }
function yy_r1_12() public function yy_r1_12()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
$this->yypushstate(self::LITERAL); $this->yypushstate(self::LITERAL);
} // end function } // end function
function yy_r1_14() public function yy_r1_14()
{ {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
return true; return true;
} }
function yy_r1_16() public function yy_r1_16()
{ {
$this->compiler->getTagCompiler('private_php')->parsePhp($this); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
} }
function yy_r1_19() public function yy_r1_19()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
@@ -437,8 +447,7 @@ class Smarty_Internal_Templatelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state TAG');
5) . '... state TAG');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -470,63 +479,63 @@ class Smarty_Internal_Templatelexer
} while (true); } while (true);
} }
function yy_r2_1() public function yy_r2_1()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELIF; $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_4() public function yy_r2_4()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR; $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_6() public function yy_r2_6()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_8() public function yy_r2_8()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_10() public function yy_r2_10()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE; $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_12() public function yy_r2_12()
{ {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_15() public function yy_r2_15()
{ {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_18() public function yy_r2_18()
{ {
$this->yypopstate(); $this->yypopstate();
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_20() public function yy_r2_20()
{ {
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->yypopstate();
@@ -540,14 +549,14 @@ class Smarty_Internal_Templatelexer
} }
} // end function } // end function
function yy_r2_23() public function yy_r2_23()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r2_25() public function yy_r2_25()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->yybegin(self::TAGBODY); $this->yybegin(self::TAGBODY);
@@ -576,8 +585,7 @@ class Smarty_Internal_Templatelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state TAGBODY');
5) . '... state TAGBODY');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -609,156 +617,156 @@ class Smarty_Internal_Templatelexer
} while (true); } while (true);
} }
function yy_r3_1() public function yy_r3_1()
{ {
$this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->token = Smarty_Internal_Templateparser::TP_RDEL;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r3_2() public function yy_r3_2()
{ {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
return true; return true;
} }
function yy_r3_4() public function yy_r3_4()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote(); $this->compiler->enterDoubleQuote();
} }
function yy_r3_5() public function yy_r3_5()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
} }
function yy_r3_6() public function yy_r3_6()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID; $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
} }
function yy_r3_7() public function yy_r3_7()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR; $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
} }
function yy_r3_8() public function yy_r3_8()
{ {
$this->token = Smarty_Internal_Templateparser::TP_ISIN; $this->token = Smarty_Internal_Templateparser::TP_ISIN;
} }
function yy_r3_9() public function yy_r3_9()
{ {
$this->token = Smarty_Internal_Templateparser::TP_AS; $this->token = Smarty_Internal_Templateparser::TP_AS;
} }
function yy_r3_10() public function yy_r3_10()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TO; $this->token = Smarty_Internal_Templateparser::TP_TO;
} }
function yy_r3_11() public function yy_r3_11()
{ {
$this->token = Smarty_Internal_Templateparser::TP_STEP; $this->token = Smarty_Internal_Templateparser::TP_STEP;
} }
function yy_r3_12() public function yy_r3_12()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
} }
function yy_r3_13() public function yy_r3_13()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LOGOP; $this->token = Smarty_Internal_Templateparser::TP_LOGOP;
} }
function yy_r3_15() public function yy_r3_15()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP; $this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
} }
function yy_r3_17() public function yy_r3_17()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP; $this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
} }
function yy_r3_20() public function yy_r3_20()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
} }
function yy_r3_23() public function yy_r3_23()
{ {
$this->token = Smarty_Internal_Templateparser::TP_NOT; $this->token = Smarty_Internal_Templateparser::TP_NOT;
} }
function yy_r3_24() public function yy_r3_24()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST; $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
} }
function yy_r3_28() public function yy_r3_28()
{ {
$this->token = Smarty_Internal_Templateparser::TP_OPENP; $this->token = Smarty_Internal_Templateparser::TP_OPENP;
} }
function yy_r3_29() public function yy_r3_29()
{ {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP; $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
} }
function yy_r3_30() public function yy_r3_30()
{ {
$this->token = Smarty_Internal_Templateparser::TP_OPENB; $this->token = Smarty_Internal_Templateparser::TP_OPENB;
} }
function yy_r3_31() public function yy_r3_31()
{ {
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB; $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
} }
function yy_r3_32() public function yy_r3_32()
{ {
$this->token = Smarty_Internal_Templateparser::TP_PTR; $this->token = Smarty_Internal_Templateparser::TP_PTR;
} }
function yy_r3_33() public function yy_r3_33()
{ {
$this->token = Smarty_Internal_Templateparser::TP_APTR; $this->token = Smarty_Internal_Templateparser::TP_APTR;
} }
function yy_r3_34() public function yy_r3_34()
{ {
$this->token = Smarty_Internal_Templateparser::TP_EQUAL; $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
} }
function yy_r3_35() public function yy_r3_35()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INCDEC; $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
} }
function yy_r3_37() public function yy_r3_37()
{ {
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH; $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
} }
function yy_r3_39() public function yy_r3_39()
{ {
$this->token = Smarty_Internal_Templateparser::TP_MATH; $this->token = Smarty_Internal_Templateparser::TP_MATH;
} }
function yy_r3_41() public function yy_r3_41()
{ {
$this->token = Smarty_Internal_Templateparser::TP_AT; $this->token = Smarty_Internal_Templateparser::TP_AT;
} }
function yy_r3_42() public function yy_r3_42()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HATCH; $this->token = Smarty_Internal_Templateparser::TP_HATCH;
} }
function yy_r3_43() public function yy_r3_43()
{ {
// resolve conflicts with shorttag and right_delimiter starting with '=' // resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
@@ -771,73 +779,73 @@ class Smarty_Internal_Templatelexer
} }
} }
function yy_r3_44() public function yy_r3_44()
{ {
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
} }
function yy_r3_47() public function yy_r3_47()
{ {
$this->token = Smarty_Internal_Templateparser::TP_ID; $this->token = Smarty_Internal_Templateparser::TP_ID;
} }
function yy_r3_48() public function yy_r3_48()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INTEGER; $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
} }
function yy_r3_49() public function yy_r3_49()
{ {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r3_50() public function yy_r3_50()
{ {
$this->token = Smarty_Internal_Templateparser::TP_VERT; $this->token = Smarty_Internal_Templateparser::TP_VERT;
} }
function yy_r3_51() public function yy_r3_51()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOT; $this->token = Smarty_Internal_Templateparser::TP_DOT;
} }
function yy_r3_52() public function yy_r3_52()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COMMA; $this->token = Smarty_Internal_Templateparser::TP_COMMA;
} }
function yy_r3_53() public function yy_r3_53()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
} }
function yy_r3_54() public function yy_r3_54()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
} }
function yy_r3_55() public function yy_r3_55()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COLON; $this->token = Smarty_Internal_Templateparser::TP_COLON;
} }
function yy_r3_56() public function yy_r3_56()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QMARK; $this->token = Smarty_Internal_Templateparser::TP_QMARK;
} }
function yy_r3_57() public function yy_r3_57()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HEX; $this->token = Smarty_Internal_Templateparser::TP_HEX;
} }
function yy_r3_58() public function yy_r3_58()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = Smarty_Internal_Templateparser::TP_SPACE;
} // end function } // end function
function yy_r3_59() public function yy_r3_59()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
@@ -864,8 +872,7 @@ class Smarty_Internal_Templatelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state LITERAL');
5) . '... state LITERAL');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -897,13 +904,13 @@ class Smarty_Internal_Templatelexer
} while (true); } while (true);
} }
function yy_r4_1() public function yy_r4_1()
{ {
$this->literal_cnt++; $this->literal_cnt++;
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} }
function yy_r4_3() public function yy_r4_3()
{ {
if ($this->literal_cnt) { if ($this->literal_cnt) {
$this->literal_cnt--; $this->literal_cnt--;
@@ -914,7 +921,7 @@ class Smarty_Internal_Templatelexer
} }
} }
function yy_r4_5() public function yy_r4_5()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} // end function } // end function
@@ -941,8 +948,7 @@ class Smarty_Internal_Templatelexer
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr($this->data, ' an empty string. Input "' . substr($this->data,
$this->counter, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
5) . '... state DOUBLEQUOTEDSTRING');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -974,47 +980,47 @@ class Smarty_Internal_Templatelexer
} while (true); } while (true);
} }
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_3() public function yy_r5_3()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
function yy_r5_5() public function yy_r5_5()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
function yy_r5_7() public function yy_r5_7()
{ {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
return true; return true;
} }
function yy_r5_9() public function yy_r5_9()
{ {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
return true; return true;
} }
function yy_r5_11() public function yy_r5_11()
{ {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = Smarty_Internal_Templateparser::TP_LDEL;
$this->taglineno = $this->line; $this->taglineno = $this->line;
$this->yypushstate(self::TAGBODY); $this->yypushstate(self::TAGBODY);
} }
function yy_r5_13() public function yy_r5_13()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r5_14() public function yy_r5_14()
{ {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->value = substr($this->value, 0, -1); $this->value = substr($this->value, 0, -1);
@@ -1022,17 +1028,17 @@ class Smarty_Internal_Templatelexer
$this->taglineno = $this->line; $this->taglineno = $this->line;
} }
function yy_r5_15() public function yy_r5_15()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID; $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
} }
function yy_r5_16() public function yy_r5_16()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
function yy_r5_17() public function yy_r5_17()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }

File diff suppressed because it is too large Load Diff