8824603c8611fb62d5ed54cf71612cef20e7ae60
1 <?php
2 /**
3 * Smarty Internal Plugin Configfileparser
4 *
5 * This is the config file parser.
6 * It is generated from the internal.configfileparser.y file
7 * @package Smarty
8 * @subpackage Compiler
9 * @author Uwe Tews
10 */
12 class TPC_yyToken implements ArrayAccess
13 {
14 public $string = '';
15 public $metadata = array();
17 function __construct($s, $m = array())
18 {
19 if ($s instanceof TPC_yyToken) {
20 $this->string = $s->string;
21 $this->metadata = $s->metadata;
22 } else {
23 $this->string = (string) $s;
24 if ($m instanceof TPC_yyToken) {
25 $this->metadata = $m->metadata;
26 } elseif (is_array($m)) {
27 $this->metadata = $m;
28 }
29 }
30 }
32 function __toString()
33 {
34 return $this->_string;
35 }
37 function offsetExists($offset)
38 {
39 return isset($this->metadata[$offset]);
40 }
42 function offsetGet($offset)
43 {
44 return $this->metadata[$offset];
45 }
47 function offsetSet($offset, $value)
48 {
49 if ($offset === null) {
50 if (isset($value[0])) {
51 $x = ($value instanceof TPC_yyToken) ?
52 $value->metadata : $value;
53 $this->metadata = array_merge($this->metadata, $x);
54 return;
55 }
56 $offset = count($this->metadata);
57 }
58 if ($value === null) {
59 return;
60 }
61 if ($value instanceof TPC_yyToken) {
62 if ($value->metadata) {
63 $this->metadata[$offset] = $value->metadata;
64 }
65 } elseif ($value) {
66 $this->metadata[$offset] = $value;
67 }
68 }
70 function offsetUnset($offset)
71 {
72 unset($this->metadata[$offset]);
73 }
74 }
76 class TPC_yyStackEntry
77 {
78 public $stateno; /* The state-number */
79 public $major; /* The major token value. This is the code
80 ** number for the token at this stack level */
81 public $minor; /* The user-supplied minor token value. This
82 ** is the value of the token */
83 };
86 #line 12 "smarty_internal_configfileparser.y"
87 class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php"
88 {
89 #line 14 "smarty_internal_configfileparser.y"
91 // states whether the parse was successful or not
92 public $successful = true;
93 public $retvalue = 0;
94 private $lex;
95 private $internalError = false;
97 function __construct($lex, $compiler) {
98 // set instance object
99 self::instance($this);
100 $this->lex = $lex;
101 $this->smarty = $compiler->smarty;
102 $this->compiler = $compiler;
103 }
104 public static function &instance($new_instance = null)
105 {
106 static $instance = null;
107 if (isset($new_instance) && is_object($new_instance))
108 $instance = $new_instance;
109 return $instance;
110 }
112 private function parse_bool($str) {
113 if (in_array(strtolower($str) ,array('on','yes','true'))) {
114 $res = true;
115 } else {
116 $res = false;
117 }
118 return $res;
119 }
121 private static $escapes_single = Array('\\' => '\\',
122 '\'' => '\'');
123 private static function parse_single_quoted_string($qstr) {
124 $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes
126 $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
128 $str = "";
129 foreach ($ss as $s) {
130 if (strlen($s) === 2 && $s[0] === '\\') {
131 if (isset(self::$escapes_single[$s[1]])) {
132 $s = self::$escapes_single[$s[1]];
133 }
134 }
136 $str .= $s;
137 }
139 return $str;
140 }
142 private static function parse_double_quoted_string($qstr) {
143 $inner_str = substr($qstr, 1, strlen($qstr)-2);
144 return stripcslashes($inner_str);
145 }
147 private static function parse_tripple_double_quoted_string($qstr) {
148 $inner_str = substr($qstr, 3, strlen($qstr)-6);
149 return stripcslashes($inner_str);
150 }
152 private function set_var(Array $var, Array &$target_array) {
153 $key = $var["key"];
154 $value = $var["value"];
156 if ($this->smarty->config_overwrite || !isset($target_array['vars'][$key])) {
157 $target_array['vars'][$key] = $value;
158 } else {
159 settype($target_array['vars'][$key], 'array');
160 $target_array['vars'][$key][] = $value;
161 }
162 }
164 private function add_global_vars(Array $vars) {
165 if (!isset($this->compiler->config_data['vars'])) {
166 $this->compiler->config_data['vars'] = Array();
167 }
168 foreach ($vars as $var) {
169 $this->set_var($var, $this->compiler->config_data);
170 }
171 }
173 private function add_section_vars($section_name, Array $vars) {
174 if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
175 $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
176 }
177 foreach ($vars as $var) {
178 $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
179 }
180 }
181 #line 174 "smarty_internal_configfileparser.php"
183 const TPC_OPENB = 1;
184 const TPC_SECTION = 2;
185 const TPC_CLOSEB = 3;
186 const TPC_DOT = 4;
187 const TPC_ID = 5;
188 const TPC_EQUAL = 6;
189 const TPC_FLOAT = 7;
190 const TPC_INT = 8;
191 const TPC_BOOL = 9;
192 const TPC_SINGLE_QUOTED_STRING = 10;
193 const TPC_DOUBLE_QUOTED_STRING = 11;
194 const TPC_TRIPPLE_DOUBLE_QUOTED_STRING = 12;
195 const TPC_NAKED_STRING = 13;
196 const TPC_NEWLINE = 14;
197 const TPC_COMMENTSTART = 15;
198 const YY_NO_ACTION = 54;
199 const YY_ACCEPT_ACTION = 53;
200 const YY_ERROR_ACTION = 52;
202 const YY_SZ_ACTTAB = 35;
203 static public $yy_action = array(
204 /* 0 */ 26, 27, 21, 30, 29, 28, 31, 16, 53, 8,
205 /* 10 */ 19, 2, 20, 11, 24, 23, 20, 11, 17, 15,
206 /* 20 */ 3, 14, 13, 18, 4, 6, 5, 1, 12, 22,
207 /* 30 */ 9, 47, 10, 25, 7,
208 );
209 static public $yy_lookahead = array(
210 /* 0 */ 7, 8, 9, 10, 11, 12, 13, 5, 17, 18,
211 /* 10 */ 14, 20, 14, 15, 22, 23, 14, 15, 2, 2,
212 /* 20 */ 20, 4, 13, 14, 6, 3, 3, 20, 1, 24,
213 /* 30 */ 22, 25, 22, 21, 19,
214 );
215 const YY_SHIFT_USE_DFLT = -8;
216 const YY_SHIFT_MAX = 17;
217 static public $yy_shift_ofst = array(
218 /* 0 */ -8, 2, 2, 2, -7, -2, -2, 27, -8, -8,
219 /* 10 */ -8, 9, 17, -4, 16, 23, 18, 22,
220 );
221 const YY_REDUCE_USE_DFLT = -10;
222 const YY_REDUCE_MAX = 10;
223 static public $yy_reduce_ofst = array(
224 /* 0 */ -9, -8, -8, -8, 5, 10, 8, 12, 15, 0,
225 /* 10 */ 7,
226 );
227 static public $yyExpectedTokens = array(
228 /* 0 */ array(),
229 /* 1 */ array(5, 14, 15, ),
230 /* 2 */ array(5, 14, 15, ),
231 /* 3 */ array(5, 14, 15, ),
232 /* 4 */ array(7, 8, 9, 10, 11, 12, 13, ),
233 /* 5 */ array(14, 15, ),
234 /* 6 */ array(14, 15, ),
235 /* 7 */ array(1, ),
236 /* 8 */ array(),
237 /* 9 */ array(),
238 /* 10 */ array(),
239 /* 11 */ array(13, 14, ),
240 /* 12 */ array(2, 4, ),
241 /* 13 */ array(14, ),
242 /* 14 */ array(2, ),
243 /* 15 */ array(3, ),
244 /* 16 */ array(6, ),
245 /* 17 */ array(3, ),
246 /* 18 */ array(),
247 /* 19 */ array(),
248 /* 20 */ array(),
249 /* 21 */ array(),
250 /* 22 */ array(),
251 /* 23 */ array(),
252 /* 24 */ array(),
253 /* 25 */ array(),
254 /* 26 */ array(),
255 /* 27 */ array(),
256 /* 28 */ array(),
257 /* 29 */ array(),
258 /* 30 */ array(),
259 /* 31 */ array(),
260 );
261 static public $yy_default = array(
262 /* 0 */ 40, 36, 33, 37, 52, 52, 52, 32, 35, 40,
263 /* 10 */ 40, 52, 52, 52, 52, 52, 52, 52, 50, 51,
264 /* 20 */ 49, 44, 41, 39, 38, 34, 42, 43, 47, 46,
265 /* 30 */ 45, 48,
266 );
267 const YYNOCODE = 26;
268 const YYSTACKDEPTH = 100;
269 const YYNSTATE = 32;
270 const YYNRULE = 20;
271 const YYERRORSYMBOL = 16;
272 const YYERRSYMDT = 'yy0';
273 const YYFALLBACK = 0;
274 static public $yyFallback = array(
275 );
276 static function Trace($TraceFILE, $zTracePrompt)
277 {
278 if (!$TraceFILE) {
279 $zTracePrompt = 0;
280 } elseif (!$zTracePrompt) {
281 $TraceFILE = 0;
282 }
283 self::$yyTraceFILE = $TraceFILE;
284 self::$yyTracePrompt = $zTracePrompt;
285 }
287 static function PrintTrace()
288 {
289 self::$yyTraceFILE = fopen('php://output', 'w');
290 self::$yyTracePrompt = '<br>';
291 }
293 static public $yyTraceFILE;
294 static public $yyTracePrompt;
295 public $yyidx; /* Index of top element in stack */
296 public $yyerrcnt; /* Shifts left before out of the error */
297 public $yystack = array(); /* The parser's stack */
299 public $yyTokenName = array(
300 '$', 'OPENB', 'SECTION', 'CLOSEB',
301 'DOT', 'ID', 'EQUAL', 'FLOAT',
302 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
303 'TRIPPLE_DOUBLE_QUOTED_STRING', 'NAKED_STRING', 'NEWLINE', 'COMMENTSTART',
304 'error', 'start', 'global_vars', 'sections',
305 'var_list', 'section', 'newline', 'var',
306 'value',
307 );
309 static public $yyRuleName = array(
310 /* 0 */ "start ::= global_vars sections",
311 /* 1 */ "global_vars ::= var_list",
312 /* 2 */ "sections ::= sections section",
313 /* 3 */ "sections ::=",
314 /* 4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
315 /* 5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
316 /* 6 */ "var_list ::= var_list newline",
317 /* 7 */ "var_list ::= var_list var",
318 /* 8 */ "var_list ::=",
319 /* 9 */ "var ::= ID EQUAL value",
320 /* 10 */ "value ::= FLOAT",
321 /* 11 */ "value ::= INT",
322 /* 12 */ "value ::= BOOL",
323 /* 13 */ "value ::= SINGLE_QUOTED_STRING",
324 /* 14 */ "value ::= DOUBLE_QUOTED_STRING",
325 /* 15 */ "value ::= TRIPPLE_DOUBLE_QUOTED_STRING",
326 /* 16 */ "value ::= NAKED_STRING",
327 /* 17 */ "newline ::= NEWLINE",
328 /* 18 */ "newline ::= COMMENTSTART NEWLINE",
329 /* 19 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
330 );
332 function tokenName($tokenType)
333 {
334 if ($tokenType === 0) {
335 return 'End of Input';
336 }
337 if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
338 return $this->yyTokenName[$tokenType];
339 } else {
340 return "Unknown";
341 }
342 }
344 static function yy_destructor($yymajor, $yypminor)
345 {
346 switch ($yymajor) {
347 default: break; /* If no destructor action specified: do nothing */
348 }
349 }
351 function yy_pop_parser_stack()
352 {
353 if (!count($this->yystack)) {
354 return;
355 }
356 $yytos = array_pop($this->yystack);
357 if (self::$yyTraceFILE && $this->yyidx >= 0) {
358 fwrite(self::$yyTraceFILE,
359 self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
360 "\n");
361 }
362 $yymajor = $yytos->major;
363 self::yy_destructor($yymajor, $yytos->minor);
364 $this->yyidx--;
365 return $yymajor;
366 }
368 function __destruct()
369 {
370 while ($this->yystack !== Array()) {
371 $this->yy_pop_parser_stack();
372 }
373 if (is_resource(self::$yyTraceFILE)) {
374 fclose(self::$yyTraceFILE);
375 }
376 }
378 function yy_get_expected_tokens($token)
379 {
380 $state = $this->yystack[$this->yyidx]->stateno;
381 $expected = self::$yyExpectedTokens[$state];
382 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
383 return $expected;
384 }
385 $stack = $this->yystack;
386 $yyidx = $this->yyidx;
387 do {
388 $yyact = $this->yy_find_shift_action($token);
389 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
390 // reduce action
391 $done = 0;
392 do {
393 if ($done++ == 100) {
394 $this->yyidx = $yyidx;
395 $this->yystack = $stack;
396 // too much recursion prevents proper detection
397 // so give up
398 return array_unique($expected);
399 }
400 $yyruleno = $yyact - self::YYNSTATE;
401 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
402 $nextstate = $this->yy_find_reduce_action(
403 $this->yystack[$this->yyidx]->stateno,
404 self::$yyRuleInfo[$yyruleno]['lhs']);
405 if (isset(self::$yyExpectedTokens[$nextstate])) {
406 $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
407 if (in_array($token,
408 self::$yyExpectedTokens[$nextstate], true)) {
409 $this->yyidx = $yyidx;
410 $this->yystack = $stack;
411 return array_unique($expected);
412 }
413 }
414 if ($nextstate < self::YYNSTATE) {
415 // we need to shift a non-terminal
416 $this->yyidx++;
417 $x = new TPC_yyStackEntry;
418 $x->stateno = $nextstate;
419 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
420 $this->yystack[$this->yyidx] = $x;
421 continue 2;
422 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
423 $this->yyidx = $yyidx;
424 $this->yystack = $stack;
425 // the last token was just ignored, we can't accept
426 // by ignoring input, this is in essence ignoring a
427 // syntax error!
428 return array_unique($expected);
429 } elseif ($nextstate === self::YY_NO_ACTION) {
430 $this->yyidx = $yyidx;
431 $this->yystack = $stack;
432 // input accepted, but not shifted (I guess)
433 return $expected;
434 } else {
435 $yyact = $nextstate;
436 }
437 } while (true);
438 }
439 break;
440 } while (true);
441 $this->yyidx = $yyidx;
442 $this->yystack = $stack;
443 return array_unique($expected);
444 }
446 function yy_is_expected_token($token)
447 {
448 if ($token === 0) {
449 return true; // 0 is not part of this
450 }
451 $state = $this->yystack[$this->yyidx]->stateno;
452 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
453 return true;
454 }
455 $stack = $this->yystack;
456 $yyidx = $this->yyidx;
457 do {
458 $yyact = $this->yy_find_shift_action($token);
459 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
460 // reduce action
461 $done = 0;
462 do {
463 if ($done++ == 100) {
464 $this->yyidx = $yyidx;
465 $this->yystack = $stack;
466 // too much recursion prevents proper detection
467 // so give up
468 return true;
469 }
470 $yyruleno = $yyact - self::YYNSTATE;
471 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
472 $nextstate = $this->yy_find_reduce_action(
473 $this->yystack[$this->yyidx]->stateno,
474 self::$yyRuleInfo[$yyruleno]['lhs']);
475 if (isset(self::$yyExpectedTokens[$nextstate]) &&
476 in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
477 $this->yyidx = $yyidx;
478 $this->yystack = $stack;
479 return true;
480 }
481 if ($nextstate < self::YYNSTATE) {
482 // we need to shift a non-terminal
483 $this->yyidx++;
484 $x = new TPC_yyStackEntry;
485 $x->stateno = $nextstate;
486 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
487 $this->yystack[$this->yyidx] = $x;
488 continue 2;
489 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
490 $this->yyidx = $yyidx;
491 $this->yystack = $stack;
492 if (!$token) {
493 // end of input: this is valid
494 return true;
495 }
496 // the last token was just ignored, we can't accept
497 // by ignoring input, this is in essence ignoring a
498 // syntax error!
499 return false;
500 } elseif ($nextstate === self::YY_NO_ACTION) {
501 $this->yyidx = $yyidx;
502 $this->yystack = $stack;
503 // input accepted, but not shifted (I guess)
504 return true;
505 } else {
506 $yyact = $nextstate;
507 }
508 } while (true);
509 }
510 break;
511 } while (true);
512 $this->yyidx = $yyidx;
513 $this->yystack = $stack;
514 return true;
515 }
517 function yy_find_shift_action($iLookAhead)
518 {
519 $stateno = $this->yystack[$this->yyidx]->stateno;
521 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
522 if (!isset(self::$yy_shift_ofst[$stateno])) {
523 // no shift actions
524 return self::$yy_default[$stateno];
525 }
526 $i = self::$yy_shift_ofst[$stateno];
527 if ($i === self::YY_SHIFT_USE_DFLT) {
528 return self::$yy_default[$stateno];
529 }
530 if ($iLookAhead == self::YYNOCODE) {
531 return self::YY_NO_ACTION;
532 }
533 $i += $iLookAhead;
534 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
535 self::$yy_lookahead[$i] != $iLookAhead) {
536 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
537 && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
538 if (self::$yyTraceFILE) {
539 fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
540 $this->yyTokenName[$iLookAhead] . " => " .
541 $this->yyTokenName[$iFallback] . "\n");
542 }
543 return $this->yy_find_shift_action($iFallback);
544 }
545 return self::$yy_default[$stateno];
546 } else {
547 return self::$yy_action[$i];
548 }
549 }
551 function yy_find_reduce_action($stateno, $iLookAhead)
552 {
553 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
555 if (!isset(self::$yy_reduce_ofst[$stateno])) {
556 return self::$yy_default[$stateno];
557 }
558 $i = self::$yy_reduce_ofst[$stateno];
559 if ($i == self::YY_REDUCE_USE_DFLT) {
560 return self::$yy_default[$stateno];
561 }
562 if ($iLookAhead == self::YYNOCODE) {
563 return self::YY_NO_ACTION;
564 }
565 $i += $iLookAhead;
566 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
567 self::$yy_lookahead[$i] != $iLookAhead) {
568 return self::$yy_default[$stateno];
569 } else {
570 return self::$yy_action[$i];
571 }
572 }
574 function yy_shift($yyNewState, $yyMajor, $yypMinor)
575 {
576 $this->yyidx++;
577 if ($this->yyidx >= self::YYSTACKDEPTH) {
578 $this->yyidx--;
579 if (self::$yyTraceFILE) {
580 fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
581 }
582 while ($this->yyidx >= 0) {
583 $this->yy_pop_parser_stack();
584 }
585 #line 126 "smarty_internal_configfileparser.y"
587 $this->internalError = true;
588 $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
589 #line 585 "smarty_internal_configfileparser.php"
590 return;
591 }
592 $yytos = new TPC_yyStackEntry;
593 $yytos->stateno = $yyNewState;
594 $yytos->major = $yyMajor;
595 $yytos->minor = $yypMinor;
596 array_push($this->yystack, $yytos);
597 if (self::$yyTraceFILE && $this->yyidx > 0) {
598 fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
599 $yyNewState);
600 fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
601 for($i = 1; $i <= $this->yyidx; $i++) {
602 fprintf(self::$yyTraceFILE, " %s",
603 $this->yyTokenName[$this->yystack[$i]->major]);
604 }
605 fwrite(self::$yyTraceFILE,"\n");
606 }
607 }
609 static public $yyRuleInfo = array(
610 array( 'lhs' => 17, 'rhs' => 2 ),
611 array( 'lhs' => 18, 'rhs' => 1 ),
612 array( 'lhs' => 19, 'rhs' => 2 ),
613 array( 'lhs' => 19, 'rhs' => 0 ),
614 array( 'lhs' => 21, 'rhs' => 5 ),
615 array( 'lhs' => 21, 'rhs' => 6 ),
616 array( 'lhs' => 20, 'rhs' => 2 ),
617 array( 'lhs' => 20, 'rhs' => 2 ),
618 array( 'lhs' => 20, 'rhs' => 0 ),
619 array( 'lhs' => 23, 'rhs' => 3 ),
620 array( 'lhs' => 24, 'rhs' => 1 ),
621 array( 'lhs' => 24, 'rhs' => 1 ),
622 array( 'lhs' => 24, 'rhs' => 1 ),
623 array( 'lhs' => 24, 'rhs' => 1 ),
624 array( 'lhs' => 24, 'rhs' => 1 ),
625 array( 'lhs' => 24, 'rhs' => 1 ),
626 array( 'lhs' => 24, 'rhs' => 1 ),
627 array( 'lhs' => 22, 'rhs' => 1 ),
628 array( 'lhs' => 22, 'rhs' => 2 ),
629 array( 'lhs' => 22, 'rhs' => 3 ),
630 );
632 static public $yyReduceMap = array(
633 0 => 0,
634 2 => 0,
635 3 => 0,
636 17 => 0,
637 18 => 0,
638 19 => 0,
639 1 => 1,
640 4 => 4,
641 5 => 5,
642 6 => 6,
643 7 => 7,
644 8 => 8,
645 9 => 9,
646 10 => 10,
647 11 => 11,
648 12 => 12,
649 13 => 13,
650 14 => 14,
651 15 => 15,
652 16 => 16,
653 );
654 #line 132 "smarty_internal_configfileparser.y"
655 function yy_r0(){
656 $this->_retvalue = null;
657 }
658 #line 654 "smarty_internal_configfileparser.php"
659 #line 137 "smarty_internal_configfileparser.y"
660 function yy_r1(){
661 $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
662 }
663 #line 659 "smarty_internal_configfileparser.php"
664 #line 150 "smarty_internal_configfileparser.y"
665 function yy_r4(){
666 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
667 $this->_retvalue = null;
668 }
669 #line 665 "smarty_internal_configfileparser.php"
670 #line 155 "smarty_internal_configfileparser.y"
671 function yy_r5(){
672 if ($this->smarty->config_read_hidden) {
673 $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
674 }
675 $this->_retvalue = null;
676 }
677 #line 673 "smarty_internal_configfileparser.php"
678 #line 163 "smarty_internal_configfileparser.y"
679 function yy_r6(){
680 $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
681 }
682 #line 678 "smarty_internal_configfileparser.php"
683 #line 167 "smarty_internal_configfileparser.y"
684 function yy_r7(){
685 $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
686 }
687 #line 683 "smarty_internal_configfileparser.php"
688 #line 171 "smarty_internal_configfileparser.y"
689 function yy_r8(){
690 $this->_retvalue = Array();
691 }
692 #line 688 "smarty_internal_configfileparser.php"
693 #line 177 "smarty_internal_configfileparser.y"
694 function yy_r9(){
695 $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
696 }
697 #line 693 "smarty_internal_configfileparser.php"
698 #line 182 "smarty_internal_configfileparser.y"
699 function yy_r10(){
700 $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
701 }
702 #line 698 "smarty_internal_configfileparser.php"
703 #line 186 "smarty_internal_configfileparser.y"
704 function yy_r11(){
705 $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
706 }
707 #line 703 "smarty_internal_configfileparser.php"
708 #line 190 "smarty_internal_configfileparser.y"
709 function yy_r12(){
710 $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
711 }
712 #line 708 "smarty_internal_configfileparser.php"
713 #line 194 "smarty_internal_configfileparser.y"
714 function yy_r13(){
715 $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
716 }
717 #line 713 "smarty_internal_configfileparser.php"
718 #line 198 "smarty_internal_configfileparser.y"
719 function yy_r14(){
720 $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
721 }
722 #line 718 "smarty_internal_configfileparser.php"
723 #line 202 "smarty_internal_configfileparser.y"
724 function yy_r15(){
725 $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
726 }
727 #line 723 "smarty_internal_configfileparser.php"
728 #line 206 "smarty_internal_configfileparser.y"
729 function yy_r16(){
730 $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
731 }
732 #line 728 "smarty_internal_configfileparser.php"
734 private $_retvalue;
736 function yy_reduce($yyruleno)
737 {
738 $yymsp = $this->yystack[$this->yyidx];
739 if (self::$yyTraceFILE && $yyruleno >= 0
740 && $yyruleno < count(self::$yyRuleName)) {
741 fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
742 self::$yyTracePrompt, $yyruleno,
743 self::$yyRuleName[$yyruleno]);
744 }
746 $this->_retvalue = $yy_lefthand_side = null;
747 if (array_key_exists($yyruleno, self::$yyReduceMap)) {
748 // call the action
749 $this->_retvalue = null;
750 $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
751 $yy_lefthand_side = $this->_retvalue;
752 }
753 $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
754 $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
755 $this->yyidx -= $yysize;
756 for($i = $yysize; $i; $i--) {
757 // pop all of the right-hand side parameters
758 array_pop($this->yystack);
759 }
760 $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
761 if ($yyact < self::YYNSTATE) {
762 if (!self::$yyTraceFILE && $yysize) {
763 $this->yyidx++;
764 $x = new TPC_yyStackEntry;
765 $x->stateno = $yyact;
766 $x->major = $yygoto;
767 $x->minor = $yy_lefthand_side;
768 $this->yystack[$this->yyidx] = $x;
769 } else {
770 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
771 }
772 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
773 $this->yy_accept();
774 }
775 }
777 function yy_parse_failed()
778 {
779 if (self::$yyTraceFILE) {
780 fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
781 }
782 while ($this->yyidx >= 0) {
783 $this->yy_pop_parser_stack();
784 }
785 }
787 function yy_syntax_error($yymajor, $TOKEN)
788 {
789 #line 119 "smarty_internal_configfileparser.y"
791 $this->internalError = true;
792 $this->yymajor = $yymajor;
793 $this->compiler->trigger_config_file_error();
794 #line 791 "smarty_internal_configfileparser.php"
795 }
797 function yy_accept()
798 {
799 if (self::$yyTraceFILE) {
800 fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
801 }
802 while ($this->yyidx >= 0) {
803 $stack = $this->yy_pop_parser_stack();
804 }
805 #line 111 "smarty_internal_configfileparser.y"
807 $this->successful = !$this->internalError;
808 $this->internalError = false;
809 $this->retvalue = $this->_retvalue;
810 //echo $this->retvalue."\n\n";
811 #line 809 "smarty_internal_configfileparser.php"
812 }
814 function doParse($yymajor, $yytokenvalue)
815 {
816 $yyerrorhit = 0; /* True if yymajor has invoked an error */
818 if ($this->yyidx === null || $this->yyidx < 0) {
819 $this->yyidx = 0;
820 $this->yyerrcnt = -1;
821 $x = new TPC_yyStackEntry;
822 $x->stateno = 0;
823 $x->major = 0;
824 $this->yystack = array();
825 array_push($this->yystack, $x);
826 }
827 $yyendofinput = ($yymajor==0);
829 if (self::$yyTraceFILE) {
830 fprintf(self::$yyTraceFILE, "%sInput %s\n",
831 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
832 }
834 do {
835 $yyact = $this->yy_find_shift_action($yymajor);
836 if ($yymajor < self::YYERRORSYMBOL &&
837 !$this->yy_is_expected_token($yymajor)) {
838 // force a syntax error
839 $yyact = self::YY_ERROR_ACTION;
840 }
841 if ($yyact < self::YYNSTATE) {
842 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
843 $this->yyerrcnt--;
844 if ($yyendofinput && $this->yyidx >= 0) {
845 $yymajor = 0;
846 } else {
847 $yymajor = self::YYNOCODE;
848 }
849 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
850 $this->yy_reduce($yyact - self::YYNSTATE);
851 } elseif ($yyact == self::YY_ERROR_ACTION) {
852 if (self::$yyTraceFILE) {
853 fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
854 self::$yyTracePrompt);
855 }
856 if (self::YYERRORSYMBOL) {
857 if ($this->yyerrcnt < 0) {
858 $this->yy_syntax_error($yymajor, $yytokenvalue);
859 }
860 $yymx = $this->yystack[$this->yyidx]->major;
861 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
862 if (self::$yyTraceFILE) {
863 fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
864 self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
865 }
866 $this->yy_destructor($yymajor, $yytokenvalue);
867 $yymajor = self::YYNOCODE;
868 } else {
869 while ($this->yyidx >= 0 &&
870 $yymx != self::YYERRORSYMBOL &&
871 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
872 ){
873 $this->yy_pop_parser_stack();
874 }
875 if ($this->yyidx < 0 || $yymajor==0) {
876 $this->yy_destructor($yymajor, $yytokenvalue);
877 $this->yy_parse_failed();
878 $yymajor = self::YYNOCODE;
879 } elseif ($yymx != self::YYERRORSYMBOL) {
880 $u2 = 0;
881 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
882 }
883 }
884 $this->yyerrcnt = 3;
885 $yyerrorhit = 1;
886 } else {
887 if ($this->yyerrcnt <= 0) {
888 $this->yy_syntax_error($yymajor, $yytokenvalue);
889 }
890 $this->yyerrcnt = 3;
891 $this->yy_destructor($yymajor, $yytokenvalue);
892 if ($yyendofinput) {
893 $this->yy_parse_failed();
894 }
895 $yymajor = self::YYNOCODE;
896 }
897 } else {
898 $this->yy_accept();
899 $yymajor = self::YYNOCODE;
900 }
901 } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
902 }
903 }
904 ?>