PageRenderTime 59ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/smarty/sysplugins/smarty_internal_configfileparser.php

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