don't crash if an extrn symbol isn't referenced
[xorcyst.git] / parser.c
blobe27120df960e399c1345ab7a8760300555c2b570
1 /* A Bison parser, made by GNU Bison 2.0. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
42 /* Pure parsers. */
43 #define YYPURE 0
45 /* Using locations. */
46 #define YYLSP_NEEDED 1
50 /* Tokens. */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
54 know about them. */
55 enum yytokentype {
56 INTEGER_LITERAL = 258,
57 STRING_LITERAL = 259,
58 FILE_PATH = 260,
59 IDENTIFIER = 261,
60 LOCAL_ID = 262,
61 FORWARD_BRANCH = 263,
62 BACKWARD_BRANCH = 264,
63 LABEL = 265,
64 LOCAL_LABEL = 266,
65 MNEMONIC = 267,
66 _LABEL_ = 268,
67 BYTE = 269,
68 CHAR = 270,
69 WORD = 271,
70 DWORD = 272,
71 DSB = 273,
72 DSW = 274,
73 DSD = 275,
74 DATASEG = 276,
75 CODESEG = 277,
76 IF = 278,
77 IFDEF = 279,
78 IFNDEF = 280,
79 ELSE = 281,
80 ELIF = 282,
81 ENDIF = 283,
82 INCSRC = 284,
83 INCBIN = 285,
84 MACRO = 286,
85 REPT = 287,
86 WHILE = 288,
87 ENDM = 289,
88 ALIGN = 290,
89 EQU = 291,
90 DEFINE = 292,
91 END = 293,
92 PUBLIC = 294,
93 EXTRN = 295,
94 CHARMAP = 296,
95 STRUC = 297,
96 UNION = 298,
97 ENDS = 299,
98 RECORD = 300,
99 ENUM = 301,
100 ENDE = 302,
101 PROC = 303,
102 ENDP = 304,
103 SIZEOF = 305,
104 MASK = 306,
105 TAG = 307,
106 MESSAGE = 308,
107 WARNING = 309,
108 ERROR = 310,
109 ZEROPAGE = 311,
110 ORG = 312,
111 SCOPE_OP = 313,
112 HI_OP = 314,
113 LO_OP = 315,
114 NE_OP = 316,
115 EQ_OP = 317,
116 GE_OP = 318,
117 LE_OP = 319,
118 SHR_OP = 320,
119 SHL_OP = 321,
120 UMINUS = 322
122 #endif
123 #define INTEGER_LITERAL 258
124 #define STRING_LITERAL 259
125 #define FILE_PATH 260
126 #define IDENTIFIER 261
127 #define LOCAL_ID 262
128 #define FORWARD_BRANCH 263
129 #define BACKWARD_BRANCH 264
130 #define LABEL 265
131 #define LOCAL_LABEL 266
132 #define MNEMONIC 267
133 #define _LABEL_ 268
134 #define BYTE 269
135 #define CHAR 270
136 #define WORD 271
137 #define DWORD 272
138 #define DSB 273
139 #define DSW 274
140 #define DSD 275
141 #define DATASEG 276
142 #define CODESEG 277
143 #define IF 278
144 #define IFDEF 279
145 #define IFNDEF 280
146 #define ELSE 281
147 #define ELIF 282
148 #define ENDIF 283
149 #define INCSRC 284
150 #define INCBIN 285
151 #define MACRO 286
152 #define REPT 287
153 #define WHILE 288
154 #define ENDM 289
155 #define ALIGN 290
156 #define EQU 291
157 #define DEFINE 292
158 #define END 293
159 #define PUBLIC 294
160 #define EXTRN 295
161 #define CHARMAP 296
162 #define STRUC 297
163 #define UNION 298
164 #define ENDS 299
165 #define RECORD 300
166 #define ENUM 301
167 #define ENDE 302
168 #define PROC 303
169 #define ENDP 304
170 #define SIZEOF 305
171 #define MASK 306
172 #define TAG 307
173 #define MESSAGE 308
174 #define WARNING 309
175 #define ERROR 310
176 #define ZEROPAGE 311
177 #define ORG 312
178 #define SCOPE_OP 313
179 #define HI_OP 314
180 #define LO_OP 315
181 #define NE_OP 316
182 #define EQ_OP 317
183 #define GE_OP 318
184 #define LE_OP 319
185 #define SHR_OP 320
186 #define SHL_OP 321
187 #define UMINUS 322
192 /* Copy the first part of user declarations. */
193 #line 1 "parser.y"
196 * $Id: parser.y,v 1.14 2007/11/11 22:35:51 khansen Exp $
197 * $Log: parser.y,v $
198 * Revision 1.14 2007/11/11 22:35:51 khansen
199 * compile on mac
201 * Revision 1.13 2007/08/19 11:19:47 khansen
202 * --case-insensitive option
204 * Revision 1.12 2007/08/12 18:59:00 khansen
205 * ability to generate pure 6502 binary
207 * Revision 1.11 2007/08/11 01:25:50 khansen
208 * includepaths support (-I option)
210 * Revision 1.10 2007/07/22 13:34:38 khansen
211 * convert tabs to whitespaces
213 * Revision 1.9 2005/01/05 02:28:40 kenth
214 * anonymous union parsing
216 * Revision 1.8 2004/12/29 21:45:26 kenth
217 * xorcyst 1.4.2
218 * static indexing
220 * Revision 1.7 2004/12/19 19:59:14 kenth
221 * xorcyst 1.4.0
223 * Revision 1.6 2004/12/16 13:22:27 kenth
224 * xorcyst 1.3.5
226 * Revision 1.5 2004/12/14 01:50:42 kenth
227 * xorcyst 1.3.0
229 * Revision 1.4 2004/12/11 02:12:41 kenth
230 * xorcyst 1.2.0
232 * Revision 1.3 2004/12/09 11:17:15 kenth
233 * added: warning_statement, error_statement
235 * Revision 1.2 2004/12/06 05:06:21 kenth
236 * xorcyst 1.1.0
238 * Revision 1.1 2004/06/30 07:57:03 kenth
239 * Initial revision
242 #include <stdlib.h>
243 #include <stdio.h>
244 #include <string.h>
245 #include "symtab.h"
246 #include "loc.h"
247 #include "xasm.h"
248 //#define YYDEBUG 1
249 int yyparse(void);
250 void yyerror(const char *); /* In lexer */
251 int yylex(void); /* In lexer */
252 int yypushandrestart(const char *, int); /* In lexer */
253 void __yy_memcpy(char *, char *, int);
254 extern char *yytext; /* In lexer */
255 extern YYLTYPE yylloc; /* In lexer */
256 char *scan_include(int); /* In lexer */
257 extern astnode *root_node; /* Root of the generated parse tree */
258 void handle_incsrc(astnode *); /* See below */
259 void handle_incbin(astnode *); /* See below */
262 /* Enabling traces. */
263 #ifndef YYDEBUG
264 # define YYDEBUG 0
265 #endif
267 /* Enabling verbose error messages. */
268 #ifdef YYERROR_VERBOSE
269 # undef YYERROR_VERBOSE
270 # define YYERROR_VERBOSE 1
271 #else
272 # define YYERROR_VERBOSE 1
273 #endif
275 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
276 #line 69 "parser.y"
277 typedef union YYSTYPE {
278 long integer;
279 int mnemonic;
280 const char *string;
281 const char *label;
282 const char *ident;
283 astnode *node;
284 } YYSTYPE;
285 /* Line 185 of yacc.c. */
286 #line 287 "parser.c"
287 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
288 # define YYSTYPE_IS_DECLARED 1
289 # define YYSTYPE_IS_TRIVIAL 1
290 #endif
292 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
293 typedef struct YYLTYPE
295 int first_line;
296 int first_column;
297 int last_line;
298 int last_column;
299 } YYLTYPE;
300 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
301 # define YYLTYPE_IS_DECLARED 1
302 # define YYLTYPE_IS_TRIVIAL 1
303 #endif
306 /* Copy the second part of user declarations. */
309 /* Line 213 of yacc.c. */
310 #line 311 "parser.c"
312 #if ! defined (yyoverflow) || YYERROR_VERBOSE
314 # ifndef YYFREE
315 # define YYFREE free
316 # endif
317 # ifndef YYMALLOC
318 # define YYMALLOC malloc
319 # endif
321 /* The parser invokes alloca or malloc; define the necessary symbols. */
323 # ifdef YYSTACK_USE_ALLOCA
324 # if YYSTACK_USE_ALLOCA
325 # ifdef __GNUC__
326 # define YYSTACK_ALLOC __builtin_alloca
327 # else
328 # define YYSTACK_ALLOC alloca
329 # endif
330 # endif
331 # endif
333 # ifdef YYSTACK_ALLOC
334 /* Pacify GCC's `empty if-body' warning. */
335 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
336 # else
337 # if defined (__STDC__) || defined (__cplusplus)
338 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
339 # define YYSIZE_T size_t
340 # endif
341 # define YYSTACK_ALLOC YYMALLOC
342 # define YYSTACK_FREE YYFREE
343 # endif
344 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
347 #if (! defined (yyoverflow) \
348 && (! defined (__cplusplus) \
349 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
350 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
352 /* A type that is properly aligned for any stack member. */
353 union yyalloc
355 short int yyss;
356 YYSTYPE yyvs;
357 YYLTYPE yyls;
360 /* The size of the maximum gap between one aligned stack and the next. */
361 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
363 /* The size of an array large to enough to hold all stacks, each with
364 N elements. */
365 # define YYSTACK_BYTES(N) \
366 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
367 + 2 * YYSTACK_GAP_MAXIMUM)
369 /* Copy COUNT objects from FROM to TO. The source and destination do
370 not overlap. */
371 # ifndef YYCOPY
372 # if defined (__GNUC__) && 1 < __GNUC__
373 # define YYCOPY(To, From, Count) \
374 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
375 # else
376 # define YYCOPY(To, From, Count) \
377 do \
379 register YYSIZE_T yyi; \
380 for (yyi = 0; yyi < (Count); yyi++) \
381 (To)[yyi] = (From)[yyi]; \
383 while (0)
384 # endif
385 # endif
387 /* Relocate STACK from its old location to the new one. The
388 local variables YYSIZE and YYSTACKSIZE give the old and new number of
389 elements in the stack, and YYPTR gives the new location of the
390 stack. Advance YYPTR to a properly aligned location for the next
391 stack. */
392 # define YYSTACK_RELOCATE(Stack) \
393 do \
395 YYSIZE_T yynewbytes; \
396 YYCOPY (&yyptr->Stack, Stack, yysize); \
397 Stack = &yyptr->Stack; \
398 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
399 yyptr += yynewbytes / sizeof (*yyptr); \
401 while (0)
403 #endif
405 #if defined (__STDC__) || defined (__cplusplus)
406 typedef signed char yysigned_char;
407 #else
408 typedef short int yysigned_char;
409 #endif
411 /* YYFINAL -- State number of the termination state. */
412 #define YYFINAL 160
413 /* YYLAST -- Last index in YYTABLE. */
414 #define YYLAST 1727
416 /* YYNTOKENS -- Number of terminals. */
417 #define YYNTOKENS 97
418 /* YYNNTS -- Number of nonterminals. */
419 #define YYNNTS 84
420 /* YYNRULES -- Number of rules. */
421 #define YYNRULES 217
422 /* YYNRULES -- Number of states. */
423 #define YYNSTATES 381
425 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
426 #define YYUNDEFTOK 2
427 #define YYMAXUTOK 322
429 #define YYTRANSLATE(YYX) \
430 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
432 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
433 static const unsigned char yytranslate[] =
435 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 93, 2, 73, 66, 92, 78, 2,
439 95, 96, 90, 87, 71, 88, 72, 91, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 59, 2,
441 82, 65, 81, 2, 60, 62, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 63, 64,
444 2, 69, 2, 70, 77, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 67, 76, 68, 94, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
461 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
462 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
463 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
464 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
465 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
466 55, 56, 57, 61, 74, 75, 79, 80, 83, 84,
467 85, 86, 89
470 #if YYDEBUG
471 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
472 YYRHS. */
473 static const unsigned short int yyprhs[] =
475 0, 0, 3, 6, 9, 10, 12, 15, 17, 18,
476 21, 23, 25, 27, 29, 31, 33, 35, 37, 39,
477 41, 43, 45, 47, 49, 51, 53, 55, 57, 59,
478 61, 63, 65, 67, 69, 71, 73, 75, 77, 79,
479 81, 83, 85, 87, 90, 94, 99, 103, 107, 111,
480 117, 120, 121, 124, 125, 132, 139, 146, 153, 160,
481 167, 169, 172, 174, 177, 182, 184, 188, 192, 196,
482 199, 203, 206, 208, 210, 212, 214, 216, 219, 221,
483 224, 228, 231, 236, 241, 248, 255, 260, 262, 265,
484 267, 269, 271, 273, 275, 277, 279, 283, 285, 287,
485 289, 291, 294, 296, 301, 306, 308, 310, 312, 314,
486 316, 317, 321, 325, 329, 333, 335, 336, 338, 342,
487 344, 345, 347, 351, 355, 359, 363, 367, 371, 375,
488 379, 383, 387, 390, 393, 396, 399, 402, 405, 409,
489 413, 417, 421, 425, 429, 431, 433, 435, 437, 439,
490 441, 443, 445, 446, 448, 450, 459, 461, 462, 464,
491 467, 472, 476, 477, 485, 493, 496, 499, 502, 506,
492 510, 515, 520, 523, 525, 530, 532, 534, 536, 538,
493 541, 544, 546, 550, 554, 558, 560, 562, 570, 572,
494 573, 577, 579, 580, 582, 586, 591, 596, 600, 605,
495 609, 616, 619, 620, 622, 624, 626, 628, 630, 632,
496 635, 639, 643, 648, 653, 657, 659, 661
499 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
500 static const short int yyrhs[] =
502 98, 0, -1, 100, 99, -1, 38, 128, -1, -1,
503 102, -1, 100, 102, -1, 100, -1, -1, 127, 103,
504 -1, 103, -1, 150, -1, 155, -1, 156, -1, 165,
505 -1, 167, -1, 162, -1, 163, -1, 170, -1, 171,
506 -1, 173, -1, 174, -1, 130, -1, 157, -1, 177,
507 -1, 124, -1, 125, -1, 123, -1, 115, -1, 116,
508 -1, 117, -1, 120, -1, 114, -1, 113, -1, 112,
509 -1, 109, -1, 108, -1, 106, -1, 107, -1, 172,
510 -1, 105, -1, 104, -1, 126, -1, 1, 128, -1,
511 57, 132, 128, -1, 35, 169, 132, 128, -1, 54,
512 132, 128, -1, 55, 132, 128, -1, 53, 132, 128,
513 -1, 13, 147, 110, 111, 128, -1, 65, 132, -1,
514 -1, 59, 176, -1, -1, 33, 132, 128, 101, 34,
515 128, -1, 32, 132, 128, 101, 34, 128, -1, 48,
516 147, 128, 101, 49, 128, -1, 42, 147, 128, 101,
517 44, 128, -1, 43, 148, 128, 101, 44, 128, -1,
518 46, 147, 128, 118, 47, 128, -1, 119, -1, 118,
519 119, -1, 171, -1, 147, 128, -1, 45, 147, 121,
520 128, -1, 122, -1, 121, 71, 122, -1, 147, 59,
521 132, -1, 41, 164, 128, -1, 21, 128, -1, 21,
522 56, 128, -1, 22, 128, -1, 128, -1, 146, -1,
523 129, -1, 59, -1, 58, -1, 131, 128, -1, 12,
524 -1, 12, 62, -1, 12, 73, 132, -1, 12, 132,
525 -1, 12, 132, 71, 63, -1, 12, 132, 71, 64,
526 -1, 12, 69, 132, 71, 63, 70, -1, 12, 69,
527 132, 70, 71, 64, -1, 12, 69, 132, 70, -1,
528 133, -1, 50, 135, -1, 137, -1, 138, -1, 143,
529 -1, 149, -1, 66, -1, 144, -1, 145, -1, 95,
530 132, 96, -1, 87, -1, 88, -1, 8, -1, 9,
531 -1, 51, 137, -1, 147, -1, 147, 69, 132, 70,
532 -1, 147, 95, 132, 96, -1, 132, -1, 139, -1,
533 147, -1, 160, -1, 132, -1, -1, 147, 61, 147,
534 -1, 133, 72, 138, -1, 133, 72, 133, -1, 67,
535 140, 68, -1, 141, -1, -1, 142, -1, 141, 71,
536 142, -1, 134, -1, -1, 7, -1, 132, 87, 132,
537 -1, 132, 88, 132, -1, 132, 90, 132, -1, 132,
538 91, 132, -1, 132, 92, 132, -1, 132, 78, 132,
539 -1, 132, 76, 132, -1, 132, 77, 132, -1, 132,
540 86, 132, -1, 132, 85, 132, -1, 94, 132, -1,
541 93, 132, -1, 77, 147, -1, 82, 132, -1, 81,
542 132, -1, 88, 132, -1, 132, 80, 132, -1, 132,
543 79, 132, -1, 132, 81, 132, -1, 132, 82, 132,
544 -1, 132, 83, 132, -1, 132, 84, 132, -1, 10,
545 -1, 11, -1, 87, -1, 88, -1, 8, -1, 9,
546 -1, 6, -1, 147, -1, -1, 3, -1, 4, -1,
547 23, 132, 128, 101, 151, 154, 28, 128, -1, 152,
548 -1, -1, 153, -1, 152, 153, -1, 27, 132, 128,
549 101, -1, 26, 128, 101, -1, -1, 24, 147, 128,
550 101, 154, 28, 128, -1, 25, 147, 128, 101, 154,
551 28, 128, -1, 158, 128, -1, 159, 128, -1, 147,
552 159, -1, 56, 147, 159, -1, 39, 147, 159, -1,
553 56, 39, 147, 159, -1, 39, 56, 147, 159, -1,
554 160, 161, -1, 160, -1, 160, 69, 132, 70, -1,
555 14, -1, 15, -1, 16, -1, 17, -1, 52, 147,
556 -1, 72, 147, -1, 134, -1, 161, 71, 134, -1,
557 29, 164, 128, -1, 30, 164, 128, -1, 4, -1,
558 82, -1, 31, 147, 166, 128, 101, 34, 128, -1,
559 169, -1, -1, 147, 168, 128, -1, 161, -1, -1,
560 147, -1, 169, 71, 147, -1, 147, 36, 134, 128,
561 -1, 147, 65, 134, 128, -1, 37, 147, 128, -1,
562 37, 147, 134, 128, -1, 39, 169, 128, -1, 40,
563 169, 59, 176, 175, 128, -1, 60, 147, -1, -1,
564 160, -1, 147, -1, 48, -1, 13, -1, 178, -1,
565 179, -1, 147, 179, -1, 56, 147, 179, -1, 39,
566 147, 179, -1, 56, 39, 147, 179, -1, 39, 56,
567 147, 179, -1, 180, 136, 128, -1, 18, -1, 19,
568 -1, 20, -1
571 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
572 static const unsigned short int yyrline[] =
574 0, 123, 123, 127, 128, 132, 133, 140, 141, 145,
575 146, 150, 151, 152, 153, 154, 155, 156, 157, 158,
576 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
577 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
578 179, 180, 181, 182, 186, 190, 194, 198, 202, 206,
579 210, 211, 215, 216, 220, 224, 228, 232, 236, 240,
580 244, 245, 249, 250, 254, 258, 259, 263, 267, 271,
581 272, 275, 279, 283, 287, 288, 292, 296, 300, 301,
582 302, 303, 304, 305, 306, 307, 308, 312, 313, 314,
583 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
584 325, 326, 330, 331, 332, 336, 337, 341, 342, 346,
585 347, 351, 355, 356, 360, 364, 365, 369, 370, 374,
586 375, 379, 383, 384, 385, 386, 387, 388, 389, 390,
587 391, 392, 393, 394, 395, 396, 397, 398, 402, 403,
588 404, 405, 406, 407, 411, 412, 413, 414, 415, 416,
589 420, 424, 425, 429, 430, 434, 438, 439, 443, 444,
590 448, 452, 453, 457, 461, 465, 466, 470, 471, 472,
591 473, 474, 478, 479, 480, 484, 485, 486, 487, 488,
592 489, 493, 494, 498, 502, 506, 507, 511, 515, 516,
593 520, 524, 525, 529, 530, 534, 538, 542, 543, 547,
594 551, 555, 556, 560, 561, 562, 563, 567, 568, 572,
595 573, 574, 575, 576, 580, 584, 585, 586
597 #endif
599 #if YYDEBUG || YYERROR_VERBOSE
600 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
601 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
602 static const char *const yytname[] =
604 "$end", "error", "$undefined", "INTEGER_LITERAL", "STRING_LITERAL",
605 "FILE_PATH", "IDENTIFIER", "LOCAL_ID", "FORWARD_BRANCH",
606 "BACKWARD_BRANCH", "LABEL", "LOCAL_LABEL", "MNEMONIC", "_LABEL_", "BYTE",
607 "CHAR", "WORD", "DWORD", "DSB", "DSW", "DSD", "DATASEG", "CODESEG", "IF",
608 "IFDEF", "IFNDEF", "ELSE", "ELIF", "ENDIF", "INCSRC", "INCBIN", "MACRO",
609 "REPT", "WHILE", "ENDM", "ALIGN", "EQU", "DEFINE", "END", "PUBLIC",
610 "EXTRN", "CHARMAP", "STRUC", "UNION", "ENDS", "RECORD", "ENUM", "ENDE",
611 "PROC", "ENDP", "SIZEOF", "MASK", "TAG", "MESSAGE", "WARNING", "ERROR",
612 "ZEROPAGE", "ORG", "'\\n'", "':'", "'@'", "SCOPE_OP", "'A'", "'X'",
613 "'Y'", "'='", "'$'", "'{'", "'}'", "'['", "']'", "','", "'.'", "'#'",
614 "HI_OP", "LO_OP", "'|'", "'^'", "'&'", "NE_OP", "EQ_OP", "'>'", "'<'",
615 "GE_OP", "LE_OP", "SHR_OP", "SHL_OP", "'+'", "'-'", "UMINUS", "'*'",
616 "'/'", "'%'", "'!'", "'~'", "'('", "')'", "$accept", "assembly_unit",
617 "end_opt", "statement_list", "statement_list_opt", "labelable_statement",
618 "statement", "org_statement", "align_statement", "warning_statement",
619 "error_statement", "message_statement", "label_statement",
620 "label_addr_part_opt", "label_type_part_opt", "while_statement",
621 "rept_statement", "proc_statement", "struc_decl_statement",
622 "union_decl_statement", "enum_decl_statement", "enum_item_list",
623 "enum_item", "record_decl_statement", "record_field_list",
624 "record_field", "charmap_statement", "dataseg_statement",
625 "codeseg_statement", "null_statement", "label_decl", "line_tail",
626 "newline", "instruction_statement", "instruction", "expression",
627 "indexed_identifier", "extended_expression", "sizeof_arg",
628 "expression_opt", "scope_access", "struc_access", "struc_initializer",
629 "field_initializer_list_opt", "field_initializer_list",
630 "field_initializer", "local_id", "arithmetic_expression",
631 "comparison_expression", "label", "identifier", "identifier_opt",
632 "literal", "if_statement", "elif_statement_list_opt",
633 "elif_statement_list", "elif_statement", "else_part_opt",
634 "ifdef_statement", "ifndef_statement", "data_statement",
635 "named_data_statement", "unnamed_data_statement", "datatype",
636 "expression_list", "incsrc_statement", "incbin_statement",
637 "file_specifier", "macro_decl_statement", "param_list_opt",
638 "macro_statement", "arg_list_opt", "identifier_list", "equ_statement",
639 "assign_statement", "define_statement", "public_statement",
640 "extrn_statement", "from_part_opt", "symbol_type", "storage_statement",
641 "named_storage_statement", "unnamed_storage_statement", "storage", 0
643 #endif
645 # ifdef YYPRINT
646 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
647 token YYLEX-NUM. */
648 static const unsigned short int yytoknum[] =
650 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
651 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
652 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
653 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
654 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
655 305, 306, 307, 308, 309, 310, 311, 312, 10, 58,
656 64, 313, 65, 88, 89, 61, 36, 123, 125, 91,
657 93, 44, 46, 35, 314, 315, 124, 94, 38, 316,
658 317, 62, 60, 318, 319, 320, 321, 43, 45, 322,
659 42, 47, 37, 33, 126, 40, 41
661 # endif
663 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
664 static const unsigned char yyr1[] =
666 0, 97, 98, 99, 99, 100, 100, 101, 101, 102,
667 102, 103, 103, 103, 103, 103, 103, 103, 103, 103,
668 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
669 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
670 103, 103, 103, 103, 104, 105, 106, 107, 108, 109,
671 110, 110, 111, 111, 112, 113, 114, 115, 116, 117,
672 118, 118, 119, 119, 120, 121, 121, 122, 123, 124,
673 124, 125, 126, 127, 128, 128, 129, 130, 131, 131,
674 131, 131, 131, 131, 131, 131, 131, 132, 132, 132,
675 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
676 132, 132, 133, 133, 133, 134, 134, 135, 135, 136,
677 136, 137, 138, 138, 139, 140, 140, 141, 141, 142,
678 142, 143, 144, 144, 144, 144, 144, 144, 144, 144,
679 144, 144, 144, 144, 144, 144, 144, 144, 145, 145,
680 145, 145, 145, 145, 146, 146, 146, 146, 146, 146,
681 147, 148, 148, 149, 149, 150, 151, 151, 152, 152,
682 153, 154, 154, 155, 156, 157, 157, 158, 158, 158,
683 158, 158, 159, 159, 159, 160, 160, 160, 160, 160,
684 160, 161, 161, 162, 163, 164, 164, 165, 166, 166,
685 167, 168, 168, 169, 169, 170, 171, 172, 172, 173,
686 174, 175, 175, 176, 176, 176, 176, 177, 177, 178,
687 178, 178, 178, 178, 179, 180, 180, 180
690 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
691 static const unsigned char yyr2[] =
693 0, 2, 2, 2, 0, 1, 2, 1, 0, 2,
694 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
695 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
696 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
697 1, 1, 1, 2, 3, 4, 3, 3, 3, 5,
698 2, 0, 2, 0, 6, 6, 6, 6, 6, 6,
699 1, 2, 1, 2, 4, 1, 3, 3, 3, 2,
700 3, 2, 1, 1, 1, 1, 1, 2, 1, 2,
701 3, 2, 4, 4, 6, 6, 4, 1, 2, 1,
702 1, 1, 1, 1, 1, 1, 3, 1, 1, 1,
703 1, 2, 1, 4, 4, 1, 1, 1, 1, 1,
704 0, 3, 3, 3, 3, 1, 0, 1, 3, 1,
705 0, 1, 3, 3, 3, 3, 3, 3, 3, 3,
706 3, 3, 2, 2, 2, 2, 2, 2, 3, 3,
707 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
708 1, 1, 0, 1, 1, 8, 1, 0, 1, 2,
709 4, 3, 0, 7, 7, 2, 2, 2, 3, 3,
710 4, 4, 2, 1, 4, 1, 1, 1, 1, 2,
711 2, 1, 3, 3, 3, 1, 1, 7, 1, 0,
712 3, 1, 0, 1, 3, 4, 4, 3, 4, 3,
713 6, 2, 0, 1, 1, 1, 1, 1, 1, 2,
714 3, 3, 4, 4, 3, 1, 1, 1
717 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
718 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
719 means the default is an error. */
720 static const unsigned char yydefact[] =
722 0, 0, 150, 148, 149, 144, 145, 78, 0, 175,
723 176, 177, 178, 215, 216, 217, 0, 0, 0, 0,
724 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
725 0, 0, 152, 0, 0, 0, 0, 0, 0, 0,
726 0, 0, 76, 75, 0, 146, 147, 0, 0, 5,
727 10, 41, 40, 37, 38, 36, 35, 34, 33, 32,
728 28, 29, 30, 31, 27, 25, 26, 42, 0, 72,
729 74, 22, 0, 73, 192, 11, 12, 13, 23, 0,
730 0, 173, 16, 17, 14, 15, 18, 19, 39, 20,
731 21, 24, 207, 208, 110, 43, 153, 154, 121, 99,
732 100, 0, 0, 79, 93, 0, 0, 0, 0, 0,
733 97, 98, 0, 0, 0, 81, 87, 89, 90, 91,
734 94, 95, 102, 92, 51, 0, 69, 71, 0, 0,
735 0, 185, 186, 0, 0, 189, 0, 0, 193, 0,
736 0, 0, 193, 0, 0, 0, 0, 151, 0, 0,
737 0, 0, 179, 0, 0, 0, 0, 0, 0, 180,
738 1, 0, 2, 6, 9, 77, 0, 0, 116, 105,
739 181, 106, 167, 191, 0, 209, 165, 166, 0, 172,
740 109, 0, 88, 107, 108, 101, 0, 0, 80, 134,
741 136, 135, 137, 133, 132, 0, 0, 0, 0, 0,
742 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
743 0, 0, 0, 0, 0, 0, 0, 0, 53, 70,
744 0, 0, 0, 183, 184, 0, 188, 0, 0, 0,
745 0, 197, 0, 0, 169, 211, 199, 0, 68, 0,
746 0, 0, 65, 0, 0, 0, 48, 46, 47, 0,
747 168, 210, 44, 3, 0, 0, 119, 0, 115, 117,
748 0, 190, 0, 214, 86, 0, 96, 82, 83, 128,
749 129, 127, 139, 138, 140, 141, 142, 143, 131, 130,
750 122, 123, 124, 125, 126, 113, 112, 102, 111, 0,
751 0, 50, 0, 0, 0, 157, 162, 162, 0, 0,
752 0, 194, 45, 198, 171, 213, 206, 205, 204, 203,
753 202, 0, 0, 0, 64, 0, 0, 60, 0, 62,
754 0, 170, 212, 195, 196, 114, 120, 182, 174, 0,
755 0, 103, 104, 52, 49, 0, 162, 156, 158, 0,
756 0, 0, 0, 0, 0, 0, 0, 0, 0, 66,
757 67, 0, 61, 63, 0, 118, 85, 84, 0, 0,
758 159, 0, 0, 0, 0, 55, 54, 201, 200, 57,
759 58, 59, 56, 0, 0, 161, 163, 164, 187, 160,
763 /* YYDEFGOTO[NTERM-NUM]. */
764 static const short int yydefgoto[] =
766 -1, 47, 162, 294, 295, 49, 50, 51, 52, 53,
767 54, 55, 56, 218, 293, 57, 58, 59, 60, 61,
768 62, 316, 317, 63, 241, 242, 64, 65, 66, 67,
769 68, 69, 70, 71, 72, 169, 116, 170, 182, 181,
770 117, 118, 171, 257, 258, 259, 119, 120, 121, 73,
771 122, 148, 123, 75, 336, 337, 338, 340, 76, 77,
772 78, 79, 80, 81, 173, 82, 83, 133, 84, 225,
773 85, 174, 139, 86, 87, 88, 89, 90, 346, 310,
774 91, 92, 93, 94
777 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
778 STATE-NUM. */
779 #define YYPACT_NINF -290
780 static const short int yypact[] =
782 1502, 8, -290, -290, -290, -290, -290, 378, 38, -290,
783 -290, -290, -290, -290, -290, -290, -17, 8, 748, 38,
784 38, 2, 2, 38, 748, 748, 38, 38, 1, 38,
785 2, 38, 38, 38, 38, 38, 38, 748, 748, 748,
786 13, 748, -290, -290, 38, -290, -290, 49, 838, -290,
787 -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,
788 -290, -290, -290, -290, -290, -290, -290, -290, 1563, -290,
789 -290, -290, 8, -290, 501, -290, -290, -290, -290, 8,
790 8, 536, -290, -290, -290, -290, -290, -290, -290, -290,
791 -290, -290, -290, -290, 748, -290, -290, -290, -290, -290,
792 -290, 160, 38, -290, -290, 748, 748, 38, 748, 748,
793 -290, 14, 748, 748, 748, 1597, -16, -290, -290, -290,
794 -290, -290, -26, -290, -2, 8, -290, -290, 682, 8,
795 8, -290, -290, 8, 8, 38, 682, 682, -290, 636,
796 192, 38, 246, -45, -21, 8, 8, -290, 8, 38,
797 8, 8, -290, 682, 682, 682, 38, 246, 682, -290,
798 -290, 8, -290, -290, -290, -290, 655, 655, 603, 1635,
799 -290, -290, -290, -3, 8, -290, -290, -290, 748, -3,
800 1635, 8, -290, -290, -290, -290, 15, 705, 1635, -290,
801 1635, 1635, -32, -290, -290, 725, 9, 748, 748, 748,
802 748, 748, 748, 748, 748, 748, 748, 748, 748, 748,
803 748, 748, 748, 38, 38, 748, 748, 748, 16, -290,
804 1004, 1087, 1087, -290, -290, 8, 3, 1170, 1170, 38,
805 682, -290, 8, 246, -290, -290, -290, 200, -290, 1253,
806 1253, -34, -290, 27, 38, 1336, -290, -290, -290, 246,
807 -290, -290, -290, -290, 8, 8, -290, 19, 28, -290,
808 655, -290, 1560, -290, 30, 40, -290, -290, -290, 821,
809 330, 249, 441, 441, 135, 135, 135, 135, 26, 26,
810 -32, -32, -290, -290, -290, -16, -290, -59, -290, 1579,
811 1614, 1635, 200, 8, 921, 78, 86, 86, 1170, 85,
812 87, -290, -290, -290, -290, -290, -290, -290, -290, -290,
813 60, 81, 82, 38, -290, 748, 6, -290, -4, -290,
814 73, -290, -290, -290, -290, -290, 655, -290, -290, 67,
815 64, -290, -290, -290, -290, 748, 86, 78, -290, 8,
816 109, 112, 107, 8, 8, 38, 8, 8, 8, -290,
817 1635, 8, -290, -290, 8, -290, -290, -290, 682, 115,
818 -290, 1419, 8, 8, 8, -290, -290, -290, -290, -290,
819 -290, -290, -290, 1004, 8, -290, -290, -290, -290, -290,
820 -290
823 /* YYPGOTO[NTERM-NUM]. */
824 static const short int yypgoto[] =
826 -290, -290, -290, 146, -194, -47, 80, -290, -290, -290,
827 -290, -290, -290, -290, -290, -290, -290, -290, -290, -290,
828 -290, -290, -165, -290, -290, -158, -290, -290, -290, -290,
829 -290, -1, -290, -290, -290, 286, -57, -137, -290, -290,
830 56, -54, -290, -290, -290, -164, -290, -290, -290, -290,
831 62, -290, -290, -290, -290, -290, -176, -289, -290, -290,
832 -290, -290, -65, -99, 84, -290, -290, 18, -290, -290,
833 -290, -290, -24, -290, -233, -290, -290, -290, -290, -122,
834 -290, -290, -42, -290
837 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
838 positive, shift that token. If negative, reduce the rule which
839 number is the opposite. If zero, do what YYDEFACT says.
840 If YYTABLE_NINF, syntax error. */
841 #define YYTABLE_NINF -121
842 static const short int yytable[] =
844 95, 163, 184, 232, 143, 144, 131, 2, 341, 172,
845 215, 319, 2, 42, 43, 126, 127, 96, 97, 2,
846 2, 98, 99, 100, 42, 43, 229, 296, 297, 254,
847 255, 256, 175, 299, 300, 214, 216, 313, 237, 125,
848 134, 42, 43, 215, 2, 311, 312, 359, 145, 160,
849 229, 320, 156, 351, 42, 43, 213, 141, 210, 211,
850 212, 167, 74, 217, 101, 102, 42, 43, 260, 216,
851 124, 165, 267, 268, 229, 292, 214, 234, 176, 177,
852 104, 129, 130, 319, 132, 135, 315, 325, 138, 140,
853 142, 138, 250, 146, 147, 149, 150, 151, 152, 326,
854 235, 329, 157, 330, 342, 335, 159, 112, 113, 114,
855 74, 226, 339, 208, 209, 251, 210, 211, 212, 343,
856 345, 344, 354, 327, 219, 347, 348, 220, 221, 222,
857 74, 356, 223, 224, 357, 227, 228, 362, 309, 231,
858 363, 364, 236, 374, 238, 239, 48, 240, 164, 244,
859 245, 352, 246, 247, 248, 349, 285, 252, 185, 286,
860 253, 360, 355, 183, 186, 179, 2, 375, 304, 189,
861 333, 0, 0, 261, 9, 10, 11, 12, 0, 379,
862 263, 0, 0, 0, 321, 0, 0, 0, 0, 256,
863 0, 305, 0, 309, 0, 96, 97, 138, 2, 98,
864 99, 100, 0, 233, 0, 0, 2, 322, 0, 0,
865 0, 243, 36, 306, 9, 10, 11, 12, 249, 0,
866 206, 207, 208, 209, 298, 210, 211, 212, 0, 302,
867 0, 303, 44, 0, 0, 0, 0, 0, 0, 0,
868 314, 0, 101, 102, 0, 0, 0, 163, 307, 0,
869 42, 43, 36, 323, 324, 0, 0, 0, 104, 168,
870 9, 10, 11, 12, 13, 14, 15, 0, 0, 107,
871 0, 0, 44, 108, 109, 287, 288, 0, 0, 110,
872 111, 0, 74, 74, 74, 112, 113, 114, 0, 74,
873 74, 301, 334, 115, 0, 0, 0, 0, 36, 308,
874 0, 74, 74, 0, 128, 0, 318, 74, 0, 0,
875 136, 137, 0, 0, 0, 0, 0, 353, 44, 0,
876 0, 0, 0, 153, 154, 155, 0, 158, 200, 201,
877 202, 203, 204, 205, 206, 207, 208, 209, 361, 210,
878 211, 212, 365, 366, 0, 368, 369, 370, 0, 0,
879 371, 0, 0, 372, 308, 0, 74, 373, 0, 0,
880 74, 376, 377, 378, 0, 0, 0, 0, 0, 0,
881 0, 0, 0, 380, 0, 243, 0, 0, 318, 0,
882 180, 96, 97, 0, 2, 98, 99, 100, 0, 0,
883 0, 187, 188, 0, 190, 191, 0, 192, 193, 194,
884 195, 0, 0, 0, 0, 0, 0, 367, 199, 200,
885 201, 202, 203, 204, 205, 206, 207, 208, 209, 0,
886 210, 211, 212, 74, 0, 230, 0, 0, 101, 102,
887 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
888 103, 0, 0, 0, 104, 0, 0, 105, 0, 0,
889 0, 106, 0, 0, 0, 107, 0, 0, 0, 108,
890 109, 0, 0, 0, 262, 110, 111, 0, 0, 0,
891 0, 112, 113, 114, 0, 0, 0, 0, 0, 0,
892 0, 0, 0, 269, 270, 271, 272, 273, 274, 275,
893 276, 277, 278, 279, 280, 281, 282, 283, 284, 0,
894 0, 289, 290, 291, 96, 97, 0, 2, 98, 99,
895 100, 0, 0, 0, 0, 9, 10, 11, 12, 13,
896 14, 15, 202, 203, 204, 205, 206, 207, 208, 209,
897 0, 210, 211, 212, 0, 0, 0, 166, 0, 96,
898 97, 0, 2, 98, 99, 100, 0, 0, 0, 0,
899 0, 101, 102, 36, 0, 0, 0, 0, 0, 0,
900 0, 0, 0, 0, 0, 0, 167, 104, 168, 0,
901 0, 0, 0, 44, 0, 0, 0, 0, 107, 0,
902 0, 0, 108, 109, 0, 0, 101, 102, 110, 111,
903 0, 0, 0, 0, 112, 113, 114, 0, 0, 0,
904 0, 350, 104, 168, 0, 178, 96, 97, 0, 2,
905 98, 99, 100, 107, 0, 0, 0, 108, 109, 0,
906 0, 358, 0, 110, 111, 0, 0, 0, 0, 112,
907 113, 114, 0, 0, 0, 0, 0, 0, 0, 96,
908 97, 0, 2, 98, 99, 100, 0, 0, 0, 0,
909 0, 0, 0, 101, 102, 0, 0, 0, 96, 97,
910 0, 2, 98, 99, 100, 0, 0, 0, 0, 104,
911 168, 0, 0, 0, -120, 0, 0, 0, 0, 0,
912 107, 0, 0, 0, 108, 109, 101, 102, 0, 0,
913 110, 111, 0, 0, 0, 0, 112, 113, 114, 0,
914 0, 0, 104, 0, 0, 101, 102, 229, 0, 0,
915 0, 0, 0, 107, 0, 0, 0, 108, 109, 0,
916 0, 104, 168, 110, 111, 0, 0, 0, 0, 112,
917 113, 114, 107, 0, 0, 0, 108, 109, 0, 0,
918 42, 43, 110, 111, 0, 0, 0, 0, 112, 113,
919 114, 96, 97, 0, 2, 98, 99, 100, 197, 198,
920 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
921 209, 0, 210, 211, 212, 264, 265, 0, 0, 0,
922 0, 197, 198, 199, 200, 201, 202, 203, 204, 205,
923 206, 207, 208, 209, 0, 210, 211, 212, 101, 102,
924 0, 197, 198, 199, 200, 201, 202, 203, 204, 205,
925 206, 207, 208, 209, 104, 210, 211, 212, 0, 0,
926 0, 266, 0, 0, 0, 107, 0, 0, 0, 108,
927 109, 0, 0, 0, 0, 110, 111, 0, -4, 1,
928 0, 112, 113, 114, 2, 0, 3, 4, 5, 6,
929 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
930 17, 18, 19, 20, 0, 0, 0, 21, 22, 23,
931 24, 25, 0, 26, 0, 27, 161, 28, 29, 30,
932 31, 32, 0, 33, 34, 0, 35, 0, 0, 0,
933 36, 37, 38, 39, 40, 41, 42, 43, 198, 199,
934 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
935 44, 210, 211, 212, 0, 0, 0, 0, 0, 0,
936 0, 0, 1, 0, 0, 45, 46, 2, 0, 3,
937 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
938 14, 15, 16, 17, 18, 19, 20, -7, -7, -7,
939 21, 22, 23, 24, 25, -7, 26, 0, 27, 0,
940 28, 29, 30, 31, 32, -7, 33, 34, 0, 35,
941 -7, 0, 0, 36, 37, 38, 39, 40, 41, 42,
942 43, 0, 0, 0, 0, 0, 0, 0, 0, 0,
943 0, 0, 0, 44, 0, 0, 0, 0, 0, 0,
944 0, 0, 0, 0, 0, 1, 0, 0, 45, 46,
945 2, 0, 3, 4, 5, 6, 7, 8, 9, 10,
946 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
947 -8, -8, -8, 21, 22, 23, 24, 25, 0, 26,
948 0, 27, 0, 28, 29, 30, 31, 32, 0, 33,
949 34, 0, 35, 0, 0, 0, 36, 37, 38, 39,
950 40, 41, 42, 43, 0, 0, 0, 0, 0, 0,
951 0, 0, 0, 0, 0, 0, 44, 0, 0, 0,
952 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
953 0, 45, 46, 2, 0, 3, 4, 5, 6, 7,
954 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
955 18, 19, 20, -8, 0, -8, 21, 22, 23, 24,
956 25, 0, 26, 0, 27, 0, 28, 29, 30, 31,
957 32, 0, 33, 34, 0, 35, 0, 0, 0, 36,
958 37, 38, 39, 40, 41, 42, 43, 0, 0, 0,
959 0, 0, 0, 0, 0, 0, 0, 0, 0, 44,
960 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
961 0, 1, 0, 0, 45, 46, 2, 0, 3, 4,
962 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
963 15, 16, 17, 18, 19, 20, 0, 0, 0, 21,
964 22, 23, 24, 25, -8, 26, 0, 27, 0, 28,
965 29, 30, 31, 32, 0, 33, 34, 0, 35, 0,
966 0, 0, 36, 37, 38, 39, 40, 41, 42, 43,
967 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
968 0, 0, 44, 0, 0, 0, 0, 0, 0, 0,
969 0, 0, 0, 0, 1, 0, 0, 45, 46, 2,
970 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
971 12, 13, 14, 15, 16, 17, 18, 19, 20, 0,
972 0, 0, 21, 22, 23, 24, 25, 0, 26, 0,
973 27, 0, 28, 29, 30, 31, 32, -8, 33, 34,
974 0, 35, 0, 0, 0, 36, 37, 38, 39, 40,
975 41, 42, 43, 0, 0, 0, 0, 0, 0, 0,
976 0, 0, 0, 0, 0, 44, 0, 0, 0, 0,
977 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
978 45, 46, 2, 0, 3, 4, 5, 6, 7, 8,
979 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
980 19, 20, 0, 0, 0, 21, 22, 23, 24, 25,
981 0, 26, 0, 27, 0, 28, 29, 30, 31, 32,
982 0, 33, 34, 0, 35, -8, 0, 0, 36, 37,
983 38, 39, 40, 41, 42, 43, 0, 0, 0, 0,
984 0, 0, 0, 0, 0, 0, 0, 0, 44, 0,
985 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
986 1, 0, 0, 45, 46, 2, 0, 3, 4, 5,
987 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
988 16, 17, 18, 19, 20, 0, 0, -8, 21, 22,
989 23, 24, 25, 0, 26, 0, 27, 0, 28, 29,
990 30, 31, 32, 0, 33, 34, 0, 35, 0, 0,
991 0, 36, 37, 38, 39, 40, 41, 42, 43, 0,
992 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
993 0, 44, 0, 0, 0, 0, 0, 0, 0, 0,
994 0, 0, 0, 1, 0, 0, 45, 46, 2, 0,
995 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
996 13, 14, 15, 16, 17, 18, 19, 20, 0, 0,
997 0, 21, 22, 23, 24, 25, 0, 26, 0, 27,
998 0, 28, 29, 30, 31, 32, 0, 33, 34, 0,
999 35, 0, 0, 0, 36, 37, 38, 39, 40, 41,
1000 42, 43, 0, 0, 1, 0, 0, 0, 0, 2,
1001 0, 0, 0, 0, 44, 7, 8, 9, 10, 11,
1002 12, 13, 14, 15, 16, 17, 18, 19, 20, 45,
1003 46, 0, 21, 22, 23, 24, 25, 0, 26, 0,
1004 27, 0, 28, 29, 30, 31, 32, 0, 33, 34,
1005 0, 35, 0, 0, 0, 36, 37, 38, 39, 40,
1006 41, 42, 43, 0, 0, 0, 0, 0, 0, 0,
1007 328, 0, 0, 0, 0, 44, 197, 198, 199, 200,
1008 201, 202, 203, 204, 205, 206, 207, 208, 209, 331,
1009 210, 211, 212, 0, 0, 197, 198, 199, 200, 201,
1010 202, 203, 204, 205, 206, 207, 208, 209, 196, 210,
1011 211, 212, 0, 197, 198, 199, 200, 201, 202, 203,
1012 204, 205, 206, 207, 208, 209, 0, 210, 211, 212,
1013 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1014 207, 208, 209, 0, 210, 211, 212, 0, 0, 0,
1015 332, 197, 198, 199, 200, 201, 202, 203, 204, 205,
1016 206, 207, 208, 209, 0, 210, 211, 212
1019 static const short int yycheck[] =
1021 1, 48, 101, 140, 28, 29, 4, 6, 297, 74,
1022 69, 244, 6, 58, 59, 16, 17, 3, 4, 6,
1023 6, 7, 8, 9, 58, 59, 71, 221, 222, 166,
1024 167, 168, 74, 227, 228, 61, 95, 71, 59, 56,
1025 22, 58, 59, 69, 6, 239, 240, 336, 30, 0,
1026 71, 245, 39, 47, 58, 59, 72, 56, 90, 91,
1027 92, 65, 0, 65, 50, 51, 58, 59, 71, 95,
1028 8, 72, 63, 64, 71, 59, 61, 142, 79, 80,
1029 66, 19, 20, 316, 82, 23, 59, 68, 26, 27,
1030 28, 29, 157, 31, 32, 33, 34, 35, 36, 71,
1031 142, 71, 40, 63, 298, 27, 44, 93, 94, 95,
1032 48, 135, 26, 87, 88, 157, 90, 91, 92, 34,
1033 60, 34, 49, 260, 125, 44, 44, 128, 129, 130,
1034 68, 64, 133, 134, 70, 136, 137, 28, 237, 140,
1035 28, 34, 143, 28, 145, 146, 0, 148, 68, 150,
1036 151, 316, 153, 154, 155, 313, 213, 158, 102, 213,
1037 161, 337, 326, 101, 102, 81, 6, 361, 233, 107,
1038 292, -1, -1, 174, 14, 15, 16, 17, -1, 373,
1039 181, -1, -1, -1, 249, -1, -1, -1, -1, 326,
1040 -1, 233, -1, 292, -1, 3, 4, 135, 6, 7,
1041 8, 9, -1, 141, -1, -1, 6, 249, -1, -1,
1042 -1, 149, 52, 13, 14, 15, 16, 17, 156, -1,
1043 85, 86, 87, 88, 225, 90, 91, 92, -1, 230,
1044 -1, 232, 72, -1, -1, -1, -1, -1, -1, -1,
1045 241, -1, 50, 51, -1, -1, -1, 294, 48, -1,
1046 58, 59, 52, 254, 255, -1, -1, -1, 66, 67,
1047 14, 15, 16, 17, 18, 19, 20, -1, -1, 77,
1048 -1, -1, 72, 81, 82, 213, 214, -1, -1, 87,
1049 88, -1, 220, 221, 222, 93, 94, 95, -1, 227,
1050 228, 229, 293, 7, -1, -1, -1, -1, 52, 237,
1051 -1, 239, 240, -1, 18, -1, 244, 245, -1, -1,
1052 24, 25, -1, -1, -1, -1, -1, 318, 72, -1,
1053 -1, -1, -1, 37, 38, 39, -1, 41, 79, 80,
1054 81, 82, 83, 84, 85, 86, 87, 88, 339, 90,
1055 91, 92, 343, 344, -1, 346, 347, 348, -1, -1,
1056 351, -1, -1, 354, 292, -1, 294, 358, -1, -1,
1057 298, 362, 363, 364, -1, -1, -1, -1, -1, -1,
1058 -1, -1, -1, 374, -1, 313, -1, -1, 316, -1,
1059 94, 3, 4, -1, 6, 7, 8, 9, -1, -1,
1060 -1, 105, 106, -1, 108, 109, -1, 111, 112, 113,
1061 114, -1, -1, -1, -1, -1, -1, 345, 78, 79,
1062 80, 81, 82, 83, 84, 85, 86, 87, 88, -1,
1063 90, 91, 92, 361, -1, 139, -1, -1, 50, 51,
1064 -1, -1, -1, -1, -1, 373, -1, -1, -1, -1,
1065 62, -1, -1, -1, 66, -1, -1, 69, -1, -1,
1066 -1, 73, -1, -1, -1, 77, -1, -1, -1, 81,
1067 82, -1, -1, -1, 178, 87, 88, -1, -1, -1,
1068 -1, 93, 94, 95, -1, -1, -1, -1, -1, -1,
1069 -1, -1, -1, 197, 198, 199, 200, 201, 202, 203,
1070 204, 205, 206, 207, 208, 209, 210, 211, 212, -1,
1071 -1, 215, 216, 217, 3, 4, -1, 6, 7, 8,
1072 9, -1, -1, -1, -1, 14, 15, 16, 17, 18,
1073 19, 20, 81, 82, 83, 84, 85, 86, 87, 88,
1074 -1, 90, 91, 92, -1, -1, -1, 36, -1, 3,
1075 4, -1, 6, 7, 8, 9, -1, -1, -1, -1,
1076 -1, 50, 51, 52, -1, -1, -1, -1, -1, -1,
1077 -1, -1, -1, -1, -1, -1, 65, 66, 67, -1,
1078 -1, -1, -1, 72, -1, -1, -1, -1, 77, -1,
1079 -1, -1, 81, 82, -1, -1, 50, 51, 87, 88,
1080 -1, -1, -1, -1, 93, 94, 95, -1, -1, -1,
1081 -1, 315, 66, 67, -1, 69, 3, 4, -1, 6,
1082 7, 8, 9, 77, -1, -1, -1, 81, 82, -1,
1083 -1, 335, -1, 87, 88, -1, -1, -1, -1, 93,
1084 94, 95, -1, -1, -1, -1, -1, -1, -1, 3,
1085 4, -1, 6, 7, 8, 9, -1, -1, -1, -1,
1086 -1, -1, -1, 50, 51, -1, -1, -1, 3, 4,
1087 -1, 6, 7, 8, 9, -1, -1, -1, -1, 66,
1088 67, -1, -1, -1, 71, -1, -1, -1, -1, -1,
1089 77, -1, -1, -1, 81, 82, 50, 51, -1, -1,
1090 87, 88, -1, -1, -1, -1, 93, 94, 95, -1,
1091 -1, -1, 66, -1, -1, 50, 51, 71, -1, -1,
1092 -1, -1, -1, 77, -1, -1, -1, 81, 82, -1,
1093 -1, 66, 67, 87, 88, -1, -1, -1, -1, 93,
1094 94, 95, 77, -1, -1, -1, 81, 82, -1, -1,
1095 58, 59, 87, 88, -1, -1, -1, -1, 93, 94,
1096 95, 3, 4, -1, 6, 7, 8, 9, 76, 77,
1097 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1098 88, -1, 90, 91, 92, 70, 71, -1, -1, -1,
1099 -1, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1100 85, 86, 87, 88, -1, 90, 91, 92, 50, 51,
1101 -1, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1102 85, 86, 87, 88, 66, 90, 91, 92, -1, -1,
1103 -1, 96, -1, -1, -1, 77, -1, -1, -1, 81,
1104 82, -1, -1, -1, -1, 87, 88, -1, 0, 1,
1105 -1, 93, 94, 95, 6, -1, 8, 9, 10, 11,
1106 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1107 22, 23, 24, 25, -1, -1, -1, 29, 30, 31,
1108 32, 33, -1, 35, -1, 37, 38, 39, 40, 41,
1109 42, 43, -1, 45, 46, -1, 48, -1, -1, -1,
1110 52, 53, 54, 55, 56, 57, 58, 59, 77, 78,
1111 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1112 72, 90, 91, 92, -1, -1, -1, -1, -1, -1,
1113 -1, -1, 1, -1, -1, 87, 88, 6, -1, 8,
1114 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
1115 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1116 29, 30, 31, 32, 33, 34, 35, -1, 37, -1,
1117 39, 40, 41, 42, 43, 44, 45, 46, -1, 48,
1118 49, -1, -1, 52, 53, 54, 55, 56, 57, 58,
1119 59, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1120 -1, -1, -1, 72, -1, -1, -1, -1, -1, -1,
1121 -1, -1, -1, -1, -1, 1, -1, -1, 87, 88,
1122 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
1123 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1124 26, 27, 28, 29, 30, 31, 32, 33, -1, 35,
1125 -1, 37, -1, 39, 40, 41, 42, 43, -1, 45,
1126 46, -1, 48, -1, -1, -1, 52, 53, 54, 55,
1127 56, 57, 58, 59, -1, -1, -1, -1, -1, -1,
1128 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1129 -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
1130 -1, 87, 88, 6, -1, 8, 9, 10, 11, 12,
1131 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1132 23, 24, 25, 26, -1, 28, 29, 30, 31, 32,
1133 33, -1, 35, -1, 37, -1, 39, 40, 41, 42,
1134 43, -1, 45, 46, -1, 48, -1, -1, -1, 52,
1135 53, 54, 55, 56, 57, 58, 59, -1, -1, -1,
1136 -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
1137 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1138 -1, 1, -1, -1, 87, 88, 6, -1, 8, 9,
1139 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1140 20, 21, 22, 23, 24, 25, -1, -1, -1, 29,
1141 30, 31, 32, 33, 34, 35, -1, 37, -1, 39,
1142 40, 41, 42, 43, -1, 45, 46, -1, 48, -1,
1143 -1, -1, 52, 53, 54, 55, 56, 57, 58, 59,
1144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1145 -1, -1, 72, -1, -1, -1, -1, -1, -1, -1,
1146 -1, -1, -1, -1, 1, -1, -1, 87, 88, 6,
1147 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1148 17, 18, 19, 20, 21, 22, 23, 24, 25, -1,
1149 -1, -1, 29, 30, 31, 32, 33, -1, 35, -1,
1150 37, -1, 39, 40, 41, 42, 43, 44, 45, 46,
1151 -1, 48, -1, -1, -1, 52, 53, 54, 55, 56,
1152 57, 58, 59, -1, -1, -1, -1, -1, -1, -1,
1153 -1, -1, -1, -1, -1, 72, -1, -1, -1, -1,
1154 -1, -1, -1, -1, -1, -1, -1, 1, -1, -1,
1155 87, 88, 6, -1, 8, 9, 10, 11, 12, 13,
1156 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1157 24, 25, -1, -1, -1, 29, 30, 31, 32, 33,
1158 -1, 35, -1, 37, -1, 39, 40, 41, 42, 43,
1159 -1, 45, 46, -1, 48, 49, -1, -1, 52, 53,
1160 54, 55, 56, 57, 58, 59, -1, -1, -1, -1,
1161 -1, -1, -1, -1, -1, -1, -1, -1, 72, -1,
1162 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1163 1, -1, -1, 87, 88, 6, -1, 8, 9, 10,
1164 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1165 21, 22, 23, 24, 25, -1, -1, 28, 29, 30,
1166 31, 32, 33, -1, 35, -1, 37, -1, 39, 40,
1167 41, 42, 43, -1, 45, 46, -1, 48, -1, -1,
1168 -1, 52, 53, 54, 55, 56, 57, 58, 59, -1,
1169 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1170 -1, 72, -1, -1, -1, -1, -1, -1, -1, -1,
1171 -1, -1, -1, 1, -1, -1, 87, 88, 6, -1,
1172 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
1173 18, 19, 20, 21, 22, 23, 24, 25, -1, -1,
1174 -1, 29, 30, 31, 32, 33, -1, 35, -1, 37,
1175 -1, 39, 40, 41, 42, 43, -1, 45, 46, -1,
1176 48, -1, -1, -1, 52, 53, 54, 55, 56, 57,
1177 58, 59, -1, -1, 1, -1, -1, -1, -1, 6,
1178 -1, -1, -1, -1, 72, 12, 13, 14, 15, 16,
1179 17, 18, 19, 20, 21, 22, 23, 24, 25, 87,
1180 88, -1, 29, 30, 31, 32, 33, -1, 35, -1,
1181 37, -1, 39, 40, 41, 42, 43, -1, 45, 46,
1182 -1, 48, -1, -1, -1, 52, 53, 54, 55, 56,
1183 57, 58, 59, -1, -1, -1, -1, -1, -1, -1,
1184 70, -1, -1, -1, -1, 72, 76, 77, 78, 79,
1185 80, 81, 82, 83, 84, 85, 86, 87, 88, 70,
1186 90, 91, 92, -1, -1, 76, 77, 78, 79, 80,
1187 81, 82, 83, 84, 85, 86, 87, 88, 71, 90,
1188 91, 92, -1, 76, 77, 78, 79, 80, 81, 82,
1189 83, 84, 85, 86, 87, 88, -1, 90, 91, 92,
1190 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
1191 86, 87, 88, -1, 90, 91, 92, -1, -1, -1,
1192 96, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1193 85, 86, 87, 88, -1, 90, 91, 92
1196 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1197 symbol of state STATE-NUM. */
1198 static const unsigned char yystos[] =
1200 0, 1, 6, 8, 9, 10, 11, 12, 13, 14,
1201 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1202 25, 29, 30, 31, 32, 33, 35, 37, 39, 40,
1203 41, 42, 43, 45, 46, 48, 52, 53, 54, 55,
1204 56, 57, 58, 59, 72, 87, 88, 98, 100, 102,
1205 103, 104, 105, 106, 107, 108, 109, 112, 113, 114,
1206 115, 116, 117, 120, 123, 124, 125, 126, 127, 128,
1207 129, 130, 131, 146, 147, 150, 155, 156, 157, 158,
1208 159, 160, 162, 163, 165, 167, 170, 171, 172, 173,
1209 174, 177, 178, 179, 180, 128, 3, 4, 7, 8,
1210 9, 50, 51, 62, 66, 69, 73, 77, 81, 82,
1211 87, 88, 93, 94, 95, 132, 133, 137, 138, 143,
1212 144, 145, 147, 149, 147, 56, 128, 128, 132, 147,
1213 147, 4, 82, 164, 164, 147, 132, 132, 147, 169,
1214 147, 56, 147, 169, 169, 164, 147, 147, 148, 147,
1215 147, 147, 147, 132, 132, 132, 39, 147, 132, 147,
1216 0, 38, 99, 102, 103, 128, 36, 65, 67, 132,
1217 134, 139, 159, 161, 168, 179, 128, 128, 69, 161,
1218 132, 136, 135, 147, 160, 137, 147, 132, 132, 147,
1219 132, 132, 132, 132, 132, 132, 71, 76, 77, 78,
1220 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1221 90, 91, 92, 72, 61, 69, 95, 65, 110, 128,
1222 128, 128, 128, 128, 128, 166, 169, 128, 128, 71,
1223 132, 128, 134, 147, 159, 179, 128, 59, 128, 128,
1224 128, 121, 122, 147, 128, 128, 128, 128, 128, 147,
1225 159, 179, 128, 128, 134, 134, 134, 140, 141, 142,
1226 71, 128, 132, 128, 70, 71, 96, 63, 64, 132,
1227 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
1228 132, 132, 132, 132, 132, 133, 138, 147, 147, 132,
1229 132, 132, 59, 111, 100, 101, 101, 101, 128, 101,
1230 101, 147, 128, 128, 159, 179, 13, 48, 147, 160,
1231 176, 101, 101, 71, 128, 59, 118, 119, 147, 171,
1232 101, 159, 179, 128, 128, 68, 71, 134, 70, 71,
1233 63, 70, 96, 176, 128, 27, 151, 152, 153, 26,
1234 154, 154, 101, 34, 34, 60, 175, 44, 44, 122,
1235 132, 47, 119, 128, 49, 142, 64, 70, 132, 154,
1236 153, 128, 28, 28, 34, 128, 128, 147, 128, 128,
1237 128, 128, 128, 128, 28, 101, 128, 128, 128, 101,
1241 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1242 # define YYSIZE_T __SIZE_TYPE__
1243 #endif
1244 #if ! defined (YYSIZE_T) && defined (size_t)
1245 # define YYSIZE_T size_t
1246 #endif
1247 #if ! defined (YYSIZE_T)
1248 # if defined (__STDC__) || defined (__cplusplus)
1249 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1250 # define YYSIZE_T size_t
1251 # endif
1252 #endif
1253 #if ! defined (YYSIZE_T)
1254 # define YYSIZE_T unsigned int
1255 #endif
1257 #define yyerrok (yyerrstatus = 0)
1258 #define yyclearin (yychar = YYEMPTY)
1259 #define YYEMPTY (-2)
1260 #define YYEOF 0
1262 #define YYACCEPT goto yyacceptlab
1263 #define YYABORT goto yyabortlab
1264 #define YYERROR goto yyerrorlab
1267 /* Like YYERROR except do call yyerror. This remains here temporarily
1268 to ease the transition to the new meaning of YYERROR, for GCC.
1269 Once GCC version 2 has supplanted version 1, this can go. */
1271 #define YYFAIL goto yyerrlab
1273 #define YYRECOVERING() (!!yyerrstatus)
1275 #define YYBACKUP(Token, Value) \
1276 do \
1277 if (yychar == YYEMPTY && yylen == 1) \
1279 yychar = (Token); \
1280 yylval = (Value); \
1281 yytoken = YYTRANSLATE (yychar); \
1282 YYPOPSTACK; \
1283 goto yybackup; \
1285 else \
1287 yyerror ("syntax error: cannot back up");\
1288 YYERROR; \
1290 while (0)
1293 #define YYTERROR 1
1294 #define YYERRCODE 256
1297 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1298 If N is 0, then set CURRENT to the empty location which ends
1299 the previous symbol: RHS[0] (always defined). */
1301 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1302 #ifndef YYLLOC_DEFAULT
1303 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1304 do \
1305 if (N) \
1307 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1308 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1309 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1310 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1312 else \
1314 (Current).first_line = (Current).last_line = \
1315 YYRHSLOC (Rhs, 0).last_line; \
1316 (Current).first_column = (Current).last_column = \
1317 YYRHSLOC (Rhs, 0).last_column; \
1319 while (0)
1320 #endif
1323 /* YY_LOCATION_PRINT -- Print the location on the stream.
1324 This macro was not mandated originally: define only if we know
1325 we won't break user code: when these are the locations we know. */
1327 #ifndef YY_LOCATION_PRINT
1328 # if YYLTYPE_IS_TRIVIAL
1329 # define YY_LOCATION_PRINT(File, Loc) \
1330 fprintf (File, "%d.%d-%d.%d", \
1331 (Loc).first_line, (Loc).first_column, \
1332 (Loc).last_line, (Loc).last_column)
1333 # else
1334 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1335 # endif
1336 #endif
1339 /* YYLEX -- calling `yylex' with the right arguments. */
1341 #ifdef YYLEX_PARAM
1342 # define YYLEX yylex (YYLEX_PARAM)
1343 #else
1344 # define YYLEX yylex ()
1345 #endif
1347 /* Enable debugging if requested. */
1348 #if YYDEBUG
1350 # ifndef YYFPRINTF
1351 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1352 # define YYFPRINTF fprintf
1353 # endif
1355 # define YYDPRINTF(Args) \
1356 do { \
1357 if (yydebug) \
1358 YYFPRINTF Args; \
1359 } while (0)
1361 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1362 do { \
1363 if (yydebug) \
1365 YYFPRINTF (stderr, "%s ", Title); \
1366 yysymprint (stderr, \
1367 Type, Value, Location); \
1368 YYFPRINTF (stderr, "\n"); \
1370 } while (0)
1372 /*------------------------------------------------------------------.
1373 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1374 | TOP (included). |
1375 `------------------------------------------------------------------*/
1377 #if defined (__STDC__) || defined (__cplusplus)
1378 static void
1379 yy_stack_print (short int *bottom, short int *top)
1380 #else
1381 static void
1382 yy_stack_print (bottom, top)
1383 short int *bottom;
1384 short int *top;
1385 #endif
1387 YYFPRINTF (stderr, "Stack now");
1388 for (/* Nothing. */; bottom <= top; ++bottom)
1389 YYFPRINTF (stderr, " %d", *bottom);
1390 YYFPRINTF (stderr, "\n");
1393 # define YY_STACK_PRINT(Bottom, Top) \
1394 do { \
1395 if (yydebug) \
1396 yy_stack_print ((Bottom), (Top)); \
1397 } while (0)
1400 /*------------------------------------------------.
1401 | Report that the YYRULE is going to be reduced. |
1402 `------------------------------------------------*/
1404 #if defined (__STDC__) || defined (__cplusplus)
1405 static void
1406 yy_reduce_print (int yyrule)
1407 #else
1408 static void
1409 yy_reduce_print (yyrule)
1410 int yyrule;
1411 #endif
1413 int yyi;
1414 unsigned int yylno = yyrline[yyrule];
1415 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1416 yyrule - 1, yylno);
1417 /* Print the symbols being reduced, and their result. */
1418 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1419 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1420 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1423 # define YY_REDUCE_PRINT(Rule) \
1424 do { \
1425 if (yydebug) \
1426 yy_reduce_print (Rule); \
1427 } while (0)
1429 /* Nonzero means print parse trace. It is left uninitialized so that
1430 multiple parsers can coexist. */
1431 int yydebug;
1432 #else /* !YYDEBUG */
1433 # define YYDPRINTF(Args)
1434 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1435 # define YY_STACK_PRINT(Bottom, Top)
1436 # define YY_REDUCE_PRINT(Rule)
1437 #endif /* !YYDEBUG */
1440 /* YYINITDEPTH -- initial size of the parser's stacks. */
1441 #ifndef YYINITDEPTH
1442 # define YYINITDEPTH 200
1443 #endif
1445 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1446 if the built-in stack extension method is used).
1448 Do not make this value too large; the results are undefined if
1449 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1450 evaluated with infinite-precision integer arithmetic. */
1452 #ifndef YYMAXDEPTH
1453 # define YYMAXDEPTH 10000
1454 #endif
1458 #if YYERROR_VERBOSE
1460 # ifndef yystrlen
1461 # if defined (__GLIBC__) && defined (_STRING_H)
1462 # define yystrlen strlen
1463 # else
1464 /* Return the length of YYSTR. */
1465 static YYSIZE_T
1466 # if defined (__STDC__) || defined (__cplusplus)
1467 yystrlen (const char *yystr)
1468 # else
1469 yystrlen (yystr)
1470 const char *yystr;
1471 # endif
1473 register const char *yys = yystr;
1475 while (*yys++ != '\0')
1476 continue;
1478 return yys - yystr - 1;
1480 # endif
1481 # endif
1483 # ifndef yystpcpy
1484 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1485 # define yystpcpy stpcpy
1486 # else
1487 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1488 YYDEST. */
1489 static char *
1490 # if defined (__STDC__) || defined (__cplusplus)
1491 yystpcpy (char *yydest, const char *yysrc)
1492 # else
1493 yystpcpy (yydest, yysrc)
1494 char *yydest;
1495 const char *yysrc;
1496 # endif
1498 register char *yyd = yydest;
1499 register const char *yys = yysrc;
1501 while ((*yyd++ = *yys++) != '\0')
1502 continue;
1504 return yyd - 1;
1506 # endif
1507 # endif
1509 #endif /* !YYERROR_VERBOSE */
1513 #if YYDEBUG
1514 /*--------------------------------.
1515 | Print this symbol on YYOUTPUT. |
1516 `--------------------------------*/
1518 #if defined (__STDC__) || defined (__cplusplus)
1519 static void
1520 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1521 #else
1522 static void
1523 yysymprint (yyoutput, yytype, yyvaluep, yylocationp)
1524 FILE *yyoutput;
1525 int yytype;
1526 YYSTYPE *yyvaluep;
1527 YYLTYPE *yylocationp;
1528 #endif
1530 /* Pacify ``unused variable'' warnings. */
1531 (void) yyvaluep;
1532 (void) yylocationp;
1534 if (yytype < YYNTOKENS)
1535 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1536 else
1537 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1539 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1540 fprintf (yyoutput, ": ");
1542 # ifdef YYPRINT
1543 if (yytype < YYNTOKENS)
1544 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1545 # endif
1546 switch (yytype)
1548 default:
1549 break;
1551 YYFPRINTF (yyoutput, ")");
1554 #endif /* ! YYDEBUG */
1555 /*-----------------------------------------------.
1556 | Release the memory associated to this symbol. |
1557 `-----------------------------------------------*/
1559 #if defined (__STDC__) || defined (__cplusplus)
1560 static void
1561 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1562 #else
1563 static void
1564 yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1565 const char *yymsg;
1566 int yytype;
1567 YYSTYPE *yyvaluep;
1568 YYLTYPE *yylocationp;
1569 #endif
1571 /* Pacify ``unused variable'' warnings. */
1572 (void) yyvaluep;
1573 (void) yylocationp;
1575 if (!yymsg)
1576 yymsg = "Deleting";
1577 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1579 switch (yytype)
1582 default:
1583 break;
1588 /* Prevent warnings from -Wmissing-prototypes. */
1590 #ifdef YYPARSE_PARAM
1591 # if defined (__STDC__) || defined (__cplusplus)
1592 int yyparse (void *YYPARSE_PARAM);
1593 # else
1594 int yyparse ();
1595 # endif
1596 #else /* ! YYPARSE_PARAM */
1597 #if defined (__STDC__) || defined (__cplusplus)
1598 int yyparse (void);
1599 #else
1600 int yyparse ();
1601 #endif
1602 #endif /* ! YYPARSE_PARAM */
1606 /* The look-ahead symbol. */
1607 int yychar;
1609 /* The semantic value of the look-ahead symbol. */
1610 YYSTYPE yylval;
1612 /* Number of syntax errors so far. */
1613 int yynerrs;
1614 /* Location data for the look-ahead symbol. */
1615 YYLTYPE yylloc;
1619 /*----------.
1620 | yyparse. |
1621 `----------*/
1623 #ifdef YYPARSE_PARAM
1624 # if defined (__STDC__) || defined (__cplusplus)
1625 int yyparse (void *YYPARSE_PARAM)
1626 # else
1627 int yyparse (YYPARSE_PARAM)
1628 void *YYPARSE_PARAM;
1629 # endif
1630 #else /* ! YYPARSE_PARAM */
1631 #if defined (__STDC__) || defined (__cplusplus)
1633 yyparse (void)
1634 #else
1636 yyparse ()
1638 #endif
1639 #endif
1642 register int yystate;
1643 register int yyn;
1644 int yyresult;
1645 /* Number of tokens to shift before error messages enabled. */
1646 int yyerrstatus;
1647 /* Look-ahead token as an internal (translated) token number. */
1648 int yytoken = 0;
1650 /* Three stacks and their tools:
1651 `yyss': related to states,
1652 `yyvs': related to semantic values,
1653 `yyls': related to locations.
1655 Refer to the stacks thru separate pointers, to allow yyoverflow
1656 to reallocate them elsewhere. */
1658 /* The state stack. */
1659 short int yyssa[YYINITDEPTH];
1660 short int *yyss = yyssa;
1661 register short int *yyssp;
1663 /* The semantic value stack. */
1664 YYSTYPE yyvsa[YYINITDEPTH];
1665 YYSTYPE *yyvs = yyvsa;
1666 register YYSTYPE *yyvsp;
1668 /* The location stack. */
1669 YYLTYPE yylsa[YYINITDEPTH];
1670 YYLTYPE *yyls = yylsa;
1671 YYLTYPE *yylsp;
1672 /* The locations where the error started and ended. */
1673 YYLTYPE yyerror_range[2];
1675 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1677 YYSIZE_T yystacksize = YYINITDEPTH;
1679 /* The variables used to return semantic value and location from the
1680 action routines. */
1681 YYSTYPE yyval;
1682 YYLTYPE yyloc;
1684 /* When reducing, the number of symbols on the RHS of the reduced
1685 rule. */
1686 int yylen;
1688 YYDPRINTF ((stderr, "Starting parse\n"));
1690 yystate = 0;
1691 yyerrstatus = 0;
1692 yynerrs = 0;
1693 yychar = YYEMPTY; /* Cause a token to be read. */
1695 /* Initialize stack pointers.
1696 Waste one element of value and location stack
1697 so that they stay on the same level as the state stack.
1698 The wasted elements are never initialized. */
1700 yyssp = yyss;
1701 yyvsp = yyvs;
1702 yylsp = yyls;
1703 #if YYLTYPE_IS_TRIVIAL
1704 /* Initialize the default location before parsing starts. */
1705 yylloc.first_line = yylloc.last_line = 1;
1706 yylloc.first_column = yylloc.last_column = 0;
1707 #endif
1710 yyvsp[0] = yylval;
1711 yylsp[0] = yylloc;
1713 goto yysetstate;
1715 /*------------------------------------------------------------.
1716 | yynewstate -- Push a new state, which is found in yystate. |
1717 `------------------------------------------------------------*/
1718 yynewstate:
1719 /* In all cases, when you get here, the value and location stacks
1720 have just been pushed. so pushing a state here evens the stacks.
1722 yyssp++;
1724 yysetstate:
1725 *yyssp = yystate;
1727 if (yyss + yystacksize - 1 <= yyssp)
1729 /* Get the current used size of the three stacks, in elements. */
1730 YYSIZE_T yysize = yyssp - yyss + 1;
1732 #ifdef yyoverflow
1734 /* Give user a chance to reallocate the stack. Use copies of
1735 these so that the &'s don't force the real ones into
1736 memory. */
1737 YYSTYPE *yyvs1 = yyvs;
1738 short int *yyss1 = yyss;
1739 YYLTYPE *yyls1 = yyls;
1741 /* Each stack pointer address is followed by the size of the
1742 data in use in that stack, in bytes. This used to be a
1743 conditional around just the two extra args, but that might
1744 be undefined if yyoverflow is a macro. */
1745 yyoverflow ("parser stack overflow",
1746 &yyss1, yysize * sizeof (*yyssp),
1747 &yyvs1, yysize * sizeof (*yyvsp),
1748 &yyls1, yysize * sizeof (*yylsp),
1749 &yystacksize);
1750 yyls = yyls1;
1751 yyss = yyss1;
1752 yyvs = yyvs1;
1754 #else /* no yyoverflow */
1755 # ifndef YYSTACK_RELOCATE
1756 goto yyoverflowlab;
1757 # else
1758 /* Extend the stack our own way. */
1759 if (YYMAXDEPTH <= yystacksize)
1760 goto yyoverflowlab;
1761 yystacksize *= 2;
1762 if (YYMAXDEPTH < yystacksize)
1763 yystacksize = YYMAXDEPTH;
1766 short int *yyss1 = yyss;
1767 union yyalloc *yyptr =
1768 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1769 if (! yyptr)
1770 goto yyoverflowlab;
1771 YYSTACK_RELOCATE (yyss);
1772 YYSTACK_RELOCATE (yyvs);
1773 YYSTACK_RELOCATE (yyls);
1774 # undef YYSTACK_RELOCATE
1775 if (yyss1 != yyssa)
1776 YYSTACK_FREE (yyss1);
1778 # endif
1779 #endif /* no yyoverflow */
1781 yyssp = yyss + yysize - 1;
1782 yyvsp = yyvs + yysize - 1;
1783 yylsp = yyls + yysize - 1;
1785 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1786 (unsigned long int) yystacksize));
1788 if (yyss + yystacksize - 1 <= yyssp)
1789 YYABORT;
1792 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1794 goto yybackup;
1796 /*-----------.
1797 | yybackup. |
1798 `-----------*/
1799 yybackup:
1801 /* Do appropriate processing given the current state. */
1802 /* Read a look-ahead token if we need one and don't already have one. */
1803 /* yyresume: */
1805 /* First try to decide what to do without reference to look-ahead token. */
1807 yyn = yypact[yystate];
1808 if (yyn == YYPACT_NINF)
1809 goto yydefault;
1811 /* Not known => get a look-ahead token if don't already have one. */
1813 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1814 if (yychar == YYEMPTY)
1816 YYDPRINTF ((stderr, "Reading a token: "));
1817 yychar = YYLEX;
1820 if (yychar <= YYEOF)
1822 yychar = yytoken = YYEOF;
1823 YYDPRINTF ((stderr, "Now at end of input.\n"));
1825 else
1827 yytoken = YYTRANSLATE (yychar);
1828 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1831 /* If the proper action on seeing token YYTOKEN is to reduce or to
1832 detect an error, take that action. */
1833 yyn += yytoken;
1834 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1835 goto yydefault;
1836 yyn = yytable[yyn];
1837 if (yyn <= 0)
1839 if (yyn == 0 || yyn == YYTABLE_NINF)
1840 goto yyerrlab;
1841 yyn = -yyn;
1842 goto yyreduce;
1845 if (yyn == YYFINAL)
1846 YYACCEPT;
1848 /* Shift the look-ahead token. */
1849 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1851 /* Discard the token being shifted unless it is eof. */
1852 if (yychar != YYEOF)
1853 yychar = YYEMPTY;
1855 *++yyvsp = yylval;
1856 *++yylsp = yylloc;
1858 /* Count tokens shifted since error; after three, turn off error
1859 status. */
1860 if (yyerrstatus)
1861 yyerrstatus--;
1863 yystate = yyn;
1864 goto yynewstate;
1867 /*-----------------------------------------------------------.
1868 | yydefault -- do the default action for the current state. |
1869 `-----------------------------------------------------------*/
1870 yydefault:
1871 yyn = yydefact[yystate];
1872 if (yyn == 0)
1873 goto yyerrlab;
1874 goto yyreduce;
1877 /*-----------------------------.
1878 | yyreduce -- Do a reduction. |
1879 `-----------------------------*/
1880 yyreduce:
1881 /* yyn is the number of a rule to reduce with. */
1882 yylen = yyr2[yyn];
1884 /* If YYLEN is nonzero, implement the default value of the action:
1885 `$$ = $1'.
1887 Otherwise, the following line sets YYVAL to garbage.
1888 This behavior is undocumented and Bison
1889 users should not rely upon it. Assigning to YYVAL
1890 unconditionally makes the parser a bit smaller, and it avoids a
1891 GCC warning that YYVAL may be used uninitialized. */
1892 yyval = yyvsp[1-yylen];
1894 /* Default location. */
1895 YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);
1896 YY_REDUCE_PRINT (yyn);
1897 switch (yyn)
1899 case 2:
1900 #line 123 "parser.y"
1901 { root_node = astnode_create_list((yyvsp[-1].node)); }
1902 break;
1904 case 3:
1905 #line 127 "parser.y"
1906 { ; }
1907 break;
1909 case 5:
1910 #line 132 "parser.y"
1911 { (yyval.node) = (yyvsp[0].node); }
1912 break;
1914 case 6:
1915 #line 133 "parser.y"
1917 if ((yyvsp[-1].node) != NULL) { (yyval.node) = (yyvsp[-1].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
1918 else { (yyval.node) = (yyvsp[0].node); }
1920 break;
1922 case 7:
1923 #line 140 "parser.y"
1924 { (yyval.node) = (yyvsp[0].node); }
1925 break;
1927 case 8:
1928 #line 141 "parser.y"
1929 { (yyval.node) = NULL; }
1930 break;
1932 case 9:
1933 #line 145 "parser.y"
1934 { (yyval.node) = (yyvsp[-1].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
1935 break;
1937 case 10:
1938 #line 146 "parser.y"
1939 { (yyval.node) = (yyvsp[0].node); }
1940 break;
1942 case 11:
1943 #line 150 "parser.y"
1944 { (yyval.node) = (yyvsp[0].node); }
1945 break;
1947 case 12:
1948 #line 151 "parser.y"
1949 { (yyval.node) = (yyvsp[0].node); }
1950 break;
1952 case 13:
1953 #line 152 "parser.y"
1954 { (yyval.node) = (yyvsp[0].node); }
1955 break;
1957 case 14:
1958 #line 153 "parser.y"
1959 { (yyval.node) = (yyvsp[0].node); }
1960 break;
1962 case 15:
1963 #line 154 "parser.y"
1964 { (yyval.node) = (yyvsp[0].node); }
1965 break;
1967 case 16:
1968 #line 155 "parser.y"
1969 { (yyval.node) = (yyvsp[0].node); }
1970 break;
1972 case 17:
1973 #line 156 "parser.y"
1974 { (yyval.node) = (yyvsp[0].node); }
1975 break;
1977 case 18:
1978 #line 157 "parser.y"
1979 { (yyval.node) = (yyvsp[0].node); }
1980 break;
1982 case 19:
1983 #line 158 "parser.y"
1984 { (yyval.node) = (yyvsp[0].node); }
1985 break;
1987 case 20:
1988 #line 159 "parser.y"
1989 { (yyval.node) = (yyvsp[0].node); }
1990 break;
1992 case 21:
1993 #line 160 "parser.y"
1994 { (yyval.node) = (yyvsp[0].node); }
1995 break;
1997 case 22:
1998 #line 161 "parser.y"
1999 { (yyval.node) = (yyvsp[0].node); }
2000 break;
2002 case 23:
2003 #line 162 "parser.y"
2004 { (yyval.node) = (yyvsp[0].node); }
2005 break;
2007 case 24:
2008 #line 163 "parser.y"
2009 { (yyval.node) = (yyvsp[0].node); }
2010 break;
2012 case 25:
2013 #line 164 "parser.y"
2014 { (yyval.node) = (yyvsp[0].node); }
2015 break;
2017 case 26:
2018 #line 165 "parser.y"
2019 { (yyval.node) = (yyvsp[0].node); }
2020 break;
2022 case 27:
2023 #line 166 "parser.y"
2024 { (yyval.node) = (yyvsp[0].node); }
2025 break;
2027 case 28:
2028 #line 167 "parser.y"
2029 { (yyval.node) = (yyvsp[0].node); }
2030 break;
2032 case 29:
2033 #line 168 "parser.y"
2034 { (yyval.node) = (yyvsp[0].node); }
2035 break;
2037 case 30:
2038 #line 169 "parser.y"
2039 { (yyval.node) = (yyvsp[0].node); }
2040 break;
2042 case 31:
2043 #line 170 "parser.y"
2044 { (yyval.node) = (yyvsp[0].node); }
2045 break;
2047 case 32:
2048 #line 171 "parser.y"
2049 { (yyval.node) = (yyvsp[0].node); }
2050 break;
2052 case 33:
2053 #line 172 "parser.y"
2054 { (yyval.node) = (yyvsp[0].node); }
2055 break;
2057 case 34:
2058 #line 173 "parser.y"
2059 { (yyval.node) = (yyvsp[0].node); }
2060 break;
2062 case 35:
2063 #line 174 "parser.y"
2064 { (yyval.node) = (yyvsp[0].node); }
2065 break;
2067 case 36:
2068 #line 175 "parser.y"
2069 { (yyval.node) = (yyvsp[0].node); }
2070 break;
2072 case 37:
2073 #line 176 "parser.y"
2074 { (yyval.node) = (yyvsp[0].node); }
2075 break;
2077 case 38:
2078 #line 177 "parser.y"
2079 { (yyval.node) = (yyvsp[0].node); }
2080 break;
2082 case 39:
2083 #line 178 "parser.y"
2084 { (yyval.node) = (yyvsp[0].node); }
2085 break;
2087 case 40:
2088 #line 179 "parser.y"
2089 { (yyval.node) = (yyvsp[0].node); }
2090 break;
2092 case 41:
2093 #line 180 "parser.y"
2094 { (yyval.node) = (yyvsp[0].node); }
2095 break;
2097 case 42:
2098 #line 181 "parser.y"
2099 { (yyval.node) = (yyvsp[0].node); }
2100 break;
2102 case 43:
2103 #line 182 "parser.y"
2104 { (yyval.node) = NULL; }
2105 break;
2107 case 44:
2108 #line 186 "parser.y"
2109 { (yyval.node) = astnode_create_org((yyvsp[-1].node), (yyloc)); }
2110 break;
2112 case 45:
2113 #line 190 "parser.y"
2114 { (yyval.node) = astnode_create_align((yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2115 break;
2117 case 46:
2118 #line 194 "parser.y"
2119 { (yyval.node) = astnode_create_warning((yyvsp[-1].node), (yyloc)); }
2120 break;
2122 case 47:
2123 #line 198 "parser.y"
2124 { (yyval.node) = astnode_create_error((yyvsp[-1].node), (yyloc)); }
2125 break;
2127 case 48:
2128 #line 202 "parser.y"
2129 { (yyval.node) = astnode_create_message((yyvsp[-1].node), (yyloc)); }
2130 break;
2132 case 49:
2133 #line 206 "parser.y"
2134 { (yyval.node) = astnode_create_label((yyvsp[-3].node)->label, (yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); astnode_finalize((yyvsp[-3].node)); }
2135 break;
2137 case 50:
2138 #line 210 "parser.y"
2139 { (yyval.node) = (yyvsp[0].node); }
2140 break;
2142 case 51:
2143 #line 211 "parser.y"
2144 { (yyval.node) = NULL; }
2145 break;
2147 case 52:
2148 #line 215 "parser.y"
2149 { (yyval.node) = (yyvsp[0].node); }
2150 break;
2152 case 53:
2153 #line 216 "parser.y"
2154 { (yyval.node) = NULL; }
2155 break;
2157 case 54:
2158 #line 220 "parser.y"
2159 { (yyval.node) = astnode_create_while((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2160 break;
2162 case 55:
2163 #line 224 "parser.y"
2164 { (yyval.node) = astnode_create_rept((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2165 break;
2167 case 56:
2168 #line 228 "parser.y"
2169 { (yyval.node) = astnode_create_proc((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2170 break;
2172 case 57:
2173 #line 232 "parser.y"
2174 { (yyval.node) = astnode_create_struc_decl((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2175 break;
2177 case 58:
2178 #line 236 "parser.y"
2179 { (yyval.node) = astnode_create_union_decl((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2180 break;
2182 case 59:
2183 #line 240 "parser.y"
2184 { (yyval.node) = astnode_create_enum_decl((yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2185 break;
2187 case 60:
2188 #line 244 "parser.y"
2189 { (yyval.node) = (yyvsp[0].node); }
2190 break;
2192 case 61:
2193 #line 245 "parser.y"
2194 { (yyval.node) = (yyvsp[-1].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2195 break;
2197 case 62:
2198 #line 249 "parser.y"
2199 { (yyval.node) = (yyvsp[0].node); }
2200 break;
2202 case 63:
2203 #line 250 "parser.y"
2204 { (yyval.node) = (yyvsp[-1].node); }
2205 break;
2207 case 64:
2208 #line 254 "parser.y"
2209 { (yyval.node) = astnode_create_record_decl((yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2210 break;
2212 case 65:
2213 #line 258 "parser.y"
2214 { (yyval.node) = (yyvsp[0].node); }
2215 break;
2217 case 66:
2218 #line 259 "parser.y"
2219 { (yyval.node) = (yyvsp[-2].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2220 break;
2222 case 67:
2223 #line 263 "parser.y"
2224 { (yyval.node) = astnode_create_bitfield_decl((yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2225 break;
2227 case 68:
2228 #line 267 "parser.y"
2229 { (yyval.node) = astnode_create_charmap((yyvsp[-1].node), (yyloc)); }
2230 break;
2232 case 69:
2233 #line 271 "parser.y"
2234 { (yyval.node) = astnode_create_dataseg(0, (yyloc)); }
2235 break;
2237 case 70:
2238 #line 272 "parser.y"
2239 { (yyval.node) = astnode_create_dataseg(ZEROPAGE_FLAG, (yyloc)); }
2240 break;
2242 case 71:
2243 #line 275 "parser.y"
2244 { (yyval.node) = astnode_create_codeseg((yyloc)); }
2245 break;
2247 case 72:
2248 #line 279 "parser.y"
2249 { (yyval.node) = NULL; }
2250 break;
2252 case 73:
2253 #line 283 "parser.y"
2254 { (yyval.node) = (yyvsp[0].node); }
2255 break;
2257 case 74:
2258 #line 287 "parser.y"
2259 { ; }
2260 break;
2262 case 75:
2263 #line 288 "parser.y"
2264 { ; }
2265 break;
2267 case 76:
2268 #line 292 "parser.y"
2269 { ; }
2270 break;
2272 case 77:
2273 #line 296 "parser.y"
2274 { (yyval.node) = (yyvsp[-1].node); }
2275 break;
2277 case 78:
2278 #line 300 "parser.y"
2279 { (yyval.node) = astnode_create_instruction((yyvsp[0].mnemonic), IMPLIED_MODE, NULL, (yyloc)); }
2280 break;
2282 case 79:
2283 #line 301 "parser.y"
2284 { (yyval.node) = astnode_create_instruction((yyvsp[-1].mnemonic), ACCUMULATOR_MODE, NULL, (yyloc)); }
2285 break;
2287 case 80:
2288 #line 302 "parser.y"
2289 { (yyval.node) = astnode_create_instruction((yyvsp[-2].mnemonic), IMMEDIATE_MODE, (yyvsp[0].node), (yyloc)); }
2290 break;
2292 case 81:
2293 #line 303 "parser.y"
2294 { (yyval.node) = astnode_create_instruction((yyvsp[-1].mnemonic), ABSOLUTE_MODE, (yyvsp[0].node), (yyloc)); }
2295 break;
2297 case 82:
2298 #line 304 "parser.y"
2299 { (yyval.node) = astnode_create_instruction((yyvsp[-3].mnemonic), ABSOLUTE_X_MODE, (yyvsp[-2].node), (yyloc)); }
2300 break;
2302 case 83:
2303 #line 305 "parser.y"
2304 { (yyval.node) = astnode_create_instruction((yyvsp[-3].mnemonic), ABSOLUTE_Y_MODE, (yyvsp[-2].node), (yyloc)); }
2305 break;
2307 case 84:
2308 #line 306 "parser.y"
2309 { (yyval.node) = astnode_create_instruction((yyvsp[-5].mnemonic), PREINDEXED_INDIRECT_MODE, (yyvsp[-3].node), (yyloc)); }
2310 break;
2312 case 85:
2313 #line 307 "parser.y"
2314 { (yyval.node) = astnode_create_instruction((yyvsp[-5].mnemonic), POSTINDEXED_INDIRECT_MODE, (yyvsp[-3].node), (yyloc)); }
2315 break;
2317 case 86:
2318 #line 308 "parser.y"
2319 { (yyval.node) = astnode_create_instruction((yyvsp[-3].mnemonic), INDIRECT_MODE, (yyvsp[-1].node), (yyloc)); }
2320 break;
2322 case 87:
2323 #line 312 "parser.y"
2324 { (yyval.node) = (yyvsp[0].node); }
2325 break;
2327 case 88:
2328 #line 313 "parser.y"
2329 { (yyval.node) = astnode_create_sizeof((yyvsp[0].node), (yyloc)); }
2330 break;
2332 case 89:
2333 #line 314 "parser.y"
2334 { (yyval.node) = (yyvsp[0].node); }
2335 break;
2337 case 90:
2338 #line 315 "parser.y"
2339 { (yyval.node) = (yyvsp[0].node); }
2340 break;
2342 case 91:
2343 #line 316 "parser.y"
2344 { (yyval.node) = (yyvsp[0].node); }
2345 break;
2347 case 92:
2348 #line 317 "parser.y"
2349 { (yyval.node) = (yyvsp[0].node); }
2350 break;
2352 case 93:
2353 #line 318 "parser.y"
2354 { (yyval.node) = astnode_create_pc((yyloc)); }
2355 break;
2357 case 94:
2358 #line 319 "parser.y"
2359 { (yyval.node) = (yyvsp[0].node); }
2360 break;
2362 case 95:
2363 #line 320 "parser.y"
2364 { (yyval.node) = (yyvsp[0].node); }
2365 break;
2367 case 96:
2368 #line 321 "parser.y"
2369 { (yyval.node) = (yyvsp[-1].node); }
2370 break;
2372 case 97:
2373 #line 322 "parser.y"
2374 { (yyval.node) = astnode_create_forward_branch("+", (yyloc)); }
2375 break;
2377 case 98:
2378 #line 323 "parser.y"
2379 { (yyval.node) = astnode_create_backward_branch("-", (yyloc)); }
2380 break;
2382 case 99:
2383 #line 324 "parser.y"
2384 { (yyval.node) = astnode_create_forward_branch((yyvsp[0].ident), (yyloc)); }
2385 break;
2387 case 100:
2388 #line 325 "parser.y"
2389 { (yyval.node) = astnode_create_backward_branch((yyvsp[0].ident), (yyloc)); }
2390 break;
2392 case 101:
2393 #line 326 "parser.y"
2394 { (yyval.node) = astnode_create_mask((yyvsp[0].node), (yyloc)); }
2395 break;
2397 case 102:
2398 #line 330 "parser.y"
2399 { (yyval.node) = (yyvsp[0].node); }
2400 break;
2402 case 103:
2403 #line 331 "parser.y"
2404 { (yyval.node) = astnode_create_index((yyvsp[-3].node), (yyvsp[-1].node), (yyloc)); }
2405 break;
2407 case 104:
2408 #line 332 "parser.y"
2409 { (yyval.node) = astnode_create_index((yyvsp[-3].node), (yyvsp[-1].node), (yyloc)); }
2410 break;
2412 case 105:
2413 #line 336 "parser.y"
2414 { (yyval.node) = (yyvsp[0].node); }
2415 break;
2417 case 106:
2418 #line 337 "parser.y"
2419 { (yyval.node) = (yyvsp[0].node); }
2420 break;
2422 case 107:
2423 #line 341 "parser.y"
2424 { (yyval.node) = (yyvsp[0].node); }
2425 break;
2427 case 108:
2428 #line 342 "parser.y"
2429 { (yyval.node) = (yyvsp[0].node); }
2430 break;
2432 case 109:
2433 #line 346 "parser.y"
2434 { (yyval.node) = (yyvsp[0].node); }
2435 break;
2437 case 110:
2438 #line 347 "parser.y"
2439 { (yyval.node) = NULL; }
2440 break;
2442 case 111:
2443 #line 351 "parser.y"
2444 { (yyval.node) = astnode_create_scope((yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2445 break;
2447 case 112:
2448 #line 355 "parser.y"
2449 { (yyval.node) = astnode_create_dot((yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2450 break;
2452 case 113:
2453 #line 356 "parser.y"
2454 { (yyval.node) = astnode_create_dot((yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2455 break;
2457 case 114:
2458 #line 360 "parser.y"
2459 { (yyval.node) = astnode_create_struc((yyvsp[-1].node), (yyloc)); }
2460 break;
2462 case 115:
2463 #line 364 "parser.y"
2464 { (yyval.node) = (yyvsp[0].node); }
2465 break;
2467 case 116:
2468 #line 365 "parser.y"
2469 { (yyval.node) = NULL; }
2470 break;
2472 case 117:
2473 #line 369 "parser.y"
2474 { (yyval.node) = (yyvsp[0].node); }
2475 break;
2477 case 118:
2478 #line 370 "parser.y"
2479 { (yyval.node) = (yyvsp[-2].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2480 break;
2482 case 119:
2483 #line 374 "parser.y"
2484 { (yyval.node) = (yyvsp[0].node); }
2485 break;
2487 case 120:
2488 #line 375 "parser.y"
2489 { (yyval.node) = astnode_create_null((yyloc)); }
2490 break;
2492 case 121:
2493 #line 379 "parser.y"
2494 { (yyval.node) = astnode_create_local_id((yyvsp[0].ident), (yyloc)); }
2495 break;
2497 case 122:
2498 #line 383 "parser.y"
2499 { (yyval.node) = astnode_create_arithmetic(PLUS_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2500 break;
2502 case 123:
2503 #line 384 "parser.y"
2504 { (yyval.node) = astnode_create_arithmetic(MINUS_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2505 break;
2507 case 124:
2508 #line 385 "parser.y"
2509 { (yyval.node) = astnode_create_arithmetic(MUL_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2510 break;
2512 case 125:
2513 #line 386 "parser.y"
2514 { (yyval.node) = astnode_create_arithmetic(DIV_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2515 break;
2517 case 126:
2518 #line 387 "parser.y"
2519 { (yyval.node) = astnode_create_arithmetic(MOD_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2520 break;
2522 case 127:
2523 #line 388 "parser.y"
2524 { (yyval.node) = astnode_create_arithmetic(AND_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2525 break;
2527 case 128:
2528 #line 389 "parser.y"
2529 { (yyval.node) = astnode_create_arithmetic(OR_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2530 break;
2532 case 129:
2533 #line 390 "parser.y"
2534 { (yyval.node) = astnode_create_arithmetic(XOR_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2535 break;
2537 case 130:
2538 #line 391 "parser.y"
2539 { (yyval.node) = astnode_create_arithmetic(SHL_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2540 break;
2542 case 131:
2543 #line 392 "parser.y"
2544 { (yyval.node) = astnode_create_arithmetic(SHR_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2545 break;
2547 case 132:
2548 #line 393 "parser.y"
2549 { (yyval.node) = astnode_create_arithmetic(NEG_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2550 break;
2552 case 133:
2553 #line 394 "parser.y"
2554 { (yyval.node) = astnode_create_arithmetic(NOT_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2555 break;
2557 case 134:
2558 #line 395 "parser.y"
2559 { (yyval.node) = astnode_create_arithmetic(BANK_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2560 break;
2562 case 135:
2563 #line 396 "parser.y"
2564 { (yyval.node) = astnode_create_arithmetic(LO_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2565 break;
2567 case 136:
2568 #line 397 "parser.y"
2569 { (yyval.node) = astnode_create_arithmetic(HI_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2570 break;
2572 case 137:
2573 #line 398 "parser.y"
2574 { (yyval.node) = astnode_create_arithmetic(UMINUS_OPERATOR, (yyvsp[0].node), NULL, (yyloc)); }
2575 break;
2577 case 138:
2578 #line 402 "parser.y"
2579 { (yyval.node) = astnode_create_arithmetic(EQ_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2580 break;
2582 case 139:
2583 #line 403 "parser.y"
2584 { (yyval.node) = astnode_create_arithmetic(NE_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2585 break;
2587 case 140:
2588 #line 404 "parser.y"
2589 { (yyval.node) = astnode_create_arithmetic(GT_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2590 break;
2592 case 141:
2593 #line 405 "parser.y"
2594 { (yyval.node) = astnode_create_arithmetic(LT_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2595 break;
2597 case 142:
2598 #line 406 "parser.y"
2599 { (yyval.node) = astnode_create_arithmetic(GE_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2600 break;
2602 case 143:
2603 #line 407 "parser.y"
2604 { (yyval.node) = astnode_create_arithmetic(LE_OPERATOR, (yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2605 break;
2607 case 144:
2608 #line 411 "parser.y"
2609 { (yyval.node) = astnode_create_label((yyvsp[0].label), NULL, NULL, (yyloc)); }
2610 break;
2612 case 145:
2613 #line 412 "parser.y"
2614 { (yyval.node) = astnode_create_local_label((yyvsp[0].label), (yyloc)); }
2615 break;
2617 case 146:
2618 #line 413 "parser.y"
2619 { (yyval.node) = astnode_create_forward_branch_decl("+", (yyloc)); }
2620 break;
2622 case 147:
2623 #line 414 "parser.y"
2624 { (yyval.node) = astnode_create_backward_branch_decl("-", (yyloc)); }
2625 break;
2627 case 148:
2628 #line 415 "parser.y"
2629 { (yyval.node) = astnode_create_forward_branch_decl((yyvsp[0].ident), (yyloc)); }
2630 break;
2632 case 149:
2633 #line 416 "parser.y"
2634 { (yyval.node) = astnode_create_backward_branch_decl((yyvsp[0].ident), (yyloc)); }
2635 break;
2637 case 150:
2638 #line 420 "parser.y"
2639 { (yyval.node) = astnode_create_identifier((yyvsp[0].ident), (yyloc)); }
2640 break;
2642 case 151:
2643 #line 424 "parser.y"
2644 { (yyval.node) = (yyvsp[0].node); }
2645 break;
2647 case 152:
2648 #line 425 "parser.y"
2649 { (yyval.node) = astnode_create_null((yyloc)); }
2650 break;
2652 case 153:
2653 #line 429 "parser.y"
2654 { (yyval.node) = astnode_create_integer((yyvsp[0].integer), (yyloc)); }
2655 break;
2657 case 154:
2658 #line 430 "parser.y"
2659 { (yyval.node) = astnode_create_string((yyvsp[0].string), (yyloc)); }
2660 break;
2662 case 155:
2663 #line 434 "parser.y"
2664 { (yyval.node) = astnode_create_if((yyvsp[-6].node), (yyvsp[-4].node), (yyvsp[-3].node), (yyvsp[-2].node), (yyloc)); }
2665 break;
2667 case 156:
2668 #line 438 "parser.y"
2669 { (yyval.node) = (yyvsp[0].node); }
2670 break;
2672 case 157:
2673 #line 439 "parser.y"
2674 { (yyval.node) = NULL; }
2675 break;
2677 case 158:
2678 #line 443 "parser.y"
2679 { (yyval.node) = (yyvsp[0].node); }
2680 break;
2682 case 159:
2683 #line 444 "parser.y"
2684 { (yyval.node) = (yyvsp[-1].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2685 break;
2687 case 160:
2688 #line 448 "parser.y"
2689 { (yyval.node) = astnode_create_case((yyvsp[-2].node), (yyvsp[0].node), (yyloc)); }
2690 break;
2692 case 161:
2693 #line 452 "parser.y"
2694 { (yyval.node) = (yyvsp[0].node); }
2695 break;
2697 case 162:
2698 #line 453 "parser.y"
2699 { (yyval.node) = NULL; }
2700 break;
2702 case 163:
2703 #line 457 "parser.y"
2704 { (yyval.node) = astnode_create_ifdef((yyvsp[-5].node), (yyvsp[-3].node), (yyvsp[-2].node), (yyloc)); }
2705 break;
2707 case 164:
2708 #line 461 "parser.y"
2709 { (yyval.node) = astnode_create_ifndef((yyvsp[-5].node), (yyvsp[-3].node), (yyvsp[-2].node), (yyloc)); }
2710 break;
2712 case 165:
2713 #line 465 "parser.y"
2714 { (yyval.node) = (yyvsp[-1].node); }
2715 break;
2717 case 166:
2718 #line 466 "parser.y"
2719 { (yyval.node) = (yyvsp[-1].node); }
2720 break;
2722 case 167:
2723 #line 470 "parser.y"
2724 { (yyval.node) = astnode_create_var_decl(0, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2725 break;
2727 case 168:
2728 #line 471 "parser.y"
2729 { (yyval.node) = astnode_create_var_decl(ZEROPAGE_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2730 break;
2732 case 169:
2733 #line 472 "parser.y"
2734 { (yyval.node) = astnode_create_var_decl(PUBLIC_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2735 break;
2737 case 170:
2738 #line 473 "parser.y"
2739 { (yyval.node) = astnode_create_var_decl(ZEROPAGE_FLAG | PUBLIC_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2740 break;
2742 case 171:
2743 #line 474 "parser.y"
2744 { (yyval.node) = astnode_create_var_decl(PUBLIC_FLAG | ZEROPAGE_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2745 break;
2747 case 172:
2748 #line 478 "parser.y"
2749 { (yyval.node) = astnode_create_data((yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2750 break;
2752 case 173:
2753 #line 479 "parser.y"
2754 { (yyval.node) = astnode_create_storage((yyvsp[0].node), NULL, (yyloc)); }
2755 break;
2757 case 174:
2758 #line 480 "parser.y"
2759 { (yyval.node) = astnode_create_storage((yyvsp[-3].node), (yyvsp[-1].node), (yyloc)); }
2760 break;
2762 case 175:
2763 #line 484 "parser.y"
2764 { (yyval.node) = astnode_create_datatype(BYTE_DATATYPE, NULL, (yyloc)); }
2765 break;
2767 case 176:
2768 #line 485 "parser.y"
2769 { (yyval.node) = astnode_create_datatype(CHAR_DATATYPE, NULL, (yyloc)); }
2770 break;
2772 case 177:
2773 #line 486 "parser.y"
2774 { (yyval.node) = astnode_create_datatype(WORD_DATATYPE, NULL, (yyloc)); }
2775 break;
2777 case 178:
2778 #line 487 "parser.y"
2779 { (yyval.node) = astnode_create_datatype(DWORD_DATATYPE, NULL, (yyloc)); }
2780 break;
2782 case 179:
2783 #line 488 "parser.y"
2784 { (yyval.node) = astnode_create_datatype(USER_DATATYPE, (yyvsp[0].node), (yyloc)); }
2785 break;
2787 case 180:
2788 #line 489 "parser.y"
2789 { (yyval.node) = astnode_create_datatype(USER_DATATYPE, (yyvsp[0].node), (yyloc)); }
2790 break;
2792 case 181:
2793 #line 493 "parser.y"
2794 { (yyval.node) = (yyvsp[0].node); }
2795 break;
2797 case 182:
2798 #line 494 "parser.y"
2799 { (yyval.node) = (yyvsp[-2].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2800 break;
2802 case 183:
2803 #line 498 "parser.y"
2804 { (yyval.node) = astnode_create_incsrc((yyvsp[-1].node), (yyloc)); handle_incsrc((yyval.node)); }
2805 break;
2807 case 184:
2808 #line 502 "parser.y"
2809 { (yyval.node) = astnode_create_incbin((yyvsp[-1].node), (yyloc)); handle_incbin((yyval.node)); }
2810 break;
2812 case 185:
2813 #line 506 "parser.y"
2814 { (yyval.node) = astnode_create_string((yyvsp[0].string), (yyloc)); }
2815 break;
2817 case 186:
2818 #line 507 "parser.y"
2819 { (yyval.node) = astnode_create_file_path(scan_include('>'), (yyloc)); }
2820 break;
2822 case 187:
2823 #line 511 "parser.y"
2824 { (yyval.node) = astnode_create_macro_decl((yyvsp[-5].node), (yyvsp[-4].node), (yyvsp[-2].node), (yyloc)); }
2825 break;
2827 case 188:
2828 #line 515 "parser.y"
2829 { (yyval.node) = (yyvsp[0].node); }
2830 break;
2832 case 189:
2833 #line 516 "parser.y"
2834 { (yyval.node) = NULL; }
2835 break;
2837 case 190:
2838 #line 520 "parser.y"
2839 { (yyval.node) = astnode_create_macro((yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2840 break;
2842 case 191:
2843 #line 524 "parser.y"
2844 { (yyval.node) = (yyvsp[0].node); }
2845 break;
2847 case 192:
2848 #line 525 "parser.y"
2849 { (yyval.node) = NULL; }
2850 break;
2852 case 193:
2853 #line 529 "parser.y"
2854 { (yyval.node) = (yyvsp[0].node); }
2855 break;
2857 case 194:
2858 #line 530 "parser.y"
2859 { (yyval.node) = (yyvsp[-2].node); astnode_add_sibling((yyval.node), (yyvsp[0].node)); }
2860 break;
2862 case 195:
2863 #line 534 "parser.y"
2864 { (yyval.node) = astnode_create_equ((yyvsp[-3].node), (yyvsp[-1].node), (yyloc)); }
2865 break;
2867 case 196:
2868 #line 538 "parser.y"
2869 { (yyval.node) = astnode_create_assign((yyvsp[-3].node), (yyvsp[-1].node), (yyloc)); }
2870 break;
2872 case 197:
2873 #line 542 "parser.y"
2874 { (yyval.node) = astnode_create_equ((yyvsp[-1].node), astnode_create_integer(0, (yyloc)), (yyloc)); }
2875 break;
2877 case 198:
2878 #line 543 "parser.y"
2879 { (yyval.node) = astnode_create_equ((yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2880 break;
2882 case 199:
2883 #line 547 "parser.y"
2884 { (yyval.node) = astnode_create_public((yyvsp[-1].node), (yyloc)); }
2885 break;
2887 case 200:
2888 #line 551 "parser.y"
2889 { (yyval.node) = astnode_create_extrn((yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2890 break;
2892 case 201:
2893 #line 555 "parser.y"
2894 { (yyval.node) = (yyvsp[0].node); }
2895 break;
2897 case 202:
2898 #line 556 "parser.y"
2899 { (yyval.node) = NULL; }
2900 break;
2902 case 203:
2903 #line 560 "parser.y"
2904 { (yyval.node) = (yyvsp[0].node); }
2905 break;
2907 case 204:
2908 #line 561 "parser.y"
2909 { (yyval.node) = astnode_create_datatype(USER_DATATYPE, (yyvsp[0].node), (yyloc)); }
2910 break;
2912 case 205:
2913 #line 562 "parser.y"
2914 { (yyval.node) = astnode_create_integer(PROC_SYMBOL, (yyloc)); }
2915 break;
2917 case 206:
2918 #line 563 "parser.y"
2919 { (yyval.node) = astnode_create_integer(LABEL_SYMBOL, (yyloc)); }
2920 break;
2922 case 207:
2923 #line 567 "parser.y"
2924 { (yyval.node) = (yyvsp[0].node); }
2925 break;
2927 case 208:
2928 #line 568 "parser.y"
2929 { (yyval.node) = (yyvsp[0].node); }
2930 break;
2932 case 209:
2933 #line 572 "parser.y"
2934 { (yyval.node) = astnode_create_var_decl(0, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2935 break;
2937 case 210:
2938 #line 573 "parser.y"
2939 { (yyval.node) = astnode_create_var_decl(ZEROPAGE_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2940 break;
2942 case 211:
2943 #line 574 "parser.y"
2944 { (yyval.node) = astnode_create_var_decl(PUBLIC_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2945 break;
2947 case 212:
2948 #line 575 "parser.y"
2949 { (yyval.node) = astnode_create_var_decl(ZEROPAGE_FLAG | PUBLIC_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2950 break;
2952 case 213:
2953 #line 576 "parser.y"
2954 { (yyval.node) = astnode_create_var_decl(PUBLIC_FLAG | ZEROPAGE_FLAG, (yyvsp[-1].node), (yyvsp[0].node), (yyloc)); }
2955 break;
2957 case 214:
2958 #line 580 "parser.y"
2959 { (yyval.node) = astnode_create_storage((yyvsp[-2].node), (yyvsp[-1].node), (yyloc)); }
2960 break;
2962 case 215:
2963 #line 584 "parser.y"
2964 { (yyval.node) = astnode_create_datatype(BYTE_DATATYPE, NULL, (yyloc)); }
2965 break;
2967 case 216:
2968 #line 585 "parser.y"
2969 { (yyval.node) = astnode_create_datatype(WORD_DATATYPE, NULL, (yyloc)); }
2970 break;
2972 case 217:
2973 #line 586 "parser.y"
2974 { (yyval.node) = astnode_create_datatype(DWORD_DATATYPE, NULL, (yyloc)); }
2975 break;
2980 /* Line 1037 of yacc.c. */
2981 #line 2982 "parser.c"
2983 yyvsp -= yylen;
2984 yyssp -= yylen;
2985 yylsp -= yylen;
2987 YY_STACK_PRINT (yyss, yyssp);
2989 *++yyvsp = yyval;
2990 *++yylsp = yyloc;
2992 /* Now `shift' the result of the reduction. Determine what state
2993 that goes to, based on the state we popped back to and the rule
2994 number reduced by. */
2996 yyn = yyr1[yyn];
2998 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2999 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3000 yystate = yytable[yystate];
3001 else
3002 yystate = yydefgoto[yyn - YYNTOKENS];
3004 goto yynewstate;
3007 /*------------------------------------.
3008 | yyerrlab -- here on detecting error |
3009 `------------------------------------*/
3010 yyerrlab:
3011 /* If not already recovering from an error, report this error. */
3012 if (!yyerrstatus)
3014 ++yynerrs;
3015 #if YYERROR_VERBOSE
3016 yyn = yypact[yystate];
3018 if (YYPACT_NINF < yyn && yyn < YYLAST)
3020 YYSIZE_T yysize = 0;
3021 int yytype = YYTRANSLATE (yychar);
3022 const char* yyprefix;
3023 char *yymsg;
3024 int yyx;
3026 /* Start YYX at -YYN if negative to avoid negative indexes in
3027 YYCHECK. */
3028 int yyxbegin = yyn < 0 ? -yyn : 0;
3030 /* Stay within bounds of both yycheck and yytname. */
3031 int yychecklim = YYLAST - yyn;
3032 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3033 int yycount = 0;
3035 yyprefix = ", expecting ";
3036 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3037 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3039 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
3040 yycount += 1;
3041 if (yycount == 5)
3043 yysize = 0;
3044 break;
3047 yysize += (sizeof ("syntax error, unexpected ")
3048 + yystrlen (yytname[yytype]));
3049 yymsg = (char *) YYSTACK_ALLOC (yysize);
3050 if (yymsg != 0)
3052 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
3053 yyp = yystpcpy (yyp, yytname[yytype]);
3055 if (yycount < 5)
3057 yyprefix = ", expecting ";
3058 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3059 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3061 yyp = yystpcpy (yyp, yyprefix);
3062 yyp = yystpcpy (yyp, yytname[yyx]);
3063 yyprefix = " or ";
3066 yyerror (yymsg);
3067 YYSTACK_FREE (yymsg);
3069 else
3070 yyerror ("syntax error; also virtual memory exhausted");
3072 else
3073 #endif /* YYERROR_VERBOSE */
3074 yyerror ("syntax error");
3077 yyerror_range[0] = yylloc;
3079 if (yyerrstatus == 3)
3081 /* If just tried and failed to reuse look-ahead token after an
3082 error, discard it. */
3084 if (yychar <= YYEOF)
3086 /* If at end of input, pop the error token,
3087 then the rest of the stack, then return failure. */
3088 if (yychar == YYEOF)
3089 for (;;)
3091 yyerror_range[0] = *yylsp;
3092 YYPOPSTACK;
3093 if (yyssp == yyss)
3094 YYABORT;
3095 yydestruct ("Error: popping",
3096 yystos[*yyssp], yyvsp, yylsp);
3099 else
3101 yydestruct ("Error: discarding", yytoken, &yylval, &yylloc);
3102 yychar = YYEMPTY;
3106 /* Else will try to reuse look-ahead token after shifting the error
3107 token. */
3108 goto yyerrlab1;
3111 /*---------------------------------------------------.
3112 | yyerrorlab -- error raised explicitly by YYERROR. |
3113 `---------------------------------------------------*/
3114 yyerrorlab:
3116 #ifdef __GNUC__
3117 /* Pacify GCC when the user code never invokes YYERROR and the label
3118 yyerrorlab therefore never appears in user code. */
3119 if (0)
3120 goto yyerrorlab;
3121 #endif
3123 yyerror_range[0] = yylsp[1-yylen];
3124 yylsp -= yylen;
3125 yyvsp -= yylen;
3126 yyssp -= yylen;
3127 yystate = *yyssp;
3128 goto yyerrlab1;
3131 /*-------------------------------------------------------------.
3132 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3133 `-------------------------------------------------------------*/
3134 yyerrlab1:
3135 yyerrstatus = 3; /* Each real token shifted decrements this. */
3137 for (;;)
3139 yyn = yypact[yystate];
3140 if (yyn != YYPACT_NINF)
3142 yyn += YYTERROR;
3143 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3145 yyn = yytable[yyn];
3146 if (0 < yyn)
3147 break;
3151 /* Pop the current state because it cannot handle the error token. */
3152 if (yyssp == yyss)
3153 YYABORT;
3155 yyerror_range[0] = *yylsp;
3156 yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp);
3157 YYPOPSTACK;
3158 yystate = *yyssp;
3159 YY_STACK_PRINT (yyss, yyssp);
3162 if (yyn == YYFINAL)
3163 YYACCEPT;
3165 *++yyvsp = yylval;
3167 yyerror_range[1] = yylloc;
3168 /* Using YYLLOC is tempting, but would change the location of
3169 the look-ahead. YYLOC is available though. */
3170 YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
3171 *++yylsp = yyloc;
3173 /* Shift the error token. */
3174 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3176 yystate = yyn;
3177 goto yynewstate;
3180 /*-------------------------------------.
3181 | yyacceptlab -- YYACCEPT comes here. |
3182 `-------------------------------------*/
3183 yyacceptlab:
3184 yyresult = 0;
3185 goto yyreturn;
3187 /*-----------------------------------.
3188 | yyabortlab -- YYABORT comes here. |
3189 `-----------------------------------*/
3190 yyabortlab:
3191 yydestruct ("Error: discarding lookahead",
3192 yytoken, &yylval, &yylloc);
3193 yychar = YYEMPTY;
3194 yyresult = 1;
3195 goto yyreturn;
3197 #ifndef yyoverflow
3198 /*----------------------------------------------.
3199 | yyoverflowlab -- parser overflow comes here. |
3200 `----------------------------------------------*/
3201 yyoverflowlab:
3202 yyerror ("parser stack overflow");
3203 yyresult = 2;
3204 /* Fall through. */
3205 #endif
3207 yyreturn:
3208 #ifndef yyoverflow
3209 if (yyss != yyssa)
3210 YYSTACK_FREE (yyss);
3211 #endif
3212 return yyresult;
3216 #line 588 "parser.y"
3219 * Takes care of switching to a new scanner input stream when a "incsrc" statement
3220 * has been encountered.
3221 * The current stream is pushed on a stack, and will be popped when EOF is reached
3222 * in the new stream.
3223 * @param n A node of type INCSRC_NODE
3225 void handle_incsrc(astnode *n)
3227 char errs[512];
3228 /* Get the node which describes the file to include */
3229 astnode *file = astnode_get_child(n, 0);
3230 int quoted_form = (astnode_get_type(file) == STRING_NODE) ? 1 : 0;
3231 switch (yypushandrestart(file->string, quoted_form)) {
3232 case 0:
3233 /* Success */
3234 break;
3235 case 1:
3236 /* Failed to open file */
3237 sprintf(errs, "could not open '%s' for reading", file->string);
3238 yyerror(errs);
3239 break;
3240 case 2:
3241 /* Stack overflow */
3242 yyerror("Maximum include nesting level reached");
3243 break;
3247 // TODO: This shouldn't be done here but rather in astproc module.
3249 FILE *open_included_file(const char *, int, char **);
3252 * Takes care of including the binary contents of the file specified by a parsed
3253 * "incbin" statement.
3254 * Calls yyerror() if the file can't be included for some reason.
3255 * @param n A node of type INCBIN_NODE
3257 void handle_incbin(astnode *n)
3259 FILE *fp;
3260 unsigned char *data;
3261 int size;
3262 char errs[512];
3263 /* Get the node which describes the file to include */
3264 astnode *file = astnode_get_child(n, 0);
3265 const char *filename = file->string;
3266 int quoted_form = (astnode_get_type(file) == STRING_NODE) ? 1 : 0;
3267 /* Try to open it */
3268 fp = open_included_file(filename, quoted_form, NULL);
3269 if (fp) {
3270 /* Get filesize */
3271 fseek(fp, 0, SEEK_END);
3272 size = ftell(fp);
3273 rewind(fp);
3274 if (size > 0) {
3275 /* Allocate buffer to hold file contents */
3276 data = (unsigned char *)malloc(size);
3277 /* Read file contents into buffer */
3278 fread(data, 1, size, fp);
3279 /* Insert binary node */
3280 astnode_add_sibling(n, astnode_create_binary(data, size, n->loc) );
3282 /* Close file */
3283 fclose(fp);
3284 } else {
3285 /* Couldn't open file */
3286 sprintf(errs, "could not open '%s' for reading", file->string);
3287 yyerror(errs);