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