PageRenderTime 48ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/smarty3/lib/libs/sysplugins/smarty_internal_configfileparser.php

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