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