]>
Commit | Line | Data |
---|---|---|
1 | /* A Bison parser, made by GNU Bison 2.3+. */ | |
2 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | |
4 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | |
6 | Free Software Foundation, Inc. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
21 | Boston, MA 02110-1301, USA. */ | |
22 | ||
23 | /* As a special exception, you may create a larger work that contains | |
24 | part or all of the Bison parser skeleton and distribute that work | |
25 | under terms of your choice, so long as that work isn't itself a | |
26 | parser generator using the skeleton or a modified version thereof | |
27 | as a parser skeleton. Alternatively, if you modify or redistribute | |
28 | the parser skeleton itself, you may (at your option) remove this | |
29 | special exception, which will cause the skeleton and the resulting | |
30 | Bison output files to be licensed under the GNU General Public | |
31 | License without this special exception. | |
32 | ||
33 | This special exception was added by the Free Software Foundation in | |
34 | version 2.2 of Bison. */ | |
35 | ||
36 | /* C LALR(1) parser skeleton written by Richard Stallman, by | |
37 | simplifying the original so-called "semantic" parser. */ | |
38 | ||
39 | /* All symbols defined below should begin with yy or YY, to avoid | |
40 | infringing on user name space. This should be done even for local | |
41 | variables, as they might otherwise be expanded by user macros. | |
42 | There are some unavoidable exceptions within include files to | |
43 | define necessary library symbols; they are noted "INFRINGES ON | |
44 | USER NAME SPACE" below. */ | |
45 | ||
46 | /* Identify Bison output. */ | |
47 | #define YYBISON 1 | |
48 | ||
49 | /* Bison version. */ | |
50 | #define YYBISON_VERSION "2.3+" | |
51 | ||
52 | /* Skeleton name. */ | |
53 | #define YYSKELETON_NAME "yacc.c" | |
54 | ||
55 | /* Pure parsers. */ | |
56 | #define YYPURE 1 | |
57 | ||
58 | /* Using locations. */ | |
59 | #define YYLSP_NEEDED 1 | |
60 | ||
61 | /* Substitute the variable and function names. */ | |
62 | #define yyparse gram_parse | |
63 | #define yylex gram_lex | |
64 | #define yyerror gram_error | |
65 | #define yylval gram_lval | |
66 | #define yychar gram_char | |
67 | #define yydebug gram_debug | |
68 | #define yynerrs gram_nerrs | |
69 | #define yylloc gram_lloc | |
70 | ||
71 | /* Copy the first part of user declarations. */ | |
72 | #line 1 "parse-gram.y" | |
73 | /* Bison Grammar Parser -*- C -*- | |
74 | ||
75 | Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. | |
76 | ||
77 | This file is part of Bison, the GNU Compiler Compiler. | |
78 | ||
79 | This program is free software; you can redistribute it and/or modify | |
80 | it under the terms of the GNU General Public License as published by | |
81 | the Free Software Foundation; either version 2 of the License, or | |
82 | (at your option) any later version. | |
83 | ||
84 | This program is distributed in the hope that it will be useful, | |
85 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
87 | GNU General Public License for more details. | |
88 | ||
89 | You should have received a copy of the GNU General Public License | |
90 | along with this program; if not, write to the Free Software | |
91 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
92 | 02110-1301 USA | |
93 | */ | |
94 | ||
95 | #include <config.h> | |
96 | #include "system.h" | |
97 | ||
98 | #include "complain.h" | |
99 | #include "conflicts.h" | |
100 | #include "files.h" | |
101 | #include "getargs.h" | |
102 | #include "gram.h" | |
103 | #include "muscle_tab.h" | |
104 | #include "quotearg.h" | |
105 | #include "reader.h" | |
106 | #include "symlist.h" | |
107 | #include "scan-gram.h" | |
108 | #include "scan-code.h" | |
109 | #include "strverscmp.h" | |
110 | ||
111 | #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) | |
112 | static YYLTYPE lloc_default (YYLTYPE const *, int); | |
113 | ||
114 | #define YY_LOCATION_PRINT(File, Loc) \ | |
115 | location_print (File, Loc) | |
116 | ||
117 | static void version_check (location const *loc, char const *version); | |
118 | ||
119 | /* Request detailed syntax error messages, and pass them to GRAM_ERROR. | |
120 | FIXME: depends on the undocumented availability of YYLLOC. */ | |
121 | #undef yyerror | |
122 | #define yyerror(Msg) \ | |
123 | gram_error (&yylloc, Msg) | |
124 | static void gram_error (location const *, char const *); | |
125 | ||
126 | static char const *char_name (char); | |
127 | ||
128 | static void add_param (char const *, char *, location); | |
129 | ||
130 | static symbol_class current_class = unknown_sym; | |
131 | static uniqstr current_type = 0; | |
132 | static symbol *current_lhs; | |
133 | static location current_lhs_location; | |
134 | static int current_prec = 0; | |
135 | ||
136 | #ifdef UINT_FAST8_MAX | |
137 | # define YYTYPE_UINT8 uint_fast8_t | |
138 | #endif | |
139 | #ifdef INT_FAST8_MAX | |
140 | # define YYTYPE_INT8 int_fast8_t | |
141 | #endif | |
142 | #ifdef UINT_FAST16_MAX | |
143 | # define YYTYPE_UINT16 uint_fast16_t | |
144 | #endif | |
145 | #ifdef INT_FAST16_MAX | |
146 | # define YYTYPE_INT16 int_fast16_t | |
147 | #endif | |
148 | ||
149 | ||
150 | /* Enabling traces. */ | |
151 | #ifndef YYDEBUG | |
152 | # define YYDEBUG 1 | |
153 | #endif | |
154 | ||
155 | /* Enabling verbose error messages. */ | |
156 | #ifdef YYERROR_VERBOSE | |
157 | # undef YYERROR_VERBOSE | |
158 | # define YYERROR_VERBOSE 1 | |
159 | #else | |
160 | # define YYERROR_VERBOSE 1 | |
161 | #endif | |
162 | ||
163 | /* Enabling the token table. */ | |
164 | #ifndef YYTOKEN_TABLE | |
165 | # define YYTOKEN_TABLE 0 | |
166 | #endif | |
167 | ||
168 | ||
169 | /* Tokens. */ | |
170 | #ifndef YYTOKENTYPE | |
171 | # define YYTOKENTYPE | |
172 | /* Put the tokens into the symbol table, so that GDB and other debuggers | |
173 | know about them. */ | |
174 | enum yytokentype { | |
175 | GRAM_EOF = 0, | |
176 | STRING = 258, | |
177 | INT = 259, | |
178 | PERCENT_TOKEN = 260, | |
179 | PERCENT_NTERM = 261, | |
180 | PERCENT_TYPE = 262, | |
181 | PERCENT_DESTRUCTOR = 263, | |
182 | PERCENT_PRINTER = 264, | |
183 | PERCENT_LEFT = 265, | |
184 | PERCENT_RIGHT = 266, | |
185 | PERCENT_NONASSOC = 267, | |
186 | PERCENT_PREC = 268, | |
187 | PERCENT_DPREC = 269, | |
188 | PERCENT_MERGE = 270, | |
189 | PERCENT_AFTER_DEFINITIONS = 271, | |
190 | PERCENT_BEFORE_DEFINITIONS = 272, | |
191 | PERCENT_DEBUG = 273, | |
192 | PERCENT_DEFAULT_PREC = 274, | |
193 | PERCENT_DEFINE = 275, | |
194 | PERCENT_DEFINES = 276, | |
195 | PERCENT_ERROR_VERBOSE = 277, | |
196 | PERCENT_EXPECT = 278, | |
197 | PERCENT_EXPECT_RR = 279, | |
198 | PERCENT_FILE_PREFIX = 280, | |
199 | PERCENT_GLR_PARSER = 281, | |
200 | PERCENT_INITIAL_ACTION = 282, | |
201 | PERCENT_LEX_PARAM = 283, | |
202 | PERCENT_LOCATIONS = 284, | |
203 | PERCENT_NAME_PREFIX = 285, | |
204 | PERCENT_NO_DEFAULT_PREC = 286, | |
205 | PERCENT_NO_LINES = 287, | |
206 | PERCENT_NONDETERMINISTIC_PARSER = 288, | |
207 | PERCENT_OUTPUT = 289, | |
208 | PERCENT_PARSE_PARAM = 290, | |
209 | PERCENT_PURE_PARSER = 291, | |
210 | PERCENT_REQUIRE = 292, | |
211 | PERCENT_SKELETON = 293, | |
212 | PERCENT_START = 294, | |
213 | PERCENT_TOKEN_TABLE = 295, | |
214 | PERCENT_VERBOSE = 296, | |
215 | PERCENT_YACC = 297, | |
216 | BRACED_CODE = 298, | |
217 | CHAR = 299, | |
218 | EPILOGUE = 300, | |
219 | EQUAL = 301, | |
220 | ID = 302, | |
221 | ID_COLON = 303, | |
222 | PERCENT_PERCENT = 304, | |
223 | PIPE = 305, | |
224 | PROLOGUE = 306, | |
225 | SEMICOLON = 307, | |
226 | TYPE = 308, | |
227 | PERCENT_UNION = 309 | |
228 | }; | |
229 | #endif | |
230 | /* Tokens. */ | |
231 | #define GRAM_EOF 0 | |
232 | #define STRING 258 | |
233 | #define INT 259 | |
234 | #define PERCENT_TOKEN 260 | |
235 | #define PERCENT_NTERM 261 | |
236 | #define PERCENT_TYPE 262 | |
237 | #define PERCENT_DESTRUCTOR 263 | |
238 | #define PERCENT_PRINTER 264 | |
239 | #define PERCENT_LEFT 265 | |
240 | #define PERCENT_RIGHT 266 | |
241 | #define PERCENT_NONASSOC 267 | |
242 | #define PERCENT_PREC 268 | |
243 | #define PERCENT_DPREC 269 | |
244 | #define PERCENT_MERGE 270 | |
245 | #define PERCENT_AFTER_DEFINITIONS 271 | |
246 | #define PERCENT_BEFORE_DEFINITIONS 272 | |
247 | #define PERCENT_DEBUG 273 | |
248 | #define PERCENT_DEFAULT_PREC 274 | |
249 | #define PERCENT_DEFINE 275 | |
250 | #define PERCENT_DEFINES 276 | |
251 | #define PERCENT_ERROR_VERBOSE 277 | |
252 | #define PERCENT_EXPECT 278 | |
253 | #define PERCENT_EXPECT_RR 279 | |
254 | #define PERCENT_FILE_PREFIX 280 | |
255 | #define PERCENT_GLR_PARSER 281 | |
256 | #define PERCENT_INITIAL_ACTION 282 | |
257 | #define PERCENT_LEX_PARAM 283 | |
258 | #define PERCENT_LOCATIONS 284 | |
259 | #define PERCENT_NAME_PREFIX 285 | |
260 | #define PERCENT_NO_DEFAULT_PREC 286 | |
261 | #define PERCENT_NO_LINES 287 | |
262 | #define PERCENT_NONDETERMINISTIC_PARSER 288 | |
263 | #define PERCENT_OUTPUT 289 | |
264 | #define PERCENT_PARSE_PARAM 290 | |
265 | #define PERCENT_PURE_PARSER 291 | |
266 | #define PERCENT_REQUIRE 292 | |
267 | #define PERCENT_SKELETON 293 | |
268 | #define PERCENT_START 294 | |
269 | #define PERCENT_TOKEN_TABLE 295 | |
270 | #define PERCENT_VERBOSE 296 | |
271 | #define PERCENT_YACC 297 | |
272 | #define BRACED_CODE 298 | |
273 | #define CHAR 299 | |
274 | #define EPILOGUE 300 | |
275 | #define EQUAL 301 | |
276 | #define ID 302 | |
277 | #define ID_COLON 303 | |
278 | #define PERCENT_PERCENT 304 | |
279 | #define PIPE 305 | |
280 | #define PROLOGUE 306 | |
281 | #define SEMICOLON 307 | |
282 | #define TYPE 308 | |
283 | #define PERCENT_UNION 309 | |
284 | ||
285 | ||
286 | ||
287 | ||
288 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | |
289 | typedef union YYSTYPE | |
290 | #line 97 "parse-gram.y" | |
291 | { | |
292 | symbol *symbol; | |
293 | symbol_list *list; | |
294 | int integer; | |
295 | char *chars; | |
296 | assoc assoc; | |
297 | uniqstr uniqstr; | |
298 | unsigned char character; | |
299 | } | |
300 | /* Line 197 of yacc.c. */ | |
301 | #line 302 "parse-gram.c" | |
302 | YYSTYPE; | |
303 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | |
304 | # define YYSTYPE_IS_DECLARED 1 | |
305 | # define YYSTYPE_IS_TRIVIAL 1 | |
306 | #endif | |
307 | ||
308 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
309 | typedef struct YYLTYPE | |
310 | { | |
311 | int first_line; | |
312 | int first_column; | |
313 | int last_line; | |
314 | int last_column; | |
315 | } YYLTYPE; | |
316 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | |
317 | # define YYLTYPE_IS_DECLARED 1 | |
318 | # define YYLTYPE_IS_TRIVIAL 1 | |
319 | #endif | |
320 | ||
321 | ||
322 | /* Copy the second part of user declarations. */ | |
323 | ||
324 | ||
325 | /* Line __line__ of yacc.c. */ | |
326 | #line 327 "parse-gram.c" | |
327 | ||
328 | #ifdef short | |
329 | # undef short | |
330 | #endif | |
331 | ||
332 | #ifdef YYTYPE_UINT8 | |
333 | typedef YYTYPE_UINT8 yytype_uint8; | |
334 | #else | |
335 | typedef unsigned char yytype_uint8; | |
336 | #endif | |
337 | ||
338 | #ifdef YYTYPE_INT8 | |
339 | typedef YYTYPE_INT8 yytype_int8; | |
340 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | |
341 | || defined __cplusplus || defined _MSC_VER) | |
342 | typedef signed char yytype_int8; | |
343 | #else | |
344 | typedef short int yytype_int8; | |
345 | #endif | |
346 | ||
347 | #ifdef YYTYPE_UINT16 | |
348 | typedef YYTYPE_UINT16 yytype_uint16; | |
349 | #else | |
350 | typedef unsigned short int yytype_uint16; | |
351 | #endif | |
352 | ||
353 | #ifdef YYTYPE_INT16 | |
354 | typedef YYTYPE_INT16 yytype_int16; | |
355 | #else | |
356 | typedef short int yytype_int16; | |
357 | #endif | |
358 | ||
359 | #ifndef YYSIZE_T | |
360 | # ifdef __SIZE_TYPE__ | |
361 | # define YYSIZE_T __SIZE_TYPE__ | |
362 | # elif defined size_t | |
363 | # define YYSIZE_T size_t | |
364 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | |
365 | || defined __cplusplus || defined _MSC_VER) | |
366 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
367 | # define YYSIZE_T size_t | |
368 | # else | |
369 | # define YYSIZE_T unsigned int | |
370 | # endif | |
371 | #endif | |
372 | ||
373 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | |
374 | ||
375 | #ifndef YY_ | |
376 | # if YYENABLE_NLS | |
377 | # if ENABLE_NLS | |
378 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | |
379 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | |
380 | # endif | |
381 | # endif | |
382 | # ifndef YY_ | |
383 | # define YY_(msgid) msgid | |
384 | # endif | |
385 | #endif | |
386 | ||
387 | /* Suppress unused-variable warnings by "using" E. */ | |
388 | #if ! defined lint || defined __GNUC__ | |
389 | # define YYUSE(e) ((void) (e)) | |
390 | #else | |
391 | # define YYUSE(e) /* empty */ | |
392 | #endif | |
393 | ||
394 | /* Identity function, used to suppress warnings about constant conditions. */ | |
395 | #ifndef lint | |
396 | # define YYID(n) (n) | |
397 | #else | |
398 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
399 | || defined __cplusplus || defined _MSC_VER) | |
400 | static int | |
401 | YYID (int i) | |
402 | #else | |
403 | static int | |
404 | YYID (i) | |
405 | int i; | |
406 | #endif | |
407 | { | |
408 | return i; | |
409 | } | |
410 | #endif | |
411 | ||
412 | #if ! defined yyoverflow || YYERROR_VERBOSE | |
413 | ||
414 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | |
415 | ||
416 | # ifdef YYSTACK_USE_ALLOCA | |
417 | # if YYSTACK_USE_ALLOCA | |
418 | # ifdef __GNUC__ | |
419 | # define YYSTACK_ALLOC __builtin_alloca | |
420 | # elif defined __BUILTIN_VA_ARG_INCR | |
421 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ | |
422 | # elif defined _AIX | |
423 | # define YYSTACK_ALLOC __alloca | |
424 | # elif defined _MSC_VER | |
425 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ | |
426 | # define alloca _alloca | |
427 | # else | |
428 | # define YYSTACK_ALLOC alloca | |
429 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | |
430 | || defined __cplusplus || defined _MSC_VER) | |
431 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
432 | # ifndef _STDLIB_H | |
433 | # define _STDLIB_H 1 | |
434 | # endif | |
435 | # endif | |
436 | # endif | |
437 | # endif | |
438 | # endif | |
439 | ||
440 | # ifdef YYSTACK_ALLOC | |
441 | /* Pacify GCC's `empty if-body' warning. */ | |
442 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | |
443 | # ifndef YYSTACK_ALLOC_MAXIMUM | |
444 | /* The OS might guarantee only one guard page at the bottom of the stack, | |
445 | and a page size can be as small as 4096 bytes. So we cannot safely | |
446 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number | |
447 | to allow for a few compiler-allocated temporary stack slots. */ | |
448 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ | |
449 | # endif | |
450 | # else | |
451 | # define YYSTACK_ALLOC YYMALLOC | |
452 | # define YYSTACK_FREE YYFREE | |
453 | # ifndef YYSTACK_ALLOC_MAXIMUM | |
454 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | |
455 | # endif | |
456 | # if (defined __cplusplus && ! defined _STDLIB_H \ | |
457 | && ! ((defined YYMALLOC || defined malloc) \ | |
458 | && (defined YYFREE || defined free))) | |
459 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
460 | # ifndef _STDLIB_H | |
461 | # define _STDLIB_H 1 | |
462 | # endif | |
463 | # endif | |
464 | # ifndef YYMALLOC | |
465 | # define YYMALLOC malloc | |
466 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | |
467 | || defined __cplusplus || defined _MSC_VER) | |
468 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | |
469 | # endif | |
470 | # endif | |
471 | # ifndef YYFREE | |
472 | # define YYFREE free | |
473 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ | |
474 | || defined __cplusplus || defined _MSC_VER) | |
475 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | |
476 | # endif | |
477 | # endif | |
478 | # endif | |
479 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ | |
480 | ||
481 | ||
482 | #if (! defined yyoverflow \ | |
483 | && (! defined __cplusplus \ | |
484 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ | |
485 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | |
486 | ||
487 | /* A type that is properly aligned for any stack member. */ | |
488 | union yyalloc | |
489 | { | |
490 | yytype_int16 yyss; | |
491 | YYSTYPE yyvs; | |
492 | YYLTYPE yyls; | |
493 | }; | |
494 | ||
495 | /* The size of the maximum gap between one aligned stack and the next. */ | |
496 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | |
497 | ||
498 | /* The size of an array large to enough to hold all stacks, each with | |
499 | N elements. */ | |
500 | # define YYSTACK_BYTES(N) \ | |
501 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ | |
502 | + 2 * YYSTACK_GAP_MAXIMUM) | |
503 | ||
504 | /* Copy COUNT objects from FROM to TO. The source and destination do | |
505 | not overlap. */ | |
506 | # ifndef YYCOPY | |
507 | # if defined __GNUC__ && 1 < __GNUC__ | |
508 | # define YYCOPY(To, From, Count) \ | |
509 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
510 | # else | |
511 | # define YYCOPY(To, From, Count) \ | |
512 | do \ | |
513 | { \ | |
514 | YYSIZE_T yyi; \ | |
515 | for (yyi = 0; yyi < (Count); yyi++) \ | |
516 | (To)[yyi] = (From)[yyi]; \ | |
517 | } \ | |
518 | while (YYID (0)) | |
519 | # endif | |
520 | # endif | |
521 | ||
522 | /* Relocate STACK from its old location to the new one. The | |
523 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | |
524 | elements in the stack, and YYPTR gives the new location of the | |
525 | stack. Advance YYPTR to a properly aligned location for the next | |
526 | stack. */ | |
527 | # define YYSTACK_RELOCATE(Stack) \ | |
528 | do \ | |
529 | { \ | |
530 | YYSIZE_T yynewbytes; \ | |
531 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | |
532 | Stack = &yyptr->Stack; \ | |
533 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | |
534 | yyptr += yynewbytes / sizeof (*yyptr); \ | |
535 | } \ | |
536 | while (YYID (0)) | |
537 | ||
538 | #endif | |
539 | ||
540 | /* YYFINAL -- State number of the termination state. */ | |
541 | #define YYFINAL 3 | |
542 | /* YYLAST -- Last index in YYTABLE. */ | |
543 | #define YYLAST 185 | |
544 | ||
545 | /* YYNTOKENS -- Number of terminals. */ | |
546 | #define YYNTOKENS 55 | |
547 | /* YYNNTS -- Number of nonterminals. */ | |
548 | #define YYNNTS 27 | |
549 | /* YYNRULES -- Number of rules. */ | |
550 | #define YYNRULES 87 | |
551 | /* YYNRULES -- Number of states. */ | |
552 | #define YYNSTATES 124 | |
553 | ||
554 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
555 | #define YYUNDEFTOK 2 | |
556 | #define YYMAXUTOK 309 | |
557 | ||
558 | #define YYTRANSLATE(YYX) \ | |
559 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | |
560 | ||
561 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | |
562 | static const yytype_uint8 yytranslate[] = | |
563 | { | |
564 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
565 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
566 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
567 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
568 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
569 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
570 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
571 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
572 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
573 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
574 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
575 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
576 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
577 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
578 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
579 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
580 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
581 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
582 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
583 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
586 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
587 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
588 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
589 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | |
590 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | |
591 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | |
592 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | |
593 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, | |
594 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54 | |
595 | }; | |
596 | ||
597 | #if YYDEBUG | |
598 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | |
599 | YYRHS. */ | |
600 | static const yytype_uint8 yyprhs[] = | |
601 | { | |
602 | 0, 0, 3, 8, 9, 12, 14, 16, 19, 22, | |
603 | 24, 27, 31, 33, 35, 38, 41, 45, 47, 50, | |
604 | 53, 55, 59, 61, 63, 67, 70, 72, 75, 78, | |
605 | 80, 82, 84, 86, 88, 90, 93, 97, 101, 103, | |
606 | 105, 106, 108, 112, 113, 117, 118, 122, 126, 130, | |
607 | 132, 134, 136, 137, 139, 141, 144, 146, 148, 151, | |
608 | 154, 158, 160, 163, 165, 168, 170, 173, 176, 177, | |
609 | 181, 183, 187, 190, 191, 194, 197, 201, 205, 209, | |
610 | 211, 213, 215, 217, 219, 221, 223, 224 | |
611 | }; | |
612 | ||
613 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | |
614 | static const yytype_int8 yyrhs[] = | |
615 | { | |
616 | 56, 0, -1, 57, 49, 70, 81, -1, -1, 57, | |
617 | 58, -1, 59, -1, 51, -1, 16, 43, -1, 17, | |
618 | 43, -1, 18, -1, 20, 80, -1, 20, 80, 80, | |
619 | -1, 21, -1, 22, -1, 23, 4, -1, 24, 4, | |
620 | -1, 25, 46, 80, -1, 26, -1, 27, 43, -1, | |
621 | 28, 43, -1, 29, -1, 30, 46, 80, -1, 32, | |
622 | -1, 33, -1, 34, 46, 80, -1, 35, 43, -1, | |
623 | 36, -1, 37, 80, -1, 38, 80, -1, 40, -1, | |
624 | 41, -1, 42, -1, 52, -1, 64, -1, 61, -1, | |
625 | 39, 78, -1, 8, 43, 67, -1, 9, 43, 67, | |
626 | -1, 19, -1, 31, -1, -1, 47, -1, 54, 60, | |
627 | 43, -1, -1, 6, 62, 69, -1, -1, 5, 63, | |
628 | 69, -1, 7, 53, 67, -1, 65, 66, 67, -1, | |
629 | 10, -1, 11, -1, 12, -1, -1, 53, -1, 78, | |
630 | -1, 67, 78, -1, 53, -1, 76, -1, 76, 4, | |
631 | -1, 76, 79, -1, 76, 4, 79, -1, 68, -1, | |
632 | 69, 68, -1, 71, -1, 70, 71, -1, 72, -1, | |
633 | 59, 52, -1, 1, 52, -1, -1, 77, 73, 74, | |
634 | -1, 75, -1, 74, 50, 75, -1, 74, 52, -1, | |
635 | -1, 75, 78, -1, 75, 43, -1, 75, 13, 78, | |
636 | -1, 75, 14, 4, -1, 75, 15, 53, -1, 47, | |
637 | -1, 44, -1, 48, -1, 76, -1, 79, -1, 3, | |
638 | -1, 3, -1, -1, 49, 45, -1 | |
639 | }; | |
640 | ||
641 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
642 | static const yytype_uint16 yyrline[] = | |
643 | { | |
644 | 0, 202, 202, 210, 212, 216, 217, 219, 226, 233, | |
645 | 234, 239, 240, 241, 242, 243, 244, 245, 250, 254, | |
646 | 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
647 | 265, 266, 267, 271, 272, 273, 277, 285, 293, 297, | |
648 | 311, 312, 316, 338, 338, 343, 343, 348, 358, 373, | |
649 | 374, 375, 379, 380, 385, 386, 391, 395, 400, 406, | |
650 | 412, 423, 424, 433, 434, 440, 441, 442, 449, 449, | |
651 | 453, 454, 455, 460, 461, 463, 466, 468, 470, 483, | |
652 | 485, 494, 499, 500, 505, 514, 519, 521 | |
653 | }; | |
654 | #endif | |
655 | ||
656 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | |
657 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | |
658 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | |
659 | static const char *const yytname[] = | |
660 | { | |
661 | "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"", | |
662 | "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"", | |
663 | "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"", | |
664 | "\"%dprec\"", "\"%merge\"", "\"%after-definitions\"", | |
665 | "\"%before-definitions\"", "\"%debug\"", "\"%default-prec\"", | |
666 | "\"%define\"", "\"%defines\"", "\"%error-verbose\"", "\"%expect\"", | |
667 | "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", | |
668 | "\"%initial-action\"", "\"%lex-param\"", "\"%locations\"", | |
669 | "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"", | |
670 | "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param\"", | |
671 | "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"", | |
672 | "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"char\"", | |
673 | "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", | |
674 | "\"|\"", "\"%{...%}\"", "\";\"", "\"type\"", "\"%union\"", "$accept", | |
675 | "input", "declarations", "declaration", "grammar_declaration", | |
676 | "union_name", "symbol_declaration", "@1", "@2", "precedence_declaration", | |
677 | "precedence_declarator", "type.opt", "symbols.1", "symbol_def", | |
678 | "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", | |
679 | "@3", "rhses.1", "rhs", "id", "id_colon", "symbol", "string_as_id", | |
680 | "string_content", "epilogue.opt", 0 | |
681 | }; | |
682 | #endif | |
683 | ||
684 | # ifdef YYPRINT | |
685 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | |
686 | token YYLEX-NUM. */ | |
687 | static const yytype_uint16 yytoknum[] = | |
688 | { | |
689 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
690 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | |
691 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | |
692 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | |
693 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, | |
694 | 305, 306, 307, 308, 309 | |
695 | }; | |
696 | # endif | |
697 | ||
698 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
699 | static const yytype_uint8 yyr1[] = | |
700 | { | |
701 | 0, 55, 56, 57, 57, 58, 58, 58, 58, 58, | |
702 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | |
703 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | |
704 | 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, | |
705 | 60, 60, 59, 62, 61, 63, 61, 61, 64, 65, | |
706 | 65, 65, 66, 66, 67, 67, 68, 68, 68, 68, | |
707 | 68, 69, 69, 70, 70, 71, 71, 71, 73, 72, | |
708 | 74, 74, 74, 75, 75, 75, 75, 75, 75, 76, | |
709 | 76, 77, 78, 78, 79, 80, 81, 81 | |
710 | }; | |
711 | ||
712 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
713 | static const yytype_uint8 yyr2[] = | |
714 | { | |
715 | 0, 2, 4, 0, 2, 1, 1, 2, 2, 1, | |
716 | 2, 3, 1, 1, 2, 2, 3, 1, 2, 2, | |
717 | 1, 3, 1, 1, 3, 2, 1, 2, 2, 1, | |
718 | 1, 1, 1, 1, 1, 2, 3, 3, 1, 1, | |
719 | 0, 1, 3, 0, 3, 0, 3, 3, 3, 1, | |
720 | 1, 1, 0, 1, 1, 2, 1, 1, 2, 2, | |
721 | 3, 1, 2, 1, 2, 1, 2, 2, 0, 3, | |
722 | 1, 3, 2, 0, 2, 2, 3, 3, 3, 1, | |
723 | 1, 1, 1, 1, 1, 1, 0, 2 | |
724 | }; | |
725 | ||
726 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | |
727 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | |
728 | means the default is an error. */ | |
729 | static const yytype_uint8 yydefact[] = | |
730 | { | |
731 | 3, 0, 0, 1, 45, 43, 0, 0, 0, 49, | |
732 | 50, 51, 0, 0, 9, 38, 0, 12, 13, 0, | |
733 | 0, 0, 17, 0, 0, 20, 0, 39, 22, 23, | |
734 | 0, 0, 26, 0, 0, 0, 29, 30, 31, 0, | |
735 | 6, 32, 40, 4, 5, 34, 33, 52, 0, 0, | |
736 | 0, 0, 0, 7, 8, 85, 10, 14, 15, 0, | |
737 | 18, 19, 0, 0, 25, 27, 28, 84, 80, 79, | |
738 | 82, 35, 83, 0, 81, 0, 0, 63, 65, 68, | |
739 | 41, 0, 53, 0, 56, 61, 46, 57, 44, 47, | |
740 | 54, 36, 37, 11, 16, 21, 24, 67, 66, 0, | |
741 | 64, 2, 73, 42, 48, 62, 58, 59, 55, 87, | |
742 | 69, 70, 60, 73, 72, 0, 0, 0, 75, 74, | |
743 | 71, 76, 77, 78 | |
744 | }; | |
745 | ||
746 | /* YYDEFGOTO[NTERM-NUM]. */ | |
747 | static const yytype_int8 yydefgoto[] = | |
748 | { | |
749 | -1, 1, 2, 43, 75, 81, 45, 49, 48, 46, | |
750 | 47, 83, 89, 85, 86, 76, 77, 78, 102, 110, | |
751 | 111, 70, 79, 90, 72, 56, 101 | |
752 | }; | |
753 | ||
754 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | |
755 | STATE-NUM. */ | |
756 | #define YYPACT_NINF -74 | |
757 | static const yytype_int16 yypact[] = | |
758 | { | |
759 | -74, 34, 131, -74, -74, -74, -38, -5, -2, -74, | |
760 | -74, -74, 5, 8, -74, -74, 40, -74, -74, 48, | |
761 | 49, 14, -74, 21, 22, -74, 20, -74, -74, -74, | |
762 | 24, 25, -74, 40, 40, 0, -74, -74, -74, 81, | |
763 | -74, -74, 26, -74, -74, -74, -74, 18, -22, -22, | |
764 | 0, 0, 0, -74, -74, -74, 40, -74, -74, 40, | |
765 | -74, -74, 40, 40, -74, -74, -74, -74, -74, -74, | |
766 | -74, -74, -74, 27, -74, 29, 1, -74, -74, -74, | |
767 | -74, 31, -74, 0, -74, -74, -22, 23, -22, 0, | |
768 | -74, 0, 0, -74, -74, -74, -74, -74, -74, 30, | |
769 | -74, -74, -74, -74, 0, -74, 64, -74, -74, -74, | |
770 | -31, 15, -74, -74, -74, 0, 68, 41, -74, -74, | |
771 | 15, -74, -74, -74 | |
772 | }; | |
773 | ||
774 | /* YYPGOTO[NTERM-NUM]. */ | |
775 | static const yytype_int8 yypgoto[] = | |
776 | { | |
777 | -74, -74, -74, -74, 75, -74, -74, -74, -74, -74, | |
778 | -74, -74, -47, -51, 35, -74, 2, -74, -74, -74, | |
779 | -30, -25, -74, -35, -73, -17, -74 | |
780 | }; | |
781 | ||
782 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | |
783 | positive, shift that token. If negative, reduce the rule which | |
784 | number is the opposite. If zero, do what YYDEFACT says. | |
785 | If YYTABLE_NINF, syntax error. */ | |
786 | #define YYTABLE_NINF -87 | |
787 | static const yytype_int8 yytable[] = | |
788 | { | |
789 | 71, -86, 73, 67, 91, 92, 4, 5, 6, 7, | |
790 | 8, 9, 10, 11, 107, 50, 65, 66, 67, 113, | |
791 | 15, 114, 68, 87, 87, 69, 67, 106, 115, 116, | |
792 | 117, 84, 27, 112, 3, 105, 104, 105, 51, 93, | |
793 | 35, 52, 94, 55, 68, 95, 96, 69, 53, 74, | |
794 | 99, 54, 57, 58, 108, 42, 108, 108, 118, 68, | |
795 | 59, 87, 69, 87, 60, 61, 62, 67, 64, 108, | |
796 | 63, 82, 122, 80, 103, 109, 119, 44, 100, 97, | |
797 | 121, 98, 73, 120, 88, 119, 4, 5, 6, 7, | |
798 | 8, 9, 10, 11, 123, 0, 0, 0, 0, 0, | |
799 | 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
800 | 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, | |
801 | 35, 0, 0, 0, 0, 0, 0, 0, 0, 74, | |
802 | 0, 0, 0, 0, 0, 42, 4, 5, 6, 7, | |
803 | 8, 9, 10, 11, 0, 0, 0, 12, 13, 14, | |
804 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | |
805 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | |
806 | 35, 36, 37, 38, 0, 0, 0, 0, 0, 0, | |
807 | 39, 0, 40, 41, 0, 42 | |
808 | }; | |
809 | ||
810 | static const yytype_int8 yycheck[] = | |
811 | { | |
812 | 35, 0, 1, 3, 51, 52, 5, 6, 7, 8, | |
813 | 9, 10, 11, 12, 87, 53, 33, 34, 3, 50, | |
814 | 19, 52, 44, 48, 49, 47, 3, 4, 13, 14, | |
815 | 15, 53, 31, 106, 0, 86, 83, 88, 43, 56, | |
816 | 39, 43, 59, 3, 44, 62, 63, 47, 43, 48, | |
817 | 49, 43, 4, 4, 89, 54, 91, 92, 43, 44, | |
818 | 46, 86, 47, 88, 43, 43, 46, 3, 43, 104, | |
819 | 46, 53, 4, 47, 43, 45, 111, 2, 76, 52, | |
820 | 115, 52, 1, 113, 49, 120, 5, 6, 7, 8, | |
821 | 9, 10, 11, 12, 53, -1, -1, -1, -1, -1, | |
822 | 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
823 | -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, | |
824 | 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, | |
825 | -1, -1, -1, -1, -1, 54, 5, 6, 7, 8, | |
826 | 9, 10, 11, 12, -1, -1, -1, 16, 17, 18, | |
827 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, | |
828 | 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, | |
829 | 39, 40, 41, 42, -1, -1, -1, -1, -1, -1, | |
830 | 49, -1, 51, 52, -1, 54 | |
831 | }; | |
832 | ||
833 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | |
834 | symbol of state STATE-NUM. */ | |
835 | static const yytype_uint8 yystos[] = | |
836 | { | |
837 | 0, 56, 57, 0, 5, 6, 7, 8, 9, 10, | |
838 | 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, | |
839 | 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, | |
840 | 34, 35, 36, 37, 38, 39, 40, 41, 42, 49, | |
841 | 51, 52, 54, 58, 59, 61, 64, 65, 63, 62, | |
842 | 53, 43, 43, 43, 43, 3, 80, 4, 4, 46, | |
843 | 43, 43, 46, 46, 43, 80, 80, 3, 44, 47, | |
844 | 76, 78, 79, 1, 48, 59, 70, 71, 72, 77, | |
845 | 47, 60, 53, 66, 53, 68, 69, 76, 69, 67, | |
846 | 78, 67, 67, 80, 80, 80, 80, 52, 52, 49, | |
847 | 71, 81, 73, 43, 67, 68, 4, 79, 78, 45, | |
848 | 74, 75, 79, 50, 52, 13, 14, 15, 43, 78, | |
849 | 75, 78, 4, 53 | |
850 | }; | |
851 | ||
852 | #define yyerrok (yyerrstatus = 0) | |
853 | #define yyclearin (yychar = YYEMPTY) | |
854 | #define YYEMPTY (-2) | |
855 | #define YYEOF 0 | |
856 | ||
857 | #define YYACCEPT goto yyacceptlab | |
858 | #define YYABORT goto yyabortlab | |
859 | #define YYERROR goto yyerrorlab | |
860 | ||
861 | ||
862 | /* Like YYERROR except do call yyerror. This remains here temporarily | |
863 | to ease the transition to the new meaning of YYERROR, for GCC. | |
864 | Once GCC version 2 has supplanted version 1, this can go. */ | |
865 | ||
866 | #define YYFAIL goto yyerrlab | |
867 | ||
868 | #define YYRECOVERING() (!!yyerrstatus) | |
869 | ||
870 | #define YYBACKUP(Token, Value) \ | |
871 | do \ | |
872 | if (yychar == YYEMPTY && yylen == 1) \ | |
873 | { \ | |
874 | yychar = (Token); \ | |
875 | yylval = (Value); \ | |
876 | yytoken = YYTRANSLATE (yychar); \ | |
877 | YYPOPSTACK (1); \ | |
878 | goto yybackup; \ | |
879 | } \ | |
880 | else \ | |
881 | { \ | |
882 | yyerror (YY_("syntax error: cannot back up")); \ | |
883 | YYERROR; \ | |
884 | } \ | |
885 | while (YYID (0)) | |
886 | ||
887 | ||
888 | #define YYTERROR 1 | |
889 | #define YYERRCODE 256 | |
890 | ||
891 | ||
892 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |
893 | If N is 0, then set CURRENT to the empty location which ends | |
894 | the previous symbol: RHS[0] (always defined). */ | |
895 | ||
896 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | |
897 | #ifndef YYLLOC_DEFAULT | |
898 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |
899 | do \ | |
900 | if (YYID (N)) \ | |
901 | { \ | |
902 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | |
903 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | |
904 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | |
905 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | |
906 | } \ | |
907 | else \ | |
908 | { \ | |
909 | (Current).first_line = (Current).last_line = \ | |
910 | YYRHSLOC (Rhs, 0).last_line; \ | |
911 | (Current).first_column = (Current).last_column = \ | |
912 | YYRHSLOC (Rhs, 0).last_column; \ | |
913 | } \ | |
914 | while (YYID (0)) | |
915 | #endif | |
916 | ||
917 | ||
918 | /* YY_LOCATION_PRINT -- Print the location on the stream. | |
919 | This macro was not mandated originally: define only if we know | |
920 | we won't break user code: when these are the locations we know. */ | |
921 | ||
922 | #ifndef YY_LOCATION_PRINT | |
923 | # if YYLTYPE_IS_TRIVIAL | |
924 | # define YY_LOCATION_PRINT(File, Loc) \ | |
925 | fprintf (File, "%d.%d-%d.%d", \ | |
926 | (Loc).first_line, (Loc).first_column, \ | |
927 | (Loc).last_line, (Loc).last_column) | |
928 | # else | |
929 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | |
930 | # endif | |
931 | #endif | |
932 | ||
933 | ||
934 | /* YYLEX -- calling `yylex' with the right arguments. */ | |
935 | ||
936 | #ifdef YYLEX_PARAM | |
937 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) | |
938 | #else | |
939 | # define YYLEX yylex (&yylval, &yylloc) | |
940 | #endif | |
941 | ||
942 | /* Enable debugging if requested. */ | |
943 | #if YYDEBUG | |
944 | ||
945 | # ifndef YYFPRINTF | |
946 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | |
947 | # define YYFPRINTF fprintf | |
948 | # endif | |
949 | ||
950 | # define YYDPRINTF(Args) \ | |
951 | do { \ | |
952 | if (yydebug) \ | |
953 | YYFPRINTF Args; \ | |
954 | } while (YYID (0)) | |
955 | ||
956 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | |
957 | do { \ | |
958 | if (yydebug) \ | |
959 | { \ | |
960 | YYFPRINTF (stderr, "%s ", Title); \ | |
961 | yy_symbol_print (stderr, \ | |
962 | Type, Value, Location); \ | |
963 | YYFPRINTF (stderr, "\n"); \ | |
964 | } \ | |
965 | } while (YYID (0)) | |
966 | ||
967 | ||
968 | /*--------------------------------. | |
969 | | Print this symbol on YYOUTPUT. | | |
970 | `--------------------------------*/ | |
971 | ||
972 | /*ARGSUSED*/ | |
973 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
974 | || defined __cplusplus || defined _MSC_VER) | |
975 | static void | |
976 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | |
977 | #else | |
978 | static void | |
979 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) | |
980 | FILE *yyoutput; | |
981 | int yytype; | |
982 | YYSTYPE const * const yyvaluep; | |
983 | YYLTYPE const * const yylocationp; | |
984 | #endif | |
985 | { | |
986 | if (!yyvaluep) | |
987 | return; | |
988 | YYUSE (yylocationp); | |
989 | # ifdef YYPRINT | |
990 | if (yytype < YYNTOKENS) | |
991 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | |
992 | # else | |
993 | YYUSE (yyoutput); | |
994 | # endif | |
995 | switch (yytype) | |
996 | { | |
997 | case 3: /* "\"string\"" */ | |
998 | #line 181 "parse-gram.y" | |
999 | { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); }; | |
1000 | #line 1001 "parse-gram.c" | |
1001 | break; | |
1002 | case 4: /* "\"integer\"" */ | |
1003 | #line 191 "parse-gram.y" | |
1004 | { fprintf (stderr, "%d", (yyvaluep->integer)); }; | |
1005 | #line 1006 "parse-gram.c" | |
1006 | break; | |
1007 | case 43: /* "\"{...}\"" */ | |
1008 | #line 183 "parse-gram.y" | |
1009 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1010 | #line 1011 "parse-gram.c" | |
1011 | break; | |
1012 | case 44: /* "\"char\"" */ | |
1013 | #line 178 "parse-gram.y" | |
1014 | { fputs (char_name ((yyvaluep->character)), stderr); }; | |
1015 | #line 1016 "parse-gram.c" | |
1016 | break; | |
1017 | case 45: /* "\"epilogue\"" */ | |
1018 | #line 183 "parse-gram.y" | |
1019 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1020 | #line 1021 "parse-gram.c" | |
1021 | break; | |
1022 | case 47: /* "\"identifier\"" */ | |
1023 | #line 187 "parse-gram.y" | |
1024 | { fputs ((yyvaluep->uniqstr), stderr); }; | |
1025 | #line 1026 "parse-gram.c" | |
1026 | break; | |
1027 | case 48: /* "\"identifier:\"" */ | |
1028 | #line 188 "parse-gram.y" | |
1029 | { fprintf (stderr, "%s:", (yyvaluep->uniqstr)); }; | |
1030 | #line 1031 "parse-gram.c" | |
1031 | break; | |
1032 | case 51: /* "\"%{...%}\"" */ | |
1033 | #line 183 "parse-gram.y" | |
1034 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1035 | #line 1036 "parse-gram.c" | |
1036 | break; | |
1037 | case 53: /* "\"type\"" */ | |
1038 | #line 186 "parse-gram.y" | |
1039 | { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; | |
1040 | #line 1041 "parse-gram.c" | |
1041 | break; | |
1042 | case 76: /* "id" */ | |
1043 | #line 194 "parse-gram.y" | |
1044 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1045 | #line 1046 "parse-gram.c" | |
1046 | break; | |
1047 | case 77: /* "id_colon" */ | |
1048 | #line 195 "parse-gram.y" | |
1049 | { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; | |
1050 | #line 1051 "parse-gram.c" | |
1051 | break; | |
1052 | case 78: /* "symbol" */ | |
1053 | #line 194 "parse-gram.y" | |
1054 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1055 | #line 1056 "parse-gram.c" | |
1056 | break; | |
1057 | case 79: /* "string_as_id" */ | |
1058 | #line 194 "parse-gram.y" | |
1059 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1060 | #line 1061 "parse-gram.c" | |
1061 | break; | |
1062 | case 80: /* "string_content" */ | |
1063 | #line 181 "parse-gram.y" | |
1064 | { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); }; | |
1065 | #line 1066 "parse-gram.c" | |
1066 | break; | |
1067 | default: | |
1068 | break; | |
1069 | } | |
1070 | } | |
1071 | ||
1072 | ||
1073 | /*--------------------------------. | |
1074 | | Print this symbol on YYOUTPUT. | | |
1075 | `--------------------------------*/ | |
1076 | ||
1077 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1078 | || defined __cplusplus || defined _MSC_VER) | |
1079 | static void | |
1080 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | |
1081 | #else | |
1082 | static void | |
1083 | yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) | |
1084 | FILE *yyoutput; | |
1085 | int yytype; | |
1086 | YYSTYPE const * const yyvaluep; | |
1087 | YYLTYPE const * const yylocationp; | |
1088 | #endif | |
1089 | { | |
1090 | if (yytype < YYNTOKENS) | |
1091 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | |
1092 | else | |
1093 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | |
1094 | ||
1095 | YY_LOCATION_PRINT (yyoutput, *yylocationp); | |
1096 | YYFPRINTF (yyoutput, ": "); | |
1097 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | |
1098 | YYFPRINTF (yyoutput, ")"); | |
1099 | } | |
1100 | ||
1101 | /*------------------------------------------------------------------. | |
1102 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | |
1103 | | TOP (included). | | |
1104 | `------------------------------------------------------------------*/ | |
1105 | ||
1106 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1107 | || defined __cplusplus || defined _MSC_VER) | |
1108 | static void | |
1109 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) | |
1110 | #else | |
1111 | static void | |
1112 | yy_stack_print (bottom, top) | |
1113 | yytype_int16 *bottom; | |
1114 | yytype_int16 *top; | |
1115 | #endif | |
1116 | { | |
1117 | YYFPRINTF (stderr, "Stack now"); | |
1118 | for (; bottom <= top; ++bottom) | |
1119 | YYFPRINTF (stderr, " %d", *bottom); | |
1120 | YYFPRINTF (stderr, "\n"); | |
1121 | } | |
1122 | ||
1123 | # define YY_STACK_PRINT(Bottom, Top) \ | |
1124 | do { \ | |
1125 | if (yydebug) \ | |
1126 | yy_stack_print ((Bottom), (Top)); \ | |
1127 | } while (YYID (0)) | |
1128 | ||
1129 | ||
1130 | /*------------------------------------------------. | |
1131 | | Report that the YYRULE is going to be reduced. | | |
1132 | `------------------------------------------------*/ | |
1133 | ||
1134 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1135 | || defined __cplusplus || defined _MSC_VER) | |
1136 | static void | |
1137 | yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) | |
1138 | #else | |
1139 | static void | |
1140 | yy_reduce_print (yyvsp, yylsp, yyrule) | |
1141 | YYSTYPE *yyvsp; | |
1142 | YYLTYPE *yylsp; | |
1143 | int yyrule; | |
1144 | #endif | |
1145 | { | |
1146 | int yynrhs = yyr2[yyrule]; | |
1147 | int yyi; | |
1148 | unsigned long int yylno = yyrline[yyrule]; | |
1149 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | |
1150 | yyrule - 1, yylno); | |
1151 | /* The symbols being reduced. */ | |
1152 | for (yyi = 0; yyi < yynrhs; yyi++) | |
1153 | { | |
1154 | fprintf (stderr, " $%d = ", yyi + 1); | |
1155 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | |
1156 | &(yyvsp[(yyi + 1) - (yynrhs)]) | |
1157 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | |
1158 | fprintf (stderr, "\n"); | |
1159 | } | |
1160 | } | |
1161 | ||
1162 | # define YY_REDUCE_PRINT(Rule) \ | |
1163 | do { \ | |
1164 | if (yydebug) \ | |
1165 | yy_reduce_print (yyvsp, yylsp, Rule); \ | |
1166 | } while (YYID (0)) | |
1167 | ||
1168 | /* Nonzero means print parse trace. It is left uninitialized so that | |
1169 | multiple parsers can coexist. */ | |
1170 | int yydebug; | |
1171 | #else /* !YYDEBUG */ | |
1172 | # define YYDPRINTF(Args) | |
1173 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | |
1174 | # define YY_STACK_PRINT(Bottom, Top) | |
1175 | # define YY_REDUCE_PRINT(Rule) | |
1176 | #endif /* !YYDEBUG */ | |
1177 | ||
1178 | ||
1179 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
1180 | #ifndef YYINITDEPTH | |
1181 | # define YYINITDEPTH 200 | |
1182 | #endif | |
1183 | ||
1184 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | |
1185 | if the built-in stack extension method is used). | |
1186 | ||
1187 | Do not make this value too large; the results are undefined if | |
1188 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | |
1189 | evaluated with infinite-precision integer arithmetic. */ | |
1190 | ||
1191 | #ifndef YYMAXDEPTH | |
1192 | # define YYMAXDEPTH 10000 | |
1193 | #endif | |
1194 | ||
1195 | \f | |
1196 | ||
1197 | #if YYERROR_VERBOSE | |
1198 | ||
1199 | # ifndef yystrlen | |
1200 | # if defined __GLIBC__ && defined _STRING_H | |
1201 | # define yystrlen strlen | |
1202 | # else | |
1203 | /* Return the length of YYSTR. */ | |
1204 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1205 | || defined __cplusplus || defined _MSC_VER) | |
1206 | static YYSIZE_T | |
1207 | yystrlen (const char *yystr) | |
1208 | #else | |
1209 | static YYSIZE_T | |
1210 | yystrlen (yystr) | |
1211 | const char *yystr; | |
1212 | #endif | |
1213 | { | |
1214 | YYSIZE_T yylen; | |
1215 | for (yylen = 0; yystr[yylen]; yylen++) | |
1216 | continue; | |
1217 | return yylen; | |
1218 | } | |
1219 | # endif | |
1220 | # endif | |
1221 | ||
1222 | # ifndef yystpcpy | |
1223 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE | |
1224 | # define yystpcpy stpcpy | |
1225 | # else | |
1226 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
1227 | YYDEST. */ | |
1228 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1229 | || defined __cplusplus || defined _MSC_VER) | |
1230 | static char * | |
1231 | yystpcpy (char *yydest, const char *yysrc) | |
1232 | #else | |
1233 | static char * | |
1234 | yystpcpy (yydest, yysrc) | |
1235 | char *yydest; | |
1236 | const char *yysrc; | |
1237 | #endif | |
1238 | { | |
1239 | char *yyd = yydest; | |
1240 | const char *yys = yysrc; | |
1241 | ||
1242 | while ((*yyd++ = *yys++) != '\0') | |
1243 | continue; | |
1244 | ||
1245 | return yyd - 1; | |
1246 | } | |
1247 | # endif | |
1248 | # endif | |
1249 | ||
1250 | # ifndef yytnamerr | |
1251 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | |
1252 | quotes and backslashes, so that it's suitable for yyerror. The | |
1253 | heuristic is that double-quoting is unnecessary unless the string | |
1254 | contains an apostrophe, a comma, or backslash (other than | |
1255 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | |
1256 | null, do not copy; instead, return the length of what the result | |
1257 | would have been. */ | |
1258 | static YYSIZE_T | |
1259 | yytnamerr (char *yyres, const char *yystr) | |
1260 | { | |
1261 | if (*yystr == '"') | |
1262 | { | |
1263 | YYSIZE_T yyn = 0; | |
1264 | char const *yyp = yystr; | |
1265 | ||
1266 | for (;;) | |
1267 | switch (*++yyp) | |
1268 | { | |
1269 | case '\'': | |
1270 | case ',': | |
1271 | goto do_not_strip_quotes; | |
1272 | ||
1273 | case '\\': | |
1274 | if (*++yyp != '\\') | |
1275 | goto do_not_strip_quotes; | |
1276 | /* Fall through. */ | |
1277 | default: | |
1278 | if (yyres) | |
1279 | yyres[yyn] = *yyp; | |
1280 | yyn++; | |
1281 | break; | |
1282 | ||
1283 | case '"': | |
1284 | if (yyres) | |
1285 | yyres[yyn] = '\0'; | |
1286 | return yyn; | |
1287 | } | |
1288 | do_not_strip_quotes: ; | |
1289 | } | |
1290 | ||
1291 | if (! yyres) | |
1292 | return yystrlen (yystr); | |
1293 | ||
1294 | return yystpcpy (yyres, yystr) - yyres; | |
1295 | } | |
1296 | # endif | |
1297 | ||
1298 | /* Copy into YYRESULT an error message about the unexpected token | |
1299 | YYCHAR while in state YYSTATE. Return the number of bytes copied, | |
1300 | including the terminating null byte. If YYRESULT is null, do not | |
1301 | copy anything; just return the number of bytes that would be | |
1302 | copied. As a special case, return 0 if an ordinary "syntax error" | |
1303 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during | |
1304 | size calculation. */ | |
1305 | static YYSIZE_T | |
1306 | yysyntax_error (char *yyresult, int yystate, int yychar) | |
1307 | { | |
1308 | int yyn = yypact[yystate]; | |
1309 | ||
1310 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) | |
1311 | return 0; | |
1312 | else | |
1313 | { | |
1314 | int yytype = YYTRANSLATE (yychar); | |
1315 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); | |
1316 | YYSIZE_T yysize = yysize0; | |
1317 | YYSIZE_T yysize1; | |
1318 | int yysize_overflow = 0; | |
1319 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | |
1320 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | |
1321 | int yyx; | |
1322 | ||
1323 | # if 0 | |
1324 | /* This is so xgettext sees the translatable formats that are | |
1325 | constructed on the fly. */ | |
1326 | YY_("syntax error, unexpected %s"); | |
1327 | YY_("syntax error, unexpected %s, expecting %s"); | |
1328 | YY_("syntax error, unexpected %s, expecting %s or %s"); | |
1329 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | |
1330 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | |
1331 | # endif | |
1332 | char *yyfmt; | |
1333 | char const *yyf; | |
1334 | static char const yyunexpected[] = "syntax error, unexpected %s"; | |
1335 | static char const yyexpecting[] = ", expecting %s"; | |
1336 | static char const yyor[] = " or %s"; | |
1337 | char yyformat[sizeof yyunexpected | |
1338 | + sizeof yyexpecting - 1 | |
1339 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | |
1340 | * (sizeof yyor - 1))]; | |
1341 | char const *yyprefix = yyexpecting; | |
1342 | ||
1343 | /* Start YYX at -YYN if negative to avoid negative indexes in | |
1344 | YYCHECK. */ | |
1345 | int yyxbegin = yyn < 0 ? -yyn : 0; | |
1346 | ||
1347 | /* Stay within bounds of both yycheck and yytname. */ | |
1348 | int yychecklim = YYLAST - yyn + 1; | |
1349 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | |
1350 | int yycount = 1; | |
1351 | ||
1352 | yyarg[0] = yytname[yytype]; | |
1353 | yyfmt = yystpcpy (yyformat, yyunexpected); | |
1354 | ||
1355 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | |
1356 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | |
1357 | { | |
1358 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | |
1359 | { | |
1360 | yycount = 1; | |
1361 | yysize = yysize0; | |
1362 | yyformat[sizeof yyunexpected - 1] = '\0'; | |
1363 | break; | |
1364 | } | |
1365 | yyarg[yycount++] = yytname[yyx]; | |
1366 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | |
1367 | yysize_overflow |= (yysize1 < yysize); | |
1368 | yysize = yysize1; | |
1369 | yyfmt = yystpcpy (yyfmt, yyprefix); | |
1370 | yyprefix = yyor; | |
1371 | } | |
1372 | ||
1373 | yyf = YY_(yyformat); | |
1374 | yysize1 = yysize + yystrlen (yyf); | |
1375 | yysize_overflow |= (yysize1 < yysize); | |
1376 | yysize = yysize1; | |
1377 | ||
1378 | if (yysize_overflow) | |
1379 | return YYSIZE_MAXIMUM; | |
1380 | ||
1381 | if (yyresult) | |
1382 | { | |
1383 | /* Avoid sprintf, as that infringes on the user's name space. | |
1384 | Don't have undefined behavior even if the translation | |
1385 | produced a string with the wrong number of "%s"s. */ | |
1386 | char *yyp = yyresult; | |
1387 | int yyi = 0; | |
1388 | while ((*yyp = *yyf) != '\0') | |
1389 | { | |
1390 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) | |
1391 | { | |
1392 | yyp += yytnamerr (yyp, yyarg[yyi++]); | |
1393 | yyf += 2; | |
1394 | } | |
1395 | else | |
1396 | { | |
1397 | yyp++; | |
1398 | yyf++; | |
1399 | } | |
1400 | } | |
1401 | } | |
1402 | return yysize; | |
1403 | } | |
1404 | } | |
1405 | #endif /* YYERROR_VERBOSE */ | |
1406 | \f | |
1407 | ||
1408 | /*-----------------------------------------------. | |
1409 | | Release the memory associated to this symbol. | | |
1410 | `-----------------------------------------------*/ | |
1411 | ||
1412 | /*ARGSUSED*/ | |
1413 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1414 | || defined __cplusplus || defined _MSC_VER) | |
1415 | static void | |
1416 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) | |
1417 | #else | |
1418 | static void | |
1419 | yydestruct (yymsg, yytype, yyvaluep, yylocationp) | |
1420 | const char *yymsg; | |
1421 | int yytype; | |
1422 | YYSTYPE *yyvaluep; | |
1423 | YYLTYPE *yylocationp; | |
1424 | #endif | |
1425 | { | |
1426 | YYUSE (yyvaluep); | |
1427 | YYUSE (yylocationp); | |
1428 | ||
1429 | if (!yymsg) | |
1430 | yymsg = "Deleting"; | |
1431 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | |
1432 | ||
1433 | switch (yytype) | |
1434 | { | |
1435 | ||
1436 | default: | |
1437 | break; | |
1438 | } | |
1439 | } | |
1440 | \f | |
1441 | ||
1442 | /* Prevent warnings from -Wmissing-prototypes. */ | |
1443 | ||
1444 | #ifdef YYPARSE_PARAM | |
1445 | #if defined __STDC__ || defined __cplusplus | |
1446 | int yyparse (void *YYPARSE_PARAM); | |
1447 | #else | |
1448 | int yyparse (); | |
1449 | #endif | |
1450 | #else /* ! YYPARSE_PARAM */ | |
1451 | #if defined __STDC__ || defined __cplusplus | |
1452 | int yyparse (void); | |
1453 | #else | |
1454 | int yyparse (); | |
1455 | #endif | |
1456 | #endif /* ! YYPARSE_PARAM */ | |
1457 | ||
1458 | ||
1459 | ||
1460 | ||
1461 | ||
1462 | ||
1463 | /*----------. | |
1464 | | yyparse. | | |
1465 | `----------*/ | |
1466 | ||
1467 | #ifdef YYPARSE_PARAM | |
1468 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1469 | || defined __cplusplus || defined _MSC_VER) | |
1470 | int | |
1471 | yyparse (void *YYPARSE_PARAM) | |
1472 | #else | |
1473 | int | |
1474 | yyparse (YYPARSE_PARAM) | |
1475 | void *YYPARSE_PARAM; | |
1476 | #endif | |
1477 | #else /* ! YYPARSE_PARAM */ | |
1478 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1479 | || defined __cplusplus || defined _MSC_VER) | |
1480 | int | |
1481 | yyparse (void) | |
1482 | #else | |
1483 | int | |
1484 | yyparse () | |
1485 | ||
1486 | #endif | |
1487 | #endif | |
1488 | { | |
1489 | /* The lookahead symbol. */ | |
1490 | int yychar; | |
1491 | ||
1492 | /* The semantic value of the lookahead symbol. */ | |
1493 | YYSTYPE yylval; | |
1494 | ||
1495 | /* Number of syntax errors so far. */ | |
1496 | int yynerrs; | |
1497 | /* Location data for the lookahead symbol. */ | |
1498 | YYLTYPE yylloc; | |
1499 | ||
1500 | int yystate; | |
1501 | int yyn; | |
1502 | int yyresult; | |
1503 | /* Number of tokens to shift before error messages enabled. */ | |
1504 | int yyerrstatus; | |
1505 | /* Lookahead token as an internal (translated) token number. */ | |
1506 | int yytoken = 0; | |
1507 | #if YYERROR_VERBOSE | |
1508 | /* Buffer for error messages, and its allocated size. */ | |
1509 | char yymsgbuf[128]; | |
1510 | char *yymsg = yymsgbuf; | |
1511 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | |
1512 | #endif | |
1513 | ||
1514 | /* Three stacks and their tools: | |
1515 | `yyss': related to states, | |
1516 | `yyvs': related to semantic values, | |
1517 | `yyls': related to locations. | |
1518 | ||
1519 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
1520 | to reallocate them elsewhere. */ | |
1521 | ||
1522 | /* The state stack. */ | |
1523 | yytype_int16 yyssa[YYINITDEPTH]; | |
1524 | yytype_int16 *yyss = yyssa; | |
1525 | yytype_int16 *yyssp; | |
1526 | ||
1527 | /* The semantic value stack. */ | |
1528 | YYSTYPE yyvsa[YYINITDEPTH]; | |
1529 | YYSTYPE *yyvs = yyvsa; | |
1530 | YYSTYPE *yyvsp; | |
1531 | ||
1532 | /* The location stack. */ | |
1533 | YYLTYPE yylsa[YYINITDEPTH]; | |
1534 | YYLTYPE *yyls = yylsa; | |
1535 | YYLTYPE *yylsp; | |
1536 | /* The locations where the error started and ended. */ | |
1537 | YYLTYPE yyerror_range[2]; | |
1538 | ||
1539 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) | |
1540 | ||
1541 | YYSIZE_T yystacksize = YYINITDEPTH; | |
1542 | ||
1543 | /* The variables used to return semantic value and location from the | |
1544 | action routines. */ | |
1545 | YYSTYPE yyval; | |
1546 | YYLTYPE yyloc; | |
1547 | ||
1548 | /* The number of symbols on the RHS of the reduced rule. | |
1549 | Keep to zero when no symbol should be popped. */ | |
1550 | int yylen = 0; | |
1551 | ||
1552 | YYDPRINTF ((stderr, "Starting parse\n")); | |
1553 | ||
1554 | yystate = 0; | |
1555 | yyerrstatus = 0; | |
1556 | yynerrs = 0; | |
1557 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
1558 | ||
1559 | /* Initialize stack pointers. | |
1560 | Waste one element of value and location stack | |
1561 | so that they stay on the same level as the state stack. | |
1562 | The wasted elements are never initialized. */ | |
1563 | ||
1564 | yyssp = yyss; | |
1565 | yyvsp = yyvs; | |
1566 | yylsp = yyls; | |
1567 | #if YYLTYPE_IS_TRIVIAL | |
1568 | /* Initialize the default location before parsing starts. */ | |
1569 | yylloc.first_line = yylloc.last_line = 1; | |
1570 | yylloc.first_column = yylloc.last_column = 0; | |
1571 | #endif | |
1572 | ||
1573 | ||
1574 | /* User initialization code. */ | |
1575 | #line 88 "parse-gram.y" | |
1576 | { | |
1577 | /* Bison's grammar can initial empty locations, hence a default | |
1578 | location is needed. */ | |
1579 | boundary_set (&yylloc.start, current_file, 1, 0); | |
1580 | boundary_set (&yylloc.end, current_file, 1, 0); | |
1581 | } | |
1582 | /* Line 1085 of yacc.c. */ | |
1583 | #line 1584 "parse-gram.c" | |
1584 | yylsp[0] = yylloc; | |
1585 | goto yysetstate; | |
1586 | ||
1587 | /*------------------------------------------------------------. | |
1588 | | yynewstate -- Push a new state, which is found in yystate. | | |
1589 | `------------------------------------------------------------*/ | |
1590 | yynewstate: | |
1591 | /* In all cases, when you get here, the value and location stacks | |
1592 | have just been pushed. So pushing a state here evens the stacks. */ | |
1593 | yyssp++; | |
1594 | ||
1595 | yysetstate: | |
1596 | *yyssp = yystate; | |
1597 | ||
1598 | if (yyss + yystacksize - 1 <= yyssp) | |
1599 | { | |
1600 | /* Get the current used size of the three stacks, in elements. */ | |
1601 | YYSIZE_T yysize = yyssp - yyss + 1; | |
1602 | ||
1603 | #ifdef yyoverflow | |
1604 | { | |
1605 | /* Give user a chance to reallocate the stack. Use copies of | |
1606 | these so that the &'s don't force the real ones into | |
1607 | memory. */ | |
1608 | YYSTYPE *yyvs1 = yyvs; | |
1609 | yytype_int16 *yyss1 = yyss; | |
1610 | YYLTYPE *yyls1 = yyls; | |
1611 | ||
1612 | /* Each stack pointer address is followed by the size of the | |
1613 | data in use in that stack, in bytes. This used to be a | |
1614 | conditional around just the two extra args, but that might | |
1615 | be undefined if yyoverflow is a macro. */ | |
1616 | yyoverflow (YY_("memory exhausted"), | |
1617 | &yyss1, yysize * sizeof (*yyssp), | |
1618 | &yyvs1, yysize * sizeof (*yyvsp), | |
1619 | &yyls1, yysize * sizeof (*yylsp), | |
1620 | &yystacksize); | |
1621 | yyls = yyls1; | |
1622 | yyss = yyss1; | |
1623 | yyvs = yyvs1; | |
1624 | } | |
1625 | #else /* no yyoverflow */ | |
1626 | # ifndef YYSTACK_RELOCATE | |
1627 | goto yyexhaustedlab; | |
1628 | # else | |
1629 | /* Extend the stack our own way. */ | |
1630 | if (YYMAXDEPTH <= yystacksize) | |
1631 | goto yyexhaustedlab; | |
1632 | yystacksize *= 2; | |
1633 | if (YYMAXDEPTH < yystacksize) | |
1634 | yystacksize = YYMAXDEPTH; | |
1635 | ||
1636 | { | |
1637 | yytype_int16 *yyss1 = yyss; | |
1638 | union yyalloc *yyptr = | |
1639 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
1640 | if (! yyptr) | |
1641 | goto yyexhaustedlab; | |
1642 | YYSTACK_RELOCATE (yyss); | |
1643 | YYSTACK_RELOCATE (yyvs); | |
1644 | YYSTACK_RELOCATE (yyls); | |
1645 | # undef YYSTACK_RELOCATE | |
1646 | if (yyss1 != yyssa) | |
1647 | YYSTACK_FREE (yyss1); | |
1648 | } | |
1649 | # endif | |
1650 | #endif /* no yyoverflow */ | |
1651 | ||
1652 | yyssp = yyss + yysize - 1; | |
1653 | yyvsp = yyvs + yysize - 1; | |
1654 | yylsp = yyls + yysize - 1; | |
1655 | ||
1656 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | |
1657 | (unsigned long int) yystacksize)); | |
1658 | ||
1659 | if (yyss + yystacksize - 1 <= yyssp) | |
1660 | YYABORT; | |
1661 | } | |
1662 | ||
1663 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | |
1664 | ||
1665 | goto yybackup; | |
1666 | ||
1667 | /*-----------. | |
1668 | | yybackup. | | |
1669 | `-----------*/ | |
1670 | yybackup: | |
1671 | ||
1672 | /* Do appropriate processing given the current state. Read a | |
1673 | lookahead token if we need one and don't already have one. */ | |
1674 | ||
1675 | /* First try to decide what to do without reference to lookahead token. */ | |
1676 | yyn = yypact[yystate]; | |
1677 | if (yyn == YYPACT_NINF) | |
1678 | goto yydefault; | |
1679 | ||
1680 | /* Not known => get a lookahead token if don't already have one. */ | |
1681 | ||
1682 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | |
1683 | if (yychar == YYEMPTY) | |
1684 | { | |
1685 | YYDPRINTF ((stderr, "Reading a token: ")); | |
1686 | yychar = YYLEX; | |
1687 | } | |
1688 | ||
1689 | if (yychar <= YYEOF) | |
1690 | { | |
1691 | yychar = yytoken = YYEOF; | |
1692 | YYDPRINTF ((stderr, "Now at end of input.\n")); | |
1693 | } | |
1694 | else | |
1695 | { | |
1696 | yytoken = YYTRANSLATE (yychar); | |
1697 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | |
1698 | } | |
1699 | ||
1700 | /* If the proper action on seeing token YYTOKEN is to reduce or to | |
1701 | detect an error, take that action. */ | |
1702 | yyn += yytoken; | |
1703 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | |
1704 | goto yydefault; | |
1705 | yyn = yytable[yyn]; | |
1706 | if (yyn <= 0) | |
1707 | { | |
1708 | if (yyn == 0 || yyn == YYTABLE_NINF) | |
1709 | goto yyerrlab; | |
1710 | yyn = -yyn; | |
1711 | goto yyreduce; | |
1712 | } | |
1713 | ||
1714 | if (yyn == YYFINAL) | |
1715 | YYACCEPT; | |
1716 | ||
1717 | /* Count tokens shifted since error; after three, turn off error | |
1718 | status. */ | |
1719 | if (yyerrstatus) | |
1720 | yyerrstatus--; | |
1721 | ||
1722 | /* Shift the lookahead token. */ | |
1723 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | |
1724 | ||
1725 | /* Discard the shifted token unless it is eof. */ | |
1726 | if (yychar != YYEOF) | |
1727 | yychar = YYEMPTY; | |
1728 | ||
1729 | yystate = yyn; | |
1730 | *++yyvsp = yylval; | |
1731 | *++yylsp = yylloc; | |
1732 | goto yynewstate; | |
1733 | ||
1734 | ||
1735 | /*-----------------------------------------------------------. | |
1736 | | yydefault -- do the default action for the current state. | | |
1737 | `-----------------------------------------------------------*/ | |
1738 | yydefault: | |
1739 | yyn = yydefact[yystate]; | |
1740 | if (yyn == 0) | |
1741 | goto yyerrlab; | |
1742 | goto yyreduce; | |
1743 | ||
1744 | ||
1745 | /*-----------------------------. | |
1746 | | yyreduce -- Do a reduction. | | |
1747 | `-----------------------------*/ | |
1748 | yyreduce: | |
1749 | /* yyn is the number of a rule to reduce with. */ | |
1750 | yylen = yyr2[yyn]; | |
1751 | ||
1752 | /* If YYLEN is nonzero, implement the default value of the action: | |
1753 | `$$ = $1'. | |
1754 | ||
1755 | Otherwise, the following line sets YYVAL to garbage. | |
1756 | This behavior is undocumented and Bison | |
1757 | users should not rely upon it. Assigning to YYVAL | |
1758 | unconditionally makes the parser a bit smaller, and it avoids a | |
1759 | GCC warning that YYVAL may be used uninitialized. */ | |
1760 | yyval = yyvsp[1-yylen]; | |
1761 | ||
1762 | /* Default location. */ | |
1763 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | |
1764 | YY_REDUCE_PRINT (yyn); | |
1765 | switch (yyn) | |
1766 | { | |
1767 | case 6: | |
1768 | #line 217 "parse-gram.y" | |
1769 | { prologue_augment (translate_code ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])), | |
1770 | (yylsp[(1) - (1)])); } | |
1771 | break; | |
1772 | ||
1773 | case 7: | |
1774 | #line 220 "parse-gram.y" | |
1775 | { | |
1776 | after_definitions = true; | |
1777 | /* Remove the '{', and replace the '}' with '\n'. */ | |
1778 | (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n'; | |
1779 | muscle_code_grow ("after_definitions", (yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])); | |
1780 | } | |
1781 | break; | |
1782 | ||
1783 | case 8: | |
1784 | #line 227 "parse-gram.y" | |
1785 | { | |
1786 | before_definitions = true; | |
1787 | /* Remove the '{', and replace the '}' with '\n'. */ | |
1788 | (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n'; | |
1789 | muscle_code_grow ("before_definitions", (yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])); | |
1790 | } | |
1791 | break; | |
1792 | ||
1793 | case 9: | |
1794 | #line 233 "parse-gram.y" | |
1795 | { debug_flag = true; } | |
1796 | break; | |
1797 | ||
1798 | case 10: | |
1799 | #line 235 "parse-gram.y" | |
1800 | { | |
1801 | static char one[] = "1"; | |
1802 | muscle_insert ((yyvsp[(2) - (2)].chars), one); | |
1803 | } | |
1804 | break; | |
1805 | ||
1806 | case 11: | |
1807 | #line 239 "parse-gram.y" | |
1808 | { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); } | |
1809 | break; | |
1810 | ||
1811 | case 12: | |
1812 | #line 240 "parse-gram.y" | |
1813 | { defines_flag = true; } | |
1814 | break; | |
1815 | ||
1816 | case 13: | |
1817 | #line 241 "parse-gram.y" | |
1818 | { error_verbose = true; } | |
1819 | break; | |
1820 | ||
1821 | case 14: | |
1822 | #line 242 "parse-gram.y" | |
1823 | { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } | |
1824 | break; | |
1825 | ||
1826 | case 15: | |
1827 | #line 243 "parse-gram.y" | |
1828 | { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } | |
1829 | break; | |
1830 | ||
1831 | case 16: | |
1832 | #line 244 "parse-gram.y" | |
1833 | { spec_file_prefix = (yyvsp[(3) - (3)].chars); } | |
1834 | break; | |
1835 | ||
1836 | case 17: | |
1837 | #line 246 "parse-gram.y" | |
1838 | { | |
1839 | nondeterministic_parser = true; | |
1840 | glr_parser = true; | |
1841 | } | |
1842 | break; | |
1843 | ||
1844 | case 18: | |
1845 | #line 251 "parse-gram.y" | |
1846 | { | |
1847 | muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)])); | |
1848 | } | |
1849 | break; | |
1850 | ||
1851 | case 19: | |
1852 | #line 254 "parse-gram.y" | |
1853 | { add_param ("lex_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); } | |
1854 | break; | |
1855 | ||
1856 | case 20: | |
1857 | #line 255 "parse-gram.y" | |
1858 | { locations_flag = true; } | |
1859 | break; | |
1860 | ||
1861 | case 21: | |
1862 | #line 256 "parse-gram.y" | |
1863 | { spec_name_prefix = (yyvsp[(3) - (3)].chars); } | |
1864 | break; | |
1865 | ||
1866 | case 22: | |
1867 | #line 257 "parse-gram.y" | |
1868 | { no_lines_flag = true; } | |
1869 | break; | |
1870 | ||
1871 | case 23: | |
1872 | #line 258 "parse-gram.y" | |
1873 | { nondeterministic_parser = true; } | |
1874 | break; | |
1875 | ||
1876 | case 24: | |
1877 | #line 259 "parse-gram.y" | |
1878 | { spec_outfile = (yyvsp[(3) - (3)].chars); } | |
1879 | break; | |
1880 | ||
1881 | case 25: | |
1882 | #line 260 "parse-gram.y" | |
1883 | { add_param ("parse_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); } | |
1884 | break; | |
1885 | ||
1886 | case 26: | |
1887 | #line 261 "parse-gram.y" | |
1888 | { pure_parser = true; } | |
1889 | break; | |
1890 | ||
1891 | case 27: | |
1892 | #line 262 "parse-gram.y" | |
1893 | { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } | |
1894 | break; | |
1895 | ||
1896 | case 28: | |
1897 | #line 263 "parse-gram.y" | |
1898 | { skeleton = (yyvsp[(2) - (2)].chars); } | |
1899 | break; | |
1900 | ||
1901 | case 29: | |
1902 | #line 264 "parse-gram.y" | |
1903 | { token_table_flag = true; } | |
1904 | break; | |
1905 | ||
1906 | case 30: | |
1907 | #line 265 "parse-gram.y" | |
1908 | { report_flag = report_states; } | |
1909 | break; | |
1910 | ||
1911 | case 31: | |
1912 | #line 266 "parse-gram.y" | |
1913 | { yacc_flag = true; } | |
1914 | break; | |
1915 | ||
1916 | case 35: | |
1917 | #line 274 "parse-gram.y" | |
1918 | { | |
1919 | grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); | |
1920 | } | |
1921 | break; | |
1922 | ||
1923 | case 36: | |
1924 | #line 278 "parse-gram.y" | |
1925 | { | |
1926 | symbol_list *list; | |
1927 | const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), (yylsp[(2) - (3)])); | |
1928 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
1929 | symbol_destructor_set (list->sym, action, (yylsp[(2) - (3)])); | |
1930 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
1931 | } | |
1932 | break; | |
1933 | ||
1934 | case 37: | |
1935 | #line 286 "parse-gram.y" | |
1936 | { | |
1937 | symbol_list *list; | |
1938 | const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), (yylsp[(2) - (3)])); | |
1939 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
1940 | symbol_printer_set (list->sym, action, (yylsp[(2) - (3)])); | |
1941 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
1942 | } | |
1943 | break; | |
1944 | ||
1945 | case 38: | |
1946 | #line 294 "parse-gram.y" | |
1947 | { | |
1948 | default_prec = true; | |
1949 | } | |
1950 | break; | |
1951 | ||
1952 | case 39: | |
1953 | #line 298 "parse-gram.y" | |
1954 | { | |
1955 | default_prec = false; | |
1956 | } | |
1957 | break; | |
1958 | ||
1959 | case 40: | |
1960 | #line 311 "parse-gram.y" | |
1961 | {} | |
1962 | break; | |
1963 | ||
1964 | case 41: | |
1965 | #line 312 "parse-gram.y" | |
1966 | { muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
1967 | break; | |
1968 | ||
1969 | case 42: | |
1970 | #line 317 "parse-gram.y" | |
1971 | { | |
1972 | char const *body = (yyvsp[(3) - (3)].chars); | |
1973 | ||
1974 | if (typed) | |
1975 | { | |
1976 | /* Concatenate the union bodies, turning the first one's | |
1977 | trailing '}' into '\n', and omitting the second one's '{'. */ | |
1978 | char *code = muscle_find ("stype"); | |
1979 | code[strlen (code) - 1] = '\n'; | |
1980 | body++; | |
1981 | } | |
1982 | ||
1983 | typed = true; | |
1984 | muscle_code_grow ("stype", body, (yylsp[(3) - (3)])); | |
1985 | } | |
1986 | break; | |
1987 | ||
1988 | case 43: | |
1989 | #line 338 "parse-gram.y" | |
1990 | { current_class = nterm_sym; } | |
1991 | break; | |
1992 | ||
1993 | case 44: | |
1994 | #line 339 "parse-gram.y" | |
1995 | { | |
1996 | current_class = unknown_sym; | |
1997 | current_type = NULL; | |
1998 | } | |
1999 | break; | |
2000 | ||
2001 | case 45: | |
2002 | #line 343 "parse-gram.y" | |
2003 | { current_class = token_sym; } | |
2004 | break; | |
2005 | ||
2006 | case 46: | |
2007 | #line 344 "parse-gram.y" | |
2008 | { | |
2009 | current_class = unknown_sym; | |
2010 | current_type = NULL; | |
2011 | } | |
2012 | break; | |
2013 | ||
2014 | case 47: | |
2015 | #line 349 "parse-gram.y" | |
2016 | { | |
2017 | symbol_list *list; | |
2018 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2019 | symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); | |
2020 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2021 | } | |
2022 | break; | |
2023 | ||
2024 | case 48: | |
2025 | #line 359 "parse-gram.y" | |
2026 | { | |
2027 | symbol_list *list; | |
2028 | ++current_prec; | |
2029 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2030 | { | |
2031 | symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)])); | |
2032 | symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); | |
2033 | } | |
2034 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2035 | current_type = NULL; | |
2036 | } | |
2037 | break; | |
2038 | ||
2039 | case 49: | |
2040 | #line 373 "parse-gram.y" | |
2041 | { (yyval.assoc) = left_assoc; } | |
2042 | break; | |
2043 | ||
2044 | case 50: | |
2045 | #line 374 "parse-gram.y" | |
2046 | { (yyval.assoc) = right_assoc; } | |
2047 | break; | |
2048 | ||
2049 | case 51: | |
2050 | #line 375 "parse-gram.y" | |
2051 | { (yyval.assoc) = non_assoc; } | |
2052 | break; | |
2053 | ||
2054 | case 52: | |
2055 | #line 379 "parse-gram.y" | |
2056 | { current_type = NULL; } | |
2057 | break; | |
2058 | ||
2059 | case 53: | |
2060 | #line 380 "parse-gram.y" | |
2061 | { current_type = (yyvsp[(1) - (1)].uniqstr); } | |
2062 | break; | |
2063 | ||
2064 | case 54: | |
2065 | #line 385 "parse-gram.y" | |
2066 | { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } | |
2067 | break; | |
2068 | ||
2069 | case 55: | |
2070 | #line 386 "parse-gram.y" | |
2071 | { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } | |
2072 | break; | |
2073 | ||
2074 | case 56: | |
2075 | #line 392 "parse-gram.y" | |
2076 | { | |
2077 | current_type = (yyvsp[(1) - (1)].uniqstr); | |
2078 | } | |
2079 | break; | |
2080 | ||
2081 | case 57: | |
2082 | #line 396 "parse-gram.y" | |
2083 | { | |
2084 | symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); | |
2085 | symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); | |
2086 | } | |
2087 | break; | |
2088 | ||
2089 | case 58: | |
2090 | #line 401 "parse-gram.y" | |
2091 | { | |
2092 | symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); | |
2093 | symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); | |
2094 | symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); | |
2095 | } | |
2096 | break; | |
2097 | ||
2098 | case 59: | |
2099 | #line 407 "parse-gram.y" | |
2100 | { | |
2101 | symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); | |
2102 | symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); | |
2103 | symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc)); | |
2104 | } | |
2105 | break; | |
2106 | ||
2107 | case 60: | |
2108 | #line 413 "parse-gram.y" | |
2109 | { | |
2110 | symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); | |
2111 | symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); | |
2112 | symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)])); | |
2113 | symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc)); | |
2114 | } | |
2115 | break; | |
2116 | ||
2117 | case 67: | |
2118 | #line 443 "parse-gram.y" | |
2119 | { | |
2120 | yyerrok; | |
2121 | } | |
2122 | break; | |
2123 | ||
2124 | case 68: | |
2125 | #line 449 "parse-gram.y" | |
2126 | { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } | |
2127 | break; | |
2128 | ||
2129 | case 70: | |
2130 | #line 453 "parse-gram.y" | |
2131 | { grammar_current_rule_end ((yylsp[(1) - (1)])); } | |
2132 | break; | |
2133 | ||
2134 | case 71: | |
2135 | #line 454 "parse-gram.y" | |
2136 | { grammar_current_rule_end ((yylsp[(3) - (3)])); } | |
2137 | break; | |
2138 | ||
2139 | case 73: | |
2140 | #line 460 "parse-gram.y" | |
2141 | { grammar_current_rule_begin (current_lhs, current_lhs_location); } | |
2142 | break; | |
2143 | ||
2144 | case 74: | |
2145 | #line 462 "parse-gram.y" | |
2146 | { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } | |
2147 | break; | |
2148 | ||
2149 | case 75: | |
2150 | #line 464 "parse-gram.y" | |
2151 | { grammar_current_rule_action_append (gram_last_string, | |
2152 | gram_last_braced_code_loc); } | |
2153 | break; | |
2154 | ||
2155 | case 76: | |
2156 | #line 467 "parse-gram.y" | |
2157 | { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } | |
2158 | break; | |
2159 | ||
2160 | case 77: | |
2161 | #line 469 "parse-gram.y" | |
2162 | { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } | |
2163 | break; | |
2164 | ||
2165 | case 78: | |
2166 | #line 471 "parse-gram.y" | |
2167 | { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } | |
2168 | break; | |
2169 | ||
2170 | case 79: | |
2171 | #line 484 "parse-gram.y" | |
2172 | { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2173 | break; | |
2174 | ||
2175 | case 80: | |
2176 | #line 486 "parse-gram.y" | |
2177 | { | |
2178 | (yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)])); | |
2179 | symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); | |
2180 | symbol_user_token_number_set ((yyval.symbol), (yyvsp[(1) - (1)].character), (yylsp[(1) - (1)])); | |
2181 | } | |
2182 | break; | |
2183 | ||
2184 | case 81: | |
2185 | #line 494 "parse-gram.y" | |
2186 | { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2187 | break; | |
2188 | ||
2189 | case 84: | |
2190 | #line 506 "parse-gram.y" | |
2191 | { | |
2192 | (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); | |
2193 | symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); | |
2194 | } | |
2195 | break; | |
2196 | ||
2197 | case 85: | |
2198 | #line 515 "parse-gram.y" | |
2199 | { (yyval.chars) = (yyvsp[(1) - (1)].chars); } | |
2200 | break; | |
2201 | ||
2202 | case 87: | |
2203 | #line 522 "parse-gram.y" | |
2204 | { | |
2205 | muscle_code_grow ("epilogue", translate_code ((yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)])); | |
2206 | gram_scanner_last_string_free (); | |
2207 | } | |
2208 | break; | |
2209 | ||
2210 | ||
2211 | /* Line 1274 of yacc.c. */ | |
2212 | #line 2213 "parse-gram.c" | |
2213 | default: break; | |
2214 | } | |
2215 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | |
2216 | ||
2217 | YYPOPSTACK (yylen); | |
2218 | yylen = 0; | |
2219 | YY_STACK_PRINT (yyss, yyssp); | |
2220 | ||
2221 | *++yyvsp = yyval; | |
2222 | *++yylsp = yyloc; | |
2223 | ||
2224 | /* Now `shift' the result of the reduction. Determine what state | |
2225 | that goes to, based on the state we popped back to and the rule | |
2226 | number reduced by. */ | |
2227 | ||
2228 | yyn = yyr1[yyn]; | |
2229 | ||
2230 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | |
2231 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
2232 | yystate = yytable[yystate]; | |
2233 | else | |
2234 | yystate = yydefgoto[yyn - YYNTOKENS]; | |
2235 | ||
2236 | goto yynewstate; | |
2237 | ||
2238 | ||
2239 | /*------------------------------------. | |
2240 | | yyerrlab -- here on detecting error | | |
2241 | `------------------------------------*/ | |
2242 | yyerrlab: | |
2243 | /* If not already recovering from an error, report this error. */ | |
2244 | if (!yyerrstatus) | |
2245 | { | |
2246 | ++yynerrs; | |
2247 | #if ! YYERROR_VERBOSE | |
2248 | yyerror (YY_("syntax error")); | |
2249 | #else | |
2250 | { | |
2251 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); | |
2252 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) | |
2253 | { | |
2254 | YYSIZE_T yyalloc = 2 * yysize; | |
2255 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) | |
2256 | yyalloc = YYSTACK_ALLOC_MAXIMUM; | |
2257 | if (yymsg != yymsgbuf) | |
2258 | YYSTACK_FREE (yymsg); | |
2259 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); | |
2260 | if (yymsg) | |
2261 | yymsg_alloc = yyalloc; | |
2262 | else | |
2263 | { | |
2264 | yymsg = yymsgbuf; | |
2265 | yymsg_alloc = sizeof yymsgbuf; | |
2266 | } | |
2267 | } | |
2268 | ||
2269 | if (0 < yysize && yysize <= yymsg_alloc) | |
2270 | { | |
2271 | (void) yysyntax_error (yymsg, yystate, yychar); | |
2272 | yyerror (yymsg); | |
2273 | } | |
2274 | else | |
2275 | { | |
2276 | yyerror (YY_("syntax error")); | |
2277 | if (yysize != 0) | |
2278 | goto yyexhaustedlab; | |
2279 | } | |
2280 | } | |
2281 | #endif | |
2282 | } | |
2283 | ||
2284 | yyerror_range[0] = yylloc; | |
2285 | ||
2286 | if (yyerrstatus == 3) | |
2287 | { | |
2288 | /* If just tried and failed to reuse lookahead token after an | |
2289 | error, discard it. */ | |
2290 | ||
2291 | if (yychar <= YYEOF) | |
2292 | { | |
2293 | /* Return failure if at end of input. */ | |
2294 | if (yychar == YYEOF) | |
2295 | YYABORT; | |
2296 | } | |
2297 | else | |
2298 | { | |
2299 | yydestruct ("Error: discarding", | |
2300 | yytoken, &yylval, &yylloc); | |
2301 | yychar = YYEMPTY; | |
2302 | } | |
2303 | } | |
2304 | ||
2305 | /* Else will try to reuse lookahead token after shifting the error | |
2306 | token. */ | |
2307 | goto yyerrlab1; | |
2308 | ||
2309 | ||
2310 | /*---------------------------------------------------. | |
2311 | | yyerrorlab -- error raised explicitly by YYERROR. | | |
2312 | `---------------------------------------------------*/ | |
2313 | yyerrorlab: | |
2314 | ||
2315 | /* Pacify compilers like GCC when the user code never invokes | |
2316 | YYERROR and the label yyerrorlab therefore never appears in user | |
2317 | code. */ | |
2318 | if (/*CONSTCOND*/ 0) | |
2319 | goto yyerrorlab; | |
2320 | ||
2321 | yyerror_range[0] = yylsp[1-yylen]; | |
2322 | /* Do not reclaim the symbols of the rule which action triggered | |
2323 | this YYERROR. */ | |
2324 | YYPOPSTACK (yylen); | |
2325 | yylen = 0; | |
2326 | YY_STACK_PRINT (yyss, yyssp); | |
2327 | yystate = *yyssp; | |
2328 | goto yyerrlab1; | |
2329 | ||
2330 | ||
2331 | /*-------------------------------------------------------------. | |
2332 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | |
2333 | `-------------------------------------------------------------*/ | |
2334 | yyerrlab1: | |
2335 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | |
2336 | ||
2337 | for (;;) | |
2338 | { | |
2339 | yyn = yypact[yystate]; | |
2340 | if (yyn != YYPACT_NINF) | |
2341 | { | |
2342 | yyn += YYTERROR; | |
2343 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | |
2344 | { | |
2345 | yyn = yytable[yyn]; | |
2346 | if (0 < yyn) | |
2347 | break; | |
2348 | } | |
2349 | } | |
2350 | ||
2351 | /* Pop the current state because it cannot handle the error token. */ | |
2352 | if (yyssp == yyss) | |
2353 | YYABORT; | |
2354 | ||
2355 | yyerror_range[0] = *yylsp; | |
2356 | yydestruct ("Error: popping", | |
2357 | yystos[yystate], yyvsp, yylsp); | |
2358 | YYPOPSTACK (1); | |
2359 | yystate = *yyssp; | |
2360 | YY_STACK_PRINT (yyss, yyssp); | |
2361 | } | |
2362 | ||
2363 | if (yyn == YYFINAL) | |
2364 | YYACCEPT; | |
2365 | ||
2366 | *++yyvsp = yylval; | |
2367 | ||
2368 | yyerror_range[1] = yylloc; | |
2369 | /* Using YYLLOC is tempting, but would change the location of | |
2370 | the lookahead. YYLOC is available though. */ | |
2371 | YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); | |
2372 | *++yylsp = yyloc; | |
2373 | ||
2374 | /* Shift the error token. */ | |
2375 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | |
2376 | ||
2377 | yystate = yyn; | |
2378 | goto yynewstate; | |
2379 | ||
2380 | ||
2381 | /*-------------------------------------. | |
2382 | | yyacceptlab -- YYACCEPT comes here. | | |
2383 | `-------------------------------------*/ | |
2384 | yyacceptlab: | |
2385 | yyresult = 0; | |
2386 | goto yyreturn; | |
2387 | ||
2388 | /*-----------------------------------. | |
2389 | | yyabortlab -- YYABORT comes here. | | |
2390 | `-----------------------------------*/ | |
2391 | yyabortlab: | |
2392 | yyresult = 1; | |
2393 | goto yyreturn; | |
2394 | ||
2395 | #ifndef yyoverflow | |
2396 | /*-------------------------------------------------. | |
2397 | | yyexhaustedlab -- memory exhaustion comes here. | | |
2398 | `-------------------------------------------------*/ | |
2399 | yyexhaustedlab: | |
2400 | yyerror (YY_("memory exhausted")); | |
2401 | yyresult = 2; | |
2402 | /* Fall through. */ | |
2403 | #endif | |
2404 | ||
2405 | yyreturn: | |
2406 | if (yychar != YYEOF && yychar != YYEMPTY) | |
2407 | yydestruct ("Cleanup: discarding lookahead", | |
2408 | yytoken, &yylval, &yylloc); | |
2409 | /* Do not reclaim the symbols of the rule which action triggered | |
2410 | this YYABORT or YYACCEPT. */ | |
2411 | YYPOPSTACK (yylen); | |
2412 | YY_STACK_PRINT (yyss, yyssp); | |
2413 | while (yyssp != yyss) | |
2414 | { | |
2415 | yydestruct ("Cleanup: popping", | |
2416 | yystos[*yyssp], yyvsp, yylsp); | |
2417 | YYPOPSTACK (1); | |
2418 | } | |
2419 | #ifndef yyoverflow | |
2420 | if (yyss != yyssa) | |
2421 | YYSTACK_FREE (yyss); | |
2422 | #endif | |
2423 | #if YYERROR_VERBOSE | |
2424 | if (yymsg != yymsgbuf) | |
2425 | YYSTACK_FREE (yymsg); | |
2426 | #endif | |
2427 | /* Make sure YYID is used. */ | |
2428 | return YYID (yyresult); | |
2429 | } | |
2430 | ||
2431 | ||
2432 | #line 528 "parse-gram.y" | |
2433 | ||
2434 | ||
2435 | ||
2436 | /* Return the location of the left-hand side of a rule whose | |
2437 | right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in | |
2438 | the right-hand side, and return an empty location equal to the end | |
2439 | boundary of RHS[0] if the right-hand side is empty. */ | |
2440 | ||
2441 | static YYLTYPE | |
2442 | lloc_default (YYLTYPE const *rhs, int n) | |
2443 | { | |
2444 | int i; | |
2445 | YYLTYPE loc; | |
2446 | ||
2447 | /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". | |
2448 | The bug is fixed in 7.4.2m, but play it safe for now. */ | |
2449 | loc.start = rhs[n].end; | |
2450 | loc.end = rhs[n].end; | |
2451 | ||
2452 | /* Ignore empty nonterminals the start of the the right-hand side. | |
2453 | Do not bother to ignore them at the end of the right-hand side, | |
2454 | since empty nonterminals have the same end as their predecessors. */ | |
2455 | for (i = 1; i <= n; i++) | |
2456 | if (! equal_boundaries (rhs[i].start, rhs[i].end)) | |
2457 | { | |
2458 | loc.start = rhs[i].start; | |
2459 | break; | |
2460 | } | |
2461 | ||
2462 | return loc; | |
2463 | } | |
2464 | ||
2465 | ||
2466 | /* Add a lex-param or a parse-param (depending on TYPE) with | |
2467 | declaration DECL and location LOC. */ | |
2468 | ||
2469 | static void | |
2470 | add_param (char const *type, char *decl, location loc) | |
2471 | { | |
2472 | static char const alphanum[26 + 26 + 1 + 10] = | |
2473 | "abcdefghijklmnopqrstuvwxyz" | |
2474 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
2475 | "_" | |
2476 | "0123456789"; | |
2477 | char const *name_start = NULL; | |
2478 | char *p; | |
2479 | ||
2480 | /* Stop on last actual character. */ | |
2481 | for (p = decl; p[1]; p++) | |
2482 | if ((p == decl | |
2483 | || ! memchr (alphanum, p[-1], sizeof alphanum)) | |
2484 | && memchr (alphanum, p[0], sizeof alphanum - 10)) | |
2485 | name_start = p; | |
2486 | ||
2487 | /* Strip the surrounding '{' and '}', and any blanks just inside | |
2488 | the braces. */ | |
2489 | while (*--p == ' ' || *p == '\t') | |
2490 | continue; | |
2491 | p[1] = '\0'; | |
2492 | while (*++decl == ' ' || *decl == '\t') | |
2493 | continue; | |
2494 | ||
2495 | if (! name_start) | |
2496 | complain_at (loc, _("missing identifier in parameter declaration")); | |
2497 | else | |
2498 | { | |
2499 | char *name; | |
2500 | size_t name_len; | |
2501 | ||
2502 | for (name_len = 1; | |
2503 | memchr (alphanum, name_start[name_len], sizeof alphanum); | |
2504 | name_len++) | |
2505 | continue; | |
2506 | ||
2507 | name = xmalloc (name_len + 1); | |
2508 | memcpy (name, name_start, name_len); | |
2509 | name[name_len] = '\0'; | |
2510 | muscle_pair_list_grow (type, decl, name); | |
2511 | free (name); | |
2512 | } | |
2513 | ||
2514 | gram_scanner_last_string_free (); | |
2515 | } | |
2516 | ||
2517 | static void | |
2518 | version_check (location const *loc, char const *version) | |
2519 | { | |
2520 | if (strverscmp (version, PACKAGE_VERSION) > 0) | |
2521 | { | |
2522 | complain_at (*loc, "require bison %s, but have %s", | |
2523 | version, PACKAGE_VERSION); | |
2524 | exit (63); | |
2525 | } | |
2526 | } | |
2527 | ||
2528 | static void | |
2529 | gram_error (location const *loc, char const *msg) | |
2530 | { | |
2531 | complain_at (*loc, "%s", msg); | |
2532 | } | |
2533 | ||
2534 | char const * | |
2535 | token_name (int type) | |
2536 | { | |
2537 | return yytname[YYTRANSLATE (type)]; | |
2538 | } | |
2539 | ||
2540 | static char const * | |
2541 | char_name (char c) | |
2542 | { | |
2543 | if (c == '\'') | |
2544 | return "'\\''"; | |
2545 | else | |
2546 | { | |
2547 | char buf[4]; | |
2548 | buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0'; | |
2549 | return quotearg_style (escape_quoting_style, buf); | |
2550 | } | |
2551 | } | |
2552 |