smarty_internal_configfileparser.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  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->yystack !== Array()) {
  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 = array_merge($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. $this->yyidx = $yyidx;
  408. $this->yystack = $stack;
  409. return array_unique($expected);
  410. }
  411. function yy_is_expected_token($token)
  412. {
  413. if ($token === 0) {
  414. return true; // 0 is not part of this
  415. }
  416. $state = $this->yystack[$this->yyidx]->stateno;
  417. if (in_array($token, self::$yyExpectedTokens[$state], true)) {
  418. return true;
  419. }
  420. $stack = $this->yystack;
  421. $yyidx = $this->yyidx;
  422. do {
  423. $yyact = $this->yy_find_shift_action($token);
  424. if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
  425. // reduce action
  426. $done = 0;
  427. do {
  428. if ($done++ == 100) {
  429. $this->yyidx = $yyidx;
  430. $this->yystack = $stack;
  431. // too much recursion prevents proper detection
  432. // so give up
  433. return true;
  434. }
  435. $yyruleno = $yyact - self::YYNSTATE;
  436. $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
  437. $nextstate = $this->yy_find_reduce_action(
  438. $this->yystack[$this->yyidx]->stateno,
  439. self::$yyRuleInfo[$yyruleno]['lhs']);
  440. if (isset(self::$yyExpectedTokens[$nextstate]) &&
  441. in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
  442. $this->yyidx = $yyidx;
  443. $this->yystack = $stack;
  444. return true;
  445. }
  446. if ($nextstate < self::YYNSTATE) {
  447. // we need to shift a non-terminal
  448. $this->yyidx++;
  449. $x = new TPC_yyStackEntry;
  450. $x->stateno = $nextstate;
  451. $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
  452. $this->yystack[$this->yyidx] = $x;
  453. continue 2;
  454. } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
  455. $this->yyidx = $yyidx;
  456. $this->yystack = $stack;
  457. if (!$token) {
  458. // end of input: this is valid
  459. return true;
  460. }
  461. // the last token was just ignored, we can't accept
  462. // by ignoring input, this is in essence ignoring a
  463. // syntax error!
  464. return false;
  465. } elseif ($nextstate === self::YY_NO_ACTION) {
  466. $this->yyidx = $yyidx;
  467. $this->yystack = $stack;
  468. // input accepted, but not shifted (I guess)
  469. return true;
  470. } else {
  471. $yyact = $nextstate;
  472. }
  473. } while (true);
  474. }
  475. break;
  476. } while (true);
  477. $this->yyidx = $yyidx;
  478. $this->yystack = $stack;
  479. return true;
  480. }
  481. function yy_find_shift_action($iLookAhead)
  482. {
  483. $stateno = $this->yystack[$this->yyidx]->stateno;
  484. /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
  485. if (!isset(self::$yy_shift_ofst[$stateno])) {
  486. // no shift actions
  487. return self::$yy_default[$stateno];
  488. }
  489. $i = self::$yy_shift_ofst[$stateno];
  490. if ($i === self::YY_SHIFT_USE_DFLT) {
  491. return self::$yy_default[$stateno];
  492. }
  493. if ($iLookAhead == self::YYNOCODE) {
  494. return self::YY_NO_ACTION;
  495. }
  496. $i += $iLookAhead;
  497. if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
  498. self::$yy_lookahead[$i] != $iLookAhead) {
  499. if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
  500. && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
  501. if (self::$yyTraceFILE) {
  502. fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
  503. $this->yyTokenName[$iLookAhead] . " => " .
  504. $this->yyTokenName[$iFallback] . "\n");
  505. }
  506. return $this->yy_find_shift_action($iFallback);
  507. }
  508. return self::$yy_default[$stateno];
  509. } else {
  510. return self::$yy_action[$i];
  511. }
  512. }
  513. function yy_find_reduce_action($stateno, $iLookAhead)
  514. {
  515. /* $stateno = $this->yystack[$this->yyidx]->stateno; */
  516. if (!isset(self::$yy_reduce_ofst[$stateno])) {
  517. return self::$yy_default[$stateno];
  518. }
  519. $i = self::$yy_reduce_ofst[$stateno];
  520. if ($i == self::YY_REDUCE_USE_DFLT) {
  521. return self::$yy_default[$stateno];
  522. }
  523. if ($iLookAhead == self::YYNOCODE) {
  524. return self::YY_NO_ACTION;
  525. }
  526. $i += $iLookAhead;
  527. if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
  528. self::$yy_lookahead[$i] != $iLookAhead) {
  529. return self::$yy_default[$stateno];
  530. } else {
  531. return self::$yy_action[$i];
  532. }
  533. }
  534. function yy_shift($yyNewState, $yyMajor, $yypMinor)
  535. {
  536. $this->yyidx++;
  537. if ($this->yyidx >= self::YYSTACKDEPTH) {
  538. $this->yyidx--;
  539. if (self::$yyTraceFILE) {
  540. fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
  541. }
  542. while ($this->yyidx >= 0) {
  543. $this->yy_pop_parser_stack();
  544. }
  545. #line 127 "smarty_internal_configfileparser.y"
  546. $this->internalError = true;
  547. $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
  548. #line 586 "smarty_internal_configfileparser.php"
  549. return;
  550. }
  551. $yytos = new TPC_yyStackEntry;
  552. $yytos->stateno = $yyNewState;
  553. $yytos->major = $yyMajor;
  554. $yytos->minor = $yypMinor;
  555. array_push($this->yystack, $yytos);
  556. if (self::$yyTraceFILE && $this->yyidx > 0) {
  557. fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
  558. $yyNewState);
  559. fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
  560. for($i = 1; $i <= $this->yyidx; $i++) {
  561. fprintf(self::$yyTraceFILE, " %s",
  562. $this->yyTokenName[$this->yystack[$i]->major]);
  563. }
  564. fwrite(self::$yyTraceFILE,"\n");
  565. }
  566. }
  567. static public $yyRuleInfo = array(
  568. array( 'lhs' => 17, 'rhs' => 2 ),
  569. array( 'lhs' => 18, 'rhs' => 1 ),
  570. array( 'lhs' => 19, 'rhs' => 2 ),
  571. array( 'lhs' => 19, 'rhs' => 0 ),
  572. array( 'lhs' => 21, 'rhs' => 5 ),
  573. array( 'lhs' => 21, 'rhs' => 6 ),
  574. array( 'lhs' => 20, 'rhs' => 2 ),
  575. array( 'lhs' => 20, 'rhs' => 2 ),
  576. array( 'lhs' => 20, 'rhs' => 0 ),
  577. array( 'lhs' => 23, 'rhs' => 3 ),
  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' => 24, 'rhs' => 1 ),
  585. array( 'lhs' => 22, 'rhs' => 1 ),
  586. array( 'lhs' => 22, 'rhs' => 2 ),
  587. array( 'lhs' => 22, 'rhs' => 3 ),
  588. );
  589. static public $yyReduceMap = array(
  590. 0 => 0,
  591. 2 => 0,
  592. 3 => 0,
  593. 17 => 0,
  594. 18 => 0,
  595. 19 => 0,
  596. 1 => 1,
  597. 4 => 4,
  598. 5 => 5,
  599. 6 => 6,
  600. 7 => 7,
  601. 8 => 8,
  602. 9 => 9,
  603. 10 => 10,
  604. 11 => 11,
  605. 12 => 12,
  606. 13 => 13,
  607. 14 => 14,
  608. 15 => 15,
  609. 16 => 16,
  610. );
  611. #line 133 "smarty_internal_configfileparser.y"
  612. function yy_r0(){ $this->_retvalue = null; }
  613. #line 653 "smarty_internal_configfileparser.php"
  614. #line 136 "smarty_internal_configfileparser.y"
  615. function yy_r1(){ $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; }
  616. #line 656 "smarty_internal_configfileparser.php"
  617. #line 142 "smarty_internal_configfileparser.y"
  618. function yy_r4(){ $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; }
  619. #line 659 "smarty_internal_configfileparser.php"
  620. #line 143 "smarty_internal_configfileparser.y"
  621. 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; }
  622. #line 662 "smarty_internal_configfileparser.php"
  623. #line 146 "smarty_internal_configfileparser.y"
  624. function yy_r6(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
  625. #line 665 "smarty_internal_configfileparser.php"
  626. #line 147 "smarty_internal_configfileparser.y"
  627. function yy_r7(){ $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor)); }
  628. #line 668 "smarty_internal_configfileparser.php"
  629. #line 148 "smarty_internal_configfileparser.y"
  630. function yy_r8(){ $this->_retvalue = Array(); }
  631. #line 671 "smarty_internal_configfileparser.php"
  632. #line 152 "smarty_internal_configfileparser.y"
  633. function yy_r9(){ $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor); }
  634. #line 674 "smarty_internal_configfileparser.php"
  635. #line 154 "smarty_internal_configfileparser.y"
  636. function yy_r10(){ $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; }
  637. #line 677 "smarty_internal_configfileparser.php"
  638. #line 155 "smarty_internal_configfileparser.y"
  639. function yy_r11(){ $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; }
  640. #line 680 "smarty_internal_configfileparser.php"
  641. #line 156 "smarty_internal_configfileparser.y"
  642. function yy_r12(){ $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); }
  643. #line 683 "smarty_internal_configfileparser.php"
  644. #line 157 "smarty_internal_configfileparser.y"
  645. function yy_r13(){ $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
  646. #line 686 "smarty_internal_configfileparser.php"
  647. #line 158 "smarty_internal_configfileparser.y"
  648. function yy_r14(){ $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
  649. #line 689 "smarty_internal_configfileparser.php"
  650. #line 159 "smarty_internal_configfileparser.y"
  651. function yy_r15(){ $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); }
  652. #line 692 "smarty_internal_configfileparser.php"
  653. #line 160 "smarty_internal_configfileparser.y"
  654. function yy_r16(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
  655. #line 695 "smarty_internal_configfileparser.php"
  656. private $_retvalue;
  657. function yy_reduce($yyruleno)
  658. {
  659. $yymsp = $this->yystack[$this->yyidx];
  660. if (self::$yyTraceFILE && $yyruleno >= 0
  661. && $yyruleno < count(self::$yyRuleName)) {
  662. fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
  663. self::$yyTracePrompt, $yyruleno,
  664. self::$yyRuleName[$yyruleno]);
  665. }
  666. $this->_retvalue = $yy_lefthand_side = null;
  667. if (array_key_exists($yyruleno, self::$yyReduceMap)) {
  668. // call the action
  669. $this->_retvalue = null;
  670. $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
  671. $yy_lefthand_side = $this->_retvalue;
  672. }
  673. $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
  674. $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
  675. $this->yyidx -= $yysize;
  676. for($i = $yysize; $i; $i--) {
  677. // pop all of the right-hand side parameters
  678. array_pop($this->yystack);
  679. }
  680. $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
  681. if ($yyact < self::YYNSTATE) {
  682. if (!self::$yyTraceFILE && $yysize) {
  683. $this->yyidx++;
  684. $x = new TPC_yyStackEntry;
  685. $x->stateno = $yyact;
  686. $x->major = $yygoto;
  687. $x->minor = $yy_lefthand_side;
  688. $this->yystack[$this->yyidx] = $x;
  689. } else {
  690. $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
  691. }
  692. } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
  693. $this->yy_accept();
  694. }
  695. }
  696. function yy_parse_failed()
  697. {
  698. if (self::$yyTraceFILE) {
  699. fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
  700. }
  701. while ($this->yyidx >= 0) {
  702. $this->yy_pop_parser_stack();
  703. }
  704. }
  705. function yy_syntax_error($yymajor, $TOKEN)
  706. {
  707. #line 120 "smarty_internal_configfileparser.y"
  708. $this->internalError = true;
  709. $this->yymajor = $yymajor;
  710. $this->compiler->trigger_config_file_error();
  711. #line 758 "smarty_internal_configfileparser.php"
  712. }
  713. function yy_accept()
  714. {
  715. if (self::$yyTraceFILE) {
  716. fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
  717. }
  718. while ($this->yyidx >= 0) {
  719. $stack = $this->yy_pop_parser_stack();
  720. }
  721. #line 112 "smarty_internal_configfileparser.y"
  722. $this->successful = !$this->internalError;
  723. $this->internalError = false;
  724. $this->retvalue = $this->_retvalue;
  725. //echo $this->retvalue."\n\n";
  726. #line 776 "smarty_internal_configfileparser.php"
  727. }
  728. function doParse($yymajor, $yytokenvalue)
  729. {
  730. $yyerrorhit = 0; /* True if yymajor has invoked an error */
  731. if ($this->yyidx === null || $this->yyidx < 0) {
  732. $this->yyidx = 0;
  733. $this->yyerrcnt = -1;
  734. $x = new TPC_yyStackEntry;
  735. $x->stateno = 0;
  736. $x->major = 0;
  737. $this->yystack = array();
  738. array_push($this->yystack, $x);
  739. }
  740. $yyendofinput = ($yymajor==0);
  741. if (self::$yyTraceFILE) {
  742. fprintf(self::$yyTraceFILE, "%sInput %s\n",
  743. self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
  744. }
  745. do {
  746. $yyact = $this->yy_find_shift_action($yymajor);
  747. if ($yymajor < self::YYERRORSYMBOL &&
  748. !$this->yy_is_expected_token($yymajor)) {
  749. // force a syntax error
  750. $yyact = self::YY_ERROR_ACTION;
  751. }
  752. if ($yyact < self::YYNSTATE) {
  753. $this->yy_shift($yyact, $yymajor, $yytokenvalue);
  754. $this->yyerrcnt--;
  755. if ($yyendofinput && $this->yyidx >= 0) {
  756. $yymajor = 0;
  757. } else {
  758. $yymajor = self::YYNOCODE;
  759. }
  760. } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
  761. $this->yy_reduce($yyact - self::YYNSTATE);
  762. } elseif ($yyact == self::YY_ERROR_ACTION) {
  763. if (self::$yyTraceFILE) {
  764. fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
  765. self::$yyTracePrompt);
  766. }
  767. if (self::YYERRORSYMBOL) {
  768. if ($this->yyerrcnt < 0) {
  769. $this->yy_syntax_error($yymajor, $yytokenvalue);
  770. }
  771. $yymx = $this->yystack[$this->yyidx]->major;
  772. if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
  773. if (self::$yyTraceFILE) {
  774. fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
  775. self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
  776. }
  777. $this->yy_destructor($yymajor, $yytokenvalue);
  778. $yymajor = self::YYNOCODE;
  779. } else {
  780. while ($this->yyidx >= 0 &&
  781. $yymx != self::YYERRORSYMBOL &&
  782. ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
  783. ){
  784. $this->yy_pop_parser_stack();
  785. }
  786. if ($this->yyidx < 0 || $yymajor==0) {
  787. $this->yy_destructor($yymajor, $yytokenvalue);
  788. $this->yy_parse_failed();
  789. $yymajor = self::YYNOCODE;
  790. } elseif ($yymx != self::YYERRORSYMBOL) {
  791. $u2 = 0;
  792. $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
  793. }
  794. }
  795. $this->yyerrcnt = 3;
  796. $yyerrorhit = 1;
  797. } else {
  798. if ($this->yyerrcnt <= 0) {
  799. $this->yy_syntax_error($yymajor, $yytokenvalue);
  800. }
  801. $this->yyerrcnt = 3;
  802. $this->yy_destructor($yymajor, $yytokenvalue);
  803. if ($yyendofinput) {
  804. $this->yy_parse_failed();
  805. }
  806. $yymajor = self::YYNOCODE;
  807. }
  808. } else {
  809. $this->yy_accept();
  810. $yymajor = self::YYNOCODE;
  811. }
  812. } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
  813. }
  814. }
  815. ?>