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