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