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