/* */
This source file includes following definitions.
- YYID
- yy_symbol_value_print
- yy_symbol_print
- yy_stack_print
- yy_reduce_print
- yystrlen
- yystpcpy
- yytnamerr
- yysyntax_error
- yydestruct
- yyparse
- assembly
- yyerror
1 /* A Bison parser, made by GNU Bison 2.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61 /* Using locations. */
62 #define YYLSP_NEEDED 1
63
64 /* Substitute the variable and function names. */
65 #define yyparse asm_parse
66 #define yylex asm_lex
67 #define yyerror asm_error
68 #define yylval asm_lval
69 #define yychar asm_char
70 #define yydebug asm_debug
71 #define yynerrs asm_nerrs
72 #define yylloc asm_lloc
73
74 /* Copy the first part of user declarations. */
75
76 /* Line 268 of yacc.c */
77 #line 1 "asm_parse.y"
78
79 /*
80 * Copyright (c) 2004, 2010 Tama Communications Corporation
81 *
82 * This file is part of GNU GLOBAL.
83 *
84 * This program is free software: you can redistribute it and/or modify
85 * it under the terms of the GNU General Public License as published by
86 * the Free Software Foundation, either version 3 of the License, or
87 * (at your option) any later version.
88 *
89 * This program is distributed in the hope that it will be useful,
90 * but WITHOUT ANY WARRANTY; without even the implied warranty of
91 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92 * GNU General Public License for more details.
93 *
94 * You should have received a copy of the GNU General Public License
95 * along with this program. If not, see <http://www.gnu.org/licenses/>.
96 */
97
98 #ifdef HAVE_CONFIG_H
99 #include <config.h>
100 #endif
101 #include <assert.h>
102 #include <ctype.h>
103 #ifdef HAVE_STRING_H
104 #include <string.h>
105 #else
106 #include <strings.h>
107 #endif
108
109 #include "internal.h"
110 #include "die.h"
111 #include "linetable.h"
112 #include "strbuf.h"
113
114 #define YYLTYPE int
115 #define YYLLOC_DEFAULT(Current, Rhs, N) ((Current) = (Rhs)[1])
116
117 #undef PUT
118 #define PUT(type, tag, lno) do { \
119 const char *line_image = linetable_get(lno, NULL); \
120 char *nl = strchr(line_image, '\n'); \
121 if (nl != NULL) \
122 *nl = '\0'; \
123 param->put(type, tag, lno, param->file, line_image, param->arg);\
124 if (nl != NULL) \
125 *nl = '\n'; \
126 } while (0)
127
128 #define GET_SYM(offset) (assert((offset) < strbuf_getlen(asm_symtable)),\
129 &strbuf_value(asm_symtable)[offset])
130
131 STRBUF *asm_symtable;
132
133 static void yyerror(const struct parser_param *, const char *);
134
135
136
137 /* Line 268 of yacc.c */
138 #line 139 "asm_parse.c"
139
140 /* Enabling traces. */
141 #ifndef YYDEBUG
142 # define YYDEBUG 0
143 #endif
144
145 /* Enabling verbose error messages. */
146 #ifdef YYERROR_VERBOSE
147 # undef YYERROR_VERBOSE
148 # define YYERROR_VERBOSE 1
149 #else
150 # define YYERROR_VERBOSE 0
151 #endif
152
153 /* Enabling the token table. */
154 #ifndef YYTOKEN_TABLE
155 # define YYTOKEN_TABLE 0
156 #endif
157
158
159 /* Tokens. */
160 #ifndef YYTOKENTYPE
161 # define YYTOKENTYPE
162 /* Put the tokens into the symbol table, so that GDB and other debuggers
163 know about them. */
164 enum yytokentype {
165 ASM_CONST = 258,
166 ASM_CALL = 259,
167 ASM_ENTRY = 260,
168 ASM_EXT = 261,
169 ASM_SYMBOL = 262,
170 ASM_LABEL = 263,
171 ASM_DEFINE = 264,
172 ASM_UNDEF = 265,
173 ASM_DIRECTIVE = 266,
174 ASM_MACRO = 267,
175 ASM_EQU = 268
176 };
177 #endif
178
179
180
181 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
182 typedef int YYSTYPE;
183 # define YYSTYPE_IS_TRIVIAL 1
184 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
185 # define YYSTYPE_IS_DECLARED 1
186 #endif
187
188 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
189 typedef struct YYLTYPE
190 {
191 int first_line;
192 int first_column;
193 int last_line;
194 int last_column;
195 } YYLTYPE;
196 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
197 # define YYLTYPE_IS_DECLARED 1
198 # define YYLTYPE_IS_TRIVIAL 1
199 #endif
200
201
202 /* Copy the second part of user declarations. */
203
204
205 /* Line 343 of yacc.c */
206 #line 207 "asm_parse.c"
207
208 #ifdef short
209 # undef short
210 #endif
211
212 #ifdef YYTYPE_UINT8
213 typedef YYTYPE_UINT8 yytype_uint8;
214 #else
215 typedef unsigned char yytype_uint8;
216 #endif
217
218 #ifdef YYTYPE_INT8
219 typedef YYTYPE_INT8 yytype_int8;
220 #elif (defined __STDC__ || defined __C99__FUNC__ \
221 || defined __cplusplus || defined _MSC_VER)
222 typedef signed char yytype_int8;
223 #else
224 typedef short int yytype_int8;
225 #endif
226
227 #ifdef YYTYPE_UINT16
228 typedef YYTYPE_UINT16 yytype_uint16;
229 #else
230 typedef unsigned short int yytype_uint16;
231 #endif
232
233 #ifdef YYTYPE_INT16
234 typedef YYTYPE_INT16 yytype_int16;
235 #else
236 typedef short int yytype_int16;
237 #endif
238
239 #ifndef YYSIZE_T
240 # ifdef __SIZE_TYPE__
241 # define YYSIZE_T __SIZE_TYPE__
242 # elif defined size_t
243 # define YYSIZE_T size_t
244 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
245 || defined __cplusplus || defined _MSC_VER)
246 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
247 # define YYSIZE_T size_t
248 # else
249 # define YYSIZE_T unsigned int
250 # endif
251 #endif
252
253 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
254
255 #ifndef YY_
256 # if defined YYENABLE_NLS && YYENABLE_NLS
257 # if ENABLE_NLS
258 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
259 # define YY_(msgid) dgettext ("bison-runtime", msgid)
260 # endif
261 # endif
262 # ifndef YY_
263 # define YY_(msgid) msgid
264 # endif
265 #endif
266
267 /* Suppress unused-variable warnings by "using" E. */
268 #if ! defined lint || defined __GNUC__
269 # define YYUSE(e) ((void) (e))
270 #else
271 # define YYUSE(e) /* empty */
272 #endif
273
274 /* Identity function, used to suppress warnings about constant conditions. */
275 #ifndef lint
276 # define YYID(n) (n)
277 #else
278 #if (defined __STDC__ || defined __C99__FUNC__ \
279 || defined __cplusplus || defined _MSC_VER)
280 static int
281 YYID (int yyi)
282 #else
283 static int
284 YYID (yyi)
285 int yyi;
286 #endif
287 {
288 return yyi;
289 }
290 #endif
291
292 #if ! defined yyoverflow || YYERROR_VERBOSE
293
294 /* The parser invokes alloca or malloc; define the necessary symbols. */
295
296 # ifdef YYSTACK_USE_ALLOCA
297 # if YYSTACK_USE_ALLOCA
298 # ifdef __GNUC__
299 # define YYSTACK_ALLOC __builtin_alloca
300 # elif defined __BUILTIN_VA_ARG_INCR
301 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
302 # elif defined _AIX
303 # define YYSTACK_ALLOC __alloca
304 # elif defined _MSC_VER
305 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
306 # define alloca _alloca
307 # else
308 # define YYSTACK_ALLOC alloca
309 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
310 || defined __cplusplus || defined _MSC_VER)
311 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
312 # ifndef EXIT_SUCCESS
313 # define EXIT_SUCCESS 0
314 # endif
315 # endif
316 # endif
317 # endif
318 # endif
319
320 # ifdef YYSTACK_ALLOC
321 /* Pacify GCC's `empty if-body' warning. */
322 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
323 # ifndef YYSTACK_ALLOC_MAXIMUM
324 /* The OS might guarantee only one guard page at the bottom of the stack,
325 and a page size can be as small as 4096 bytes. So we cannot safely
326 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
327 to allow for a few compiler-allocated temporary stack slots. */
328 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
329 # endif
330 # else
331 # define YYSTACK_ALLOC YYMALLOC
332 # define YYSTACK_FREE YYFREE
333 # ifndef YYSTACK_ALLOC_MAXIMUM
334 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
335 # endif
336 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
337 && ! ((defined YYMALLOC || defined malloc) \
338 && (defined YYFREE || defined free)))
339 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
340 # ifndef EXIT_SUCCESS
341 # define EXIT_SUCCESS 0
342 # endif
343 # endif
344 # ifndef YYMALLOC
345 # define YYMALLOC malloc
346 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
347 || defined __cplusplus || defined _MSC_VER)
348 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
349 # endif
350 # endif
351 # ifndef YYFREE
352 # define YYFREE free
353 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
354 || defined __cplusplus || defined _MSC_VER)
355 void free (void *); /* INFRINGES ON USER NAME SPACE */
356 # endif
357 # endif
358 # endif
359 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
360
361
362 #if (! defined yyoverflow \
363 && (! defined __cplusplus \
364 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
365 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
366
367 /* A type that is properly aligned for any stack member. */
368 union yyalloc
369 {
370 yytype_int16 yyss_alloc;
371 YYSTYPE yyvs_alloc;
372 YYLTYPE yyls_alloc;
373 };
374
375 /* The size of the maximum gap between one aligned stack and the next. */
376 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
377
378 /* The size of an array large to enough to hold all stacks, each with
379 N elements. */
380 # define YYSTACK_BYTES(N) \
381 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
382 + 2 * YYSTACK_GAP_MAXIMUM)
383
384 # define YYCOPY_NEEDED 1
385
386 /* Relocate STACK from its old location to the new one. The
387 local variables YYSIZE and YYSTACKSIZE give the old and new number of
388 elements in the stack, and YYPTR gives the new location of the
389 stack. Advance YYPTR to a properly aligned location for the next
390 stack. */
391 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
392 do \
393 { \
394 YYSIZE_T yynewbytes; \
395 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
396 Stack = &yyptr->Stack_alloc; \
397 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
398 yyptr += yynewbytes / sizeof (*yyptr); \
399 } \
400 while (YYID (0))
401
402 #endif
403
404 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
405 /* Copy COUNT objects from FROM to TO. The source and destination do
406 not overlap. */
407 # ifndef YYCOPY
408 # if defined __GNUC__ && 1 < __GNUC__
409 # define YYCOPY(To, From, Count) \
410 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
411 # else
412 # define YYCOPY(To, From, Count) \
413 do \
414 { \
415 YYSIZE_T yyi; \
416 for (yyi = 0; yyi < (Count); yyi++) \
417 (To)[yyi] = (From)[yyi]; \
418 } \
419 while (YYID (0))
420 # endif
421 # endif
422 #endif /* !YYCOPY_NEEDED */
423
424 /* YYFINAL -- State number of the termination state. */
425 #define YYFINAL 2
426 /* YYLAST -- Last index in YYTABLE. */
427 #define YYLAST 48
428
429 /* YYNTOKENS -- Number of terminals. */
430 #define YYNTOKENS 18
431 /* YYNNTS -- Number of nonterminals. */
432 #define YYNNTS 3
433 /* YYNRULES -- Number of rules. */
434 #define YYNRULES 13
435 /* YYNRULES -- Number of states. */
436 #define YYNSTATES 46
437
438 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
439 #define YYUNDEFTOK 2
440 #define YYMAXUTOK 268
441
442 #define YYTRANSLATE(YYX) \
443 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
444
445 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
446 static const yytype_uint8 yytranslate[] =
447 {
448 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 16, 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 14, 15, 2, 2, 17, 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, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
474 5, 6, 7, 8, 9, 10, 11, 12, 13
475 };
476
477 #if YYDEBUG
478 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
479 YYRHS. */
480 static const yytype_uint8 yyprhs[] =
481 {
482 0, 0, 3, 4, 7, 14, 19, 27, 32, 37,
483 42, 47, 53, 58
484 };
485
486 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
487 static const yytype_int8 yyrhs[] =
488 {
489 19, 0, -1, -1, 19, 20, -1, 5, 14, 7,
490 15, 1, 16, -1, 4, 7, 1, 16, -1, 4,
491 6, 14, 7, 15, 1, 16, -1, 9, 7, 1,
492 16, -1, 10, 7, 1, 16, -1, 12, 7, 1,
493 16, -1, 8, 12, 1, 16, -1, 13, 7, 17,
494 1, 16, -1, 8, 13, 1, 16, -1, 1, 16,
495 -1
496 };
497
498 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
499 static const yytype_uint8 yyrline[] =
500 {
501 0, 83, 83, 84, 87, 93, 105, 111, 116, 121,
502 126, 131, 136, 141
503 };
504 #endif
505
506 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
507 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
508 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
509 static const char *const yytname[] =
510 {
511 "$end", "error", "$undefined", "ASM_CONST", "ASM_CALL", "ASM_ENTRY",
512 "ASM_EXT", "ASM_SYMBOL", "ASM_LABEL", "\"#define\"", "\"#undef\"",
513 "ASM_DIRECTIVE", "ASM_MACRO", "ASM_EQU", "'('", "')'", "'\\n'", "','",
514 "$accept", "input", "line", 0
515 };
516 #endif
517
518 # ifdef YYPRINT
519 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
520 token YYLEX-NUM. */
521 static const yytype_uint16 yytoknum[] =
522 {
523 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
524 265, 266, 267, 268, 40, 41, 10, 44
525 };
526 # endif
527
528 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
529 static const yytype_uint8 yyr1[] =
530 {
531 0, 18, 19, 19, 20, 20, 20, 20, 20, 20,
532 20, 20, 20, 20
533 };
534
535 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
536 static const yytype_uint8 yyr2[] =
537 {
538 0, 2, 0, 2, 6, 4, 7, 4, 4, 4,
539 4, 5, 4, 2
540 };
541
542 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
543 Performed when YYTABLE doesn't specify something else to do. Zero
544 means the default is an error. */
545 static const yytype_uint8 yydefact[] =
546 {
547 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
548 0, 3, 13, 0, 0, 0, 0, 0, 0, 0,
549 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
550 0, 0, 5, 0, 10, 12, 7, 8, 9, 0,
551 0, 0, 11, 0, 4, 6
552 };
553
554 /* YYDEFGOTO[NTERM-NUM]. */
555 static const yytype_int8 yydefgoto[] =
556 {
557 -1, 1, 11
558 };
559
560 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
561 STATE-NUM. */
562 #define YYPACT_NINF -7
563 static const yytype_int8 yypact[] =
564 {
565 -7, 0, -7, -5, -4, 1, -6, 7, 9, 10,
566 11, -7, -7, 5, 19, 14, 21, 22, 23, 24,
567 25, 12, 20, 15, 13, 16, 17, 18, 26, 27,
568 29, 30, -7, 34, -7, -7, -7, -7, -7, 28,
569 35, 31, -7, 32, -7, -7
570 };
571
572 /* YYPGOTO[NTERM-NUM]. */
573 static const yytype_int8 yypgoto[] =
574 {
575 -7, -7, -7
576 };
577
578 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
579 positive, shift that token. If negative, reduce the rule which
580 number is the opposite. If YYTABLE_NINF, syntax error. */
581 #define YYTABLE_NINF -1
582 static const yytype_uint8 yytable[] =
583 {
584 2, 3, 13, 14, 4, 5, 16, 17, 6, 7,
585 8, 12, 9, 10, 18, 15, 19, 20, 21, 22,
586 23, 24, 25, 26, 27, 28, 29, 31, 33, 30,
587 39, 32, 34, 35, 36, 41, 43, 0, 0, 0,
588 0, 0, 37, 38, 42, 40, 0, 44, 45
589 };
590
591 #define yypact_value_is_default(yystate) \
592 ((yystate) == (-7))
593
594 #define yytable_value_is_error(yytable_value) \
595 YYID (0)
596
597 static const yytype_int8 yycheck[] =
598 {
599 0, 1, 6, 7, 4, 5, 12, 13, 8, 9,
600 10, 16, 12, 13, 7, 14, 7, 7, 7, 14,
601 1, 7, 1, 1, 1, 1, 1, 7, 15, 17,
602 1, 16, 16, 16, 16, 1, 1, -1, -1, -1,
603 -1, -1, 16, 16, 16, 15, -1, 16, 16
604 };
605
606 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
607 symbol of state STATE-NUM. */
608 static const yytype_uint8 yystos[] =
609 {
610 0, 19, 0, 1, 4, 5, 8, 9, 10, 12,
611 13, 20, 16, 6, 7, 14, 12, 13, 7, 7,
612 7, 7, 14, 1, 7, 1, 1, 1, 1, 1,
613 17, 7, 16, 15, 16, 16, 16, 16, 16, 1,
614 15, 1, 16, 1, 16, 16
615 };
616
617 #define yyerrok (yyerrstatus = 0)
618 #define yyclearin (yychar = YYEMPTY)
619 #define YYEMPTY (-2)
620 #define YYEOF 0
621
622 #define YYACCEPT goto yyacceptlab
623 #define YYABORT goto yyabortlab
624 #define YYERROR goto yyerrorlab
625
626
627 /* Like YYERROR except do call yyerror. This remains here temporarily
628 to ease the transition to the new meaning of YYERROR, for GCC.
629 Once GCC version 2 has supplanted version 1, this can go. However,
630 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
631 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
632 discussed. */
633
634 #define YYFAIL goto yyerrlab
635 #if defined YYFAIL
636 /* This is here to suppress warnings from the GCC cpp's
637 -Wunused-macros. Normally we don't worry about that warning, but
638 some users do, and we want to make it easy for users to remove
639 YYFAIL uses, which will produce warnings from Bison 2.5. */
640 #endif
641
642 #define YYRECOVERING() (!!yyerrstatus)
643
644 #define YYBACKUP(Token, Value) \
645 do \
646 if (yychar == YYEMPTY && yylen == 1) \
647 { \
648 yychar = (Token); \
649 yylval = (Value); \
650 YYPOPSTACK (1); \
651 goto yybackup; \
652 } \
653 else \
654 { \
655 yyerror (param, YY_("syntax error: cannot back up")); \
656 YYERROR; \
657 } \
658 while (YYID (0))
659
660
661 #define YYTERROR 1
662 #define YYERRCODE 256
663
664
665 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
666 If N is 0, then set CURRENT to the empty location which ends
667 the previous symbol: RHS[0] (always defined). */
668
669 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
670 #ifndef YYLLOC_DEFAULT
671 # define YYLLOC_DEFAULT(Current, Rhs, N) \
672 do \
673 if (YYID (N)) \
674 { \
675 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
676 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
677 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
678 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
679 } \
680 else \
681 { \
682 (Current).first_line = (Current).last_line = \
683 YYRHSLOC (Rhs, 0).last_line; \
684 (Current).first_column = (Current).last_column = \
685 YYRHSLOC (Rhs, 0).last_column; \
686 } \
687 while (YYID (0))
688 #endif
689
690
691 /* YY_LOCATION_PRINT -- Print the location on the stream.
692 This macro was not mandated originally: define only if we know
693 we won't break user code: when these are the locations we know. */
694
695 #ifndef YY_LOCATION_PRINT
696 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
697 # define YY_LOCATION_PRINT(File, Loc) \
698 fprintf (File, "%d.%d-%d.%d", \
699 (Loc).first_line, (Loc).first_column, \
700 (Loc).last_line, (Loc).last_column)
701 # else
702 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
703 # endif
704 #endif
705
706
707 /* YYLEX -- calling `yylex' with the right arguments. */
708
709 #ifdef YYLEX_PARAM
710 # define YYLEX yylex (YYLEX_PARAM)
711 #else
712 # define YYLEX yylex (param)
713 #endif
714
715 /* Enable debugging if requested. */
716 #if YYDEBUG
717
718 # ifndef YYFPRINTF
719 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
720 # define YYFPRINTF fprintf
721 # endif
722
723 # define YYDPRINTF(Args) \
724 do { \
725 if (yydebug) \
726 YYFPRINTF Args; \
727 } while (YYID (0))
728
729 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
730 do { \
731 if (yydebug) \
732 { \
733 YYFPRINTF (stderr, "%s ", Title); \
734 yy_symbol_print (stderr, \
735 Type, Value, Location, param); \
736 YYFPRINTF (stderr, "\n"); \
737 } \
738 } while (YYID (0))
739
740
741 /*--------------------------------.
742 | Print this symbol on YYOUTPUT. |
743 `--------------------------------*/
744
745 /*ARGSUSED*/
746 #if (defined __STDC__ || defined __C99__FUNC__ \
747 || defined __cplusplus || defined _MSC_VER)
748 static void
749 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const struct parser_param *param)
750 #else
751 static void
752 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, param)
753 FILE *yyoutput;
754 int yytype;
755 YYSTYPE const * const yyvaluep;
756 YYLTYPE const * const yylocationp;
757 const struct parser_param *param;
758 #endif
759 {
760 if (!yyvaluep)
761 return;
762 YYUSE (yylocationp);
763 YYUSE (param);
764 # ifdef YYPRINT
765 if (yytype < YYNTOKENS)
766 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
767 # else
768 YYUSE (yyoutput);
769 # endif
770 switch (yytype)
771 {
772 default:
773 break;
774 }
775 }
776
777
778 /*--------------------------------.
779 | Print this symbol on YYOUTPUT. |
780 `--------------------------------*/
781
782 #if (defined __STDC__ || defined __C99__FUNC__ \
783 || defined __cplusplus || defined _MSC_VER)
784 static void
785 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const struct parser_param *param)
786 #else
787 static void
788 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, param)
789 FILE *yyoutput;
790 int yytype;
791 YYSTYPE const * const yyvaluep;
792 YYLTYPE const * const yylocationp;
793 const struct parser_param *param;
794 #endif
795 {
796 if (yytype < YYNTOKENS)
797 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
798 else
799 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
800
801 YY_LOCATION_PRINT (yyoutput, *yylocationp);
802 YYFPRINTF (yyoutput, ": ");
803 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, param);
804 YYFPRINTF (yyoutput, ")");
805 }
806
807 /*------------------------------------------------------------------.
808 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
809 | TOP (included). |
810 `------------------------------------------------------------------*/
811
812 #if (defined __STDC__ || defined __C99__FUNC__ \
813 || defined __cplusplus || defined _MSC_VER)
814 static void
815 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
816 #else
817 static void
818 yy_stack_print (yybottom, yytop)
819 yytype_int16 *yybottom;
820 yytype_int16 *yytop;
821 #endif
822 {
823 YYFPRINTF (stderr, "Stack now");
824 for (; yybottom <= yytop; yybottom++)
825 {
826 int yybot = *yybottom;
827 YYFPRINTF (stderr, " %d", yybot);
828 }
829 YYFPRINTF (stderr, "\n");
830 }
831
832 # define YY_STACK_PRINT(Bottom, Top) \
833 do { \
834 if (yydebug) \
835 yy_stack_print ((Bottom), (Top)); \
836 } while (YYID (0))
837
838
839 /*------------------------------------------------.
840 | Report that the YYRULE is going to be reduced. |
841 `------------------------------------------------*/
842
843 #if (defined __STDC__ || defined __C99__FUNC__ \
844 || defined __cplusplus || defined _MSC_VER)
845 static void
846 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, const struct parser_param *param)
847 #else
848 static void
849 yy_reduce_print (yyvsp, yylsp, yyrule, param)
850 YYSTYPE *yyvsp;
851 YYLTYPE *yylsp;
852 int yyrule;
853 const struct parser_param *param;
854 #endif
855 {
856 int yynrhs = yyr2[yyrule];
857 int yyi;
858 unsigned long int yylno = yyrline[yyrule];
859 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
860 yyrule - 1, yylno);
861 /* The symbols being reduced. */
862 for (yyi = 0; yyi < yynrhs; yyi++)
863 {
864 YYFPRINTF (stderr, " $%d = ", yyi + 1);
865 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
866 &(yyvsp[(yyi + 1) - (yynrhs)])
867 , &(yylsp[(yyi + 1) - (yynrhs)]) , param);
868 YYFPRINTF (stderr, "\n");
869 }
870 }
871
872 # define YY_REDUCE_PRINT(Rule) \
873 do { \
874 if (yydebug) \
875 yy_reduce_print (yyvsp, yylsp, Rule, param); \
876 } while (YYID (0))
877
878 /* Nonzero means print parse trace. It is left uninitialized so that
879 multiple parsers can coexist. */
880 int yydebug;
881 #else /* !YYDEBUG */
882 # define YYDPRINTF(Args)
883 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
884 # define YY_STACK_PRINT(Bottom, Top)
885 # define YY_REDUCE_PRINT(Rule)
886 #endif /* !YYDEBUG */
887
888
889 /* YYINITDEPTH -- initial size of the parser's stacks. */
890 #ifndef YYINITDEPTH
891 # define YYINITDEPTH 200
892 #endif
893
894 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
895 if the built-in stack extension method is used).
896
897 Do not make this value too large; the results are undefined if
898 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
899 evaluated with infinite-precision integer arithmetic. */
900
901 #ifndef YYMAXDEPTH
902 # define YYMAXDEPTH 10000
903 #endif
904
905
906 #if YYERROR_VERBOSE
907
908 # ifndef yystrlen
909 # if defined __GLIBC__ && defined _STRING_H
910 # define yystrlen strlen
911 # else
912 /* Return the length of YYSTR. */
913 #if (defined __STDC__ || defined __C99__FUNC__ \
914 || defined __cplusplus || defined _MSC_VER)
915 static YYSIZE_T
916 yystrlen (const char *yystr)
917 #else
918 static YYSIZE_T
919 yystrlen (yystr)
920 const char *yystr;
921 #endif
922 {
923 YYSIZE_T yylen;
924 for (yylen = 0; yystr[yylen]; yylen++)
925 continue;
926 return yylen;
927 }
928 # endif
929 # endif
930
931 # ifndef yystpcpy
932 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
933 # define yystpcpy stpcpy
934 # else
935 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
936 YYDEST. */
937 #if (defined __STDC__ || defined __C99__FUNC__ \
938 || defined __cplusplus || defined _MSC_VER)
939 static char *
940 yystpcpy (char *yydest, const char *yysrc)
941 #else
942 static char *
943 yystpcpy (yydest, yysrc)
944 char *yydest;
945 const char *yysrc;
946 #endif
947 {
948 char *yyd = yydest;
949 const char *yys = yysrc;
950
951 while ((*yyd++ = *yys++) != '\0')
952 continue;
953
954 return yyd - 1;
955 }
956 # endif
957 # endif
958
959 # ifndef yytnamerr
960 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
961 quotes and backslashes, so that it's suitable for yyerror. The
962 heuristic is that double-quoting is unnecessary unless the string
963 contains an apostrophe, a comma, or backslash (other than
964 backslash-backslash). YYSTR is taken from yytname. If YYRES is
965 null, do not copy; instead, return the length of what the result
966 would have been. */
967 static YYSIZE_T
968 yytnamerr (char *yyres, const char *yystr)
969 {
970 if (*yystr == '"')
971 {
972 YYSIZE_T yyn = 0;
973 char const *yyp = yystr;
974
975 for (;;)
976 switch (*++yyp)
977 {
978 case '\'':
979 case ',':
980 goto do_not_strip_quotes;
981
982 case '\\':
983 if (*++yyp != '\\')
984 goto do_not_strip_quotes;
985 /* Fall through. */
986 default:
987 if (yyres)
988 yyres[yyn] = *yyp;
989 yyn++;
990 break;
991
992 case '"':
993 if (yyres)
994 yyres[yyn] = '\0';
995 return yyn;
996 }
997 do_not_strip_quotes: ;
998 }
999
1000 if (! yyres)
1001 return yystrlen (yystr);
1002
1003 return yystpcpy (yyres, yystr) - yyres;
1004 }
1005 # endif
1006
1007 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1008 about the unexpected token YYTOKEN for the state stack whose top is
1009 YYSSP.
1010
1011 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1012 not large enough to hold the message. In that case, also set
1013 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1014 required number of bytes is too large to store. */
1015 static int
1016 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1017 yytype_int16 *yyssp, int yytoken)
1018 {
1019 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1020 YYSIZE_T yysize = yysize0;
1021 YYSIZE_T yysize1;
1022 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1023 /* Internationalized format string. */
1024 const char *yyformat = 0;
1025 /* Arguments of yyformat. */
1026 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1027 /* Number of reported tokens (one for the "unexpected", one per
1028 "expected"). */
1029 int yycount = 0;
1030
1031 /* There are many possibilities here to consider:
1032 - Assume YYFAIL is not used. It's too flawed to consider. See
1033 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1034 for details. YYERROR is fine as it does not invoke this
1035 function.
1036 - If this state is a consistent state with a default action, then
1037 the only way this function was invoked is if the default action
1038 is an error action. In that case, don't check for expected
1039 tokens because there are none.
1040 - The only way there can be no lookahead present (in yychar) is if
1041 this state is a consistent state with a default action. Thus,
1042 detecting the absence of a lookahead is sufficient to determine
1043 that there is no unexpected or expected token to report. In that
1044 case, just report a simple "syntax error".
1045 - Don't assume there isn't a lookahead just because this state is a
1046 consistent state with a default action. There might have been a
1047 previous inconsistent state, consistent state with a non-default
1048 action, or user semantic action that manipulated yychar.
1049 - Of course, the expected token list depends on states to have
1050 correct lookahead information, and it depends on the parser not
1051 to perform extra reductions after fetching a lookahead from the
1052 scanner and before detecting a syntax error. Thus, state merging
1053 (from LALR or IELR) and default reductions corrupt the expected
1054 token list. However, the list is correct for canonical LR with
1055 one exception: it will still contain any token that will not be
1056 accepted due to an error action in a later state.
1057 */
1058 if (yytoken != YYEMPTY)
1059 {
1060 int yyn = yypact[*yyssp];
1061 yyarg[yycount++] = yytname[yytoken];
1062 if (!yypact_value_is_default (yyn))
1063 {
1064 /* Start YYX at -YYN if negative to avoid negative indexes in
1065 YYCHECK. In other words, skip the first -YYN actions for
1066 this state because they are default actions. */
1067 int yyxbegin = yyn < 0 ? -yyn : 0;
1068 /* Stay within bounds of both yycheck and yytname. */
1069 int yychecklim = YYLAST - yyn + 1;
1070 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1071 int yyx;
1072
1073 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1074 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1075 && !yytable_value_is_error (yytable[yyx + yyn]))
1076 {
1077 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1078 {
1079 yycount = 1;
1080 yysize = yysize0;
1081 break;
1082 }
1083 yyarg[yycount++] = yytname[yyx];
1084 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1085 if (! (yysize <= yysize1
1086 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1087 return 2;
1088 yysize = yysize1;
1089 }
1090 }
1091 }
1092
1093 switch (yycount)
1094 {
1095 # define YYCASE_(N, S) \
1096 case N: \
1097 yyformat = S; \
1098 break
1099 YYCASE_(0, YY_("syntax error"));
1100 YYCASE_(1, YY_("syntax error, unexpected %s"));
1101 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1102 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1103 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1104 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1105 # undef YYCASE_
1106 }
1107
1108 yysize1 = yysize + yystrlen (yyformat);
1109 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1110 return 2;
1111 yysize = yysize1;
1112
1113 if (*yymsg_alloc < yysize)
1114 {
1115 *yymsg_alloc = 2 * yysize;
1116 if (! (yysize <= *yymsg_alloc
1117 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1118 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1119 return 1;
1120 }
1121
1122 /* Avoid sprintf, as that infringes on the user's name space.
1123 Don't have undefined behavior even if the translation
1124 produced a string with the wrong number of "%s"s. */
1125 {
1126 char *yyp = *yymsg;
1127 int yyi = 0;
1128 while ((*yyp = *yyformat) != '\0')
1129 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1130 {
1131 yyp += yytnamerr (yyp, yyarg[yyi++]);
1132 yyformat += 2;
1133 }
1134 else
1135 {
1136 yyp++;
1137 yyformat++;
1138 }
1139 }
1140 return 0;
1141 }
1142 #endif /* YYERROR_VERBOSE */
1143
1144 /*-----------------------------------------------.
1145 | Release the memory associated to this symbol. |
1146 `-----------------------------------------------*/
1147
1148 /*ARGSUSED*/
1149 #if (defined __STDC__ || defined __C99__FUNC__ \
1150 || defined __cplusplus || defined _MSC_VER)
1151 static void
1152 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, const struct parser_param *param)
1153 #else
1154 static void
1155 yydestruct (yymsg, yytype, yyvaluep, yylocationp, param)
1156 const char *yymsg;
1157 int yytype;
1158 YYSTYPE *yyvaluep;
1159 YYLTYPE *yylocationp;
1160 const struct parser_param *param;
1161 #endif
1162 {
1163 YYUSE (yyvaluep);
1164 YYUSE (yylocationp);
1165 YYUSE (param);
1166
1167 if (!yymsg)
1168 yymsg = "Deleting";
1169 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1170
1171 switch (yytype)
1172 {
1173
1174 default:
1175 break;
1176 }
1177 }
1178
1179
1180 /* Prevent warnings from -Wmissing-prototypes. */
1181 #ifdef YYPARSE_PARAM
1182 #if defined __STDC__ || defined __cplusplus
1183 int yyparse (void *YYPARSE_PARAM);
1184 #else
1185 int yyparse ();
1186 #endif
1187 #else /* ! YYPARSE_PARAM */
1188 #if defined __STDC__ || defined __cplusplus
1189 int yyparse (const struct parser_param *param);
1190 #else
1191 int yyparse ();
1192 #endif
1193 #endif /* ! YYPARSE_PARAM */
1194
1195
1196 /* The lookahead symbol. */
1197 int yychar;
1198
1199 /* The semantic value of the lookahead symbol. */
1200 YYSTYPE yylval;
1201
1202 /* Location data for the lookahead symbol. */
1203 YYLTYPE yylloc;
1204
1205 /* Number of syntax errors so far. */
1206 int yynerrs;
1207
1208
1209 /*----------.
1210 | yyparse. |
1211 `----------*/
1212
1213 #ifdef YYPARSE_PARAM
1214 #if (defined __STDC__ || defined __C99__FUNC__ \
1215 || defined __cplusplus || defined _MSC_VER)
1216 int
1217 yyparse (void *YYPARSE_PARAM)
1218 #else
1219 int
1220 yyparse (YYPARSE_PARAM)
1221 void *YYPARSE_PARAM;
1222 #endif
1223 #else /* ! YYPARSE_PARAM */
1224 #if (defined __STDC__ || defined __C99__FUNC__ \
1225 || defined __cplusplus || defined _MSC_VER)
1226 int
1227 yyparse (const struct parser_param *param)
1228 #else
1229 int
1230 yyparse (param)
1231 const struct parser_param *param;
1232 #endif
1233 #endif
1234 {
1235 int yystate;
1236 /* Number of tokens to shift before error messages enabled. */
1237 int yyerrstatus;
1238
1239 /* The stacks and their tools:
1240 `yyss': related to states.
1241 `yyvs': related to semantic values.
1242 `yyls': related to locations.
1243
1244 Refer to the stacks thru separate pointers, to allow yyoverflow
1245 to reallocate them elsewhere. */
1246
1247 /* The state stack. */
1248 yytype_int16 yyssa[YYINITDEPTH];
1249 yytype_int16 *yyss;
1250 yytype_int16 *yyssp;
1251
1252 /* The semantic value stack. */
1253 YYSTYPE yyvsa[YYINITDEPTH];
1254 YYSTYPE *yyvs;
1255 YYSTYPE *yyvsp;
1256
1257 /* The location stack. */
1258 YYLTYPE yylsa[YYINITDEPTH];
1259 YYLTYPE *yyls;
1260 YYLTYPE *yylsp;
1261
1262 /* The locations where the error started and ended. */
1263 YYLTYPE yyerror_range[3];
1264
1265 YYSIZE_T yystacksize;
1266
1267 int yyn;
1268 int yyresult;
1269 /* Lookahead token as an internal (translated) token number. */
1270 int yytoken;
1271 /* The variables used to return semantic value and location from the
1272 action routines. */
1273 YYSTYPE yyval;
1274 YYLTYPE yyloc;
1275
1276 #if YYERROR_VERBOSE
1277 /* Buffer for error messages, and its allocated size. */
1278 char yymsgbuf[128];
1279 char *yymsg = yymsgbuf;
1280 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1281 #endif
1282
1283 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1284
1285 /* The number of symbols on the RHS of the reduced rule.
1286 Keep to zero when no symbol should be popped. */
1287 int yylen = 0;
1288
1289 yytoken = 0;
1290 yyss = yyssa;
1291 yyvs = yyvsa;
1292 yyls = yylsa;
1293 yystacksize = YYINITDEPTH;
1294
1295 YYDPRINTF ((stderr, "Starting parse\n"));
1296
1297 yystate = 0;
1298 yyerrstatus = 0;
1299 yynerrs = 0;
1300 yychar = YYEMPTY; /* Cause a token to be read. */
1301
1302 /* Initialize stack pointers.
1303 Waste one element of value and location stack
1304 so that they stay on the same level as the state stack.
1305 The wasted elements are never initialized. */
1306 yyssp = yyss;
1307 yyvsp = yyvs;
1308 yylsp = yyls;
1309
1310 #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1311 /* Initialize the default location before parsing starts. */
1312 yylloc.first_line = yylloc.last_line = 1;
1313 yylloc.first_column = yylloc.last_column = 1;
1314 #endif
1315
1316 goto yysetstate;
1317
1318 /*------------------------------------------------------------.
1319 | yynewstate -- Push a new state, which is found in yystate. |
1320 `------------------------------------------------------------*/
1321 yynewstate:
1322 /* In all cases, when you get here, the value and location stacks
1323 have just been pushed. So pushing a state here evens the stacks. */
1324 yyssp++;
1325
1326 yysetstate:
1327 *yyssp = yystate;
1328
1329 if (yyss + yystacksize - 1 <= yyssp)
1330 {
1331 /* Get the current used size of the three stacks, in elements. */
1332 YYSIZE_T yysize = yyssp - yyss + 1;
1333
1334 #ifdef yyoverflow
1335 {
1336 /* Give user a chance to reallocate the stack. Use copies of
1337 these so that the &'s don't force the real ones into
1338 memory. */
1339 YYSTYPE *yyvs1 = yyvs;
1340 yytype_int16 *yyss1 = yyss;
1341 YYLTYPE *yyls1 = yyls;
1342
1343 /* Each stack pointer address is followed by the size of the
1344 data in use in that stack, in bytes. This used to be a
1345 conditional around just the two extra args, but that might
1346 be undefined if yyoverflow is a macro. */
1347 yyoverflow (YY_("memory exhausted"),
1348 &yyss1, yysize * sizeof (*yyssp),
1349 &yyvs1, yysize * sizeof (*yyvsp),
1350 &yyls1, yysize * sizeof (*yylsp),
1351 &yystacksize);
1352
1353 yyls = yyls1;
1354 yyss = yyss1;
1355 yyvs = yyvs1;
1356 }
1357 #else /* no yyoverflow */
1358 # ifndef YYSTACK_RELOCATE
1359 goto yyexhaustedlab;
1360 # else
1361 /* Extend the stack our own way. */
1362 if (YYMAXDEPTH <= yystacksize)
1363 goto yyexhaustedlab;
1364 yystacksize *= 2;
1365 if (YYMAXDEPTH < yystacksize)
1366 yystacksize = YYMAXDEPTH;
1367
1368 {
1369 yytype_int16 *yyss1 = yyss;
1370 union yyalloc *yyptr =
1371 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1372 if (! yyptr)
1373 goto yyexhaustedlab;
1374 YYSTACK_RELOCATE (yyss_alloc, yyss);
1375 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1376 YYSTACK_RELOCATE (yyls_alloc, yyls);
1377 # undef YYSTACK_RELOCATE
1378 if (yyss1 != yyssa)
1379 YYSTACK_FREE (yyss1);
1380 }
1381 # endif
1382 #endif /* no yyoverflow */
1383
1384 yyssp = yyss + yysize - 1;
1385 yyvsp = yyvs + yysize - 1;
1386 yylsp = yyls + yysize - 1;
1387
1388 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1389 (unsigned long int) yystacksize));
1390
1391 if (yyss + yystacksize - 1 <= yyssp)
1392 YYABORT;
1393 }
1394
1395 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1396
1397 if (yystate == YYFINAL)
1398 YYACCEPT;
1399
1400 goto yybackup;
1401
1402 /*-----------.
1403 | yybackup. |
1404 `-----------*/
1405 yybackup:
1406
1407 /* Do appropriate processing given the current state. Read a
1408 lookahead token if we need one and don't already have one. */
1409
1410 /* First try to decide what to do without reference to lookahead token. */
1411 yyn = yypact[yystate];
1412 if (yypact_value_is_default (yyn))
1413 goto yydefault;
1414
1415 /* Not known => get a lookahead token if don't already have one. */
1416
1417 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1418 if (yychar == YYEMPTY)
1419 {
1420 YYDPRINTF ((stderr, "Reading a token: "));
1421 yychar = YYLEX;
1422 }
1423
1424 if (yychar <= YYEOF)
1425 {
1426 yychar = yytoken = YYEOF;
1427 YYDPRINTF ((stderr, "Now at end of input.\n"));
1428 }
1429 else
1430 {
1431 yytoken = YYTRANSLATE (yychar);
1432 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1433 }
1434
1435 /* If the proper action on seeing token YYTOKEN is to reduce or to
1436 detect an error, take that action. */
1437 yyn += yytoken;
1438 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1439 goto yydefault;
1440 yyn = yytable[yyn];
1441 if (yyn <= 0)
1442 {
1443 if (yytable_value_is_error (yyn))
1444 goto yyerrlab;
1445 yyn = -yyn;
1446 goto yyreduce;
1447 }
1448
1449 /* Count tokens shifted since error; after three, turn off error
1450 status. */
1451 if (yyerrstatus)
1452 yyerrstatus--;
1453
1454 /* Shift the lookahead token. */
1455 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1456
1457 /* Discard the shifted token. */
1458 yychar = YYEMPTY;
1459
1460 yystate = yyn;
1461 *++yyvsp = yylval;
1462 *++yylsp = yylloc;
1463 goto yynewstate;
1464
1465
1466 /*-----------------------------------------------------------.
1467 | yydefault -- do the default action for the current state. |
1468 `-----------------------------------------------------------*/
1469 yydefault:
1470 yyn = yydefact[yystate];
1471 if (yyn == 0)
1472 goto yyerrlab;
1473 goto yyreduce;
1474
1475
1476 /*-----------------------------.
1477 | yyreduce -- Do a reduction. |
1478 `-----------------------------*/
1479 yyreduce:
1480 /* yyn is the number of a rule to reduce with. */
1481 yylen = yyr2[yyn];
1482
1483 /* If YYLEN is nonzero, implement the default value of the action:
1484 `$$ = $1'.
1485
1486 Otherwise, the following line sets YYVAL to garbage.
1487 This behavior is undocumented and Bison
1488 users should not rely upon it. Assigning to YYVAL
1489 unconditionally makes the parser a bit smaller, and it avoids a
1490 GCC warning that YYVAL may be used uninitialized. */
1491 yyval = yyvsp[1-yylen];
1492
1493 /* Default location. */
1494 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1495 YY_REDUCE_PRINT (yyn);
1496 switch (yyn)
1497 {
1498 case 4:
1499
1500 /* Line 1806 of yacc.c */
1501 #line 88 "asm_parse.y"
1502 {
1503 PUT(PARSER_REF_SYM, GET_SYM((yyvsp[(1) - (6)])), (yylsp[(1) - (6)]));
1504 PUT(PARSER_DEF, GET_SYM((yyvsp[(3) - (6)])), (yylsp[(3) - (6)]));
1505 strbuf_reset(asm_symtable);
1506 }
1507 break;
1508
1509 case 5:
1510
1511 /* Line 1806 of yacc.c */
1512 #line 94 "asm_parse.y"
1513 {
1514 const char *sym = GET_SYM((yyvsp[(2) - (4)]));
1515
1516 if (sym[0] == '_') {
1517 int c = (unsigned char)sym[1];
1518
1519 if (isalpha(c) || c == '_' || c >= 0x80)
1520 PUT(PARSER_REF_SYM, &sym[1], (yylsp[(2) - (4)]));
1521 }
1522 strbuf_reset(asm_symtable);
1523 }
1524 break;
1525
1526 case 6:
1527
1528 /* Line 1806 of yacc.c */
1529 #line 106 "asm_parse.y"
1530 {
1531 PUT(PARSER_REF_SYM, GET_SYM((yyvsp[(2) - (7)])), (yylsp[(2) - (7)]));
1532 PUT(PARSER_REF_SYM, GET_SYM((yyvsp[(4) - (7)])), (yylsp[(4) - (7)]));
1533 strbuf_reset(asm_symtable);
1534 }
1535 break;
1536
1537 case 7:
1538
1539 /* Line 1806 of yacc.c */
1540 #line 112 "asm_parse.y"
1541 {
1542 PUT(PARSER_DEF, GET_SYM((yyvsp[(2) - (4)])), (yylsp[(2) - (4)]));
1543 strbuf_reset(asm_symtable);
1544 }
1545 break;
1546
1547 case 8:
1548
1549 /* Line 1806 of yacc.c */
1550 #line 117 "asm_parse.y"
1551 {
1552 PUT(PARSER_DEF, GET_SYM((yyvsp[(2) - (4)])), (yylsp[(2) - (4)]));
1553 strbuf_reset(asm_symtable);
1554 }
1555 break;
1556
1557 case 9:
1558
1559 /* Line 1806 of yacc.c */
1560 #line 122 "asm_parse.y"
1561 {
1562 PUT(PARSER_DEF, GET_SYM((yyvsp[(2) - (4)])), (yylsp[(2) - (4)]));
1563 strbuf_reset(asm_symtable);
1564 }
1565 break;
1566
1567 case 10:
1568
1569 /* Line 1806 of yacc.c */
1570 #line 127 "asm_parse.y"
1571 {
1572 PUT(PARSER_DEF, GET_SYM((yyvsp[(1) - (4)])), (yylsp[(1) - (4)]));
1573 strbuf_reset(asm_symtable);
1574 }
1575 break;
1576
1577 case 11:
1578
1579 /* Line 1806 of yacc.c */
1580 #line 132 "asm_parse.y"
1581 {
1582 PUT(PARSER_DEF, GET_SYM((yyvsp[(2) - (5)])), (yylsp[(2) - (5)]));
1583 strbuf_reset(asm_symtable);
1584 }
1585 break;
1586
1587 case 12:
1588
1589 /* Line 1806 of yacc.c */
1590 #line 137 "asm_parse.y"
1591 {
1592 PUT(PARSER_DEF, GET_SYM((yyvsp[(1) - (4)])), (yylsp[(1) - (4)]));
1593 strbuf_reset(asm_symtable);
1594 }
1595 break;
1596
1597 case 13:
1598
1599 /* Line 1806 of yacc.c */
1600 #line 142 "asm_parse.y"
1601 { strbuf_reset(asm_symtable); }
1602 break;
1603
1604
1605
1606 /* Line 1806 of yacc.c */
1607 #line 1608 "asm_parse.c"
1608 default: break;
1609 }
1610 /* User semantic actions sometimes alter yychar, and that requires
1611 that yytoken be updated with the new translation. We take the
1612 approach of translating immediately before every use of yytoken.
1613 One alternative is translating here after every semantic action,
1614 but that translation would be missed if the semantic action invokes
1615 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1616 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1617 incorrect destructor might then be invoked immediately. In the
1618 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1619 to an incorrect destructor call or verbose syntax error message
1620 before the lookahead is translated. */
1621 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1622
1623 YYPOPSTACK (yylen);
1624 yylen = 0;
1625 YY_STACK_PRINT (yyss, yyssp);
1626
1627 *++yyvsp = yyval;
1628 *++yylsp = yyloc;
1629
1630 /* Now `shift' the result of the reduction. Determine what state
1631 that goes to, based on the state we popped back to and the rule
1632 number reduced by. */
1633
1634 yyn = yyr1[yyn];
1635
1636 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1637 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1638 yystate = yytable[yystate];
1639 else
1640 yystate = yydefgoto[yyn - YYNTOKENS];
1641
1642 goto yynewstate;
1643
1644
1645 /*------------------------------------.
1646 | yyerrlab -- here on detecting error |
1647 `------------------------------------*/
1648 yyerrlab:
1649 /* Make sure we have latest lookahead translation. See comments at
1650 user semantic actions for why this is necessary. */
1651 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1652
1653 /* If not already recovering from an error, report this error. */
1654 if (!yyerrstatus)
1655 {
1656 ++yynerrs;
1657 #if ! YYERROR_VERBOSE
1658 yyerror (param, YY_("syntax error"));
1659 #else
1660 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1661 yyssp, yytoken)
1662 {
1663 char const *yymsgp = YY_("syntax error");
1664 int yysyntax_error_status;
1665 yysyntax_error_status = YYSYNTAX_ERROR;
1666 if (yysyntax_error_status == 0)
1667 yymsgp = yymsg;
1668 else if (yysyntax_error_status == 1)
1669 {
1670 if (yymsg != yymsgbuf)
1671 YYSTACK_FREE (yymsg);
1672 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1673 if (!yymsg)
1674 {
1675 yymsg = yymsgbuf;
1676 yymsg_alloc = sizeof yymsgbuf;
1677 yysyntax_error_status = 2;
1678 }
1679 else
1680 {
1681 yysyntax_error_status = YYSYNTAX_ERROR;
1682 yymsgp = yymsg;
1683 }
1684 }
1685 yyerror (param, yymsgp);
1686 if (yysyntax_error_status == 2)
1687 goto yyexhaustedlab;
1688 }
1689 # undef YYSYNTAX_ERROR
1690 #endif
1691 }
1692
1693 yyerror_range[1] = yylloc;
1694
1695 if (yyerrstatus == 3)
1696 {
1697 /* If just tried and failed to reuse lookahead token after an
1698 error, discard it. */
1699
1700 if (yychar <= YYEOF)
1701 {
1702 /* Return failure if at end of input. */
1703 if (yychar == YYEOF)
1704 YYABORT;
1705 }
1706 else
1707 {
1708 yydestruct ("Error: discarding",
1709 yytoken, &yylval, &yylloc, param);
1710 yychar = YYEMPTY;
1711 }
1712 }
1713
1714 /* Else will try to reuse lookahead token after shifting the error
1715 token. */
1716 goto yyerrlab1;
1717
1718
1719 /*---------------------------------------------------.
1720 | yyerrorlab -- error raised explicitly by YYERROR. |
1721 `---------------------------------------------------*/
1722 yyerrorlab:
1723
1724 /* Pacify compilers like GCC when the user code never invokes
1725 YYERROR and the label yyerrorlab therefore never appears in user
1726 code. */
1727 if (/*CONSTCOND*/ 0)
1728 goto yyerrorlab;
1729
1730 yyerror_range[1] = yylsp[1-yylen];
1731 /* Do not reclaim the symbols of the rule which action triggered
1732 this YYERROR. */
1733 YYPOPSTACK (yylen);
1734 yylen = 0;
1735 YY_STACK_PRINT (yyss, yyssp);
1736 yystate = *yyssp;
1737 goto yyerrlab1;
1738
1739
1740 /*-------------------------------------------------------------.
1741 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1742 `-------------------------------------------------------------*/
1743 yyerrlab1:
1744 yyerrstatus = 3; /* Each real token shifted decrements this. */
1745
1746 for (;;)
1747 {
1748 yyn = yypact[yystate];
1749 if (!yypact_value_is_default (yyn))
1750 {
1751 yyn += YYTERROR;
1752 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1753 {
1754 yyn = yytable[yyn];
1755 if (0 < yyn)
1756 break;
1757 }
1758 }
1759
1760 /* Pop the current state because it cannot handle the error token. */
1761 if (yyssp == yyss)
1762 YYABORT;
1763
1764 yyerror_range[1] = *yylsp;
1765 yydestruct ("Error: popping",
1766 yystos[yystate], yyvsp, yylsp, param);
1767 YYPOPSTACK (1);
1768 yystate = *yyssp;
1769 YY_STACK_PRINT (yyss, yyssp);
1770 }
1771
1772 *++yyvsp = yylval;
1773
1774 yyerror_range[2] = yylloc;
1775 /* Using YYLLOC is tempting, but would change the location of
1776 the lookahead. YYLOC is available though. */
1777 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
1778 *++yylsp = yyloc;
1779
1780 /* Shift the error token. */
1781 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1782
1783 yystate = yyn;
1784 goto yynewstate;
1785
1786
1787 /*-------------------------------------.
1788 | yyacceptlab -- YYACCEPT comes here. |
1789 `-------------------------------------*/
1790 yyacceptlab:
1791 yyresult = 0;
1792 goto yyreturn;
1793
1794 /*-----------------------------------.
1795 | yyabortlab -- YYABORT comes here. |
1796 `-----------------------------------*/
1797 yyabortlab:
1798 yyresult = 1;
1799 goto yyreturn;
1800
1801 #if !defined(yyoverflow) || YYERROR_VERBOSE
1802 /*-------------------------------------------------.
1803 | yyexhaustedlab -- memory exhaustion comes here. |
1804 `-------------------------------------------------*/
1805 yyexhaustedlab:
1806 yyerror (param, YY_("memory exhausted"));
1807 yyresult = 2;
1808 /* Fall through. */
1809 #endif
1810
1811 yyreturn:
1812 if (yychar != YYEMPTY)
1813 {
1814 /* Make sure we have latest lookahead translation. See comments at
1815 user semantic actions for why this is necessary. */
1816 yytoken = YYTRANSLATE (yychar);
1817 yydestruct ("Cleanup: discarding lookahead",
1818 yytoken, &yylval, &yylloc, param);
1819 }
1820 /* Do not reclaim the symbols of the rule which action triggered
1821 this YYABORT or YYACCEPT. */
1822 YYPOPSTACK (yylen);
1823 YY_STACK_PRINT (yyss, yyssp);
1824 while (yyssp != yyss)
1825 {
1826 yydestruct ("Cleanup: popping",
1827 yystos[*yyssp], yyvsp, yylsp, param);
1828 YYPOPSTACK (1);
1829 }
1830 #ifndef yyoverflow
1831 if (yyss != yyssa)
1832 YYSTACK_FREE (yyss);
1833 #endif
1834 #if YYERROR_VERBOSE
1835 if (yymsg != yymsgbuf)
1836 YYSTACK_FREE (yymsg);
1837 #endif
1838 /* Make sure YYID is used. */
1839 return YYID (yyresult);
1840 }
1841
1842
1843
1844 /* Line 2067 of yacc.c */
1845 #line 145 "asm_parse.y"
1846
1847
1848 void
1849 assembly(const struct parser_param *param)
1850 {
1851 if (linetable_open(param->file) == -1)
1852 die("'%s' cannot open.", param->file);
1853
1854 asm_symtable = strbuf_open(0);
1855 asm_initscan();
1856
1857 asm_parse(param);
1858
1859 strbuf_close(asm_symtable);
1860 linetable_close();
1861 }
1862
1863 static void
1864 yyerror(const struct parser_param *param, const char *s)
1865 {
1866
1867 }
1868
/* */