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