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