12 $this->
string = $s->string;
13 $this->metadata = $s->metadata;
15 $this->
string = (string) $s;
16 if ($m instanceof TPC_yyToken) {
17 $this->metadata = $m->metadata;
18 } elseif (is_array($m)) {
31 return isset($this->metadata[$offset]);
36 return $this->metadata[$offset];
41 if ($offset === null) {
42 if (isset($value[0])) {
43 $x = ($value instanceof
TPC_yyToken) ? $value->metadata : $value;
44 $this->metadata = array_merge($this->metadata, $x);
48 $offset = count($this->metadata);
50 if ($value === null) {
54 if ($value->metadata) {
55 $this->metadata[$offset] = $value->metadata;
58 $this->metadata[$offset] = $value;
64 unset($this->metadata[$offset]);
79 #line 12 "../smarty/lexer/smarty_internal_configfileparser.y"
93 #line 25 "../smarty/lexer/smarty_internal_configfileparser.y"
172 self::instance($this);
174 $this->smarty = $compiler->smarty;
176 $this->configOverwrite = $this->smarty->config_overwrite;
177 $this->configReadHidden = $this->smarty->config_read_hidden;
185 public static function &
instance($new_instance = null)
187 static $instance = null;
188 if (isset($new_instance) && is_object($new_instance)) {
189 $instance = $new_instance;
203 $str = strtolower($str);
204 if (in_array($str, array(
'on',
'yes',
'true'))) {
223 $escaped_string = substr($qstr, 1, strlen($qstr) - 2);
225 $ss = preg_split(
'/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
228 foreach ($ss as $s) {
229 if (strlen($s) === 2 && $s[0] ===
'\\') {
230 if (isset(self::$escapes_single[$s[1]])) {
231 $s = self::$escapes_single[$s[1]];
248 $inner_str = substr($qstr, 1, strlen($qstr) - 2);
249 return stripcslashes($inner_str);
261 return stripcslashes($qstr);
270 private function set_var(Array $var, Array &$target_array)
273 $value = $var[
"value"];
275 if ($this->configOverwrite || !isset($target_array[
'vars'][$key])) {
276 $target_array[
'vars'][$key] = $value;
278 settype($target_array[
'vars'][$key],
'array');
279 $target_array[
'vars'][$key][] = $value;
290 if (!isset($this->compiler->config_data[
'vars'])) {
291 $this->compiler->config_data[
'vars'] = Array();
293 foreach ($vars as $var) {
294 $this->
set_var($var, $this->compiler->config_data);
306 if (!isset($this->compiler->config_data[
'sections'][$section_name][
'vars'])) {
307 $this->compiler->config_data[
'sections'][$section_name][
'vars'] = Array();
309 foreach ($vars as $var) {
310 $this->
set_var($var, $this->compiler->config_data[
'sections'][$section_name]);
358 static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15,
359 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
361 static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15,
362 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
368 static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
375 static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
377 static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
378 array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), array(1,), array(), array(), array(),
379 array(2, 4,), array(15, 17,), array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
380 array(6,), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(),
381 array(), array(), array(), array(), array(),);
383 static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
384 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
402 public function Trace($TraceFILE, $zTracePrompt)
406 } elseif (!$zTracePrompt) {
409 $this->yyTraceFILE = $TraceFILE;
410 $this->yyTracePrompt = $zTracePrompt;
415 $this->yyTraceFILE = fopen(
'php://output',
'w');
416 $this->yyTracePrompt =
'<br>';
427 public $yyTokenName = array(
'$',
'OPENB',
'SECTION',
'CLOSEB',
'DOT',
'ID',
'EQUAL',
'FLOAT',
'INT',
'BOOL',
428 'SINGLE_QUOTED_STRING',
'DOUBLE_QUOTED_STRING',
'TRIPPLE_QUOTES',
'TRIPPLE_TEXT',
'TRIPPLE_QUOTES_END',
429 'NAKED_STRING',
'OTHER',
'NEWLINE',
'COMMENTSTART',
'error',
'start',
'global_vars',
'sections',
'var_list',
430 'section',
'newline',
'var',
'value',);
432 public static $yyRuleName = array(
'start ::= global_vars sections',
'global_vars ::= var_list',
433 'sections ::= sections section',
'sections ::=',
'section ::= OPENB SECTION CLOSEB newline var_list',
434 'section ::= OPENB DOT SECTION CLOSEB newline var_list',
'var_list ::= var_list newline',
435 'var_list ::= var_list var',
'var_list ::=',
'var ::= ID EQUAL value',
'value ::= FLOAT',
'value ::= INT',
436 'value ::= BOOL',
'value ::= SINGLE_QUOTED_STRING',
'value ::= DOUBLE_QUOTED_STRING',
437 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END',
'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END',
438 'value ::= NAKED_STRING',
'value ::= OTHER',
'newline ::= NEWLINE',
'newline ::= COMMENTSTART NEWLINE',
439 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
443 if ($tokenType === 0) {
444 return 'End of Input';
446 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
447 return $this->yyTokenName[$tokenType];
463 if (empty($this->yystack)) {
466 $yytos = array_pop($this->yystack);
467 if ($this->yyTraceFILE && $this->yyidx >= 0) {
468 fwrite($this->yyTraceFILE, $this->yyTracePrompt .
'Popping ' . $this->yyTokenName[$yytos->major] .
"\n");
471 self::yy_destructor(
$yymajor, $yytos->minor);
479 while ($this->yystack !== Array()) {
482 if (is_resource($this->yyTraceFILE)) {
483 fclose($this->yyTraceFILE);
489 static $res3 = array();
490 static $res4 = array();
492 $expected = self::$yyExpectedTokens[$state];
493 if (isset($res3[$state][$token])) {
494 if ($res3[$state][$token]) {
498 if ($res3[$state][$token] = in_array($token, self::$yyExpectedTokens[$state],
true)) {
506 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
510 if ($done ++ == 100) {
512 $this->yystack = $stack;
515 return array_unique($expected);
517 $yyruleno = $yyact - self::YYNSTATE;
518 $this->yyidx -= self::$yyRuleInfo[$yyruleno][1];
519 $nextstate = $this->
yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno][0]);
520 if (isset(self::$yyExpectedTokens[$nextstate])) {
521 $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
522 if (isset($res4[$nextstate][$token])) {
523 if ($res4[$nextstate][$token]) {
525 $this->yystack = $stack;
526 return array_unique($expected);
529 if ($res4[$nextstate][$token] = in_array($token, self::$yyExpectedTokens[$nextstate],
true)) {
531 $this->yystack = $stack;
532 return array_unique($expected);
536 if ($nextstate < self::YYNSTATE) {
540 $x->stateno = $nextstate;
541 $x->major = self::$yyRuleInfo[$yyruleno][0];
544 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
546 $this->yystack = $stack;
550 return array_unique($expected);
551 } elseif ($nextstate === self::YY_NO_ACTION) {
553 $this->yystack = $stack;
564 $this->yystack = $stack;
566 return array_unique($expected);
571 static $res = array();
572 static $res2 = array();
577 if (isset($res[$state][$token])) {
578 if ($res[$state][$token]) {
582 if ($res[$state][$token] = in_array($token, self::$yyExpectedTokens[$state],
true)) {
590 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
594 if ($done ++ == 100) {
596 $this->yystack = $stack;
601 $yyruleno = $yyact - self::YYNSTATE;
602 $this->yyidx -= self::$yyRuleInfo[$yyruleno][1];
603 $nextstate = $this->
yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno][0]);
604 if (isset($res2[$nextstate][$token])) {
605 if ($res2[$nextstate][$token]) {
607 $this->yystack = $stack;
611 if ($res2[$nextstate][$token] = (isset(self::$yyExpectedTokens[$nextstate]) && in_array($token, self::$yyExpectedTokens[$nextstate],
true))) {
613 $this->yystack = $stack;
617 if ($nextstate < self::YYNSTATE) {
621 $x->stateno = $nextstate;
622 $x->major = self::$yyRuleInfo[$yyruleno][0];
625 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
627 $this->yystack = $stack;
636 } elseif ($nextstate === self::YY_NO_ACTION) {
638 $this->yystack = $stack;
649 $this->yystack = $stack;
659 if (!isset(self::$yy_shift_ofst[$stateno])) {
661 return self::$yy_default[$stateno];
663 $i = self::$yy_shift_ofst[$stateno];
664 if ($i === self::YY_SHIFT_USE_DFLT) {
665 return self::$yy_default[$stateno];
667 if ($iLookAhead == self::YYNOCODE) {
668 return self::YY_NO_ACTION;
671 if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) {
672 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
673 if ($this->yyTraceFILE) {
674 fwrite($this->yyTraceFILE, $this->yyTracePrompt .
"FALLBACK " . $this->yyTokenName[$iLookAhead] .
" => " . $this->yyTokenName[$iFallback] .
"\n");
680 return self::$yy_default[$stateno];
682 return self::$yy_action[$i];
690 if (!isset(self::$yy_reduce_ofst[$stateno])) {
691 return self::$yy_default[$stateno];
693 $i = self::$yy_reduce_ofst[$stateno];
694 if ($i == self::YY_REDUCE_USE_DFLT) {
695 return self::$yy_default[$stateno];
697 if ($iLookAhead == self::YYNOCODE) {
698 return self::YY_NO_ACTION;
701 if ($i < 0 || $i >= self::YY_SZ_ACTTAB || self::$yy_lookahead[$i] != $iLookAhead) {
702 return self::$yy_default[$stateno];
704 return self::$yy_action[$i];
708 public function yy_shift($yyNewState, $yyMajor, $yypMinor)
711 if ($this->yyidx >= self::YYSTACKDEPTH) {
713 if ($this->yyTraceFILE) {
714 fprintf($this->yyTraceFILE,
"%sStack Overflow!\n", $this->yyTracePrompt);
716 while ($this->yyidx >= 0) {
719 #line 255 "../smarty/lexer/smarty_internal_configfileparser.y"
721 $this->internalError =
true;
722 $this->compiler->trigger_config_file_error(
"Stack overflow in configfile parser");
727 $yytos->stateno = $yyNewState;
728 $yytos->major = $yyMajor;
729 $yytos->minor = $yypMinor;
730 $this->yystack[] = $yytos;
731 if ($this->yyTraceFILE && $this->yyidx > 0) {
732 fprintf($this->yyTraceFILE,
"%sShift %d\n", $this->yyTracePrompt, $yyNewState);
733 fprintf($this->yyTraceFILE,
"%sStack:", $this->yyTracePrompt);
735 fprintf($this->yyTraceFILE,
" %s", $this->yyTokenName[$this->yystack[$i]->major]);
737 fwrite($this->yyTraceFILE,
"\n");
741 public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
742 array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), array(0 => 23, 1 => 2),
743 array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), array(0 => 26, 1 => 3), array(0 => 27, 1 => 1),
744 array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
745 array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
746 array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), array(0 => 25, 1 => 3),);
748 public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
749 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
750 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
752 #line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
755 $this->_retvalue = null;
758 #line 266 "../smarty/lexer/smarty_internal_configfileparser.y"
762 $this->_retvalue = null;
765 #line 280 "../smarty/lexer/smarty_internal_configfileparser.y"
768 $this->
add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
769 $this->_retvalue = null;
772 #line 285 "../smarty/lexer/smarty_internal_configfileparser.y"
775 if ($this->configReadHidden) {
776 $this->
add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
778 $this->_retvalue = null;
781 #line 293 "../smarty/lexer/smarty_internal_configfileparser.y"
784 $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
787 #line 297 "../smarty/lexer/smarty_internal_configfileparser.y"
790 $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
793 #line 301 "../smarty/lexer/smarty_internal_configfileparser.y"
796 $this->_retvalue = Array();
799 #line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
802 $this->_retvalue = Array(
"key" => $this->yystack[$this->yyidx + - 2]->minor,
803 "value" => $this->yystack[$this->yyidx + 0]->minor);
806 #line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
809 $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
812 #line 316 "../smarty/lexer/smarty_internal_configfileparser.y"
815 $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
818 #line 320 "../smarty/lexer/smarty_internal_configfileparser.y"
821 $this->_retvalue = $this->
parse_bool($this->yystack[$this->yyidx + 0]->minor);
824 #line 324 "../smarty/lexer/smarty_internal_configfileparser.y"
827 $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
830 #line 328 "../smarty/lexer/smarty_internal_configfileparser.y"
833 $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
836 #line 332 "../smarty/lexer/smarty_internal_configfileparser.y"
839 $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + - 1]->minor);
842 #line 336 "../smarty/lexer/smarty_internal_configfileparser.y"
845 $this->_retvalue =
'';
848 #line 340 "../smarty/lexer/smarty_internal_configfileparser.y"
851 $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
858 if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) {
859 fprintf($this->yyTraceFILE,
"%sReduce (%d) [%s].\n", $this->yyTracePrompt, $yyruleno, self::$yyRuleName[$yyruleno]);
862 $this->_retvalue = $yy_lefthand_side = null;
863 if (isset(self::$yyReduceMap[$yyruleno])) {
865 $this->_retvalue = null;
866 $this->{
'yy_r' . self::$yyReduceMap[$yyruleno]}();
869 $yygoto = self::$yyRuleInfo[$yyruleno][0];
870 $yysize = self::$yyRuleInfo[$yyruleno][1];
871 $this->yyidx -= $yysize;
872 for ($i = $yysize; $i; $i --) {
874 array_pop($this->yystack);
877 if ($yyact < self::YYNSTATE) {
878 if (!$this->yyTraceFILE && $yysize) {
881 $x->stateno = $yyact;
883 $x->minor = $yy_lefthand_side;
886 $this->
yy_shift($yyact, $yygoto, $yy_lefthand_side);
888 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
895 if ($this->yyTraceFILE) {
896 fprintf($this->yyTraceFILE,
"%sFail!\n", $this->yyTracePrompt);
898 while ($this->yyidx >= 0) {
905 #line 248 "../smarty/lexer/smarty_internal_configfileparser.y"
907 $this->internalError =
true;
909 $this->compiler->trigger_config_file_error();
914 if ($this->yyTraceFILE) {
915 fprintf($this->yyTraceFILE,
"%sAccept!\n", $this->yyTracePrompt);
917 while ($this->yyidx >= 0) {
920 #line 241 "../smarty/lexer/smarty_internal_configfileparser.y"
923 $this->internalError =
false;
931 if ($this->yyidx === null || $this->yyidx < 0) {
933 $this->yyerrcnt = - 1;
937 $this->yystack = array();
938 $this->yystack[] = $x;
942 if ($this->yyTraceFILE) {
943 fprintf($this->yyTraceFILE,
"%sInput %s\n", $this->yyTracePrompt, $this->yyTokenName[
$yymajor]);
950 $yyact = self::YY_ERROR_ACTION;
952 if ($yyact < self::YYNSTATE) {
955 if ($yyendofinput && $this->yyidx >= 0) {
960 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
961 $this->
yy_reduce($yyact - self::YYNSTATE);
962 } elseif ($yyact == self::YY_ERROR_ACTION) {
963 if ($this->yyTraceFILE) {
964 fprintf($this->yyTraceFILE,
"%sSyntax Error!\n", $this->yyTracePrompt);
966 if (self::YYERRORSYMBOL) {
967 if ($this->yyerrcnt < 0) {
971 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
972 if ($this->yyTraceFILE) {
973 fprintf($this->yyTraceFILE,
"%sDiscard input token %s\n", $this->yyTracePrompt, $this->yyTokenName[
$yymajor]);
978 while ($this->yyidx >= 0 && $yymx != self::YYERRORSYMBOL && ($yyact = $this->
yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE) {
981 if ($this->yyidx < 0 ||
$yymajor == 0) {
985 } elseif ($yymx != self::YYERRORSYMBOL) {
987 $this->
yy_shift($yyact, self::YYERRORSYMBOL, $u2);
993 if ($this->yyerrcnt <= 0) {
1007 }
while (
$yymajor != self::YYNOCODE && $this->yyidx >= 0);