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

/Extend/Vendor/Smarty/sysplugins/smarty_internal_configfileparser.php

http://thinkphp.googlecode.com/
PHP | 928 lines | 804 code | 45 blank | 79 comment | 121 complexity | 7efb3c6e5ee81fcbcccae2df60eef515 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
  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. 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 173 "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_QUOTES_END = 13;
  170. const TPC_NAKED_STRING = 14;
  171. const TPC_TRIPPLE_CONTENT = 15;
  172. const TPC_NEWLINE = 16;
  173. const TPC_COMMENTSTART = 17;
  174. const YY_NO_ACTION = 61;
  175. const YY_ACCEPT_ACTION = 60;
  176. const YY_ERROR_ACTION = 59;
  177. const YY_SZ_ACTTAB = 39;
  178. static public $yy_action = array(
  179. /* 0 */ 29, 30, 34, 33, 24, 7, 19, 21, 60, 9,
  180. /* 10 */ 16, 1, 20, 14, 15, 6, 23, 20, 14, 32,
  181. /* 20 */ 17, 31, 18, 27, 26, 2, 3, 5, 25, 22,
  182. /* 30 */ 35, 4, 13, 11, 10, 12, 53, 28, 8,
  183. );
  184. static public $yy_lookahead = array(
  185. /* 0 */ 7, 8, 9, 10, 11, 12, 5, 14, 19, 20,
  186. /* 10 */ 2, 22, 16, 17, 14, 3, 16, 16, 17, 13,
  187. /* 20 */ 2, 15, 4, 24, 25, 22, 22, 3, 26, 16,
  188. /* 30 */ 15, 6, 27, 24, 24, 1, 28, 23, 21,
  189. );
  190. const YY_SHIFT_USE_DFLT = -8;
  191. const YY_SHIFT_MAX = 19;
  192. static public $yy_shift_ofst = array(
  193. /* 0 */ -8, 1, 1, 1, -7, -4, -4, 15, 34, -8,
  194. /* 10 */ -8, -8, 18, 6, 0, 13, 24, 12, 8, 25,
  195. );
  196. const YY_REDUCE_USE_DFLT = -12;
  197. const YY_REDUCE_MAX = 11;
  198. static public $yy_reduce_ofst = array(
  199. /* 0 */ -11, -1, -1, -1, 2, 10, 9, 5, 14, 17,
  200. /* 10 */ 3, 4,
  201. );
  202. static public $yyExpectedTokens = array(
  203. /* 0 */ array(),
  204. /* 1 */ array(5, 16, 17, ),
  205. /* 2 */ array(5, 16, 17, ),
  206. /* 3 */ array(5, 16, 17, ),
  207. /* 4 */ array(7, 8, 9, 10, 11, 12, 14, ),
  208. /* 5 */ array(16, 17, ),
  209. /* 6 */ array(16, 17, ),
  210. /* 7 */ array(15, ),
  211. /* 8 */ array(1, ),
  212. /* 9 */ array(),
  213. /* 10 */ array(),
  214. /* 11 */ array(),
  215. /* 12 */ array(2, 4, ),
  216. /* 13 */ array(13, 15, ),
  217. /* 14 */ array(14, 16, ),
  218. /* 15 */ array(16, ),
  219. /* 16 */ array(3, ),
  220. /* 17 */ array(3, ),
  221. /* 18 */ array(2, ),
  222. /* 19 */ array(6, ),
  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. /* 32 */ array(),
  236. /* 33 */ array(),
  237. /* 34 */ array(),
  238. /* 35 */ array(),
  239. );
  240. static public $yy_default = array(
  241. /* 0 */ 44, 37, 41, 40, 59, 59, 59, 55, 36, 39,
  242. /* 10 */ 44, 44, 59, 59, 59, 59, 59, 59, 59, 59,
  243. /* 20 */ 56, 52, 58, 57, 50, 45, 43, 42, 38, 46,
  244. /* 30 */ 47, 53, 51, 49, 48, 54,
  245. );
  246. const YYNOCODE = 29;
  247. const YYSTACKDEPTH = 100;
  248. const YYNSTATE = 36;
  249. const YYNRULE = 23;
  250. const YYERRORSYMBOL = 18;
  251. const YYERRSYMDT = 'yy0';
  252. const YYFALLBACK = 0;
  253. static public $yyFallback = array(
  254. );
  255. static function Trace($TraceFILE, $zTracePrompt)
  256. {
  257. if (!$TraceFILE) {
  258. $zTracePrompt = 0;
  259. } elseif (!$zTracePrompt) {
  260. $TraceFILE = 0;
  261. }
  262. self::$yyTraceFILE = $TraceFILE;
  263. self::$yyTracePrompt = $zTracePrompt;
  264. }
  265. static function PrintTrace()
  266. {
  267. self::$yyTraceFILE = fopen('php://output', 'w');
  268. self::$yyTracePrompt = '<br>';
  269. }
  270. static public $yyTraceFILE;
  271. static public $yyTracePrompt;
  272. public $yyidx; /* Index of top element in stack */
  273. public $yyerrcnt; /* Shifts left before out of the error */
  274. public $yystack = array(); /* The parser's stack */
  275. public $yyTokenName = array(
  276. '$', 'OPENB', 'SECTION', 'CLOSEB',
  277. 'DOT', 'ID', 'EQUAL', 'FLOAT',
  278. 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
  279. 'TRIPPLE_QUOTES', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'TRIPPLE_CONTENT',
  280. 'NEWLINE', 'COMMENTSTART', 'error', 'start',
  281. 'global_vars', 'sections', 'var_list', 'section',
  282. 'newline', 'var', 'value', 'tripple_content',
  283. );
  284. static public $yyRuleName = array(
  285. /* 0 */ "start ::= global_vars sections",
  286. /* 1 */ "global_vars ::= var_list",
  287. /* 2 */ "sections ::= sections section",
  288. /* 3 */ "sections ::=",
  289. /* 4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
  290. /* 5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
  291. /* 6 */ "var_list ::= var_list newline",
  292. /* 7 */ "var_list ::= var_list var",
  293. /* 8 */ "var_list ::=",
  294. /* 9 */ "var ::= ID EQUAL value",
  295. /* 10 */ "value ::= FLOAT",
  296. /* 11 */ "value ::= INT",
  297. /* 12 */ "value ::= BOOL",
  298. /* 13 */ "value ::= SINGLE_QUOTED_STRING",
  299. /* 14 */ "value ::= DOUBLE_QUOTED_STRING",
  300. /* 15 */ "value ::= TRIPPLE_QUOTES tripple_content TRIPPLE_QUOTES_END",
  301. /* 16 */ "value ::= NAKED_STRING",
  302. /* 17 */ "tripple_content ::= tripple_content TRIPPLE_CONTENT",
  303. /* 18 */ "tripple_content ::= TRIPPLE_CONTENT",
  304. /* 19 */ "tripple_content ::=",
  305. /* 20 */ "newline ::= NEWLINE",
  306. /* 21 */ "newline ::= COMMENTSTART NEWLINE",
  307. /* 22 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
  308. );
  309. 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. static function yy_destructor($yymajor, $yypminor)
  321. {
  322. switch ($yymajor) {
  323. default: break; /* If no destructor action specified: do nothing */
  324. }
  325. }
  326. function yy_pop_parser_stack()
  327. {
  328. if (!count($this->yystack)) {
  329. return;
  330. }
  331. $yytos = array_pop($this->yystack);
  332. if (self::$yyTraceFILE && $this->yyidx >= 0) {
  333. fwrite(self::$yyTraceFILE,
  334. self::$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. function __destruct()
  343. {
  344. while ($this->yystack !== Array()) {
  345. $this->yy_pop_parser_stack();
  346. }
  347. if (is_resource(self::$yyTraceFILE)) {
  348. fclose(self::$yyTraceFILE);
  349. }
  350. }
  351. 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. 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. 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 (self::$yyTraceFILE) {
  509. fwrite(self::$yyTraceFILE, self::$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. 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. function yy_shift($yyNewState, $yyMajor, $yypMinor)
  542. {
  543. $this->yyidx++;
  544. if ($this->yyidx >= self::YYSTACKDEPTH) {
  545. $this->yyidx--;
  546. if (self::$yyTraceFILE) {
  547. fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$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 593 "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 (self::$yyTraceFILE && $this->yyidx > 0) {
  564. fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
  565. $yyNewState);
  566. fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
  567. for($i = 1; $i <= $this->yyidx; $i++) {
  568. fprintf(self::$yyTraceFILE, " %s",
  569. $this->yyTokenName[$this->yystack[$i]->major]);
  570. }
  571. fwrite(self::$yyTraceFILE,"\n");
  572. }
  573. }
  574. static public $yyRuleInfo = array(
  575. array( 'lhs' => 19, 'rhs' => 2 ),
  576. array( 'lhs' => 20, 'rhs' => 1 ),
  577. array( 'lhs' => 21, 'rhs' => 2 ),
  578. array( 'lhs' => 21, 'rhs' => 0 ),
  579. array( 'lhs' => 23, 'rhs' => 5 ),
  580. array( 'lhs' => 23, 'rhs' => 6 ),
  581. array( 'lhs' => 22, 'rhs' => 2 ),
  582. array( 'lhs' => 22, 'rhs' => 2 ),
  583. array( 'lhs' => 22, 'rhs' => 0 ),
  584. array( 'lhs' => 25, 'rhs' => 3 ),
  585. array( 'lhs' => 26, 'rhs' => 1 ),
  586. array( 'lhs' => 26, 'rhs' => 1 ),
  587. array( 'lhs' => 26, 'rhs' => 1 ),
  588. array( 'lhs' => 26, 'rhs' => 1 ),
  589. array( 'lhs' => 26, 'rhs' => 1 ),
  590. array( 'lhs' => 26, 'rhs' => 3 ),
  591. array( 'lhs' => 26, 'rhs' => 1 ),
  592. array( 'lhs' => 27, 'rhs' => 2 ),
  593. array( 'lhs' => 27, 'rhs' => 1 ),
  594. array( 'lhs' => 27, 'rhs' => 0 ),
  595. array( 'lhs' => 24, 'rhs' => 1 ),
  596. array( 'lhs' => 24, 'rhs' => 2 ),
  597. array( 'lhs' => 24, 'rhs' => 3 ),
  598. );
  599. static public $yyReduceMap = array(
  600. 0 => 0,
  601. 2 => 0,
  602. 3 => 0,
  603. 20 => 0,
  604. 21 => 0,
  605. 22 => 0,
  606. 1 => 1,
  607. 4 => 4,
  608. 5 => 5,
  609. 6 => 6,
  610. 7 => 7,
  611. 8 => 8,
  612. 9 => 9,
  613. 10 => 10,
  614. 11 => 11,
  615. 12 => 12,
  616. 13 => 13,
  617. 14 => 14,
  618. 15 => 15,
  619. 16 => 16,
  620. 18 => 16,
  621. 17 => 17,
  622. 19 => 19,
  623. );
  624. #line 131 "smarty_internal_configfileparser.y"
  625. function yy_r0(){
  626. $this->_retvalue = null;
  627. }
  628. #line 668 "smarty_internal_configfileparser.php"
  629. #line 136 "smarty_internal_configfileparser.y"
  630. function yy_r1(){
  631. $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
  632. }
  633. #line 673 "smarty_internal_configfileparser.php"
  634. #line 149 "smarty_internal_configfileparser.y"
  635. function yy_r4(){
  636. $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
  637. $this->_retvalue = null;
  638. }
  639. #line 679 "smarty_internal_configfileparser.php"
  640. #line 154 "smarty_internal_configfileparser.y"
  641. function yy_r5(){
  642. if ($this->smarty->config_read_hidden) {
  643. $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
  644. }
  645. $this->_retvalue = null;
  646. }
  647. #line 687 "smarty_internal_configfileparser.php"
  648. #line 162 "smarty_internal_configfileparser.y"
  649. function yy_r6(){
  650. $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
  651. }
  652. #line 692 "smarty_internal_configfileparser.php"
  653. #line 166 "smarty_internal_configfileparser.y"
  654. function yy_r7(){
  655. $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
  656. }
  657. #line 697 "smarty_internal_configfileparser.php"
  658. #line 170 "smarty_internal_configfileparser.y"
  659. function yy_r8(){
  660. $this->_retvalue = Array();
  661. }
  662. #line 702 "smarty_internal_configfileparser.php"
  663. #line 176 "smarty_internal_configfileparser.y"
  664. function yy_r9(){
  665. $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
  666. }
  667. #line 707 "smarty_internal_configfileparser.php"
  668. #line 181 "smarty_internal_configfileparser.y"
  669. function yy_r10(){
  670. $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
  671. }
  672. #line 712 "smarty_internal_configfileparser.php"
  673. #line 185 "smarty_internal_configfileparser.y"
  674. function yy_r11(){
  675. $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
  676. }
  677. #line 717 "smarty_internal_configfileparser.php"
  678. #line 189 "smarty_internal_configfileparser.y"
  679. function yy_r12(){
  680. $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
  681. }
  682. #line 722 "smarty_internal_configfileparser.php"
  683. #line 193 "smarty_internal_configfileparser.y"
  684. function yy_r13(){
  685. $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
  686. }
  687. #line 727 "smarty_internal_configfileparser.php"
  688. #line 197 "smarty_internal_configfileparser.y"
  689. function yy_r14(){
  690. $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
  691. }
  692. #line 732 "smarty_internal_configfileparser.php"
  693. #line 201 "smarty_internal_configfileparser.y"
  694. function yy_r15(){
  695. $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
  696. }
  697. #line 737 "smarty_internal_configfileparser.php"
  698. #line 205 "smarty_internal_configfileparser.y"
  699. function yy_r16(){
  700. $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
  701. }
  702. #line 742 "smarty_internal_configfileparser.php"
  703. #line 210 "smarty_internal_configfileparser.y"
  704. function yy_r17(){
  705. $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor . $this->yystack[$this->yyidx + 0]->minor;
  706. }
  707. #line 747 "smarty_internal_configfileparser.php"
  708. #line 216 "smarty_internal_configfileparser.y"
  709. function yy_r19(){
  710. $this->_retvalue = '';
  711. }
  712. #line 752 "smarty_internal_configfileparser.php"
  713. private $_retvalue;
  714. function yy_reduce($yyruleno)
  715. {
  716. $yymsp = $this->yystack[$this->yyidx];
  717. if (self::$yyTraceFILE && $yyruleno >= 0
  718. && $yyruleno < count(self::$yyRuleName)) {
  719. fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
  720. self::$yyTracePrompt, $yyruleno,
  721. self::$yyRuleName[$yyruleno]);
  722. }
  723. $this->_retvalue = $yy_lefthand_side = null;
  724. if (array_key_exists($yyruleno, self::$yyReduceMap)) {
  725. // call the action
  726. $this->_retvalue = null;
  727. $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
  728. $yy_lefthand_side = $this->_retvalue;
  729. }
  730. $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
  731. $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
  732. $this->yyidx -= $yysize;
  733. for($i = $yysize; $i; $i--) {
  734. // pop all of the right-hand side parameters
  735. array_pop($this->yystack);
  736. }
  737. $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
  738. if ($yyact < self::YYNSTATE) {
  739. if (!self::$yyTraceFILE && $yysize) {
  740. $this->yyidx++;
  741. $x = new TPC_yyStackEntry;
  742. $x->stateno = $yyact;
  743. $x->major = $yygoto;
  744. $x->minor = $yy_lefthand_side;
  745. $this->yystack[$this->yyidx] = $x;
  746. } else {
  747. $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
  748. }
  749. } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
  750. $this->yy_accept();
  751. }
  752. }
  753. function yy_parse_failed()
  754. {
  755. if (self::$yyTraceFILE) {
  756. fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
  757. }
  758. while ($this->yyidx >= 0) {
  759. $this->yy_pop_parser_stack();
  760. }
  761. }
  762. function yy_syntax_error($yymajor, $TOKEN)
  763. {
  764. #line 118 "smarty_internal_configfileparser.y"
  765. $this->internalError = true;
  766. $this->yymajor = $yymajor;
  767. $this->compiler->trigger_config_file_error();
  768. #line 815 "smarty_internal_configfileparser.php"
  769. }
  770. function yy_accept()
  771. {
  772. if (self::$yyTraceFILE) {
  773. fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
  774. }
  775. while ($this->yyidx >= 0) {
  776. $stack = $this->yy_pop_parser_stack();
  777. }
  778. #line 110 "smarty_internal_configfileparser.y"
  779. $this->successful = !$this->internalError;
  780. $this->internalError = false;
  781. $this->retvalue = $this->_retvalue;
  782. //echo $this->retvalue."\n\n";
  783. #line 833 "smarty_internal_configfileparser.php"
  784. }
  785. function doParse($yymajor, $yytokenvalue)
  786. {
  787. $yyerrorhit = 0; /* True if yymajor has invoked an error */
  788. if ($this->yyidx === null || $this->yyidx < 0) {
  789. $this->yyidx = 0;
  790. $this->yyerrcnt = -1;
  791. $x = new TPC_yyStackEntry;
  792. $x->stateno = 0;
  793. $x->major = 0;
  794. $this->yystack = array();
  795. array_push($this->yystack, $x);
  796. }
  797. $yyendofinput = ($yymajor==0);
  798. if (self::$yyTraceFILE) {
  799. fprintf(self::$yyTraceFILE, "%sInput %s\n",
  800. self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
  801. }
  802. do {
  803. $yyact = $this->yy_find_shift_action($yymajor);
  804. if ($yymajor < self::YYERRORSYMBOL &&
  805. !$this->yy_is_expected_token($yymajor)) {
  806. // force a syntax error
  807. $yyact = self::YY_ERROR_ACTION;
  808. }
  809. if ($yyact < self::YYNSTATE) {
  810. $this->yy_shift($yyact, $yymajor, $yytokenvalue);
  811. $this->yyerrcnt--;
  812. if ($yyendofinput && $this->yyidx >= 0) {
  813. $yymajor = 0;
  814. } else {
  815. $yymajor = self::YYNOCODE;
  816. }
  817. } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
  818. $this->yy_reduce($yyact - self::YYNSTATE);
  819. } elseif ($yyact == self::YY_ERROR_ACTION) {
  820. if (self::$yyTraceFILE) {
  821. fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
  822. self::$yyTracePrompt);
  823. }
  824. if (self::YYERRORSYMBOL) {
  825. if ($this->yyerrcnt < 0) {
  826. $this->yy_syntax_error($yymajor, $yytokenvalue);
  827. }
  828. $yymx = $this->yystack[$this->yyidx]->major;
  829. if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
  830. if (self::$yyTraceFILE) {
  831. fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
  832. self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
  833. }
  834. $this->yy_destructor($yymajor, $yytokenvalue);
  835. $yymajor = self::YYNOCODE;
  836. } else {
  837. while ($this->yyidx >= 0 &&
  838. $yymx != self::YYERRORSYMBOL &&
  839. ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
  840. ){
  841. $this->yy_pop_parser_stack();
  842. }
  843. if ($this->yyidx < 0 || $yymajor==0) {
  844. $this->yy_destructor($yymajor, $yytokenvalue);
  845. $this->yy_parse_failed();
  846. $yymajor = self::YYNOCODE;
  847. } elseif ($yymx != self::YYERRORSYMBOL) {
  848. $u2 = 0;
  849. $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
  850. }
  851. }
  852. $this->yyerrcnt = 3;
  853. $yyerrorhit = 1;
  854. } else {
  855. if ($this->yyerrcnt <= 0) {
  856. $this->yy_syntax_error($yymajor, $yytokenvalue);
  857. }
  858. $this->yyerrcnt = 3;
  859. $this->yy_destructor($yymajor, $yytokenvalue);
  860. if ($yyendofinput) {
  861. $this->yy_parse_failed();
  862. }
  863. $yymajor = self::YYNOCODE;
  864. }
  865. } else {
  866. $this->yy_accept();
  867. $yymajor = self::YYNOCODE;
  868. }
  869. } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
  870. }
  871. }
  872. ?>