- Added tests suite for haanga-cli.php
[haanga.git] / lib / parser.php
blob1fcfd3d113d1ade45f48f4dabd0d95d284107e16
1 <?php
2 /* Driver template for the PHP_Haanga_rGenerator parser generator. (PHP port of LEMON)
3 */
5 /**
6 * This can be used to store both the string representation of
7 * a token, and any useful meta-data associated with the token.
9 * meta-data should be stored as an array
11 class Haanga_yyToken implements ArrayAccess
13 public $string = '';
14 public $metadata = array();
16 function __construct($s, $m = array())
18 if ($s instanceof Haanga_yyToken) {
19 $this->string = $s->string;
20 $this->metadata = $s->metadata;
21 } else {
22 $this->string = (string) $s;
23 if ($m instanceof Haanga_yyToken) {
24 $this->metadata = $m->metadata;
25 } elseif (is_array($m)) {
26 $this->metadata = $m;
31 function __toString()
33 return $this->_string;
36 function offsetExists($offset)
38 return isset($this->metadata[$offset]);
41 function offsetGet($offset)
43 return $this->metadata[$offset];
46 function offsetSet($offset, $value)
48 if ($offset === null) {
49 if (isset($value[0])) {
50 $x = ($value instanceof Haanga_yyToken) ?
51 $value->metadata : $value;
52 $this->metadata = array_merge($this->metadata, $x);
53 return;
55 $offset = count($this->metadata);
57 if ($value === null) {
58 return;
60 if ($value instanceof Haanga_yyToken) {
61 if ($value->metadata) {
62 $this->metadata[$offset] = $value->metadata;
64 } elseif ($value) {
65 $this->metadata[$offset] = $value;
69 function offsetUnset($offset)
71 unset($this->metadata[$offset]);
75 /** The following structure represents a single element of the
76 * parser's stack. Information stored includes:
78 * + The state number for the parser at this level of the stack.
80 * + The value of the token stored at this level of the stack.
81 * (In other words, the "major" token.)
83 * + The semantic value stored at this level of the stack. This is
84 * the information used by the action routines in the grammar.
85 * It is sometimes called the "minor" token.
87 class Haanga_yyStackEntry
89 public $stateno; /* The state-number */
90 public $major; /* The major token value. This is the code
91 ** number for the token at this stack level */
92 public $minor; /* The user-supplied minor token value. This
93 ** is the value of the token */
96 // code external to the class is included here
97 #line 2 "parser.y"
100 +---------------------------------------------------------------------------------+
101 | Copyright (c) 2010 Haanga |
102 +---------------------------------------------------------------------------------+
103 | Redistribution and use in source and binary forms, with or without |
104 | modification, are permitted provided that the following conditions are met: |
105 | 1. Redistributions of source code must retain the above copyright |
106 | notice, this list of conditions and the following disclaimer. |
108 | 2. Redistributions in binary form must reproduce the above copyright |
109 | notice, this list of conditions and the following disclaimer in the |
110 | documentation and/or other materials provided with the distribution. |
112 | 3. All advertising materials mentioning features or use of this software |
113 | must display the following acknowledgement: |
114 | This product includes software developed by César D. Rodas. |
116 | 4. Neither the name of the César D. Rodas nor the |
117 | names of its contributors may be used to endorse or promote products |
118 | derived from this software without specific prior written permission. |
120 | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY |
121 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
122 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
123 | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY |
124 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
125 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
126 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
127 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
128 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
129 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE |
130 +---------------------------------------------------------------------------------+
131 | Authors: César Rodas <crodas@php.net> |
132 +---------------------------------------------------------------------------------+
134 #line 136 "parser.php"
136 // declare_class is output here
137 #line 39 "parser.y"
138 class Parser #line 141 "parser.php"
140 /* First off, code is included which follows the "include_class" declaration
141 ** in the input file. */
142 #line 40 "parser.y"
145 #line 149 "parser.php"
147 /* Next is all token values, as class constants
150 ** These constants (all generated automatically by the parser generator)
151 ** specify the various kinds of tokens (terminals) that the parser
152 ** understands.
154 ** Each symbol here is a terminal symbol in the grammar.
156 const T_OPEN_TAG = 1;
157 const T_AND = 2;
158 const T_OR = 3;
159 const T_EQ = 4;
160 const T_NE = 5;
161 const T_GT = 6;
162 const T_GE = 7;
163 const T_LT = 8;
164 const T_LE = 9;
165 const T_IN = 10;
166 const T_PLUS = 11;
167 const T_MINUS = 12;
168 const T_TIMES = 13;
169 const T_DIV = 14;
170 const T_MOD = 15;
171 const T_HTML = 16;
172 const T_COMMENT_OPEN = 17;
173 const T_COMMENT = 18;
174 const T_PRINT_OPEN = 19;
175 const T_PRINT_CLOSE = 20;
176 const T_EXTENDS = 21;
177 const T_CLOSE_TAG = 22;
178 const T_INCLUDE = 23;
179 const T_AUTOESCAPE = 24;
180 const T_OFF = 25;
181 const T_ON = 26;
182 const T_END_AUTOESCAPE = 27;
183 const T_CUSTOM_TAG = 28;
184 const T_AS = 29;
185 const T_CUSTOM_BLOCK = 30;
186 const T_CUSTOM_END = 31;
187 const T_WITH = 32;
188 const T_ENDWITH = 33;
189 const T_FOR = 34;
190 const T_CLOSEFOR = 35;
191 const T_COMMA = 36;
192 const T_EMPTY = 37;
193 const T_IF = 38;
194 const T_ENDIF = 39;
195 const T_ELSE = 40;
196 const T_IFCHANGED = 41;
197 const T_ENDIFCHANGED = 42;
198 const T_BLOCK = 43;
199 const T_END_BLOCK = 44;
200 const T_FILTER = 45;
201 const T_END_FILTER = 46;
202 const T_REGROUP = 47;
203 const T_BY = 48;
204 const T_PIPE = 49;
205 const T_COLON = 50;
206 const T_NUMERIC = 51;
207 const T_STRING_SINGLE_INIT = 52;
208 const T_STRING_SINGLE_END = 53;
209 const T_STRING_DOUBLE_INIT = 54;
210 const T_STRING_DOUBLE_END = 55;
211 const T_STRING_CONTENT = 56;
212 const T_LPARENT = 57;
213 const T_RPARENT = 58;
214 const T_DOT = 59;
215 const T_ALPHA = 60;
216 const T_BRACKETS_OPEN = 61;
217 const T_BRACKETS_CLOSE = 62;
218 const YY_NO_ACTION = 260;
219 const YY_ACCEPT_ACTION = 259;
220 const YY_ERROR_ACTION = 258;
222 /* Next are that tables used to determine what action to take based on the
223 ** current state and lookahead token. These tables are used to implement
224 ** functions that take a state number and lookahead value and return an
225 ** action integer.
227 ** Suppose the action integer is N. Then the action is determined as
228 ** follows
230 ** 0 <= N < self::YYNSTATE Shift N. That is,
231 ** push the lookahead
232 ** token onto the stack
233 ** and goto state N.
235 ** self::YYNSTATE <= N < self::YYNSTATE+self::YYNRULE Reduce by rule N-YYNSTATE.
237 ** N == self::YYNSTATE+self::YYNRULE A syntax error has occurred.
239 ** N == self::YYNSTATE+self::YYNRULE+1 The parser accepts its
240 ** input. (and concludes parsing)
242 ** N == self::YYNSTATE+self::YYNRULE+2 No such action. Denotes unused
243 ** slots in the yy_action[] table.
245 ** The action table is constructed as a single large static array $yy_action.
246 ** Given state S and lookahead X, the action is computed as
248 ** self::$yy_action[self::$yy_shift_ofst[S] + X ]
250 ** If the index value self::$yy_shift_ofst[S]+X is out of range or if the value
251 ** self::$yy_lookahead[self::$yy_shift_ofst[S]+X] is not equal to X or if
252 ** self::$yy_shift_ofst[S] is equal to self::YY_SHIFT_USE_DFLT, it means that
253 ** the action is not in the table and that self::$yy_default[S] should be used instead.
255 ** The formula above is for computing the action when the lookahead is
256 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
257 ** a reduce action) then the static $yy_reduce_ofst array is used in place of
258 ** the static $yy_shift_ofst array and self::YY_REDUCE_USE_DFLT is used in place of
259 ** self::YY_SHIFT_USE_DFLT.
261 ** The following are the tables generated in this section:
263 ** self::$yy_action A single table containing all actions.
264 ** self::$yy_lookahead A table containing the lookahead for each entry in
265 ** yy_action. Used to detect hash collisions.
266 ** self::$yy_shift_ofst For each state, the offset into self::$yy_action for
267 ** shifting terminals.
268 ** self::$yy_reduce_ofst For each state, the offset into self::$yy_action for
269 ** shifting non-terminals after a reduce.
270 ** self::$yy_default Default action for each state.
272 const YY_SZ_ACTTAB = 634;
273 static public $yy_action = array(
274 /* 0 */ 21, 22, 17, 17, 17, 17, 17, 17, 17, 20,
275 /* 10 */ 20, 19, 19, 19, 21, 22, 17, 17, 17, 17,
276 /* 20 */ 17, 17, 17, 20, 20, 19, 19, 19, 30, 31,
277 /* 30 */ 28, 103, 259, 47, 70, 24, 190, 124, 122, 59,
278 /* 40 */ 32, 61, 19, 19, 19, 23, 138, 116, 25, 129,
279 /* 50 */ 56, 105, 34, 187, 36, 167, 142, 30, 166, 28,
280 /* 60 */ 103, 92, 104, 27, 24, 177, 124, 163, 59, 52,
281 /* 70 */ 61, 149, 12, 149, 23, 38, 130, 25, 111, 56,
282 /* 80 */ 183, 34, 30, 36, 28, 103, 71, 176, 109, 24,
283 /* 90 */ 35, 124, 122, 59, 32, 61, 58, 4, 73, 23,
284 /* 100 */ 127, 126, 25, 156, 56, 174, 34, 30, 36, 28,
285 /* 110 */ 103, 46, 176, 109, 24, 35, 124, 122, 59, 32,
286 /* 120 */ 61, 119, 3, 123, 23, 38, 122, 25, 32, 56,
287 /* 130 */ 185, 34, 30, 36, 28, 103, 81, 176, 109, 24,
288 /* 140 */ 35, 124, 122, 59, 32, 61, 133, 2, 135, 23,
289 /* 150 */ 137, 76, 25, 37, 56, 181, 34, 30, 36, 28,
290 /* 160 */ 103, 180, 176, 109, 24, 35, 124, 122, 59, 32,
291 /* 170 */ 61, 118, 140, 122, 23, 32, 14, 25, 38, 56,
292 /* 180 */ 104, 34, 108, 36, 69, 163, 30, 54, 28, 103,
293 /* 190 */ 80, 176, 109, 24, 35, 124, 67, 59, 148, 61,
294 /* 200 */ 132, 6, 122, 23, 32, 92, 25, 68, 56, 179,
295 /* 210 */ 34, 30, 36, 28, 103, 154, 176, 109, 24, 35,
296 /* 220 */ 124, 158, 59, 38, 61, 164, 166, 122, 23, 32,
297 /* 230 */ 77, 25, 110, 56, 102, 34, 30, 36, 28, 103,
298 /* 240 */ 157, 178, 125, 24, 92, 124, 159, 59, 177, 61,
299 /* 250 */ 104, 15, 38, 23, 189, 163, 25, 75, 56, 72,
300 /* 260 */ 34, 30, 36, 28, 103, 145, 176, 109, 24, 35,
301 /* 270 */ 124, 131, 59, 191, 61, 173, 115, 115, 23, 172,
302 /* 280 */ 98, 25, 121, 56, 175, 34, 30, 36, 28, 103,
303 /* 290 */ 92, 104, 170, 24, 177, 124, 163, 59, 149, 61,
304 /* 300 */ 149, 8, 62, 23, 57, 38, 25, 134, 56, 139,
305 /* 310 */ 34, 30, 36, 28, 103, 171, 176, 109, 24, 35,
306 /* 320 */ 124, 168, 59, 74, 61, 120, 7, 95, 23, 136,
307 /* 330 */ 156, 25, 122, 56, 32, 34, 30, 36, 28, 103,
308 /* 340 */ 106, 176, 109, 24, 35, 124, 90, 59, 112, 61,
309 /* 350 */ 92, 161, 94, 23, 177, 88, 25, 89, 56, 87,
310 /* 360 */ 34, 99, 36, 41, 22, 17, 17, 17, 17, 17,
311 /* 370 */ 17, 17, 20, 20, 19, 19, 19, 165, 30, 100,
312 /* 380 */ 28, 103, 96, 182, 93, 24, 91, 124, 42, 59,
313 /* 390 */ 153, 61, 104, 9, 107, 23, 55, 163, 25, 43,
314 /* 400 */ 56, 51, 34, 30, 36, 28, 103, 40, 176, 109,
315 /* 410 */ 24, 35, 124, 39, 59, 49, 61, 44, 78, 45,
316 /* 420 */ 23, 128, 153, 25, 149, 56, 149, 34, 50, 36,
317 /* 430 */ 17, 17, 17, 17, 17, 17, 17, 20, 20, 19,
318 /* 440 */ 19, 19, 30, 48, 28, 103, 53, 162, 66, 24,
319 /* 450 */ 65, 124, 153, 59, 153, 61, 156, 79, 153, 23,
320 /* 460 */ 153, 153, 25, 149, 56, 149, 34, 153, 36, 160,
321 /* 470 */ 153, 29, 114, 147, 146, 150, 151, 155, 153, 152,
322 /* 480 */ 153, 153, 188, 153, 153, 184, 162, 66, 153, 65,
323 /* 490 */ 153, 149, 63, 149, 13, 156, 169, 187, 149, 29,
324 /* 500 */ 149, 153, 149, 64, 149, 153, 104, 26, 153, 176,
325 /* 510 */ 109, 163, 35, 153, 162, 66, 149, 65, 149, 101,
326 /* 520 */ 1, 141, 66, 156, 65, 162, 66, 18, 65, 92,
327 /* 530 */ 156, 153, 153, 177, 156, 176, 109, 117, 35, 162,
328 /* 540 */ 66, 153, 65, 117, 153, 153, 153, 92, 156, 153,
329 /* 550 */ 84, 177, 144, 92, 117, 153, 86, 177, 144, 153,
330 /* 560 */ 117, 153, 10, 153, 92, 153, 153, 97, 177, 144,
331 /* 570 */ 92, 117, 153, 83, 177, 144, 16, 176, 109, 153,
332 /* 580 */ 35, 92, 33, 117, 82, 177, 144, 153, 153, 153,
333 /* 590 */ 117, 176, 109, 92, 35, 5, 85, 177, 144, 11,
334 /* 600 */ 92, 153, 153, 143, 177, 144, 153, 113, 60, 186,
335 /* 610 */ 176, 109, 153, 35, 176, 109, 104, 35, 104, 153,
336 /* 620 */ 153, 163, 153, 163, 153, 153, 153, 153, 153, 153,
337 /* 630 */ 153, 122, 153, 32,
339 static public $yy_lookahead = array(
340 /* 0 */ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
341 /* 10 */ 12, 13, 14, 15, 2, 3, 4, 5, 6, 7,
342 /* 20 */ 8, 9, 10, 11, 12, 13, 14, 15, 21, 50,
343 /* 30 */ 23, 24, 64, 65, 22, 28, 22, 30, 59, 32,
344 /* 40 */ 61, 34, 13, 14, 15, 38, 20, 40, 41, 42,
345 /* 50 */ 43, 68, 45, 69, 47, 53, 58, 21, 56, 23,
346 /* 60 */ 24, 78, 78, 79, 28, 82, 30, 83, 32, 65,
347 /* 70 */ 34, 28, 1, 30, 38, 49, 40, 41, 42, 43,
348 /* 80 */ 22, 45, 21, 47, 23, 24, 22, 16, 17, 28,
349 /* 90 */ 19, 30, 59, 32, 61, 34, 29, 1, 22, 38,
350 /* 100 */ 39, 40, 41, 60, 43, 22, 45, 21, 47, 23,
351 /* 110 */ 24, 65, 16, 17, 28, 19, 30, 59, 32, 61,
352 /* 120 */ 34, 35, 1, 37, 38, 49, 59, 41, 61, 43,
353 /* 130 */ 22, 45, 21, 47, 23, 24, 22, 16, 17, 28,
354 /* 140 */ 19, 30, 59, 32, 61, 34, 35, 1, 37, 38,
355 /* 150 */ 22, 22, 41, 10, 43, 22, 45, 21, 47, 23,
356 /* 160 */ 24, 22, 16, 17, 28, 19, 30, 59, 32, 61,
357 /* 170 */ 34, 69, 22, 59, 38, 61, 1, 41, 49, 43,
358 /* 180 */ 78, 45, 46, 47, 22, 83, 21, 65, 23, 24,
359 /* 190 */ 22, 16, 17, 28, 19, 30, 22, 32, 22, 34,
360 /* 200 */ 35, 1, 59, 38, 61, 78, 41, 22, 43, 82,
361 /* 210 */ 45, 21, 47, 23, 24, 22, 16, 17, 28, 19,
362 /* 220 */ 30, 60, 32, 49, 34, 55, 56, 59, 38, 61,
363 /* 230 */ 22, 41, 42, 43, 68, 45, 21, 47, 23, 24,
364 /* 240 */ 62, 69, 27, 28, 78, 30, 22, 32, 82, 34,
365 /* 250 */ 78, 1, 49, 38, 22, 83, 41, 22, 43, 22,
366 /* 260 */ 45, 21, 47, 23, 24, 22, 16, 17, 28, 19,
367 /* 270 */ 30, 31, 32, 18, 34, 22, 25, 26, 38, 22,
368 /* 280 */ 68, 41, 69, 43, 22, 45, 21, 47, 23, 24,
369 /* 290 */ 78, 78, 22, 28, 82, 30, 83, 32, 28, 34,
370 /* 300 */ 30, 1, 29, 38, 48, 49, 41, 42, 43, 22,
371 /* 310 */ 45, 21, 47, 23, 24, 22, 16, 17, 28, 19,
372 /* 320 */ 30, 22, 32, 22, 34, 35, 1, 78, 38, 22,
373 /* 330 */ 60, 41, 59, 43, 61, 45, 21, 47, 23, 24,
374 /* 340 */ 68, 16, 17, 28, 19, 30, 78, 32, 33, 34,
375 /* 350 */ 78, 66, 78, 38, 82, 78, 41, 78, 43, 78,
376 /* 360 */ 45, 78, 47, 65, 3, 4, 5, 6, 7, 8,
377 /* 370 */ 9, 10, 11, 12, 13, 14, 15, 56, 21, 84,
378 /* 380 */ 23, 24, 78, 69, 78, 28, 78, 30, 65, 32,
379 /* 390 */ 85, 34, 78, 1, 84, 38, 65, 83, 41, 65,
380 /* 400 */ 43, 44, 45, 21, 47, 23, 24, 65, 16, 17,
381 /* 410 */ 28, 19, 30, 65, 32, 65, 34, 65, 22, 65,
382 /* 420 */ 38, 39, 85, 41, 28, 43, 30, 45, 65, 47,
383 /* 430 */ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
384 /* 440 */ 14, 15, 21, 65, 23, 24, 65, 51, 52, 28,
385 /* 450 */ 54, 30, 85, 32, 85, 34, 60, 22, 85, 38,
386 /* 460 */ 85, 85, 41, 28, 43, 30, 45, 85, 47, 67,
387 /* 470 */ 85, 36, 70, 71, 72, 73, 74, 75, 76, 77,
388 /* 480 */ 85, 85, 80, 85, 85, 22, 51, 52, 85, 54,
389 /* 490 */ 85, 28, 29, 30, 1, 60, 22, 69, 28, 36,
390 /* 500 */ 30, 85, 28, 29, 30, 85, 78, 79, 85, 16,
391 /* 510 */ 17, 83, 19, 85, 51, 52, 28, 54, 30, 68,
392 /* 520 */ 1, 51, 52, 60, 54, 51, 52, 57, 54, 78,
393 /* 530 */ 60, 85, 85, 82, 60, 16, 17, 68, 19, 51,
394 /* 540 */ 52, 85, 54, 68, 85, 85, 85, 78, 60, 85,
395 /* 550 */ 81, 82, 83, 78, 68, 85, 81, 82, 83, 85,
396 /* 560 */ 68, 85, 1, 85, 78, 85, 85, 81, 82, 83,
397 /* 570 */ 78, 68, 85, 81, 82, 83, 1, 16, 17, 85,
398 /* 580 */ 19, 78, 10, 68, 81, 82, 83, 85, 85, 85,
399 /* 590 */ 68, 16, 17, 78, 19, 1, 81, 82, 83, 1,
400 /* 600 */ 78, 85, 85, 81, 82, 83, 85, 69, 36, 69,
401 /* 610 */ 16, 17, 85, 19, 16, 17, 78, 19, 78, 85,
402 /* 620 */ 85, 83, 85, 83, 85, 85, 85, 85, 85, 85,
403 /* 630 */ 85, 59, 85, 61,
405 const YY_SHIFT_USE_DFLT = -22;
406 const YY_SHIFT_MAX = 135;
407 static public $yy_shift_ofst = array(
408 /* 0 */ -22, 111, 86, 61, 36, 7, 315, 382, 240, 136,
409 /* 10 */ 190, 265, 290, 357, 215, 165, 421, 470, 470, 470,
410 /* 20 */ 470, 470, 470, 470, 474, 396, 463, 435, 488, 488,
411 /* 30 */ 488, 488, 488, 43, 43, 43, 43, 43, 43, 300,
412 /* 40 */ 250, 519, 71, 325, 594, 561, 493, 575, 598, 392,
413 /* 50 */ 121, 270, 200, 175, 96, 146, 43, 43, 43, 43,
414 /* 60 */ 43, 43, 43, 43, 43, 321, 321, -22, -22, -22,
415 /* 70 */ -22, -22, -22, -22, -22, -22, -22, -22, -22, -22,
416 /* 80 */ -22, -22, 12, -2, 361, 426, 426, 572, 273, 168,
417 /* 90 */ 143, 83, -21, 108, 114, 67, 58, 29, 129, 33,
418 /* 100 */ 170, 256, 26, 251, 33, 174, 76, 2, 262, 255,
419 /* 110 */ 293, 287, 232, 193, 176, 162, 208, 203, 178, 150,
420 /* 120 */ 307, 224, 161, 185, 235, 299, 237, 243, 253, 257,
421 /* 130 */ 301, 14, 139, 133, 128, 64,
423 const YY_REDUCE_USE_DFLT = -33;
424 const YY_REDUCE_MAX = 81;
425 static public $yy_reduce_ofst = array(
426 /* 0 */ -32, 402, 402, 402, 402, 402, 402, 402, 402, 402,
427 /* 10 */ 402, 402, 402, 402, 402, 402, 402, 475, 492, 522,
428 /* 20 */ 486, 469, 515, 503, 428, -16, 314, 314, 538, 540,
429 /* 30 */ 213, 172, 102, -17, 212, 166, 451, 272, 127, 285,
430 /* 40 */ 285, 285, 285, 285, 285, 285, 285, 285, 285, 285,
431 /* 50 */ 285, 308, 285, 285, 285, 285, 279, 277, 274, 249,
432 /* 60 */ 268, 281, 283, 304, 306, 295, 310, 298, 323, 381,
433 /* 70 */ 363, 342, 334, 331, 378, 348, 350, 354, 352, 122,
434 /* 80 */ 46, 4,
436 static public $yyExpectedTokens = array(
437 /* 0 */ array(),
438 /* 1 */ array(21, 23, 24, 28, 30, 32, 34, 35, 37, 38, 41, 43, 45, 47, ),
439 /* 2 */ array(21, 23, 24, 28, 30, 32, 34, 35, 37, 38, 41, 43, 45, 47, ),
440 /* 3 */ array(21, 23, 24, 28, 30, 32, 34, 38, 39, 40, 41, 43, 45, 47, ),
441 /* 4 */ array(21, 23, 24, 28, 30, 32, 34, 38, 40, 41, 42, 43, 45, 47, ),
442 /* 5 */ array(21, 23, 24, 28, 30, 32, 34, 38, 40, 41, 42, 43, 45, 47, ),
443 /* 6 */ array(21, 23, 24, 28, 30, 32, 33, 34, 38, 41, 43, 45, 47, ),
444 /* 7 */ array(21, 23, 24, 28, 30, 32, 34, 38, 39, 41, 43, 45, 47, ),
445 /* 8 */ array(21, 23, 24, 28, 30, 31, 32, 34, 38, 41, 43, 45, 47, ),
446 /* 9 */ array(21, 23, 24, 28, 30, 32, 34, 38, 41, 43, 45, 46, 47, ),
447 /* 10 */ array(21, 23, 24, 28, 30, 32, 34, 38, 41, 42, 43, 45, 47, ),
448 /* 11 */ array(21, 23, 24, 28, 30, 32, 34, 38, 41, 42, 43, 45, 47, ),
449 /* 12 */ array(21, 23, 24, 28, 30, 32, 34, 35, 38, 41, 43, 45, 47, ),
450 /* 13 */ array(21, 23, 24, 28, 30, 32, 34, 38, 41, 43, 44, 45, 47, ),
451 /* 14 */ array(21, 23, 24, 27, 28, 30, 32, 34, 38, 41, 43, 45, 47, ),
452 /* 15 */ array(21, 23, 24, 28, 30, 32, 34, 35, 38, 41, 43, 45, 47, ),
453 /* 16 */ array(21, 23, 24, 28, 30, 32, 34, 38, 41, 43, 45, 47, ),
454 /* 17 */ array(28, 30, 51, 52, 54, 57, 60, ),
455 /* 18 */ array(28, 30, 51, 52, 54, 57, 60, ),
456 /* 19 */ array(28, 30, 51, 52, 54, 57, 60, ),
457 /* 20 */ array(28, 30, 51, 52, 54, 57, 60, ),
458 /* 21 */ array(28, 30, 51, 52, 54, 57, 60, ),
459 /* 22 */ array(28, 30, 51, 52, 54, 57, 60, ),
460 /* 23 */ array(28, 30, 51, 52, 54, 57, 60, ),
461 /* 24 */ array(22, 28, 29, 30, 51, 52, 54, 60, ),
462 /* 25 */ array(22, 28, 30, 51, 52, 54, 60, ),
463 /* 26 */ array(22, 28, 29, 30, 36, 51, 52, 54, 60, ),
464 /* 27 */ array(22, 28, 30, 36, 51, 52, 54, 60, ),
465 /* 28 */ array(28, 30, 51, 52, 54, 60, ),
466 /* 29 */ array(28, 30, 51, 52, 54, 60, ),
467 /* 30 */ array(28, 30, 51, 52, 54, 60, ),
468 /* 31 */ array(28, 30, 51, 52, 54, 60, ),
469 /* 32 */ array(28, 30, 51, 52, 54, 60, ),
470 /* 33 */ array(28, 30, 60, ),
471 /* 34 */ array(28, 30, 60, ),
472 /* 35 */ array(28, 30, 60, ),
473 /* 36 */ array(28, 30, 60, ),
474 /* 37 */ array(28, 30, 60, ),
475 /* 38 */ array(28, 30, 60, ),
476 /* 39 */ array(1, 16, 17, 19, ),
477 /* 40 */ array(1, 16, 17, 19, ),
478 /* 41 */ array(1, 16, 17, 19, ),
479 /* 42 */ array(1, 16, 17, 19, ),
480 /* 43 */ array(1, 16, 17, 19, ),
481 /* 44 */ array(1, 16, 17, 19, ),
482 /* 45 */ array(1, 16, 17, 19, ),
483 /* 46 */ array(1, 16, 17, 19, ),
484 /* 47 */ array(1, 16, 17, 19, ),
485 /* 48 */ array(1, 16, 17, 19, ),
486 /* 49 */ array(1, 16, 17, 19, ),
487 /* 50 */ array(1, 16, 17, 19, ),
488 /* 51 */ array(22, 28, 30, 60, ),
489 /* 52 */ array(1, 16, 17, 19, ),
490 /* 53 */ array(1, 16, 17, 19, ),
491 /* 54 */ array(1, 16, 17, 19, ),
492 /* 55 */ array(1, 16, 17, 19, ),
493 /* 56 */ array(28, 30, 60, ),
494 /* 57 */ array(28, 30, 60, ),
495 /* 58 */ array(28, 30, 60, ),
496 /* 59 */ array(28, 30, 60, ),
497 /* 60 */ array(28, 30, 60, ),
498 /* 61 */ array(28, 30, 60, ),
499 /* 62 */ array(28, 30, 60, ),
500 /* 63 */ array(28, 30, 60, ),
501 /* 64 */ array(28, 30, 60, ),
502 /* 65 */ array(56, ),
503 /* 66 */ array(56, ),
504 /* 67 */ array(),
505 /* 68 */ array(),
506 /* 69 */ array(),
507 /* 70 */ array(),
508 /* 71 */ array(),
509 /* 72 */ array(),
510 /* 73 */ array(),
511 /* 74 */ array(),
512 /* 75 */ array(),
513 /* 76 */ array(),
514 /* 77 */ array(),
515 /* 78 */ array(),
516 /* 79 */ array(),
517 /* 80 */ array(),
518 /* 81 */ array(),
519 /* 82 */ array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 22, ),
520 /* 83 */ array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 58, ),
521 /* 84 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ),
522 /* 85 */ array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ),
523 /* 86 */ array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ),
524 /* 87 */ array(10, 36, 59, 61, ),
525 /* 88 */ array(29, 59, 61, ),
526 /* 89 */ array(22, 59, 61, ),
527 /* 90 */ array(10, 59, 61, ),
528 /* 91 */ array(22, 59, 61, ),
529 /* 92 */ array(50, 59, 61, ),
530 /* 93 */ array(22, 59, 61, ),
531 /* 94 */ array(22, 59, 61, ),
532 /* 95 */ array(29, 59, 61, ),
533 /* 96 */ array(22, 59, 61, ),
534 /* 97 */ array(13, 14, 15, ),
535 /* 98 */ array(22, 49, ),
536 /* 99 */ array(59, 61, ),
537 /* 100 */ array(55, 56, ),
538 /* 101 */ array(48, 49, ),
539 /* 102 */ array(20, 49, ),
540 /* 103 */ array(25, 26, ),
541 /* 104 */ array(59, 61, ),
542 /* 105 */ array(22, 49, ),
543 /* 106 */ array(22, 49, ),
544 /* 107 */ array(53, 56, ),
545 /* 108 */ array(22, ),
546 /* 109 */ array(18, ),
547 /* 110 */ array(22, ),
548 /* 111 */ array(22, ),
549 /* 112 */ array(22, ),
550 /* 113 */ array(22, ),
551 /* 114 */ array(22, ),
552 /* 115 */ array(22, ),
553 /* 116 */ array(22, ),
554 /* 117 */ array(49, ),
555 /* 118 */ array(62, ),
556 /* 119 */ array(22, ),
557 /* 120 */ array(22, ),
558 /* 121 */ array(22, ),
559 /* 122 */ array(60, ),
560 /* 123 */ array(22, ),
561 /* 124 */ array(22, ),
562 /* 125 */ array(22, ),
563 /* 126 */ array(22, ),
564 /* 127 */ array(22, ),
565 /* 128 */ array(22, ),
566 /* 129 */ array(22, ),
567 /* 130 */ array(22, ),
568 /* 131 */ array(22, ),
569 /* 132 */ array(22, ),
570 /* 133 */ array(22, ),
571 /* 134 */ array(22, ),
572 /* 135 */ array(22, ),
573 /* 136 */ array(),
574 /* 137 */ array(),
575 /* 138 */ array(),
576 /* 139 */ array(),
577 /* 140 */ array(),
578 /* 141 */ array(),
579 /* 142 */ array(),
580 /* 143 */ array(),
581 /* 144 */ array(),
582 /* 145 */ array(),
583 /* 146 */ array(),
584 /* 147 */ array(),
585 /* 148 */ array(),
586 /* 149 */ array(),
587 /* 150 */ array(),
588 /* 151 */ array(),
589 /* 152 */ array(),
590 /* 153 */ array(),
591 /* 154 */ array(),
592 /* 155 */ array(),
593 /* 156 */ array(),
594 /* 157 */ array(),
595 /* 158 */ array(),
596 /* 159 */ array(),
597 /* 160 */ array(),
598 /* 161 */ array(),
599 /* 162 */ array(),
600 /* 163 */ array(),
601 /* 164 */ array(),
602 /* 165 */ array(),
603 /* 166 */ array(),
604 /* 167 */ array(),
605 /* 168 */ array(),
606 /* 169 */ array(),
607 /* 170 */ array(),
608 /* 171 */ array(),
609 /* 172 */ array(),
610 /* 173 */ array(),
611 /* 174 */ array(),
612 /* 175 */ array(),
613 /* 176 */ array(),
614 /* 177 */ array(),
615 /* 178 */ array(),
616 /* 179 */ array(),
617 /* 180 */ array(),
618 /* 181 */ array(),
619 /* 182 */ array(),
620 /* 183 */ array(),
621 /* 184 */ array(),
622 /* 185 */ array(),
623 /* 186 */ array(),
624 /* 187 */ array(),
625 /* 188 */ array(),
626 /* 189 */ array(),
627 /* 190 */ array(),
628 /* 191 */ array(),
630 static public $yy_default = array(
631 /* 0 */ 194, 258, 258, 258, 258, 258, 258, 258, 258, 258,
632 /* 10 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
633 /* 20 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
634 /* 30 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
635 /* 40 */ 258, 258, 258, 258, 258, 258, 258, 192, 258, 258,
636 /* 50 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
637 /* 60 */ 258, 258, 258, 258, 258, 258, 258, 194, 194, 194,
638 /* 70 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
639 /* 80 */ 194, 194, 258, 258, 245, 246, 248, 258, 258, 258,
640 /* 90 */ 258, 258, 234, 258, 258, 258, 258, 247, 258, 230,
641 /* 100 */ 258, 258, 258, 258, 238, 258, 258, 258, 258, 258,
642 /* 110 */ 258, 258, 258, 258, 258, 258, 258, 250, 258, 258,
643 /* 120 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258,
644 /* 130 */ 258, 258, 258, 258, 258, 258, 220, 226, 198, 224,
645 /* 140 */ 218, 253, 251, 249, 252, 221, 202, 201, 200, 257,
646 /* 150 */ 203, 204, 208, 207, 206, 205, 256, 255, 254, 199,
647 /* 160 */ 195, 193, 239, 240, 242, 244, 243, 241, 209, 210,
648 /* 170 */ 227, 225, 223, 222, 228, 229, 196, 232, 233, 231,
649 /* 180 */ 219, 217, 235, 213, 212, 211, 236, 237, 216, 215,
650 /* 190 */ 214, 197,
652 /* The next thing included is series of defines which control
653 ** various aspects of the generated parser.
654 ** self::YYNOCODE is a number which corresponds
655 ** to no legal terminal or nonterminal number. This
656 ** number is used to fill in empty slots of the hash
657 ** table.
658 ** self::YYFALLBACK If defined, this indicates that one or more tokens
659 ** have fall-back values which should be used if the
660 ** original value of the token will not parse.
661 ** self::YYSTACKDEPTH is the maximum depth of the parser's stack.
662 ** self::YYNSTATE the combined number of states.
663 ** self::YYNRULE the number of rules in the grammar
664 ** self::YYERRORSYMBOL is the code number of the error symbol. If not
665 ** defined, then do no error processing.
667 const YYNOCODE = 86;
668 const YYSTACKDEPTH = 100;
669 const YYNSTATE = 192;
670 const YYNRULE = 66;
671 const YYERRORSYMBOL = 63;
672 const YYERRSYMDT = 'yy0';
673 const YYFALLBACK = 0;
674 /** The next table maps tokens into fallback tokens. If a construct
675 * like the following:
677 * %fallback ID X Y Z.
679 * appears in the grammer, then ID becomes a fallback token for X, Y,
680 * and Z. Whenever one of the tokens X, Y, or Z is input to the parser
681 * but it does not parse, the type of the token is changed to ID and
682 * the parse is retried before an error is thrown.
684 static public $yyFallback = array(
687 * Turn parser tracing on by giving a stream to which to write the trace
688 * and a prompt to preface each trace message. Tracing is turned off
689 * by making either argument NULL
691 * Inputs:
693 * - A stream resource to which trace output should be written.
694 * If NULL, then tracing is turned off.
695 * - A prefix string written at the beginning of every
696 * line of trace output. If NULL, then tracing is
697 * turned off.
699 * Outputs:
701 * - None.
702 * @param resource
703 * @param string
705 static function Trace($TraceFILE, $zTracePrompt)
707 if (!$TraceFILE) {
708 $zTracePrompt = 0;
709 } elseif (!$zTracePrompt) {
710 $TraceFILE = 0;
712 self::$yyTraceFILE = $TraceFILE;
713 self::$yyTracePrompt = $zTracePrompt;
717 * Output debug information to output (php://output stream)
719 static function PrintTrace()
721 self::$yyTraceFILE = fopen('php://output', 'w');
722 self::$yyTracePrompt = '';
726 * @var resource|0
728 static public $yyTraceFILE;
730 * String to prepend to debug output
731 * @var string|0
733 static public $yyTracePrompt;
735 * @var int
737 public $yyidx; /* Index of top element in stack */
739 * @var int
741 public $yyerrcnt; /* Shifts left before out of the error */
743 * @var array
745 public $yystack = array(); /* The parser's stack */
748 * For tracing shifts, the names of all terminals and nonterminals
749 * are required. The following table supplies these names
750 * @var array
752 static public $yyTokenName = array(
753 '$', 'T_OPEN_TAG', 'T_AND', 'T_OR',
754 'T_EQ', 'T_NE', 'T_GT', 'T_GE',
755 'T_LT', 'T_LE', 'T_IN', 'T_PLUS',
756 'T_MINUS', 'T_TIMES', 'T_DIV', 'T_MOD',
757 'T_HTML', 'T_COMMENT_OPEN', 'T_COMMENT', 'T_PRINT_OPEN',
758 'T_PRINT_CLOSE', 'T_EXTENDS', 'T_CLOSE_TAG', 'T_INCLUDE',
759 'T_AUTOESCAPE', 'T_OFF', 'T_ON', 'T_END_AUTOESCAPE',
760 'T_CUSTOM_TAG', 'T_AS', 'T_CUSTOM_BLOCK', 'T_CUSTOM_END',
761 'T_WITH', 'T_ENDWITH', 'T_FOR', 'T_CLOSEFOR',
762 'T_COMMA', 'T_EMPTY', 'T_IF', 'T_ENDIF',
763 'T_ELSE', 'T_IFCHANGED', 'T_ENDIFCHANGED', 'T_BLOCK',
764 'T_END_BLOCK', 'T_FILTER', 'T_END_FILTER', 'T_REGROUP',
765 'T_BY', 'T_PIPE', 'T_COLON', 'T_NUMERIC',
766 'T_STRING_SINGLE_INIT', 'T_STRING_SINGLE_END', 'T_STRING_DOUBLE_INIT', 'T_STRING_DOUBLE_END',
767 'T_STRING_CONTENT', 'T_LPARENT', 'T_RPARENT', 'T_DOT',
768 'T_ALPHA', 'T_BRACKETS_OPEN', 'T_BRACKETS_CLOSE', 'error',
769 'start', 'body', 'code', 'stmts',
770 'filtered_var', 'var_or_string', 'stmt', 'for_stmt',
771 'ifchanged_stmt', 'block_stmt', 'filter_stmt', 'if_stmt',
772 'custom_tag', 'alias', 'varname', 'var_list',
773 'regroup', 'expr', 'varname_args', 'string',
774 's_content',
778 * For tracing reduce actions, the names of all rules are required.
779 * @var array
781 static public $yyRuleName = array(
782 /* 0 */ "start ::= body",
783 /* 1 */ "body ::= body code",
784 /* 2 */ "body ::=",
785 /* 3 */ "code ::= T_OPEN_TAG stmts",
786 /* 4 */ "code ::= T_HTML",
787 /* 5 */ "code ::= T_COMMENT_OPEN T_COMMENT",
788 /* 6 */ "code ::= T_PRINT_OPEN filtered_var T_PRINT_CLOSE",
789 /* 7 */ "stmts ::= T_EXTENDS var_or_string T_CLOSE_TAG",
790 /* 8 */ "stmts ::= stmt T_CLOSE_TAG",
791 /* 9 */ "stmts ::= for_stmt",
792 /* 10 */ "stmts ::= ifchanged_stmt",
793 /* 11 */ "stmts ::= block_stmt",
794 /* 12 */ "stmts ::= filter_stmt",
795 /* 13 */ "stmts ::= if_stmt",
796 /* 14 */ "stmts ::= T_INCLUDE var_or_string T_CLOSE_TAG",
797 /* 15 */ "stmts ::= custom_tag",
798 /* 16 */ "stmts ::= alias",
799 /* 17 */ "stmts ::= T_AUTOESCAPE T_OFF|T_ON T_CLOSE_TAG body T_OPEN_TAG T_END_AUTOESCAPE T_CLOSE_TAG",
800 /* 18 */ "custom_tag ::= T_CUSTOM_TAG T_CLOSE_TAG",
801 /* 19 */ "custom_tag ::= T_CUSTOM_TAG T_AS varname T_CLOSE_TAG",
802 /* 20 */ "custom_tag ::= T_CUSTOM_TAG var_list T_CLOSE_TAG",
803 /* 21 */ "custom_tag ::= T_CUSTOM_TAG var_list T_AS varname T_CLOSE_TAG",
804 /* 22 */ "custom_tag ::= T_CUSTOM_BLOCK T_CLOSE_TAG body T_OPEN_TAG T_CUSTOM_END T_CLOSE_TAG",
805 /* 23 */ "alias ::= T_WITH varname T_AS varname T_CLOSE_TAG body T_OPEN_TAG T_ENDWITH T_CLOSE_TAG",
806 /* 24 */ "stmt ::= regroup",
807 /* 25 */ "for_stmt ::= T_FOR varname T_IN filtered_var T_CLOSE_TAG body T_OPEN_TAG T_CLOSEFOR T_CLOSE_TAG",
808 /* 26 */ "for_stmt ::= T_FOR varname T_COMMA varname T_IN filtered_var T_CLOSE_TAG body T_OPEN_TAG T_CLOSEFOR T_CLOSE_TAG",
809 /* 27 */ "for_stmt ::= T_FOR varname T_IN filtered_var T_CLOSE_TAG body T_OPEN_TAG T_EMPTY T_CLOSE_TAG body T_OPEN_TAG T_CLOSEFOR T_CLOSE_TAG",
810 /* 28 */ "for_stmt ::= T_FOR varname T_COMMA varname T_IN filtered_var T_CLOSE_TAG body T_OPEN_TAG T_EMPTY T_CLOSE_TAG body T_OPEN_TAG T_CLOSEFOR T_CLOSE_TAG",
811 /* 29 */ "if_stmt ::= T_IF expr T_CLOSE_TAG body T_OPEN_TAG T_ENDIF T_CLOSE_TAG",
812 /* 30 */ "if_stmt ::= T_IF expr T_CLOSE_TAG body T_OPEN_TAG T_ELSE T_CLOSE_TAG body T_OPEN_TAG T_ENDIF T_CLOSE_TAG",
813 /* 31 */ "ifchanged_stmt ::= T_IFCHANGED T_CLOSE_TAG body T_OPEN_TAG T_ENDIFCHANGED T_CLOSE_TAG",
814 /* 32 */ "ifchanged_stmt ::= T_IFCHANGED var_list T_CLOSE_TAG body T_OPEN_TAG T_ENDIFCHANGED T_CLOSE_TAG",
815 /* 33 */ "ifchanged_stmt ::= T_IFCHANGED T_CLOSE_TAG body T_OPEN_TAG T_ELSE T_CLOSE_TAG body T_OPEN_TAG T_ENDIFCHANGED T_CLOSE_TAG",
816 /* 34 */ "ifchanged_stmt ::= T_IFCHANGED var_list T_CLOSE_TAG body T_OPEN_TAG T_ELSE T_CLOSE_TAG body T_OPEN_TAG T_ENDIFCHANGED T_CLOSE_TAG",
817 /* 35 */ "block_stmt ::= T_BLOCK varname T_CLOSE_TAG body T_OPEN_TAG T_END_BLOCK T_CLOSE_TAG",
818 /* 36 */ "block_stmt ::= T_BLOCK varname T_CLOSE_TAG body T_OPEN_TAG T_END_BLOCK varname T_CLOSE_TAG",
819 /* 37 */ "filter_stmt ::= T_FILTER filtered_var T_CLOSE_TAG body T_OPEN_TAG T_END_FILTER T_CLOSE_TAG",
820 /* 38 */ "regroup ::= T_REGROUP filtered_var T_BY varname T_AS varname",
821 /* 39 */ "filtered_var ::= filtered_var T_PIPE varname_args",
822 /* 40 */ "filtered_var ::= varname_args",
823 /* 41 */ "varname_args ::= varname T_COLON var_or_string",
824 /* 42 */ "varname_args ::= varname",
825 /* 43 */ "var_list ::= var_list var_or_string",
826 /* 44 */ "var_list ::= var_list T_COMMA var_or_string",
827 /* 45 */ "var_list ::= var_or_string",
828 /* 46 */ "var_or_string ::= varname",
829 /* 47 */ "var_or_string ::= T_NUMERIC",
830 /* 48 */ "var_or_string ::= string",
831 /* 49 */ "string ::= T_STRING_SINGLE_INIT s_content T_STRING_SINGLE_END",
832 /* 50 */ "string ::= T_STRING_DOUBLE_INIT s_content T_STRING_DOUBLE_END",
833 /* 51 */ "s_content ::= s_content T_STRING_CONTENT",
834 /* 52 */ "s_content ::= T_STRING_CONTENT",
835 /* 53 */ "expr ::= expr T_AND expr",
836 /* 54 */ "expr ::= expr T_OR expr",
837 /* 55 */ "expr ::= expr T_PLUS|T_MINUS expr",
838 /* 56 */ "expr ::= expr T_EQ|T_NE|T_GT|T_GE|T_LT|T_LE|T_IN expr",
839 /* 57 */ "expr ::= expr T_TIMES|T_DIV|T_MOD expr",
840 /* 58 */ "expr ::= filtered_var",
841 /* 59 */ "expr ::= T_LPARENT expr T_RPARENT",
842 /* 60 */ "expr ::= string",
843 /* 61 */ "expr ::= T_NUMERIC",
844 /* 62 */ "varname ::= varname T_DOT T_ALPHA",
845 /* 63 */ "varname ::= varname T_BRACKETS_OPEN var_or_string T_BRACKETS_CLOSE",
846 /* 64 */ "varname ::= T_ALPHA",
847 /* 65 */ "varname ::= T_CUSTOM_TAG|T_CUSTOM_BLOCK",
851 * This function returns the symbolic name associated with a token
852 * value.
853 * @param int
854 * @return string
856 function tokenName($tokenType)
858 if ($tokenType === 0) {
859 return 'End of Input';
861 if ($tokenType > 0 && $tokenType < count(self::$yyTokenName)) {
862 return self::$yyTokenName[$tokenType];
863 } else {
864 return "Unknown";
869 * The following function deletes the value associated with a
870 * symbol. The symbol can be either a terminal or nonterminal.
871 * @param int the symbol code
872 * @param mixed the symbol's value
874 static function yy_destructor($yymajor, $yypminor)
876 switch ($yymajor) {
877 /* Here is inserted the actions which take place when a
878 ** terminal or non-terminal is destroyed. This can happen
879 ** when the symbol is popped from the stack during a
880 ** reduce or during error processing or when a parser is
881 ** being destroyed before it is finished parsing.
883 ** Note: during a reduce, the only symbols destroyed are those
884 ** which appear on the RHS of the rule, but which are not used
885 ** inside the C code.
887 default: break; /* If no destructor action specified: do nothing */
892 * Pop the parser's stack once.
894 * If there is a destructor routine associated with the token which
895 * is popped from the stack, then call it.
897 * Return the major token number for the symbol popped.
898 * @param Haanga_yyParser
899 * @return int
901 function yy_pop_parser_stack()
903 if (!count($this->yystack)) {
904 return;
906 $yytos = array_pop($this->yystack);
907 if (self::$yyTraceFILE && $this->yyidx >= 0) {
908 fwrite(self::$yyTraceFILE,
909 self::$yyTracePrompt . 'Popping ' . self::$yyTokenName[$yytos->major] .
910 "\n");
912 $yymajor = $yytos->major;
913 self::yy_destructor($yymajor, $yytos->minor);
914 $this->yyidx--;
915 return $yymajor;
919 * Deallocate and destroy a parser. Destructors are all called for
920 * all stack elements before shutting the parser down.
922 function __destruct()
924 while ($this->yyidx >= 0) {
925 $this->yy_pop_parser_stack();
927 if (is_resource(self::$yyTraceFILE)) {
928 fclose(self::$yyTraceFILE);
933 * Based on the current state and parser stack, get a list of all
934 * possible lookahead tokens
935 * @param int
936 * @return array
938 function yy_get_expected_tokens($token)
940 $state = $this->yystack[$this->yyidx]->stateno;
941 $expected = self::$yyExpectedTokens[$state];
942 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
943 return $expected;
945 $stack = $this->yystack;
946 $yyidx = $this->yyidx;
947 do {
948 $yyact = $this->yy_find_shift_action($token);
949 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
950 // reduce action
951 $done = 0;
952 do {
953 if ($done++ == 100) {
954 $this->yyidx = $yyidx;
955 $this->yystack = $stack;
956 // too much recursion prevents proper detection
957 // so give up
958 return array_unique($expected);
960 $yyruleno = $yyact - self::YYNSTATE;
961 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
962 $nextstate = $this->yy_find_reduce_action(
963 $this->yystack[$this->yyidx]->stateno,
964 self::$yyRuleInfo[$yyruleno]['lhs']);
965 if (isset(self::$yyExpectedTokens[$nextstate])) {
966 $expected += self::$yyExpectedTokens[$nextstate];
967 if (in_array($token,
968 self::$yyExpectedTokens[$nextstate], true)) {
969 $this->yyidx = $yyidx;
970 $this->yystack = $stack;
971 return array_unique($expected);
974 if ($nextstate < self::YYNSTATE) {
975 // we need to shift a non-terminal
976 $this->yyidx++;
977 $x = new Haanga_yyStackEntry;
978 $x->stateno = $nextstate;
979 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
980 $this->yystack[$this->yyidx] = $x;
981 continue 2;
982 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
983 $this->yyidx = $yyidx;
984 $this->yystack = $stack;
985 // the last token was just ignored, we can't accept
986 // by ignoring input, this is in essence ignoring a
987 // syntax error!
988 return array_unique($expected);
989 } elseif ($nextstate === self::YY_NO_ACTION) {
990 $this->yyidx = $yyidx;
991 $this->yystack = $stack;
992 // input accepted, but not shifted (I guess)
993 return $expected;
994 } else {
995 $yyact = $nextstate;
997 } while (true);
999 break;
1000 } while (true);
1001 return array_unique($expected);
1005 * Based on the parser state and current parser stack, determine whether
1006 * the lookahead token is possible.
1008 * The parser will convert the token value to an error token if not. This
1009 * catches some unusual edge cases where the parser would fail.
1010 * @param int
1011 * @return bool
1013 function yy_is_expected_token($token)
1015 if ($token === 0) {
1016 return true; // 0 is not part of this
1018 $state = $this->yystack[$this->yyidx]->stateno;
1019 if (in_array($token, self::$yyExpectedTokens[$state], true)) {
1020 return true;
1022 $stack = $this->yystack;
1023 $yyidx = $this->yyidx;
1024 do {
1025 $yyact = $this->yy_find_shift_action($token);
1026 if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
1027 // reduce action
1028 $done = 0;
1029 do {
1030 if ($done++ == 100) {
1031 $this->yyidx = $yyidx;
1032 $this->yystack = $stack;
1033 // too much recursion prevents proper detection
1034 // so give up
1035 return true;
1037 $yyruleno = $yyact - self::YYNSTATE;
1038 $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
1039 $nextstate = $this->yy_find_reduce_action(
1040 $this->yystack[$this->yyidx]->stateno,
1041 self::$yyRuleInfo[$yyruleno]['lhs']);
1042 if (isset(self::$yyExpectedTokens[$nextstate]) &&
1043 in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
1044 $this->yyidx = $yyidx;
1045 $this->yystack = $stack;
1046 return true;
1048 if ($nextstate < self::YYNSTATE) {
1049 // we need to shift a non-terminal
1050 $this->yyidx++;
1051 $x = new Haanga_yyStackEntry;
1052 $x->stateno = $nextstate;
1053 $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
1054 $this->yystack[$this->yyidx] = $x;
1055 continue 2;
1056 } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
1057 $this->yyidx = $yyidx;
1058 $this->yystack = $stack;
1059 if (!$token) {
1060 // end of input: this is valid
1061 return true;
1063 // the last token was just ignored, we can't accept
1064 // by ignoring input, this is in essence ignoring a
1065 // syntax error!
1066 return false;
1067 } elseif ($nextstate === self::YY_NO_ACTION) {
1068 $this->yyidx = $yyidx;
1069 $this->yystack = $stack;
1070 // input accepted, but not shifted (I guess)
1071 return true;
1072 } else {
1073 $yyact = $nextstate;
1075 } while (true);
1077 break;
1078 } while (true);
1079 $this->yyidx = $yyidx;
1080 $this->yystack = $stack;
1081 return true;
1085 * Find the appropriate action for a parser given the terminal
1086 * look-ahead token iLookAhead.
1088 * If the look-ahead token is YYNOCODE, then check to see if the action is
1089 * independent of the look-ahead. If it is, return the action, otherwise
1090 * return YY_NO_ACTION.
1091 * @param int The look-ahead token
1093 function yy_find_shift_action($iLookAhead)
1095 $stateno = $this->yystack[$this->yyidx]->stateno;
1097 /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */
1098 if (!isset(self::$yy_shift_ofst[$stateno])) {
1099 // no shift actions
1100 return self::$yy_default[$stateno];
1102 $i = self::$yy_shift_ofst[$stateno];
1103 if ($i === self::YY_SHIFT_USE_DFLT) {
1104 return self::$yy_default[$stateno];
1106 if ($iLookAhead == self::YYNOCODE) {
1107 return self::YY_NO_ACTION;
1109 $i += $iLookAhead;
1110 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
1111 self::$yy_lookahead[$i] != $iLookAhead) {
1112 if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
1113 && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
1114 if (self::$yyTraceFILE) {
1115 fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
1116 self::$yyTokenName[$iLookAhead] . " => " .
1117 self::$yyTokenName[$iFallback] . "\n");
1119 return $this->yy_find_shift_action($iFallback);
1121 return self::$yy_default[$stateno];
1122 } else {
1123 return self::$yy_action[$i];
1128 * Find the appropriate action for a parser given the non-terminal
1129 * look-ahead token $iLookAhead.
1131 * If the look-ahead token is self::YYNOCODE, then check to see if the action is
1132 * independent of the look-ahead. If it is, return the action, otherwise
1133 * return self::YY_NO_ACTION.
1134 * @param int Current state number
1135 * @param int The look-ahead token
1137 function yy_find_reduce_action($stateno, $iLookAhead)
1139 /* $stateno = $this->yystack[$this->yyidx]->stateno; */
1141 if (!isset(self::$yy_reduce_ofst[$stateno])) {
1142 return self::$yy_default[$stateno];
1144 $i = self::$yy_reduce_ofst[$stateno];
1145 if ($i == self::YY_REDUCE_USE_DFLT) {
1146 return self::$yy_default[$stateno];
1148 if ($iLookAhead == self::YYNOCODE) {
1149 return self::YY_NO_ACTION;
1151 $i += $iLookAhead;
1152 if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
1153 self::$yy_lookahead[$i] != $iLookAhead) {
1154 return self::$yy_default[$stateno];
1155 } else {
1156 return self::$yy_action[$i];
1161 * Perform a shift action.
1162 * @param int The new state to shift in
1163 * @param int The major token to shift in
1164 * @param mixed the minor token to shift in
1166 function yy_shift($yyNewState, $yyMajor, $yypMinor)
1168 $this->yyidx++;
1169 if ($this->yyidx >= self::YYSTACKDEPTH) {
1170 $this->yyidx--;
1171 if (self::$yyTraceFILE) {
1172 fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
1174 while ($this->yyidx >= 0) {
1175 $this->yy_pop_parser_stack();
1177 /* Here code is inserted which will execute if the parser
1178 ** stack ever overflows */
1179 return;
1181 $yytos = new Haanga_yyStackEntry;
1182 $yytos->stateno = $yyNewState;
1183 $yytos->major = $yyMajor;
1184 $yytos->minor = $yypMinor;
1185 array_push($this->yystack, $yytos);
1186 if (self::$yyTraceFILE && $this->yyidx > 0) {
1187 fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
1188 $yyNewState);
1189 fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
1190 for($i = 1; $i <= $this->yyidx; $i++) {
1191 fprintf(self::$yyTraceFILE, " %s",
1192 self::$yyTokenName[$this->yystack[$i]->major]);
1194 fwrite(self::$yyTraceFILE,"\n");
1199 * The following table contains information about every rule that
1200 * is used during the reduce.
1202 * <pre>
1203 * array(
1204 * array(
1205 * int $lhs; Symbol on the left-hand side of the rule
1206 * int $nrhs; Number of right-hand side symbols in the rule
1207 * ),...
1208 * );
1209 * </pre>
1211 static public $yyRuleInfo = array(
1212 array( 'lhs' => 64, 'rhs' => 1 ),
1213 array( 'lhs' => 65, 'rhs' => 2 ),
1214 array( 'lhs' => 65, 'rhs' => 0 ),
1215 array( 'lhs' => 66, 'rhs' => 2 ),
1216 array( 'lhs' => 66, 'rhs' => 1 ),
1217 array( 'lhs' => 66, 'rhs' => 2 ),
1218 array( 'lhs' => 66, 'rhs' => 3 ),
1219 array( 'lhs' => 67, 'rhs' => 3 ),
1220 array( 'lhs' => 67, 'rhs' => 2 ),
1221 array( 'lhs' => 67, 'rhs' => 1 ),
1222 array( 'lhs' => 67, 'rhs' => 1 ),
1223 array( 'lhs' => 67, 'rhs' => 1 ),
1224 array( 'lhs' => 67, 'rhs' => 1 ),
1225 array( 'lhs' => 67, 'rhs' => 1 ),
1226 array( 'lhs' => 67, 'rhs' => 3 ),
1227 array( 'lhs' => 67, 'rhs' => 1 ),
1228 array( 'lhs' => 67, 'rhs' => 1 ),
1229 array( 'lhs' => 67, 'rhs' => 7 ),
1230 array( 'lhs' => 76, 'rhs' => 2 ),
1231 array( 'lhs' => 76, 'rhs' => 4 ),
1232 array( 'lhs' => 76, 'rhs' => 3 ),
1233 array( 'lhs' => 76, 'rhs' => 5 ),
1234 array( 'lhs' => 76, 'rhs' => 6 ),
1235 array( 'lhs' => 77, 'rhs' => 9 ),
1236 array( 'lhs' => 70, 'rhs' => 1 ),
1237 array( 'lhs' => 71, 'rhs' => 9 ),
1238 array( 'lhs' => 71, 'rhs' => 11 ),
1239 array( 'lhs' => 71, 'rhs' => 13 ),
1240 array( 'lhs' => 71, 'rhs' => 15 ),
1241 array( 'lhs' => 75, 'rhs' => 7 ),
1242 array( 'lhs' => 75, 'rhs' => 11 ),
1243 array( 'lhs' => 72, 'rhs' => 6 ),
1244 array( 'lhs' => 72, 'rhs' => 7 ),
1245 array( 'lhs' => 72, 'rhs' => 10 ),
1246 array( 'lhs' => 72, 'rhs' => 11 ),
1247 array( 'lhs' => 73, 'rhs' => 7 ),
1248 array( 'lhs' => 73, 'rhs' => 8 ),
1249 array( 'lhs' => 74, 'rhs' => 7 ),
1250 array( 'lhs' => 80, 'rhs' => 6 ),
1251 array( 'lhs' => 68, 'rhs' => 3 ),
1252 array( 'lhs' => 68, 'rhs' => 1 ),
1253 array( 'lhs' => 82, 'rhs' => 3 ),
1254 array( 'lhs' => 82, 'rhs' => 1 ),
1255 array( 'lhs' => 79, 'rhs' => 2 ),
1256 array( 'lhs' => 79, 'rhs' => 3 ),
1257 array( 'lhs' => 79, 'rhs' => 1 ),
1258 array( 'lhs' => 69, 'rhs' => 1 ),
1259 array( 'lhs' => 69, 'rhs' => 1 ),
1260 array( 'lhs' => 69, 'rhs' => 1 ),
1261 array( 'lhs' => 83, 'rhs' => 3 ),
1262 array( 'lhs' => 83, 'rhs' => 3 ),
1263 array( 'lhs' => 84, 'rhs' => 2 ),
1264 array( 'lhs' => 84, 'rhs' => 1 ),
1265 array( 'lhs' => 81, 'rhs' => 3 ),
1266 array( 'lhs' => 81, 'rhs' => 3 ),
1267 array( 'lhs' => 81, 'rhs' => 3 ),
1268 array( 'lhs' => 81, 'rhs' => 3 ),
1269 array( 'lhs' => 81, 'rhs' => 3 ),
1270 array( 'lhs' => 81, 'rhs' => 1 ),
1271 array( 'lhs' => 81, 'rhs' => 3 ),
1272 array( 'lhs' => 81, 'rhs' => 1 ),
1273 array( 'lhs' => 81, 'rhs' => 1 ),
1274 array( 'lhs' => 78, 'rhs' => 3 ),
1275 array( 'lhs' => 78, 'rhs' => 4 ),
1276 array( 'lhs' => 78, 'rhs' => 1 ),
1277 array( 'lhs' => 78, 'rhs' => 1 ),
1281 * The following table contains a mapping of reduce action to method name
1282 * that handles the reduction.
1284 * If a rule is not set, it has no handler.
1286 static public $yyReduceMap = array(
1287 0 => 0,
1288 1 => 1,
1289 2 => 2,
1290 3 => 3,
1291 9 => 3,
1292 10 => 3,
1293 11 => 3,
1294 12 => 3,
1295 13 => 3,
1296 15 => 3,
1297 16 => 3,
1298 24 => 3,
1299 42 => 3,
1300 52 => 3,
1301 64 => 3,
1302 65 => 3,
1303 4 => 4,
1304 5 => 5,
1305 6 => 6,
1306 7 => 7,
1307 8 => 8,
1308 14 => 14,
1309 17 => 17,
1310 18 => 18,
1311 19 => 19,
1312 20 => 20,
1313 21 => 21,
1314 22 => 22,
1315 23 => 23,
1316 25 => 25,
1317 26 => 26,
1318 27 => 27,
1319 28 => 28,
1320 29 => 29,
1321 30 => 30,
1322 31 => 31,
1323 32 => 32,
1324 33 => 33,
1325 34 => 34,
1326 35 => 35,
1327 36 => 36,
1328 37 => 37,
1329 38 => 38,
1330 39 => 39,
1331 44 => 39,
1332 40 => 40,
1333 45 => 40,
1334 41 => 41,
1335 43 => 43,
1336 46 => 46,
1337 47 => 47,
1338 61 => 47,
1339 48 => 48,
1340 60 => 48,
1341 49 => 49,
1342 50 => 49,
1343 51 => 51,
1344 53 => 53,
1345 54 => 53,
1346 55 => 53,
1347 57 => 53,
1348 56 => 56,
1349 58 => 58,
1350 59 => 59,
1351 62 => 62,
1352 63 => 63,
1354 /* Beginning here are the reduction cases. A typical example
1355 ** follows:
1356 ** #line <lineno> <grammarfile>
1357 ** function yy_r0($yymsp){ ... } // User supplied code
1358 ** #line <lineno> <thisfile>
1360 #line 65 "parser.y"
1361 function yy_r0(){ $this->body = $this->yystack[$this->yyidx + 0]->minor; }
1362 #line 1368 "parser.php"
1363 #line 67 "parser.y"
1364 function yy_r1(){ $this->_retvalue=$this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; }
1365 #line 1371 "parser.php"
1366 #line 68 "parser.y"
1367 function yy_r2(){ $this->_retvalue = array(); }
1368 #line 1374 "parser.php"
1369 #line 71 "parser.y"
1370 function yy_r3(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
1371 #line 1377 "parser.php"
1372 #line 72 "parser.y"
1373 function yy_r4(){ $this->_retvalue = array('operation' => 'html', 'html' => $this->yystack[$this->yyidx + 0]->minor); }
1374 #line 1380 "parser.php"
1375 #line 73 "parser.y"
1376 function yy_r5(){ $this->yystack[$this->yyidx + 0]->minor=rtrim($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = array('operation' => 'comment', 'comment' => substr($this->yystack[$this->yyidx + 0]->minor, 0, strlen($this->yystack[$this->yyidx + 0]->minor)-2)); }
1377 #line 1383 "parser.php"
1378 #line 74 "parser.y"
1379 function yy_r6(){ $this->_retvalue = array('operation' => 'print_var', 'variable' => $this->yystack[$this->yyidx + -1]->minor); }
1380 #line 1386 "parser.php"
1381 #line 76 "parser.y"
1382 function yy_r7(){ $this->_retvalue = array('operation' => 'base', $this->yystack[$this->yyidx + -1]->minor); }
1383 #line 1389 "parser.php"
1384 #line 77 "parser.y"
1385 function yy_r8(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
1386 #line 1392 "parser.php"
1387 #line 83 "parser.y"
1388 function yy_r14(){ $this->_retvalue = array('operation' => 'include', $this->yystack[$this->yyidx + -1]->minor); }
1389 #line 1395 "parser.php"
1390 #line 86 "parser.y"
1391 function yy_r17(){ $this->_retvalue = array('operation' => 'autoescape', 'value' => strtolower(@$this->yystack[$this->yyidx + -5]->minor), 'body' => $this->yystack[$this->yyidx + -3]->minor); }
1392 #line 1398 "parser.php"
1393 #line 91 "parser.y"
1394 function yy_r18(){ $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); }
1395 #line 1401 "parser.php"
1396 #line 92 "parser.y"
1397 function yy_r19(){ $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -3]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); }
1398 #line 1404 "parser.php"
1399 #line 93 "parser.y"
1400 function yy_r20(){ $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -2]->minor, 'list' => $this->yystack[$this->yyidx + -1]->minor); }
1401 #line 1407 "parser.php"
1402 #line 94 "parser.y"
1403 function yy_r21(){ $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -4]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list' => $this->yystack[$this->yyidx + -3]->minor); }
1404 #line 1410 "parser.php"
1405 #line 96 "parser.y"
1406 function yy_r22(){ if ('end'.$this->yystack[$this->yyidx + -5]->minor != $this->yystack[$this->yyidx + -1]->minor) { throw new Exception("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); } $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'list' => array()); }
1407 #line 1413 "parser.php"
1408 #line 99 "parser.y"
1409 function yy_r23(){ $this->_retvalue = array('operation' => 'alias', 'var' => $this->yystack[$this->yyidx + -7]->minor, 'as' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); }
1410 #line 1416 "parser.php"
1411 #line 105 "parser.y"
1412 function yy_r25(){
1413 $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'array' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'index' => NULL);
1415 #line 1421 "parser.php"
1416 #line 108 "parser.y"
1417 function yy_r26(){
1418 $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'array' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'index' => $this->yystack[$this->yyidx + -9]->minor);
1420 #line 1426 "parser.php"
1421 #line 111 "parser.y"
1422 function yy_r27(){
1423 $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -11]->minor, 'array' => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'empty' => $this->yystack[$this->yyidx + -3]->minor, 'index' => NULL);
1425 #line 1431 "parser.php"
1426 #line 114 "parser.y"
1427 function yy_r28(){
1428 $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -11]->minor, 'array' => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'empty' => $this->yystack[$this->yyidx + -3]->minor, 'index' => $this->yystack[$this->yyidx + -13]->minor);
1430 #line 1436 "parser.php"
1431 #line 118 "parser.y"
1432 function yy_r29(){ $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); }
1433 #line 1439 "parser.php"
1434 #line 119 "parser.y"
1435 function yy_r30(){ $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); }
1436 #line 1442 "parser.php"
1437 #line 122 "parser.y"
1438 function yy_r31(){
1439 $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor);
1441 #line 1447 "parser.php"
1442 #line 126 "parser.y"
1443 function yy_r32(){
1444 $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor, 'check' => $this->yystack[$this->yyidx + -5]->minor);
1446 #line 1452 "parser.php"
1447 #line 129 "parser.y"
1448 function yy_r33(){
1449 $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor);
1451 #line 1457 "parser.php"
1452 #line 133 "parser.y"
1453 function yy_r34(){
1454 $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'check' => $this->yystack[$this->yyidx + -9]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor);
1456 #line 1462 "parser.php"
1457 #line 139 "parser.y"
1458 function yy_r35(){ $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); }
1459 #line 1465 "parser.php"
1460 #line 141 "parser.y"
1461 function yy_r36(){ $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -6]->minor, 'body' => $this->yystack[$this->yyidx + -4]->minor); }
1462 #line 1468 "parser.php"
1463 #line 144 "parser.y"
1464 function yy_r37(){ $this->_retvalue = array('operation' => 'filter', 'functions' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); }
1465 #line 1471 "parser.php"
1466 #line 147 "parser.y"
1467 function yy_r38(){ $this->_retvalue=array('operation' => 'regroup', 'array' => $this->yystack[$this->yyidx + -4]->minor, 'row' => $this->yystack[$this->yyidx + -2]->minor, 'as' => $this->yystack[$this->yyidx + 0]->minor); }
1468 #line 1474 "parser.php"
1469 #line 150 "parser.y"
1470 function yy_r39(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; }
1471 #line 1477 "parser.php"
1472 #line 151 "parser.y"
1473 function yy_r40(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); }
1474 #line 1480 "parser.php"
1475 #line 153 "parser.y"
1476 function yy_r41(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, 'args'=>array($this->yystack[$this->yyidx + 0]->minor)); }
1477 #line 1483 "parser.php"
1478 #line 157 "parser.y"
1479 function yy_r43(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; }
1480 #line 1486 "parser.php"
1481 #line 163 "parser.y"
1482 function yy_r46(){ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + 0]->minor); }
1483 #line 1489 "parser.php"
1484 #line 164 "parser.y"
1485 function yy_r47(){ $this->_retvalue = array('number' => $this->yystack[$this->yyidx + 0]->minor); }
1486 #line 1492 "parser.php"
1487 #line 165 "parser.y"
1488 function yy_r48(){ $this->_retvalue = array('string' => $this->yystack[$this->yyidx + 0]->minor); }
1489 #line 1495 "parser.php"
1490 #line 167 "parser.y"
1491 function yy_r49(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; }
1492 #line 1498 "parser.php"
1493 #line 169 "parser.y"
1494 function yy_r51(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
1495 #line 1501 "parser.php"
1496 #line 173 "parser.y"
1497 function yy_r53(){ $this->_retvalue = array('op_expr' => @$this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); }
1498 #line 1504 "parser.php"
1499 #line 176 "parser.y"
1500 function yy_r56(){ $this->_retvalue = array('op_expr' => trim(@$this->yystack[$this->yyidx + -1]->minor), $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); }
1501 #line 1507 "parser.php"
1502 #line 178 "parser.y"
1503 function yy_r58(){$this->_retvalue = array('var_filter' => $this->yystack[$this->yyidx + 0]->minor); }
1504 #line 1510 "parser.php"
1505 #line 179 "parser.y"
1506 function yy_r59(){ $this->_retvalue = array('op_expr' => 'expr', $this->yystack[$this->yyidx + -1]->minor); }
1507 #line 1513 "parser.php"
1508 #line 185 "parser.y"
1509 function yy_r62(){ if (!is_array($this->yystack[$this->yyidx + -2]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor); } else { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } $this->_retvalue[]=$this->yystack[$this->yyidx + 0]->minor; }
1510 #line 1516 "parser.php"
1511 #line 186 "parser.y"
1512 function yy_r63(){ if (!is_array($this->yystack[$this->yyidx + -3]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -3]->minor); } else { $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor; } $this->_retvalue[]=$this->yystack[$this->yyidx + -1]->minor; }
1513 #line 1519 "parser.php"
1516 * placeholder for the left hand side in a reduce operation.
1518 * For a parser with a rule like this:
1519 * <pre>
1520 * rule(A) ::= B. { A = 1; }
1521 * </pre>
1523 * The parser will translate to something like:
1525 * <code>
1526 * function yy_r0(){$this->_retvalue = 1;}
1527 * </code>
1529 private $_retvalue;
1532 * Perform a reduce action and the shift that must immediately
1533 * follow the reduce.
1535 * For a rule such as:
1537 * <pre>
1538 * A ::= B blah C. { dosomething(); }
1539 * </pre>
1541 * This function will first call the action, if any, ("dosomething();" in our
1542 * example), and then it will pop three states from the stack,
1543 * one for each entry on the right-hand side of the expression
1544 * (B, blah, and C in our example rule), and then push the result of the action
1545 * back on to the stack with the resulting state reduced to (as described in the .out
1546 * file)
1547 * @param int Number of the rule by which to reduce
1549 function yy_reduce($yyruleno)
1551 //int $yygoto; /* The next state */
1552 //int $yyact; /* The next action */
1553 //mixed $yygotominor; /* The LHS of the rule reduced */
1554 //Haanga_yyStackEntry $yymsp; /* The top of the parser's stack */
1555 //int $yysize; /* Amount to pop the stack */
1556 $yymsp = $this->yystack[$this->yyidx];
1557 if (self::$yyTraceFILE && $yyruleno >= 0
1558 && $yyruleno < count(self::$yyRuleName)) {
1559 fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
1560 self::$yyTracePrompt, $yyruleno,
1561 self::$yyRuleName[$yyruleno]);
1564 $this->_retvalue = $yy_lefthand_side = null;
1565 if (array_key_exists($yyruleno, self::$yyReduceMap)) {
1566 // call the action
1567 $this->_retvalue = null;
1568 $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
1569 $yy_lefthand_side = $this->_retvalue;
1571 $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
1572 $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
1573 $this->yyidx -= $yysize;
1574 for($i = $yysize; $i; $i--) {
1575 // pop all of the right-hand side parameters
1576 array_pop($this->yystack);
1578 $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
1579 if ($yyact < self::YYNSTATE) {
1580 /* If we are not debugging and the reduce action popped at least
1581 ** one element off the stack, then we can push the new element back
1582 ** onto the stack here, and skip the stack overflow test in yy_shift().
1583 ** That gives a significant speed improvement. */
1584 if (!self::$yyTraceFILE && $yysize) {
1585 $this->yyidx++;
1586 $x = new Haanga_yyStackEntry;
1587 $x->stateno = $yyact;
1588 $x->major = $yygoto;
1589 $x->minor = $yy_lefthand_side;
1590 $this->yystack[$this->yyidx] = $x;
1591 } else {
1592 $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
1594 } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
1595 $this->yy_accept();
1600 * The following code executes when the parse fails
1602 * Code from %parse_fail is inserted here
1604 function yy_parse_failed()
1606 if (self::$yyTraceFILE) {
1607 fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
1609 while ($this->yyidx >= 0) {
1610 $this->yy_pop_parser_stack();
1612 /* Here code is inserted which will be executed whenever the
1613 ** parser fails */
1617 * The following code executes when a syntax error first occurs.
1619 * %syntax_error code is inserted here
1620 * @param int The major type of the error token
1621 * @param mixed The minor type of the error token
1623 function yy_syntax_error($yymajor, $TOKEN)
1625 #line 56 "parser.y"
1627 $expect = array();
1628 foreach ($this->yy_get_expected_tokens($yymajor) as $token) {
1629 $expect[] = self::$yyTokenName[$token];
1631 throw new Exception('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. '), expected one of: ' . implode(',', $expect));
1632 #line 1639 "parser.php"
1636 * The following is executed when the parser accepts
1638 * %parse_accept code is inserted here
1640 function yy_accept()
1642 if (self::$yyTraceFILE) {
1643 fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
1645 while ($this->yyidx >= 0) {
1646 $stack = $this->yy_pop_parser_stack();
1648 /* Here code is inserted which will be executed whenever the
1649 ** parser accepts */
1650 #line 44 "parser.y"
1652 #line 1660 "parser.php"
1656 * The main parser program.
1658 * The first argument is the major token number. The second is
1659 * the token value string as scanned from the input.
1661 * @param int the token number
1662 * @param mixed the token value
1663 * @param mixed any extra arguments that should be passed to handlers
1665 function doParse($yymajor, $yytokenvalue)
1667 // $yyact; /* The parser action. */
1668 // $yyendofinput; /* True if we are at the end of input */
1669 $yyerrorhit = 0; /* True if yymajor has invoked an error */
1671 /* (re)initialize the parser, if necessary */
1672 if ($this->yyidx === null || $this->yyidx < 0) {
1673 /* if ($yymajor == 0) return; // not sure why this was here... */
1674 $this->yyidx = 0;
1675 $this->yyerrcnt = -1;
1676 $x = new Haanga_yyStackEntry;
1677 $x->stateno = 0;
1678 $x->major = 0;
1679 $this->yystack = array();
1680 array_push($this->yystack, $x);
1682 $yyendofinput = ($yymajor==0);
1684 if (self::$yyTraceFILE) {
1685 fprintf(self::$yyTraceFILE, "%sInput %s\n",
1686 self::$yyTracePrompt, self::$yyTokenName[$yymajor]);
1689 do {
1690 $yyact = $this->yy_find_shift_action($yymajor);
1691 if ($yymajor < self::YYERRORSYMBOL &&
1692 !$this->yy_is_expected_token($yymajor)) {
1693 // force a syntax error
1694 $yyact = self::YY_ERROR_ACTION;
1696 if ($yyact < self::YYNSTATE) {
1697 $this->yy_shift($yyact, $yymajor, $yytokenvalue);
1698 $this->yyerrcnt--;
1699 if ($yyendofinput && $this->yyidx >= 0) {
1700 $yymajor = 0;
1701 } else {
1702 $yymajor = self::YYNOCODE;
1704 } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
1705 $this->yy_reduce($yyact - self::YYNSTATE);
1706 } elseif ($yyact == self::YY_ERROR_ACTION) {
1707 if (self::$yyTraceFILE) {
1708 fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
1709 self::$yyTracePrompt);
1711 if (self::YYERRORSYMBOL) {
1712 /* A syntax error has occurred.
1713 ** The response to an error depends upon whether or not the
1714 ** grammar defines an error token "ERROR".
1716 ** This is what we do if the grammar does define ERROR:
1718 ** * Call the %syntax_error function.
1720 ** * Begin popping the stack until we enter a state where
1721 ** it is legal to shift the error symbol, then shift
1722 ** the error symbol.
1724 ** * Set the error count to three.
1726 ** * Begin accepting and shifting new tokens. No new error
1727 ** processing will occur until three tokens have been
1728 ** shifted successfully.
1731 if ($this->yyerrcnt < 0) {
1732 $this->yy_syntax_error($yymajor, $yytokenvalue);
1734 $yymx = $this->yystack[$this->yyidx]->major;
1735 if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
1736 if (self::$yyTraceFILE) {
1737 fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
1738 self::$yyTracePrompt, self::$yyTokenName[$yymajor]);
1740 $this->yy_destructor($yymajor, $yytokenvalue);
1741 $yymajor = self::YYNOCODE;
1742 } else {
1743 while ($this->yyidx >= 0 &&
1744 $yymx != self::YYERRORSYMBOL &&
1745 ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
1747 $this->yy_pop_parser_stack();
1749 if ($this->yyidx < 0 || $yymajor==0) {
1750 $this->yy_destructor($yymajor, $yytokenvalue);
1751 $this->yy_parse_failed();
1752 $yymajor = self::YYNOCODE;
1753 } elseif ($yymx != self::YYERRORSYMBOL) {
1754 $u2 = 0;
1755 $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
1758 $this->yyerrcnt = 3;
1759 $yyerrorhit = 1;
1760 } else {
1761 /* YYERRORSYMBOL is not defined */
1762 /* This is what we do if the grammar does not define ERROR:
1764 ** * Report an error message, and throw away the input token.
1766 ** * If the input token is $, then fail the parse.
1768 ** As before, subsequent error messages are suppressed until
1769 ** three input tokens have been successfully shifted.
1771 if ($this->yyerrcnt <= 0) {
1772 $this->yy_syntax_error($yymajor, $yytokenvalue);
1774 $this->yyerrcnt = 3;
1775 $this->yy_destructor($yymajor, $yytokenvalue);
1776 if ($yyendofinput) {
1777 $this->yy_parse_failed();
1779 $yymajor = self::YYNOCODE;
1781 } else {
1782 $this->yy_accept();
1783 $yymajor = self::YYNOCODE;
1785 } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);