calc: boolean expressions
[m6w6/ext-psi] / src / parser_proc.c
1 /*
2 ** 2000-05-29
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
10 **
11 *************************************************************************
12 ** Driver template for the LEMON parser generator.
13 **
14 ** The "lemon" program processes an LALR(1) input grammar file, then uses
15 ** this template to construct a parser. The "lemon" program inserts text
16 ** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the
17 ** interstitial "-" characters) contained in this template is changed into
18 ** the value of the %name directive from the grammar. Otherwise, the content
19 ** of this template is copied straight through into the generate parser
20 ** source file.
21 **
22 ** The following is the concatenation of all %include directives from the
23 ** input grammar file:
24 */
25 #include <stdio.h>
26 /************ Begin %include sections from the grammar ************************/
27 #line 1 "src/parser_proc.y"
28
29 #include "php_psi_stdinc.h"
30
31 #include <assert.h>
32 #include <stdarg.h>
33
34 #include "plist.h"
35 #include "parser.h"
36
37 /* rename lemon symbols, works better than DEF(%name) */
38 #define ParseAlloc psi_parser_proc_init_ex
39 #define Parse psi_parser_proc_parse
40 #define ParseTrace psi_parser_proc_trace
41 #define ParseFree psi_parser_proc_free_ex
42
43 /* fwd decls */
44 void *ParseAlloc(void *(*mallocProc)(size_t));
45 void ParseFree(void *p, void (*freeProc)(void*));
46
47 /* wrappers */
48 void *psi_parser_proc_init(void)
49 {
50 return ParseAlloc(malloc);
51 }
52
53 void psi_parser_proc_free(void **parser_proc)
54 {
55 if (*parser_proc) {
56 ParseFree(*parser_proc, free);
57 *parser_proc = NULL;
58 }
59 }
60
61 #line 62 "src/parser_proc.c"
62 /**************** End of %include directives **********************************/
63 /* These constants specify the various numeric values for terminal symbols
64 ** in a format understandable to "makeheaders". This section is blank unless
65 ** "lemon" is run with the "-m" command-line option.
66 ***************** Begin makeheaders token definitions *************************/
67 /**************** End makeheaders token definitions ***************************/
68
69 /* The next sections is a series of control #defines.
70 ** various aspects of the generated parser.
71 ** YYCODETYPE is the data type used to store the integer codes
72 ** that represent terminal and non-terminal symbols.
73 ** "unsigned char" is used if there are fewer than
74 ** 256 symbols. Larger types otherwise.
75 ** YYNOCODE is a number of type YYCODETYPE that is not used for
76 ** any terminal or nonterminal symbol.
77 ** YYFALLBACK If defined, this indicates that one or more tokens
78 ** (also known as: "terminal symbols") have fall-back
79 ** values which should be used if the original symbol
80 ** would not parse. This permits keywords to sometimes
81 ** be used as identifiers, for example.
82 ** YYACTIONTYPE is the data type used for "action codes" - numbers
83 ** that indicate what to do in response to the next
84 ** token.
85 ** ParseTOKENTYPE is the data type used for minor type for terminal
86 ** symbols. Background: A "minor type" is a semantic
87 ** value associated with a terminal or non-terminal
88 ** symbols. For example, for an "ID" terminal symbol,
89 ** the minor type might be the name of the identifier.
90 ** Each non-terminal can have a different minor type.
91 ** Terminal symbols all have the same minor type, though.
92 ** This macros defines the minor type for terminal
93 ** symbols.
94 ** YYMINORTYPE is the data type used for all minor types.
95 ** This is typically a union of many types, one of
96 ** which is ParseTOKENTYPE. The entry in the union
97 ** for terminal symbols is called "yy0".
98 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
99 ** zero the stack is dynamically sized using realloc()
100 ** ParseARG_SDECL A static variable declaration for the %extra_argument
101 ** ParseARG_PDECL A parameter declaration for the %extra_argument
102 ** ParseARG_STORE Code to store %extra_argument into yypParser
103 ** ParseARG_FETCH Code to extract %extra_argument from yypParser
104 ** YYERRORSYMBOL is the code number of the error symbol. If not
105 ** defined, then do no error processing.
106 ** YYNSTATE the combined number of states.
107 ** YYNRULE the number of rules in the grammar
108 ** YY_MAX_SHIFT Maximum value for shift actions
109 ** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
110 ** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
111 ** YY_MIN_REDUCE Maximum value for reduce actions
112 ** YY_ERROR_ACTION The yy_action[] code for syntax error
113 ** YY_ACCEPT_ACTION The yy_action[] code for accept
114 ** YY_NO_ACTION The yy_action[] code for no-op
115 */
116 #ifndef INTERFACE
117 # define INTERFACE 1
118 #endif
119 /************* Begin control #defines *****************************************/
120 #define YYCODETYPE unsigned char
121 #define YYNOCODE 167
122 #define YYACTIONTYPE unsigned short int
123 #define ParseTOKENTYPE struct psi_token *
124 typedef union {
125 int yyinit;
126 ParseTOKENTYPE yy0;
127 struct psi_const_type* yy7;
128 struct psi_let_calloc* yy17;
129 struct psi_decl_union* yy19;
130 struct psi_impl_def_val* yy21;
131 struct psi_token** yy38;
132 struct psi_num_exp* yy39;
133 struct psi_impl* yy49;
134 struct psi_set_exp* yy67;
135 struct psi_decl_enum_item* yy69;
136 struct psi_decl* yy71;
137 struct psi_let_func* yy72;
138 struct psi_free_stmt* yy76;
139 struct psi_set_func* yy78;
140 struct psi_layout* yy81;
141 struct psi_const* yy106;
142 struct psi_impl_func* yy120;
143 struct psi_return_stmt* yy130;
144 struct psi_let_stmt* yy139;
145 struct psi_impl_type* yy142;
146 struct psi_let_exp* yy144;
147 struct psi_decl_type* yy152;
148 struct psi_number* yy160;
149 struct psi_let_callback* yy164;
150 struct psi_impl_var* yy185;
151 unsigned yy190;
152 struct psi_free_exp* yy197;
153 struct psi_decl_var* yy207;
154 struct psi_set_stmt* yy226;
155 struct psi_impl_arg* yy238;
156 struct psi_decl_abi* yy242;
157 struct psi_decl_arg* yy260;
158 struct psi_decl_struct* yy271;
159 bool yy273;
160 struct psi_decl_enum * yy279;
161 struct psi_plist * yy287;
162 struct psi_plist* yy303;
163 struct psi_layout yy323;
164 } YYMINORTYPE;
165 #ifndef YYSTACKDEPTH
166 #define YYSTACKDEPTH 100
167 #endif
168 #define ParseARG_SDECL struct psi_parser *P;
169 #define ParseARG_PDECL ,struct psi_parser *P
170 #define ParseARG_FETCH struct psi_parser *P = yypParser->P
171 #define ParseARG_STORE yypParser->P = P
172 #define YYFALLBACK 1
173 #define YYNSTATE 197
174 #define YYNRULE 157
175 #define YY_MAX_SHIFT 196
176 #define YY_MIN_SHIFTREDUCE 328
177 #define YY_MAX_SHIFTREDUCE 484
178 #define YY_MIN_REDUCE 485
179 #define YY_MAX_REDUCE 641
180 #define YY_ERROR_ACTION 642
181 #define YY_ACCEPT_ACTION 643
182 #define YY_NO_ACTION 644
183 /************* End control #defines *******************************************/
184
185 /* Define the yytestcase() macro to be a no-op if is not already defined
186 ** otherwise.
187 **
188 ** Applications can choose to define yytestcase() in the %include section
189 ** to a macro that can assist in verifying code coverage. For production
190 ** code the yytestcase() macro should be turned off. But it is useful
191 ** for testing.
192 */
193 #ifndef yytestcase
194 # define yytestcase(X)
195 #endif
196
197
198 /* Next are the tables used to determine what action to take based on the
199 ** current state and lookahead token. These tables are used to implement
200 ** functions that take a state number and lookahead value and return an
201 ** action integer.
202 **
203 ** Suppose the action integer is N. Then the action is determined as
204 ** follows
205 **
206 ** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
207 ** token onto the stack and goto state N.
208 **
209 ** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
210 ** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
211 **
212 ** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
213 ** and YY_MAX_REDUCE
214 **
215 ** N == YY_ERROR_ACTION A syntax error has occurred.
216 **
217 ** N == YY_ACCEPT_ACTION The parser accepts its input.
218 **
219 ** N == YY_NO_ACTION No such action. Denotes unused
220 ** slots in the yy_action[] table.
221 **
222 ** The action table is constructed as a single large table named yy_action[].
223 ** Given state S and lookahead X, the action is computed as either:
224 **
225 ** (A) N = yy_action[ yy_shift_ofst[S] + X ]
226 ** (B) N = yy_default[S]
227 **
228 ** The (A) formula is preferred. The B formula is used instead if:
229 ** (1) The yy_shift_ofst[S]+X value is out of range, or
230 ** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or
231 ** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT.
232 ** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that
233 ** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X.
234 ** Hence only tests (1) and (2) need to be evaluated.)
235 **
236 ** The formulas above are for computing the action when the lookahead is
237 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
238 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
239 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
240 ** YY_SHIFT_USE_DFLT.
241 **
242 ** The following are the tables generated in this section:
243 **
244 ** yy_action[] A single table containing all actions.
245 ** yy_lookahead[] A table containing the lookahead for each entry in
246 ** yy_action. Used to detect hash collisions.
247 ** yy_shift_ofst[] For each state, the offset into yy_action for
248 ** shifting terminals.
249 ** yy_reduce_ofst[] For each state, the offset into yy_action for
250 ** shifting non-terminals after a reduce.
251 ** yy_default[] Default action for each state.
252 **
253 *********** Begin parsing tables **********************************************/
254 #define YY_ACTTAB_COUNT (1024)
255 static const YYACTIONTYPE yy_action[] = {
256 /* 0 */ 394, 409, 93, 409, 409, 409, 409, 409, 409, 409,
257 /* 10 */ 409, 409, 409, 93, 436, 430, 478, 21, 424, 430,
258 /* 20 */ 425, 427, 15, 427, 411, 27, 27, 478, 475, 428,
259 /* 30 */ 494, 428, 150, 426, 429, 426, 429, 494, 27, 27,
260 /* 40 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
261 /* 50 */ 432, 101, 124, 439, 441, 83, 423, 438, 452, 110,
262 /* 60 */ 417, 417, 417, 417, 417, 405, 149, 56, 366, 422,
263 /* 70 */ 107, 122, 28, 376, 90, 89, 88, 147, 348, 48,
264 /* 80 */ 35, 133, 478, 164, 116, 390, 81, 67, 65, 64,
265 /* 90 */ 394, 409, 47, 409, 409, 409, 409, 409, 409, 409,
266 /* 100 */ 409, 409, 409, 39, 49, 11, 10, 60, 93, 437,
267 /* 110 */ 430, 158, 115, 141, 430, 353, 353, 353, 353, 478,
268 /* 120 */ 27, 27, 478, 141, 141, 141, 141, 141, 141, 141,
269 /* 130 */ 375, 193, 136, 27, 27, 148, 148, 148, 148, 148,
270 /* 140 */ 148, 148, 148, 148, 148, 83, 349, 352, 394, 409,
271 /* 150 */ 146, 409, 409, 409, 409, 409, 409, 409, 409, 409,
272 /* 160 */ 409, 149, 349, 351, 179, 181, 180, 28, 134, 122,
273 /* 170 */ 35, 122, 153, 109, 471, 390, 81, 67, 65, 64,
274 /* 180 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
275 /* 190 */ 29, 29, 29, 29, 29, 29, 29, 29, 394, 419,
276 /* 200 */ 419, 419, 419, 41, 124, 145, 394, 409, 416, 409,
277 /* 210 */ 409, 409, 409, 409, 409, 409, 409, 409, 409, 415,
278 /* 220 */ 382, 114, 90, 89, 88, 410, 43, 414, 34, 106,
279 /* 230 */ 147, 123, 344, 390, 81, 67, 65, 64, 29, 29,
280 /* 240 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
281 /* 250 */ 29, 374, 108, 29, 29, 419, 419, 419, 419, 419,
282 /* 260 */ 421, 83, 113, 397, 394, 409, 405, 409, 409, 409,
283 /* 270 */ 409, 409, 409, 409, 409, 409, 409, 167, 137, 112,
284 /* 280 */ 90, 89, 88, 390, 81, 67, 35, 147, 36, 128,
285 /* 290 */ 122, 390, 81, 67, 65, 64, 458, 458, 458, 458,
286 /* 300 */ 458, 458, 458, 458, 458, 458, 155, 379, 157, 161,
287 /* 310 */ 365, 169, 459, 160, 161, 410, 43, 122, 122, 76,
288 /* 320 */ 119, 479, 394, 409, 431, 409, 409, 409, 409, 409,
289 /* 330 */ 409, 409, 409, 409, 409, 376, 431, 357, 179, 181,
290 /* 340 */ 180, 402, 432, 100, 35, 440, 442, 80, 140, 390,
291 /* 350 */ 81, 67, 65, 64, 432, 99, 405, 163, 161, 144,
292 /* 360 */ 142, 127, 350, 122, 356, 456, 53, 463, 37, 473,
293 /* 370 */ 2, 418, 395, 147, 122, 122, 122, 66, 8, 451,
294 /* 380 */ 394, 409, 431, 409, 409, 409, 409, 409, 409, 409,
295 /* 390 */ 409, 409, 409, 94, 431, 401, 179, 181, 180, 343,
296 /* 400 */ 432, 96, 35, 122, 13, 461, 140, 390, 81, 67,
297 /* 410 */ 65, 64, 432, 99, 39, 49, 11, 10, 60, 470,
298 /* 420 */ 92, 122, 70, 465, 111, 463, 131, 7, 460, 6,
299 /* 430 */ 450, 147, 413, 122, 479, 83, 23, 154, 394, 409,
300 /* 440 */ 431, 409, 409, 409, 409, 409, 409, 409, 409, 409,
301 /* 450 */ 409, 68, 150, 472, 179, 181, 180, 132, 432, 97,
302 /* 460 */ 35, 378, 24, 360, 38, 390, 81, 67, 65, 64,
303 /* 470 */ 432, 101, 20, 439, 441, 479, 383, 438, 453, 122,
304 /* 480 */ 369, 410, 43, 382, 117, 377, 368, 105, 410, 43,
305 /* 490 */ 367, 122, 361, 74, 189, 379, 394, 409, 42, 409,
306 /* 500 */ 409, 409, 409, 409, 409, 409, 409, 409, 409, 479,
307 /* 510 */ 176, 177, 179, 181, 180, 398, 22, 424, 393, 400,
308 /* 520 */ 427, 431, 405, 390, 81, 67, 65, 64, 428, 405,
309 /* 530 */ 44, 391, 426, 429, 118, 196, 483, 484, 2, 432,
310 /* 540 */ 102, 84, 95, 190, 170, 45, 86, 335, 63, 1,
311 /* 550 */ 120, 82, 333, 342, 334, 121, 332, 331, 69, 68,
312 /* 560 */ 122, 329, 183, 19, 46, 341, 340, 192, 345, 337,
313 /* 570 */ 179, 181, 180, 330, 151, 39, 49, 11, 10, 60,
314 /* 580 */ 373, 390, 81, 67, 65, 64, 93, 372, 430, 61,
315 /* 590 */ 57, 126, 430, 412, 125, 475, 182, 58, 27, 27,
316 /* 600 */ 478, 59, 130, 31, 643, 3, 3, 178, 194, 469,
317 /* 610 */ 16, 27, 27, 141, 468, 79, 431, 4, 384, 32,
318 /* 620 */ 410, 43, 447, 141, 141, 141, 141, 141, 141, 141,
319 /* 630 */ 419, 419, 419, 419, 432, 98, 446, 71, 93, 462,
320 /* 640 */ 430, 12, 40, 448, 430, 28, 143, 475, 14, 182,
321 /* 650 */ 27, 27, 478, 5, 50, 122, 418, 194, 87, 85,
322 /* 660 */ 178, 405, 51, 27, 27, 141, 631, 26, 79, 9,
323 /* 670 */ 17, 385, 364, 410, 43, 141, 141, 141, 141, 141,
324 /* 680 */ 141, 141, 152, 363, 18, 72, 419, 419, 419, 419,
325 /* 690 */ 419, 156, 52, 73, 159, 479, 75, 28, 431, 162,
326 /* 700 */ 54, 522, 355, 354, 129, 78, 62, 168, 139, 389,
327 /* 710 */ 194, 87, 85, 171, 405, 172, 432, 104, 173, 29,
328 /* 720 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
329 /* 730 */ 29, 29, 29, 29, 29, 29, 29, 122, 174, 408,
330 /* 740 */ 175, 29, 29, 29, 29, 29, 29, 29, 29, 29,
331 /* 750 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 387,
332 /* 760 */ 386, 407, 406, 358, 371, 494, 184, 339, 185, 187,
333 /* 770 */ 186, 188, 91, 449, 29, 29, 29, 29, 29, 29,
334 /* 780 */ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
335 /* 790 */ 29, 29, 191, 93, 25, 430, 637, 30, 55, 430,
336 /* 800 */ 328, 195, 475, 431, 487, 27, 27, 478, 487, 487,
337 /* 810 */ 369, 487, 487, 487, 487, 487, 487, 487, 27, 27,
338 /* 820 */ 141, 432, 103, 487, 487, 487, 487, 487, 433, 182,
339 /* 830 */ 141, 141, 141, 141, 141, 141, 141, 487, 487, 487,
340 /* 840 */ 359, 166, 122, 487, 77, 93, 487, 430, 165, 487,
341 /* 850 */ 487, 430, 28, 410, 33, 487, 487, 27, 27, 478,
342 /* 860 */ 487, 487, 487, 487, 487, 196, 483, 484, 487, 487,
343 /* 870 */ 27, 27, 95, 190, 170, 487, 487, 487, 63, 1,
344 /* 880 */ 487, 487, 487, 487, 487, 487, 487, 487, 69, 68,
345 /* 890 */ 194, 87, 85, 335, 405, 487, 150, 487, 333, 487,
346 /* 900 */ 334, 487, 332, 331, 28, 150, 487, 329, 487, 19,
347 /* 910 */ 487, 487, 487, 487, 432, 101, 487, 439, 441, 330,
348 /* 920 */ 151, 438, 445, 432, 101, 487, 439, 441, 487, 487,
349 /* 930 */ 438, 138, 487, 487, 487, 122, 487, 487, 487, 487,
350 /* 940 */ 487, 487, 487, 431, 122, 487, 431, 487, 487, 487,
351 /* 950 */ 487, 487, 482, 487, 194, 140, 487, 487, 140, 487,
352 /* 960 */ 487, 432, 99, 487, 432, 99, 487, 487, 487, 487,
353 /* 970 */ 487, 487, 135, 487, 463, 467, 487, 463, 487, 431,
354 /* 980 */ 147, 487, 122, 147, 431, 122, 487, 487, 487, 487,
355 /* 990 */ 487, 140, 487, 487, 487, 487, 140, 432, 99, 487,
356 /* 1000 */ 487, 487, 432, 99, 487, 487, 487, 487, 466, 487,
357 /* 1010 */ 463, 487, 487, 457, 487, 463, 147, 487, 122, 487,
358 /* 1020 */ 487, 147, 487, 122,
359 };
360 static const YYCODETYPE yy_lookahead[] = {
361 /* 0 */ 2, 3, 14, 5, 6, 7, 8, 9, 10, 11,
362 /* 10 */ 12, 13, 14, 14, 15, 16, 28, 129, 130, 20,
363 /* 20 */ 130, 133, 23, 133, 120, 26, 27, 28, 23, 141,
364 /* 30 */ 72, 141, 113, 145, 146, 145, 146, 79, 39, 40,
365 /* 40 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
366 /* 50 */ 131, 132, 125, 134, 135, 57, 126, 138, 139, 140,
367 /* 60 */ 15, 16, 17, 18, 19, 161, 67, 68, 14, 126,
368 /* 70 */ 127, 152, 73, 113, 76, 77, 78, 150, 80, 149,
369 /* 80 */ 82, 14, 28, 151, 152, 87, 88, 89, 90, 91,
370 /* 90 */ 2, 3, 149, 5, 6, 7, 8, 9, 10, 11,
371 /* 100 */ 12, 13, 14, 62, 63, 64, 65, 66, 14, 15,
372 /* 110 */ 16, 151, 152, 41, 20, 1, 2, 3, 4, 28,
373 /* 120 */ 26, 27, 28, 51, 52, 53, 54, 55, 56, 57,
374 /* 130 */ 113, 14, 113, 39, 40, 41, 42, 43, 44, 45,
375 /* 140 */ 46, 47, 48, 49, 50, 57, 99, 100, 2, 3,
376 /* 150 */ 165, 5, 6, 7, 8, 9, 10, 11, 12, 13,
377 /* 160 */ 14, 67, 99, 100, 76, 77, 78, 73, 144, 152,
378 /* 170 */ 82, 152, 84, 147, 148, 87, 88, 89, 90, 91,
379 /* 180 */ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
380 /* 190 */ 31, 32, 33, 34, 35, 36, 37, 38, 2, 1,
381 /* 200 */ 2, 3, 4, 57, 125, 125, 2, 3, 149, 5,
382 /* 210 */ 6, 7, 8, 9, 10, 11, 12, 13, 14, 149,
383 /* 220 */ 115, 116, 76, 77, 78, 120, 121, 149, 82, 150,
384 /* 230 */ 150, 97, 98, 87, 88, 89, 90, 91, 22, 23,
385 /* 240 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
386 /* 250 */ 34, 113, 114, 37, 38, 57, 58, 59, 60, 61,
387 /* 260 */ 124, 57, 125, 5, 2, 3, 161, 5, 6, 7,
388 /* 270 */ 8, 9, 10, 11, 12, 13, 14, 124, 113, 113,
389 /* 280 */ 76, 77, 78, 87, 88, 89, 82, 150, 74, 75,
390 /* 290 */ 152, 87, 88, 89, 90, 91, 41, 42, 43, 44,
391 /* 300 */ 45, 46, 47, 48, 49, 50, 111, 14, 151, 152,
392 /* 310 */ 115, 104, 57, 151, 152, 120, 121, 152, 152, 57,
393 /* 320 */ 152, 28, 2, 3, 113, 5, 6, 7, 8, 9,
394 /* 330 */ 10, 11, 12, 13, 14, 113, 113, 113, 76, 77,
395 /* 340 */ 78, 161, 131, 132, 82, 134, 135, 89, 125, 87,
396 /* 350 */ 88, 89, 90, 91, 131, 132, 161, 151, 152, 136,
397 /* 360 */ 137, 84, 71, 152, 113, 142, 73, 144, 74, 75,
398 /* 370 */ 79, 94, 163, 150, 152, 152, 152, 57, 74, 75,
399 /* 380 */ 2, 3, 113, 5, 6, 7, 8, 9, 10, 11,
400 /* 390 */ 12, 13, 14, 74, 113, 161, 76, 77, 78, 80,
401 /* 400 */ 131, 132, 82, 152, 74, 75, 125, 87, 88, 89,
402 /* 410 */ 90, 91, 131, 132, 62, 63, 64, 65, 66, 71,
403 /* 420 */ 14, 152, 74, 142, 143, 144, 150, 74, 75, 74,
404 /* 430 */ 75, 150, 80, 152, 28, 57, 74, 75, 2, 3,
405 /* 440 */ 113, 5, 6, 7, 8, 9, 10, 11, 12, 13,
406 /* 450 */ 14, 93, 113, 148, 76, 77, 78, 123, 131, 132,
407 /* 460 */ 82, 14, 74, 75, 150, 87, 88, 89, 90, 91,
408 /* 470 */ 131, 132, 73, 134, 135, 28, 115, 138, 139, 152,
409 /* 480 */ 14, 120, 121, 115, 116, 109, 109, 152, 120, 121,
410 /* 490 */ 109, 152, 109, 57, 72, 14, 2, 3, 102, 5,
411 /* 500 */ 6, 7, 8, 9, 10, 11, 12, 13, 14, 28,
412 /* 510 */ 72, 119, 76, 77, 78, 164, 129, 130, 2, 2,
413 /* 520 */ 133, 113, 161, 87, 88, 89, 90, 91, 141, 161,
414 /* 530 */ 99, 162, 145, 146, 152, 69, 70, 71, 79, 131,
415 /* 540 */ 132, 102, 76, 77, 78, 99, 102, 96, 82, 83,
416 /* 550 */ 14, 57, 101, 156, 103, 14, 105, 106, 92, 93,
417 /* 560 */ 152, 110, 14, 112, 102, 156, 156, 85, 98, 14,
418 /* 570 */ 76, 77, 78, 122, 123, 62, 63, 64, 65, 66,
419 /* 580 */ 160, 87, 88, 89, 90, 91, 14, 160, 16, 81,
420 /* 590 */ 72, 94, 20, 80, 75, 23, 96, 72, 26, 27,
421 /* 600 */ 28, 72, 20, 73, 153, 154, 155, 107, 157, 71,
422 /* 610 */ 79, 39, 40, 41, 71, 115, 113, 117, 118, 73,
423 /* 620 */ 120, 121, 71, 51, 52, 53, 54, 55, 56, 57,
424 /* 630 */ 1, 2, 3, 4, 131, 132, 71, 81, 14, 75,
425 /* 640 */ 16, 81, 73, 75, 20, 73, 75, 23, 74, 96,
426 /* 650 */ 26, 27, 28, 73, 73, 152, 94, 157, 158, 159,
427 /* 660 */ 107, 161, 73, 39, 40, 41, 94, 73, 115, 81,
428 /* 670 */ 79, 118, 71, 120, 121, 51, 52, 53, 54, 55,
429 /* 680 */ 56, 57, 75, 71, 73, 75, 57, 58, 59, 60,
430 /* 690 */ 61, 14, 73, 75, 14, 28, 75, 73, 113, 14,
431 /* 700 */ 73, 73, 71, 71, 75, 14, 81, 20, 84, 75,
432 /* 710 */ 157, 158, 159, 16, 161, 74, 131, 132, 16, 21,
433 /* 720 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
434 /* 730 */ 32, 33, 34, 35, 36, 37, 38, 152, 73, 14,
435 /* 740 */ 72, 21, 22, 23, 24, 25, 26, 27, 28, 29,
436 /* 750 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 71,
437 /* 760 */ 71, 14, 14, 14, 86, 79, 16, 75, 74, 73,
438 /* 770 */ 16, 72, 14, 75, 21, 22, 23, 24, 25, 26,
439 /* 780 */ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
440 /* 790 */ 37, 38, 16, 14, 74, 16, 0, 81, 79, 20,
441 /* 800 */ 71, 19, 23, 113, 166, 26, 27, 28, 166, 166,
442 /* 810 */ 14, 166, 166, 166, 166, 166, 166, 166, 39, 40,
443 /* 820 */ 41, 131, 132, 166, 166, 166, 166, 166, 75, 96,
444 /* 830 */ 51, 52, 53, 54, 55, 56, 57, 166, 166, 166,
445 /* 840 */ 107, 108, 152, 166, 111, 14, 166, 16, 115, 166,
446 /* 850 */ 166, 20, 73, 120, 121, 166, 166, 26, 27, 28,
447 /* 860 */ 166, 166, 166, 166, 166, 69, 70, 71, 166, 166,
448 /* 870 */ 39, 40, 76, 77, 78, 166, 166, 166, 82, 83,
449 /* 880 */ 166, 166, 166, 166, 166, 166, 166, 166, 92, 93,
450 /* 890 */ 157, 158, 159, 96, 161, 166, 113, 166, 101, 166,
451 /* 900 */ 103, 166, 105, 106, 73, 113, 166, 110, 166, 112,
452 /* 910 */ 166, 166, 166, 166, 131, 132, 166, 134, 135, 122,
453 /* 920 */ 123, 138, 139, 131, 132, 166, 134, 135, 166, 166,
454 /* 930 */ 138, 139, 166, 166, 166, 152, 166, 166, 166, 166,
455 /* 940 */ 166, 166, 166, 113, 152, 166, 113, 166, 166, 166,
456 /* 950 */ 166, 166, 155, 166, 157, 125, 166, 166, 125, 166,
457 /* 960 */ 166, 131, 132, 166, 131, 132, 166, 166, 166, 166,
458 /* 970 */ 166, 166, 142, 166, 144, 142, 166, 144, 166, 113,
459 /* 980 */ 150, 166, 152, 150, 113, 152, 166, 166, 166, 166,
460 /* 990 */ 166, 125, 166, 166, 166, 166, 125, 131, 132, 166,
461 /* 1000 */ 166, 166, 131, 132, 166, 166, 166, 166, 142, 166,
462 /* 1010 */ 144, 166, 166, 142, 166, 144, 150, 166, 152, 166,
463 /* 1020 */ 166, 150, 166, 152,
464 };
465 #define YY_SHIFT_USE_DFLT (1024)
466 #define YY_SHIFT_COUNT (196)
467 #define YY_SHIFT_MIN (-42)
468 #define YY_SHIFT_MAX (831)
469 static const short yy_shift_ofst[] = {
470 /* 0 */ 466, 146, 204, 796, -2, 572, -1, 624, -1, -1,
471 /* 10 */ -1, 779, 779, 779, 779, 94, 41, 41, 262, 320,
472 /* 20 */ 262, 352, 513, 88, 378, 831, 831, 831, 831, 831,
473 /* 30 */ 831, 629, -12, -12, 436, 494, 198, -12, -12, -12,
474 /* 40 */ -12, 54, 291, -12, -12, -12, 291, 5, 5, 67,
475 /* 50 */ 5, 5, 91, 91, 91, 117, 255, 198, 198, 198,
476 /* 60 */ 72, 45, 45, 114, 196, 196, 54, 258, 5, 358,
477 /* 70 */ 67, 5, 399, 399, 91, 399, 91, 399, 422, 438,
478 /* 80 */ 517, 516, 91, 91, 459, 422, 459, 422, 536, 541,
479 /* 90 */ 548, 422, 482, 482, 117, 555, 698, 720, 753, 159,
480 /* 100 */ 159, 159, 159, 159, 216, 293, 277, 214, 294, 348,
481 /* 110 */ 304, 330, 353, 355, 362, 406, 447, 388, 481, 447,
482 /* 120 */ -42, -42, 406, 319, 508, 518, 519, 497, 525, 529,
483 /* 130 */ 530, 582, 531, 546, 538, 543, 551, 556, 565, 564,
484 /* 140 */ 560, 569, 574, 568, 571, 580, 581, 562, 589, 594,
485 /* 150 */ 588, 591, 601, 607, 612, 611, 610, 677, 619, 618,
486 /* 160 */ 680, 667, 621, 685, 627, 628, 631, 632, 625, 687,
487 /* 170 */ 691, 634, 697, 641, 702, 665, 668, 688, 689, 725,
488 /* 180 */ 747, 748, 749, 686, 692, 750, 694, 754, 696, 699,
489 /* 190 */ 758, 678, 776, 716, 719, 729, 782,
490 };
491 #define YY_REDUCE_USE_DFLT (-113)
492 #define YY_REDUCE_COUNT (95)
493 #define YY_REDUCE_MIN (-112)
494 #define YY_REDUCE_MAX (871)
495 static const short yy_reduce_ofst[] = {
496 /* 0 */ 451, 733, 500, 797, 553, 223, -81, 281, 339, 783,
497 /* 10 */ 792, 830, 833, 866, 871, 211, -112, 387, 105, 195,
498 /* 20 */ 368, -110, -110, 361, 361, 269, 327, 408, 503, 585,
499 /* 30 */ 690, -57, 138, -40, -96, -96, -70, 17, 19, 165,
500 /* 40 */ 166, -68, 47, 222, 224, 251, 63, -73, 79, 26,
501 /* 50 */ 80, 137, 157, 162, 206, 134, -15, 59, 70, 78,
502 /* 60 */ 24, 136, 153, 207, 180, 234, 168, 209, 276, 334,
503 /* 70 */ 305, 314, 376, 377, 335, 381, 168, 383, 396, 392,
504 /* 80 */ 351, 369, 382, 168, 431, 439, 446, 444, 397, 409,
505 /* 90 */ 410, 462, 420, 427, 470, 410,
506 };
507 static const YYACTIONTYPE yy_default[] = {
508 /* 0 */ 642, 642, 642, 642, 642, 611, 642, 631, 642, 642,
509 /* 10 */ 642, 631, 631, 631, 631, 642, 642, 642, 537, 642,
510 /* 20 */ 537, 642, 642, 642, 642, 642, 642, 642, 642, 642,
511 /* 30 */ 642, 642, 642, 633, 642, 642, 642, 642, 642, 642,
512 /* 40 */ 642, 633, 642, 642, 642, 642, 642, 631, 631, 642,
513 /* 50 */ 631, 631, 633, 633, 633, 642, 642, 642, 642, 642,
514 /* 60 */ 642, 642, 642, 642, 561, 560, 642, 553, 631, 642,
515 /* 70 */ 642, 631, 642, 642, 642, 642, 538, 642, 495, 545,
516 /* 80 */ 556, 549, 642, 642, 642, 495, 642, 495, 493, 493,
517 /* 90 */ 493, 495, 527, 527, 642, 493, 642, 642, 642, 621,
518 /* 100 */ 601, 600, 592, 503, 591, 642, 642, 642, 642, 642,
519 /* 110 */ 642, 642, 642, 642, 642, 634, 634, 642, 642, 642,
520 /* 120 */ 564, 563, 642, 642, 577, 642, 642, 642, 642, 642,
521 /* 130 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
522 /* 140 */ 642, 642, 612, 642, 642, 642, 642, 642, 642, 642,
523 /* 150 */ 588, 642, 642, 642, 642, 642, 642, 642, 642, 642,
524 /* 160 */ 642, 634, 642, 642, 642, 519, 642, 642, 642, 642,
525 /* 170 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
526 /* 180 */ 642, 642, 642, 565, 642, 642, 642, 642, 642, 642,
527 /* 190 */ 642, 642, 642, 504, 642, 642, 642,
528 };
529 /********** End of lemon-generated parsing tables *****************************/
530
531 /* The next table maps tokens (terminal symbols) into fallback tokens.
532 ** If a construct like the following:
533 **
534 ** %fallback ID X Y Z.
535 **
536 ** appears in the grammar, then ID becomes a fallback token for X, Y,
537 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
538 ** but it does not parse, the type of the token is changed to ID and
539 ** the parse is retried before an error is thrown.
540 **
541 ** This feature can be used, for example, to cause some keywords in a language
542 ** to revert to identifiers if they keyword does not apply in the context where
543 ** it appears.
544 */
545 #ifdef YYFALLBACK
546 static const YYCODETYPE yyFallback[] = {
547 0, /* $ => nothing */
548 0, /* BOOL => nothing */
549 0, /* INT => nothing */
550 0, /* FLOAT => nothing */
551 14, /* STRING => NAME */
552 0, /* DOUBLE => nothing */
553 0, /* INT8 => nothing */
554 0, /* UINT8 => nothing */
555 0, /* INT16 => nothing */
556 0, /* UINT16 => nothing */
557 0, /* INT32 => nothing */
558 0, /* UINT32 => nothing */
559 0, /* INT64 => nothing */
560 0, /* UINT64 => nothing */
561 0, /* NAME => nothing */
562 0, /* NULL => nothing */
563 0, /* NUMBER => nothing */
564 0, /* TRUE => nothing */
565 0, /* FALSE => nothing */
566 0, /* QUOTED_STRING => nothing */
567 0, /* NSNAME => nothing */
568 0, /* PIPE => nothing */
569 0, /* CARET => nothing */
570 0, /* AMPERSAND => nothing */
571 0, /* LSHIFT => nothing */
572 0, /* RSHIFT => nothing */
573 0, /* PLUS => nothing */
574 0, /* MINUS => nothing */
575 0, /* ASTERISK => nothing */
576 0, /* SLASH => nothing */
577 0, /* MODULO => nothing */
578 0, /* RCHEVR => nothing */
579 0, /* LCHEVR => nothing */
580 0, /* CMP_GE => nothing */
581 0, /* CMP_LE => nothing */
582 0, /* OR => nothing */
583 0, /* AND => nothing */
584 0, /* CMP_EQ => nothing */
585 0, /* CMP_NE => nothing */
586 0, /* TILDE => nothing */
587 0, /* NOT => nothing */
588 14, /* ZVAL => NAME */
589 0, /* OBJVAL => nothing */
590 0, /* ARRVAL => nothing */
591 0, /* PATHVAL => nothing */
592 0, /* STRLEN => nothing */
593 0, /* STRVAL => nothing */
594 0, /* FLOATVAL => nothing */
595 0, /* INTVAL => nothing */
596 0, /* BOOLVAL => nothing */
597 14, /* COUNT => NAME */
598 0, /* TO_OBJECT => nothing */
599 0, /* TO_ARRAY => nothing */
600 0, /* TO_STRING => nothing */
601 0, /* TO_INT => nothing */
602 0, /* TO_FLOAT => nothing */
603 0, /* TO_BOOL => nothing */
604 0, /* VOID => nothing */
605 0, /* MIXED => nothing */
606 0, /* ARRAY => nothing */
607 0, /* OBJECT => nothing */
608 0, /* CALLABLE => nothing */
609 14, /* TEMP => NAME */
610 14, /* FREE => NAME */
611 14, /* SET => NAME */
612 14, /* LET => NAME */
613 14, /* RETURN => NAME */
614 14, /* CALLOC => NAME */
615 14, /* CALLBACK => NAME */
616 14, /* LIB => NAME */
617 };
618 #endif /* YYFALLBACK */
619
620 /* The following structure represents a single element of the
621 ** parser's stack. Information stored includes:
622 **
623 ** + The state number for the parser at this level of the stack.
624 **
625 ** + The value of the token stored at this level of the stack.
626 ** (In other words, the "major" token.)
627 **
628 ** + The semantic value stored at this level of the stack. This is
629 ** the information used by the action routines in the grammar.
630 ** It is sometimes called the "minor" token.
631 **
632 ** After the "shift" half of a SHIFTREDUCE action, the stateno field
633 ** actually contains the reduce action for the second half of the
634 ** SHIFTREDUCE.
635 */
636 struct yyStackEntry {
637 YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */
638 YYCODETYPE major; /* The major token value. This is the code
639 ** number for the token at this stack level */
640 YYMINORTYPE minor; /* The user-supplied minor token value. This
641 ** is the value of the token */
642 };
643 typedef struct yyStackEntry yyStackEntry;
644
645 /* The state of the parser is completely contained in an instance of
646 ** the following structure */
647 struct yyParser {
648 yyStackEntry *yytos; /* Pointer to top element of the stack */
649 #ifdef YYTRACKMAXSTACKDEPTH
650 int yyhwm; /* High-water mark of the stack */
651 #endif
652 #ifndef YYNOERRORRECOVERY
653 int yyerrcnt; /* Shifts left before out of the error */
654 #endif
655 ParseARG_SDECL /* A place to hold %extra_argument */
656 #if YYSTACKDEPTH<=0
657 int yystksz; /* Current side of the stack */
658 yyStackEntry *yystack; /* The parser's stack */
659 yyStackEntry yystk0; /* First stack entry */
660 #else
661 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
662 #endif
663 };
664 typedef struct yyParser yyParser;
665
666 #ifndef NDEBUG
667 #include <stdio.h>
668 static FILE *yyTraceFILE = 0;
669 static char *yyTracePrompt = 0;
670 #endif /* NDEBUG */
671
672 #ifndef NDEBUG
673 /*
674 ** Turn parser tracing on by giving a stream to which to write the trace
675 ** and a prompt to preface each trace message. Tracing is turned off
676 ** by making either argument NULL
677 **
678 ** Inputs:
679 ** <ul>
680 ** <li> A FILE* to which trace output should be written.
681 ** If NULL, then tracing is turned off.
682 ** <li> A prefix string written at the beginning of every
683 ** line of trace output. If NULL, then tracing is
684 ** turned off.
685 ** </ul>
686 **
687 ** Outputs:
688 ** None.
689 */
690 void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
691 yyTraceFILE = TraceFILE;
692 yyTracePrompt = zTracePrompt;
693 if( yyTraceFILE==0 ) yyTracePrompt = 0;
694 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
695 }
696 #endif /* NDEBUG */
697
698 #ifndef NDEBUG
699 /* For tracing shifts, the names of all terminals and nonterminals
700 ** are required. The following table supplies these names */
701 static const char *const yyTokenName[] = {
702 "$", "BOOL", "INT", "FLOAT",
703 "STRING", "DOUBLE", "INT8", "UINT8",
704 "INT16", "UINT16", "INT32", "UINT32",
705 "INT64", "UINT64", "NAME", "NULL",
706 "NUMBER", "TRUE", "FALSE", "QUOTED_STRING",
707 "NSNAME", "PIPE", "CARET", "AMPERSAND",
708 "LSHIFT", "RSHIFT", "PLUS", "MINUS",
709 "ASTERISK", "SLASH", "MODULO", "RCHEVR",
710 "LCHEVR", "CMP_GE", "CMP_LE", "OR",
711 "AND", "CMP_EQ", "CMP_NE", "TILDE",
712 "NOT", "ZVAL", "OBJVAL", "ARRVAL",
713 "PATHVAL", "STRLEN", "STRVAL", "FLOATVAL",
714 "INTVAL", "BOOLVAL", "COUNT", "TO_OBJECT",
715 "TO_ARRAY", "TO_STRING", "TO_INT", "TO_FLOAT",
716 "TO_BOOL", "VOID", "MIXED", "ARRAY",
717 "OBJECT", "CALLABLE", "TEMP", "FREE",
718 "SET", "LET", "RETURN", "CALLOC",
719 "CALLBACK", "LIB", "EOF", "EOS",
720 "COLON", "LPAREN", "COMMA", "RPAREN",
721 "ENUM", "STRUCT", "UNION", "LBRACE",
722 "RBRACE", "EQUALS", "CONST", "TYPEDEF",
723 "ELLIPSIS", "LBRACKET", "RBRACKET", "CHAR",
724 "SHORT", "LONG", "UNSIGNED", "SIGNED",
725 "STATIC", "FUNCTION", "DOLLAR_NAME", "error",
726 "decl_enum", "decl_enum_items", "decl_enum_item", "decl_struct_args_block",
727 "decl_struct_args", "decl_struct", "align_and_size", "decl_union",
728 "const_type", "constant", "decl_typedef", "decl_typedef_body_ex",
729 "decl_typedef_body", "decl_typedef_body_fn_args", "decl", "decl_func",
730 "decl_abi", "decl_var", "decl_vars", "decl_arg",
731 "decl_args", "struct_args", "struct_arg", "decl_layout",
732 "decl_type", "const_decl_type", "impl", "impl_func",
733 "impl_def_val", "impl_var", "impl_arg", "impl_args",
734 "impl_vararg", "impl_stmts", "impl_stmt", "number",
735 "num_exp", "let_stmt", "let_calloc", "let_func",
736 "callback_arg_list", "callback_args", "let_callback", "let_exp",
737 "let_exps", "set_stmt", "set_exp", "set_exps",
738 "set_func", "return_stmt", "free_stmt", "free_exps",
739 "free_exp", "impl_type", "reference", "indirection",
740 "pointers", "file", "blocks", "block",
741 "optional_name", "enum_name", "struct_name", "union_name",
742 "decl_var_array_size", "decl_scalar_type", "decl_scalar_type_short", "decl_scalar_type_long",
743 "decl_scalar_type_long_long", "callback_rval",
744 };
745 #endif /* NDEBUG */
746
747 #ifndef NDEBUG
748 /* For tracing reduce actions, the names of all rules are required.
749 */
750 static const char *const yyRuleName[] = {
751 /* 0 */ "block ::= LIB QUOTED_STRING EOS",
752 /* 1 */ "block ::= decl",
753 /* 2 */ "block ::= impl",
754 /* 3 */ "block ::= decl_typedef",
755 /* 4 */ "block ::= constant",
756 /* 5 */ "block ::= decl_struct",
757 /* 6 */ "block ::= decl_union",
758 /* 7 */ "block ::= decl_enum",
759 /* 8 */ "optional_name ::=",
760 /* 9 */ "optional_name ::= NAME",
761 /* 10 */ "align_and_size ::=",
762 /* 11 */ "align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN",
763 /* 12 */ "enum_name ::= ENUM optional_name",
764 /* 13 */ "struct_name ::= STRUCT optional_name",
765 /* 14 */ "union_name ::= UNION optional_name",
766 /* 15 */ "decl_enum ::= enum_name LBRACE decl_enum_items RBRACE",
767 /* 16 */ "decl_enum_items ::= decl_enum_item",
768 /* 17 */ "decl_enum_items ::= decl_enum_items COMMA decl_enum_item",
769 /* 18 */ "decl_enum_item ::= NAME EQUALS num_exp",
770 /* 19 */ "decl_enum_item ::= NAME",
771 /* 20 */ "decl_struct_args_block ::= LBRACE struct_args RBRACE",
772 /* 21 */ "decl_struct_args ::= decl_struct_args_block",
773 /* 22 */ "decl_struct_args ::= EOS",
774 /* 23 */ "decl_struct ::= STRUCT NAME align_and_size decl_struct_args",
775 /* 24 */ "decl_union ::= UNION NAME align_and_size decl_struct_args",
776 /* 25 */ "const_type ::= BOOL|INT|FLOAT|STRING",
777 /* 26 */ "constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS",
778 /* 27 */ "decl_typedef ::= TYPEDEF decl_typedef_body EOS",
779 /* 28 */ "decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var",
780 /* 29 */ "decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var",
781 /* 30 */ "decl_typedef_body_ex ::= decl_enum NAME",
782 /* 31 */ "decl_typedef_body ::= decl_typedef_body_ex",
783 /* 32 */ "decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN",
784 /* 33 */ "decl_typedef_body ::= decl_func decl_typedef_body_fn_args",
785 /* 34 */ "decl_typedef_body ::= decl_arg",
786 /* 35 */ "decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS",
787 /* 36 */ "decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS",
788 /* 37 */ "decl_func ::= decl_arg",
789 /* 38 */ "decl_func ::= VOID NAME",
790 /* 39 */ "decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
791 /* 40 */ "decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
792 /* 41 */ "decl_abi ::= NAME",
793 /* 42 */ "decl_var_array_size ::=",
794 /* 43 */ "decl_var_array_size ::= LBRACKET NUMBER RBRACKET",
795 /* 44 */ "decl_var ::= NAME decl_var_array_size",
796 /* 45 */ "decl_var ::= pointers NAME decl_var_array_size",
797 /* 46 */ "decl_vars ::= decl_var",
798 /* 47 */ "decl_vars ::= decl_vars COMMA decl_var",
799 /* 48 */ "decl_arg ::= const_decl_type decl_var",
800 /* 49 */ "decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
801 /* 50 */ "decl_arg ::= VOID pointers NAME",
802 /* 51 */ "decl_arg ::= CONST VOID pointers NAME",
803 /* 52 */ "decl_args ::=",
804 /* 53 */ "decl_args ::= VOID",
805 /* 54 */ "decl_args ::= decl_arg",
806 /* 55 */ "decl_args ::= decl_args COMMA decl_arg",
807 /* 56 */ "struct_args ::= struct_arg",
808 /* 57 */ "struct_args ::= struct_args struct_arg",
809 /* 58 */ "struct_arg ::= decl_typedef_body_ex EOS",
810 /* 59 */ "struct_arg ::= decl_arg decl_layout EOS",
811 /* 60 */ "decl_layout ::=",
812 /* 61 */ "decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN",
813 /* 62 */ "decl_scalar_type ::= CHAR",
814 /* 63 */ "decl_scalar_type ::= SHORT decl_scalar_type_short",
815 /* 64 */ "decl_scalar_type_short ::=",
816 /* 65 */ "decl_scalar_type_short ::= INT",
817 /* 66 */ "decl_scalar_type ::= INT",
818 /* 67 */ "decl_scalar_type ::= LONG decl_scalar_type_long",
819 /* 68 */ "decl_scalar_type_long ::=",
820 /* 69 */ "decl_scalar_type_long ::= DOUBLE",
821 /* 70 */ "decl_scalar_type_long ::= LONG decl_scalar_type_long_long",
822 /* 71 */ "decl_scalar_type_long_long ::=",
823 /* 72 */ "decl_scalar_type_long_long ::= INT",
824 /* 73 */ "decl_type ::= UNSIGNED decl_scalar_type",
825 /* 74 */ "decl_type ::= SIGNED decl_scalar_type",
826 /* 75 */ "decl_type ::= UNSIGNED",
827 /* 76 */ "decl_type ::= SIGNED",
828 /* 77 */ "decl_type ::= decl_scalar_type",
829 /* 78 */ "decl_type ::= STRUCT NAME",
830 /* 79 */ "decl_type ::= UNION NAME",
831 /* 80 */ "decl_type ::= ENUM NAME",
832 /* 81 */ "decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME",
833 /* 82 */ "const_decl_type ::= decl_type",
834 /* 83 */ "const_decl_type ::= CONST decl_type",
835 /* 84 */ "impl ::= impl_func LBRACE impl_stmts RBRACE",
836 /* 85 */ "impl ::= STATIC impl_func LBRACE impl_stmts RBRACE",
837 /* 86 */ "impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type",
838 /* 87 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type",
839 /* 88 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type",
840 /* 89 */ "impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING",
841 /* 90 */ "impl_var ::= reference DOLLAR_NAME",
842 /* 91 */ "impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE",
843 /* 92 */ "impl_arg ::= impl_type impl_var",
844 /* 93 */ "impl_arg ::= impl_type impl_var EQUALS impl_def_val",
845 /* 94 */ "impl_args ::= impl_arg",
846 /* 95 */ "impl_args ::= impl_args COMMA impl_arg",
847 /* 96 */ "impl_stmts ::= impl_stmt",
848 /* 97 */ "impl_stmts ::= impl_stmts impl_stmt",
849 /* 98 */ "impl_stmt ::= return_stmt",
850 /* 99 */ "impl_stmt ::= let_stmt",
851 /* 100 */ "impl_stmt ::= set_stmt",
852 /* 101 */ "impl_stmt ::= free_stmt",
853 /* 102 */ "number ::= NUMBER|NSNAME",
854 /* 103 */ "number ::= decl_var",
855 /* 104 */ "num_exp ::= number",
856 /* 105 */ "num_exp ::= LPAREN num_exp RPAREN",
857 /* 106 */ "num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE num_exp",
858 /* 107 */ "num_exp ::= TILDE|NOT|PLUS|MINUS num_exp",
859 /* 108 */ "let_exp ::= NULL",
860 /* 109 */ "let_exp ::= AMPERSAND NULL",
861 /* 110 */ "let_exp ::= let_callback",
862 /* 111 */ "let_exp ::= let_calloc",
863 /* 112 */ "let_exp ::= AMPERSAND let_calloc",
864 /* 113 */ "let_exp ::= let_func",
865 /* 114 */ "let_exp ::= AMPERSAND let_func",
866 /* 115 */ "let_exp ::= num_exp",
867 /* 116 */ "let_exp ::= AMPERSAND num_exp",
868 /* 117 */ "let_exp ::= decl_var EQUALS let_exp",
869 /* 118 */ "let_stmt ::= LET let_exp EOS",
870 /* 119 */ "let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS",
871 /* 120 */ "let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN",
872 /* 121 */ "let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN",
873 /* 122 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN",
874 /* 123 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN",
875 /* 124 */ "let_exps ::= let_exp",
876 /* 125 */ "let_exps ::= let_exps COMMA let_exp",
877 /* 126 */ "callback_arg_list ::=",
878 /* 127 */ "callback_arg_list ::= callback_args",
879 /* 128 */ "callback_args ::= set_exp",
880 /* 129 */ "callback_args ::= callback_args COMMA set_exp",
881 /* 130 */ "callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT",
882 /* 131 */ "callback_rval ::= VOID",
883 /* 132 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN",
884 /* 133 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN",
885 /* 134 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN",
886 /* 135 */ "set_exp ::= set_func",
887 /* 136 */ "set_exp ::= num_exp",
888 /* 137 */ "set_exps ::= set_exp",
889 /* 138 */ "set_exps ::= set_exps COMMA set_exp",
890 /* 139 */ "set_exp ::= impl_var EQUALS set_exp",
891 /* 140 */ "set_stmt ::= SET set_exp EOS",
892 /* 141 */ "return_stmt ::= RETURN set_func EOS",
893 /* 142 */ "free_stmt ::= FREE free_exps EOS",
894 /* 143 */ "free_exps ::= free_exp",
895 /* 144 */ "free_exps ::= free_exps COMMA free_exp",
896 /* 145 */ "free_exp ::= NAME LPAREN decl_vars RPAREN",
897 /* 146 */ "reference ::=",
898 /* 147 */ "reference ::= AMPERSAND",
899 /* 148 */ "indirection ::=",
900 /* 149 */ "indirection ::= pointers",
901 /* 150 */ "pointers ::= ASTERISK",
902 /* 151 */ "pointers ::= pointers ASTERISK",
903 /* 152 */ "file ::= blocks",
904 /* 153 */ "blocks ::= block",
905 /* 154 */ "blocks ::= blocks block",
906 /* 155 */ "block ::= EOF",
907 /* 156 */ "block ::= EOS",
908 };
909 #endif /* NDEBUG */
910
911
912 #if YYSTACKDEPTH<=0
913 /*
914 ** Try to increase the size of the parser stack. Return the number
915 ** of errors. Return 0 on success.
916 */
917 static int yyGrowStack(yyParser *p){
918 int newSize;
919 int idx;
920 yyStackEntry *pNew;
921
922 newSize = p->yystksz*2 + 100;
923 idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
924 if( p->yystack==&p->yystk0 ){
925 pNew = malloc(newSize*sizeof(pNew[0]));
926 if( pNew ) pNew[0] = p->yystk0;
927 }else{
928 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
929 }
930 if( pNew ){
931 p->yystack = pNew;
932 p->yytos = &p->yystack[idx];
933 #ifndef NDEBUG
934 if( yyTraceFILE ){
935 fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
936 yyTracePrompt, p->yystksz, newSize);
937 }
938 #endif
939 p->yystksz = newSize;
940 }
941 return pNew==0;
942 }
943 #endif
944
945 /* Datatype of the argument to the memory allocated passed as the
946 ** second argument to ParseAlloc() below. This can be changed by
947 ** putting an appropriate #define in the %include section of the input
948 ** grammar.
949 */
950 #ifndef YYMALLOCARGTYPE
951 # define YYMALLOCARGTYPE size_t
952 #endif
953
954 /* Initialize a new parser that has already been allocated.
955 */
956 void ParseInit(void *yypParser){
957 yyParser *pParser = (yyParser*)yypParser;
958 #ifdef YYTRACKMAXSTACKDEPTH
959 pParser->yyhwm = 0;
960 #endif
961 #if YYSTACKDEPTH<=0
962 pParser->yytos = NULL;
963 pParser->yystack = NULL;
964 pParser->yystksz = 0;
965 if( yyGrowStack(pParser) ){
966 pParser->yystack = &pParser->yystk0;
967 pParser->yystksz = 1;
968 }
969 #endif
970 #ifndef YYNOERRORRECOVERY
971 pParser->yyerrcnt = -1;
972 #endif
973 pParser->yytos = pParser->yystack;
974 pParser->yystack[0].stateno = 0;
975 pParser->yystack[0].major = 0;
976 }
977
978 #ifndef Parse_ENGINEALWAYSONSTACK
979 /*
980 ** This function allocates a new parser.
981 ** The only argument is a pointer to a function which works like
982 ** malloc.
983 **
984 ** Inputs:
985 ** A pointer to the function used to allocate memory.
986 **
987 ** Outputs:
988 ** A pointer to a parser. This pointer is used in subsequent calls
989 ** to Parse and ParseFree.
990 */
991 void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
992 yyParser *pParser;
993 pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
994 if( pParser ) ParseInit(pParser);
995 return pParser;
996 }
997 #endif /* Parse_ENGINEALWAYSONSTACK */
998
999
1000 /* The following function deletes the "minor type" or semantic value
1001 ** associated with a symbol. The symbol can be either a terminal
1002 ** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
1003 ** a pointer to the value to be deleted. The code used to do the
1004 ** deletions is derived from the %destructor and/or %token_destructor
1005 ** directives of the input grammar.
1006 */
1007 static void yy_destructor(
1008 yyParser *yypParser, /* The parser */
1009 YYCODETYPE yymajor, /* Type code for object to destroy */
1010 YYMINORTYPE *yypminor /* The object to be destroyed */
1011 ){
1012 ParseARG_FETCH;
1013 switch( yymajor ){
1014 /* Here is inserted the actions which take place when a
1015 ** terminal or non-terminal is destroyed. This can happen
1016 ** when the symbol is popped from the stack during a
1017 ** reduce or during error processing or when a parser is
1018 ** being destroyed before it is finished parsing.
1019 **
1020 ** Note: during a reduce, the only symbols destroyed are those
1021 ** which appear on the RHS of the rule, but which are *not* used
1022 ** inside the C code.
1023 */
1024 /********* Begin destructor definitions ***************************************/
1025 /* TERMINAL Destructor */
1026 case 1: /* BOOL */
1027 case 2: /* INT */
1028 case 3: /* FLOAT */
1029 case 4: /* STRING */
1030 case 5: /* DOUBLE */
1031 case 6: /* INT8 */
1032 case 7: /* UINT8 */
1033 case 8: /* INT16 */
1034 case 9: /* UINT16 */
1035 case 10: /* INT32 */
1036 case 11: /* UINT32 */
1037 case 12: /* INT64 */
1038 case 13: /* UINT64 */
1039 case 14: /* NAME */
1040 case 15: /* NULL */
1041 case 16: /* NUMBER */
1042 case 17: /* TRUE */
1043 case 18: /* FALSE */
1044 case 19: /* QUOTED_STRING */
1045 case 20: /* NSNAME */
1046 case 21: /* PIPE */
1047 case 22: /* CARET */
1048 case 23: /* AMPERSAND */
1049 case 24: /* LSHIFT */
1050 case 25: /* RSHIFT */
1051 case 26: /* PLUS */
1052 case 27: /* MINUS */
1053 case 28: /* ASTERISK */
1054 case 29: /* SLASH */
1055 case 30: /* MODULO */
1056 case 31: /* RCHEVR */
1057 case 32: /* LCHEVR */
1058 case 33: /* CMP_GE */
1059 case 34: /* CMP_LE */
1060 case 35: /* OR */
1061 case 36: /* AND */
1062 case 37: /* CMP_EQ */
1063 case 38: /* CMP_NE */
1064 case 39: /* TILDE */
1065 case 40: /* NOT */
1066 case 41: /* ZVAL */
1067 case 42: /* OBJVAL */
1068 case 43: /* ARRVAL */
1069 case 44: /* PATHVAL */
1070 case 45: /* STRLEN */
1071 case 46: /* STRVAL */
1072 case 47: /* FLOATVAL */
1073 case 48: /* INTVAL */
1074 case 49: /* BOOLVAL */
1075 case 50: /* COUNT */
1076 case 51: /* TO_OBJECT */
1077 case 52: /* TO_ARRAY */
1078 case 53: /* TO_STRING */
1079 case 54: /* TO_INT */
1080 case 55: /* TO_FLOAT */
1081 case 56: /* TO_BOOL */
1082 case 57: /* VOID */
1083 case 58: /* MIXED */
1084 case 59: /* ARRAY */
1085 case 60: /* OBJECT */
1086 case 61: /* CALLABLE */
1087 case 62: /* TEMP */
1088 case 63: /* FREE */
1089 case 64: /* SET */
1090 case 65: /* LET */
1091 case 66: /* RETURN */
1092 case 67: /* CALLOC */
1093 case 68: /* CALLBACK */
1094 case 69: /* LIB */
1095 case 70: /* EOF */
1096 case 71: /* EOS */
1097 case 72: /* COLON */
1098 case 73: /* LPAREN */
1099 case 74: /* COMMA */
1100 case 75: /* RPAREN */
1101 case 76: /* ENUM */
1102 case 77: /* STRUCT */
1103 case 78: /* UNION */
1104 case 79: /* LBRACE */
1105 case 80: /* RBRACE */
1106 case 81: /* EQUALS */
1107 case 82: /* CONST */
1108 case 83: /* TYPEDEF */
1109 case 84: /* ELLIPSIS */
1110 case 85: /* LBRACKET */
1111 case 86: /* RBRACKET */
1112 case 87: /* CHAR */
1113 case 88: /* SHORT */
1114 case 89: /* LONG */
1115 case 90: /* UNSIGNED */
1116 case 91: /* SIGNED */
1117 case 92: /* STATIC */
1118 case 93: /* FUNCTION */
1119 case 94: /* DOLLAR_NAME */
1120 {
1121 #line 37 "src/parser_proc.y"
1122 free((yypminor->yy0));
1123 #line 1124 "src/parser_proc.c"
1124 }
1125 break;
1126 /* Default NON-TERMINAL Destructor */
1127 case 95: /* error */
1128 case 102: /* align_and_size */
1129 case 150: /* reference */
1130 case 151: /* indirection */
1131 case 152: /* pointers */
1132 case 153: /* file */
1133 case 154: /* blocks */
1134 case 155: /* block */
1135 case 156: /* optional_name */
1136 case 157: /* enum_name */
1137 case 158: /* struct_name */
1138 case 159: /* union_name */
1139 case 160: /* decl_var_array_size */
1140 case 161: /* decl_scalar_type */
1141 case 162: /* decl_scalar_type_short */
1142 case 163: /* decl_scalar_type_long */
1143 case 164: /* decl_scalar_type_long_long */
1144 case 165: /* callback_rval */
1145 {
1146 #line 38 "src/parser_proc.y"
1147 (void)P;
1148 #line 1149 "src/parser_proc.c"
1149 }
1150 break;
1151 case 96: /* decl_enum */
1152 {
1153 #line 63 "src/parser_proc.y"
1154 psi_decl_enum_free(&(yypminor->yy279));
1155 #line 1156 "src/parser_proc.c"
1156 }
1157 break;
1158 case 97: /* decl_enum_items */
1159 case 99: /* decl_struct_args_block */
1160 case 100: /* decl_struct_args */
1161 case 109: /* decl_typedef_body_fn_args */
1162 case 114: /* decl_vars */
1163 case 116: /* decl_args */
1164 case 117: /* struct_args */
1165 case 127: /* impl_args */
1166 case 129: /* impl_stmts */
1167 case 140: /* let_exps */
1168 case 143: /* set_exps */
1169 case 147: /* free_exps */
1170 {
1171 #line 65 "src/parser_proc.y"
1172 psi_plist_free((yypminor->yy303));
1173 #line 1174 "src/parser_proc.c"
1174 }
1175 break;
1176 case 98: /* decl_enum_item */
1177 {
1178 #line 67 "src/parser_proc.y"
1179 psi_decl_enum_item_free(&(yypminor->yy69));
1180 #line 1181 "src/parser_proc.c"
1181 }
1182 break;
1183 case 101: /* decl_struct */
1184 {
1185 #line 73 "src/parser_proc.y"
1186 psi_decl_struct_free(&(yypminor->yy271));
1187 #line 1188 "src/parser_proc.c"
1188 }
1189 break;
1190 case 103: /* decl_union */
1191 {
1192 #line 76 "src/parser_proc.y"
1193 psi_decl_union_free(&(yypminor->yy19));
1194 #line 1195 "src/parser_proc.c"
1195 }
1196 break;
1197 case 104: /* const_type */
1198 {
1199 #line 78 "src/parser_proc.y"
1200 psi_const_type_free(&(yypminor->yy7));
1201 #line 1202 "src/parser_proc.c"
1202 }
1203 break;
1204 case 105: /* constant */
1205 {
1206 #line 80 "src/parser_proc.y"
1207 psi_const_free(&(yypminor->yy106));
1208 #line 1209 "src/parser_proc.c"
1209 }
1210 break;
1211 case 106: /* decl_typedef */
1212 case 107: /* decl_typedef_body_ex */
1213 case 108: /* decl_typedef_body */
1214 case 111: /* decl_func */
1215 case 115: /* decl_arg */
1216 case 118: /* struct_arg */
1217 {
1218 #line 82 "src/parser_proc.y"
1219 psi_decl_arg_free(&(yypminor->yy260));
1220 #line 1221 "src/parser_proc.c"
1221 }
1222 break;
1223 case 110: /* decl */
1224 {
1225 #line 90 "src/parser_proc.y"
1226 psi_decl_free(&(yypminor->yy71));
1227 #line 1228 "src/parser_proc.c"
1228 }
1229 break;
1230 case 112: /* decl_abi */
1231 {
1232 #line 94 "src/parser_proc.y"
1233 psi_decl_abi_free(&(yypminor->yy242));
1234 #line 1235 "src/parser_proc.c"
1235 }
1236 break;
1237 case 113: /* decl_var */
1238 {
1239 #line 96 "src/parser_proc.y"
1240 psi_decl_var_free(&(yypminor->yy207));
1241 #line 1242 "src/parser_proc.c"
1242 }
1243 break;
1244 case 119: /* decl_layout */
1245 {
1246 #line 108 "src/parser_proc.y"
1247 psi_layout_free(&(yypminor->yy81));
1248 #line 1249 "src/parser_proc.c"
1249 }
1250 break;
1251 case 120: /* decl_type */
1252 case 121: /* const_decl_type */
1253 {
1254 #line 110 "src/parser_proc.y"
1255 psi_decl_type_free(&(yypminor->yy152));
1256 #line 1257 "src/parser_proc.c"
1257 }
1258 break;
1259 case 122: /* impl */
1260 {
1261 #line 114 "src/parser_proc.y"
1262 psi_impl_free(&(yypminor->yy49));
1263 #line 1264 "src/parser_proc.c"
1264 }
1265 break;
1266 case 123: /* impl_func */
1267 {
1268 #line 116 "src/parser_proc.y"
1269 psi_impl_func_free(&(yypminor->yy120));
1270 #line 1271 "src/parser_proc.c"
1271 }
1272 break;
1273 case 124: /* impl_def_val */
1274 {
1275 #line 118 "src/parser_proc.y"
1276 psi_impl_def_val_free(&(yypminor->yy21));
1277 #line 1278 "src/parser_proc.c"
1278 }
1279 break;
1280 case 125: /* impl_var */
1281 {
1282 #line 120 "src/parser_proc.y"
1283 psi_impl_var_free(&(yypminor->yy185));
1284 #line 1285 "src/parser_proc.c"
1285 }
1286 break;
1287 case 126: /* impl_arg */
1288 case 128: /* impl_vararg */
1289 {
1290 #line 122 "src/parser_proc.y"
1291 psi_impl_arg_free(&(yypminor->yy238));
1292 #line 1293 "src/parser_proc.c"
1293 }
1294 break;
1295 case 130: /* impl_stmt */
1296 {
1297 #line 130 "src/parser_proc.y"
1298 psi_impl_stmt_free(&(yypminor->yy38));
1299 #line 1300 "src/parser_proc.c"
1300 }
1301 break;
1302 case 131: /* number */
1303 {
1304 #line 132 "src/parser_proc.y"
1305 psi_number_free(&(yypminor->yy160));
1306 #line 1307 "src/parser_proc.c"
1307 }
1308 break;
1309 case 132: /* num_exp */
1310 {
1311 #line 134 "src/parser_proc.y"
1312 psi_num_exp_free(&(yypminor->yy39));
1313 #line 1314 "src/parser_proc.c"
1314 }
1315 break;
1316 case 133: /* let_stmt */
1317 {
1318 #line 136 "src/parser_proc.y"
1319 psi_let_stmt_free(&(yypminor->yy139));
1320 #line 1321 "src/parser_proc.c"
1321 }
1322 break;
1323 case 134: /* let_calloc */
1324 {
1325 #line 138 "src/parser_proc.y"
1326 psi_let_calloc_free(&(yypminor->yy17));
1327 #line 1328 "src/parser_proc.c"
1328 }
1329 break;
1330 case 135: /* let_func */
1331 {
1332 #line 140 "src/parser_proc.y"
1333 psi_let_func_free(&(yypminor->yy72));
1334 #line 1335 "src/parser_proc.c"
1335 }
1336 break;
1337 case 136: /* callback_arg_list */
1338 case 137: /* callback_args */
1339 {
1340 #line 142 "src/parser_proc.y"
1341 psi_plist_free((yypminor->yy287));
1342 #line 1343 "src/parser_proc.c"
1343 }
1344 break;
1345 case 138: /* let_callback */
1346 {
1347 #line 146 "src/parser_proc.y"
1348 psi_let_callback_free(&(yypminor->yy164));
1349 #line 1350 "src/parser_proc.c"
1350 }
1351 break;
1352 case 139: /* let_exp */
1353 {
1354 #line 148 "src/parser_proc.y"
1355 psi_let_exp_free(&(yypminor->yy144));
1356 #line 1357 "src/parser_proc.c"
1357 }
1358 break;
1359 case 141: /* set_stmt */
1360 {
1361 #line 152 "src/parser_proc.y"
1362 psi_set_stmt_free(&(yypminor->yy226));
1363 #line 1364 "src/parser_proc.c"
1364 }
1365 break;
1366 case 142: /* set_exp */
1367 {
1368 #line 154 "src/parser_proc.y"
1369 psi_set_exp_free(&(yypminor->yy67));
1370 #line 1371 "src/parser_proc.c"
1371 }
1372 break;
1373 case 144: /* set_func */
1374 {
1375 #line 158 "src/parser_proc.y"
1376 psi_set_func_free(&(yypminor->yy78));
1377 #line 1378 "src/parser_proc.c"
1378 }
1379 break;
1380 case 145: /* return_stmt */
1381 {
1382 #line 160 "src/parser_proc.y"
1383 psi_return_stmt_free(&(yypminor->yy130));
1384 #line 1385 "src/parser_proc.c"
1385 }
1386 break;
1387 case 146: /* free_stmt */
1388 {
1389 #line 162 "src/parser_proc.y"
1390 psi_free_stmt_free(&(yypminor->yy76));
1391 #line 1392 "src/parser_proc.c"
1392 }
1393 break;
1394 case 148: /* free_exp */
1395 {
1396 #line 166 "src/parser_proc.y"
1397 psi_free_exp_free(&(yypminor->yy197));
1398 #line 1399 "src/parser_proc.c"
1399 }
1400 break;
1401 case 149: /* impl_type */
1402 {
1403 #line 168 "src/parser_proc.y"
1404 psi_impl_type_free(&(yypminor->yy142));
1405 #line 1406 "src/parser_proc.c"
1406 }
1407 break;
1408 /********* End destructor definitions *****************************************/
1409 default: break; /* If no destructor action specified: do nothing */
1410 }
1411 }
1412
1413 /*
1414 ** Pop the parser's stack once.
1415 **
1416 ** If there is a destructor routine associated with the token which
1417 ** is popped from the stack, then call it.
1418 */
1419 static void yy_pop_parser_stack(yyParser *pParser){
1420 yyStackEntry *yytos;
1421 assert( pParser->yytos!=0 );
1422 assert( pParser->yytos > pParser->yystack );
1423 yytos = pParser->yytos--;
1424 #ifndef NDEBUG
1425 if( yyTraceFILE ){
1426 fprintf(yyTraceFILE,"%sPopping %s\n",
1427 yyTracePrompt,
1428 yyTokenName[yytos->major]);
1429 }
1430 #endif
1431 yy_destructor(pParser, yytos->major, &yytos->minor);
1432 }
1433
1434 /*
1435 ** Clear all secondary memory allocations from the parser
1436 */
1437 void ParseFinalize(void *p){
1438 yyParser *pParser = (yyParser*)p;
1439 while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
1440 #if YYSTACKDEPTH<=0
1441 if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
1442 #endif
1443 }
1444
1445 #ifndef Parse_ENGINEALWAYSONSTACK
1446 /*
1447 ** Deallocate and destroy a parser. Destructors are called for
1448 ** all stack elements before shutting the parser down.
1449 **
1450 ** If the YYPARSEFREENEVERNULL macro exists (for example because it
1451 ** is defined in a %include section of the input grammar) then it is
1452 ** assumed that the input pointer is never NULL.
1453 */
1454 void ParseFree(
1455 void *p, /* The parser to be deleted */
1456 void (*freeProc)(void*) /* Function used to reclaim memory */
1457 ){
1458 #ifndef YYPARSEFREENEVERNULL
1459 if( p==0 ) return;
1460 #endif
1461 ParseFinalize(p);
1462 (*freeProc)(p);
1463 }
1464 #endif /* Parse_ENGINEALWAYSONSTACK */
1465
1466 /*
1467 ** Return the peak depth of the stack for a parser.
1468 */
1469 #ifdef YYTRACKMAXSTACKDEPTH
1470 int ParseStackPeak(void *p){
1471 yyParser *pParser = (yyParser*)p;
1472 return pParser->yyhwm;
1473 }
1474 #endif
1475
1476 /*
1477 ** Find the appropriate action for a parser given the terminal
1478 ** look-ahead token iLookAhead.
1479 */
1480 static unsigned int yy_find_shift_action(
1481 yyParser *pParser, /* The parser */
1482 YYCODETYPE iLookAhead /* The look-ahead token */
1483 ){
1484 int i;
1485 int stateno = pParser->yytos->stateno;
1486
1487 if( stateno>=YY_MIN_REDUCE ) return stateno;
1488 assert( stateno <= YY_SHIFT_COUNT );
1489 do{
1490 i = yy_shift_ofst[stateno];
1491 assert( iLookAhead!=YYNOCODE );
1492 i += iLookAhead;
1493 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
1494 #ifdef YYFALLBACK
1495 YYCODETYPE iFallback; /* Fallback token */
1496 if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
1497 && (iFallback = yyFallback[iLookAhead])!=0 ){
1498 #ifndef NDEBUG
1499 if( yyTraceFILE ){
1500 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
1501 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
1502 }
1503 #endif
1504 assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
1505 iLookAhead = iFallback;
1506 continue;
1507 }
1508 #endif
1509 #ifdef YYWILDCARD
1510 {
1511 int j = i - iLookAhead + YYWILDCARD;
1512 if(
1513 #if YY_SHIFT_MIN+YYWILDCARD<0
1514 j>=0 &&
1515 #endif
1516 #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
1517 j<YY_ACTTAB_COUNT &&
1518 #endif
1519 yy_lookahead[j]==YYWILDCARD && iLookAhead>0
1520 ){
1521 #ifndef NDEBUG
1522 if( yyTraceFILE ){
1523 fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
1524 yyTracePrompt, yyTokenName[iLookAhead],
1525 yyTokenName[YYWILDCARD]);
1526 }
1527 #endif /* NDEBUG */
1528 return yy_action[j];
1529 }
1530 }
1531 #endif /* YYWILDCARD */
1532 return yy_default[stateno];
1533 }else{
1534 return yy_action[i];
1535 }
1536 }while(1);
1537 }
1538
1539 /*
1540 ** Find the appropriate action for a parser given the non-terminal
1541 ** look-ahead token iLookAhead.
1542 */
1543 static int yy_find_reduce_action(
1544 int stateno, /* Current state number */
1545 YYCODETYPE iLookAhead /* The look-ahead token */
1546 ){
1547 int i;
1548 #ifdef YYERRORSYMBOL
1549 if( stateno>YY_REDUCE_COUNT ){
1550 return yy_default[stateno];
1551 }
1552 #else
1553 assert( stateno<=YY_REDUCE_COUNT );
1554 #endif
1555 i = yy_reduce_ofst[stateno];
1556 assert( i!=YY_REDUCE_USE_DFLT );
1557 assert( iLookAhead!=YYNOCODE );
1558 i += iLookAhead;
1559 #ifdef YYERRORSYMBOL
1560 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
1561 return yy_default[stateno];
1562 }
1563 #else
1564 assert( i>=0 && i<YY_ACTTAB_COUNT );
1565 assert( yy_lookahead[i]==iLookAhead );
1566 #endif
1567 return yy_action[i];
1568 }
1569
1570 /*
1571 ** The following routine is called if the stack overflows.
1572 */
1573 static void yyStackOverflow(yyParser *yypParser){
1574 ParseARG_FETCH;
1575 #ifndef NDEBUG
1576 if( yyTraceFILE ){
1577 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
1578 }
1579 #endif
1580 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1581 /* Here code is inserted which will execute if the parser
1582 ** stack every overflows */
1583 /******** Begin %stack_overflow code ******************************************/
1584 /******** End %stack_overflow code ********************************************/
1585 ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
1586 }
1587
1588 /*
1589 ** Print tracing information for a SHIFT action
1590 */
1591 #ifndef NDEBUG
1592 static void yyTraceShift(yyParser *yypParser, int yyNewState){
1593 if( yyTraceFILE ){
1594 if( yyNewState<YYNSTATE ){
1595 fprintf(yyTraceFILE,"%sShift '%s', go to state %d\n",
1596 yyTracePrompt,yyTokenName[yypParser->yytos->major],
1597 yyNewState);
1598 }else{
1599 fprintf(yyTraceFILE,"%sShift '%s'\n",
1600 yyTracePrompt,yyTokenName[yypParser->yytos->major]);
1601 }
1602 }
1603 }
1604 #else
1605 # define yyTraceShift(X,Y)
1606 #endif
1607
1608 /*
1609 ** Perform a shift action.
1610 */
1611 static void yy_shift(
1612 yyParser *yypParser, /* The parser to be shifted */
1613 int yyNewState, /* The new state to shift in */
1614 int yyMajor, /* The major token to shift in */
1615 ParseTOKENTYPE yyMinor /* The minor token to shift in */
1616 ){
1617 yyStackEntry *yytos;
1618 yypParser->yytos++;
1619 #ifdef YYTRACKMAXSTACKDEPTH
1620 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1621 yypParser->yyhwm++;
1622 assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
1623 }
1624 #endif
1625 #if YYSTACKDEPTH>0
1626 if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){
1627 yypParser->yytos--;
1628 yyStackOverflow(yypParser);
1629 return;
1630 }
1631 #else
1632 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
1633 if( yyGrowStack(yypParser) ){
1634 yypParser->yytos--;
1635 yyStackOverflow(yypParser);
1636 return;
1637 }
1638 }
1639 #endif
1640 if( yyNewState > YY_MAX_SHIFT ){
1641 yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
1642 }
1643 yytos = yypParser->yytos;
1644 yytos->stateno = (YYACTIONTYPE)yyNewState;
1645 yytos->major = (YYCODETYPE)yyMajor;
1646 yytos->minor.yy0 = yyMinor;
1647 yyTraceShift(yypParser, yyNewState);
1648 }
1649
1650 /* The following table contains information about every rule that
1651 ** is used during the reduce.
1652 */
1653 static const struct {
1654 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
1655 unsigned char nrhs; /* Number of right-hand side symbols in the rule */
1656 } yyRuleInfo[] = {
1657 { 155, 3 },
1658 { 155, 1 },
1659 { 155, 1 },
1660 { 155, 1 },
1661 { 155, 1 },
1662 { 155, 1 },
1663 { 155, 1 },
1664 { 155, 1 },
1665 { 156, 0 },
1666 { 156, 1 },
1667 { 102, 0 },
1668 { 102, 7 },
1669 { 157, 2 },
1670 { 158, 2 },
1671 { 159, 2 },
1672 { 96, 4 },
1673 { 97, 1 },
1674 { 97, 3 },
1675 { 98, 3 },
1676 { 98, 1 },
1677 { 99, 3 },
1678 { 100, 1 },
1679 { 100, 1 },
1680 { 101, 4 },
1681 { 103, 4 },
1682 { 104, 1 },
1683 { 105, 6 },
1684 { 106, 3 },
1685 { 107, 4 },
1686 { 107, 4 },
1687 { 107, 2 },
1688 { 108, 1 },
1689 { 109, 3 },
1690 { 108, 2 },
1691 { 108, 1 },
1692 { 110, 6 },
1693 { 110, 8 },
1694 { 111, 1 },
1695 { 111, 2 },
1696 { 108, 7 },
1697 { 108, 8 },
1698 { 112, 1 },
1699 { 160, 0 },
1700 { 160, 3 },
1701 { 113, 2 },
1702 { 113, 3 },
1703 { 114, 1 },
1704 { 114, 3 },
1705 { 115, 2 },
1706 { 108, 7 },
1707 { 115, 3 },
1708 { 115, 4 },
1709 { 116, 0 },
1710 { 116, 1 },
1711 { 116, 1 },
1712 { 116, 3 },
1713 { 117, 1 },
1714 { 117, 2 },
1715 { 118, 2 },
1716 { 118, 3 },
1717 { 119, 0 },
1718 { 119, 7 },
1719 { 161, 1 },
1720 { 161, 2 },
1721 { 162, 0 },
1722 { 162, 1 },
1723 { 161, 1 },
1724 { 161, 2 },
1725 { 163, 0 },
1726 { 163, 1 },
1727 { 163, 2 },
1728 { 164, 0 },
1729 { 164, 1 },
1730 { 120, 2 },
1731 { 120, 2 },
1732 { 120, 1 },
1733 { 120, 1 },
1734 { 120, 1 },
1735 { 120, 2 },
1736 { 120, 2 },
1737 { 120, 2 },
1738 { 120, 1 },
1739 { 121, 1 },
1740 { 121, 2 },
1741 { 122, 4 },
1742 { 122, 5 },
1743 { 123, 7 },
1744 { 123, 8 },
1745 { 123, 13 },
1746 { 124, 1 },
1747 { 125, 2 },
1748 { 149, 1 },
1749 { 126, 2 },
1750 { 126, 4 },
1751 { 127, 1 },
1752 { 127, 3 },
1753 { 129, 1 },
1754 { 129, 2 },
1755 { 130, 1 },
1756 { 130, 1 },
1757 { 130, 1 },
1758 { 130, 1 },
1759 { 131, 1 },
1760 { 131, 1 },
1761 { 132, 1 },
1762 { 132, 3 },
1763 { 132, 3 },
1764 { 132, 2 },
1765 { 139, 1 },
1766 { 139, 2 },
1767 { 139, 1 },
1768 { 139, 1 },
1769 { 139, 2 },
1770 { 139, 1 },
1771 { 139, 2 },
1772 { 139, 1 },
1773 { 139, 2 },
1774 { 139, 3 },
1775 { 133, 3 },
1776 { 133, 6 },
1777 { 138, 8 },
1778 { 134, 6 },
1779 { 135, 4 },
1780 { 135, 6 },
1781 { 140, 1 },
1782 { 140, 3 },
1783 { 136, 0 },
1784 { 136, 1 },
1785 { 137, 1 },
1786 { 137, 3 },
1787 { 165, 1 },
1788 { 165, 1 },
1789 { 144, 4 },
1790 { 144, 6 },
1791 { 144, 6 },
1792 { 142, 1 },
1793 { 142, 1 },
1794 { 143, 1 },
1795 { 143, 3 },
1796 { 142, 3 },
1797 { 141, 3 },
1798 { 145, 3 },
1799 { 146, 3 },
1800 { 147, 1 },
1801 { 147, 3 },
1802 { 148, 4 },
1803 { 150, 0 },
1804 { 150, 1 },
1805 { 151, 0 },
1806 { 151, 1 },
1807 { 152, 1 },
1808 { 152, 2 },
1809 { 153, 1 },
1810 { 154, 1 },
1811 { 154, 2 },
1812 { 155, 1 },
1813 { 155, 1 },
1814 };
1815
1816 static void yy_accept(yyParser*); /* Forward Declaration */
1817
1818 /*
1819 ** Perform a reduce action and the shift that must immediately
1820 ** follow the reduce.
1821 */
1822 static void yy_reduce(
1823 yyParser *yypParser, /* The parser */
1824 unsigned int yyruleno /* Number of the rule by which to reduce */
1825 ){
1826 int yygoto; /* The next state */
1827 int yyact; /* The next action */
1828 yyStackEntry *yymsp; /* The top of the parser's stack */
1829 int yysize; /* Amount to pop the stack */
1830 ParseARG_FETCH;
1831 yymsp = yypParser->yytos;
1832 #ifndef NDEBUG
1833 if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
1834 yysize = yyRuleInfo[yyruleno].nrhs;
1835 fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
1836 yyRuleName[yyruleno], yymsp[-yysize].stateno);
1837 }
1838 #endif /* NDEBUG */
1839
1840 /* Check that the stack is large enough to grow by a single entry
1841 ** if the RHS of the rule is empty. This ensures that there is room
1842 ** enough on the stack to push the LHS value */
1843 if( yyRuleInfo[yyruleno].nrhs==0 ){
1844 #ifdef YYTRACKMAXSTACKDEPTH
1845 if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1846 yypParser->yyhwm++;
1847 assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
1848 }
1849 #endif
1850 #if YYSTACKDEPTH>0
1851 if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){
1852 yyStackOverflow(yypParser);
1853 return;
1854 }
1855 #else
1856 if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
1857 if( yyGrowStack(yypParser) ){
1858 yyStackOverflow(yypParser);
1859 return;
1860 }
1861 yymsp = yypParser->yytos;
1862 }
1863 #endif
1864 }
1865
1866 switch( yyruleno ){
1867 /* Beginning here are the reduction cases. A typical example
1868 ** follows:
1869 ** case 0:
1870 ** #line <lineno> <grammarfile>
1871 ** { ... } // User supplied code
1872 ** #line <lineno> <thisfile>
1873 ** break;
1874 */
1875 /********** Begin reduce actions **********************************************/
1876 YYMINORTYPE yylhsminor;
1877 case 0: /* block ::= LIB QUOTED_STRING EOS */
1878 #line 177 "src/parser_proc.y"
1879 {
1880 if (P->file.ln) {
1881 P->error(PSI_DATA(P), yymsp[-2].minor.yy0, PSI_WARNING, "Extra 'lib %s' statement has no effect", yymsp[-1].minor.yy0->text);
1882 } else {
1883 P->file.ln = strndup(yymsp[-1].minor.yy0->text + 1, yymsp[-1].minor.yy0->size - 2);
1884 }
1885 free(yymsp[-1].minor.yy0);
1886 free(yymsp[-2].minor.yy0);
1887 }
1888 #line 1889 "src/parser_proc.c"
1889 yy_destructor(yypParser,71,&yymsp[0].minor);
1890 break;
1891 case 1: /* block ::= decl */
1892 #line 186 "src/parser_proc.y"
1893 {
1894 if (!P->decls) {
1895 P->decls = psi_plist_init((psi_plist_dtor) psi_decl_free);
1896 }
1897 P->decls = psi_plist_add(P->decls, &yymsp[0].minor.yy71);
1898 }
1899 #line 1900 "src/parser_proc.c"
1900 break;
1901 case 2: /* block ::= impl */
1902 #line 192 "src/parser_proc.y"
1903 {
1904 if (!P->impls) {
1905 P->impls = psi_plist_init((psi_plist_dtor) psi_impl_free);
1906 }
1907 P->impls = psi_plist_add(P->impls, &yymsp[0].minor.yy49);
1908 }
1909 #line 1910 "src/parser_proc.c"
1910 break;
1911 case 3: /* block ::= decl_typedef */
1912 #line 198 "src/parser_proc.y"
1913 {
1914 if (!P->types) {
1915 P->types = psi_plist_init((psi_plist_dtor) psi_decl_arg_free);
1916 }
1917 P->types = psi_plist_add(P->types, &yymsp[0].minor.yy260);
1918 switch (yymsp[0].minor.yy260->type->type) {
1919 case PSI_T_STRUCT:
1920 if (yymsp[0].minor.yy260->type->real.strct) {
1921 if (!P->structs) {
1922 P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free);
1923 }
1924 P->structs = psi_plist_add(P->structs, &yymsp[0].minor.yy260->type->real.strct);
1925 }
1926 break;
1927 case PSI_T_UNION:
1928 if (yymsp[0].minor.yy260->type->real.unn) {
1929 if (!P->unions) {
1930 P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free);
1931 }
1932 P->unions = psi_plist_add(P->unions, &yymsp[0].minor.yy260->type->real.unn);
1933 }
1934 break;
1935 case PSI_T_ENUM:
1936 if (yymsp[0].minor.yy260->type->real.enm) {
1937 if (!P->enums) {
1938 P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free);
1939 }
1940 P->enums = psi_plist_add(P->enums, &yymsp[0].minor.yy260->type->real.enm);
1941 }
1942 break;
1943 }
1944 }
1945 #line 1946 "src/parser_proc.c"
1946 break;
1947 case 4: /* block ::= constant */
1948 #line 230 "src/parser_proc.y"
1949 {
1950 if (!P->consts) {
1951 P->consts = psi_plist_init((psi_plist_dtor) psi_const_free);
1952 }
1953 P->consts = psi_plist_add(P->consts, &yymsp[0].minor.yy106);
1954 }
1955 #line 1956 "src/parser_proc.c"
1956 break;
1957 case 5: /* block ::= decl_struct */
1958 #line 236 "src/parser_proc.y"
1959 {
1960 if (!P->structs) {
1961 P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free);
1962 }
1963 P->structs = psi_plist_add(P->structs, &yymsp[0].minor.yy271);
1964 }
1965 #line 1966 "src/parser_proc.c"
1966 break;
1967 case 6: /* block ::= decl_union */
1968 #line 242 "src/parser_proc.y"
1969 {
1970 if (!P->unions) {
1971 P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free);
1972 }
1973 P->unions = psi_plist_add(P->unions, &yymsp[0].minor.yy19);
1974 }
1975 #line 1976 "src/parser_proc.c"
1976 break;
1977 case 7: /* block ::= decl_enum */
1978 #line 248 "src/parser_proc.y"
1979 {
1980 if (!P->enums) {
1981 P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free);
1982 }
1983 P->enums = psi_plist_add(P->enums, &yymsp[0].minor.yy279);
1984 }
1985 #line 1986 "src/parser_proc.c"
1986 break;
1987 case 8: /* optional_name ::= */
1988 case 42: /* decl_var_array_size ::= */ yytestcase(yyruleno==42);
1989 case 64: /* decl_scalar_type_short ::= */ yytestcase(yyruleno==64);
1990 case 68: /* decl_scalar_type_long ::= */ yytestcase(yyruleno==68);
1991 case 71: /* decl_scalar_type_long_long ::= */ yytestcase(yyruleno==71);
1992 #line 254 "src/parser_proc.y"
1993 {
1994 yymsp[1].minor.yy0 = NULL;
1995 }
1996 #line 1997 "src/parser_proc.c"
1997 break;
1998 case 9: /* optional_name ::= NAME */
1999 case 62: /* decl_scalar_type ::= CHAR */ yytestcase(yyruleno==62);
2000 case 65: /* decl_scalar_type_short ::= INT */ yytestcase(yyruleno==65);
2001 case 66: /* decl_scalar_type ::= INT */ yytestcase(yyruleno==66);
2002 case 69: /* decl_scalar_type_long ::= DOUBLE */ yytestcase(yyruleno==69);
2003 case 72: /* decl_scalar_type_long_long ::= INT */ yytestcase(yyruleno==72);
2004 case 130: /* callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT */ yytestcase(yyruleno==130);
2005 case 131: /* callback_rval ::= VOID */ yytestcase(yyruleno==131);
2006 #line 257 "src/parser_proc.y"
2007 {
2008 yylhsminor.yy0 = yymsp[0].minor.yy0;
2009 }
2010 #line 2011 "src/parser_proc.c"
2011 yymsp[0].minor.yy0 = yylhsminor.yy0;
2012 break;
2013 case 10: /* align_and_size ::= */
2014 #line 260 "src/parser_proc.y"
2015 {
2016 yymsp[1].minor.yy323.pos = 0;
2017 yymsp[1].minor.yy323.len = 0;
2018 }
2019 #line 2020 "src/parser_proc.c"
2020 break;
2021 case 11: /* align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */
2022 { yy_destructor(yypParser,72,&yymsp[-6].minor);
2023 #line 264 "src/parser_proc.y"
2024 {
2025 yymsp[-6].minor.yy323.pos = atol(yymsp[-3].minor.yy0->text);
2026 yymsp[-6].minor.yy323.len = atol(yymsp[-1].minor.yy0->text);
2027 free(yymsp[-3].minor.yy0);
2028 free(yymsp[-1].minor.yy0);
2029 }
2030 #line 2031 "src/parser_proc.c"
2031 yy_destructor(yypParser,72,&yymsp[-5].minor);
2032 yy_destructor(yypParser,73,&yymsp[-4].minor);
2033 yy_destructor(yypParser,74,&yymsp[-2].minor);
2034 yy_destructor(yypParser,75,&yymsp[0].minor);
2035 }
2036 break;
2037 case 12: /* enum_name ::= ENUM optional_name */
2038 case 13: /* struct_name ::= STRUCT optional_name */ yytestcase(yyruleno==13);
2039 case 14: /* union_name ::= UNION optional_name */ yytestcase(yyruleno==14);
2040 #line 270 "src/parser_proc.y"
2041 {
2042 if (yymsp[0].minor.yy0) {
2043 yylhsminor.yy0 = yymsp[0].minor.yy0;
2044 free(yymsp[-1].minor.yy0);
2045 } else {
2046 char digest[17];
2047 psi_token_hash(yymsp[-1].minor.yy0, digest);
2048 yylhsminor.yy0 = psi_token_translit(psi_token_append(yymsp[-1].minor.yy0, 1, digest), " ", "@");
2049 }
2050 }
2051 #line 2052 "src/parser_proc.c"
2052 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2053 break;
2054 case 15: /* decl_enum ::= enum_name LBRACE decl_enum_items RBRACE */
2055 #line 300 "src/parser_proc.y"
2056 {
2057 yylhsminor.yy279 = psi_decl_enum_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy303);
2058 yylhsminor.yy279->token = yymsp[-3].minor.yy0;
2059 }
2060 #line 2061 "src/parser_proc.c"
2061 yy_destructor(yypParser,79,&yymsp[-2].minor);
2062 yy_destructor(yypParser,80,&yymsp[0].minor);
2063 yymsp[-3].minor.yy279 = yylhsminor.yy279;
2064 break;
2065 case 16: /* decl_enum_items ::= decl_enum_item */
2066 #line 304 "src/parser_proc.y"
2067 {
2068 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_enum_item_free),
2069 &yymsp[0].minor.yy69);
2070 }
2071 #line 2072 "src/parser_proc.c"
2072 yymsp[0].minor.yy303 = yylhsminor.yy303;
2073 break;
2074 case 17: /* decl_enum_items ::= decl_enum_items COMMA decl_enum_item */
2075 #line 308 "src/parser_proc.y"
2076 {
2077 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy69);
2078 }
2079 #line 2080 "src/parser_proc.c"
2080 yy_destructor(yypParser,74,&yymsp[-1].minor);
2081 yymsp[-2].minor.yy303 = yylhsminor.yy303;
2082 break;
2083 case 18: /* decl_enum_item ::= NAME EQUALS num_exp */
2084 #line 311 "src/parser_proc.y"
2085 {
2086 yylhsminor.yy69 = psi_decl_enum_item_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy39);
2087 yylhsminor.yy69->token = yymsp[-2].minor.yy0;
2088 }
2089 #line 2090 "src/parser_proc.c"
2090 yy_destructor(yypParser,81,&yymsp[-1].minor);
2091 yymsp[-2].minor.yy69 = yylhsminor.yy69;
2092 break;
2093 case 19: /* decl_enum_item ::= NAME */
2094 #line 315 "src/parser_proc.y"
2095 {
2096 yylhsminor.yy69 = psi_decl_enum_item_init(yymsp[0].minor.yy0->text, NULL);
2097 yylhsminor.yy69->token = yymsp[0].minor.yy0;
2098 }
2099 #line 2100 "src/parser_proc.c"
2100 yymsp[0].minor.yy69 = yylhsminor.yy69;
2101 break;
2102 case 20: /* decl_struct_args_block ::= LBRACE struct_args RBRACE */
2103 { yy_destructor(yypParser,79,&yymsp[-2].minor);
2104 #line 319 "src/parser_proc.y"
2105 {
2106 yymsp[-2].minor.yy303 = yymsp[-1].minor.yy303;
2107 }
2108 #line 2109 "src/parser_proc.c"
2109 yy_destructor(yypParser,80,&yymsp[0].minor);
2110 }
2111 break;
2112 case 21: /* decl_struct_args ::= decl_struct_args_block */
2113 #line 322 "src/parser_proc.y"
2114 {
2115 yylhsminor.yy303 = yymsp[0].minor.yy303;
2116 }
2117 #line 2118 "src/parser_proc.c"
2118 yymsp[0].minor.yy303 = yylhsminor.yy303;
2119 break;
2120 case 22: /* decl_struct_args ::= EOS */
2121 { yy_destructor(yypParser,71,&yymsp[0].minor);
2122 #line 325 "src/parser_proc.y"
2123 {
2124 yymsp[0].minor.yy303 = psi_plist_init((psi_plist_dtor) psi_decl_arg_free);
2125 }
2126 #line 2127 "src/parser_proc.c"
2127 }
2128 break;
2129 case 23: /* decl_struct ::= STRUCT NAME align_and_size decl_struct_args */
2130 { yy_destructor(yypParser,77,&yymsp[-3].minor);
2131 #line 328 "src/parser_proc.y"
2132 {
2133 yymsp[-3].minor.yy271 = psi_decl_struct_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy303);
2134 yymsp[-3].minor.yy271->align = yymsp[-1].minor.yy323.pos;
2135 yymsp[-3].minor.yy271->size = yymsp[-1].minor.yy323.len;
2136 yymsp[-3].minor.yy271->token = yymsp[-2].minor.yy0;
2137 }
2138 #line 2139 "src/parser_proc.c"
2139 }
2140 break;
2141 case 24: /* decl_union ::= UNION NAME align_and_size decl_struct_args */
2142 { yy_destructor(yypParser,78,&yymsp[-3].minor);
2143 #line 334 "src/parser_proc.y"
2144 {
2145 yymsp[-3].minor.yy19 = psi_decl_union_init(yymsp[-2].minor.yy0->text, yymsp[0].minor.yy303);
2146 yymsp[-3].minor.yy19->align = yymsp[-1].minor.yy323.pos;
2147 yymsp[-3].minor.yy19->size = yymsp[-1].minor.yy323.len;
2148 yymsp[-3].minor.yy19->token = yymsp[-2].minor.yy0;
2149 }
2150 #line 2151 "src/parser_proc.c"
2151 }
2152 break;
2153 case 25: /* const_type ::= BOOL|INT|FLOAT|STRING */
2154 #line 340 "src/parser_proc.y"
2155 {
2156 yylhsminor.yy7 = psi_const_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text);
2157 free(yymsp[0].minor.yy0);
2158 }
2159 #line 2160 "src/parser_proc.c"
2160 yymsp[0].minor.yy7 = yylhsminor.yy7;
2161 break;
2162 case 26: /* constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS */
2163 { yy_destructor(yypParser,82,&yymsp[-5].minor);
2164 #line 344 "src/parser_proc.y"
2165 {
2166 yymsp[-5].minor.yy106 = psi_const_init(yymsp[-4].minor.yy7, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy21);
2167 yymsp[-5].minor.yy106->token = yymsp[-3].minor.yy0;
2168 }
2169 #line 2170 "src/parser_proc.c"
2170 yy_destructor(yypParser,81,&yymsp[-2].minor);
2171 yy_destructor(yypParser,71,&yymsp[0].minor);
2172 }
2173 break;
2174 case 27: /* decl_typedef ::= TYPEDEF decl_typedef_body EOS */
2175 #line 348 "src/parser_proc.y"
2176 {
2177 yylhsminor.yy260 = yymsp[-1].minor.yy260;
2178 yylhsminor.yy260->token = yymsp[-2].minor.yy0;
2179 }
2180 #line 2181 "src/parser_proc.c"
2181 yy_destructor(yypParser,71,&yymsp[0].minor);
2182 yymsp[-2].minor.yy260 = yylhsminor.yy260;
2183 break;
2184 case 28: /* decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var */
2185 #line 352 "src/parser_proc.y"
2186 {
2187 yylhsminor.yy260 = psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT, yymsp[-3].minor.yy0->text), yymsp[0].minor.yy207);
2188 yylhsminor.yy260->type->token = psi_token_copy(yymsp[-3].minor.yy0);
2189 yylhsminor.yy260->type->real.strct = psi_decl_struct_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy303);
2190 yylhsminor.yy260->type->real.strct->token = yymsp[-3].minor.yy0;
2191 yylhsminor.yy260->type->real.strct->align = yymsp[-2].minor.yy323.pos;
2192 yylhsminor.yy260->type->real.strct->size = yymsp[-2].minor.yy323.len;
2193 }
2194 #line 2195 "src/parser_proc.c"
2195 yymsp[-3].minor.yy260 = yylhsminor.yy260;
2196 break;
2197 case 29: /* decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var */
2198 #line 360 "src/parser_proc.y"
2199 {
2200 yylhsminor.yy260 = psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION, yymsp[-3].minor.yy0->text), yymsp[0].minor.yy207);
2201 yylhsminor.yy260->type->token = psi_token_copy(yymsp[-3].minor.yy0);
2202 yylhsminor.yy260->type->real.unn = psi_decl_union_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy303);
2203 yylhsminor.yy260->type->real.unn->token = yymsp[-3].minor.yy0;
2204 yylhsminor.yy260->type->real.unn->align = yymsp[-2].minor.yy323.pos;
2205 yylhsminor.yy260->type->real.unn->size = yymsp[-2].minor.yy323.len;
2206 }
2207 #line 2208 "src/parser_proc.c"
2208 yymsp[-3].minor.yy260 = yylhsminor.yy260;
2209 break;
2210 case 30: /* decl_typedef_body_ex ::= decl_enum NAME */
2211 #line 368 "src/parser_proc.y"
2212 {
2213 yylhsminor.yy260 = psi_decl_arg_init(psi_decl_type_init(PSI_T_ENUM, yymsp[-1].minor.yy279->name), psi_decl_var_init(yymsp[0].minor.yy0->text, 0, 0));
2214 yylhsminor.yy260->var->token = yymsp[0].minor.yy0;
2215 yylhsminor.yy260->type->token = psi_token_copy(yymsp[-1].minor.yy279->token);
2216 yylhsminor.yy260->type->real.enm = yymsp[-1].minor.yy279;
2217 }
2218 #line 2219 "src/parser_proc.c"
2219 yymsp[-1].minor.yy260 = yylhsminor.yy260;
2220 break;
2221 case 31: /* decl_typedef_body ::= decl_typedef_body_ex */
2222 case 34: /* decl_typedef_body ::= decl_arg */ yytestcase(yyruleno==34);
2223 case 37: /* decl_func ::= decl_arg */ yytestcase(yyruleno==37);
2224 #line 374 "src/parser_proc.y"
2225 {
2226 yylhsminor.yy260 = yymsp[0].minor.yy260;
2227 }
2228 #line 2229 "src/parser_proc.c"
2229 yymsp[0].minor.yy260 = yylhsminor.yy260;
2230 break;
2231 case 32: /* decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN */
2232 { yy_destructor(yypParser,73,&yymsp[-2].minor);
2233 #line 377 "src/parser_proc.y"
2234 {
2235 yymsp[-2].minor.yy303 = yymsp[-1].minor.yy303;
2236 }
2237 #line 2238 "src/parser_proc.c"
2238 yy_destructor(yypParser,75,&yymsp[0].minor);
2239 }
2240 break;
2241 case 33: /* decl_typedef_body ::= decl_func decl_typedef_body_fn_args */
2242 #line 380 "src/parser_proc.y"
2243 {
2244 yylhsminor.yy260 = psi_decl_arg_init(psi_decl_type_init(PSI_T_FUNCTION, yymsp[-1].minor.yy260->var->name), psi_decl_var_copy(yymsp[-1].minor.yy260->var));
2245 yylhsminor.yy260->type->token = psi_token_copy(yymsp[-1].minor.yy260->token);
2246 yylhsminor.yy260->type->real.func = psi_decl_init(psi_decl_abi_init("default"), yymsp[-1].minor.yy260, yymsp[0].minor.yy303);
2247 }
2248 #line 2249 "src/parser_proc.c"
2249 yymsp[-1].minor.yy260 = yylhsminor.yy260;
2250 break;
2251 case 35: /* decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS */
2252 #line 388 "src/parser_proc.y"
2253 {
2254 yylhsminor.yy71 = psi_decl_init(yymsp[-5].minor.yy242, yymsp[-4].minor.yy260, yymsp[-2].minor.yy303);
2255 }
2256 #line 2257 "src/parser_proc.c"
2257 yy_destructor(yypParser,73,&yymsp[-3].minor);
2258 yy_destructor(yypParser,75,&yymsp[-1].minor);
2259 yy_destructor(yypParser,71,&yymsp[0].minor);
2260 yymsp[-5].minor.yy71 = yylhsminor.yy71;
2261 break;
2262 case 36: /* decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS */
2263 #line 391 "src/parser_proc.y"
2264 {
2265 yylhsminor.yy71 = psi_decl_init(yymsp[-7].minor.yy242, yymsp[-6].minor.yy260, yymsp[-4].minor.yy303);
2266 yylhsminor.yy71->varargs = 1;
2267 }
2268 #line 2269 "src/parser_proc.c"
2269 yy_destructor(yypParser,73,&yymsp[-5].minor);
2270 yy_destructor(yypParser,74,&yymsp[-3].minor);
2271 yy_destructor(yypParser,84,&yymsp[-2].minor);
2272 yy_destructor(yypParser,75,&yymsp[-1].minor);
2273 yy_destructor(yypParser,71,&yymsp[0].minor);
2274 yymsp[-7].minor.yy71 = yylhsminor.yy71;
2275 break;
2276 case 38: /* decl_func ::= VOID NAME */
2277 #line 398 "src/parser_proc.y"
2278 {
2279 yylhsminor.yy260 = psi_decl_arg_init(
2280 psi_decl_type_init(yymsp[-1].minor.yy0->type, yymsp[-1].minor.yy0->text),
2281 psi_decl_var_init(yymsp[0].minor.yy0->text, 0, 0)
2282 );
2283 yylhsminor.yy260->type->token = yymsp[-1].minor.yy0;
2284 yylhsminor.yy260->var->token = yymsp[0].minor.yy0;
2285 yylhsminor.yy260->token = yymsp[0].minor.yy0;
2286 }
2287 #line 2288 "src/parser_proc.c"
2288 yymsp[-1].minor.yy260 = yylhsminor.yy260;
2289 break;
2290 case 39: /* decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2291 #line 407 "src/parser_proc.y"
2292 {
2293 struct psi_decl_arg *func_ = psi_decl_arg_init(
2294 psi_decl_type_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text),
2295 psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy190, 0)
2296 );
2297 func_->type->token = yymsp[-6].minor.yy0;
2298 func_->var->token = yymsp[-2].minor.yy0;
2299 func_->token = yymsp[-2].minor.yy0;
2300 yylhsminor.yy260 = psi_decl_arg_init(
2301 psi_decl_type_init(PSI_T_FUNCTION, func_->var->name),
2302 psi_decl_var_copy(func_->var)
2303 );
2304 yylhsminor.yy260->var->pointer_level = yymsp[-3].minor.yy190;
2305 yylhsminor.yy260->type->token = psi_token_copy(func_->token);
2306 yylhsminor.yy260->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy303);
2307 }
2308 #line 2309 "src/parser_proc.c"
2309 yy_destructor(yypParser,73,&yymsp[-4].minor);
2310 yy_destructor(yypParser,75,&yymsp[-1].minor);
2311 yymsp[-6].minor.yy260 = yylhsminor.yy260;
2312 break;
2313 case 40: /* decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2314 { yy_destructor(yypParser,82,&yymsp[-7].minor);
2315 #line 423 "src/parser_proc.y"
2316 {
2317 struct psi_decl_arg *func_ = psi_decl_arg_init(
2318 psi_decl_type_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text),
2319 psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy190, 0)
2320 );
2321 func_->type->token = yymsp[-6].minor.yy0;
2322 func_->var->token = yymsp[-2].minor.yy0;
2323 func_->token = yymsp[-2].minor.yy0;
2324 yymsp[-7].minor.yy260 = psi_decl_arg_init(
2325 psi_decl_type_init(PSI_T_FUNCTION, func_->var->name),
2326 psi_decl_var_copy(func_->var)
2327 );
2328 yymsp[-7].minor.yy260->var->pointer_level = yymsp[-3].minor.yy190;
2329 yymsp[-7].minor.yy260->type->token = psi_token_copy(func_->token);
2330 yymsp[-7].minor.yy260->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy303);
2331 }
2332 #line 2333 "src/parser_proc.c"
2333 yy_destructor(yypParser,73,&yymsp[-4].minor);
2334 yy_destructor(yypParser,75,&yymsp[-1].minor);
2335 }
2336 break;
2337 case 41: /* decl_abi ::= NAME */
2338 #line 439 "src/parser_proc.y"
2339 {
2340 yylhsminor.yy242 = psi_decl_abi_init(yymsp[0].minor.yy0->text);
2341 yylhsminor.yy242->token = yymsp[0].minor.yy0;
2342 }
2343 #line 2344 "src/parser_proc.c"
2344 yymsp[0].minor.yy242 = yylhsminor.yy242;
2345 break;
2346 case 43: /* decl_var_array_size ::= LBRACKET NUMBER RBRACKET */
2347 { yy_destructor(yypParser,85,&yymsp[-2].minor);
2348 #line 446 "src/parser_proc.y"
2349 {
2350 yymsp[-2].minor.yy0 = yymsp[-1].minor.yy0;
2351 }
2352 #line 2353 "src/parser_proc.c"
2353 yy_destructor(yypParser,86,&yymsp[0].minor);
2354 }
2355 break;
2356 case 44: /* decl_var ::= NAME decl_var_array_size */
2357 #line 449 "src/parser_proc.y"
2358 {
2359 yylhsminor.yy207 = psi_decl_var_init(yymsp[-1].minor.yy0->text, 0, yymsp[0].minor.yy0?atol(yymsp[0].minor.yy0->text):0);
2360 yylhsminor.yy207->token = yymsp[-1].minor.yy0;
2361 if (yymsp[0].minor.yy0) {
2362 free(yymsp[0].minor.yy0);
2363 }
2364 }
2365 #line 2366 "src/parser_proc.c"
2366 yymsp[-1].minor.yy207 = yylhsminor.yy207;
2367 break;
2368 case 45: /* decl_var ::= pointers NAME decl_var_array_size */
2369 #line 456 "src/parser_proc.y"
2370 {
2371 yylhsminor.yy207 = psi_decl_var_init(yymsp[-1].minor.yy0->text, yymsp[-2].minor.yy190+!!yymsp[0].minor.yy0, yymsp[0].minor.yy0?atol(yymsp[0].minor.yy0->text):0);
2372 yylhsminor.yy207->token = yymsp[-1].minor.yy0;
2373 if (yymsp[0].minor.yy0) {
2374 free(yymsp[0].minor.yy0);
2375 }
2376 }
2377 #line 2378 "src/parser_proc.c"
2378 yymsp[-2].minor.yy207 = yylhsminor.yy207;
2379 break;
2380 case 46: /* decl_vars ::= decl_var */
2381 #line 463 "src/parser_proc.y"
2382 {
2383 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_var_free),
2384 &yymsp[0].minor.yy207);
2385 }
2386 #line 2387 "src/parser_proc.c"
2387 yymsp[0].minor.yy303 = yylhsminor.yy303;
2388 break;
2389 case 47: /* decl_vars ::= decl_vars COMMA decl_var */
2390 #line 467 "src/parser_proc.y"
2391 {
2392 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy207);
2393 }
2394 #line 2395 "src/parser_proc.c"
2395 yy_destructor(yypParser,74,&yymsp[-1].minor);
2396 yymsp[-2].minor.yy303 = yylhsminor.yy303;
2397 break;
2398 case 48: /* decl_arg ::= const_decl_type decl_var */
2399 #line 470 "src/parser_proc.y"
2400 {
2401 yylhsminor.yy260 = psi_decl_arg_init(yymsp[-1].minor.yy152, yymsp[0].minor.yy207);
2402 }
2403 #line 2404 "src/parser_proc.c"
2404 yymsp[-1].minor.yy260 = yylhsminor.yy260;
2405 break;
2406 case 49: /* decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2407 #line 473 "src/parser_proc.y"
2408 {
2409 struct psi_decl_arg *func_ = psi_decl_arg_init(
2410 yymsp[-6].minor.yy152,
2411 psi_decl_var_init(yymsp[-2].minor.yy0->text, yymsp[-5].minor.yy190, 0)
2412 );
2413 func_->var->token = yymsp[-2].minor.yy0;
2414 func_->token = yymsp[-2].minor.yy0;
2415 yylhsminor.yy260 = psi_decl_arg_init(
2416 psi_decl_type_init(PSI_T_FUNCTION, func_->var->name),
2417 psi_decl_var_copy(func_->var)
2418 );
2419 yylhsminor.yy260->var->pointer_level = yymsp[-3].minor.yy190;
2420 yylhsminor.yy260->type->token = psi_token_copy(func_->token);
2421 yylhsminor.yy260->type->real.func = psi_decl_init(psi_decl_abi_init("default"), func_, yymsp[0].minor.yy303);
2422 }
2423 #line 2424 "src/parser_proc.c"
2424 yy_destructor(yypParser,73,&yymsp[-4].minor);
2425 yy_destructor(yypParser,75,&yymsp[-1].minor);
2426 yymsp[-6].minor.yy260 = yylhsminor.yy260;
2427 break;
2428 case 50: /* decl_arg ::= VOID pointers NAME */
2429 #line 488 "src/parser_proc.y"
2430 {
2431 yylhsminor.yy260 = psi_decl_arg_init(
2432 psi_decl_type_init(yymsp[-2].minor.yy0->type, yymsp[-2].minor.yy0->text),
2433 psi_decl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy190, 0)
2434 );
2435 yylhsminor.yy260->type->token = yymsp[-2].minor.yy0;
2436 yylhsminor.yy260->var->token = yymsp[0].minor.yy0;
2437 yylhsminor.yy260->token = yymsp[0].minor.yy0;
2438 }
2439 #line 2440 "src/parser_proc.c"
2440 yymsp[-2].minor.yy260 = yylhsminor.yy260;
2441 break;
2442 case 51: /* decl_arg ::= CONST VOID pointers NAME */
2443 { yy_destructor(yypParser,82,&yymsp[-3].minor);
2444 #line 497 "src/parser_proc.y"
2445 {
2446 yymsp[-3].minor.yy260 = psi_decl_arg_init(
2447 psi_decl_type_init(yymsp[-2].minor.yy0->type, yymsp[-2].minor.yy0->text),
2448 psi_decl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy190, 0)
2449 );
2450 yymsp[-3].minor.yy260->type->token = yymsp[-2].minor.yy0;
2451 yymsp[-3].minor.yy260->var->token = yymsp[0].minor.yy0;
2452 yymsp[-3].minor.yy260->token = yymsp[0].minor.yy0;
2453 }
2454 #line 2455 "src/parser_proc.c"
2455 }
2456 break;
2457 case 52: /* decl_args ::= */
2458 #line 506 "src/parser_proc.y"
2459 {
2460 yymsp[1].minor.yy303 = NULL;
2461 }
2462 #line 2463 "src/parser_proc.c"
2463 break;
2464 case 53: /* decl_args ::= VOID */
2465 { yy_destructor(yypParser,57,&yymsp[0].minor);
2466 #line 509 "src/parser_proc.y"
2467 {
2468 yymsp[0].minor.yy303 = NULL;
2469 }
2470 #line 2471 "src/parser_proc.c"
2471 }
2472 break;
2473 case 54: /* decl_args ::= decl_arg */
2474 case 56: /* struct_args ::= struct_arg */ yytestcase(yyruleno==56);
2475 #line 512 "src/parser_proc.y"
2476 {
2477 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_decl_arg_free),
2478 &yymsp[0].minor.yy260);
2479 }
2480 #line 2481 "src/parser_proc.c"
2481 yymsp[0].minor.yy303 = yylhsminor.yy303;
2482 break;
2483 case 55: /* decl_args ::= decl_args COMMA decl_arg */
2484 #line 516 "src/parser_proc.y"
2485 {
2486 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy260);
2487 }
2488 #line 2489 "src/parser_proc.c"
2489 yy_destructor(yypParser,74,&yymsp[-1].minor);
2490 yymsp[-2].minor.yy303 = yylhsminor.yy303;
2491 break;
2492 case 57: /* struct_args ::= struct_args struct_arg */
2493 #line 523 "src/parser_proc.y"
2494 {
2495 yylhsminor.yy303 = psi_plist_add(yymsp[-1].minor.yy303, &yymsp[0].minor.yy260);
2496 }
2497 #line 2498 "src/parser_proc.c"
2498 yymsp[-1].minor.yy303 = yylhsminor.yy303;
2499 break;
2500 case 58: /* struct_arg ::= decl_typedef_body_ex EOS */
2501 #line 526 "src/parser_proc.y"
2502 {
2503 yylhsminor.yy260 = yymsp[-1].minor.yy260;
2504 switch (yymsp[-1].minor.yy260->type->type) {
2505 case PSI_T_STRUCT:
2506 if (yymsp[-1].minor.yy260->type->real.strct) {
2507 if (!P->structs) {
2508 P->structs = psi_plist_init((psi_plist_dtor) psi_decl_struct_free);
2509 }
2510 P->structs = psi_plist_add(P->structs, &yymsp[-1].minor.yy260->type->real.strct);
2511 }
2512 break;
2513 case PSI_T_UNION:
2514 if (yymsp[-1].minor.yy260->type->real.unn) {
2515 if (!P->unions) {
2516 P->unions = psi_plist_init((psi_plist_dtor) psi_decl_union_free);
2517 }
2518 P->unions = psi_plist_add(P->unions, &yymsp[-1].minor.yy260->type->real.unn);
2519 }
2520 break;
2521 case PSI_T_ENUM:
2522 if (yymsp[-1].minor.yy260->type->real.enm) {
2523 if (!P->enums) {
2524 P->enums = psi_plist_init((psi_plist_dtor) psi_decl_enum_free);
2525 }
2526 P->enums = psi_plist_add(P->enums, &yymsp[-1].minor.yy260->type->real.enm);
2527 }
2528 break;
2529 }
2530 }
2531 #line 2532 "src/parser_proc.c"
2532 yy_destructor(yypParser,71,&yymsp[0].minor);
2533 yymsp[-1].minor.yy260 = yylhsminor.yy260;
2534 break;
2535 case 59: /* struct_arg ::= decl_arg decl_layout EOS */
2536 #line 555 "src/parser_proc.y"
2537 {
2538 yymsp[-2].minor.yy260->layout = yymsp[-1].minor.yy81;
2539 yylhsminor.yy260 = yymsp[-2].minor.yy260;
2540 }
2541 #line 2542 "src/parser_proc.c"
2542 yy_destructor(yypParser,71,&yymsp[0].minor);
2543 yymsp[-2].minor.yy260 = yylhsminor.yy260;
2544 break;
2545 case 60: /* decl_layout ::= */
2546 #line 559 "src/parser_proc.y"
2547 {
2548 yymsp[1].minor.yy81 = NULL;
2549 }
2550 #line 2551 "src/parser_proc.c"
2551 break;
2552 case 61: /* decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */
2553 { yy_destructor(yypParser,72,&yymsp[-6].minor);
2554 #line 562 "src/parser_proc.y"
2555 {
2556 yymsp[-6].minor.yy81 = psi_layout_init(atol(yymsp[-3].minor.yy0->text), atol(yymsp[-1].minor.yy0->text));
2557 free(yymsp[-3].minor.yy0);
2558 free(yymsp[-1].minor.yy0);
2559 }
2560 #line 2561 "src/parser_proc.c"
2561 yy_destructor(yypParser,72,&yymsp[-5].minor);
2562 yy_destructor(yypParser,73,&yymsp[-4].minor);
2563 yy_destructor(yypParser,74,&yymsp[-2].minor);
2564 yy_destructor(yypParser,75,&yymsp[0].minor);
2565 }
2566 break;
2567 case 63: /* decl_scalar_type ::= SHORT decl_scalar_type_short */
2568 case 67: /* decl_scalar_type ::= LONG decl_scalar_type_long */ yytestcase(yyruleno==67);
2569 case 70: /* decl_scalar_type_long ::= LONG decl_scalar_type_long_long */ yytestcase(yyruleno==70);
2570 #line 570 "src/parser_proc.y"
2571 {
2572 if (yymsp[0].minor.yy0) {
2573 yylhsminor.yy0 = psi_token_cat(2, yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
2574 free(yymsp[-1].minor.yy0);
2575 free(yymsp[0].minor.yy0);
2576 } else {
2577 yylhsminor.yy0 = yymsp[-1].minor.yy0;
2578 }
2579 }
2580 #line 2581 "src/parser_proc.c"
2581 yymsp[-1].minor.yy0 = yylhsminor.yy0;
2582 break;
2583 case 73: /* decl_type ::= UNSIGNED decl_scalar_type */
2584 case 74: /* decl_type ::= SIGNED decl_scalar_type */ yytestcase(yyruleno==74);
2585 #line 618 "src/parser_proc.y"
2586 {
2587 struct psi_token *T = psi_token_cat(2, yymsp[-1].minor.yy0, yymsp[0].minor.yy0);
2588 yylhsminor.yy152 = psi_decl_type_init(T->type, T->text);
2589 yylhsminor.yy152->token = T;
2590 free(yymsp[-1].minor.yy0);
2591 free(yymsp[0].minor.yy0);
2592 }
2593 #line 2594 "src/parser_proc.c"
2594 yymsp[-1].minor.yy152 = yylhsminor.yy152;
2595 break;
2596 case 75: /* decl_type ::= UNSIGNED */
2597 case 76: /* decl_type ::= SIGNED */ yytestcase(yyruleno==76);
2598 #line 632 "src/parser_proc.y"
2599 {
2600 yylhsminor.yy152 = psi_decl_type_init(PSI_T_NAME, yymsp[0].minor.yy0->text);
2601 yylhsminor.yy152->token = yymsp[0].minor.yy0;
2602 }
2603 #line 2604 "src/parser_proc.c"
2604 yymsp[0].minor.yy152 = yylhsminor.yy152;
2605 break;
2606 case 77: /* decl_type ::= decl_scalar_type */
2607 case 81: /* decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME */ yytestcase(yyruleno==81);
2608 #line 640 "src/parser_proc.y"
2609 {
2610 yylhsminor.yy152 = psi_decl_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text);
2611 yylhsminor.yy152->token = yymsp[0].minor.yy0;
2612 }
2613 #line 2614 "src/parser_proc.c"
2614 yymsp[0].minor.yy152 = yylhsminor.yy152;
2615 break;
2616 case 78: /* decl_type ::= STRUCT NAME */
2617 case 79: /* decl_type ::= UNION NAME */ yytestcase(yyruleno==79);
2618 case 80: /* decl_type ::= ENUM NAME */ yytestcase(yyruleno==80);
2619 #line 644 "src/parser_proc.y"
2620 {
2621 yylhsminor.yy152 = psi_decl_type_init(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy0->text);
2622 yylhsminor.yy152->token = yymsp[0].minor.yy0;
2623 free(yymsp[-1].minor.yy0);
2624 }
2625 #line 2626 "src/parser_proc.c"
2626 yymsp[-1].minor.yy152 = yylhsminor.yy152;
2627 break;
2628 case 82: /* const_decl_type ::= decl_type */
2629 #line 663 "src/parser_proc.y"
2630 {
2631 yylhsminor.yy152 = yymsp[0].minor.yy152;
2632 }
2633 #line 2634 "src/parser_proc.c"
2634 yymsp[0].minor.yy152 = yylhsminor.yy152;
2635 break;
2636 case 83: /* const_decl_type ::= CONST decl_type */
2637 { yy_destructor(yypParser,82,&yymsp[-1].minor);
2638 #line 666 "src/parser_proc.y"
2639 {
2640 yymsp[-1].minor.yy152 = yymsp[0].minor.yy152;
2641 }
2642 #line 2643 "src/parser_proc.c"
2643 }
2644 break;
2645 case 84: /* impl ::= impl_func LBRACE impl_stmts RBRACE */
2646 #line 669 "src/parser_proc.y"
2647 {
2648 yylhsminor.yy49 = psi_impl_init(yymsp[-3].minor.yy120, yymsp[-1].minor.yy303);
2649 }
2650 #line 2651 "src/parser_proc.c"
2651 yy_destructor(yypParser,79,&yymsp[-2].minor);
2652 yy_destructor(yypParser,80,&yymsp[0].minor);
2653 yymsp[-3].minor.yy49 = yylhsminor.yy49;
2654 break;
2655 case 85: /* impl ::= STATIC impl_func LBRACE impl_stmts RBRACE */
2656 { yy_destructor(yypParser,92,&yymsp[-4].minor);
2657 #line 672 "src/parser_proc.y"
2658 {
2659 yymsp[-3].minor.yy120->static_memory = 1;
2660 yymsp[-4].minor.yy49 = psi_impl_init(yymsp[-3].minor.yy120, yymsp[-1].minor.yy303);
2661 }
2662 #line 2663 "src/parser_proc.c"
2663 yy_destructor(yypParser,79,&yymsp[-2].minor);
2664 yy_destructor(yypParser,80,&yymsp[0].minor);
2665 }
2666 break;
2667 case 86: /* impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type */
2668 { yy_destructor(yypParser,93,&yymsp[-6].minor);
2669 #line 676 "src/parser_proc.y"
2670 {
2671 yymsp[-6].minor.yy120 = psi_impl_func_init(yymsp[-4].minor.yy0->text, NULL, yymsp[0].minor.yy142);
2672 yymsp[-6].minor.yy120->token = yymsp[-4].minor.yy0;
2673 yymsp[-6].minor.yy120->return_reference = yymsp[-5].minor.yy273;
2674 }
2675 #line 2676 "src/parser_proc.c"
2676 yy_destructor(yypParser,73,&yymsp[-3].minor);
2677 yy_destructor(yypParser,75,&yymsp[-2].minor);
2678 yy_destructor(yypParser,72,&yymsp[-1].minor);
2679 }
2680 break;
2681 case 87: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type */
2682 { yy_destructor(yypParser,93,&yymsp[-7].minor);
2683 #line 681 "src/parser_proc.y"
2684 {
2685 yymsp[-7].minor.yy120 = psi_impl_func_init(yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy303, yymsp[0].minor.yy142);
2686 yymsp[-7].minor.yy120->token = yymsp[-5].minor.yy0;
2687 yymsp[-7].minor.yy120->return_reference = yymsp[-6].minor.yy273;
2688 }
2689 #line 2690 "src/parser_proc.c"
2690 yy_destructor(yypParser,73,&yymsp[-4].minor);
2691 yy_destructor(yypParser,75,&yymsp[-2].minor);
2692 yy_destructor(yypParser,72,&yymsp[-1].minor);
2693 }
2694 break;
2695 case 88: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type */
2696 { yy_destructor(yypParser,93,&yymsp[-12].minor);
2697 #line 686 "src/parser_proc.y"
2698 {
2699 yymsp[-12].minor.yy120 = psi_impl_func_init(yymsp[-10].minor.yy0->text, yymsp[-8].minor.yy303, yymsp[0].minor.yy142);
2700 yymsp[-12].minor.yy120->token = yymsp[-10].minor.yy0;
2701 yymsp[-12].minor.yy120->return_reference = yymsp[-11].minor.yy273;
2702 yymsp[-12].minor.yy120->vararg = psi_impl_arg_init(yymsp[-6].minor.yy142, psi_impl_var_init(yymsp[-3].minor.yy0->text, yymsp[-5].minor.yy273), NULL);
2703 free(yymsp[-3].minor.yy0);
2704 }
2705 #line 2706 "src/parser_proc.c"
2706 yy_destructor(yypParser,73,&yymsp[-9].minor);
2707 yy_destructor(yypParser,74,&yymsp[-7].minor);
2708 yy_destructor(yypParser,84,&yymsp[-4].minor);
2709 yy_destructor(yypParser,75,&yymsp[-2].minor);
2710 yy_destructor(yypParser,72,&yymsp[-1].minor);
2711 }
2712 break;
2713 case 89: /* impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING */
2714 #line 693 "src/parser_proc.y"
2715 {
2716 yylhsminor.yy21 = psi_impl_def_val_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text);
2717 yylhsminor.yy21->token = yymsp[0].minor.yy0;
2718 }
2719 #line 2720 "src/parser_proc.c"
2720 yymsp[0].minor.yy21 = yylhsminor.yy21;
2721 break;
2722 case 90: /* impl_var ::= reference DOLLAR_NAME */
2723 #line 697 "src/parser_proc.y"
2724 {
2725 yylhsminor.yy185 = psi_impl_var_init(yymsp[0].minor.yy0->text, yymsp[-1].minor.yy273);
2726 yylhsminor.yy185->token = yymsp[0].minor.yy0;
2727 }
2728 #line 2729 "src/parser_proc.c"
2729 yymsp[-1].minor.yy185 = yylhsminor.yy185;
2730 break;
2731 case 91: /* impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE */
2732 #line 701 "src/parser_proc.y"
2733 {
2734 yylhsminor.yy142 = psi_impl_type_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text);
2735 free(yymsp[0].minor.yy0);
2736 }
2737 #line 2738 "src/parser_proc.c"
2738 yymsp[0].minor.yy142 = yylhsminor.yy142;
2739 break;
2740 case 92: /* impl_arg ::= impl_type impl_var */
2741 #line 705 "src/parser_proc.y"
2742 {
2743 yylhsminor.yy238 = psi_impl_arg_init(yymsp[-1].minor.yy142, yymsp[0].minor.yy185, NULL);
2744 }
2745 #line 2746 "src/parser_proc.c"
2746 yymsp[-1].minor.yy238 = yylhsminor.yy238;
2747 break;
2748 case 93: /* impl_arg ::= impl_type impl_var EQUALS impl_def_val */
2749 #line 708 "src/parser_proc.y"
2750 {
2751 yylhsminor.yy238 = psi_impl_arg_init(yymsp[-3].minor.yy142, yymsp[-2].minor.yy185, yymsp[0].minor.yy21);
2752 }
2753 #line 2754 "src/parser_proc.c"
2754 yy_destructor(yypParser,81,&yymsp[-1].minor);
2755 yymsp[-3].minor.yy238 = yylhsminor.yy238;
2756 break;
2757 case 94: /* impl_args ::= impl_arg */
2758 #line 711 "src/parser_proc.y"
2759 {
2760 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_arg_free),
2761 &yymsp[0].minor.yy238);
2762 }
2763 #line 2764 "src/parser_proc.c"
2764 yymsp[0].minor.yy303 = yylhsminor.yy303;
2765 break;
2766 case 95: /* impl_args ::= impl_args COMMA impl_arg */
2767 #line 715 "src/parser_proc.y"
2768 {
2769 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy238);
2770 }
2771 #line 2772 "src/parser_proc.c"
2772 yy_destructor(yypParser,74,&yymsp[-1].minor);
2773 yymsp[-2].minor.yy303 = yylhsminor.yy303;
2774 break;
2775 case 96: /* impl_stmts ::= impl_stmt */
2776 #line 718 "src/parser_proc.y"
2777 {
2778 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_impl_stmt_free),
2779 &yymsp[0].minor.yy38);
2780 }
2781 #line 2782 "src/parser_proc.c"
2782 yymsp[0].minor.yy303 = yylhsminor.yy303;
2783 break;
2784 case 97: /* impl_stmts ::= impl_stmts impl_stmt */
2785 #line 722 "src/parser_proc.y"
2786 {
2787 yylhsminor.yy303 = psi_plist_add(yymsp[-1].minor.yy303, &yymsp[0].minor.yy38);
2788 }
2789 #line 2790 "src/parser_proc.c"
2790 yymsp[-1].minor.yy303 = yylhsminor.yy303;
2791 break;
2792 case 98: /* impl_stmt ::= return_stmt */
2793 #line 725 "src/parser_proc.y"
2794 {
2795 yylhsminor.yy38 = (struct psi_token**) yymsp[0].minor.yy130;
2796 }
2797 #line 2798 "src/parser_proc.c"
2798 yymsp[0].minor.yy38 = yylhsminor.yy38;
2799 break;
2800 case 99: /* impl_stmt ::= let_stmt */
2801 #line 728 "src/parser_proc.y"
2802 {
2803 yylhsminor.yy38 = (struct psi_token**) yymsp[0].minor.yy139;
2804 }
2805 #line 2806 "src/parser_proc.c"
2806 yymsp[0].minor.yy38 = yylhsminor.yy38;
2807 break;
2808 case 100: /* impl_stmt ::= set_stmt */
2809 #line 731 "src/parser_proc.y"
2810 {
2811 yylhsminor.yy38 = (struct psi_token**) yymsp[0].minor.yy226;
2812 }
2813 #line 2814 "src/parser_proc.c"
2814 yymsp[0].minor.yy38 = yylhsminor.yy38;
2815 break;
2816 case 101: /* impl_stmt ::= free_stmt */
2817 #line 734 "src/parser_proc.y"
2818 {
2819 yylhsminor.yy38 = (struct psi_token**) yymsp[0].minor.yy76;
2820 }
2821 #line 2822 "src/parser_proc.c"
2822 yymsp[0].minor.yy38 = yylhsminor.yy38;
2823 break;
2824 case 102: /* number ::= NUMBER|NSNAME */
2825 #line 737 "src/parser_proc.y"
2826 {
2827 yylhsminor.yy160 = psi_number_init(yymsp[0].minor.yy0->type, yymsp[0].minor.yy0->text);
2828 yylhsminor.yy160->token = yymsp[0].minor.yy0;
2829 }
2830 #line 2831 "src/parser_proc.c"
2831 yymsp[0].minor.yy160 = yylhsminor.yy160;
2832 break;
2833 case 103: /* number ::= decl_var */
2834 #line 741 "src/parser_proc.y"
2835 {
2836 yylhsminor.yy160 = psi_number_init(PSI_T_NAME, yymsp[0].minor.yy207);
2837 yylhsminor.yy160->token = psi_token_copy(yymsp[0].minor.yy207->token);
2838 }
2839 #line 2840 "src/parser_proc.c"
2840 yymsp[0].minor.yy160 = yylhsminor.yy160;
2841 break;
2842 case 104: /* num_exp ::= number */
2843 #line 745 "src/parser_proc.y"
2844 {
2845 yylhsminor.yy39 = psi_num_exp_init_num(yymsp[0].minor.yy160);
2846 yylhsminor.yy39->token = psi_token_copy(yymsp[0].minor.yy160->token);
2847 }
2848 #line 2849 "src/parser_proc.c"
2849 yymsp[0].minor.yy39 = yylhsminor.yy39;
2850 break;
2851 case 105: /* num_exp ::= LPAREN num_exp RPAREN */
2852 #line 749 "src/parser_proc.y"
2853 {
2854 yylhsminor.yy39 = psi_num_exp_init_unary(PSI_T_LPAREN, yymsp[-1].minor.yy39);
2855 yylhsminor.yy39->token = yymsp[-2].minor.yy0;
2856 }
2857 #line 2858 "src/parser_proc.c"
2858 yy_destructor(yypParser,75,&yymsp[0].minor);
2859 yymsp[-2].minor.yy39 = yylhsminor.yy39;
2860 break;
2861 case 106: /* num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO|RCHEVR|LCHEVR|CMP_GE|CMP_LE|OR|AND|CMP_EQ|CMP_NE num_exp */
2862 #line 753 "src/parser_proc.y"
2863 {
2864 yylhsminor.yy39 = psi_num_exp_init_binary(yymsp[-1].minor.yy0->type, yymsp[-2].minor.yy39, yymsp[0].minor.yy39);
2865 yylhsminor.yy39->token = yymsp[-1].minor.yy0;
2866 }
2867 #line 2868 "src/parser_proc.c"
2868 yymsp[-2].minor.yy39 = yylhsminor.yy39;
2869 break;
2870 case 107: /* num_exp ::= TILDE|NOT|PLUS|MINUS num_exp */
2871 #line 757 "src/parser_proc.y"
2872 {
2873 yylhsminor.yy39 = psi_num_exp_init_unary(yymsp[-1].minor.yy0->type, yymsp[0].minor.yy39);
2874 yylhsminor.yy39->token = yymsp[-1].minor.yy0;
2875 }
2876 #line 2877 "src/parser_proc.c"
2877 yymsp[-1].minor.yy39 = yylhsminor.yy39;
2878 break;
2879 case 108: /* let_exp ::= NULL */
2880 { yy_destructor(yypParser,15,&yymsp[0].minor);
2881 #line 761 "src/parser_proc.y"
2882 {
2883 yymsp[0].minor.yy144 = psi_let_exp_init(PSI_LET_NULL, NULL);
2884 }
2885 #line 2886 "src/parser_proc.c"
2886 }
2887 break;
2888 case 109: /* let_exp ::= AMPERSAND NULL */
2889 { yy_destructor(yypParser,23,&yymsp[-1].minor);
2890 #line 764 "src/parser_proc.y"
2891 {
2892 yymsp[-1].minor.yy144 = psi_let_exp_init(PSI_LET_NULL, NULL);
2893 yymsp[-1].minor.yy144->is_reference = 1;
2894 }
2895 #line 2896 "src/parser_proc.c"
2896 yy_destructor(yypParser,15,&yymsp[0].minor);
2897 }
2898 break;
2899 case 110: /* let_exp ::= let_callback */
2900 #line 768 "src/parser_proc.y"
2901 {
2902 yylhsminor.yy144 = psi_let_exp_init(PSI_LET_CALLBACK, yymsp[0].minor.yy164);
2903 }
2904 #line 2905 "src/parser_proc.c"
2905 yymsp[0].minor.yy144 = yylhsminor.yy144;
2906 break;
2907 case 111: /* let_exp ::= let_calloc */
2908 #line 771 "src/parser_proc.y"
2909 {
2910 yylhsminor.yy144 = psi_let_exp_init(PSI_LET_CALLOC, yymsp[0].minor.yy17);
2911 }
2912 #line 2913 "src/parser_proc.c"
2913 yymsp[0].minor.yy144 = yylhsminor.yy144;
2914 break;
2915 case 112: /* let_exp ::= AMPERSAND let_calloc */
2916 { yy_destructor(yypParser,23,&yymsp[-1].minor);
2917 #line 774 "src/parser_proc.y"
2918 {
2919 yymsp[-1].minor.yy144 = psi_let_exp_init(PSI_LET_CALLOC, yymsp[0].minor.yy17);
2920 yymsp[-1].minor.yy144->is_reference = 1;
2921 }
2922 #line 2923 "src/parser_proc.c"
2923 }
2924 break;
2925 case 113: /* let_exp ::= let_func */
2926 #line 778 "src/parser_proc.y"
2927 {
2928 yylhsminor.yy144 = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, yymsp[0].minor.yy72);
2929 }
2930 #line 2931 "src/parser_proc.c"
2931 yymsp[0].minor.yy144 = yylhsminor.yy144;
2932 break;
2933 case 114: /* let_exp ::= AMPERSAND let_func */
2934 { yy_destructor(yypParser,23,&yymsp[-1].minor);
2935 #line 781 "src/parser_proc.y"
2936 {
2937 yymsp[-1].minor.yy144 = psi_let_exp_init_ex(NULL, PSI_LET_FUNC, yymsp[0].minor.yy72);
2938 yymsp[-1].minor.yy144->is_reference = 1;
2939 }
2940 #line 2941 "src/parser_proc.c"
2941 }
2942 break;
2943 case 115: /* let_exp ::= num_exp */
2944 #line 785 "src/parser_proc.y"
2945 {
2946 yylhsminor.yy144 = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, yymsp[0].minor.yy39);
2947 }
2948 #line 2949 "src/parser_proc.c"
2949 yymsp[0].minor.yy144 = yylhsminor.yy144;
2950 break;
2951 case 116: /* let_exp ::= AMPERSAND num_exp */
2952 { yy_destructor(yypParser,23,&yymsp[-1].minor);
2953 #line 788 "src/parser_proc.y"
2954 {
2955 yymsp[-1].minor.yy144 = psi_let_exp_init_ex(NULL, PSI_LET_NUMEXP, yymsp[0].minor.yy39);
2956 yymsp[-1].minor.yy144->is_reference = 1;
2957 }
2958 #line 2959 "src/parser_proc.c"
2959 }
2960 break;
2961 case 117: /* let_exp ::= decl_var EQUALS let_exp */
2962 #line 792 "src/parser_proc.y"
2963 {
2964 yylhsminor.yy144 = yymsp[0].minor.yy144;
2965 yylhsminor.yy144->var = yymsp[-2].minor.yy207;
2966 }
2967 #line 2968 "src/parser_proc.c"
2968 yy_destructor(yypParser,81,&yymsp[-1].minor);
2969 yymsp[-2].minor.yy144 = yylhsminor.yy144;
2970 break;
2971 case 118: /* let_stmt ::= LET let_exp EOS */
2972 #line 796 "src/parser_proc.y"
2973 {
2974 yylhsminor.yy139 = psi_let_stmt_init(yymsp[-1].minor.yy144);
2975 yylhsminor.yy139->token = yymsp[-2].minor.yy0;
2976 }
2977 #line 2978 "src/parser_proc.c"
2978 yy_destructor(yypParser,71,&yymsp[0].minor);
2979 yymsp[-2].minor.yy139 = yylhsminor.yy139;
2980 break;
2981 case 119: /* let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS */
2982 #line 800 "src/parser_proc.y"
2983 {
2984 yylhsminor.yy139 = psi_let_stmt_init(psi_let_exp_init_ex(yymsp[-4].minor.yy207, PSI_LET_TMP, yymsp[-1].minor.yy207));
2985 yylhsminor.yy139->token = yymsp[-5].minor.yy0;
2986 yylhsminor.yy139->exp->is_reference = yymsp[-2].minor.yy273 ? 1 : 0;
2987 }
2988 #line 2989 "src/parser_proc.c"
2989 yy_destructor(yypParser,81,&yymsp[-3].minor);
2990 yy_destructor(yypParser,71,&yymsp[0].minor);
2991 yymsp[-5].minor.yy139 = yylhsminor.yy139;
2992 break;
2993 case 120: /* let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN */
2994 #line 805 "src/parser_proc.y"
2995 {
2996 yylhsminor.yy164 = psi_let_callback_init(psi_let_func_init(yymsp[-6].minor.yy0->type, yymsp[-6].minor.yy0->text, yymsp[-4].minor.yy185), yymsp[-2].minor.yy287);
2997 yylhsminor.yy164->token = yymsp[-7].minor.yy0;
2998 free(yymsp[-6].minor.yy0);
2999 }
3000 #line 3001 "src/parser_proc.c"
3001 yy_destructor(yypParser,73,&yymsp[-5].minor);
3002 yy_destructor(yypParser,73,&yymsp[-3].minor);
3003 yy_destructor(yypParser,75,&yymsp[-1].minor);
3004 yy_destructor(yypParser,75,&yymsp[0].minor);
3005 yymsp[-7].minor.yy164 = yylhsminor.yy164;
3006 break;
3007 case 121: /* let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN */
3008 #line 810 "src/parser_proc.y"
3009 {
3010 yylhsminor.yy17 = psi_let_calloc_init(yymsp[-3].minor.yy39, yymsp[-1].minor.yy39);
3011 yylhsminor.yy17->token = yymsp[-5].minor.yy0;
3012 }
3013 #line 3014 "src/parser_proc.c"
3014 yy_destructor(yypParser,73,&yymsp[-4].minor);
3015 yy_destructor(yypParser,74,&yymsp[-2].minor);
3016 yy_destructor(yypParser,75,&yymsp[0].minor);
3017 yymsp[-5].minor.yy17 = yylhsminor.yy17;
3018 break;
3019 case 122: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN */
3020 #line 814 "src/parser_proc.y"
3021 {
3022 yylhsminor.yy72 = psi_let_func_init(yymsp[-3].minor.yy0->type, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy185);
3023 yylhsminor.yy72->token = yymsp[-3].minor.yy0;
3024 }
3025 #line 3026 "src/parser_proc.c"
3026 yy_destructor(yypParser,73,&yymsp[-2].minor);
3027 yy_destructor(yypParser,75,&yymsp[0].minor);
3028 yymsp[-3].minor.yy72 = yylhsminor.yy72;
3029 break;
3030 case 123: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN */
3031 #line 818 "src/parser_proc.y"
3032 {
3033 yylhsminor.yy72 = psi_let_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy185);
3034 yylhsminor.yy72->token = yymsp[-5].minor.yy0;
3035 yylhsminor.yy72->inner = yymsp[-1].minor.yy303;
3036 }
3037 #line 3038 "src/parser_proc.c"
3038 yy_destructor(yypParser,73,&yymsp[-4].minor);
3039 yy_destructor(yypParser,74,&yymsp[-2].minor);
3040 yy_destructor(yypParser,75,&yymsp[0].minor);
3041 yymsp[-5].minor.yy72 = yylhsminor.yy72;
3042 break;
3043 case 124: /* let_exps ::= let_exp */
3044 #line 823 "src/parser_proc.y"
3045 {
3046 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_let_exp_free),
3047 &yymsp[0].minor.yy144);
3048 }
3049 #line 3050 "src/parser_proc.c"
3050 yymsp[0].minor.yy303 = yylhsminor.yy303;
3051 break;
3052 case 125: /* let_exps ::= let_exps COMMA let_exp */
3053 #line 827 "src/parser_proc.y"
3054 {
3055 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy144);
3056 }
3057 #line 3058 "src/parser_proc.c"
3058 yy_destructor(yypParser,74,&yymsp[-1].minor);
3059 yymsp[-2].minor.yy303 = yylhsminor.yy303;
3060 break;
3061 case 126: /* callback_arg_list ::= */
3062 #line 830 "src/parser_proc.y"
3063 {
3064 yymsp[1].minor.yy287 = NULL;
3065 }
3066 #line 3067 "src/parser_proc.c"
3067 break;
3068 case 127: /* callback_arg_list ::= callback_args */
3069 #line 833 "src/parser_proc.y"
3070 {
3071 yylhsminor.yy287 = yymsp[0].minor.yy287;
3072 }
3073 #line 3074 "src/parser_proc.c"
3074 yymsp[0].minor.yy287 = yylhsminor.yy287;
3075 break;
3076 case 128: /* callback_args ::= set_exp */
3077 #line 836 "src/parser_proc.y"
3078 {
3079 yylhsminor.yy287 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free),
3080 &yymsp[0].minor.yy67);
3081 }
3082 #line 3083 "src/parser_proc.c"
3083 yymsp[0].minor.yy287 = yylhsminor.yy287;
3084 break;
3085 case 129: /* callback_args ::= callback_args COMMA set_exp */
3086 #line 840 "src/parser_proc.y"
3087 {
3088 yylhsminor.yy287 = psi_plist_add(yymsp[-2].minor.yy287, &yymsp[0].minor.yy67);
3089 }
3090 #line 3091 "src/parser_proc.c"
3091 yy_destructor(yypParser,74,&yymsp[-1].minor);
3092 yymsp[-2].minor.yy287 = yylhsminor.yy287;
3093 break;
3094 case 132: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN */
3095 #line 849 "src/parser_proc.y"
3096 {
3097 yylhsminor.yy78 = psi_set_func_init(yymsp[-3].minor.yy0->type, yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy207);
3098 yylhsminor.yy78->token = yymsp[-3].minor.yy0;
3099 }
3100 #line 3101 "src/parser_proc.c"
3101 yy_destructor(yypParser,73,&yymsp[-2].minor);
3102 yy_destructor(yypParser,75,&yymsp[0].minor);
3103 yymsp[-3].minor.yy78 = yylhsminor.yy78;
3104 break;
3105 case 133: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN */
3106 #line 853 "src/parser_proc.y"
3107 {
3108 yylhsminor.yy78 = psi_set_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy207);
3109 yylhsminor.yy78->token = yymsp[-5].minor.yy0;
3110 yylhsminor.yy78->inner = yymsp[-1].minor.yy303;
3111 }
3112 #line 3113 "src/parser_proc.c"
3113 yy_destructor(yypParser,73,&yymsp[-4].minor);
3114 yy_destructor(yypParser,74,&yymsp[-2].minor);
3115 yy_destructor(yypParser,75,&yymsp[0].minor);
3116 yymsp[-5].minor.yy78 = yylhsminor.yy78;
3117 break;
3118 case 134: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN */
3119 #line 858 "src/parser_proc.y"
3120 {
3121 yylhsminor.yy78 = psi_set_func_init(yymsp[-5].minor.yy0->type, yymsp[-5].minor.yy0->text, yymsp[-3].minor.yy207);
3122 yylhsminor.yy78->token = yymsp[-5].minor.yy0;
3123 yylhsminor.yy78->recursive = 1;
3124 }
3125 #line 3126 "src/parser_proc.c"
3126 yy_destructor(yypParser,73,&yymsp[-4].minor);
3127 yy_destructor(yypParser,74,&yymsp[-2].minor);
3128 yy_destructor(yypParser,84,&yymsp[-1].minor);
3129 yy_destructor(yypParser,75,&yymsp[0].minor);
3130 yymsp[-5].minor.yy78 = yylhsminor.yy78;
3131 break;
3132 case 135: /* set_exp ::= set_func */
3133 #line 863 "src/parser_proc.y"
3134 {
3135 yylhsminor.yy67 = psi_set_exp_init(PSI_SET_FUNC, yymsp[0].minor.yy78);
3136 }
3137 #line 3138 "src/parser_proc.c"
3138 yymsp[0].minor.yy67 = yylhsminor.yy67;
3139 break;
3140 case 136: /* set_exp ::= num_exp */
3141 #line 866 "src/parser_proc.y"
3142 {
3143 yylhsminor.yy67 = psi_set_exp_init(PSI_SET_NUMEXP, yymsp[0].minor.yy39);
3144 }
3145 #line 3146 "src/parser_proc.c"
3146 yymsp[0].minor.yy67 = yylhsminor.yy67;
3147 break;
3148 case 137: /* set_exps ::= set_exp */
3149 #line 869 "src/parser_proc.y"
3150 {
3151 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_set_exp_free),
3152 &yymsp[0].minor.yy67);
3153 }
3154 #line 3155 "src/parser_proc.c"
3155 yymsp[0].minor.yy303 = yylhsminor.yy303;
3156 break;
3157 case 138: /* set_exps ::= set_exps COMMA set_exp */
3158 #line 873 "src/parser_proc.y"
3159 {
3160 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy67);
3161 }
3162 #line 3163 "src/parser_proc.c"
3163 yy_destructor(yypParser,74,&yymsp[-1].minor);
3164 yymsp[-2].minor.yy303 = yylhsminor.yy303;
3165 break;
3166 case 139: /* set_exp ::= impl_var EQUALS set_exp */
3167 #line 876 "src/parser_proc.y"
3168 {
3169 yylhsminor.yy67 = yymsp[0].minor.yy67;
3170 yylhsminor.yy67->var = yymsp[-2].minor.yy185;
3171 }
3172 #line 3173 "src/parser_proc.c"
3173 yy_destructor(yypParser,81,&yymsp[-1].minor);
3174 yymsp[-2].minor.yy67 = yylhsminor.yy67;
3175 break;
3176 case 140: /* set_stmt ::= SET set_exp EOS */
3177 #line 880 "src/parser_proc.y"
3178 {
3179 yylhsminor.yy226 = psi_set_stmt_init(yymsp[-1].minor.yy67);
3180 yylhsminor.yy226->token = yymsp[-2].minor.yy0;
3181 }
3182 #line 3183 "src/parser_proc.c"
3183 yy_destructor(yypParser,71,&yymsp[0].minor);
3184 yymsp[-2].minor.yy226 = yylhsminor.yy226;
3185 break;
3186 case 141: /* return_stmt ::= RETURN set_func EOS */
3187 #line 884 "src/parser_proc.y"
3188 {
3189 yylhsminor.yy130 = psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC, yymsp[-1].minor.yy78));
3190 yylhsminor.yy130->token = yymsp[-2].minor.yy0;
3191 }
3192 #line 3193 "src/parser_proc.c"
3193 yy_destructor(yypParser,71,&yymsp[0].minor);
3194 yymsp[-2].minor.yy130 = yylhsminor.yy130;
3195 break;
3196 case 142: /* free_stmt ::= FREE free_exps EOS */
3197 #line 888 "src/parser_proc.y"
3198 {
3199 yylhsminor.yy76 = psi_free_stmt_init(yymsp[-1].minor.yy303);
3200 yylhsminor.yy76->token = yymsp[-2].minor.yy0;
3201 }
3202 #line 3203 "src/parser_proc.c"
3203 yy_destructor(yypParser,71,&yymsp[0].minor);
3204 yymsp[-2].minor.yy76 = yylhsminor.yy76;
3205 break;
3206 case 143: /* free_exps ::= free_exp */
3207 #line 892 "src/parser_proc.y"
3208 {
3209 yylhsminor.yy303 = psi_plist_add(psi_plist_init((psi_plist_dtor) psi_free_exp_free),
3210 &yymsp[0].minor.yy197);
3211 }
3212 #line 3213 "src/parser_proc.c"
3213 yymsp[0].minor.yy303 = yylhsminor.yy303;
3214 break;
3215 case 144: /* free_exps ::= free_exps COMMA free_exp */
3216 #line 896 "src/parser_proc.y"
3217 {
3218 yylhsminor.yy303 = psi_plist_add(yymsp[-2].minor.yy303, &yymsp[0].minor.yy197);
3219 }
3220 #line 3221 "src/parser_proc.c"
3221 yy_destructor(yypParser,74,&yymsp[-1].minor);
3222 yymsp[-2].minor.yy303 = yylhsminor.yy303;
3223 break;
3224 case 145: /* free_exp ::= NAME LPAREN decl_vars RPAREN */
3225 #line 899 "src/parser_proc.y"
3226 {
3227 yylhsminor.yy197 = psi_free_exp_init(yymsp[-3].minor.yy0->text, yymsp[-1].minor.yy303);
3228 yylhsminor.yy197->token = yymsp[-3].minor.yy0;
3229 }
3230 #line 3231 "src/parser_proc.c"
3231 yy_destructor(yypParser,73,&yymsp[-2].minor);
3232 yy_destructor(yypParser,75,&yymsp[0].minor);
3233 yymsp[-3].minor.yy197 = yylhsminor.yy197;
3234 break;
3235 case 146: /* reference ::= */
3236 #line 903 "src/parser_proc.y"
3237 {
3238 yymsp[1].minor.yy273 = false;
3239 }
3240 #line 3241 "src/parser_proc.c"
3241 break;
3242 case 147: /* reference ::= AMPERSAND */
3243 { yy_destructor(yypParser,23,&yymsp[0].minor);
3244 #line 906 "src/parser_proc.y"
3245 {
3246 yymsp[0].minor.yy273 = true;
3247 }
3248 #line 3249 "src/parser_proc.c"
3249 }
3250 break;
3251 case 148: /* indirection ::= */
3252 #line 909 "src/parser_proc.y"
3253 {
3254 yymsp[1].minor.yy190 = 0;
3255 }
3256 #line 3257 "src/parser_proc.c"
3257 break;
3258 case 149: /* indirection ::= pointers */
3259 #line 912 "src/parser_proc.y"
3260 {
3261 yylhsminor.yy190 = yymsp[0].minor.yy190;
3262 }
3263 #line 3264 "src/parser_proc.c"
3264 yymsp[0].minor.yy190 = yylhsminor.yy190;
3265 break;
3266 case 150: /* pointers ::= ASTERISK */
3267 { yy_destructor(yypParser,28,&yymsp[0].minor);
3268 #line 915 "src/parser_proc.y"
3269 {
3270 yymsp[0].minor.yy190 = 1;
3271 }
3272 #line 3273 "src/parser_proc.c"
3273 }
3274 break;
3275 case 151: /* pointers ::= pointers ASTERISK */
3276 #line 918 "src/parser_proc.y"
3277 {
3278 yylhsminor.yy190 = yymsp[-1].minor.yy190+1;
3279 }
3280 #line 3281 "src/parser_proc.c"
3281 yy_destructor(yypParser,28,&yymsp[0].minor);
3282 yymsp[-1].minor.yy190 = yylhsminor.yy190;
3283 break;
3284 case 152: /* file ::= blocks */
3285 { yy_destructor(yypParser,154,&yymsp[0].minor);
3286 #line 172 "src/parser_proc.y"
3287 {
3288 }
3289 #line 3290 "src/parser_proc.c"
3290 }
3291 break;
3292 case 153: /* blocks ::= block */
3293 { yy_destructor(yypParser,155,&yymsp[0].minor);
3294 #line 173 "src/parser_proc.y"
3295 {
3296 }
3297 #line 3298 "src/parser_proc.c"
3298 }
3299 break;
3300 case 154: /* blocks ::= blocks block */
3301 { yy_destructor(yypParser,154,&yymsp[-1].minor);
3302 #line 174 "src/parser_proc.y"
3303 {
3304 }
3305 #line 3306 "src/parser_proc.c"
3306 yy_destructor(yypParser,155,&yymsp[0].minor);
3307 }
3308 break;
3309 case 155: /* block ::= EOF */
3310 { yy_destructor(yypParser,70,&yymsp[0].minor);
3311 #line 175 "src/parser_proc.y"
3312 {
3313 }
3314 #line 3315 "src/parser_proc.c"
3315 }
3316 break;
3317 case 156: /* block ::= EOS */
3318 { yy_destructor(yypParser,71,&yymsp[0].minor);
3319 #line 176 "src/parser_proc.y"
3320 {
3321 }
3322 #line 3323 "src/parser_proc.c"
3323 }
3324 break;
3325 default:
3326 break;
3327 /********** End reduce actions ************************************************/
3328 };
3329 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
3330 yygoto = yyRuleInfo[yyruleno].lhs;
3331 yysize = yyRuleInfo[yyruleno].nrhs;
3332 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
3333 if( yyact <= YY_MAX_SHIFTREDUCE ){
3334 if( yyact>YY_MAX_SHIFT ){
3335 yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
3336 }
3337 yymsp -= yysize-1;
3338 yypParser->yytos = yymsp;
3339 yymsp->stateno = (YYACTIONTYPE)yyact;
3340 yymsp->major = (YYCODETYPE)yygoto;
3341 yyTraceShift(yypParser, yyact);
3342 }else{
3343 assert( yyact == YY_ACCEPT_ACTION );
3344 yypParser->yytos -= yysize;
3345 yy_accept(yypParser);
3346 }
3347 }
3348
3349 /*
3350 ** The following code executes when the parse fails
3351 */
3352 #ifndef YYNOERRORRECOVERY
3353 static void yy_parse_failed(
3354 yyParser *yypParser /* The parser */
3355 ){
3356 ParseARG_FETCH;
3357 #ifndef NDEBUG
3358 if( yyTraceFILE ){
3359 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
3360 }
3361 #endif
3362 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
3363 /* Here code is inserted which will be executed whenever the
3364 ** parser fails */
3365 /************ Begin %parse_failure code ***************************************/
3366 /************ End %parse_failure code *****************************************/
3367 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
3368 }
3369 #endif /* YYNOERRORRECOVERY */
3370
3371 /*
3372 ** The following code executes when a syntax error first occurs.
3373 */
3374 static void yy_syntax_error(
3375 yyParser *yypParser, /* The parser */
3376 int yymajor, /* The major type of the error token */
3377 ParseTOKENTYPE yyminor /* The minor type of the error token */
3378 ){
3379 ParseARG_FETCH;
3380 #define TOKEN yyminor
3381 /************ Begin %syntax_error code ****************************************/
3382 #line 40 "src/parser_proc.y"
3383 ++P->errors; if (TOKEN && TOKEN->type != PSI_T_EOF) { psi_error(PSI_WARNING, TOKEN->file, TOKEN->line, "PSI syntax error: Unexpected token '%s' at pos %u", TOKEN->text, TOKEN->col); } else { psi_error(PSI_WARNING, P->file.fn, P->line, "PSI syntax error: Unexpected end of input"); }
3384 #line 3385 "src/parser_proc.c"
3385 /************ End %syntax_error code ******************************************/
3386 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
3387 }
3388
3389 /*
3390 ** The following is executed when the parser accepts
3391 */
3392 static void yy_accept(
3393 yyParser *yypParser /* The parser */
3394 ){
3395 ParseARG_FETCH;
3396 #ifndef NDEBUG
3397 if( yyTraceFILE ){
3398 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
3399 }
3400 #endif
3401 #ifndef YYNOERRORRECOVERY
3402 yypParser->yyerrcnt = -1;
3403 #endif
3404 assert( yypParser->yytos==yypParser->yystack );
3405 /* Here code is inserted which will be executed whenever the
3406 ** parser accepts */
3407 /*********** Begin %parse_accept code *****************************************/
3408 /*********** End %parse_accept code *******************************************/
3409 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
3410 }
3411
3412 /* The main parser program.
3413 ** The first argument is a pointer to a structure obtained from
3414 ** "ParseAlloc" which describes the current state of the parser.
3415 ** The second argument is the major token number. The third is
3416 ** the minor token. The fourth optional argument is whatever the
3417 ** user wants (and specified in the grammar) and is available for
3418 ** use by the action routines.
3419 **
3420 ** Inputs:
3421 ** <ul>
3422 ** <li> A pointer to the parser (an opaque structure.)
3423 ** <li> The major token number.
3424 ** <li> The minor token number.
3425 ** <li> An option argument of a grammar-specified type.
3426 ** </ul>
3427 **
3428 ** Outputs:
3429 ** None.
3430 */
3431 void Parse(
3432 void *yyp, /* The parser */
3433 int yymajor, /* The major token code number */
3434 ParseTOKENTYPE yyminor /* The value for the token */
3435 ParseARG_PDECL /* Optional %extra_argument parameter */
3436 ){
3437 YYMINORTYPE yyminorunion;
3438 unsigned int yyact; /* The parser action. */
3439 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
3440 int yyendofinput; /* True if we are at the end of input */
3441 #endif
3442 #ifdef YYERRORSYMBOL
3443 int yyerrorhit = 0; /* True if yymajor has invoked an error */
3444 #endif
3445 yyParser *yypParser; /* The parser */
3446
3447 yypParser = (yyParser*)yyp;
3448 assert( yypParser->yytos!=0 );
3449 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
3450 yyendofinput = (yymajor==0);
3451 #endif
3452 ParseARG_STORE;
3453
3454 #ifndef NDEBUG
3455 if( yyTraceFILE ){
3456 fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
3457 }
3458 #endif
3459
3460 do{
3461 yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
3462 if( yyact <= YY_MAX_SHIFTREDUCE ){
3463 yy_shift(yypParser,yyact,yymajor,yyminor);
3464 #ifndef YYNOERRORRECOVERY
3465 yypParser->yyerrcnt--;
3466 #endif
3467 yymajor = YYNOCODE;
3468 }else if( yyact <= YY_MAX_REDUCE ){
3469 yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
3470 }else{
3471 assert( yyact == YY_ERROR_ACTION );
3472 yyminorunion.yy0 = yyminor;
3473 #ifdef YYERRORSYMBOL
3474 int yymx;
3475 #endif
3476 #ifndef NDEBUG
3477 if( yyTraceFILE ){
3478 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
3479 }
3480 #endif
3481 #ifdef YYERRORSYMBOL
3482 /* A syntax error has occurred.
3483 ** The response to an error depends upon whether or not the
3484 ** grammar defines an error token "ERROR".
3485 **
3486 ** This is what we do if the grammar does define ERROR:
3487 **
3488 ** * Call the %syntax_error function.
3489 **
3490 ** * Begin popping the stack until we enter a state where
3491 ** it is legal to shift the error symbol, then shift
3492 ** the error symbol.
3493 **
3494 ** * Set the error count to three.
3495 **
3496 ** * Begin accepting and shifting new tokens. No new error
3497 ** processing will occur until three tokens have been
3498 ** shifted successfully.
3499 **
3500 */
3501 if( yypParser->yyerrcnt<0 ){
3502 yy_syntax_error(yypParser,yymajor,yyminor);
3503 }
3504 yymx = yypParser->yytos->major;
3505 if( yymx==YYERRORSYMBOL || yyerrorhit ){
3506 #ifndef NDEBUG
3507 if( yyTraceFILE ){
3508 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
3509 yyTracePrompt,yyTokenName[yymajor]);
3510 }
3511 #endif
3512 yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
3513 yymajor = YYNOCODE;
3514 }else{
3515 while( yypParser->yytos >= yypParser->yystack
3516 && yymx != YYERRORSYMBOL
3517 && (yyact = yy_find_reduce_action(
3518 yypParser->yytos->stateno,
3519 YYERRORSYMBOL)) >= YY_MIN_REDUCE
3520 ){
3521 yy_pop_parser_stack(yypParser);
3522 }
3523 if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
3524 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3525 yy_parse_failed(yypParser);
3526 #ifndef YYNOERRORRECOVERY
3527 yypParser->yyerrcnt = -1;
3528 #endif
3529 yymajor = YYNOCODE;
3530 }else if( yymx!=YYERRORSYMBOL ){
3531 yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
3532 }
3533 }
3534 yypParser->yyerrcnt = 3;
3535 yyerrorhit = 1;
3536 #elif defined(YYNOERRORRECOVERY)
3537 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
3538 ** do any kind of error recovery. Instead, simply invoke the syntax
3539 ** error routine and continue going as if nothing had happened.
3540 **
3541 ** Applications can set this macro (for example inside %include) if
3542 ** they intend to abandon the parse upon the first syntax error seen.
3543 */
3544 yy_syntax_error(yypParser,yymajor, yyminor);
3545 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3546 yymajor = YYNOCODE;
3547
3548 #else /* YYERRORSYMBOL is not defined */
3549 /* This is what we do if the grammar does not define ERROR:
3550 **
3551 ** * Report an error message, and throw away the input token.
3552 **
3553 ** * If the input token is $, then fail the parse.
3554 **
3555 ** As before, subsequent error messages are suppressed until
3556 ** three input tokens have been successfully shifted.
3557 */
3558 if( yypParser->yyerrcnt<=0 ){
3559 yy_syntax_error(yypParser,yymajor, yyminor);
3560 }
3561 yypParser->yyerrcnt = 3;
3562 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3563 if( yyendofinput ){
3564 yy_parse_failed(yypParser);
3565 #ifndef YYNOERRORRECOVERY
3566 yypParser->yyerrcnt = -1;
3567 #endif
3568 }
3569 yymajor = YYNOCODE;
3570 #endif
3571 }
3572 }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
3573 #ifndef NDEBUG
3574 if( yyTraceFILE ){
3575 yyStackEntry *i;
3576 char cDiv = '[';
3577 fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
3578 for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
3579 fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
3580 cDiv = ' ';
3581 }
3582 fprintf(yyTraceFILE,"]\n");
3583 }
3584 #endif
3585 return;
3586 }