smarty_internal_configfileparser.php 33 KB

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