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