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