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