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