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