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