4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
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.
11 *************************************************************************
12 ** Driver template for the LEMON parser generator.
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
22 ** The following is the concatenation of all %include directives from the
23 ** input grammar file:
26 /************ Begin %include sections from the grammar ************************/
27 #line 1 "src/parser_proc.y"
29 #include "php_psi_stdinc.h"
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
44 void *ParseAlloc(void *(*mallocProc
)(size_t));
45 void ParseFree(void *p
, void (*freeProc
)(void*));
48 void *psi_parser_proc_init(void)
50 return ParseAlloc(malloc
);
53 void psi_parser_proc_free(void **parser_proc
)
56 ParseFree(*parser_proc
, free
);
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 ***************************/
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
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
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
119 /************* Begin control #defines *****************************************/
120 #define YYCODETYPE unsigned char
122 #define YYACTIONTYPE unsigned short int
123 #define ParseTOKENTYPE struct psi_token *
127 struct psi_let_calloc
* yy9
;
128 struct psi_decl_var
* yy11
;
129 struct psi_let_exp
* yy20
;
130 struct psi_set_func
* yy26
;
131 struct psi_let_func
* yy27
;
132 struct psi_impl_var
* yy37
;
133 struct psi_plist
* yy43
;
134 struct psi_decl_enum
* yy63
;
135 struct psi_token
** yy78
;
136 struct psi_return_stmt
* yy90
;
137 struct psi_layout yy91
;
138 struct psi_impl_def_val
* yy93
;
139 struct psi_free_exp
* yy94
;
140 struct psi_impl
* yy97
;
141 struct psi_set_stmt
* yy98
;
142 struct psi_decl
* yy103
;
144 struct psi_decl_type
* yy132
;
145 struct psi_impl_type
* yy138
;
146 struct psi_layout
* yy141
;
147 struct psi_set_exp
* yy147
;
148 struct psi_const
* yy154
;
149 struct psi_plist
* yy163
;
150 struct psi_impl_func
* yy168
;
151 struct psi_const_type
* yy171
;
152 struct psi_decl_arg
* yy184
;
153 struct psi_number
* yy188
;
154 struct psi_free_stmt
* yy192
;
156 struct psi_impl_arg
* yy210
;
157 struct psi_decl_enum_item
* yy217
;
158 struct psi_decl_abi
* yy218
;
159 struct psi_let_callback
* yy220
;
160 struct psi_num_exp
* yy259
;
161 struct psi_decl_union
* yy271
;
162 struct psi_decl_struct
* yy275
;
163 struct psi_let_stmt
* yy311
;
166 #define YYSTACKDEPTH 100
168 #define ParseARG_SDECL struct psi_parser *P;
169 #define ParseARG_PDECL ,struct psi_parser *P
170 #define ParseARG_FETCH struct psi_parser *P = yypParser->P
171 #define ParseARG_STORE yypParser->P = P
175 #define YY_MAX_SHIFT 196
176 #define YY_MIN_SHIFTREDUCE 328
177 #define YY_MAX_SHIFTREDUCE 484
178 #define YY_MIN_REDUCE 485
179 #define YY_MAX_REDUCE 641
180 #define YY_ERROR_ACTION 642
181 #define YY_ACCEPT_ACTION 643
182 #define YY_NO_ACTION 644
183 /************* End control #defines *******************************************/
185 /* Define the yytestcase() macro to be a no-op if is not already defined
188 ** Applications can choose to define yytestcase() in the %include section
189 ** to a macro that can assist in verifying code coverage. For production
190 ** code the yytestcase() macro should be turned off. But it is useful
194 # define yytestcase(X)
198 /* Next are the tables used to determine what action to take based on the
199 ** current state and lookahead token. These tables are used to implement
200 ** functions that take a state number and lookahead value and return an
203 ** Suppose the action integer is N. Then the action is determined as
206 ** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead
207 ** token onto the stack and goto state N.
209 ** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
210 ** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
212 ** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
215 ** N == YY_ERROR_ACTION A syntax error has occurred.
217 ** N == YY_ACCEPT_ACTION The parser accepts its input.
219 ** N == YY_NO_ACTION No such action. Denotes unused
220 ** slots in the yy_action[] table.
222 ** The action table is constructed as a single large table named yy_action[].
223 ** Given state S and lookahead X, the action is computed as either:
225 ** (A) N = yy_action[ yy_shift_ofst[S] + X ]
226 ** (B) N = yy_default[S]
228 ** The (A) formula is preferred. The B formula is used instead if:
229 ** (1) The yy_shift_ofst[S]+X value is out of range, or
230 ** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or
231 ** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT.
232 ** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that
233 ** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X.
234 ** Hence only tests (1) and (2) need to be evaluated.)
236 ** The formulas above are for computing the action when the lookahead is
237 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
238 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
239 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
240 ** YY_SHIFT_USE_DFLT.
242 ** The following are the tables generated in this section:
244 ** yy_action[] A single table containing all actions.
245 ** yy_lookahead[] A table containing the lookahead for each entry in
246 ** yy_action. Used to detect hash collisions.
247 ** yy_shift_ofst[] For each state, the offset into yy_action for
248 ** shifting terminals.
249 ** yy_reduce_ofst[] For each state, the offset into yy_action for
250 ** shifting non-terminals after a reduce.
251 ** yy_default[] Default action for each state.
253 *********** Begin parsing tables **********************************************/
254 #define YY_ACTTAB_COUNT (960)
255 static const YYACTIONTYPE yy_action
[] = {
256 /* 0 */ 394, 409, 93, 409, 409, 409, 409, 409, 409, 409,
257 /* 10 */ 409, 409, 409, 93, 436, 430, 478, 164, 116, 430,
258 /* 20 */ 350, 423, 15, 475, 431, 27, 27, 478, 2, 133,
259 /* 30 */ 27, 27, 148, 148, 148, 148, 148, 148, 148, 148,
260 /* 40 */ 148, 148, 432, 100, 48, 440, 442, 83, 29, 29,
261 /* 50 */ 29, 29, 29, 29, 29, 29, 29, 29, 149, 56,
262 /* 60 */ 478, 422, 107, 122, 28, 155, 90, 89, 88, 365,
263 /* 70 */ 348, 397, 35, 470, 410, 43, 70, 390, 81, 67,
264 /* 80 */ 65, 64, 394, 409, 47, 409, 409, 409, 409, 409,
265 /* 90 */ 409, 409, 409, 409, 409, 39, 49, 11, 10, 60,
266 /* 100 */ 93, 437, 430, 349, 352, 411, 430, 417, 417, 417,
267 /* 110 */ 417, 417, 27, 27, 478, 405, 146, 27, 27, 148,
268 /* 120 */ 148, 148, 148, 148, 148, 148, 148, 148, 148, 83,
269 /* 130 */ 374, 108, 394, 409, 376, 409, 409, 409, 409, 409,
270 /* 140 */ 409, 409, 409, 409, 409, 149, 405, 80, 179, 181,
271 /* 150 */ 180, 28, 193, 182, 35, 425, 153, 376, 427, 390,
272 /* 160 */ 81, 67, 65, 64, 359, 166, 428, 494, 77, 122,
273 /* 170 */ 426, 429, 165, 122, 494, 382, 114, 410, 33, 41,
274 /* 180 */ 410, 43, 394, 409, 431, 409, 409, 409, 409, 409,
275 /* 190 */ 409, 409, 409, 409, 409, 158, 115, 416, 90, 89,
276 /* 200 */ 88, 415, 432, 96, 34, 414, 182, 375, 134, 390,
277 /* 210 */ 81, 67, 65, 64, 194, 87, 85, 178, 405, 136,
278 /* 220 */ 421, 405, 167, 122, 169, 79, 137, 4, 384, 83,
279 /* 230 */ 410, 43, 394, 409, 112, 409, 409, 409, 409, 409,
280 /* 240 */ 409, 409, 409, 409, 409, 357, 122, 394, 90, 89,
281 /* 250 */ 88, 382, 117, 182, 35, 119, 410, 43, 122, 390,
282 /* 260 */ 81, 67, 65, 64, 178, 122, 379, 194, 87, 85,
283 /* 270 */ 94, 405, 79, 122, 395, 385, 343, 410, 43, 76,
284 /* 280 */ 479, 366, 394, 409, 122, 409, 409, 409, 409, 409,
285 /* 290 */ 409, 409, 409, 409, 409, 478, 402, 405, 179, 181,
286 /* 300 */ 180, 383, 349, 351, 35, 124, 410, 43, 401, 390,
287 /* 310 */ 81, 67, 65, 64, 194, 87, 85, 53, 405, 131,
288 /* 320 */ 419, 419, 419, 419, 390, 81, 67, 431, 68, 66,
289 /* 330 */ 147, 132, 394, 409, 431, 409, 409, 409, 409, 409,
290 /* 340 */ 409, 409, 409, 409, 409, 432, 97, 405, 179, 181,
291 /* 350 */ 180, 38, 432, 102, 35, 124, 431, 127, 431, 390,
292 /* 360 */ 81, 67, 65, 64, 36, 128, 122, 418, 419, 419,
293 /* 370 */ 419, 419, 419, 122, 432, 98, 432, 104, 20, 83,
294 /* 380 */ 106, 472, 394, 409, 431, 409, 409, 409, 409, 409,
295 /* 390 */ 409, 409, 409, 409, 409, 122, 377, 122, 179, 181,
296 /* 400 */ 180, 368, 432, 103, 35, 353, 353, 353, 353, 390,
297 /* 410 */ 81, 67, 65, 64, 29, 29, 29, 29, 29, 29,
298 /* 420 */ 29, 29, 29, 122, 109, 471, 356, 145, 113, 74,
299 /* 430 */ 157, 161, 394, 409, 105, 409, 409, 409, 409, 409,
300 /* 440 */ 409, 409, 409, 409, 409, 160, 161, 367, 179, 181,
301 /* 450 */ 180, 361, 147, 147, 189, 163, 161, 42, 176, 390,
302 /* 460 */ 81, 67, 65, 64, 92, 122, 177, 458, 458, 458,
303 /* 470 */ 458, 458, 458, 458, 458, 458, 458, 335, 479, 82,
304 /* 480 */ 123, 344, 333, 459, 334, 400, 332, 331, 37, 473,
305 /* 490 */ 398, 329, 393, 19, 8, 451, 391, 118, 179, 181,
306 /* 500 */ 180, 378, 2, 330, 151, 13, 461, 7, 460, 390,
307 /* 510 */ 81, 67, 65, 64, 93, 479, 430, 6, 450, 84,
308 /* 520 */ 430, 86, 120, 475, 44, 342, 27, 27, 478, 23,
309 /* 530 */ 154, 27, 27, 141, 643, 3, 3, 45, 194, 24,
310 /* 540 */ 360, 379, 121, 141, 141, 141, 141, 141, 141, 141,
311 /* 550 */ 341, 183, 46, 340, 192, 479, 345, 337, 93, 373,
312 /* 560 */ 430, 372, 61, 57, 430, 28, 126, 475, 125, 58,
313 /* 570 */ 27, 27, 478, 59, 130, 27, 27, 141, 419, 419,
314 /* 580 */ 419, 419, 31, 16, 32, 469, 631, 141, 141, 141,
315 /* 590 */ 141, 141, 141, 141, 29, 29, 29, 29, 29, 29,
316 /* 600 */ 29, 29, 29, 29, 93, 637, 430, 71, 468, 28,
317 /* 610 */ 430, 447, 446, 475, 462, 12, 27, 27, 478, 369,
318 /* 620 */ 139, 27, 27, 141, 40, 448, 419, 419, 419, 419,
319 /* 630 */ 419, 14, 5, 141, 141, 141, 141, 141, 141, 141,
320 /* 640 */ 449, 143, 418, 50, 129, 51, 26, 364, 369, 9,
321 /* 650 */ 17, 363, 152, 72, 18, 28, 29, 29, 29, 29,
322 /* 660 */ 29, 29, 29, 29, 29, 29, 196, 483, 484, 156,
323 /* 670 */ 93, 52, 430, 95, 190, 170, 430, 73, 159, 63,
324 /* 680 */ 1, 479, 27, 27, 478, 162, 75, 27, 27, 69,
325 /* 690 */ 68, 54, 522, 355, 354, 196, 483, 484, 62, 168,
326 /* 700 */ 78, 25, 95, 190, 170, 389, 335, 171, 63, 1,
327 /* 710 */ 172, 333, 173, 334, 141, 332, 331, 174, 69, 68,
328 /* 720 */ 329, 28, 19, 175, 141, 141, 141, 141, 141, 141,
329 /* 730 */ 141, 387, 330, 151, 150, 29, 29, 29, 29, 29,
330 /* 740 */ 29, 29, 29, 29, 29, 431, 386, 494, 408, 407,
331 /* 750 */ 185, 406, 432, 101, 358, 439, 441, 140, 184, 438,
332 /* 760 */ 452, 110, 339, 432, 99, 482, 186, 194, 144, 142,
333 /* 770 */ 187, 431, 188, 122, 456, 91, 463, 371, 191, 30,
334 /* 780 */ 55, 433, 147, 140, 122, 328, 195, 487, 487, 432,
335 /* 790 */ 99, 487, 487, 150, 487, 39, 49, 11, 10, 60,
336 /* 800 */ 465, 111, 463, 150, 487, 487, 487, 487, 147, 487,
337 /* 810 */ 122, 432, 101, 413, 439, 441, 487, 487, 438, 453,
338 /* 820 */ 487, 432, 101, 487, 439, 441, 150, 487, 438, 445,
339 /* 830 */ 487, 487, 122, 487, 487, 487, 487, 487, 431, 487,
340 /* 840 */ 487, 431, 122, 487, 432, 101, 487, 439, 441, 487,
341 /* 850 */ 140, 438, 138, 140, 487, 487, 432, 99, 487, 432,
342 /* 860 */ 99, 487, 487, 487, 487, 122, 487, 135, 487, 463,
343 /* 870 */ 467, 431, 463, 487, 431, 147, 487, 122, 147, 487,
344 /* 880 */ 122, 487, 487, 140, 487, 487, 140, 487, 487, 432,
345 /* 890 */ 99, 487, 432, 99, 487, 487, 487, 487, 487, 487,
346 /* 900 */ 466, 487, 463, 457, 487, 463, 487, 487, 147, 487,
347 /* 910 */ 122, 147, 487, 122, 487, 21, 424, 487, 487, 427,
348 /* 920 */ 487, 487, 22, 424, 487, 487, 427, 428, 487, 487,
349 /* 930 */ 487, 426, 429, 487, 428, 487, 487, 487, 426, 429,
350 /* 940 */ 487, 39, 49, 11, 10, 60, 487, 487, 487, 487,
351 /* 950 */ 487, 487, 487, 487, 487, 487, 487, 487, 487, 412,
353 static const YYCODETYPE yy_lookahead
[] = {
354 /* 0 */ 2, 3, 14, 5, 6, 7, 8, 9, 10, 11,
355 /* 10 */ 12, 13, 14, 14, 15, 16, 28, 143, 144, 20,
356 /* 20 */ 63, 118, 23, 23, 105, 26, 27, 28, 71, 14,
357 /* 30 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
358 /* 40 */ 41, 42, 123, 124, 141, 126, 127, 49, 21, 22,
359 /* 50 */ 23, 24, 25, 26, 27, 28, 29, 30, 59, 60,
360 /* 60 */ 28, 118, 119, 144, 65, 103, 68, 69, 70, 107,
361 /* 70 */ 72, 5, 74, 63, 112, 113, 66, 79, 80, 81,
362 /* 80 */ 82, 83, 2, 3, 141, 5, 6, 7, 8, 9,
363 /* 90 */ 10, 11, 12, 13, 14, 54, 55, 56, 57, 58,
364 /* 100 */ 14, 15, 16, 91, 92, 112, 20, 15, 16, 17,
365 /* 110 */ 18, 19, 26, 27, 28, 153, 157, 31, 32, 33,
366 /* 120 */ 34, 35, 36, 37, 38, 39, 40, 41, 42, 49,
367 /* 130 */ 105, 106, 2, 3, 105, 5, 6, 7, 8, 9,
368 /* 140 */ 10, 11, 12, 13, 14, 59, 153, 81, 68, 69,
369 /* 150 */ 70, 65, 14, 88, 74, 122, 76, 105, 125, 79,
370 /* 160 */ 80, 81, 82, 83, 99, 100, 133, 64, 103, 144,
371 /* 170 */ 137, 138, 107, 144, 71, 107, 108, 112, 113, 49,
372 /* 180 */ 112, 113, 2, 3, 105, 5, 6, 7, 8, 9,
373 /* 190 */ 10, 11, 12, 13, 14, 143, 144, 141, 68, 69,
374 /* 200 */ 70, 141, 123, 124, 74, 141, 88, 105, 136, 79,
375 /* 210 */ 80, 81, 82, 83, 149, 150, 151, 99, 153, 105,
376 /* 220 */ 116, 153, 116, 144, 96, 107, 105, 109, 110, 49,
377 /* 230 */ 112, 113, 2, 3, 105, 5, 6, 7, 8, 9,
378 /* 240 */ 10, 11, 12, 13, 14, 105, 144, 2, 68, 69,
379 /* 250 */ 70, 107, 108, 88, 74, 144, 112, 113, 144, 79,
380 /* 260 */ 80, 81, 82, 83, 99, 144, 14, 149, 150, 151,
381 /* 270 */ 66, 153, 107, 144, 155, 110, 72, 112, 113, 49,
382 /* 280 */ 28, 14, 2, 3, 144, 5, 6, 7, 8, 9,
383 /* 290 */ 10, 11, 12, 13, 14, 28, 153, 153, 68, 69,
384 /* 300 */ 70, 107, 91, 92, 74, 117, 112, 113, 153, 79,
385 /* 310 */ 80, 81, 82, 83, 149, 150, 151, 65, 153, 142,
386 /* 320 */ 1, 2, 3, 4, 79, 80, 81, 105, 85, 49,
387 /* 330 */ 142, 115, 2, 3, 105, 5, 6, 7, 8, 9,
388 /* 340 */ 10, 11, 12, 13, 14, 123, 124, 153, 68, 69,
389 /* 350 */ 70, 142, 123, 124, 74, 117, 105, 76, 105, 79,
390 /* 360 */ 80, 81, 82, 83, 66, 67, 144, 86, 49, 50,
391 /* 370 */ 51, 52, 53, 144, 123, 124, 123, 124, 65, 49,
392 /* 380 */ 142, 140, 2, 3, 105, 5, 6, 7, 8, 9,
393 /* 390 */ 10, 11, 12, 13, 14, 144, 101, 144, 68, 69,
394 /* 400 */ 70, 101, 123, 124, 74, 1, 2, 3, 4, 79,
395 /* 410 */ 80, 81, 82, 83, 22, 23, 24, 25, 26, 27,
396 /* 420 */ 28, 29, 30, 144, 139, 140, 105, 117, 117, 49,
397 /* 430 */ 143, 144, 2, 3, 144, 5, 6, 7, 8, 9,
398 /* 440 */ 10, 11, 12, 13, 14, 143, 144, 101, 68, 69,
399 /* 450 */ 70, 101, 142, 142, 64, 143, 144, 94, 64, 79,
400 /* 460 */ 80, 81, 82, 83, 14, 144, 111, 33, 34, 35,
401 /* 470 */ 36, 37, 38, 39, 40, 41, 42, 88, 28, 49,
402 /* 480 */ 89, 90, 93, 49, 95, 2, 97, 98, 66, 67,
403 /* 490 */ 156, 102, 2, 104, 66, 67, 154, 144, 68, 69,
404 /* 500 */ 70, 14, 71, 114, 115, 66, 67, 66, 67, 79,
405 /* 510 */ 80, 81, 82, 83, 14, 28, 16, 66, 67, 94,
406 /* 520 */ 20, 94, 14, 23, 91, 148, 26, 27, 28, 66,
407 /* 530 */ 67, 31, 32, 33, 145, 146, 147, 91, 149, 66,
408 /* 540 */ 67, 14, 14, 43, 44, 45, 46, 47, 48, 49,
409 /* 550 */ 148, 14, 94, 148, 77, 28, 90, 14, 14, 152,
410 /* 560 */ 16, 152, 73, 64, 20, 65, 86, 23, 67, 64,
411 /* 570 */ 26, 27, 28, 64, 20, 31, 32, 33, 1, 2,
412 /* 580 */ 3, 4, 65, 71, 65, 63, 86, 43, 44, 45,
413 /* 590 */ 46, 47, 48, 49, 21, 22, 23, 24, 25, 26,
414 /* 600 */ 27, 28, 29, 30, 14, 0, 16, 73, 63, 65,
415 /* 610 */ 20, 63, 63, 23, 67, 73, 26, 27, 28, 14,
416 /* 620 */ 76, 31, 32, 33, 65, 67, 49, 50, 51, 52,
417 /* 630 */ 53, 66, 65, 43, 44, 45, 46, 47, 48, 49,
418 /* 640 */ 67, 67, 86, 65, 67, 65, 65, 63, 14, 73,
419 /* 650 */ 71, 63, 67, 67, 65, 65, 21, 22, 23, 24,
420 /* 660 */ 25, 26, 27, 28, 29, 30, 61, 62, 63, 14,
421 /* 670 */ 14, 65, 16, 68, 69, 70, 20, 67, 14, 74,
422 /* 680 */ 75, 28, 26, 27, 28, 14, 67, 31, 32, 84,
423 /* 690 */ 85, 65, 65, 63, 63, 61, 62, 63, 73, 20,
424 /* 700 */ 14, 66, 68, 69, 70, 67, 88, 16, 74, 75,
425 /* 710 */ 66, 93, 16, 95, 33, 97, 98, 65, 84, 85,
426 /* 720 */ 102, 65, 104, 64, 43, 44, 45, 46, 47, 48,
427 /* 730 */ 49, 63, 114, 115, 105, 21, 22, 23, 24, 25,
428 /* 740 */ 26, 27, 28, 29, 30, 105, 63, 71, 14, 14,
429 /* 750 */ 66, 14, 123, 124, 14, 126, 127, 117, 16, 130,
430 /* 760 */ 131, 132, 67, 123, 124, 147, 16, 149, 128, 129,
431 /* 770 */ 65, 105, 64, 144, 134, 14, 136, 78, 16, 73,
432 /* 780 */ 71, 67, 142, 117, 144, 63, 19, 158, 158, 123,
433 /* 790 */ 124, 158, 158, 105, 158, 54, 55, 56, 57, 58,
434 /* 800 */ 134, 135, 136, 105, 158, 158, 158, 158, 142, 158,
435 /* 810 */ 144, 123, 124, 72, 126, 127, 158, 158, 130, 131,
436 /* 820 */ 158, 123, 124, 158, 126, 127, 105, 158, 130, 131,
437 /* 830 */ 158, 158, 144, 158, 158, 158, 158, 158, 105, 158,
438 /* 840 */ 158, 105, 144, 158, 123, 124, 158, 126, 127, 158,
439 /* 850 */ 117, 130, 131, 117, 158, 158, 123, 124, 158, 123,
440 /* 860 */ 124, 158, 158, 158, 158, 144, 158, 134, 158, 136,
441 /* 870 */ 134, 105, 136, 158, 105, 142, 158, 144, 142, 158,
442 /* 880 */ 144, 158, 158, 117, 158, 158, 117, 158, 158, 123,
443 /* 890 */ 124, 158, 123, 124, 158, 158, 158, 158, 158, 158,
444 /* 900 */ 134, 158, 136, 134, 158, 136, 158, 158, 142, 158,
445 /* 910 */ 144, 142, 158, 144, 158, 121, 122, 158, 158, 125,
446 /* 920 */ 158, 158, 121, 122, 158, 158, 125, 133, 158, 158,
447 /* 930 */ 158, 137, 138, 158, 133, 158, 158, 158, 137, 138,
448 /* 940 */ 158, 54, 55, 56, 57, 58, 158, 158, 158, 158,
449 /* 950 */ 158, 158, 158, 158, 158, 158, 158, 158, 158, 72,
451 #define YY_SHIFT_USE_DFLT (960)
452 #define YY_SHIFT_COUNT (196)
453 #define YY_SHIFT_MIN (-43)
454 #define YY_SHIFT_MAX (887)
455 static const short yy_shift_ofst
[] = {
456 /* 0 */ 634, 130, 180, 605, -2, 500, -1, 544, -1, -1,
457 /* 10 */ -1, 590, 590, 590, 590, 86, 41, 41, 230, 280,
458 /* 20 */ 230, 741, 887, 80, 330, 656, 656, 656, 656, 656,
459 /* 30 */ 656, 577, -12, -12, 380, 430, 319, -12, -12, -12,
460 /* 40 */ -12, 267, -43, -12, -12, -12, -43, 0, 0, 15,
461 /* 50 */ 0, 0, 32, 32, 32, 138, 434, 319, 319, 319,
462 /* 60 */ 681, 92, 92, 404, 245, 245, 267, 66, 0, 243,
463 /* 70 */ 15, 0, 313, 313, 32, 313, 32, 313, 390, 394,
464 /* 80 */ 483, 490, 32, 32, 431, 390, 431, 390, 508, 528,
465 /* 90 */ 537, 390, 477, 477, 138, 543, 573, 635, 714, 27,
466 /* 100 */ 27, 27, 27, 27, 392, 252, 281, 298, 422, 10,
467 /* 110 */ 428, 439, 441, 451, 463, 450, 487, 473, 527, 487,
468 /* 120 */ 103, 103, 450, 204, 489, 499, 501, 480, 505, 509,
469 /* 130 */ 517, 554, 512, 519, 522, 545, 548, 534, 549, 547,
470 /* 140 */ 542, 559, 565, 558, 574, 567, 578, 556, 580, 581,
471 /* 150 */ 576, 579, 584, 585, 588, 589, 586, 655, 606, 610,
472 /* 160 */ 664, 653, 619, 671, 626, 627, 630, 631, 625, 679,
473 /* 170 */ 686, 638, 691, 644, 696, 652, 659, 668, 683, 734,
474 /* 180 */ 735, 737, 740, 676, 695, 742, 684, 750, 705, 708,
475 /* 190 */ 761, 699, 762, 706, 709, 722, 767,
477 #define YY_REDUCE_USE_DFLT (-127)
478 #define YY_REDUCE_COUNT (95)
479 #define YY_REDUCE_MIN (-126)
480 #define YY_REDUCE_MAX (801)
481 static const short yy_reduce_ofst
[] = {
482 /* 0 */ 389, 65, 118, 618, 165, 640, 629, 666, 688, 698,
483 /* 10 */ 721, 733, 736, 766, 769, -81, 794, 801, 68, -38,
484 /* 20 */ 144, 33, 33, 194, 194, 79, 222, 229, 251, 253,
485 /* 30 */ 279, -57, 25, 52, -7, -7, -97, 102, 114, 121,
486 /* 40 */ 129, -126, 12, 29, 140, 321, 211, 188, 238, 285,
487 /* 50 */ 310, 311, 287, 302, 312, 391, -41, 56, 60, 64,
488 /* 60 */ 72, 104, 106, 128, 143, 155, 111, 119, 177, 216,
489 /* 70 */ 241, 209, 295, 300, 290, 346, 111, 350, 363, 355,
490 /* 80 */ 334, 342, 353, 111, 433, 425, 446, 427, 377, 402,
491 /* 90 */ 405, 458, 407, 409, 466, 405,
493 static const YYACTIONTYPE yy_default
[] = {
494 /* 0 */ 642, 642, 642, 642, 642, 611, 642, 631, 642, 642,
495 /* 10 */ 642, 631, 631, 631, 631, 642, 642, 642, 537, 642,
496 /* 20 */ 537, 642, 642, 642, 642, 642, 642, 642, 642, 642,
497 /* 30 */ 642, 642, 642, 633, 642, 642, 642, 642, 642, 642,
498 /* 40 */ 642, 633, 642, 642, 642, 642, 642, 631, 631, 642,
499 /* 50 */ 631, 631, 633, 633, 633, 642, 642, 642, 642, 642,
500 /* 60 */ 642, 642, 642, 642, 561, 560, 642, 553, 631, 642,
501 /* 70 */ 642, 631, 642, 642, 642, 642, 538, 642, 495, 545,
502 /* 80 */ 556, 549, 642, 642, 642, 495, 642, 495, 493, 493,
503 /* 90 */ 493, 495, 527, 527, 642, 493, 642, 642, 642, 621,
504 /* 100 */ 601, 600, 592, 503, 591, 642, 642, 642, 642, 642,
505 /* 110 */ 642, 642, 642, 642, 642, 634, 634, 642, 642, 642,
506 /* 120 */ 564, 563, 642, 642, 577, 642, 642, 642, 642, 642,
507 /* 130 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
508 /* 140 */ 642, 642, 612, 642, 642, 642, 642, 642, 642, 642,
509 /* 150 */ 588, 642, 642, 642, 642, 642, 642, 642, 642, 642,
510 /* 160 */ 642, 634, 642, 642, 642, 519, 642, 642, 642, 642,
511 /* 170 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642,
512 /* 180 */ 642, 642, 642, 565, 642, 642, 642, 642, 642, 642,
513 /* 190 */ 642, 642, 642, 504, 642, 642, 642,
515 /********** End of lemon-generated parsing tables *****************************/
517 /* The next table maps tokens (terminal symbols) into fallback tokens.
518 ** If a construct like the following:
520 ** %fallback ID X Y Z.
522 ** appears in the grammar, then ID becomes a fallback token for X, Y,
523 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
524 ** but it does not parse, the type of the token is changed to ID and
525 ** the parse is retried before an error is thrown.
527 ** This feature can be used, for example, to cause some keywords in a language
528 ** to revert to identifiers if they keyword does not apply in the context where
532 static const YYCODETYPE yyFallback
[] = {
533 0, /* $ => nothing */
534 0, /* BOOL => nothing */
535 0, /* INT => nothing */
536 0, /* FLOAT => nothing */
537 14, /* STRING => NAME */
538 0, /* DOUBLE => nothing */
539 0, /* INT8 => nothing */
540 0, /* UINT8 => nothing */
541 0, /* INT16 => nothing */
542 0, /* UINT16 => nothing */
543 0, /* INT32 => nothing */
544 0, /* UINT32 => nothing */
545 0, /* INT64 => nothing */
546 0, /* UINT64 => nothing */
547 0, /* NAME => nothing */
548 0, /* NULL => nothing */
549 0, /* NUMBER => nothing */
550 0, /* TRUE => nothing */
551 0, /* FALSE => nothing */
552 0, /* QUOTED_STRING => nothing */
553 0, /* NSNAME => nothing */
554 0, /* PIPE => nothing */
555 0, /* CARET => nothing */
556 0, /* AMPERSAND => nothing */
557 0, /* LSHIFT => nothing */
558 0, /* RSHIFT => nothing */
559 0, /* PLUS => nothing */
560 0, /* MINUS => nothing */
561 0, /* ASTERISK => nothing */
562 0, /* SLASH => nothing */
563 0, /* MODULO => nothing */
564 0, /* TILDE => nothing */
565 0, /* NOT => nothing */
566 14, /* ZVAL => NAME */
567 0, /* OBJVAL => nothing */
568 0, /* ARRVAL => nothing */
569 0, /* PATHVAL => nothing */
570 0, /* STRLEN => nothing */
571 0, /* STRVAL => nothing */
572 0, /* FLOATVAL => nothing */
573 0, /* INTVAL => nothing */
574 0, /* BOOLVAL => nothing */
575 14, /* COUNT => NAME */
576 0, /* TO_OBJECT => nothing */
577 0, /* TO_ARRAY => nothing */
578 0, /* TO_STRING => nothing */
579 0, /* TO_INT => nothing */
580 0, /* TO_FLOAT => nothing */
581 0, /* TO_BOOL => nothing */
582 0, /* VOID => nothing */
583 0, /* MIXED => nothing */
584 0, /* ARRAY => nothing */
585 0, /* OBJECT => nothing */
586 0, /* CALLABLE => nothing */
587 14, /* TEMP => NAME */
588 14, /* FREE => NAME */
589 14, /* SET => NAME */
590 14, /* LET => NAME */
591 14, /* RETURN => NAME */
592 14, /* CALLOC => NAME */
593 14, /* CALLBACK => NAME */
594 14, /* LIB => NAME */
596 #endif /* YYFALLBACK */
598 /* The following structure represents a single element of the
599 ** parser's stack. Information stored includes:
601 ** + The state number for the parser at this level of the stack.
603 ** + The value of the token stored at this level of the stack.
604 ** (In other words, the "major" token.)
606 ** + The semantic value stored at this level of the stack. This is
607 ** the information used by the action routines in the grammar.
608 ** It is sometimes called the "minor" token.
610 ** After the "shift" half of a SHIFTREDUCE action, the stateno field
611 ** actually contains the reduce action for the second half of the
614 struct yyStackEntry
{
615 YYACTIONTYPE stateno
; /* The state-number, or reduce action in SHIFTREDUCE */
616 YYCODETYPE major
; /* The major token value. This is the code
617 ** number for the token at this stack level */
618 YYMINORTYPE minor
; /* The user-supplied minor token value. This
619 ** is the value of the token */
621 typedef struct yyStackEntry yyStackEntry
;
623 /* The state of the parser is completely contained in an instance of
624 ** the following structure */
626 yyStackEntry
*yytos
; /* Pointer to top element of the stack */
627 #ifdef YYTRACKMAXSTACKDEPTH
628 int yyhwm
; /* High-water mark of the stack */
630 #ifndef YYNOERRORRECOVERY
631 int yyerrcnt
; /* Shifts left before out of the error */
633 ParseARG_SDECL
/* A place to hold %extra_argument */
635 int yystksz
; /* Current side of the stack */
636 yyStackEntry
*yystack
; /* The parser's stack */
637 yyStackEntry yystk0
; /* First stack entry */
639 yyStackEntry yystack
[YYSTACKDEPTH
]; /* The parser's stack */
642 typedef struct yyParser yyParser
;
646 static FILE *yyTraceFILE
= 0;
647 static char *yyTracePrompt
= 0;
652 ** Turn parser tracing on by giving a stream to which to write the trace
653 ** and a prompt to preface each trace message. Tracing is turned off
654 ** by making either argument NULL
658 ** <li> A FILE* to which trace output should be written.
659 ** If NULL, then tracing is turned off.
660 ** <li> A prefix string written at the beginning of every
661 ** line of trace output. If NULL, then tracing is
668 void ParseTrace(FILE *TraceFILE
, char *zTracePrompt
){
669 yyTraceFILE
= TraceFILE
;
670 yyTracePrompt
= zTracePrompt
;
671 if( yyTraceFILE
==0 ) yyTracePrompt
= 0;
672 else if( yyTracePrompt
==0 ) yyTraceFILE
= 0;
677 /* For tracing shifts, the names of all terminals and nonterminals
678 ** are required. The following table supplies these names */
679 static const char *const yyTokenName
[] = {
680 "$", "BOOL", "INT", "FLOAT",
681 "STRING", "DOUBLE", "INT8", "UINT8",
682 "INT16", "UINT16", "INT32", "UINT32",
683 "INT64", "UINT64", "NAME", "NULL",
684 "NUMBER", "TRUE", "FALSE", "QUOTED_STRING",
685 "NSNAME", "PIPE", "CARET", "AMPERSAND",
686 "LSHIFT", "RSHIFT", "PLUS", "MINUS",
687 "ASTERISK", "SLASH", "MODULO", "TILDE",
688 "NOT", "ZVAL", "OBJVAL", "ARRVAL",
689 "PATHVAL", "STRLEN", "STRVAL", "FLOATVAL",
690 "INTVAL", "BOOLVAL", "COUNT", "TO_OBJECT",
691 "TO_ARRAY", "TO_STRING", "TO_INT", "TO_FLOAT",
692 "TO_BOOL", "VOID", "MIXED", "ARRAY",
693 "OBJECT", "CALLABLE", "TEMP", "FREE",
694 "SET", "LET", "RETURN", "CALLOC",
695 "CALLBACK", "LIB", "EOF", "EOS",
696 "COLON", "LPAREN", "COMMA", "RPAREN",
697 "ENUM", "STRUCT", "UNION", "LBRACE",
698 "RBRACE", "EQUALS", "CONST", "TYPEDEF",
699 "ELLIPSIS", "LBRACKET", "RBRACKET", "CHAR",
700 "SHORT", "LONG", "UNSIGNED", "SIGNED",
701 "STATIC", "FUNCTION", "DOLLAR_NAME", "error",
702 "decl_enum", "decl_enum_items", "decl_enum_item", "decl_struct_args_block",
703 "decl_struct_args", "decl_struct", "align_and_size", "decl_union",
704 "const_type", "constant", "decl_typedef", "decl_typedef_body_ex",
705 "decl_typedef_body", "decl_typedef_body_fn_args", "decl", "decl_func",
706 "decl_abi", "decl_var", "decl_vars", "decl_arg",
707 "decl_args", "struct_args", "struct_arg", "decl_layout",
708 "decl_type", "const_decl_type", "impl", "impl_func",
709 "impl_def_val", "impl_var", "impl_arg", "impl_args",
710 "impl_vararg", "impl_stmts", "impl_stmt", "number",
711 "num_exp", "let_stmt", "let_calloc", "let_func",
712 "callback_arg_list", "callback_args", "let_callback", "let_exp",
713 "let_exps", "set_stmt", "set_exp", "set_exps",
714 "set_func", "return_stmt", "free_stmt", "free_exps",
715 "free_exp", "impl_type", "reference", "indirection",
716 "pointers", "file", "blocks", "block",
717 "optional_name", "enum_name", "struct_name", "union_name",
718 "decl_var_array_size", "decl_scalar_type", "decl_scalar_type_short", "decl_scalar_type_long",
719 "decl_scalar_type_long_long", "callback_rval",
724 /* For tracing reduce actions, the names of all rules are required.
726 static const char *const yyRuleName
[] = {
727 /* 0 */ "block ::= LIB QUOTED_STRING EOS",
728 /* 1 */ "block ::= decl",
729 /* 2 */ "block ::= impl",
730 /* 3 */ "block ::= decl_typedef",
731 /* 4 */ "block ::= constant",
732 /* 5 */ "block ::= decl_struct",
733 /* 6 */ "block ::= decl_union",
734 /* 7 */ "block ::= decl_enum",
735 /* 8 */ "optional_name ::=",
736 /* 9 */ "optional_name ::= NAME",
737 /* 10 */ "align_and_size ::=",
738 /* 11 */ "align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN",
739 /* 12 */ "enum_name ::= ENUM optional_name",
740 /* 13 */ "struct_name ::= STRUCT optional_name",
741 /* 14 */ "union_name ::= UNION optional_name",
742 /* 15 */ "decl_enum ::= enum_name LBRACE decl_enum_items RBRACE",
743 /* 16 */ "decl_enum_items ::= decl_enum_item",
744 /* 17 */ "decl_enum_items ::= decl_enum_items COMMA decl_enum_item",
745 /* 18 */ "decl_enum_item ::= NAME EQUALS num_exp",
746 /* 19 */ "decl_enum_item ::= NAME",
747 /* 20 */ "decl_struct_args_block ::= LBRACE struct_args RBRACE",
748 /* 21 */ "decl_struct_args ::= decl_struct_args_block",
749 /* 22 */ "decl_struct_args ::= EOS",
750 /* 23 */ "decl_struct ::= STRUCT NAME align_and_size decl_struct_args",
751 /* 24 */ "decl_union ::= UNION NAME align_and_size decl_struct_args",
752 /* 25 */ "const_type ::= BOOL|INT|FLOAT|STRING",
753 /* 26 */ "constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS",
754 /* 27 */ "decl_typedef ::= TYPEDEF decl_typedef_body EOS",
755 /* 28 */ "decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var",
756 /* 29 */ "decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var",
757 /* 30 */ "decl_typedef_body_ex ::= decl_enum NAME",
758 /* 31 */ "decl_typedef_body ::= decl_typedef_body_ex",
759 /* 32 */ "decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN",
760 /* 33 */ "decl_typedef_body ::= decl_func decl_typedef_body_fn_args",
761 /* 34 */ "decl_typedef_body ::= decl_arg",
762 /* 35 */ "decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS",
763 /* 36 */ "decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS",
764 /* 37 */ "decl_func ::= decl_arg",
765 /* 38 */ "decl_func ::= VOID NAME",
766 /* 39 */ "decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
767 /* 40 */ "decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
768 /* 41 */ "decl_abi ::= NAME",
769 /* 42 */ "decl_var_array_size ::=",
770 /* 43 */ "decl_var_array_size ::= LBRACKET NUMBER RBRACKET",
771 /* 44 */ "decl_var ::= NAME decl_var_array_size",
772 /* 45 */ "decl_var ::= pointers NAME decl_var_array_size",
773 /* 46 */ "decl_vars ::= decl_var",
774 /* 47 */ "decl_vars ::= decl_vars COMMA decl_var",
775 /* 48 */ "decl_arg ::= const_decl_type decl_var",
776 /* 49 */ "decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args",
777 /* 50 */ "decl_arg ::= VOID pointers NAME",
778 /* 51 */ "decl_arg ::= CONST VOID pointers NAME",
779 /* 52 */ "decl_args ::=",
780 /* 53 */ "decl_args ::= VOID",
781 /* 54 */ "decl_args ::= decl_arg",
782 /* 55 */ "decl_args ::= decl_args COMMA decl_arg",
783 /* 56 */ "struct_args ::= struct_arg",
784 /* 57 */ "struct_args ::= struct_args struct_arg",
785 /* 58 */ "struct_arg ::= decl_typedef_body_ex EOS",
786 /* 59 */ "struct_arg ::= decl_arg decl_layout EOS",
787 /* 60 */ "decl_layout ::=",
788 /* 61 */ "decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN",
789 /* 62 */ "decl_scalar_type ::= CHAR",
790 /* 63 */ "decl_scalar_type ::= SHORT decl_scalar_type_short",
791 /* 64 */ "decl_scalar_type_short ::=",
792 /* 65 */ "decl_scalar_type_short ::= INT",
793 /* 66 */ "decl_scalar_type ::= INT",
794 /* 67 */ "decl_scalar_type ::= LONG decl_scalar_type_long",
795 /* 68 */ "decl_scalar_type_long ::=",
796 /* 69 */ "decl_scalar_type_long ::= DOUBLE",
797 /* 70 */ "decl_scalar_type_long ::= LONG decl_scalar_type_long_long",
798 /* 71 */ "decl_scalar_type_long_long ::=",
799 /* 72 */ "decl_scalar_type_long_long ::= INT",
800 /* 73 */ "decl_type ::= UNSIGNED decl_scalar_type",
801 /* 74 */ "decl_type ::= SIGNED decl_scalar_type",
802 /* 75 */ "decl_type ::= UNSIGNED",
803 /* 76 */ "decl_type ::= SIGNED",
804 /* 77 */ "decl_type ::= decl_scalar_type",
805 /* 78 */ "decl_type ::= STRUCT NAME",
806 /* 79 */ "decl_type ::= UNION NAME",
807 /* 80 */ "decl_type ::= ENUM NAME",
808 /* 81 */ "decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME",
809 /* 82 */ "const_decl_type ::= decl_type",
810 /* 83 */ "const_decl_type ::= CONST decl_type",
811 /* 84 */ "impl ::= impl_func LBRACE impl_stmts RBRACE",
812 /* 85 */ "impl ::= STATIC impl_func LBRACE impl_stmts RBRACE",
813 /* 86 */ "impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type",
814 /* 87 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type",
815 /* 88 */ "impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type",
816 /* 89 */ "impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING",
817 /* 90 */ "impl_var ::= reference DOLLAR_NAME",
818 /* 91 */ "impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE",
819 /* 92 */ "impl_arg ::= impl_type impl_var",
820 /* 93 */ "impl_arg ::= impl_type impl_var EQUALS impl_def_val",
821 /* 94 */ "impl_args ::= impl_arg",
822 /* 95 */ "impl_args ::= impl_args COMMA impl_arg",
823 /* 96 */ "impl_stmts ::= impl_stmt",
824 /* 97 */ "impl_stmts ::= impl_stmts impl_stmt",
825 /* 98 */ "impl_stmt ::= return_stmt",
826 /* 99 */ "impl_stmt ::= let_stmt",
827 /* 100 */ "impl_stmt ::= set_stmt",
828 /* 101 */ "impl_stmt ::= free_stmt",
829 /* 102 */ "number ::= NUMBER|NSNAME",
830 /* 103 */ "number ::= decl_var",
831 /* 104 */ "num_exp ::= number",
832 /* 105 */ "num_exp ::= LPAREN num_exp RPAREN",
833 /* 106 */ "num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO num_exp",
834 /* 107 */ "num_exp ::= TILDE|NOT|PLUS|MINUS num_exp",
835 /* 108 */ "let_exp ::= NULL",
836 /* 109 */ "let_exp ::= AMPERSAND NULL",
837 /* 110 */ "let_exp ::= let_callback",
838 /* 111 */ "let_exp ::= let_calloc",
839 /* 112 */ "let_exp ::= AMPERSAND let_calloc",
840 /* 113 */ "let_exp ::= let_func",
841 /* 114 */ "let_exp ::= AMPERSAND let_func",
842 /* 115 */ "let_exp ::= num_exp",
843 /* 116 */ "let_exp ::= AMPERSAND num_exp",
844 /* 117 */ "let_exp ::= decl_var EQUALS let_exp",
845 /* 118 */ "let_stmt ::= LET let_exp EOS",
846 /* 119 */ "let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS",
847 /* 120 */ "let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN",
848 /* 121 */ "let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN",
849 /* 122 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN",
850 /* 123 */ "let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN",
851 /* 124 */ "let_exps ::= let_exp",
852 /* 125 */ "let_exps ::= let_exps COMMA let_exp",
853 /* 126 */ "callback_arg_list ::=",
854 /* 127 */ "callback_arg_list ::= callback_args",
855 /* 128 */ "callback_args ::= set_exp",
856 /* 129 */ "callback_args ::= callback_args COMMA set_exp",
857 /* 130 */ "callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT",
858 /* 131 */ "callback_rval ::= VOID",
859 /* 132 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN",
860 /* 133 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN",
861 /* 134 */ "set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN",
862 /* 135 */ "set_exp ::= set_func",
863 /* 136 */ "set_exp ::= num_exp",
864 /* 137 */ "set_exps ::= set_exp",
865 /* 138 */ "set_exps ::= set_exps COMMA set_exp",
866 /* 139 */ "set_exp ::= impl_var EQUALS set_exp",
867 /* 140 */ "set_stmt ::= SET set_exp EOS",
868 /* 141 */ "return_stmt ::= RETURN set_func EOS",
869 /* 142 */ "free_stmt ::= FREE free_exps EOS",
870 /* 143 */ "free_exps ::= free_exp",
871 /* 144 */ "free_exps ::= free_exps COMMA free_exp",
872 /* 145 */ "free_exp ::= NAME LPAREN decl_vars RPAREN",
873 /* 146 */ "reference ::=",
874 /* 147 */ "reference ::= AMPERSAND",
875 /* 148 */ "indirection ::=",
876 /* 149 */ "indirection ::= pointers",
877 /* 150 */ "pointers ::= ASTERISK",
878 /* 151 */ "pointers ::= pointers ASTERISK",
879 /* 152 */ "file ::= blocks",
880 /* 153 */ "blocks ::= block",
881 /* 154 */ "blocks ::= blocks block",
882 /* 155 */ "block ::= EOF",
883 /* 156 */ "block ::= EOS",
890 ** Try to increase the size of the parser stack. Return the number
891 ** of errors. Return 0 on success.
893 static int yyGrowStack(yyParser
*p
){
898 newSize
= p
->yystksz
*2 + 100;
899 idx
= p
->yytos
? (int)(p
->yytos
- p
->yystack
) : 0;
900 if( p
->yystack
==&p
->yystk0
){
901 pNew
= malloc(newSize
*sizeof(pNew
[0]));
902 if( pNew
) pNew
[0] = p
->yystk0
;
904 pNew
= realloc(p
->yystack
, newSize
*sizeof(pNew
[0]));
908 p
->yytos
= &p
->yystack
[idx
];
911 fprintf(yyTraceFILE
,"%sStack grows from %d to %d entries.\n",
912 yyTracePrompt
, p
->yystksz
, newSize
);
915 p
->yystksz
= newSize
;
921 /* Datatype of the argument to the memory allocated passed as the
922 ** second argument to ParseAlloc() below. This can be changed by
923 ** putting an appropriate #define in the %include section of the input
926 #ifndef YYMALLOCARGTYPE
927 # define YYMALLOCARGTYPE size_t
930 /* Initialize a new parser that has already been allocated.
932 void ParseInit(void *yypParser
){
933 yyParser
*pParser
= (yyParser
*)yypParser
;
934 #ifdef YYTRACKMAXSTACKDEPTH
938 pParser
->yytos
= NULL
;
939 pParser
->yystack
= NULL
;
940 pParser
->yystksz
= 0;
941 if( yyGrowStack(pParser
) ){
942 pParser
->yystack
= &pParser
->yystk0
;
943 pParser
->yystksz
= 1;
946 #ifndef YYNOERRORRECOVERY
947 pParser
->yyerrcnt
= -1;
949 pParser
->yytos
= pParser
->yystack
;
950 pParser
->yystack
[0].stateno
= 0;
951 pParser
->yystack
[0].major
= 0;
954 #ifndef Parse_ENGINEALWAYSONSTACK
956 ** This function allocates a new parser.
957 ** The only argument is a pointer to a function which works like
961 ** A pointer to the function used to allocate memory.
964 ** A pointer to a parser. This pointer is used in subsequent calls
965 ** to Parse and ParseFree.
967 void *ParseAlloc(void *(*mallocProc
)(YYMALLOCARGTYPE
)){
969 pParser
= (yyParser
*)(*mallocProc
)( (YYMALLOCARGTYPE
)sizeof(yyParser
) );
970 if( pParser
) ParseInit(pParser
);
973 #endif /* Parse_ENGINEALWAYSONSTACK */
976 /* The following function deletes the "minor type" or semantic value
977 ** associated with a symbol. The symbol can be either a terminal
978 ** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
979 ** a pointer to the value to be deleted. The code used to do the
980 ** deletions is derived from the %destructor and/or %token_destructor
981 ** directives of the input grammar.
983 static void yy_destructor(
984 yyParser
*yypParser
, /* The parser */
985 YYCODETYPE yymajor
, /* Type code for object to destroy */
986 YYMINORTYPE
*yypminor
/* The object to be destroyed */
990 /* Here is inserted the actions which take place when a
991 ** terminal or non-terminal is destroyed. This can happen
992 ** when the symbol is popped from the stack during a
993 ** reduce or during error processing or when a parser is
994 ** being destroyed before it is finished parsing.
996 ** Note: during a reduce, the only symbols destroyed are those
997 ** which appear on the RHS of the rule, but which are *not* used
998 ** inside the C code.
1000 /********* Begin destructor definitions ***************************************/
1001 /* TERMINAL Destructor */
1005 case 4: /* STRING */
1006 case 5: /* DOUBLE */
1010 case 9: /* UINT16 */
1011 case 10: /* INT32 */
1012 case 11: /* UINT32 */
1013 case 12: /* INT64 */
1014 case 13: /* UINT64 */
1017 case 16: /* NUMBER */
1019 case 18: /* FALSE */
1020 case 19: /* QUOTED_STRING */
1021 case 20: /* NSNAME */
1023 case 22: /* CARET */
1024 case 23: /* AMPERSAND */
1025 case 24: /* LSHIFT */
1026 case 25: /* RSHIFT */
1028 case 27: /* MINUS */
1029 case 28: /* ASTERISK */
1030 case 29: /* SLASH */
1031 case 30: /* MODULO */
1032 case 31: /* TILDE */
1035 case 34: /* OBJVAL */
1036 case 35: /* ARRVAL */
1037 case 36: /* PATHVAL */
1038 case 37: /* STRLEN */
1039 case 38: /* STRVAL */
1040 case 39: /* FLOATVAL */
1041 case 40: /* INTVAL */
1042 case 41: /* BOOLVAL */
1043 case 42: /* COUNT */
1044 case 43: /* TO_OBJECT */
1045 case 44: /* TO_ARRAY */
1046 case 45: /* TO_STRING */
1047 case 46: /* TO_INT */
1048 case 47: /* TO_FLOAT */
1049 case 48: /* TO_BOOL */
1051 case 50: /* MIXED */
1052 case 51: /* ARRAY */
1053 case 52: /* OBJECT */
1054 case 53: /* CALLABLE */
1059 case 58: /* RETURN */
1060 case 59: /* CALLOC */
1061 case 60: /* CALLBACK */
1065 case 64: /* COLON */
1066 case 65: /* LPAREN */
1067 case 66: /* COMMA */
1068 case 67: /* RPAREN */
1070 case 69: /* STRUCT */
1071 case 70: /* UNION */
1072 case 71: /* LBRACE */
1073 case 72: /* RBRACE */
1074 case 73: /* EQUALS */
1075 case 74: /* CONST */
1076 case 75: /* TYPEDEF */
1077 case 76: /* ELLIPSIS */
1078 case 77: /* LBRACKET */
1079 case 78: /* RBRACKET */
1081 case 80: /* SHORT */
1083 case 82: /* UNSIGNED */
1084 case 83: /* SIGNED */
1085 case 84: /* STATIC */
1086 case 85: /* FUNCTION */
1087 case 86: /* DOLLAR_NAME */
1089 #line 37 "src/parser_proc.y"
1090 free((yypminor
->yy0
));
1091 #line 1092 "src/parser_proc.c"
1094 /* Default NON-TERMINAL Destructor */
1095 case 87: /* error */
1096 case 94: /* align_and_size */
1097 case 142: /* reference */
1098 case 143: /* indirection */
1099 case 144: /* pointers */
1100 case 145: /* file */
1101 case 146: /* blocks */
1102 case 147: /* block */
1103 case 148: /* optional_name */
1104 case 149: /* enum_name */
1105 case 150: /* struct_name */
1106 case 151: /* union_name */
1107 case 152: /* decl_var_array_size */
1108 case 153: /* decl_scalar_type */
1109 case 154: /* decl_scalar_type_short */
1110 case 155: /* decl_scalar_type_long */
1111 case 156: /* decl_scalar_type_long_long */
1112 case 157: /* callback_rval */
1114 #line 38 "src/parser_proc.y"
1116 #line 1117 "src/parser_proc.c"
1119 case 88: /* decl_enum */
1121 #line 60 "src/parser_proc.y"
1122 psi_decl_enum_free(&(yypminor
->yy63
));
1123 #line 1124 "src/parser_proc.c"
1126 case 89: /* decl_enum_items */
1127 case 91: /* decl_struct_args_block */
1128 case 92: /* decl_struct_args */
1129 case 101: /* decl_typedef_body_fn_args */
1130 case 106: /* decl_vars */
1131 case 108: /* decl_args */
1132 case 109: /* struct_args */
1133 case 119: /* impl_args */
1134 case 121: /* impl_stmts */
1135 case 132: /* let_exps */
1136 case 135: /* set_exps */
1137 case 139: /* free_exps */
1139 #line 62 "src/parser_proc.y"
1140 psi_plist_free((yypminor
->yy163
));
1141 #line 1142 "src/parser_proc.c"
1144 case 90: /* decl_enum_item */
1146 #line 64 "src/parser_proc.y"
1147 psi_decl_enum_item_free(&(yypminor
->yy217
));
1148 #line 1149 "src/parser_proc.c"
1151 case 93: /* decl_struct */
1153 #line 70 "src/parser_proc.y"
1154 psi_decl_struct_free(&(yypminor
->yy275
));
1155 #line 1156 "src/parser_proc.c"
1158 case 95: /* decl_union */
1160 #line 73 "src/parser_proc.y"
1161 psi_decl_union_free(&(yypminor
->yy271
));
1162 #line 1163 "src/parser_proc.c"
1165 case 96: /* const_type */
1167 #line 75 "src/parser_proc.y"
1168 psi_const_type_free(&(yypminor
->yy171
));
1169 #line 1170 "src/parser_proc.c"
1172 case 97: /* constant */
1174 #line 77 "src/parser_proc.y"
1175 psi_const_free(&(yypminor
->yy154
));
1176 #line 1177 "src/parser_proc.c"
1179 case 98: /* decl_typedef */
1180 case 99: /* decl_typedef_body_ex */
1181 case 100: /* decl_typedef_body */
1182 case 103: /* decl_func */
1183 case 107: /* decl_arg */
1184 case 110: /* struct_arg */
1186 #line 79 "src/parser_proc.y"
1187 psi_decl_arg_free(&(yypminor
->yy184
));
1188 #line 1189 "src/parser_proc.c"
1191 case 102: /* decl */
1193 #line 87 "src/parser_proc.y"
1194 psi_decl_free(&(yypminor
->yy103
));
1195 #line 1196 "src/parser_proc.c"
1198 case 104: /* decl_abi */
1200 #line 91 "src/parser_proc.y"
1201 psi_decl_abi_free(&(yypminor
->yy218
));
1202 #line 1203 "src/parser_proc.c"
1205 case 105: /* decl_var */
1207 #line 93 "src/parser_proc.y"
1208 psi_decl_var_free(&(yypminor
->yy11
));
1209 #line 1210 "src/parser_proc.c"
1212 case 111: /* decl_layout */
1214 #line 105 "src/parser_proc.y"
1215 psi_layout_free(&(yypminor
->yy141
));
1216 #line 1217 "src/parser_proc.c"
1219 case 112: /* decl_type */
1220 case 113: /* const_decl_type */
1222 #line 107 "src/parser_proc.y"
1223 psi_decl_type_free(&(yypminor
->yy132
));
1224 #line 1225 "src/parser_proc.c"
1227 case 114: /* impl */
1229 #line 111 "src/parser_proc.y"
1230 psi_impl_free(&(yypminor
->yy97
));
1231 #line 1232 "src/parser_proc.c"
1234 case 115: /* impl_func */
1236 #line 113 "src/parser_proc.y"
1237 psi_impl_func_free(&(yypminor
->yy168
));
1238 #line 1239 "src/parser_proc.c"
1241 case 116: /* impl_def_val */
1243 #line 115 "src/parser_proc.y"
1244 psi_impl_def_val_free(&(yypminor
->yy93
));
1245 #line 1246 "src/parser_proc.c"
1248 case 117: /* impl_var */
1250 #line 117 "src/parser_proc.y"
1251 psi_impl_var_free(&(yypminor
->yy37
));
1252 #line 1253 "src/parser_proc.c"
1255 case 118: /* impl_arg */
1256 case 120: /* impl_vararg */
1258 #line 119 "src/parser_proc.y"
1259 psi_impl_arg_free(&(yypminor
->yy210
));
1260 #line 1261 "src/parser_proc.c"
1263 case 122: /* impl_stmt */
1265 #line 127 "src/parser_proc.y"
1266 psi_impl_stmt_free(&(yypminor
->yy78
));
1267 #line 1268 "src/parser_proc.c"
1270 case 123: /* number */
1272 #line 129 "src/parser_proc.y"
1273 psi_number_free(&(yypminor
->yy188
));
1274 #line 1275 "src/parser_proc.c"
1277 case 124: /* num_exp */
1279 #line 131 "src/parser_proc.y"
1280 psi_num_exp_free(&(yypminor
->yy259
));
1281 #line 1282 "src/parser_proc.c"
1284 case 125: /* let_stmt */
1286 #line 133 "src/parser_proc.y"
1287 psi_let_stmt_free(&(yypminor
->yy311
));
1288 #line 1289 "src/parser_proc.c"
1291 case 126: /* let_calloc */
1293 #line 135 "src/parser_proc.y"
1294 psi_let_calloc_free(&(yypminor
->yy9
));
1295 #line 1296 "src/parser_proc.c"
1298 case 127: /* let_func */
1300 #line 137 "src/parser_proc.y"
1301 psi_let_func_free(&(yypminor
->yy27
));
1302 #line 1303 "src/parser_proc.c"
1305 case 128: /* callback_arg_list */
1306 case 129: /* callback_args */
1308 #line 139 "src/parser_proc.y"
1309 psi_plist_free((yypminor
->yy43
));
1310 #line 1311 "src/parser_proc.c"
1313 case 130: /* let_callback */
1315 #line 143 "src/parser_proc.y"
1316 psi_let_callback_free(&(yypminor
->yy220
));
1317 #line 1318 "src/parser_proc.c"
1320 case 131: /* let_exp */
1322 #line 145 "src/parser_proc.y"
1323 psi_let_exp_free(&(yypminor
->yy20
));
1324 #line 1325 "src/parser_proc.c"
1327 case 133: /* set_stmt */
1329 #line 149 "src/parser_proc.y"
1330 psi_set_stmt_free(&(yypminor
->yy98
));
1331 #line 1332 "src/parser_proc.c"
1334 case 134: /* set_exp */
1336 #line 151 "src/parser_proc.y"
1337 psi_set_exp_free(&(yypminor
->yy147
));
1338 #line 1339 "src/parser_proc.c"
1341 case 136: /* set_func */
1343 #line 155 "src/parser_proc.y"
1344 psi_set_func_free(&(yypminor
->yy26
));
1345 #line 1346 "src/parser_proc.c"
1348 case 137: /* return_stmt */
1350 #line 157 "src/parser_proc.y"
1351 psi_return_stmt_free(&(yypminor
->yy90
));
1352 #line 1353 "src/parser_proc.c"
1355 case 138: /* free_stmt */
1357 #line 159 "src/parser_proc.y"
1358 psi_free_stmt_free(&(yypminor
->yy192
));
1359 #line 1360 "src/parser_proc.c"
1362 case 140: /* free_exp */
1364 #line 163 "src/parser_proc.y"
1365 psi_free_exp_free(&(yypminor
->yy94
));
1366 #line 1367 "src/parser_proc.c"
1369 case 141: /* impl_type */
1371 #line 165 "src/parser_proc.y"
1372 psi_impl_type_free(&(yypminor
->yy138
));
1373 #line 1374 "src/parser_proc.c"
1376 /********* End destructor definitions *****************************************/
1377 default: break; /* If no destructor action specified: do nothing */
1382 ** Pop the parser's stack once.
1384 ** If there is a destructor routine associated with the token which
1385 ** is popped from the stack, then call it.
1387 static void yy_pop_parser_stack(yyParser
*pParser
){
1388 yyStackEntry
*yytos
;
1389 assert( pParser
->yytos
!=0 );
1390 assert( pParser
->yytos
> pParser
->yystack
);
1391 yytos
= pParser
->yytos
--;
1394 fprintf(yyTraceFILE
,"%sPopping %s\n",
1396 yyTokenName
[yytos
->major
]);
1399 yy_destructor(pParser
, yytos
->major
, &yytos
->minor
);
1403 ** Clear all secondary memory allocations from the parser
1405 void ParseFinalize(void *p
){
1406 yyParser
*pParser
= (yyParser
*)p
;
1407 while( pParser
->yytos
>pParser
->yystack
) yy_pop_parser_stack(pParser
);
1409 if( pParser
->yystack
!=&pParser
->yystk0
) free(pParser
->yystack
);
1413 #ifndef Parse_ENGINEALWAYSONSTACK
1415 ** Deallocate and destroy a parser. Destructors are called for
1416 ** all stack elements before shutting the parser down.
1418 ** If the YYPARSEFREENEVERNULL macro exists (for example because it
1419 ** is defined in a %include section of the input grammar) then it is
1420 ** assumed that the input pointer is never NULL.
1423 void *p
, /* The parser to be deleted */
1424 void (*freeProc
)(void*) /* Function used to reclaim memory */
1426 #ifndef YYPARSEFREENEVERNULL
1432 #endif /* Parse_ENGINEALWAYSONSTACK */
1435 ** Return the peak depth of the stack for a parser.
1437 #ifdef YYTRACKMAXSTACKDEPTH
1438 int ParseStackPeak(void *p
){
1439 yyParser
*pParser
= (yyParser
*)p
;
1440 return pParser
->yyhwm
;
1445 ** Find the appropriate action for a parser given the terminal
1446 ** look-ahead token iLookAhead.
1448 static unsigned int yy_find_shift_action(
1449 yyParser
*pParser
, /* The parser */
1450 YYCODETYPE iLookAhead
/* The look-ahead token */
1453 int stateno
= pParser
->yytos
->stateno
;
1455 if( stateno
>=YY_MIN_REDUCE
) return stateno
;
1456 assert( stateno
<= YY_SHIFT_COUNT
);
1458 i
= yy_shift_ofst
[stateno
];
1459 assert( iLookAhead
!=YYNOCODE
);
1461 if( i
<0 || i
>=YY_ACTTAB_COUNT
|| yy_lookahead
[i
]!=iLookAhead
){
1463 YYCODETYPE iFallback
; /* Fallback token */
1464 if( iLookAhead
<sizeof(yyFallback
)/sizeof(yyFallback
[0])
1465 && (iFallback
= yyFallback
[iLookAhead
])!=0 ){
1468 fprintf(yyTraceFILE
, "%sFALLBACK %s => %s\n",
1469 yyTracePrompt
, yyTokenName
[iLookAhead
], yyTokenName
[iFallback
]);
1472 assert( yyFallback
[iFallback
]==0 ); /* Fallback loop must terminate */
1473 iLookAhead
= iFallback
;
1479 int j
= i
- iLookAhead
+ YYWILDCARD
;
1481 #if YY_SHIFT_MIN+YYWILDCARD<0
1484 #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
1485 j
<YY_ACTTAB_COUNT
&&
1487 yy_lookahead
[j
]==YYWILDCARD
&& iLookAhead
>0
1491 fprintf(yyTraceFILE
, "%sWILDCARD %s => %s\n",
1492 yyTracePrompt
, yyTokenName
[iLookAhead
],
1493 yyTokenName
[YYWILDCARD
]);
1496 return yy_action
[j
];
1499 #endif /* YYWILDCARD */
1500 return yy_default
[stateno
];
1502 return yy_action
[i
];
1508 ** Find the appropriate action for a parser given the non-terminal
1509 ** look-ahead token iLookAhead.
1511 static int yy_find_reduce_action(
1512 int stateno
, /* Current state number */
1513 YYCODETYPE iLookAhead
/* The look-ahead token */
1516 #ifdef YYERRORSYMBOL
1517 if( stateno
>YY_REDUCE_COUNT
){
1518 return yy_default
[stateno
];
1521 assert( stateno
<=YY_REDUCE_COUNT
);
1523 i
= yy_reduce_ofst
[stateno
];
1524 assert( i
!=YY_REDUCE_USE_DFLT
);
1525 assert( iLookAhead
!=YYNOCODE
);
1527 #ifdef YYERRORSYMBOL
1528 if( i
<0 || i
>=YY_ACTTAB_COUNT
|| yy_lookahead
[i
]!=iLookAhead
){
1529 return yy_default
[stateno
];
1532 assert( i
>=0 && i
<YY_ACTTAB_COUNT
);
1533 assert( yy_lookahead
[i
]==iLookAhead
);
1535 return yy_action
[i
];
1539 ** The following routine is called if the stack overflows.
1541 static void yyStackOverflow(yyParser
*yypParser
){
1545 fprintf(yyTraceFILE
,"%sStack Overflow!\n",yyTracePrompt
);
1548 while( yypParser
->yytos
>yypParser
->yystack
) yy_pop_parser_stack(yypParser
);
1549 /* Here code is inserted which will execute if the parser
1550 ** stack every overflows */
1551 /******** Begin %stack_overflow code ******************************************/
1552 /******** End %stack_overflow code ********************************************/
1553 ParseARG_STORE
; /* Suppress warning about unused %extra_argument var */
1557 ** Print tracing information for a SHIFT action
1560 static void yyTraceShift(yyParser
*yypParser
, int yyNewState
){
1562 if( yyNewState
<YYNSTATE
){
1563 fprintf(yyTraceFILE
,"%sShift '%s', go to state %d\n",
1564 yyTracePrompt
,yyTokenName
[yypParser
->yytos
->major
],
1567 fprintf(yyTraceFILE
,"%sShift '%s'\n",
1568 yyTracePrompt
,yyTokenName
[yypParser
->yytos
->major
]);
1573 # define yyTraceShift(X,Y)
1577 ** Perform a shift action.
1579 static void yy_shift(
1580 yyParser
*yypParser
, /* The parser to be shifted */
1581 int yyNewState
, /* The new state to shift in */
1582 int yyMajor
, /* The major token to shift in */
1583 ParseTOKENTYPE yyMinor
/* The minor token to shift in */
1585 yyStackEntry
*yytos
;
1587 #ifdef YYTRACKMAXSTACKDEPTH
1588 if( (int)(yypParser
->yytos
- yypParser
->yystack
)>yypParser
->yyhwm
){
1590 assert( yypParser
->yyhwm
== (int)(yypParser
->yytos
- yypParser
->yystack
) );
1594 if( yypParser
->yytos
>=&yypParser
->yystack
[YYSTACKDEPTH
] ){
1596 yyStackOverflow(yypParser
);
1600 if( yypParser
->yytos
>=&yypParser
->yystack
[yypParser
->yystksz
] ){
1601 if( yyGrowStack(yypParser
) ){
1603 yyStackOverflow(yypParser
);
1608 if( yyNewState
> YY_MAX_SHIFT
){
1609 yyNewState
+= YY_MIN_REDUCE
- YY_MIN_SHIFTREDUCE
;
1611 yytos
= yypParser
->yytos
;
1612 yytos
->stateno
= (YYACTIONTYPE
)yyNewState
;
1613 yytos
->major
= (YYCODETYPE
)yyMajor
;
1614 yytos
->minor
.yy0
= yyMinor
;
1615 yyTraceShift(yypParser
, yyNewState
);
1618 /* The following table contains information about every rule that
1619 ** is used during the reduce.
1621 static const struct {
1622 YYCODETYPE lhs
; /* Symbol on the left-hand side of the rule */
1623 unsigned char nrhs
; /* Number of right-hand side symbols in the rule */
1784 static void yy_accept(yyParser
*); /* Forward Declaration */
1787 ** Perform a reduce action and the shift that must immediately
1788 ** follow the reduce.
1790 static void yy_reduce(
1791 yyParser
*yypParser
, /* The parser */
1792 unsigned int yyruleno
/* Number of the rule by which to reduce */
1794 int yygoto
; /* The next state */
1795 int yyact
; /* The next action */
1796 yyStackEntry
*yymsp
; /* The top of the parser's stack */
1797 int yysize
; /* Amount to pop the stack */
1799 yymsp
= yypParser
->yytos
;
1801 if( yyTraceFILE
&& yyruleno
<(int)(sizeof(yyRuleName
)/sizeof(yyRuleName
[0])) ){
1802 yysize
= yyRuleInfo
[yyruleno
].nrhs
;
1803 fprintf(yyTraceFILE
, "%sReduce [%s], go to state %d.\n", yyTracePrompt
,
1804 yyRuleName
[yyruleno
], yymsp
[-yysize
].stateno
);
1808 /* Check that the stack is large enough to grow by a single entry
1809 ** if the RHS of the rule is empty. This ensures that there is room
1810 ** enough on the stack to push the LHS value */
1811 if( yyRuleInfo
[yyruleno
].nrhs
==0 ){
1812 #ifdef YYTRACKMAXSTACKDEPTH
1813 if( (int)(yypParser
->yytos
- yypParser
->yystack
)>yypParser
->yyhwm
){
1815 assert( yypParser
->yyhwm
== (int)(yypParser
->yytos
- yypParser
->yystack
));
1819 if( yypParser
->yytos
>=&yypParser
->yystack
[YYSTACKDEPTH
-1] ){
1820 yyStackOverflow(yypParser
);
1824 if( yypParser
->yytos
>=&yypParser
->yystack
[yypParser
->yystksz
-1] ){
1825 if( yyGrowStack(yypParser
) ){
1826 yyStackOverflow(yypParser
);
1829 yymsp
= yypParser
->yytos
;
1835 /* Beginning here are the reduction cases. A typical example
1838 ** #line <lineno> <grammarfile>
1839 ** { ... } // User supplied code
1840 ** #line <lineno> <thisfile>
1843 /********** Begin reduce actions **********************************************/
1844 YYMINORTYPE yylhsminor
;
1845 case 0: /* block ::= LIB QUOTED_STRING EOS */
1846 #line 174 "src/parser_proc.y"
1849 P
->error(PSI_DATA(P
), yymsp
[-2].minor
.yy0
, PSI_WARNING
, "Extra 'lib %s' statement has no effect", yymsp
[-1].minor
.yy0
->text
);
1851 P
->file
.ln
= strndup(yymsp
[-1].minor
.yy0
->text
+ 1, yymsp
[-1].minor
.yy0
->size
- 2);
1853 free(yymsp
[-1].minor
.yy0
);
1854 free(yymsp
[-2].minor
.yy0
);
1856 #line 1857 "src/parser_proc.c"
1857 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
1859 case 1: /* block ::= decl */
1860 #line 183 "src/parser_proc.y"
1863 P
->decls
= psi_plist_init((psi_plist_dtor
) psi_decl_free
);
1865 P
->decls
= psi_plist_add(P
->decls
, &yymsp
[0].minor
.yy103
);
1867 #line 1868 "src/parser_proc.c"
1869 case 2: /* block ::= impl */
1870 #line 189 "src/parser_proc.y"
1873 P
->impls
= psi_plist_init((psi_plist_dtor
) psi_impl_free
);
1875 P
->impls
= psi_plist_add(P
->impls
, &yymsp
[0].minor
.yy97
);
1877 #line 1878 "src/parser_proc.c"
1879 case 3: /* block ::= decl_typedef */
1880 #line 195 "src/parser_proc.y"
1883 P
->types
= psi_plist_init((psi_plist_dtor
) psi_decl_arg_free
);
1885 P
->types
= psi_plist_add(P
->types
, &yymsp
[0].minor
.yy184
);
1886 switch (yymsp
[0].minor
.yy184
->type
->type
) {
1888 if (yymsp
[0].minor
.yy184
->type
->real
.strct
) {
1890 P
->structs
= psi_plist_init((psi_plist_dtor
) psi_decl_struct_free
);
1892 P
->structs
= psi_plist_add(P
->structs
, &yymsp
[0].minor
.yy184
->type
->real
.strct
);
1896 if (yymsp
[0].minor
.yy184
->type
->real
.unn
) {
1898 P
->unions
= psi_plist_init((psi_plist_dtor
) psi_decl_union_free
);
1900 P
->unions
= psi_plist_add(P
->unions
, &yymsp
[0].minor
.yy184
->type
->real
.unn
);
1904 if (yymsp
[0].minor
.yy184
->type
->real
.enm
) {
1906 P
->enums
= psi_plist_init((psi_plist_dtor
) psi_decl_enum_free
);
1908 P
->enums
= psi_plist_add(P
->enums
, &yymsp
[0].minor
.yy184
->type
->real
.enm
);
1913 #line 1914 "src/parser_proc.c"
1915 case 4: /* block ::= constant */
1916 #line 227 "src/parser_proc.y"
1919 P
->consts
= psi_plist_init((psi_plist_dtor
) psi_const_free
);
1921 P
->consts
= psi_plist_add(P
->consts
, &yymsp
[0].minor
.yy154
);
1923 #line 1924 "src/parser_proc.c"
1925 case 5: /* block ::= decl_struct */
1926 #line 233 "src/parser_proc.y"
1929 P
->structs
= psi_plist_init((psi_plist_dtor
) psi_decl_struct_free
);
1931 P
->structs
= psi_plist_add(P
->structs
, &yymsp
[0].minor
.yy275
);
1933 #line 1934 "src/parser_proc.c"
1935 case 6: /* block ::= decl_union */
1936 #line 239 "src/parser_proc.y"
1939 P
->unions
= psi_plist_init((psi_plist_dtor
) psi_decl_union_free
);
1941 P
->unions
= psi_plist_add(P
->unions
, &yymsp
[0].minor
.yy271
);
1943 #line 1944 "src/parser_proc.c"
1945 case 7: /* block ::= decl_enum */
1946 #line 245 "src/parser_proc.y"
1949 P
->enums
= psi_plist_init((psi_plist_dtor
) psi_decl_enum_free
);
1951 P
->enums
= psi_plist_add(P
->enums
, &yymsp
[0].minor
.yy63
);
1953 #line 1954 "src/parser_proc.c"
1955 case 8: /* optional_name ::= */
1956 case 42: /* decl_var_array_size ::= */ yytestcase(yyruleno
==42);
1957 case 64: /* decl_scalar_type_short ::= */ yytestcase(yyruleno
==64);
1958 case 68: /* decl_scalar_type_long ::= */ yytestcase(yyruleno
==68);
1959 case 71: /* decl_scalar_type_long_long ::= */ yytestcase(yyruleno
==71);
1960 #line 251 "src/parser_proc.y"
1962 yymsp
[1].minor
.yy0
= NULL
;
1964 #line 1965 "src/parser_proc.c"
1966 case 9: /* optional_name ::= NAME */
1967 case 62: /* decl_scalar_type ::= CHAR */ yytestcase(yyruleno
==62);
1968 case 65: /* decl_scalar_type_short ::= INT */ yytestcase(yyruleno
==65);
1969 case 66: /* decl_scalar_type ::= INT */ yytestcase(yyruleno
==66);
1970 case 69: /* decl_scalar_type_long ::= DOUBLE */ yytestcase(yyruleno
==69);
1971 case 72: /* decl_scalar_type_long_long ::= INT */ yytestcase(yyruleno
==72);
1972 case 130: /* callback_rval ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT */ yytestcase(yyruleno
==130);
1973 case 131: /* callback_rval ::= VOID */ yytestcase(yyruleno
==131);
1974 #line 254 "src/parser_proc.y"
1976 yylhsminor
.yy0
= yymsp
[0].minor
.yy0
;
1978 #line 1979 "src/parser_proc.c"
1979 yymsp
[0].minor
.yy0
= yylhsminor
.yy0
;
1981 case 10: /* align_and_size ::= */
1982 #line 257 "src/parser_proc.y"
1984 yymsp
[1].minor
.yy91
.pos
= 0;
1985 yymsp
[1].minor
.yy91
.len
= 0;
1987 #line 1988 "src/parser_proc.c"
1989 case 11: /* align_and_size ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */
1990 { yy_destructor(yypParser
,64,&yymsp
[-6].minor
);
1991 #line 261 "src/parser_proc.y"
1993 yymsp
[-6].minor
.yy91
.pos
= atol(yymsp
[-3].minor
.yy0
->text
);
1994 yymsp
[-6].minor
.yy91
.len
= atol(yymsp
[-1].minor
.yy0
->text
);
1995 free(yymsp
[-3].minor
.yy0
);
1996 free(yymsp
[-1].minor
.yy0
);
1998 #line 1999 "src/parser_proc.c"
1999 yy_destructor(yypParser
,64,&yymsp
[-5].minor
);
2000 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2001 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
2002 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2005 case 12: /* enum_name ::= ENUM optional_name */
2006 case 13: /* struct_name ::= STRUCT optional_name */ yytestcase(yyruleno
==13);
2007 case 14: /* union_name ::= UNION optional_name */ yytestcase(yyruleno
==14);
2008 #line 267 "src/parser_proc.y"
2010 if (yymsp
[0].minor
.yy0
) {
2011 yylhsminor
.yy0
= yymsp
[0].minor
.yy0
;
2012 free(yymsp
[-1].minor
.yy0
);
2015 psi_token_hash(yymsp
[-1].minor
.yy0
, digest
);
2016 yylhsminor
.yy0
= psi_token_translit(psi_token_append(yymsp
[-1].minor
.yy0
, 1, digest
), " ", "@");
2019 #line 2020 "src/parser_proc.c"
2020 yymsp
[-1].minor
.yy0
= yylhsminor
.yy0
;
2022 case 15: /* decl_enum ::= enum_name LBRACE decl_enum_items RBRACE */
2023 #line 297 "src/parser_proc.y"
2025 yylhsminor
.yy63
= psi_decl_enum_init(yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy163
);
2026 yylhsminor
.yy63
->token
= yymsp
[-3].minor
.yy0
;
2028 #line 2029 "src/parser_proc.c"
2029 yy_destructor(yypParser
,71,&yymsp
[-2].minor
);
2030 yy_destructor(yypParser
,72,&yymsp
[0].minor
);
2031 yymsp
[-3].minor
.yy63
= yylhsminor
.yy63
;
2033 case 16: /* decl_enum_items ::= decl_enum_item */
2034 #line 301 "src/parser_proc.y"
2036 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_decl_enum_item_free
),
2037 &yymsp
[0].minor
.yy217
);
2039 #line 2040 "src/parser_proc.c"
2040 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2042 case 17: /* decl_enum_items ::= decl_enum_items COMMA decl_enum_item */
2043 #line 305 "src/parser_proc.y"
2045 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy217
);
2047 #line 2048 "src/parser_proc.c"
2048 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
2049 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
2051 case 18: /* decl_enum_item ::= NAME EQUALS num_exp */
2052 #line 308 "src/parser_proc.y"
2054 yylhsminor
.yy217
= psi_decl_enum_item_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[0].minor
.yy259
);
2055 yylhsminor
.yy217
->token
= yymsp
[-2].minor
.yy0
;
2057 #line 2058 "src/parser_proc.c"
2058 yy_destructor(yypParser
,73,&yymsp
[-1].minor
);
2059 yymsp
[-2].minor
.yy217
= yylhsminor
.yy217
;
2061 case 19: /* decl_enum_item ::= NAME */
2062 #line 312 "src/parser_proc.y"
2064 yylhsminor
.yy217
= psi_decl_enum_item_init(yymsp
[0].minor
.yy0
->text
, NULL
);
2065 yylhsminor
.yy217
->token
= yymsp
[0].minor
.yy0
;
2067 #line 2068 "src/parser_proc.c"
2068 yymsp
[0].minor
.yy217
= yylhsminor
.yy217
;
2070 case 20: /* decl_struct_args_block ::= LBRACE struct_args RBRACE */
2071 { yy_destructor(yypParser
,71,&yymsp
[-2].minor
);
2072 #line 316 "src/parser_proc.y"
2074 yymsp
[-2].minor
.yy163
= yymsp
[-1].minor
.yy163
;
2076 #line 2077 "src/parser_proc.c"
2077 yy_destructor(yypParser
,72,&yymsp
[0].minor
);
2080 case 21: /* decl_struct_args ::= decl_struct_args_block */
2081 #line 319 "src/parser_proc.y"
2083 yylhsminor
.yy163
= yymsp
[0].minor
.yy163
;
2085 #line 2086 "src/parser_proc.c"
2086 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2088 case 22: /* decl_struct_args ::= EOS */
2089 { yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2090 #line 322 "src/parser_proc.y"
2092 yymsp
[0].minor
.yy163
= psi_plist_init((psi_plist_dtor
) psi_decl_arg_free
);
2094 #line 2095 "src/parser_proc.c"
2097 case 23: /* decl_struct ::= STRUCT NAME align_and_size decl_struct_args */
2098 { yy_destructor(yypParser
,69,&yymsp
[-3].minor
);
2099 #line 325 "src/parser_proc.y"
2101 yymsp
[-3].minor
.yy275
= psi_decl_struct_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[0].minor
.yy163
);
2102 yymsp
[-3].minor
.yy275
->align
= yymsp
[-1].minor
.yy91
.pos
;
2103 yymsp
[-3].minor
.yy275
->size
= yymsp
[-1].minor
.yy91
.len
;
2104 yymsp
[-3].minor
.yy275
->token
= yymsp
[-2].minor
.yy0
;
2106 #line 2107 "src/parser_proc.c"
2109 case 24: /* decl_union ::= UNION NAME align_and_size decl_struct_args */
2110 { yy_destructor(yypParser
,70,&yymsp
[-3].minor
);
2111 #line 331 "src/parser_proc.y"
2113 yymsp
[-3].minor
.yy271
= psi_decl_union_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[0].minor
.yy163
);
2114 yymsp
[-3].minor
.yy271
->align
= yymsp
[-1].minor
.yy91
.pos
;
2115 yymsp
[-3].minor
.yy271
->size
= yymsp
[-1].minor
.yy91
.len
;
2116 yymsp
[-3].minor
.yy271
->token
= yymsp
[-2].minor
.yy0
;
2118 #line 2119 "src/parser_proc.c"
2121 case 25: /* const_type ::= BOOL|INT|FLOAT|STRING */
2122 #line 337 "src/parser_proc.y"
2124 yylhsminor
.yy171
= psi_const_type_init(yymsp
[0].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2125 free(yymsp
[0].minor
.yy0
);
2127 #line 2128 "src/parser_proc.c"
2128 yymsp
[0].minor
.yy171
= yylhsminor
.yy171
;
2130 case 26: /* constant ::= CONST const_type NSNAME EQUALS impl_def_val EOS */
2131 { yy_destructor(yypParser
,74,&yymsp
[-5].minor
);
2132 #line 341 "src/parser_proc.y"
2134 yymsp
[-5].minor
.yy154
= psi_const_init(yymsp
[-4].minor
.yy171
, yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy93
);
2135 yymsp
[-5].minor
.yy154
->token
= yymsp
[-3].minor
.yy0
;
2137 #line 2138 "src/parser_proc.c"
2138 yy_destructor(yypParser
,73,&yymsp
[-2].minor
);
2139 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2142 case 27: /* decl_typedef ::= TYPEDEF decl_typedef_body EOS */
2143 #line 345 "src/parser_proc.y"
2145 yylhsminor
.yy184
= yymsp
[-1].minor
.yy184
;
2146 yylhsminor
.yy184
->token
= yymsp
[-2].minor
.yy0
;
2148 #line 2149 "src/parser_proc.c"
2149 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2150 yymsp
[-2].minor
.yy184
= yylhsminor
.yy184
;
2152 case 28: /* decl_typedef_body_ex ::= struct_name align_and_size decl_struct_args_block decl_var */
2153 #line 349 "src/parser_proc.y"
2155 yylhsminor
.yy184
= psi_decl_arg_init(psi_decl_type_init(PSI_T_STRUCT
, yymsp
[-3].minor
.yy0
->text
), yymsp
[0].minor
.yy11
);
2156 yylhsminor
.yy184
->type
->token
= psi_token_copy(yymsp
[-3].minor
.yy0
);
2157 yylhsminor
.yy184
->type
->real
.strct
= psi_decl_struct_init(yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy163
);
2158 yylhsminor
.yy184
->type
->real
.strct
->token
= yymsp
[-3].minor
.yy0
;
2159 yylhsminor
.yy184
->type
->real
.strct
->align
= yymsp
[-2].minor
.yy91
.pos
;
2160 yylhsminor
.yy184
->type
->real
.strct
->size
= yymsp
[-2].minor
.yy91
.len
;
2162 #line 2163 "src/parser_proc.c"
2163 yymsp
[-3].minor
.yy184
= yylhsminor
.yy184
;
2165 case 29: /* decl_typedef_body_ex ::= union_name align_and_size decl_struct_args_block decl_var */
2166 #line 357 "src/parser_proc.y"
2168 yylhsminor
.yy184
= psi_decl_arg_init(psi_decl_type_init(PSI_T_UNION
, yymsp
[-3].minor
.yy0
->text
), yymsp
[0].minor
.yy11
);
2169 yylhsminor
.yy184
->type
->token
= psi_token_copy(yymsp
[-3].minor
.yy0
);
2170 yylhsminor
.yy184
->type
->real
.unn
= psi_decl_union_init(yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy163
);
2171 yylhsminor
.yy184
->type
->real
.unn
->token
= yymsp
[-3].minor
.yy0
;
2172 yylhsminor
.yy184
->type
->real
.unn
->align
= yymsp
[-2].minor
.yy91
.pos
;
2173 yylhsminor
.yy184
->type
->real
.unn
->size
= yymsp
[-2].minor
.yy91
.len
;
2175 #line 2176 "src/parser_proc.c"
2176 yymsp
[-3].minor
.yy184
= yylhsminor
.yy184
;
2178 case 30: /* decl_typedef_body_ex ::= decl_enum NAME */
2179 #line 365 "src/parser_proc.y"
2181 yylhsminor
.yy184
= psi_decl_arg_init(psi_decl_type_init(PSI_T_ENUM
, yymsp
[-1].minor
.yy63
->name
), psi_decl_var_init(yymsp
[0].minor
.yy0
->text
, 0, 0));
2182 yylhsminor
.yy184
->var
->token
= yymsp
[0].minor
.yy0
;
2183 yylhsminor
.yy184
->type
->token
= psi_token_copy(yymsp
[-1].minor
.yy63
->token
);
2184 yylhsminor
.yy184
->type
->real
.enm
= yymsp
[-1].minor
.yy63
;
2186 #line 2187 "src/parser_proc.c"
2187 yymsp
[-1].minor
.yy184
= yylhsminor
.yy184
;
2189 case 31: /* decl_typedef_body ::= decl_typedef_body_ex */
2190 case 34: /* decl_typedef_body ::= decl_arg */ yytestcase(yyruleno
==34);
2191 case 37: /* decl_func ::= decl_arg */ yytestcase(yyruleno
==37);
2192 #line 371 "src/parser_proc.y"
2194 yylhsminor
.yy184
= yymsp
[0].minor
.yy184
;
2196 #line 2197 "src/parser_proc.c"
2197 yymsp
[0].minor
.yy184
= yylhsminor
.yy184
;
2199 case 32: /* decl_typedef_body_fn_args ::= LPAREN decl_args RPAREN */
2200 { yy_destructor(yypParser
,65,&yymsp
[-2].minor
);
2201 #line 374 "src/parser_proc.y"
2203 yymsp
[-2].minor
.yy163
= yymsp
[-1].minor
.yy163
;
2205 #line 2206 "src/parser_proc.c"
2206 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2209 case 33: /* decl_typedef_body ::= decl_func decl_typedef_body_fn_args */
2210 #line 377 "src/parser_proc.y"
2212 yylhsminor
.yy184
= psi_decl_arg_init(psi_decl_type_init(PSI_T_FUNCTION
, yymsp
[-1].minor
.yy184
->var
->name
), psi_decl_var_copy(yymsp
[-1].minor
.yy184
->var
));
2213 yylhsminor
.yy184
->type
->token
= psi_token_copy(yymsp
[-1].minor
.yy184
->token
);
2214 yylhsminor
.yy184
->type
->real
.func
= psi_decl_init(psi_decl_abi_init("default"), yymsp
[-1].minor
.yy184
, yymsp
[0].minor
.yy163
);
2216 #line 2217 "src/parser_proc.c"
2217 yymsp
[-1].minor
.yy184
= yylhsminor
.yy184
;
2219 case 35: /* decl ::= decl_abi decl_func LPAREN decl_args RPAREN EOS */
2220 #line 385 "src/parser_proc.y"
2222 yylhsminor
.yy103
= psi_decl_init(yymsp
[-5].minor
.yy218
, yymsp
[-4].minor
.yy184
, yymsp
[-2].minor
.yy163
);
2224 #line 2225 "src/parser_proc.c"
2225 yy_destructor(yypParser
,65,&yymsp
[-3].minor
);
2226 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2227 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2228 yymsp
[-5].minor
.yy103
= yylhsminor
.yy103
;
2230 case 36: /* decl ::= decl_abi decl_func LPAREN decl_args COMMA ELLIPSIS RPAREN EOS */
2231 #line 388 "src/parser_proc.y"
2233 yylhsminor
.yy103
= psi_decl_init(yymsp
[-7].minor
.yy218
, yymsp
[-6].minor
.yy184
, yymsp
[-4].minor
.yy163
);
2234 yylhsminor
.yy103
->varargs
= 1;
2236 #line 2237 "src/parser_proc.c"
2237 yy_destructor(yypParser
,65,&yymsp
[-5].minor
);
2238 yy_destructor(yypParser
,66,&yymsp
[-3].minor
);
2239 yy_destructor(yypParser
,76,&yymsp
[-2].minor
);
2240 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2241 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2242 yymsp
[-7].minor
.yy103
= yylhsminor
.yy103
;
2244 case 38: /* decl_func ::= VOID NAME */
2245 #line 395 "src/parser_proc.y"
2247 yylhsminor
.yy184
= psi_decl_arg_init(
2248 psi_decl_type_init(yymsp
[-1].minor
.yy0
->type
, yymsp
[-1].minor
.yy0
->text
),
2249 psi_decl_var_init(yymsp
[0].minor
.yy0
->text
, 0, 0)
2251 yylhsminor
.yy184
->type
->token
= yymsp
[-1].minor
.yy0
;
2252 yylhsminor
.yy184
->var
->token
= yymsp
[0].minor
.yy0
;
2253 yylhsminor
.yy184
->token
= yymsp
[0].minor
.yy0
;
2255 #line 2256 "src/parser_proc.c"
2256 yymsp
[-1].minor
.yy184
= yylhsminor
.yy184
;
2258 case 39: /* decl_typedef_body ::= VOID indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2259 #line 404 "src/parser_proc.y"
2261 struct psi_decl_arg
*func_
= psi_decl_arg_init(
2262 psi_decl_type_init(yymsp
[-6].minor
.yy0
->type
, yymsp
[-6].minor
.yy0
->text
),
2263 psi_decl_var_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[-5].minor
.yy202
, 0)
2265 func_
->type
->token
= yymsp
[-6].minor
.yy0
;
2266 func_
->var
->token
= yymsp
[-2].minor
.yy0
;
2267 func_
->token
= yymsp
[-2].minor
.yy0
;
2268 yylhsminor
.yy184
= psi_decl_arg_init(
2269 psi_decl_type_init(PSI_T_FUNCTION
, func_
->var
->name
),
2270 psi_decl_var_copy(func_
->var
)
2272 yylhsminor
.yy184
->var
->pointer_level
= yymsp
[-3].minor
.yy202
;
2273 yylhsminor
.yy184
->type
->token
= psi_token_copy(func_
->token
);
2274 yylhsminor
.yy184
->type
->real
.func
= psi_decl_init(psi_decl_abi_init("default"), func_
, yymsp
[0].minor
.yy163
);
2276 #line 2277 "src/parser_proc.c"
2277 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2278 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2279 yymsp
[-6].minor
.yy184
= yylhsminor
.yy184
;
2281 case 40: /* decl_typedef_body ::= CONST VOID pointers LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2282 { yy_destructor(yypParser
,74,&yymsp
[-7].minor
);
2283 #line 420 "src/parser_proc.y"
2285 struct psi_decl_arg
*func_
= psi_decl_arg_init(
2286 psi_decl_type_init(yymsp
[-6].minor
.yy0
->type
, yymsp
[-6].minor
.yy0
->text
),
2287 psi_decl_var_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[-5].minor
.yy202
, 0)
2289 func_
->type
->token
= yymsp
[-6].minor
.yy0
;
2290 func_
->var
->token
= yymsp
[-2].minor
.yy0
;
2291 func_
->token
= yymsp
[-2].minor
.yy0
;
2292 yymsp
[-7].minor
.yy184
= psi_decl_arg_init(
2293 psi_decl_type_init(PSI_T_FUNCTION
, func_
->var
->name
),
2294 psi_decl_var_copy(func_
->var
)
2296 yymsp
[-7].minor
.yy184
->var
->pointer_level
= yymsp
[-3].minor
.yy202
;
2297 yymsp
[-7].minor
.yy184
->type
->token
= psi_token_copy(func_
->token
);
2298 yymsp
[-7].minor
.yy184
->type
->real
.func
= psi_decl_init(psi_decl_abi_init("default"), func_
, yymsp
[0].minor
.yy163
);
2300 #line 2301 "src/parser_proc.c"
2301 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2302 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2305 case 41: /* decl_abi ::= NAME */
2306 #line 436 "src/parser_proc.y"
2308 yylhsminor
.yy218
= psi_decl_abi_init(yymsp
[0].minor
.yy0
->text
);
2309 yylhsminor
.yy218
->token
= yymsp
[0].minor
.yy0
;
2311 #line 2312 "src/parser_proc.c"
2312 yymsp
[0].minor
.yy218
= yylhsminor
.yy218
;
2314 case 43: /* decl_var_array_size ::= LBRACKET NUMBER RBRACKET */
2315 { yy_destructor(yypParser
,77,&yymsp
[-2].minor
);
2316 #line 443 "src/parser_proc.y"
2318 yymsp
[-2].minor
.yy0
= yymsp
[-1].minor
.yy0
;
2320 #line 2321 "src/parser_proc.c"
2321 yy_destructor(yypParser
,78,&yymsp
[0].minor
);
2324 case 44: /* decl_var ::= NAME decl_var_array_size */
2325 #line 446 "src/parser_proc.y"
2327 yylhsminor
.yy11
= psi_decl_var_init(yymsp
[-1].minor
.yy0
->text
, 0, yymsp
[0].minor
.yy0
?atol(yymsp
[0].minor
.yy0
->text
):0);
2328 yylhsminor
.yy11
->token
= yymsp
[-1].minor
.yy0
;
2329 if (yymsp
[0].minor
.yy0
) {
2330 free(yymsp
[0].minor
.yy0
);
2333 #line 2334 "src/parser_proc.c"
2334 yymsp
[-1].minor
.yy11
= yylhsminor
.yy11
;
2336 case 45: /* decl_var ::= pointers NAME decl_var_array_size */
2337 #line 453 "src/parser_proc.y"
2339 yylhsminor
.yy11
= psi_decl_var_init(yymsp
[-1].minor
.yy0
->text
, yymsp
[-2].minor
.yy202
+!!yymsp
[0].minor
.yy0
, yymsp
[0].minor
.yy0
?atol(yymsp
[0].minor
.yy0
->text
):0);
2340 yylhsminor
.yy11
->token
= yymsp
[-1].minor
.yy0
;
2341 if (yymsp
[0].minor
.yy0
) {
2342 free(yymsp
[0].minor
.yy0
);
2345 #line 2346 "src/parser_proc.c"
2346 yymsp
[-2].minor
.yy11
= yylhsminor
.yy11
;
2348 case 46: /* decl_vars ::= decl_var */
2349 #line 460 "src/parser_proc.y"
2351 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_decl_var_free
),
2352 &yymsp
[0].minor
.yy11
);
2354 #line 2355 "src/parser_proc.c"
2355 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2357 case 47: /* decl_vars ::= decl_vars COMMA decl_var */
2358 #line 464 "src/parser_proc.y"
2360 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy11
);
2362 #line 2363 "src/parser_proc.c"
2363 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
2364 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
2366 case 48: /* decl_arg ::= const_decl_type decl_var */
2367 #line 467 "src/parser_proc.y"
2369 yylhsminor
.yy184
= psi_decl_arg_init(yymsp
[-1].minor
.yy132
, yymsp
[0].minor
.yy11
);
2371 #line 2372 "src/parser_proc.c"
2372 yymsp
[-1].minor
.yy184
= yylhsminor
.yy184
;
2374 case 49: /* decl_typedef_body ::= const_decl_type indirection LPAREN indirection NAME RPAREN decl_typedef_body_fn_args */
2375 #line 470 "src/parser_proc.y"
2377 struct psi_decl_arg
*func_
= psi_decl_arg_init(
2378 yymsp
[-6].minor
.yy132
,
2379 psi_decl_var_init(yymsp
[-2].minor
.yy0
->text
, yymsp
[-5].minor
.yy202
, 0)
2381 func_
->var
->token
= yymsp
[-2].minor
.yy0
;
2382 func_
->token
= yymsp
[-2].minor
.yy0
;
2383 yylhsminor
.yy184
= psi_decl_arg_init(
2384 psi_decl_type_init(PSI_T_FUNCTION
, func_
->var
->name
),
2385 psi_decl_var_copy(func_
->var
)
2387 yylhsminor
.yy184
->var
->pointer_level
= yymsp
[-3].minor
.yy202
;
2388 yylhsminor
.yy184
->type
->token
= psi_token_copy(func_
->token
);
2389 yylhsminor
.yy184
->type
->real
.func
= psi_decl_init(psi_decl_abi_init("default"), func_
, yymsp
[0].minor
.yy163
);
2391 #line 2392 "src/parser_proc.c"
2392 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2393 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2394 yymsp
[-6].minor
.yy184
= yylhsminor
.yy184
;
2396 case 50: /* decl_arg ::= VOID pointers NAME */
2397 #line 485 "src/parser_proc.y"
2399 yylhsminor
.yy184
= psi_decl_arg_init(
2400 psi_decl_type_init(yymsp
[-2].minor
.yy0
->type
, yymsp
[-2].minor
.yy0
->text
),
2401 psi_decl_var_init(yymsp
[0].minor
.yy0
->text
, yymsp
[-1].minor
.yy202
, 0)
2403 yylhsminor
.yy184
->type
->token
= yymsp
[-2].minor
.yy0
;
2404 yylhsminor
.yy184
->var
->token
= yymsp
[0].minor
.yy0
;
2405 yylhsminor
.yy184
->token
= yymsp
[0].minor
.yy0
;
2407 #line 2408 "src/parser_proc.c"
2408 yymsp
[-2].minor
.yy184
= yylhsminor
.yy184
;
2410 case 51: /* decl_arg ::= CONST VOID pointers NAME */
2411 { yy_destructor(yypParser
,74,&yymsp
[-3].minor
);
2412 #line 494 "src/parser_proc.y"
2414 yymsp
[-3].minor
.yy184
= psi_decl_arg_init(
2415 psi_decl_type_init(yymsp
[-2].minor
.yy0
->type
, yymsp
[-2].minor
.yy0
->text
),
2416 psi_decl_var_init(yymsp
[0].minor
.yy0
->text
, yymsp
[-1].minor
.yy202
, 0)
2418 yymsp
[-3].minor
.yy184
->type
->token
= yymsp
[-2].minor
.yy0
;
2419 yymsp
[-3].minor
.yy184
->var
->token
= yymsp
[0].minor
.yy0
;
2420 yymsp
[-3].minor
.yy184
->token
= yymsp
[0].minor
.yy0
;
2422 #line 2423 "src/parser_proc.c"
2425 case 52: /* decl_args ::= */
2426 #line 503 "src/parser_proc.y"
2428 yymsp
[1].minor
.yy163
= NULL
;
2430 #line 2431 "src/parser_proc.c"
2432 case 53: /* decl_args ::= VOID */
2433 { yy_destructor(yypParser
,49,&yymsp
[0].minor
);
2434 #line 506 "src/parser_proc.y"
2436 yymsp
[0].minor
.yy163
= NULL
;
2438 #line 2439 "src/parser_proc.c"
2441 case 54: /* decl_args ::= decl_arg */
2442 case 56: /* struct_args ::= struct_arg */ yytestcase(yyruleno
==56);
2443 #line 509 "src/parser_proc.y"
2445 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_decl_arg_free
),
2446 &yymsp
[0].minor
.yy184
);
2448 #line 2449 "src/parser_proc.c"
2449 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2451 case 55: /* decl_args ::= decl_args COMMA decl_arg */
2452 #line 513 "src/parser_proc.y"
2454 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy184
);
2456 #line 2457 "src/parser_proc.c"
2457 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
2458 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
2460 case 57: /* struct_args ::= struct_args struct_arg */
2461 #line 520 "src/parser_proc.y"
2463 yylhsminor
.yy163
= psi_plist_add(yymsp
[-1].minor
.yy163
, &yymsp
[0].minor
.yy184
);
2465 #line 2466 "src/parser_proc.c"
2466 yymsp
[-1].minor
.yy163
= yylhsminor
.yy163
;
2468 case 58: /* struct_arg ::= decl_typedef_body_ex EOS */
2469 #line 523 "src/parser_proc.y"
2471 yylhsminor
.yy184
= yymsp
[-1].minor
.yy184
;
2472 switch (yymsp
[-1].minor
.yy184
->type
->type
) {
2474 if (yymsp
[-1].minor
.yy184
->type
->real
.strct
) {
2476 P
->structs
= psi_plist_init((psi_plist_dtor
) psi_decl_struct_free
);
2478 P
->structs
= psi_plist_add(P
->structs
, &yymsp
[-1].minor
.yy184
->type
->real
.strct
);
2482 if (yymsp
[-1].minor
.yy184
->type
->real
.unn
) {
2484 P
->unions
= psi_plist_init((psi_plist_dtor
) psi_decl_union_free
);
2486 P
->unions
= psi_plist_add(P
->unions
, &yymsp
[-1].minor
.yy184
->type
->real
.unn
);
2490 if (yymsp
[-1].minor
.yy184
->type
->real
.enm
) {
2492 P
->enums
= psi_plist_init((psi_plist_dtor
) psi_decl_enum_free
);
2494 P
->enums
= psi_plist_add(P
->enums
, &yymsp
[-1].minor
.yy184
->type
->real
.enm
);
2499 #line 2500 "src/parser_proc.c"
2500 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2501 yymsp
[-1].minor
.yy184
= yylhsminor
.yy184
;
2503 case 59: /* struct_arg ::= decl_arg decl_layout EOS */
2504 #line 552 "src/parser_proc.y"
2506 yymsp
[-2].minor
.yy184
->layout
= yymsp
[-1].minor
.yy141
;
2507 yylhsminor
.yy184
= yymsp
[-2].minor
.yy184
;
2509 #line 2510 "src/parser_proc.c"
2510 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2511 yymsp
[-2].minor
.yy184
= yylhsminor
.yy184
;
2513 case 60: /* decl_layout ::= */
2514 #line 556 "src/parser_proc.y"
2516 yymsp
[1].minor
.yy141
= NULL
;
2518 #line 2519 "src/parser_proc.c"
2520 case 61: /* decl_layout ::= COLON COLON LPAREN NUMBER COMMA NUMBER RPAREN */
2521 { yy_destructor(yypParser
,64,&yymsp
[-6].minor
);
2522 #line 559 "src/parser_proc.y"
2524 yymsp
[-6].minor
.yy141
= psi_layout_init(atol(yymsp
[-3].minor
.yy0
->text
), atol(yymsp
[-1].minor
.yy0
->text
));
2525 free(yymsp
[-3].minor
.yy0
);
2526 free(yymsp
[-1].minor
.yy0
);
2528 #line 2529 "src/parser_proc.c"
2529 yy_destructor(yypParser
,64,&yymsp
[-5].minor
);
2530 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2531 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
2532 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2535 case 63: /* decl_scalar_type ::= SHORT decl_scalar_type_short */
2536 case 67: /* decl_scalar_type ::= LONG decl_scalar_type_long */ yytestcase(yyruleno
==67);
2537 case 70: /* decl_scalar_type_long ::= LONG decl_scalar_type_long_long */ yytestcase(yyruleno
==70);
2538 #line 567 "src/parser_proc.y"
2540 if (yymsp
[0].minor
.yy0
) {
2541 yylhsminor
.yy0
= psi_token_cat(2, yymsp
[-1].minor
.yy0
, yymsp
[0].minor
.yy0
);
2542 free(yymsp
[-1].minor
.yy0
);
2543 free(yymsp
[0].minor
.yy0
);
2545 yylhsminor
.yy0
= yymsp
[-1].minor
.yy0
;
2548 #line 2549 "src/parser_proc.c"
2549 yymsp
[-1].minor
.yy0
= yylhsminor
.yy0
;
2551 case 73: /* decl_type ::= UNSIGNED decl_scalar_type */
2552 case 74: /* decl_type ::= SIGNED decl_scalar_type */ yytestcase(yyruleno
==74);
2553 #line 615 "src/parser_proc.y"
2555 struct psi_token
*T
= psi_token_cat(2, yymsp
[-1].minor
.yy0
, yymsp
[0].minor
.yy0
);
2556 yylhsminor
.yy132
= psi_decl_type_init(T
->type
, T
->text
);
2557 yylhsminor
.yy132
->token
= T
;
2558 free(yymsp
[-1].minor
.yy0
);
2559 free(yymsp
[0].minor
.yy0
);
2561 #line 2562 "src/parser_proc.c"
2562 yymsp
[-1].minor
.yy132
= yylhsminor
.yy132
;
2564 case 75: /* decl_type ::= UNSIGNED */
2565 case 76: /* decl_type ::= SIGNED */ yytestcase(yyruleno
==76);
2566 #line 629 "src/parser_proc.y"
2568 yylhsminor
.yy132
= psi_decl_type_init(PSI_T_NAME
, yymsp
[0].minor
.yy0
->text
);
2569 yylhsminor
.yy132
->token
= yymsp
[0].minor
.yy0
;
2571 #line 2572 "src/parser_proc.c"
2572 yymsp
[0].minor
.yy132
= yylhsminor
.yy132
;
2574 case 77: /* decl_type ::= decl_scalar_type */
2575 case 81: /* decl_type ::= FLOAT|DOUBLE|INT8|UINT8|INT16|UINT16|INT32|UINT32|INT64|UINT64|NAME */ yytestcase(yyruleno
==81);
2576 #line 637 "src/parser_proc.y"
2578 yylhsminor
.yy132
= psi_decl_type_init(yymsp
[0].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2579 yylhsminor
.yy132
->token
= yymsp
[0].minor
.yy0
;
2581 #line 2582 "src/parser_proc.c"
2582 yymsp
[0].minor
.yy132
= yylhsminor
.yy132
;
2584 case 78: /* decl_type ::= STRUCT NAME */
2585 case 79: /* decl_type ::= UNION NAME */ yytestcase(yyruleno
==79);
2586 case 80: /* decl_type ::= ENUM NAME */ yytestcase(yyruleno
==80);
2587 #line 641 "src/parser_proc.y"
2589 yylhsminor
.yy132
= psi_decl_type_init(yymsp
[-1].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2590 yylhsminor
.yy132
->token
= yymsp
[0].minor
.yy0
;
2591 free(yymsp
[-1].minor
.yy0
);
2593 #line 2594 "src/parser_proc.c"
2594 yymsp
[-1].minor
.yy132
= yylhsminor
.yy132
;
2596 case 82: /* const_decl_type ::= decl_type */
2597 #line 660 "src/parser_proc.y"
2599 yylhsminor
.yy132
= yymsp
[0].minor
.yy132
;
2601 #line 2602 "src/parser_proc.c"
2602 yymsp
[0].minor
.yy132
= yylhsminor
.yy132
;
2604 case 83: /* const_decl_type ::= CONST decl_type */
2605 { yy_destructor(yypParser
,74,&yymsp
[-1].minor
);
2606 #line 663 "src/parser_proc.y"
2608 yymsp
[-1].minor
.yy132
= yymsp
[0].minor
.yy132
;
2610 #line 2611 "src/parser_proc.c"
2613 case 84: /* impl ::= impl_func LBRACE impl_stmts RBRACE */
2614 #line 666 "src/parser_proc.y"
2616 yylhsminor
.yy97
= psi_impl_init(yymsp
[-3].minor
.yy168
, yymsp
[-1].minor
.yy163
);
2618 #line 2619 "src/parser_proc.c"
2619 yy_destructor(yypParser
,71,&yymsp
[-2].minor
);
2620 yy_destructor(yypParser
,72,&yymsp
[0].minor
);
2621 yymsp
[-3].minor
.yy97
= yylhsminor
.yy97
;
2623 case 85: /* impl ::= STATIC impl_func LBRACE impl_stmts RBRACE */
2624 { yy_destructor(yypParser
,84,&yymsp
[-4].minor
);
2625 #line 669 "src/parser_proc.y"
2627 yymsp
[-3].minor
.yy168
->static_memory
= 1;
2628 yymsp
[-4].minor
.yy97
= psi_impl_init(yymsp
[-3].minor
.yy168
, yymsp
[-1].minor
.yy163
);
2630 #line 2631 "src/parser_proc.c"
2631 yy_destructor(yypParser
,71,&yymsp
[-2].minor
);
2632 yy_destructor(yypParser
,72,&yymsp
[0].minor
);
2635 case 86: /* impl_func ::= FUNCTION reference NSNAME LPAREN RPAREN COLON impl_type */
2636 { yy_destructor(yypParser
,85,&yymsp
[-6].minor
);
2637 #line 673 "src/parser_proc.y"
2639 yymsp
[-6].minor
.yy168
= psi_impl_func_init(yymsp
[-4].minor
.yy0
->text
, NULL
, yymsp
[0].minor
.yy138
);
2640 yymsp
[-6].minor
.yy168
->token
= yymsp
[-4].minor
.yy0
;
2641 yymsp
[-6].minor
.yy168
->return_reference
= yymsp
[-5].minor
.yy121
;
2643 #line 2644 "src/parser_proc.c"
2644 yy_destructor(yypParser
,65,&yymsp
[-3].minor
);
2645 yy_destructor(yypParser
,67,&yymsp
[-2].minor
);
2646 yy_destructor(yypParser
,64,&yymsp
[-1].minor
);
2649 case 87: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args RPAREN COLON impl_type */
2650 { yy_destructor(yypParser
,85,&yymsp
[-7].minor
);
2651 #line 678 "src/parser_proc.y"
2653 yymsp
[-7].minor
.yy168
= psi_impl_func_init(yymsp
[-5].minor
.yy0
->text
, yymsp
[-3].minor
.yy163
, yymsp
[0].minor
.yy138
);
2654 yymsp
[-7].minor
.yy168
->token
= yymsp
[-5].minor
.yy0
;
2655 yymsp
[-7].minor
.yy168
->return_reference
= yymsp
[-6].minor
.yy121
;
2657 #line 2658 "src/parser_proc.c"
2658 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2659 yy_destructor(yypParser
,67,&yymsp
[-2].minor
);
2660 yy_destructor(yypParser
,64,&yymsp
[-1].minor
);
2663 case 88: /* impl_func ::= FUNCTION reference NSNAME LPAREN impl_args COMMA impl_type reference ELLIPSIS DOLLAR_NAME RPAREN COLON impl_type */
2664 { yy_destructor(yypParser
,85,&yymsp
[-12].minor
);
2665 #line 683 "src/parser_proc.y"
2667 yymsp
[-12].minor
.yy168
= psi_impl_func_init(yymsp
[-10].minor
.yy0
->text
, yymsp
[-8].minor
.yy163
, yymsp
[0].minor
.yy138
);
2668 yymsp
[-12].minor
.yy168
->token
= yymsp
[-10].minor
.yy0
;
2669 yymsp
[-12].minor
.yy168
->return_reference
= yymsp
[-11].minor
.yy121
;
2670 yymsp
[-12].minor
.yy168
->vararg
= psi_impl_arg_init(yymsp
[-6].minor
.yy138
, psi_impl_var_init(yymsp
[-3].minor
.yy0
->text
, yymsp
[-5].minor
.yy121
), NULL
);
2671 free(yymsp
[-3].minor
.yy0
);
2673 #line 2674 "src/parser_proc.c"
2674 yy_destructor(yypParser
,65,&yymsp
[-9].minor
);
2675 yy_destructor(yypParser
,66,&yymsp
[-7].minor
);
2676 yy_destructor(yypParser
,76,&yymsp
[-4].minor
);
2677 yy_destructor(yypParser
,67,&yymsp
[-2].minor
);
2678 yy_destructor(yypParser
,64,&yymsp
[-1].minor
);
2681 case 89: /* impl_def_val ::= NULL|NUMBER|TRUE|FALSE|QUOTED_STRING */
2682 #line 690 "src/parser_proc.y"
2684 yylhsminor
.yy93
= psi_impl_def_val_init(yymsp
[0].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2685 yylhsminor
.yy93
->token
= yymsp
[0].minor
.yy0
;
2687 #line 2688 "src/parser_proc.c"
2688 yymsp
[0].minor
.yy93
= yylhsminor
.yy93
;
2690 case 90: /* impl_var ::= reference DOLLAR_NAME */
2691 #line 694 "src/parser_proc.y"
2693 yylhsminor
.yy37
= psi_impl_var_init(yymsp
[0].minor
.yy0
->text
, yymsp
[-1].minor
.yy121
);
2694 yylhsminor
.yy37
->token
= yymsp
[0].minor
.yy0
;
2696 #line 2697 "src/parser_proc.c"
2697 yymsp
[-1].minor
.yy37
= yylhsminor
.yy37
;
2699 case 91: /* impl_type ::= VOID|MIXED|BOOL|INT|FLOAT|STRING|ARRAY|OBJECT|CALLABLE */
2700 #line 698 "src/parser_proc.y"
2702 yylhsminor
.yy138
= psi_impl_type_init(yymsp
[0].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2703 free(yymsp
[0].minor
.yy0
);
2705 #line 2706 "src/parser_proc.c"
2706 yymsp
[0].minor
.yy138
= yylhsminor
.yy138
;
2708 case 92: /* impl_arg ::= impl_type impl_var */
2709 #line 702 "src/parser_proc.y"
2711 yylhsminor
.yy210
= psi_impl_arg_init(yymsp
[-1].minor
.yy138
, yymsp
[0].minor
.yy37
, NULL
);
2713 #line 2714 "src/parser_proc.c"
2714 yymsp
[-1].minor
.yy210
= yylhsminor
.yy210
;
2716 case 93: /* impl_arg ::= impl_type impl_var EQUALS impl_def_val */
2717 #line 705 "src/parser_proc.y"
2719 yylhsminor
.yy210
= psi_impl_arg_init(yymsp
[-3].minor
.yy138
, yymsp
[-2].minor
.yy37
, yymsp
[0].minor
.yy93
);
2721 #line 2722 "src/parser_proc.c"
2722 yy_destructor(yypParser
,73,&yymsp
[-1].minor
);
2723 yymsp
[-3].minor
.yy210
= yylhsminor
.yy210
;
2725 case 94: /* impl_args ::= impl_arg */
2726 #line 708 "src/parser_proc.y"
2728 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_impl_arg_free
),
2729 &yymsp
[0].minor
.yy210
);
2731 #line 2732 "src/parser_proc.c"
2732 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2734 case 95: /* impl_args ::= impl_args COMMA impl_arg */
2735 #line 712 "src/parser_proc.y"
2737 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy210
);
2739 #line 2740 "src/parser_proc.c"
2740 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
2741 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
2743 case 96: /* impl_stmts ::= impl_stmt */
2744 #line 715 "src/parser_proc.y"
2746 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_impl_stmt_free
),
2747 &yymsp
[0].minor
.yy78
);
2749 #line 2750 "src/parser_proc.c"
2750 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
2752 case 97: /* impl_stmts ::= impl_stmts impl_stmt */
2753 #line 719 "src/parser_proc.y"
2755 yylhsminor
.yy163
= psi_plist_add(yymsp
[-1].minor
.yy163
, &yymsp
[0].minor
.yy78
);
2757 #line 2758 "src/parser_proc.c"
2758 yymsp
[-1].minor
.yy163
= yylhsminor
.yy163
;
2760 case 98: /* impl_stmt ::= return_stmt */
2761 #line 722 "src/parser_proc.y"
2763 yylhsminor
.yy78
= (struct psi_token
**) yymsp
[0].minor
.yy90
;
2765 #line 2766 "src/parser_proc.c"
2766 yymsp
[0].minor
.yy78
= yylhsminor
.yy78
;
2768 case 99: /* impl_stmt ::= let_stmt */
2769 #line 725 "src/parser_proc.y"
2771 yylhsminor
.yy78
= (struct psi_token
**) yymsp
[0].minor
.yy311
;
2773 #line 2774 "src/parser_proc.c"
2774 yymsp
[0].minor
.yy78
= yylhsminor
.yy78
;
2776 case 100: /* impl_stmt ::= set_stmt */
2777 #line 728 "src/parser_proc.y"
2779 yylhsminor
.yy78
= (struct psi_token
**) yymsp
[0].minor
.yy98
;
2781 #line 2782 "src/parser_proc.c"
2782 yymsp
[0].minor
.yy78
= yylhsminor
.yy78
;
2784 case 101: /* impl_stmt ::= free_stmt */
2785 #line 731 "src/parser_proc.y"
2787 yylhsminor
.yy78
= (struct psi_token
**) yymsp
[0].minor
.yy192
;
2789 #line 2790 "src/parser_proc.c"
2790 yymsp
[0].minor
.yy78
= yylhsminor
.yy78
;
2792 case 102: /* number ::= NUMBER|NSNAME */
2793 #line 734 "src/parser_proc.y"
2795 yylhsminor
.yy188
= psi_number_init(yymsp
[0].minor
.yy0
->type
, yymsp
[0].minor
.yy0
->text
);
2796 yylhsminor
.yy188
->token
= yymsp
[0].minor
.yy0
;
2798 #line 2799 "src/parser_proc.c"
2799 yymsp
[0].minor
.yy188
= yylhsminor
.yy188
;
2801 case 103: /* number ::= decl_var */
2802 #line 738 "src/parser_proc.y"
2804 yylhsminor
.yy188
= psi_number_init(PSI_T_NAME
, yymsp
[0].minor
.yy11
);
2805 yylhsminor
.yy188
->token
= psi_token_copy(yymsp
[0].minor
.yy11
->token
);
2807 #line 2808 "src/parser_proc.c"
2808 yymsp
[0].minor
.yy188
= yylhsminor
.yy188
;
2810 case 104: /* num_exp ::= number */
2811 #line 742 "src/parser_proc.y"
2813 yylhsminor
.yy259
= psi_num_exp_init_num(yymsp
[0].minor
.yy188
);
2814 yylhsminor
.yy259
->token
= psi_token_copy(yymsp
[0].minor
.yy188
->token
);
2816 #line 2817 "src/parser_proc.c"
2817 yymsp
[0].minor
.yy259
= yylhsminor
.yy259
;
2819 case 105: /* num_exp ::= LPAREN num_exp RPAREN */
2820 #line 746 "src/parser_proc.y"
2822 yylhsminor
.yy259
= psi_num_exp_init_unary(PSI_T_LPAREN
, yymsp
[-1].minor
.yy259
);
2823 yylhsminor
.yy259
->token
= yymsp
[-2].minor
.yy0
;
2825 #line 2826 "src/parser_proc.c"
2826 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2827 yymsp
[-2].minor
.yy259
= yylhsminor
.yy259
;
2829 case 106: /* num_exp ::= num_exp PIPE|CARET|AMPERSAND|LSHIFT|RSHIFT|PLUS|MINUS|ASTERISK|SLASH|MODULO num_exp */
2830 #line 750 "src/parser_proc.y"
2832 yylhsminor
.yy259
= psi_num_exp_init_binary(yymsp
[-1].minor
.yy0
->type
, yymsp
[-2].minor
.yy259
, yymsp
[0].minor
.yy259
);
2833 yylhsminor
.yy259
->token
= yymsp
[-1].minor
.yy0
;
2835 #line 2836 "src/parser_proc.c"
2836 yymsp
[-2].minor
.yy259
= yylhsminor
.yy259
;
2838 case 107: /* num_exp ::= TILDE|NOT|PLUS|MINUS num_exp */
2839 #line 754 "src/parser_proc.y"
2841 yylhsminor
.yy259
= psi_num_exp_init_unary(yymsp
[-1].minor
.yy0
->type
, yymsp
[0].minor
.yy259
);
2842 yylhsminor
.yy259
->token
= yymsp
[-1].minor
.yy0
;
2844 #line 2845 "src/parser_proc.c"
2845 yymsp
[-1].minor
.yy259
= yylhsminor
.yy259
;
2847 case 108: /* let_exp ::= NULL */
2848 { yy_destructor(yypParser
,15,&yymsp
[0].minor
);
2849 #line 758 "src/parser_proc.y"
2851 yymsp
[0].minor
.yy20
= psi_let_exp_init(PSI_LET_NULL
, NULL
);
2853 #line 2854 "src/parser_proc.c"
2856 case 109: /* let_exp ::= AMPERSAND NULL */
2857 { yy_destructor(yypParser
,23,&yymsp
[-1].minor
);
2858 #line 761 "src/parser_proc.y"
2860 yymsp
[-1].minor
.yy20
= psi_let_exp_init(PSI_LET_NULL
, NULL
);
2861 yymsp
[-1].minor
.yy20
->is_reference
= 1;
2863 #line 2864 "src/parser_proc.c"
2864 yy_destructor(yypParser
,15,&yymsp
[0].minor
);
2867 case 110: /* let_exp ::= let_callback */
2868 #line 765 "src/parser_proc.y"
2870 yylhsminor
.yy20
= psi_let_exp_init(PSI_LET_CALLBACK
, yymsp
[0].minor
.yy220
);
2872 #line 2873 "src/parser_proc.c"
2873 yymsp
[0].minor
.yy20
= yylhsminor
.yy20
;
2875 case 111: /* let_exp ::= let_calloc */
2876 #line 768 "src/parser_proc.y"
2878 yylhsminor
.yy20
= psi_let_exp_init(PSI_LET_CALLOC
, yymsp
[0].minor
.yy9
);
2880 #line 2881 "src/parser_proc.c"
2881 yymsp
[0].minor
.yy20
= yylhsminor
.yy20
;
2883 case 112: /* let_exp ::= AMPERSAND let_calloc */
2884 { yy_destructor(yypParser
,23,&yymsp
[-1].minor
);
2885 #line 771 "src/parser_proc.y"
2887 yymsp
[-1].minor
.yy20
= psi_let_exp_init(PSI_LET_CALLOC
, yymsp
[0].minor
.yy9
);
2888 yymsp
[-1].minor
.yy20
->is_reference
= 1;
2890 #line 2891 "src/parser_proc.c"
2893 case 113: /* let_exp ::= let_func */
2894 #line 775 "src/parser_proc.y"
2896 yylhsminor
.yy20
= psi_let_exp_init_ex(NULL
, PSI_LET_FUNC
, yymsp
[0].minor
.yy27
);
2898 #line 2899 "src/parser_proc.c"
2899 yymsp
[0].minor
.yy20
= yylhsminor
.yy20
;
2901 case 114: /* let_exp ::= AMPERSAND let_func */
2902 { yy_destructor(yypParser
,23,&yymsp
[-1].minor
);
2903 #line 778 "src/parser_proc.y"
2905 yymsp
[-1].minor
.yy20
= psi_let_exp_init_ex(NULL
, PSI_LET_FUNC
, yymsp
[0].minor
.yy27
);
2906 yymsp
[-1].minor
.yy20
->is_reference
= 1;
2908 #line 2909 "src/parser_proc.c"
2911 case 115: /* let_exp ::= num_exp */
2912 #line 782 "src/parser_proc.y"
2914 yylhsminor
.yy20
= psi_let_exp_init_ex(NULL
, PSI_LET_NUMEXP
, yymsp
[0].minor
.yy259
);
2916 #line 2917 "src/parser_proc.c"
2917 yymsp
[0].minor
.yy20
= yylhsminor
.yy20
;
2919 case 116: /* let_exp ::= AMPERSAND num_exp */
2920 { yy_destructor(yypParser
,23,&yymsp
[-1].minor
);
2921 #line 785 "src/parser_proc.y"
2923 yymsp
[-1].minor
.yy20
= psi_let_exp_init_ex(NULL
, PSI_LET_NUMEXP
, yymsp
[0].minor
.yy259
);
2924 yymsp
[-1].minor
.yy20
->is_reference
= 1;
2926 #line 2927 "src/parser_proc.c"
2929 case 117: /* let_exp ::= decl_var EQUALS let_exp */
2930 #line 789 "src/parser_proc.y"
2932 yylhsminor
.yy20
= yymsp
[0].minor
.yy20
;
2933 yylhsminor
.yy20
->var
= yymsp
[-2].minor
.yy11
;
2935 #line 2936 "src/parser_proc.c"
2936 yy_destructor(yypParser
,73,&yymsp
[-1].minor
);
2937 yymsp
[-2].minor
.yy20
= yylhsminor
.yy20
;
2939 case 118: /* let_stmt ::= LET let_exp EOS */
2940 #line 793 "src/parser_proc.y"
2942 yylhsminor
.yy311
= psi_let_stmt_init(yymsp
[-1].minor
.yy20
);
2943 yylhsminor
.yy311
->token
= yymsp
[-2].minor
.yy0
;
2945 #line 2946 "src/parser_proc.c"
2946 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2947 yymsp
[-2].minor
.yy311
= yylhsminor
.yy311
;
2949 case 119: /* let_stmt ::= TEMP decl_var EQUALS reference decl_var EOS */
2950 #line 797 "src/parser_proc.y"
2952 yylhsminor
.yy311
= psi_let_stmt_init(psi_let_exp_init_ex(yymsp
[-4].minor
.yy11
, PSI_LET_TMP
, yymsp
[-1].minor
.yy11
));
2953 yylhsminor
.yy311
->token
= yymsp
[-5].minor
.yy0
;
2954 yylhsminor
.yy311
->exp
->is_reference
= yymsp
[-2].minor
.yy121
? 1 : 0;
2956 #line 2957 "src/parser_proc.c"
2957 yy_destructor(yypParser
,73,&yymsp
[-3].minor
);
2958 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
2959 yymsp
[-5].minor
.yy311
= yylhsminor
.yy311
;
2961 case 120: /* let_callback ::= CALLBACK callback_rval LPAREN impl_var LPAREN callback_arg_list RPAREN RPAREN */
2962 #line 802 "src/parser_proc.y"
2964 yylhsminor
.yy220
= psi_let_callback_init(psi_let_func_init(yymsp
[-6].minor
.yy0
->type
, yymsp
[-6].minor
.yy0
->text
, yymsp
[-4].minor
.yy37
), yymsp
[-2].minor
.yy43
);
2965 yylhsminor
.yy220
->token
= yymsp
[-7].minor
.yy0
;
2966 free(yymsp
[-6].minor
.yy0
);
2968 #line 2969 "src/parser_proc.c"
2969 yy_destructor(yypParser
,65,&yymsp
[-5].minor
);
2970 yy_destructor(yypParser
,65,&yymsp
[-3].minor
);
2971 yy_destructor(yypParser
,67,&yymsp
[-1].minor
);
2972 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2973 yymsp
[-7].minor
.yy220
= yylhsminor
.yy220
;
2975 case 121: /* let_calloc ::= CALLOC LPAREN num_exp COMMA num_exp RPAREN */
2976 #line 807 "src/parser_proc.y"
2978 yylhsminor
.yy9
= psi_let_calloc_init(yymsp
[-3].minor
.yy259
, yymsp
[-1].minor
.yy259
);
2979 yylhsminor
.yy9
->token
= yymsp
[-5].minor
.yy0
;
2981 #line 2982 "src/parser_proc.c"
2982 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
2983 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
2984 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2985 yymsp
[-5].minor
.yy9
= yylhsminor
.yy9
;
2987 case 122: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var RPAREN */
2988 #line 811 "src/parser_proc.y"
2990 yylhsminor
.yy27
= psi_let_func_init(yymsp
[-3].minor
.yy0
->type
, yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy37
);
2991 yylhsminor
.yy27
->token
= yymsp
[-3].minor
.yy0
;
2993 #line 2994 "src/parser_proc.c"
2994 yy_destructor(yypParser
,65,&yymsp
[-2].minor
);
2995 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
2996 yymsp
[-3].minor
.yy27
= yylhsminor
.yy27
;
2998 case 123: /* let_func ::= ZVAL|OBJVAL|ARRVAL|PATHVAL|STRLEN|STRVAL|FLOATVAL|INTVAL|BOOLVAL|COUNT LPAREN impl_var COMMA let_exps RPAREN */
2999 #line 815 "src/parser_proc.y"
3001 yylhsminor
.yy27
= psi_let_func_init(yymsp
[-5].minor
.yy0
->type
, yymsp
[-5].minor
.yy0
->text
, yymsp
[-3].minor
.yy37
);
3002 yylhsminor
.yy27
->token
= yymsp
[-5].minor
.yy0
;
3003 yylhsminor
.yy27
->inner
= yymsp
[-1].minor
.yy163
;
3005 #line 3006 "src/parser_proc.c"
3006 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
3007 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
3008 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
3009 yymsp
[-5].minor
.yy27
= yylhsminor
.yy27
;
3011 case 124: /* let_exps ::= let_exp */
3012 #line 820 "src/parser_proc.y"
3014 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_let_exp_free
),
3015 &yymsp
[0].minor
.yy20
);
3017 #line 3018 "src/parser_proc.c"
3018 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
3020 case 125: /* let_exps ::= let_exps COMMA let_exp */
3021 #line 824 "src/parser_proc.y"
3023 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy20
);
3025 #line 3026 "src/parser_proc.c"
3026 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
3027 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
3029 case 126: /* callback_arg_list ::= */
3030 #line 827 "src/parser_proc.y"
3032 yymsp
[1].minor
.yy43
= NULL
;
3034 #line 3035 "src/parser_proc.c"
3036 case 127: /* callback_arg_list ::= callback_args */
3037 #line 830 "src/parser_proc.y"
3039 yylhsminor
.yy43
= yymsp
[0].minor
.yy43
;
3041 #line 3042 "src/parser_proc.c"
3042 yymsp
[0].minor
.yy43
= yylhsminor
.yy43
;
3044 case 128: /* callback_args ::= set_exp */
3045 #line 833 "src/parser_proc.y"
3047 yylhsminor
.yy43
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_set_exp_free
),
3048 &yymsp
[0].minor
.yy147
);
3050 #line 3051 "src/parser_proc.c"
3051 yymsp
[0].minor
.yy43
= yylhsminor
.yy43
;
3053 case 129: /* callback_args ::= callback_args COMMA set_exp */
3054 #line 837 "src/parser_proc.y"
3056 yylhsminor
.yy43
= psi_plist_add(yymsp
[-2].minor
.yy43
, &yymsp
[0].minor
.yy147
);
3058 #line 3059 "src/parser_proc.c"
3059 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
3060 yymsp
[-2].minor
.yy43
= yylhsminor
.yy43
;
3062 case 132: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var RPAREN */
3063 #line 846 "src/parser_proc.y"
3065 yylhsminor
.yy26
= psi_set_func_init(yymsp
[-3].minor
.yy0
->type
, yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy11
);
3066 yylhsminor
.yy26
->token
= yymsp
[-3].minor
.yy0
;
3068 #line 3069 "src/parser_proc.c"
3069 yy_destructor(yypParser
,65,&yymsp
[-2].minor
);
3070 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
3071 yymsp
[-3].minor
.yy26
= yylhsminor
.yy26
;
3073 case 133: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA set_exps RPAREN */
3074 #line 850 "src/parser_proc.y"
3076 yylhsminor
.yy26
= psi_set_func_init(yymsp
[-5].minor
.yy0
->type
, yymsp
[-5].minor
.yy0
->text
, yymsp
[-3].minor
.yy11
);
3077 yylhsminor
.yy26
->token
= yymsp
[-5].minor
.yy0
;
3078 yylhsminor
.yy26
->inner
= yymsp
[-1].minor
.yy163
;
3080 #line 3081 "src/parser_proc.c"
3081 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
3082 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
3083 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
3084 yymsp
[-5].minor
.yy26
= yylhsminor
.yy26
;
3086 case 134: /* set_func ::= TO_OBJECT|TO_ARRAY|TO_STRING|TO_INT|TO_FLOAT|TO_BOOL|ZVAL|VOID LPAREN decl_var COMMA ELLIPSIS RPAREN */
3087 #line 855 "src/parser_proc.y"
3089 yylhsminor
.yy26
= psi_set_func_init(yymsp
[-5].minor
.yy0
->type
, yymsp
[-5].minor
.yy0
->text
, yymsp
[-3].minor
.yy11
);
3090 yylhsminor
.yy26
->token
= yymsp
[-5].minor
.yy0
;
3091 yylhsminor
.yy26
->recursive
= 1;
3093 #line 3094 "src/parser_proc.c"
3094 yy_destructor(yypParser
,65,&yymsp
[-4].minor
);
3095 yy_destructor(yypParser
,66,&yymsp
[-2].minor
);
3096 yy_destructor(yypParser
,76,&yymsp
[-1].minor
);
3097 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
3098 yymsp
[-5].minor
.yy26
= yylhsminor
.yy26
;
3100 case 135: /* set_exp ::= set_func */
3101 #line 860 "src/parser_proc.y"
3103 yylhsminor
.yy147
= psi_set_exp_init(PSI_SET_FUNC
, yymsp
[0].minor
.yy26
);
3105 #line 3106 "src/parser_proc.c"
3106 yymsp
[0].minor
.yy147
= yylhsminor
.yy147
;
3108 case 136: /* set_exp ::= num_exp */
3109 #line 863 "src/parser_proc.y"
3111 yylhsminor
.yy147
= psi_set_exp_init(PSI_SET_NUMEXP
, yymsp
[0].minor
.yy259
);
3113 #line 3114 "src/parser_proc.c"
3114 yymsp
[0].minor
.yy147
= yylhsminor
.yy147
;
3116 case 137: /* set_exps ::= set_exp */
3117 #line 866 "src/parser_proc.y"
3119 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_set_exp_free
),
3120 &yymsp
[0].minor
.yy147
);
3122 #line 3123 "src/parser_proc.c"
3123 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
3125 case 138: /* set_exps ::= set_exps COMMA set_exp */
3126 #line 870 "src/parser_proc.y"
3128 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy147
);
3130 #line 3131 "src/parser_proc.c"
3131 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
3132 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
3134 case 139: /* set_exp ::= impl_var EQUALS set_exp */
3135 #line 873 "src/parser_proc.y"
3137 yylhsminor
.yy147
= yymsp
[0].minor
.yy147
;
3138 yylhsminor
.yy147
->var
= yymsp
[-2].minor
.yy37
;
3140 #line 3141 "src/parser_proc.c"
3141 yy_destructor(yypParser
,73,&yymsp
[-1].minor
);
3142 yymsp
[-2].minor
.yy147
= yylhsminor
.yy147
;
3144 case 140: /* set_stmt ::= SET set_exp EOS */
3145 #line 877 "src/parser_proc.y"
3147 yylhsminor
.yy98
= psi_set_stmt_init(yymsp
[-1].minor
.yy147
);
3148 yylhsminor
.yy98
->token
= yymsp
[-2].minor
.yy0
;
3150 #line 3151 "src/parser_proc.c"
3151 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
3152 yymsp
[-2].minor
.yy98
= yylhsminor
.yy98
;
3154 case 141: /* return_stmt ::= RETURN set_func EOS */
3155 #line 881 "src/parser_proc.y"
3157 yylhsminor
.yy90
= psi_return_stmt_init(psi_set_exp_init(PSI_SET_FUNC
, yymsp
[-1].minor
.yy26
));
3158 yylhsminor
.yy90
->token
= yymsp
[-2].minor
.yy0
;
3160 #line 3161 "src/parser_proc.c"
3161 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
3162 yymsp
[-2].minor
.yy90
= yylhsminor
.yy90
;
3164 case 142: /* free_stmt ::= FREE free_exps EOS */
3165 #line 885 "src/parser_proc.y"
3167 yylhsminor
.yy192
= psi_free_stmt_init(yymsp
[-1].minor
.yy163
);
3168 yylhsminor
.yy192
->token
= yymsp
[-2].minor
.yy0
;
3170 #line 3171 "src/parser_proc.c"
3171 yy_destructor(yypParser
,63,&yymsp
[0].minor
);
3172 yymsp
[-2].minor
.yy192
= yylhsminor
.yy192
;
3174 case 143: /* free_exps ::= free_exp */
3175 #line 889 "src/parser_proc.y"
3177 yylhsminor
.yy163
= psi_plist_add(psi_plist_init((psi_plist_dtor
) psi_free_exp_free
),
3178 &yymsp
[0].minor
.yy94
);
3180 #line 3181 "src/parser_proc.c"
3181 yymsp
[0].minor
.yy163
= yylhsminor
.yy163
;
3183 case 144: /* free_exps ::= free_exps COMMA free_exp */
3184 #line 893 "src/parser_proc.y"
3186 yylhsminor
.yy163
= psi_plist_add(yymsp
[-2].minor
.yy163
, &yymsp
[0].minor
.yy94
);
3188 #line 3189 "src/parser_proc.c"
3189 yy_destructor(yypParser
,66,&yymsp
[-1].minor
);
3190 yymsp
[-2].minor
.yy163
= yylhsminor
.yy163
;
3192 case 145: /* free_exp ::= NAME LPAREN decl_vars RPAREN */
3193 #line 896 "src/parser_proc.y"
3195 yylhsminor
.yy94
= psi_free_exp_init(yymsp
[-3].minor
.yy0
->text
, yymsp
[-1].minor
.yy163
);
3196 yylhsminor
.yy94
->token
= yymsp
[-3].minor
.yy0
;
3198 #line 3199 "src/parser_proc.c"
3199 yy_destructor(yypParser
,65,&yymsp
[-2].minor
);
3200 yy_destructor(yypParser
,67,&yymsp
[0].minor
);
3201 yymsp
[-3].minor
.yy94
= yylhsminor
.yy94
;
3203 case 146: /* reference ::= */
3204 #line 900 "src/parser_proc.y"
3206 yymsp
[1].minor
.yy121
= false;
3208 #line 3209 "src/parser_proc.c"
3210 case 147: /* reference ::= AMPERSAND */
3211 { yy_destructor(yypParser
,23,&yymsp
[0].minor
);
3212 #line 903 "src/parser_proc.y"
3214 yymsp
[0].minor
.yy121
= true;
3216 #line 3217 "src/parser_proc.c"
3219 case 148: /* indirection ::= */
3220 #line 906 "src/parser_proc.y"
3222 yymsp
[1].minor
.yy202
= 0;
3224 #line 3225 "src/parser_proc.c"
3226 case 149: /* indirection ::= pointers */
3227 #line 909 "src/parser_proc.y"
3229 yylhsminor
.yy202
= yymsp
[0].minor
.yy202
;
3231 #line 3232 "src/parser_proc.c"
3232 yymsp
[0].minor
.yy202
= yylhsminor
.yy202
;
3234 case 150: /* pointers ::= ASTERISK */
3235 { yy_destructor(yypParser
,28,&yymsp
[0].minor
);
3236 #line 912 "src/parser_proc.y"
3238 yymsp
[0].minor
.yy202
= 1;
3240 #line 3241 "src/parser_proc.c"
3243 case 151: /* pointers ::= pointers ASTERISK */
3244 #line 915 "src/parser_proc.y"
3246 yylhsminor
.yy202
= yymsp
[-1].minor
.yy202
+1;
3248 #line 3249 "src/parser_proc.c"
3249 yy_destructor(yypParser
,28,&yymsp
[0].minor
);
3250 yymsp
[-1].minor
.yy202
= yylhsminor
.yy202
;
3252 case 152: /* file ::= blocks */
3253 { yy_destructor(yypParser
,146,&yymsp
[0].minor
);
3254 #line 169 "src/parser_proc.y"
3257 #line 3258 "src/parser_proc.c"
3260 case 153: /* blocks ::= block */
3261 { yy_destructor(yypParser
,147,&yymsp
[0].minor
);
3262 #line 170 "src/parser_proc.y"
3265 #line 3266 "src/parser_proc.c"
3268 case 154: /* blocks ::= blocks block */
3269 { yy_destructor(yypParser
,146,&yymsp
[-1].minor
);
3270 #line 171 "src/parser_proc.y"
3273 #line 3274 "src/parser_proc.c"
3274 yy_destructor(yypParser
,147,&yymsp
[0].minor
);
3277 case 155: /* block ::= EOF */
3278 { yy_destructor(yypParser
,62,&yymsp
[0].minor
);
3279 #line 172 "src/parser_proc.y"
3282 #line 3283 "src/parser_proc.c"
3285 case 156: /* block ::= EOS */
3286 { yy_destructor(yypParser
,63,&yymsp
[0].minor
);
3287 #line 173 "src/parser_proc.y"
3290 #line 3291 "src/parser_proc.c"
3295 /********** End reduce actions ************************************************/
3297 assert( yyruleno
<sizeof(yyRuleInfo
)/sizeof(yyRuleInfo
[0]) );
3298 yygoto
= yyRuleInfo
[yyruleno
].lhs
;
3299 yysize
= yyRuleInfo
[yyruleno
].nrhs
;
3300 yyact
= yy_find_reduce_action(yymsp
[-yysize
].stateno
,(YYCODETYPE
)yygoto
);
3301 if( yyact
<= YY_MAX_SHIFTREDUCE
){
3302 if( yyact
>YY_MAX_SHIFT
){
3303 yyact
+= YY_MIN_REDUCE
- YY_MIN_SHIFTREDUCE
;
3306 yypParser
->yytos
= yymsp
;
3307 yymsp
->stateno
= (YYACTIONTYPE
)yyact
;
3308 yymsp
->major
= (YYCODETYPE
)yygoto
;
3309 yyTraceShift(yypParser
, yyact
);
3311 assert( yyact
== YY_ACCEPT_ACTION
);
3312 yypParser
->yytos
-= yysize
;
3313 yy_accept(yypParser
);
3318 ** The following code executes when the parse fails
3320 #ifndef YYNOERRORRECOVERY
3321 static void yy_parse_failed(
3322 yyParser
*yypParser
/* The parser */
3327 fprintf(yyTraceFILE
,"%sFail!\n",yyTracePrompt
);
3330 while( yypParser
->yytos
>yypParser
->yystack
) yy_pop_parser_stack(yypParser
);
3331 /* Here code is inserted which will be executed whenever the
3333 /************ Begin %parse_failure code ***************************************/
3334 /************ End %parse_failure code *****************************************/
3335 ParseARG_STORE
; /* Suppress warning about unused %extra_argument variable */
3337 #endif /* YYNOERRORRECOVERY */
3340 ** The following code executes when a syntax error first occurs.
3342 static void yy_syntax_error(
3343 yyParser
*yypParser
, /* The parser */
3344 int yymajor
, /* The major type of the error token */
3345 ParseTOKENTYPE yyminor
/* The minor type of the error token */
3348 #define TOKEN yyminor
3349 /************ Begin %syntax_error code ****************************************/
3350 #line 40 "src/parser_proc.y"
3351 ++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"); }
3352 #line 3353 "src/parser_proc.c"
3353 /************ End %syntax_error code ******************************************/
3354 ParseARG_STORE
; /* Suppress warning about unused %extra_argument variable */
3358 ** The following is executed when the parser accepts
3360 static void yy_accept(
3361 yyParser
*yypParser
/* The parser */
3366 fprintf(yyTraceFILE
,"%sAccept!\n",yyTracePrompt
);
3369 #ifndef YYNOERRORRECOVERY
3370 yypParser
->yyerrcnt
= -1;
3372 assert( yypParser
->yytos
==yypParser
->yystack
);
3373 /* Here code is inserted which will be executed whenever the
3374 ** parser accepts */
3375 /*********** Begin %parse_accept code *****************************************/
3376 /*********** End %parse_accept code *******************************************/
3377 ParseARG_STORE
; /* Suppress warning about unused %extra_argument variable */
3380 /* The main parser program.
3381 ** The first argument is a pointer to a structure obtained from
3382 ** "ParseAlloc" which describes the current state of the parser.
3383 ** The second argument is the major token number. The third is
3384 ** the minor token. The fourth optional argument is whatever the
3385 ** user wants (and specified in the grammar) and is available for
3386 ** use by the action routines.
3390 ** <li> A pointer to the parser (an opaque structure.)
3391 ** <li> The major token number.
3392 ** <li> The minor token number.
3393 ** <li> An option argument of a grammar-specified type.
3400 void *yyp
, /* The parser */
3401 int yymajor
, /* The major token code number */
3402 ParseTOKENTYPE yyminor
/* The value for the token */
3403 ParseARG_PDECL
/* Optional %extra_argument parameter */
3405 YYMINORTYPE yyminorunion
;
3406 unsigned int yyact
; /* The parser action. */
3407 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
3408 int yyendofinput
; /* True if we are at the end of input */
3410 #ifdef YYERRORSYMBOL
3411 int yyerrorhit
= 0; /* True if yymajor has invoked an error */
3413 yyParser
*yypParser
; /* The parser */
3415 yypParser
= (yyParser
*)yyp
;
3416 assert( yypParser
->yytos
!=0 );
3417 #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
3418 yyendofinput
= (yymajor
==0);
3424 fprintf(yyTraceFILE
,"%sInput '%s'\n",yyTracePrompt
,yyTokenName
[yymajor
]);
3429 yyact
= yy_find_shift_action(yypParser
,(YYCODETYPE
)yymajor
);
3430 if( yyact
<= YY_MAX_SHIFTREDUCE
){
3431 yy_shift(yypParser
,yyact
,yymajor
,yyminor
);
3432 #ifndef YYNOERRORRECOVERY
3433 yypParser
->yyerrcnt
--;
3436 }else if( yyact
<= YY_MAX_REDUCE
){
3437 yy_reduce(yypParser
,yyact
-YY_MIN_REDUCE
);
3439 assert( yyact
== YY_ERROR_ACTION
);
3440 yyminorunion
.yy0
= yyminor
;
3441 #ifdef YYERRORSYMBOL
3446 fprintf(yyTraceFILE
,"%sSyntax Error!\n",yyTracePrompt
);
3449 #ifdef YYERRORSYMBOL
3450 /* A syntax error has occurred.
3451 ** The response to an error depends upon whether or not the
3452 ** grammar defines an error token "ERROR".
3454 ** This is what we do if the grammar does define ERROR:
3456 ** * Call the %syntax_error function.
3458 ** * Begin popping the stack until we enter a state where
3459 ** it is legal to shift the error symbol, then shift
3460 ** the error symbol.
3462 ** * Set the error count to three.
3464 ** * Begin accepting and shifting new tokens. No new error
3465 ** processing will occur until three tokens have been
3466 ** shifted successfully.
3469 if( yypParser
->yyerrcnt
<0 ){
3470 yy_syntax_error(yypParser
,yymajor
,yyminor
);
3472 yymx
= yypParser
->yytos
->major
;
3473 if( yymx
==YYERRORSYMBOL
|| yyerrorhit
){
3476 fprintf(yyTraceFILE
,"%sDiscard input token %s\n",
3477 yyTracePrompt
,yyTokenName
[yymajor
]);
3480 yy_destructor(yypParser
, (YYCODETYPE
)yymajor
, &yyminorunion
);
3483 while( yypParser
->yytos
>= yypParser
->yystack
3484 && yymx
!= YYERRORSYMBOL
3485 && (yyact
= yy_find_reduce_action(
3486 yypParser
->yytos
->stateno
,
3487 YYERRORSYMBOL
)) >= YY_MIN_REDUCE
3489 yy_pop_parser_stack(yypParser
);
3491 if( yypParser
->yytos
< yypParser
->yystack
|| yymajor
==0 ){
3492 yy_destructor(yypParser
,(YYCODETYPE
)yymajor
,&yyminorunion
);
3493 yy_parse_failed(yypParser
);
3494 #ifndef YYNOERRORRECOVERY
3495 yypParser
->yyerrcnt
= -1;
3498 }else if( yymx
!=YYERRORSYMBOL
){
3499 yy_shift(yypParser
,yyact
,YYERRORSYMBOL
,yyminor
);
3502 yypParser
->yyerrcnt
= 3;
3504 #elif defined(YYNOERRORRECOVERY)
3505 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
3506 ** do any kind of error recovery. Instead, simply invoke the syntax
3507 ** error routine and continue going as if nothing had happened.
3509 ** Applications can set this macro (for example inside %include) if
3510 ** they intend to abandon the parse upon the first syntax error seen.
3512 yy_syntax_error(yypParser
,yymajor
, yyminor
);
3513 yy_destructor(yypParser
,(YYCODETYPE
)yymajor
,&yyminorunion
);
3516 #else /* YYERRORSYMBOL is not defined */
3517 /* This is what we do if the grammar does not define ERROR:
3519 ** * Report an error message, and throw away the input token.
3521 ** * If the input token is $, then fail the parse.
3523 ** As before, subsequent error messages are suppressed until
3524 ** three input tokens have been successfully shifted.
3526 if( yypParser
->yyerrcnt
<=0 ){
3527 yy_syntax_error(yypParser
,yymajor
, yyminor
);
3529 yypParser
->yyerrcnt
= 3;
3530 yy_destructor(yypParser
,(YYCODETYPE
)yymajor
,&yyminorunion
);
3532 yy_parse_failed(yypParser
);
3533 #ifndef YYNOERRORRECOVERY
3534 yypParser
->yyerrcnt
= -1;
3540 }while( yymajor
!=YYNOCODE
&& yypParser
->yytos
>yypParser
->yystack
);
3545 fprintf(yyTraceFILE
,"%sReturn. Stack=",yyTracePrompt
);
3546 for(i
=&yypParser
->yystack
[1]; i
<=yypParser
->yytos
; i
++){
3547 fprintf(yyTraceFILE
,"%c%s", cDiv
, yyTokenName
[i
->major
]);
3550 fprintf(yyTraceFILE
,"]\n");