From 485f093e0b686ddc2525f793064389d6dc6ed983 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Tue, 30 Dec 2014 16:03:21 +0100 Subject: [PATCH] get config properties via template object --- lexer/smarty_internal_configfilelexer.plex | 2 +- lexer/smarty_internal_configfileparser.y | 7 ++-- .../smarty_internal_configfilelexer.php | 2 +- .../smarty_internal_configfileparser.php | 41 +++++++++---------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/lexer/smarty_internal_configfilelexer.plex b/lexer/smarty_internal_configfilelexer.plex index 1c001c81..47f06948 100644 --- a/lexer/smarty_internal_configfilelexer.plex +++ b/lexer/smarty_internal_configfilelexer.plex @@ -117,7 +117,7 @@ class Smarty_Internal_Configfilelexer $this->line = 1; $this->compiler = $compiler; $this->smarty = $compiler->smarty; - $this->configBooleanize = $compiler->smarty->config_booleanize; + $this->configBooleanize = $compiler->template->smarty->config_booleanize; } public static function &instance($new_instance = null) diff --git a/lexer/smarty_internal_configfileparser.y b/lexer/smarty_internal_configfileparser.y index 358c8349..caecc38d 100644 --- a/lexer/smarty_internal_configfileparser.y +++ b/lexer/smarty_internal_configfileparser.y @@ -94,7 +94,7 @@ class Smarty_Internal_Configfileparser // set instance object self::instance($this); $this->lex = $lex; - $this->smarty = $compiler->smarty; + $this->smarty = $compiler->template->smarty; $this->compiler = $compiler; $this->configOverwrite = $compiler->smarty->config_overwrite; $this->configReadHidden = $compiler->smarty->config_read_hidden; @@ -235,7 +235,6 @@ class Smarty_Internal_Configfileparser } } - %token_prefix TPC_ %parse_accept @@ -243,7 +242,6 @@ class Smarty_Internal_Configfileparser $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; - //echo $this->retvalue."\n\n"; } %syntax_error @@ -266,7 +264,8 @@ start(res) ::= global_vars sections. { // Global vars global_vars(res) ::= var_list(vl). { - $this->add_global_vars(vl); res = null; + $this->add_global_vars(vl); + res = null; } // Sections diff --git a/libs/sysplugins/smarty_internal_configfilelexer.php b/libs/sysplugins/smarty_internal_configfilelexer.php index 8fda77c4..ff725c42 100644 --- a/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/libs/sysplugins/smarty_internal_configfilelexer.php @@ -117,7 +117,7 @@ class Smarty_Internal_Configfilelexer $this->line = 1; $this->compiler = $compiler; $this->smarty = $compiler->smarty; - $this->configBooleanize = $compiler->smarty->config_booleanize; + $this->configBooleanize = $compiler->template->smarty->config_booleanize; } public static function &instance($new_instance = null) diff --git a/libs/sysplugins/smarty_internal_configfileparser.php b/libs/sysplugins/smarty_internal_configfileparser.php index c3d553f5..c47004d5 100644 --- a/libs/sysplugins/smarty_internal_configfileparser.php +++ b/libs/sysplugins/smarty_internal_configfileparser.php @@ -162,7 +162,7 @@ class Smarty_Internal_Configfileparser // set instance object self::instance($this); $this->lex = $lex; - $this->smarty = $compiler->smarty; + $this->smarty = $compiler->template->smarty; $this->compiler = $compiler; $this->configOverwrite = $compiler->smarty->config_overwrite; $this->configReadHidden = $compiler->smarty->config_read_hidden; @@ -725,7 +725,7 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 257 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 255 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->compiler->trigger_config_file_error("Stack overflow in configfile parser"); @@ -799,27 +799,27 @@ class Smarty_Internal_Configfileparser 18 => 17, ); - #line 263 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 261 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r0() { $this->_retvalue = null; } - #line 268 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 266 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r1() { $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; } - #line 281 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 280 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r4() { $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; } - #line 286 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r5() { if ($this->configReadHidden) { @@ -828,73 +828,73 @@ class Smarty_Internal_Configfileparser $this->_retvalue = null; } - #line 294 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 293 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r6() { $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor; } - #line 298 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 297 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r7() { $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor)); } - #line 302 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 301 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r8() { $this->_retvalue = Array(); } - #line 308 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 307 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r9() { $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor); } - #line 313 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r10() { $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; } - #line 317 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r11() { $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; } - #line 321 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r12() { $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); } - #line 325 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r13() { $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); } - #line 329 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 328 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r14() { $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); } - #line 333 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 332 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r15() { $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + - 1]->minor); } - #line 337 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 336 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r16() { $this->_retvalue = ''; } - #line 341 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 340 "../smarty/lexer/smarty_internal_configfileparser.y" function yy_r17() { $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; @@ -956,7 +956,7 @@ class Smarty_Internal_Configfileparser public function yy_syntax_error($yymajor, $TOKEN) { - #line 250 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 248 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->yymajor = $yymajor; @@ -971,12 +971,11 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 242 "../smarty/lexer/smarty_internal_configfileparser.y" + #line 241 "../smarty/lexer/smarty_internal_configfileparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; - //echo $this->retvalue."\n\n"; } public function doParse($yymajor, $yytokenvalue)