PageRenderTime 79ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/vendor/smarty/sysplugins/smarty_internal_configfileparser.php

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