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