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