]>
Commit | Line | Data |
---|---|---|
1 | /* A Bison parser, made by GNU Bison 2.4.1.259-f52e1. */ | |
2 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | |
4 | ||
5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. | |
6 | ||
7 | This program is free software: you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation, either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | /* As a special exception, you may create a larger work that contains | |
21 | part or all of the Bison parser skeleton and distribute that work | |
22 | under terms of your choice, so long as that work isn't itself a | |
23 | parser generator using the skeleton or a modified version thereof | |
24 | as a parser skeleton. Alternatively, if you modify or redistribute | |
25 | the parser skeleton itself, you may (at your option) remove this | |
26 | special exception, which will cause the skeleton and the resulting | |
27 | Bison output files to be licensed under the GNU General Public | |
28 | License without this special exception. | |
29 | ||
30 | This special exception was added by the Free Software Foundation in | |
31 | version 2.2 of Bison. */ | |
32 | ||
33 | /* C LALR(1) parser skeleton written by Richard Stallman, by | |
34 | simplifying the original so-called "semantic" parser. */ | |
35 | ||
36 | /* All symbols defined below should begin with yy or YY, to avoid | |
37 | infringing on user name space. This should be done even for local | |
38 | variables, as they might otherwise be expanded by user macros. | |
39 | There are some unavoidable exceptions within include files to | |
40 | define necessary library symbols; they are noted "INFRINGES ON | |
41 | USER NAME SPACE" below. */ | |
42 | ||
43 | /* Identify Bison output. */ | |
44 | #define YYBISON 1 | |
45 | ||
46 | /* Bison version. */ | |
47 | #define YYBISON_VERSION "2.4.1.259-f52e1" | |
48 | ||
49 | /* Skeleton name. */ | |
50 | #define YYSKELETON_NAME "yacc.c" | |
51 | ||
52 | /* Pure parsers. */ | |
53 | #define YYPURE 1 | |
54 | ||
55 | /* Push parsers. */ | |
56 | #define YYPUSH 0 | |
57 | ||
58 | /* Pull parsers. */ | |
59 | #define YYPULL 1 | |
60 | ||
61 | /* Using locations. */ | |
62 | #define YYLSP_NEEDED 1 | |
63 | ||
64 | /* Substitute the variable and function names. */ | |
65 | #define yyparse gram_parse | |
66 | #define yylex gram_lex | |
67 | #define yyerror gram_error | |
68 | #define yylval gram_lval | |
69 | #define yychar gram_char | |
70 | #define yydebug gram_debug | |
71 | #define yynerrs gram_nerrs | |
72 | #define yylloc gram_lloc | |
73 | ||
74 | /* Copy the first part of user declarations. */ | |
75 | ||
76 | /* Line 268 of yacc.c */ | |
77 | #line 1 "parse-gram.y" | |
78 | /* Bison Grammar Parser -*- C -*- | |
79 | ||
80 | Copyright (C) 2002-2011 Free Software Foundation, Inc. | |
81 | ||
82 | This file is part of Bison, the GNU Compiler Compiler. | |
83 | ||
84 | This program is free software: you can redistribute it and/or modify | |
85 | it under the terms of the GNU General Public License as published by | |
86 | the Free Software Foundation, either version 3 of the License, or | |
87 | (at your option) any later version. | |
88 | ||
89 | This program is distributed in the hope that it will be useful, | |
90 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
91 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
92 | GNU General Public License for more details. | |
93 | ||
94 | You should have received a copy of the GNU General Public License | |
95 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
96 | ||
97 | #include <config.h> | |
98 | #include "system.h" | |
99 | ||
100 | #include "complain.h" | |
101 | #include "conflicts.h" | |
102 | #include "files.h" | |
103 | #include "getargs.h" | |
104 | #include "gram.h" | |
105 | #include "muscle-tab.h" | |
106 | #include "named-ref.h" | |
107 | #include "quotearg.h" | |
108 | #include "reader.h" | |
109 | #include "symlist.h" | |
110 | #include "scan-gram.h" | |
111 | #include "scan-code.h" | |
112 | ||
113 | #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N) | |
114 | static YYLTYPE lloc_default (YYLTYPE const *, int); | |
115 | ||
116 | #define YY_LOCATION_PRINT(File, Loc) \ | |
117 | location_print (File, Loc) | |
118 | ||
119 | static void version_check (location const *loc, char const *version); | |
120 | ||
121 | /* Request detailed syntax error messages, and pass them to GRAM_ERROR. | |
122 | FIXME: depends on the undocumented availability of YYLLOC. */ | |
123 | #undef yyerror | |
124 | #define yyerror(Msg) \ | |
125 | gram_error (&yylloc, Msg) | |
126 | static void gram_error (location const *, char const *); | |
127 | ||
128 | static char const *char_name (char); | |
129 | ||
130 | /** Add a lex-param or a parse-param. | |
131 | * | |
132 | * \param type \a lex_param or \a parse_param | |
133 | * \param decl the formal argument | |
134 | * \param loc the location in the source. | |
135 | */ | |
136 | static void add_param (char const *type, char *decl, location loc); | |
137 | ||
138 | ||
139 | static symbol_class current_class = unknown_sym; | |
140 | static uniqstr current_type = NULL; | |
141 | static symbol *current_lhs; | |
142 | static location current_lhs_location; | |
143 | static named_ref *current_lhs_named_ref; | |
144 | static int current_prec = 0; | |
145 | ||
146 | #define YYTYPE_INT16 int_fast16_t | |
147 | #define YYTYPE_INT8 int_fast8_t | |
148 | #define YYTYPE_UINT16 uint_fast16_t | |
149 | #define YYTYPE_UINT8 uint_fast8_t | |
150 | ||
151 | ||
152 | /* Line 268 of yacc.c */ | |
153 | #line 154 "parse-gram.c" | |
154 | ||
155 | /* Enabling traces. */ | |
156 | #ifndef YYDEBUG | |
157 | # define YYDEBUG 1 | |
158 | #endif | |
159 | ||
160 | /* Enabling verbose error messages. */ | |
161 | #ifdef YYERROR_VERBOSE | |
162 | # undef YYERROR_VERBOSE | |
163 | # define YYERROR_VERBOSE 1 | |
164 | #else | |
165 | # define YYERROR_VERBOSE 1 | |
166 | #endif | |
167 | ||
168 | /* Enabling the token table. */ | |
169 | #ifndef YYTOKEN_TABLE | |
170 | # define YYTOKEN_TABLE 0 | |
171 | #endif | |
172 | ||
173 | ||
174 | /* Tokens. */ | |
175 | #ifndef YYTOKENTYPE | |
176 | # define YYTOKENTYPE | |
177 | /* Put the tokens into the symbol table, so that GDB and other debuggers | |
178 | know about them. */ | |
179 | enum yytokentype { | |
180 | GRAM_EOF = 0, | |
181 | STRING = 258, | |
182 | INT = 259, | |
183 | PERCENT_TOKEN = 260, | |
184 | PERCENT_NTERM = 261, | |
185 | PERCENT_TYPE = 262, | |
186 | PERCENT_DESTRUCTOR = 263, | |
187 | PERCENT_PRINTER = 264, | |
188 | PERCENT_LEFT = 265, | |
189 | PERCENT_RIGHT = 266, | |
190 | PERCENT_NONASSOC = 267, | |
191 | PERCENT_PREC = 268, | |
192 | PERCENT_DPREC = 269, | |
193 | PERCENT_MERGE = 270, | |
194 | PERCENT_CODE = 271, | |
195 | PERCENT_DEBUG = 272, | |
196 | PERCENT_DEFAULT_PREC = 273, | |
197 | PERCENT_DEFINE = 274, | |
198 | PERCENT_DEFINES = 275, | |
199 | PERCENT_ERROR_VERBOSE = 276, | |
200 | PERCENT_EXPECT = 277, | |
201 | PERCENT_EXPECT_RR = 278, | |
202 | PERCENT_FILE_PREFIX = 279, | |
203 | PERCENT_GLR_PARSER = 280, | |
204 | PERCENT_INITIAL_ACTION = 281, | |
205 | PERCENT_LANGUAGE = 282, | |
206 | PERCENT_LEX_PARAM = 283, | |
207 | PERCENT_LOCATIONS = 284, | |
208 | PERCENT_NAME_PREFIX = 285, | |
209 | PERCENT_NO_DEFAULT_PREC = 286, | |
210 | PERCENT_NO_LINES = 287, | |
211 | PERCENT_NONDETERMINISTIC_PARSER = 288, | |
212 | PERCENT_OUTPUT = 289, | |
213 | PERCENT_PARSE_PARAM = 290, | |
214 | PERCENT_PURE_PARSER = 291, | |
215 | PERCENT_REQUIRE = 292, | |
216 | PERCENT_SKELETON = 293, | |
217 | PERCENT_START = 294, | |
218 | PERCENT_TOKEN_TABLE = 295, | |
219 | PERCENT_VERBOSE = 296, | |
220 | PERCENT_YACC = 297, | |
221 | BRACED_CODE = 298, | |
222 | BRACKETED_ID = 299, | |
223 | CHAR = 300, | |
224 | EPILOGUE = 301, | |
225 | EQUAL = 302, | |
226 | ID = 303, | |
227 | ID_COLON = 304, | |
228 | PERCENT_PERCENT = 305, | |
229 | PIPE = 306, | |
230 | PROLOGUE = 307, | |
231 | SEMICOLON = 308, | |
232 | TYPE = 309, | |
233 | TYPE_TAG_ANY = 310, | |
234 | TYPE_TAG_NONE = 311, | |
235 | PERCENT_UNION = 312 | |
236 | }; | |
237 | #endif | |
238 | /* Tokens. */ | |
239 | #define GRAM_EOF 0 | |
240 | #define STRING 258 | |
241 | #define INT 259 | |
242 | #define PERCENT_TOKEN 260 | |
243 | #define PERCENT_NTERM 261 | |
244 | #define PERCENT_TYPE 262 | |
245 | #define PERCENT_DESTRUCTOR 263 | |
246 | #define PERCENT_PRINTER 264 | |
247 | #define PERCENT_LEFT 265 | |
248 | #define PERCENT_RIGHT 266 | |
249 | #define PERCENT_NONASSOC 267 | |
250 | #define PERCENT_PREC 268 | |
251 | #define PERCENT_DPREC 269 | |
252 | #define PERCENT_MERGE 270 | |
253 | #define PERCENT_CODE 271 | |
254 | #define PERCENT_DEBUG 272 | |
255 | #define PERCENT_DEFAULT_PREC 273 | |
256 | #define PERCENT_DEFINE 274 | |
257 | #define PERCENT_DEFINES 275 | |
258 | #define PERCENT_ERROR_VERBOSE 276 | |
259 | #define PERCENT_EXPECT 277 | |
260 | #define PERCENT_EXPECT_RR 278 | |
261 | #define PERCENT_FILE_PREFIX 279 | |
262 | #define PERCENT_GLR_PARSER 280 | |
263 | #define PERCENT_INITIAL_ACTION 281 | |
264 | #define PERCENT_LANGUAGE 282 | |
265 | #define PERCENT_LEX_PARAM 283 | |
266 | #define PERCENT_LOCATIONS 284 | |
267 | #define PERCENT_NAME_PREFIX 285 | |
268 | #define PERCENT_NO_DEFAULT_PREC 286 | |
269 | #define PERCENT_NO_LINES 287 | |
270 | #define PERCENT_NONDETERMINISTIC_PARSER 288 | |
271 | #define PERCENT_OUTPUT 289 | |
272 | #define PERCENT_PARSE_PARAM 290 | |
273 | #define PERCENT_PURE_PARSER 291 | |
274 | #define PERCENT_REQUIRE 292 | |
275 | #define PERCENT_SKELETON 293 | |
276 | #define PERCENT_START 294 | |
277 | #define PERCENT_TOKEN_TABLE 295 | |
278 | #define PERCENT_VERBOSE 296 | |
279 | #define PERCENT_YACC 297 | |
280 | #define BRACED_CODE 298 | |
281 | #define BRACKETED_ID 299 | |
282 | #define CHAR 300 | |
283 | #define EPILOGUE 301 | |
284 | #define EQUAL 302 | |
285 | #define ID 303 | |
286 | #define ID_COLON 304 | |
287 | #define PERCENT_PERCENT 305 | |
288 | #define PIPE 306 | |
289 | #define PROLOGUE 307 | |
290 | #define SEMICOLON 308 | |
291 | #define TYPE 309 | |
292 | #define TYPE_TAG_ANY 310 | |
293 | #define TYPE_TAG_NONE 311 | |
294 | #define PERCENT_UNION 312 | |
295 | ||
296 | ||
297 | ||
298 | ||
299 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | |
300 | typedef union YYSTYPE | |
301 | { | |
302 | ||
303 | /* Line 293 of yacc.c */ | |
304 | #line 94 "parse-gram.y" | |
305 | ||
306 | symbol *symbol; | |
307 | symbol_list *list; | |
308 | int integer; | |
309 | char const *chars; | |
310 | char *code; | |
311 | assoc assoc; | |
312 | uniqstr uniqstr; | |
313 | unsigned char character; | |
314 | named_ref *named_ref; | |
315 | ||
316 | ||
317 | ||
318 | /* Line 293 of yacc.c */ | |
319 | #line 320 "parse-gram.c" | |
320 | } YYSTYPE; | |
321 | # define YYSTYPE_IS_TRIVIAL 1 | |
322 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | |
323 | # define YYSTYPE_IS_DECLARED 1 | |
324 | #endif | |
325 | ||
326 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED | |
327 | typedef struct YYLTYPE | |
328 | { | |
329 | int first_line; | |
330 | int first_column; | |
331 | int last_line; | |
332 | int last_column; | |
333 | } YYLTYPE; | |
334 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ | |
335 | # define YYLTYPE_IS_DECLARED 1 | |
336 | # define YYLTYPE_IS_TRIVIAL 1 | |
337 | #endif | |
338 | ||
339 | ||
340 | /* Copy the second part of user declarations. */ | |
341 | ||
342 | ||
343 | /* Line 343 of yacc.c */ | |
344 | #line 345 "parse-gram.c" | |
345 | ||
346 | #ifdef short | |
347 | # undef short | |
348 | #endif | |
349 | ||
350 | #ifdef YYTYPE_UINT8 | |
351 | typedef YYTYPE_UINT8 yytype_uint8; | |
352 | #else | |
353 | typedef unsigned char yytype_uint8; | |
354 | #endif | |
355 | ||
356 | #ifdef YYTYPE_INT8 | |
357 | typedef YYTYPE_INT8 yytype_int8; | |
358 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | |
359 | || defined __cplusplus || defined _MSC_VER) | |
360 | typedef signed char yytype_int8; | |
361 | #else | |
362 | typedef short int yytype_int8; | |
363 | #endif | |
364 | ||
365 | #ifdef YYTYPE_UINT16 | |
366 | typedef YYTYPE_UINT16 yytype_uint16; | |
367 | #else | |
368 | typedef unsigned short int yytype_uint16; | |
369 | #endif | |
370 | ||
371 | #ifdef YYTYPE_INT16 | |
372 | typedef YYTYPE_INT16 yytype_int16; | |
373 | #else | |
374 | typedef short int yytype_int16; | |
375 | #endif | |
376 | ||
377 | #ifndef YYSIZE_T | |
378 | # ifdef __SIZE_TYPE__ | |
379 | # define YYSIZE_T __SIZE_TYPE__ | |
380 | # elif defined size_t | |
381 | # define YYSIZE_T size_t | |
382 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ | |
383 | || defined __cplusplus || defined _MSC_VER) | |
384 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
385 | # define YYSIZE_T size_t | |
386 | # else | |
387 | # define YYSIZE_T unsigned int | |
388 | # endif | |
389 | #endif | |
390 | ||
391 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | |
392 | ||
393 | #ifndef YY_ | |
394 | # if defined YYENABLE_NLS && YYENABLE_NLS | |
395 | # if ENABLE_NLS | |
396 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | |
397 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | |
398 | # endif | |
399 | # endif | |
400 | # ifndef YY_ | |
401 | # define YY_(msgid) msgid | |
402 | # endif | |
403 | #endif | |
404 | ||
405 | /* Suppress unused-variable warnings by "using" E. */ | |
406 | #if ! defined lint || defined __GNUC__ | |
407 | # define YYUSE(e) ((void) (e)) | |
408 | #else | |
409 | # define YYUSE(e) /* empty */ | |
410 | #endif | |
411 | ||
412 | /* Identity function, used to suppress warnings about constant conditions. */ | |
413 | #ifndef lint | |
414 | # define YYID(n) (n) | |
415 | #else | |
416 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
417 | || defined __cplusplus || defined _MSC_VER) | |
418 | static int | |
419 | YYID (int yyi) | |
420 | #else | |
421 | static int | |
422 | YYID (yyi) | |
423 | int yyi; | |
424 | #endif | |
425 | { | |
426 | return yyi; | |
427 | } | |
428 | #endif | |
429 | ||
430 | #if 1 | |
431 | ||
432 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | |
433 | ||
434 | # ifdef YYSTACK_ALLOC | |
435 | /* Pacify GCC's `empty if-body' warning. */ | |
436 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) | |
437 | # ifndef YYSTACK_ALLOC_MAXIMUM | |
438 | /* The OS might guarantee only one guard page at the bottom of the stack, | |
439 | and a page size can be as small as 4096 bytes. So we cannot safely | |
440 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number | |
441 | to allow for a few compiler-allocated temporary stack slots. */ | |
442 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ | |
443 | # endif | |
444 | # else | |
445 | # define YYSTACK_ALLOC YYMALLOC | |
446 | # define YYSTACK_FREE YYFREE | |
447 | # ifndef YYSTACK_ALLOC_MAXIMUM | |
448 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM | |
449 | # endif | |
450 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ | |
451 | && ! ((defined YYMALLOC || defined malloc) \ | |
452 | && (defined YYFREE || defined free))) | |
453 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
454 | # ifndef EXIT_SUCCESS | |
455 | # define EXIT_SUCCESS 0 | |
456 | # endif | |
457 | # endif | |
458 | # ifndef YYMALLOC | |
459 | # define YYMALLOC malloc | |
460 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | |
461 | || defined __cplusplus || defined _MSC_VER) | |
462 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | |
463 | # endif | |
464 | # endif | |
465 | # ifndef YYFREE | |
466 | # define YYFREE free | |
467 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ | |
468 | || defined __cplusplus || defined _MSC_VER) | |
469 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | |
470 | # endif | |
471 | # endif | |
472 | # endif | |
473 | # define YYCOPY_NEEDED 1 | |
474 | #endif | |
475 | ||
476 | ||
477 | #if (! defined yyoverflow \ | |
478 | && (! defined __cplusplus \ | |
479 | || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ | |
480 | && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | |
481 | ||
482 | /* A type that is properly aligned for any stack member. */ | |
483 | union yyalloc | |
484 | { | |
485 | yytype_int16 yyss_alloc; | |
486 | YYSTYPE yyvs_alloc; | |
487 | YYLTYPE yyls_alloc; | |
488 | }; | |
489 | ||
490 | /* The size of the maximum gap between one aligned stack and the next. */ | |
491 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | |
492 | ||
493 | /* The size of an array large to enough to hold all stacks, each with | |
494 | N elements. */ | |
495 | # define YYSTACK_BYTES(N) \ | |
496 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ | |
497 | + 2 * YYSTACK_GAP_MAXIMUM) | |
498 | ||
499 | # define YYCOPY_NEEDED 1 | |
500 | ||
501 | /* Relocate STACK from its old location to the new one. The | |
502 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | |
503 | elements in the stack, and YYPTR gives the new location of the | |
504 | stack. Advance YYPTR to a properly aligned location for the next | |
505 | stack. */ | |
506 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ | |
507 | do \ | |
508 | { \ | |
509 | YYSIZE_T yynewbytes; \ | |
510 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ | |
511 | Stack = &yyptr->Stack_alloc; \ | |
512 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | |
513 | yyptr += yynewbytes / sizeof (*yyptr); \ | |
514 | } \ | |
515 | while (YYID (0)) | |
516 | ||
517 | #endif | |
518 | ||
519 | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED | |
520 | /* Copy COUNT objects from FROM to TO. The source and destination do | |
521 | not overlap. */ | |
522 | # ifndef YYCOPY | |
523 | # if defined __GNUC__ && 1 < __GNUC__ | |
524 | # define YYCOPY(To, From, Count) \ | |
525 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
526 | # else | |
527 | # define YYCOPY(To, From, Count) \ | |
528 | do \ | |
529 | { \ | |
530 | YYSIZE_T yyi; \ | |
531 | for (yyi = 0; yyi < (Count); yyi++) \ | |
532 | (To)[yyi] = (From)[yyi]; \ | |
533 | } \ | |
534 | while (YYID (0)) | |
535 | # endif | |
536 | # endif | |
537 | #endif /* !YYCOPY_NEEDED */ | |
538 | ||
539 | /* YYFINAL -- State number of the termination state. */ | |
540 | #define YYFINAL 3 | |
541 | /* YYLAST -- Last index in YYTABLE. */ | |
542 | #define YYLAST 160 | |
543 | ||
544 | /* YYNTOKENS -- Number of terminals. */ | |
545 | #define YYNTOKENS 58 | |
546 | /* YYNNTS -- Number of nonterminals. */ | |
547 | #define YYNNTS 34 | |
548 | /* YYNRULES -- Number of rules. */ | |
549 | #define YYNRULES 108 | |
550 | /* YYNRULES -- Number of states. */ | |
551 | #define YYNSTATES 148 | |
552 | ||
553 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
554 | #define YYUNDEFTOK 2 | |
555 | #define YYMAXUTOK 312 | |
556 | ||
557 | #define YYTRANSLATE(YYX) \ | |
558 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | |
559 | ||
560 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | |
561 | static const yytype_uint8 yytranslate[] = | |
562 | { | |
563 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
564 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
565 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
566 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
567 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
568 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
569 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
570 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
571 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
572 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
573 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
574 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
575 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
576 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
577 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
578 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
579 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
580 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
581 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
582 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
583 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
585 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
586 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
587 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
588 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | |
589 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | |
590 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | |
591 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | |
592 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, | |
593 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, | |
594 | 55, 56, 57 | |
595 | }; | |
596 | ||
597 | #if YYDEBUG | |
598 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | |
599 | YYRHS. */ | |
600 | static const yytype_uint16 yyprhs[] = | |
601 | { | |
602 | 0, 0, 3, 8, 9, 12, 14, 16, 18, 22, | |
603 | 24, 27, 29, 32, 35, 38, 42, 44, 47, 50, | |
604 | 53, 55, 58, 62, 64, 66, 69, 73, 76, 78, | |
605 | 81, 84, 86, 88, 90, 92, 94, 96, 99, 103, | |
606 | 107, 109, 111, 114, 118, 119, 121, 125, 126, 130, | |
607 | 131, 135, 139, 143, 145, 147, 149, 150, 152, 154, | |
608 | 157, 159, 162, 164, 167, 169, 172, 174, 176, 178, | |
609 | 180, 182, 184, 187, 190, 194, 196, 199, 201, 204, | |
610 | 206, 209, 212, 213, 218, 220, 224, 227, 228, 232, | |
611 | 236, 240, 244, 248, 249, 251, 253, 255, 256, 258, | |
612 | 260, 262, 264, 266, 268, 270, 272, 274, 275 | |
613 | }; | |
614 | ||
615 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | |
616 | static const yytype_int8 yyrhs[] = | |
617 | { | |
618 | 59, 0, -1, 60, 50, 77, 91, -1, -1, 60, | |
619 | 61, -1, 62, -1, 52, -1, 17, -1, 19, 84, | |
620 | 85, -1, 20, -1, 20, 3, -1, 21, -1, 22, | |
621 | 4, -1, 23, 4, -1, 24, 3, -1, 24, 47, | |
622 | 3, -1, 25, -1, 26, 43, -1, 27, 3, -1, | |
623 | 28, 43, -1, 29, -1, 30, 3, -1, 30, 47, | |
624 | 3, -1, 32, -1, 33, -1, 34, 3, -1, 34, | |
625 | 47, 3, -1, 35, 43, -1, 36, -1, 37, 3, | |
626 | -1, 38, 3, -1, 40, -1, 41, -1, 42, -1, | |
627 | 53, -1, 67, -1, 64, -1, 39, 89, -1, 8, | |
628 | 43, 73, -1, 9, 43, 73, -1, 18, -1, 31, | |
629 | -1, 16, 86, -1, 16, 48, 86, -1, -1, 48, | |
630 | -1, 57, 63, 86, -1, -1, 6, 65, 76, -1, | |
631 | -1, 5, 66, 76, -1, 7, 54, 72, -1, 68, | |
632 | 69, 70, -1, 10, -1, 11, -1, 12, -1, -1, | |
633 | 54, -1, 71, -1, 70, 71, -1, 89, -1, 89, | |
634 | 4, -1, 89, -1, 72, 89, -1, 74, -1, 73, | |
635 | 74, -1, 89, -1, 54, -1, 55, -1, 56, -1, | |
636 | 54, -1, 87, -1, 87, 4, -1, 87, 90, -1, | |
637 | 87, 4, 90, -1, 75, -1, 76, 75, -1, 78, | |
638 | -1, 77, 78, -1, 79, -1, 62, 53, -1, 1, | |
639 | 53, -1, -1, 88, 83, 80, 81, -1, 82, -1, | |
640 | 81, 51, 82, -1, 81, 53, -1, -1, 82, 89, | |
641 | 83, -1, 82, 43, 83, -1, 82, 13, 89, -1, | |
642 | 82, 14, 4, -1, 82, 15, 54, -1, -1, 44, | |
643 | -1, 48, -1, 3, -1, -1, 48, -1, 3, -1, | |
644 | 43, -1, 48, -1, 45, -1, 49, -1, 87, -1, | |
645 | 90, -1, 3, -1, -1, 50, 46, -1 | |
646 | }; | |
647 | ||
648 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
649 | static const yytype_uint16 yyrline[] = | |
650 | { | |
651 | 0, 209, 209, 217, 219, 223, 224, 234, 235, 240, | |
652 | 241, 246, 247, 248, 249, 250, 251, 256, 265, 266, | |
653 | 267, 268, 269, 270, 271, 272, 273, 274, 275, 290, | |
654 | 291, 315, 316, 317, 318, 322, 323, 324, 328, 335, | |
655 | 342, 346, 350, 357, 372, 373, 377, 389, 389, 394, | |
656 | 394, 399, 410, 425, 426, 427, 431, 432, 437, 439, | |
657 | 444, 445, 450, 452, 457, 458, 462, 463, 464, 465, | |
658 | 470, 475, 480, 486, 492, 503, 504, 513, 514, 520, | |
659 | 521, 522, 529, 529, 534, 535, 536, 541, 543, 545, | |
660 | 547, 549, 551, 556, 558, 569, 570, 575, 576, 577, | |
661 | 586, 606, 608, 617, 622, 623, 628, 635, 637 | |
662 | }; | |
663 | #endif | |
664 | ||
665 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE | |
666 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | |
667 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | |
668 | static const char *const yytname[] = | |
669 | { | |
670 | "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"", | |
671 | "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"", | |
672 | "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"", | |
673 | "\"%dprec\"", "\"%merge\"", "\"%code\"", "\"%debug\"", | |
674 | "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", | |
675 | "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"", | |
676 | "\"%initial-action\"", "\"%language\"", "\"%lex-param\"", | |
677 | "\"%locations\"", "\"%name-prefix\"", "\"%no-default-prec\"", | |
678 | "\"%no-lines\"", "\"%nondeterministic-parser\"", "\"%output\"", | |
679 | "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", | |
680 | "\"%start\"", "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", | |
681 | "\"{...}\"", "\"[identifier]\"", "\"char\"", "\"epilogue\"", "\"=\"", | |
682 | "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"", | |
683 | "\";\"", "\"type\"", "\"<*>\"", "\"<>\"", "\"%union\"", "$accept", | |
684 | "input", "prologue_declarations", "prologue_declaration", | |
685 | "grammar_declaration", "union_name", "symbol_declaration", "$@1", "$@2", | |
686 | "precedence_declaration", "precedence_declarator", "type.opt", | |
687 | "symbols.prec", "symbol.prec", "symbols.1", "generic_symlist", | |
688 | "generic_symlist_item", "symbol_def", "symbol_defs.1", "grammar", | |
689 | "rules_or_grammar_declaration", "rules", "$@3", "rhses.1", "rhs", | |
690 | "named_ref.opt", "variable", "content.opt", "braceless", "id", | |
691 | "id_colon", "symbol", "string_as_id", "epilogue.opt", 0 | |
692 | }; | |
693 | #endif | |
694 | ||
695 | # ifdef YYPRINT | |
696 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | |
697 | token YYLEX-NUM. */ | |
698 | static const yytype_uint16 yytoknum[] = | |
699 | { | |
700 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
701 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | |
702 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | |
703 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | |
704 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, | |
705 | 305, 306, 307, 308, 309, 310, 311, 312 | |
706 | }; | |
707 | # endif | |
708 | ||
709 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
710 | static const yytype_uint8 yyr1[] = | |
711 | { | |
712 | 0, 58, 59, 60, 60, 61, 61, 61, 61, 61, | |
713 | 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, | |
714 | 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, | |
715 | 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, | |
716 | 62, 62, 62, 62, 63, 63, 62, 65, 64, 66, | |
717 | 64, 64, 67, 68, 68, 68, 69, 69, 70, 70, | |
718 | 71, 71, 72, 72, 73, 73, 74, 74, 74, 74, | |
719 | 75, 75, 75, 75, 75, 76, 76, 77, 77, 78, | |
720 | 78, 78, 80, 79, 81, 81, 81, 82, 82, 82, | |
721 | 82, 82, 82, 83, 83, 84, 84, 85, 85, 85, | |
722 | 86, 87, 87, 88, 89, 89, 90, 91, 91 | |
723 | }; | |
724 | ||
725 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
726 | static const yytype_uint8 yyr2[] = | |
727 | { | |
728 | 0, 2, 4, 0, 2, 1, 1, 1, 3, 1, | |
729 | 2, 1, 2, 2, 2, 3, 1, 2, 2, 2, | |
730 | 1, 2, 3, 1, 1, 2, 3, 2, 1, 2, | |
731 | 2, 1, 1, 1, 1, 1, 1, 2, 3, 3, | |
732 | 1, 1, 2, 3, 0, 1, 3, 0, 3, 0, | |
733 | 3, 3, 3, 1, 1, 1, 0, 1, 1, 2, | |
734 | 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, | |
735 | 1, 1, 2, 2, 3, 1, 2, 1, 2, 1, | |
736 | 2, 2, 0, 4, 1, 3, 2, 0, 3, 3, | |
737 | 3, 3, 3, 0, 1, 1, 1, 0, 1, 1, | |
738 | 1, 1, 1, 1, 1, 1, 1, 0, 2 | |
739 | }; | |
740 | ||
741 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. | |
742 | Performed when YYTABLE doesn't specify something else to do. Zero | |
743 | means the default is an error. */ | |
744 | static const yytype_uint8 yydefact[] = | |
745 | { | |
746 | 3, 0, 0, 1, 49, 47, 0, 0, 0, 53, | |
747 | 54, 55, 0, 7, 40, 0, 9, 11, 0, 0, | |
748 | 0, 16, 0, 0, 0, 20, 0, 41, 23, 24, | |
749 | 0, 0, 28, 0, 0, 0, 31, 32, 33, 0, | |
750 | 6, 34, 44, 4, 5, 36, 35, 56, 0, 0, | |
751 | 0, 0, 0, 100, 0, 42, 96, 95, 97, 10, | |
752 | 12, 13, 14, 0, 17, 18, 19, 21, 0, 25, | |
753 | 0, 27, 29, 30, 106, 102, 101, 104, 37, 105, | |
754 | 0, 103, 0, 0, 77, 79, 93, 45, 0, 57, | |
755 | 0, 70, 75, 50, 71, 48, 51, 62, 67, 68, | |
756 | 69, 38, 64, 66, 39, 43, 99, 98, 8, 15, | |
757 | 22, 26, 81, 80, 0, 78, 2, 94, 82, 46, | |
758 | 52, 58, 60, 76, 72, 73, 63, 65, 108, 87, | |
759 | 59, 61, 74, 83, 84, 87, 86, 0, 0, 0, | |
760 | 93, 93, 85, 90, 91, 92, 89, 88 | |
761 | }; | |
762 | ||
763 | /* YYDEFGOTO[NTERM-NUM]. */ | |
764 | static const yytype_int16 yydefgoto[] = | |
765 | { | |
766 | -1, 1, 2, 43, 82, 88, 45, 49, 48, 46, | |
767 | 47, 90, 120, 121, 96, 101, 102, 92, 93, 83, | |
768 | 84, 85, 129, 133, 134, 118, 58, 108, 55, 77, | |
769 | 86, 103, 79, 116 | |
770 | }; | |
771 | ||
772 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | |
773 | STATE-NUM. */ | |
774 | #define YYPACT_NINF -91 | |
775 | static const yytype_int16 yypact[] = | |
776 | { | |
777 | -91, 3, 103, -91, -91, -91, -36, 2, 10, -91, | |
778 | -91, -91, 9, -91, -91, 32, 60, -91, 65, 67, | |
779 | 27, -91, 41, 73, 51, -91, 39, -91, -91, -91, | |
780 | 40, 52, -91, 93, 95, 33, -91, -91, -91, 15, | |
781 | -91, -91, 53, -91, -91, -91, -91, 46, 43, 43, | |
782 | 33, 11, 11, -91, 61, -91, -91, -91, 35, -91, | |
783 | -91, -91, -91, 100, -91, -91, -91, -91, 102, -91, | |
784 | 113, -91, -91, -91, -91, -91, -91, -91, -91, -91, | |
785 | 64, -91, 94, 1, -91, -91, 62, -91, 61, -91, | |
786 | 33, -91, -91, 43, 86, 43, 33, -91, -91, -91, | |
787 | -91, 11, -91, -91, 11, -91, -91, -91, -91, -91, | |
788 | -91, -91, -91, -91, 72, -91, -91, -91, -91, -91, | |
789 | 33, -91, 142, -91, 145, -91, -91, -91, -91, -91, | |
790 | -91, -91, -91, 17, 34, -91, -91, 33, 146, 97, | |
791 | 62, 62, 34, -91, -91, -91, -91, -91 | |
792 | }; | |
793 | ||
794 | /* YYPGOTO[NTERM-NUM]. */ | |
795 | static const yytype_int16 yypgoto[] = | |
796 | { | |
797 | -91, -91, -91, -91, 147, -91, -91, -91, -91, -91, | |
798 | -91, -91, -91, 37, -91, 106, -60, -33, 105, -91, | |
799 | 69, -91, -91, -91, 24, -48, -91, -91, -49, -20, | |
800 | -91, -35, -90, -91 | |
801 | }; | |
802 | ||
803 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | |
804 | positive, shift that token. If negative, reduce the rule which | |
805 | number is the opposite. If YYTABLE_NINF, syntax error. */ | |
806 | #define YYTABLE_NINF -108 | |
807 | static const yytype_int16 yytable[] = | |
808 | { | |
809 | 78, -107, 80, 3, 125, 105, 4, 5, 6, 7, | |
810 | 8, 9, 10, 11, 74, 97, 80, 12, 50, 14, | |
811 | 4, 5, 6, 7, 8, 9, 10, 11, 94, 94, | |
812 | 62, 12, 27, 14, 132, 56, 74, 74, 106, 119, | |
813 | 35, 127, 67, 69, 127, 51, 27, 137, 138, 139, | |
814 | 81, 114, 53, 52, 35, 122, 75, 54, 42, 76, | |
815 | 123, 126, 123, 59, 81, 98, 99, 100, 135, 60, | |
816 | 136, 61, 42, 94, 63, 94, 65, 140, 75, 75, | |
817 | 57, 76, 76, 107, 64, 122, 68, 70, 75, 74, | |
818 | 124, 76, 146, 147, 66, 71, 72, 91, 73, 141, | |
819 | 89, 87, 143, 109, 53, 110, 117, 141, 4, 5, | |
820 | 6, 7, 8, 9, 10, 11, 111, 112, 128, 12, | |
821 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | |
822 | 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, | |
823 | 33, 34, 35, 36, 37, 38, 131, 113, 74, 44, | |
824 | 144, 145, 115, 39, 95, 40, 41, 130, 104, 142, | |
825 | 42 | |
826 | }; | |
827 | ||
828 | #define yypact_value_is_default(yystate) \ | |
829 | ((yystate) == (-91)) | |
830 | ||
831 | #define yytable_value_is_error(yytable_value) \ | |
832 | YYID (0) | |
833 | ||
834 | static const yytype_uint8 yycheck[] = | |
835 | { | |
836 | 35, 0, 1, 0, 94, 54, 5, 6, 7, 8, | |
837 | 9, 10, 11, 12, 3, 50, 1, 16, 54, 18, | |
838 | 5, 6, 7, 8, 9, 10, 11, 12, 48, 49, | |
839 | 3, 16, 31, 18, 124, 3, 3, 3, 3, 88, | |
840 | 39, 101, 3, 3, 104, 43, 31, 13, 14, 15, | |
841 | 49, 50, 43, 43, 39, 90, 45, 48, 57, 48, | |
842 | 93, 96, 95, 3, 49, 54, 55, 56, 51, 4, | |
843 | 53, 4, 57, 93, 47, 95, 3, 43, 45, 45, | |
844 | 48, 48, 48, 48, 43, 120, 47, 47, 45, 3, | |
845 | 4, 48, 140, 141, 43, 43, 3, 54, 3, 134, | |
846 | 54, 48, 137, 3, 43, 3, 44, 142, 5, 6, | |
847 | 7, 8, 9, 10, 11, 12, 3, 53, 46, 16, | |
848 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | |
849 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | |
850 | 37, 38, 39, 40, 41, 42, 4, 53, 3, 2, | |
851 | 4, 54, 83, 50, 49, 52, 53, 120, 52, 135, | |
852 | 57 | |
853 | }; | |
854 | ||
855 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | |
856 | symbol of state STATE-NUM. */ | |
857 | static const yytype_uint8 yystos[] = | |
858 | { | |
859 | 0, 59, 60, 0, 5, 6, 7, 8, 9, 10, | |
860 | 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, | |
861 | 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, | |
862 | 34, 35, 36, 37, 38, 39, 40, 41, 42, 50, | |
863 | 52, 53, 57, 61, 62, 64, 67, 68, 66, 65, | |
864 | 54, 43, 43, 43, 48, 86, 3, 48, 84, 3, | |
865 | 4, 4, 3, 47, 43, 3, 43, 3, 47, 3, | |
866 | 47, 43, 3, 3, 3, 45, 48, 87, 89, 90, | |
867 | 1, 49, 62, 77, 78, 79, 88, 48, 63, 54, | |
868 | 69, 54, 75, 76, 87, 76, 72, 89, 54, 55, | |
869 | 56, 73, 74, 89, 73, 86, 3, 48, 85, 3, | |
870 | 3, 3, 53, 53, 50, 78, 91, 44, 83, 86, | |
871 | 70, 71, 89, 75, 4, 90, 89, 74, 46, 80, | |
872 | 71, 4, 90, 81, 82, 51, 53, 13, 14, 15, | |
873 | 43, 89, 82, 89, 4, 54, 83, 83 | |
874 | }; | |
875 | ||
876 | #define yyerrok (yyerrstatus = 0) | |
877 | #define yyclearin (yychar = YYEMPTY) | |
878 | #define YYEMPTY (-2) | |
879 | #define YYEOF 0 | |
880 | ||
881 | #define YYACCEPT goto yyacceptlab | |
882 | #define YYABORT goto yyabortlab | |
883 | #define YYERROR goto yyerrorlab | |
884 | ||
885 | ||
886 | /* Like YYERROR except do call yyerror. This remains here temporarily | |
887 | to ease the transition to the new meaning of YYERROR, for GCC. | |
888 | Once GCC version 2 has supplanted version 1, this can go. However, | |
889 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | |
890 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | |
891 | discussed. */ | |
892 | ||
893 | #define YYFAIL goto yyerrlab | |
894 | #if defined YYFAIL | |
895 | /* This is here to suppress warnings from the GCC cpp's | |
896 | -Wunused-macros. Normally we don't worry about that warning, but | |
897 | some users do, and we want to make it easy for users to remove | |
898 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | |
899 | #endif | |
900 | ||
901 | #define YYRECOVERING() (!!yyerrstatus) | |
902 | ||
903 | #define YYBACKUP(Token, Value) \ | |
904 | do \ | |
905 | if (yychar == YYEMPTY && yylen == 1) \ | |
906 | { \ | |
907 | yychar = (Token); \ | |
908 | yylval = (Value); \ | |
909 | YYPOPSTACK (1); \ | |
910 | YY_LAC_DISCARD ("YYBACKUP"); \ | |
911 | goto yybackup; \ | |
912 | } \ | |
913 | else \ | |
914 | { \ | |
915 | yyerror (YY_("syntax error: cannot back up")); \ | |
916 | YYERROR; \ | |
917 | } \ | |
918 | while (YYID (0)) | |
919 | ||
920 | ||
921 | #define YYTERROR 1 | |
922 | #define YYERRCODE 256 | |
923 | ||
924 | ||
925 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. | |
926 | If N is 0, then set CURRENT to the empty location which ends | |
927 | the previous symbol: RHS[0] (always defined). */ | |
928 | ||
929 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | |
930 | #ifndef YYLLOC_DEFAULT | |
931 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | |
932 | do \ | |
933 | if (YYID (N)) \ | |
934 | { \ | |
935 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | |
936 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | |
937 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | |
938 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | |
939 | } \ | |
940 | else \ | |
941 | { \ | |
942 | (Current).first_line = (Current).last_line = \ | |
943 | YYRHSLOC (Rhs, 0).last_line; \ | |
944 | (Current).first_column = (Current).last_column = \ | |
945 | YYRHSLOC (Rhs, 0).last_column; \ | |
946 | } \ | |
947 | while (YYID (0)) | |
948 | #endif | |
949 | ||
950 | ||
951 | /* YY_LOCATION_PRINT -- Print the location on the stream. | |
952 | This macro was not mandated originally: define only if we know | |
953 | we won't break user code: when these are the locations we know. */ | |
954 | ||
955 | #ifndef YY_LOCATION_PRINT | |
956 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | |
957 | # define YY_LOCATION_PRINT(File, Loc) \ | |
958 | fprintf (File, "%d.%d-%d.%d", \ | |
959 | (Loc).first_line, (Loc).first_column, \ | |
960 | (Loc).last_line, (Loc).last_column) | |
961 | # else | |
962 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | |
963 | # endif | |
964 | #endif | |
965 | ||
966 | ||
967 | /* YYLEX -- calling `yylex' with the right arguments. */ | |
968 | ||
969 | #ifdef YYLEX_PARAM | |
970 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) | |
971 | #else | |
972 | # define YYLEX yylex (&yylval, &yylloc) | |
973 | #endif | |
974 | ||
975 | /* Enable debugging if requested. */ | |
976 | #if YYDEBUG | |
977 | ||
978 | # ifndef YYFPRINTF | |
979 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | |
980 | # define YYFPRINTF fprintf | |
981 | # endif | |
982 | ||
983 | # define YYDPRINTF(Args) \ | |
984 | do { \ | |
985 | if (yydebug) \ | |
986 | YYFPRINTF Args; \ | |
987 | } while (YYID (0)) | |
988 | ||
989 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | |
990 | do { \ | |
991 | if (yydebug) \ | |
992 | { \ | |
993 | YYFPRINTF (stderr, "%s ", Title); \ | |
994 | yy_symbol_print (stderr, \ | |
995 | Type, Value, Location); \ | |
996 | YYFPRINTF (stderr, "\n"); \ | |
997 | } \ | |
998 | } while (YYID (0)) | |
999 | ||
1000 | ||
1001 | /*--------------------------------. | |
1002 | | Print this symbol on YYOUTPUT. | | |
1003 | `--------------------------------*/ | |
1004 | ||
1005 | /*ARGSUSED*/ | |
1006 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1007 | || defined __cplusplus || defined _MSC_VER) | |
1008 | static void | |
1009 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | |
1010 | #else | |
1011 | static void | |
1012 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) | |
1013 | FILE *yyoutput; | |
1014 | int yytype; | |
1015 | YYSTYPE const * const yyvaluep; | |
1016 | YYLTYPE const * const yylocationp; | |
1017 | #endif | |
1018 | { | |
1019 | if (!yyvaluep) | |
1020 | return; | |
1021 | YYUSE (yylocationp); | |
1022 | # ifdef YYPRINT | |
1023 | if (yytype < YYNTOKENS) | |
1024 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | |
1025 | # else | |
1026 | YYUSE (yyoutput); | |
1027 | # endif | |
1028 | switch (yytype) | |
1029 | { | |
1030 | case 3: /* "\"string\"" */ | |
1031 | ||
1032 | /* Line 819 of yacc.c */ | |
1033 | #line 184 "parse-gram.y" | |
1034 | { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); }; | |
1035 | ||
1036 | /* Line 819 of yacc.c */ | |
1037 | #line 1038 "parse-gram.c" | |
1038 | break; | |
1039 | case 4: /* "\"integer\"" */ | |
1040 | ||
1041 | /* Line 819 of yacc.c */ | |
1042 | #line 196 "parse-gram.y" | |
1043 | { fprintf (stderr, "%d", (yyvaluep->integer)); }; | |
1044 | ||
1045 | /* Line 819 of yacc.c */ | |
1046 | #line 1047 "parse-gram.c" | |
1047 | break; | |
1048 | case 43: /* "\"{...}\"" */ | |
1049 | ||
1050 | /* Line 819 of yacc.c */ | |
1051 | #line 186 "parse-gram.y" | |
1052 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->code)); }; | |
1053 | ||
1054 | /* Line 819 of yacc.c */ | |
1055 | #line 1056 "parse-gram.c" | |
1056 | break; | |
1057 | case 44: /* "\"[identifier]\"" */ | |
1058 | ||
1059 | /* Line 819 of yacc.c */ | |
1060 | #line 191 "parse-gram.y" | |
1061 | { fprintf (stderr, "[%s]", (yyvaluep->uniqstr)); }; | |
1062 | ||
1063 | /* Line 819 of yacc.c */ | |
1064 | #line 1065 "parse-gram.c" | |
1065 | break; | |
1066 | case 45: /* "\"char\"" */ | |
1067 | ||
1068 | /* Line 819 of yacc.c */ | |
1069 | #line 178 "parse-gram.y" | |
1070 | { fputs (char_name ((yyvaluep->character)), stderr); }; | |
1071 | ||
1072 | /* Line 819 of yacc.c */ | |
1073 | #line 1074 "parse-gram.c" | |
1074 | break; | |
1075 | case 46: /* "\"epilogue\"" */ | |
1076 | ||
1077 | /* Line 819 of yacc.c */ | |
1078 | #line 186 "parse-gram.y" | |
1079 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1080 | ||
1081 | /* Line 819 of yacc.c */ | |
1082 | #line 1083 "parse-gram.c" | |
1083 | break; | |
1084 | case 48: /* "\"identifier\"" */ | |
1085 | ||
1086 | /* Line 819 of yacc.c */ | |
1087 | #line 190 "parse-gram.y" | |
1088 | { fputs ((yyvaluep->uniqstr), stderr); }; | |
1089 | ||
1090 | /* Line 819 of yacc.c */ | |
1091 | #line 1092 "parse-gram.c" | |
1092 | break; | |
1093 | case 49: /* "\"identifier:\"" */ | |
1094 | ||
1095 | /* Line 819 of yacc.c */ | |
1096 | #line 192 "parse-gram.y" | |
1097 | { fprintf (stderr, "%s:", (yyvaluep->uniqstr)); }; | |
1098 | ||
1099 | /* Line 819 of yacc.c */ | |
1100 | #line 1101 "parse-gram.c" | |
1101 | break; | |
1102 | case 52: /* "\"%{...%}\"" */ | |
1103 | ||
1104 | /* Line 819 of yacc.c */ | |
1105 | #line 186 "parse-gram.y" | |
1106 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1107 | ||
1108 | /* Line 819 of yacc.c */ | |
1109 | #line 1110 "parse-gram.c" | |
1110 | break; | |
1111 | case 54: /* "\"type\"" */ | |
1112 | ||
1113 | /* Line 819 of yacc.c */ | |
1114 | #line 193 "parse-gram.y" | |
1115 | { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; | |
1116 | ||
1117 | /* Line 819 of yacc.c */ | |
1118 | #line 1119 "parse-gram.c" | |
1119 | break; | |
1120 | case 71: /* "symbol.prec" */ | |
1121 | ||
1122 | /* Line 819 of yacc.c */ | |
1123 | #line 199 "parse-gram.y" | |
1124 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1125 | ||
1126 | /* Line 819 of yacc.c */ | |
1127 | #line 1128 "parse-gram.c" | |
1128 | break; | |
1129 | case 84: /* "variable" */ | |
1130 | ||
1131 | /* Line 819 of yacc.c */ | |
1132 | #line 190 "parse-gram.y" | |
1133 | { fputs ((yyvaluep->uniqstr), stderr); }; | |
1134 | ||
1135 | /* Line 819 of yacc.c */ | |
1136 | #line 1137 "parse-gram.c" | |
1137 | break; | |
1138 | case 85: /* "content.opt" */ | |
1139 | ||
1140 | /* Line 819 of yacc.c */ | |
1141 | #line 186 "parse-gram.y" | |
1142 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1143 | ||
1144 | /* Line 819 of yacc.c */ | |
1145 | #line 1146 "parse-gram.c" | |
1146 | break; | |
1147 | case 86: /* "braceless" */ | |
1148 | ||
1149 | /* Line 819 of yacc.c */ | |
1150 | #line 186 "parse-gram.y" | |
1151 | { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; | |
1152 | ||
1153 | /* Line 819 of yacc.c */ | |
1154 | #line 1155 "parse-gram.c" | |
1155 | break; | |
1156 | case 87: /* "id" */ | |
1157 | ||
1158 | /* Line 819 of yacc.c */ | |
1159 | #line 199 "parse-gram.y" | |
1160 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1161 | ||
1162 | /* Line 819 of yacc.c */ | |
1163 | #line 1164 "parse-gram.c" | |
1164 | break; | |
1165 | case 88: /* "id_colon" */ | |
1166 | ||
1167 | /* Line 819 of yacc.c */ | |
1168 | #line 200 "parse-gram.y" | |
1169 | { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; | |
1170 | ||
1171 | /* Line 819 of yacc.c */ | |
1172 | #line 1173 "parse-gram.c" | |
1173 | break; | |
1174 | case 89: /* "symbol" */ | |
1175 | ||
1176 | /* Line 819 of yacc.c */ | |
1177 | #line 199 "parse-gram.y" | |
1178 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1179 | ||
1180 | /* Line 819 of yacc.c */ | |
1181 | #line 1182 "parse-gram.c" | |
1182 | break; | |
1183 | case 90: /* "string_as_id" */ | |
1184 | ||
1185 | /* Line 819 of yacc.c */ | |
1186 | #line 199 "parse-gram.y" | |
1187 | { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; | |
1188 | ||
1189 | /* Line 819 of yacc.c */ | |
1190 | #line 1191 "parse-gram.c" | |
1191 | break; | |
1192 | default: | |
1193 | break; | |
1194 | } | |
1195 | } | |
1196 | ||
1197 | ||
1198 | /*--------------------------------. | |
1199 | | Print this symbol on YYOUTPUT. | | |
1200 | `--------------------------------*/ | |
1201 | ||
1202 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1203 | || defined __cplusplus || defined _MSC_VER) | |
1204 | static void | |
1205 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) | |
1206 | #else | |
1207 | static void | |
1208 | yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) | |
1209 | FILE *yyoutput; | |
1210 | int yytype; | |
1211 | YYSTYPE const * const yyvaluep; | |
1212 | YYLTYPE const * const yylocationp; | |
1213 | #endif | |
1214 | { | |
1215 | if (yytype < YYNTOKENS) | |
1216 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | |
1217 | else | |
1218 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | |
1219 | ||
1220 | YY_LOCATION_PRINT (yyoutput, *yylocationp); | |
1221 | YYFPRINTF (yyoutput, ": "); | |
1222 | yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); | |
1223 | YYFPRINTF (yyoutput, ")"); | |
1224 | } | |
1225 | ||
1226 | /*------------------------------------------------------------------. | |
1227 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | |
1228 | | TOP (included). | | |
1229 | `------------------------------------------------------------------*/ | |
1230 | ||
1231 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1232 | || defined __cplusplus || defined _MSC_VER) | |
1233 | static void | |
1234 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) | |
1235 | #else | |
1236 | static void | |
1237 | yy_stack_print (yybottom, yytop) | |
1238 | yytype_int16 *yybottom; | |
1239 | yytype_int16 *yytop; | |
1240 | #endif | |
1241 | { | |
1242 | YYFPRINTF (stderr, "Stack now"); | |
1243 | for (; yybottom <= yytop; yybottom++) | |
1244 | { | |
1245 | int yybot = *yybottom; | |
1246 | YYFPRINTF (stderr, " %d", yybot); | |
1247 | } | |
1248 | YYFPRINTF (stderr, "\n"); | |
1249 | } | |
1250 | ||
1251 | # define YY_STACK_PRINT(Bottom, Top) \ | |
1252 | do { \ | |
1253 | if (yydebug) \ | |
1254 | yy_stack_print ((Bottom), (Top)); \ | |
1255 | } while (YYID (0)) | |
1256 | ||
1257 | ||
1258 | /*------------------------------------------------. | |
1259 | | Report that the YYRULE is going to be reduced. | | |
1260 | `------------------------------------------------*/ | |
1261 | ||
1262 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1263 | || defined __cplusplus || defined _MSC_VER) | |
1264 | static void | |
1265 | yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) | |
1266 | #else | |
1267 | static void | |
1268 | yy_reduce_print (yyvsp, yylsp, yyrule) | |
1269 | YYSTYPE *yyvsp; | |
1270 | YYLTYPE *yylsp; | |
1271 | int yyrule; | |
1272 | #endif | |
1273 | { | |
1274 | int yynrhs = yyr2[yyrule]; | |
1275 | int yyi; | |
1276 | unsigned long int yylno = yyrline[yyrule]; | |
1277 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", | |
1278 | yyrule - 1, yylno); | |
1279 | /* The symbols being reduced. */ | |
1280 | for (yyi = 0; yyi < yynrhs; yyi++) | |
1281 | { | |
1282 | YYFPRINTF (stderr, " $%d = ", yyi + 1); | |
1283 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | |
1284 | &(yyvsp[(yyi + 1) - (yynrhs)]) | |
1285 | , &(yylsp[(yyi + 1) - (yynrhs)]) ); | |
1286 | YYFPRINTF (stderr, "\n"); | |
1287 | } | |
1288 | } | |
1289 | ||
1290 | # define YY_REDUCE_PRINT(Rule) \ | |
1291 | do { \ | |
1292 | if (yydebug) \ | |
1293 | yy_reduce_print (yyvsp, yylsp, Rule); \ | |
1294 | } while (YYID (0)) | |
1295 | ||
1296 | /* Nonzero means print parse trace. It is left uninitialized so that | |
1297 | multiple parsers can coexist. */ | |
1298 | int yydebug; | |
1299 | #else /* !YYDEBUG */ | |
1300 | # define YYDPRINTF(Args) | |
1301 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | |
1302 | # define YY_STACK_PRINT(Bottom, Top) | |
1303 | # define YY_REDUCE_PRINT(Rule) | |
1304 | #endif /* !YYDEBUG */ | |
1305 | ||
1306 | ||
1307 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
1308 | #ifndef YYINITDEPTH | |
1309 | # define YYINITDEPTH 200 | |
1310 | #endif | |
1311 | ||
1312 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | |
1313 | if the built-in stack extension method is used). | |
1314 | ||
1315 | Do not make this value too large; the results are undefined if | |
1316 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) | |
1317 | evaluated with infinite-precision integer arithmetic. */ | |
1318 | ||
1319 | #ifndef YYMAXDEPTH | |
1320 | # define YYMAXDEPTH 10000 | |
1321 | #endif | |
1322 | ||
1323 | /* Given a state stack such that *YYBOTTOM is its bottom, such that | |
1324 | *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty | |
1325 | stack, and such that *YYCAPACITY is the maximum number of elements it | |
1326 | can hold without a reallocation, make sure there is enough room to | |
1327 | store YYADD more elements. If not, allocate a new stack using | |
1328 | YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM, | |
1329 | *YYTOP, and *YYCAPACITY to reflect the new capacity and memory | |
1330 | location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack | |
1331 | using YYSTACK_FREE. Return 0 if successful or if no reallocation is | |
1332 | required. Return 1 if memory is exhausted. */ | |
1333 | static int | |
1334 | yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd, | |
1335 | #if YYDEBUG | |
1336 | char const *yydebug_prefix, | |
1337 | char const *yydebug_suffix, | |
1338 | #endif | |
1339 | yytype_int16 **yybottom, | |
1340 | yytype_int16 *yybottom_no_free, | |
1341 | yytype_int16 **yytop, yytype_int16 *yytop_empty) | |
1342 | { | |
1343 | YYSIZE_T yysize_old = | |
1344 | *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1; | |
1345 | YYSIZE_T yysize_new = yysize_old + yyadd; | |
1346 | if (*yycapacity < yysize_new) | |
1347 | { | |
1348 | YYSIZE_T yyalloc = 2 * yysize_new; | |
1349 | yytype_int16 *yybottom_new; | |
1350 | /* Use YYMAXDEPTH for maximum stack size given that the stack | |
1351 | should never need to grow larger than the main state stack | |
1352 | needs to grow without LAC. */ | |
1353 | if (YYMAXDEPTH < yysize_new) | |
1354 | { | |
1355 | YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix, | |
1356 | yydebug_suffix)); | |
1357 | return 1; | |
1358 | } | |
1359 | if (YYMAXDEPTH < yyalloc) | |
1360 | yyalloc = YYMAXDEPTH; | |
1361 | yybottom_new = | |
1362 | (yytype_int16*) YYSTACK_ALLOC (yyalloc * sizeof *yybottom_new); | |
1363 | if (!yybottom_new) | |
1364 | { | |
1365 | YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix, | |
1366 | yydebug_suffix)); | |
1367 | return 1; | |
1368 | } | |
1369 | if (*yytop != yytop_empty) | |
1370 | { | |
1371 | YYCOPY (yybottom_new, *yybottom, yysize_old); | |
1372 | *yytop = yybottom_new + (yysize_old - 1); | |
1373 | } | |
1374 | if (*yybottom != yybottom_no_free) | |
1375 | YYSTACK_FREE (*yybottom); | |
1376 | *yybottom = yybottom_new; | |
1377 | *yycapacity = yyalloc; | |
1378 | } | |
1379 | return 0; | |
1380 | } | |
1381 | ||
1382 | /* Establish the initial context for the current lookahead if no initial | |
1383 | context is currently established. | |
1384 | ||
1385 | We define a context as a snapshot of the parser stacks. We define | |
1386 | the initial context for a lookahead as the context in which the | |
1387 | parser initially examines that lookahead in order to select a | |
1388 | syntactic action. Thus, if the lookahead eventually proves | |
1389 | syntactically unacceptable (possibly in a later context reached via a | |
1390 | series of reductions), the initial context can be used to determine | |
1391 | the exact set of tokens that would be syntactically acceptable in the | |
1392 | lookahead's place. Moreover, it is the context after which any | |
1393 | further semantic actions would be erroneous because they would be | |
1394 | determined by a syntactically unacceptable token. | |
1395 | ||
1396 | YY_LAC_ESTABLISH should be invoked when a reduction is about to be | |
1397 | performed in an inconsistent state (which, for the purposes of LAC, | |
1398 | includes consistent states that don't know they're consistent because | |
1399 | their default reductions have been disabled). Iff there is a | |
1400 | lookahead token, it should also be invoked before reporting a syntax | |
1401 | error. This latter case is for the sake of the debugging output. | |
1402 | ||
1403 | For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as | |
1404 | follows. If no initial context is currently established for the | |
1405 | current lookahead, then check if that lookahead can eventually be | |
1406 | shifted if syntactic actions continue from the current context. | |
1407 | Report a syntax error if it cannot. */ | |
1408 | #define YY_LAC_ESTABLISH \ | |
1409 | do { \ | |
1410 | if (!yy_lac_established) \ | |
1411 | { \ | |
1412 | YYDPRINTF ((stderr, \ | |
1413 | "LAC: initial context established for %s\n", \ | |
1414 | yytname[yytoken])); \ | |
1415 | yy_lac_established = 1; \ | |
1416 | { \ | |
1417 | int yy_lac_status = \ | |
1418 | yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \ | |
1419 | if (yy_lac_status == 2) \ | |
1420 | goto yyexhaustedlab; \ | |
1421 | if (yy_lac_status == 1) \ | |
1422 | goto yyerrlab; \ | |
1423 | } \ | |
1424 | } \ | |
1425 | } while (YYID (0)) | |
1426 | ||
1427 | /* Discard any previous initial lookahead context because of Event, | |
1428 | which may be a lookahead change or an invalidation of the currently | |
1429 | established initial context for the current lookahead. | |
1430 | ||
1431 | The most common example of a lookahead change is a shift. An example | |
1432 | of both cases is syntax error recovery. That is, a syntax error | |
1433 | occurs when the lookahead is syntactically erroneous for the | |
1434 | currently established initial context, so error recovery manipulates | |
1435 | the parser stacks to try to find a new initial context in which the | |
1436 | current lookahead is syntactically acceptable. If it fails to find | |
1437 | such a context, it discards the lookahead. */ | |
1438 | #if YYDEBUG | |
1439 | # define YY_LAC_DISCARD(Event) \ | |
1440 | do { \ | |
1441 | if (yy_lac_established) \ | |
1442 | { \ | |
1443 | if (yydebug) \ | |
1444 | YYFPRINTF (stderr, "LAC: initial context discarded due to " \ | |
1445 | Event "\n"); \ | |
1446 | yy_lac_established = 0; \ | |
1447 | } \ | |
1448 | } while (YYID (0)) | |
1449 | #else | |
1450 | # define YY_LAC_DISCARD(Event) yy_lac_established = 0 | |
1451 | #endif | |
1452 | ||
1453 | /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can | |
1454 | eventually (after perhaps some reductions) be shifted, return 1 if | |
1455 | not, or return 2 if memory is exhausted. As preconditions and | |
1456 | postconditions: *YYES_CAPACITY is the allocated size of the array to | |
1457 | which *YYES points, and either *YYES = YYESA or *YYES points to an | |
1458 | array allocated with YYSTACK_ALLOC. yy_lac may overwrite the | |
1459 | contents of either array, alter *YYES and *YYES_CAPACITY, and free | |
1460 | any old *YYES other than YYESA. */ | |
1461 | static int | |
1462 | yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes, | |
1463 | YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken) | |
1464 | { | |
1465 | yytype_int16 *yyes_prev = yyssp; | |
1466 | yytype_int16 *yyesp = yyes_prev; | |
1467 | YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yytname[yytoken])); | |
1468 | if (yytoken == YYUNDEFTOK) | |
1469 | { | |
1470 | YYDPRINTF ((stderr, " Always Err\n")); | |
1471 | return 1; | |
1472 | } | |
1473 | while (1) | |
1474 | { | |
1475 | int yyrule = yypact[*yyesp]; | |
1476 | if (yypact_value_is_default (yyrule) | |
1477 | || (yyrule += yytoken) < 0 || YYLAST < yyrule | |
1478 | || yycheck[yyrule] != yytoken) | |
1479 | { | |
1480 | yyrule = yydefact[*yyesp]; | |
1481 | if (yyrule == 0) | |
1482 | { | |
1483 | YYDPRINTF ((stderr, " Err\n")); | |
1484 | return 1; | |
1485 | } | |
1486 | } | |
1487 | else | |
1488 | { | |
1489 | yyrule = yytable[yyrule]; | |
1490 | if (yytable_value_is_error (yyrule)) | |
1491 | { | |
1492 | YYDPRINTF ((stderr, " Err\n")); | |
1493 | return 1; | |
1494 | } | |
1495 | if (0 < yyrule) | |
1496 | { | |
1497 | YYDPRINTF ((stderr, " S%d\n", yyrule)); | |
1498 | return 0; | |
1499 | } | |
1500 | yyrule = -yyrule; | |
1501 | } | |
1502 | { | |
1503 | YYSIZE_T yylen = yyr2[yyrule]; | |
1504 | YYDPRINTF ((stderr, " R%d", yyrule - 1)); | |
1505 | if (yyesp != yyes_prev) | |
1506 | { | |
1507 | YYSIZE_T yysize = yyesp - *yyes + 1; | |
1508 | if (yylen < yysize) | |
1509 | { | |
1510 | yyesp -= yylen; | |
1511 | yylen = 0; | |
1512 | } | |
1513 | else | |
1514 | { | |
1515 | yylen -= yysize; | |
1516 | yyesp = yyes_prev; | |
1517 | } | |
1518 | } | |
1519 | if (yylen) | |
1520 | yyesp = yyes_prev -= yylen; | |
1521 | } | |
1522 | { | |
1523 | int yystate; | |
1524 | { | |
1525 | int yylhs = yyr1[yyrule] - YYNTOKENS; | |
1526 | yystate = yypgoto[yylhs] + *yyesp; | |
1527 | if (yystate < 0 || YYLAST < yystate | |
1528 | || yycheck[yystate] != *yyesp) | |
1529 | yystate = yydefgoto[yylhs]; | |
1530 | else | |
1531 | yystate = yytable[yystate]; | |
1532 | } | |
1533 | if (yyesp == yyes_prev) | |
1534 | { | |
1535 | yyesp = *yyes; | |
1536 | *yyesp = yystate; | |
1537 | } | |
1538 | else | |
1539 | { | |
1540 | if (yy_lac_stack_realloc (yyes_capacity, 1, | |
1541 | #if YYDEBUG | |
1542 | " (", ")", | |
1543 | #endif | |
1544 | yyes, yyesa, &yyesp, yyes_prev)) | |
1545 | { | |
1546 | YYDPRINTF ((stderr, "\n")); | |
1547 | return 2; | |
1548 | } | |
1549 | *++yyesp = yystate; | |
1550 | } | |
1551 | YYDPRINTF ((stderr, " G%d", *yyesp)); | |
1552 | } | |
1553 | } | |
1554 | } | |
1555 | ||
1556 | ||
1557 | #if YYERROR_VERBOSE | |
1558 | ||
1559 | # ifndef yystrlen | |
1560 | # if defined __GLIBC__ && defined _STRING_H | |
1561 | # define yystrlen strlen | |
1562 | # else | |
1563 | /* Return the length of YYSTR. */ | |
1564 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1565 | || defined __cplusplus || defined _MSC_VER) | |
1566 | static YYSIZE_T | |
1567 | yystrlen (const char *yystr) | |
1568 | #else | |
1569 | static YYSIZE_T | |
1570 | yystrlen (yystr) | |
1571 | const char *yystr; | |
1572 | #endif | |
1573 | { | |
1574 | YYSIZE_T yylen; | |
1575 | for (yylen = 0; yystr[yylen]; yylen++) | |
1576 | continue; | |
1577 | return yylen; | |
1578 | } | |
1579 | # endif | |
1580 | # endif | |
1581 | ||
1582 | # ifndef yystpcpy | |
1583 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE | |
1584 | # define yystpcpy stpcpy | |
1585 | # else | |
1586 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
1587 | YYDEST. */ | |
1588 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1589 | || defined __cplusplus || defined _MSC_VER) | |
1590 | static char * | |
1591 | yystpcpy (char *yydest, const char *yysrc) | |
1592 | #else | |
1593 | static char * | |
1594 | yystpcpy (yydest, yysrc) | |
1595 | char *yydest; | |
1596 | const char *yysrc; | |
1597 | #endif | |
1598 | { | |
1599 | char *yyd = yydest; | |
1600 | const char *yys = yysrc; | |
1601 | ||
1602 | while ((*yyd++ = *yys++) != '\0') | |
1603 | continue; | |
1604 | ||
1605 | return yyd - 1; | |
1606 | } | |
1607 | # endif | |
1608 | # endif | |
1609 | ||
1610 | # ifndef yytnamerr | |
1611 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | |
1612 | quotes and backslashes, so that it's suitable for yyerror. The | |
1613 | heuristic is that double-quoting is unnecessary unless the string | |
1614 | contains an apostrophe, a comma, or backslash (other than | |
1615 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | |
1616 | null, do not copy; instead, return the length of what the result | |
1617 | would have been. */ | |
1618 | static YYSIZE_T | |
1619 | yytnamerr (char *yyres, const char *yystr) | |
1620 | { | |
1621 | if (*yystr == '"') | |
1622 | { | |
1623 | YYSIZE_T yyn = 0; | |
1624 | char const *yyp = yystr; | |
1625 | ||
1626 | for (;;) | |
1627 | switch (*++yyp) | |
1628 | { | |
1629 | case '\'': | |
1630 | case ',': | |
1631 | goto do_not_strip_quotes; | |
1632 | ||
1633 | case '\\': | |
1634 | if (*++yyp != '\\') | |
1635 | goto do_not_strip_quotes; | |
1636 | /* Fall through. */ | |
1637 | default: | |
1638 | if (yyres) | |
1639 | yyres[yyn] = *yyp; | |
1640 | yyn++; | |
1641 | break; | |
1642 | ||
1643 | case '"': | |
1644 | if (yyres) | |
1645 | yyres[yyn] = '\0'; | |
1646 | return yyn; | |
1647 | } | |
1648 | do_not_strip_quotes: ; | |
1649 | } | |
1650 | ||
1651 | if (! yyres) | |
1652 | return yystrlen (yystr); | |
1653 | ||
1654 | return yystpcpy (yyres, yystr) - yyres; | |
1655 | } | |
1656 | # endif | |
1657 | ||
1658 | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message | |
1659 | about the unexpected token YYTOKEN for the state stack whose top is | |
1660 | YYSSP. In order to see if a particular token T is a | |
1661 | valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T). | |
1662 | ||
1663 | Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is | |
1664 | not large enough to hold the message. In that case, also set | |
1665 | *YYMSG_ALLOC to the required number of bytes. Return 2 if the | |
1666 | required number of bytes is too large to store or if | |
1667 | yy_lac returned 2. */ | |
1668 | static int | |
1669 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |
1670 | yytype_int16 *yyesa, yytype_int16 **yyes, | |
1671 | YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken) | |
1672 | { | |
1673 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); | |
1674 | YYSIZE_T yysize = yysize0; | |
1675 | YYSIZE_T yysize1; | |
1676 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; | |
1677 | /* Internationalized format string. */ | |
1678 | const char *yyformat = 0; | |
1679 | /* Arguments of yyformat. */ | |
1680 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | |
1681 | /* Number of reported tokens (one for the "unexpected", one per | |
1682 | "expected"). */ | |
1683 | int yycount = 0; | |
1684 | ||
1685 | /* There are many possibilities here to consider: | |
1686 | - Assume YYFAIL is not used. It's too flawed to consider. See | |
1687 | <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> | |
1688 | for details. YYERROR is fine as it does not invoke this | |
1689 | function. | |
1690 | - If this state is a consistent state with a default action, then | |
1691 | the only way this function was invoked is if the default action | |
1692 | is an error action. In that case, don't check for expected | |
1693 | tokens because there are none. | |
1694 | - The only way there can be no lookahead present (in yychar) is if | |
1695 | this state is a consistent state with a default action. Thus, | |
1696 | detecting the absence of a lookahead is sufficient to determine | |
1697 | that there is no unexpected or expected token to report. In that | |
1698 | case, just report a simple "syntax error". | |
1699 | - Don't assume there isn't a lookahead just because this state is a | |
1700 | consistent state with a default action. There might have been a | |
1701 | previous inconsistent state, consistent state with a non-default | |
1702 | action, or user semantic action that manipulated yychar. | |
1703 | In the first two cases, it might appear that the current syntax | |
1704 | error should have been detected in the previous state when yy_lac | |
1705 | was invoked. However, at that time, there might have been a | |
1706 | different syntax error that discarded a different initial context | |
1707 | during error recovery, leaving behind the current lookahead. | |
1708 | */ | |
1709 | if (yytoken != YYEMPTY) | |
1710 | { | |
1711 | int yyn = yypact[*yyssp]; | |
1712 | YYDPRINTF ((stderr, "Constructing syntax error message\n")); | |
1713 | yyarg[yycount++] = yytname[yytoken]; | |
1714 | if (!yypact_value_is_default (yyn)) | |
1715 | { | |
1716 | int yyx; | |
1717 | ||
1718 | for (yyx = 0; yyx < YYNTOKENS; ++yyx) | |
1719 | if (yyx != YYTERROR && yyx != YYUNDEFTOK) | |
1720 | { | |
1721 | { | |
1722 | int yy_lac_status = yy_lac (yyesa, yyes, yyes_capacity, | |
1723 | yyssp, yyx); | |
1724 | if (yy_lac_status == 2) | |
1725 | return 2; | |
1726 | if (yy_lac_status == 1) | |
1727 | continue; | |
1728 | } | |
1729 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) | |
1730 | { | |
1731 | yycount = 1; | |
1732 | yysize = yysize0; | |
1733 | break; | |
1734 | } | |
1735 | yyarg[yycount++] = yytname[yyx]; | |
1736 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | |
1737 | if (! (yysize <= yysize1 | |
1738 | && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | |
1739 | return 2; | |
1740 | yysize = yysize1; | |
1741 | } | |
1742 | } | |
1743 | # if YYDEBUG | |
1744 | else if (yydebug) | |
1745 | YYFPRINTF (stderr, "No expected tokens.\n"); | |
1746 | # endif | |
1747 | } | |
1748 | ||
1749 | switch (yycount) | |
1750 | { | |
1751 | # define YYCASE_(N, S) \ | |
1752 | case N: \ | |
1753 | yyformat = S; \ | |
1754 | break | |
1755 | YYCASE_(0, YY_("syntax error")); | |
1756 | YYCASE_(1, YY_("syntax error, unexpected %s")); | |
1757 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); | |
1758 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); | |
1759 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); | |
1760 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); | |
1761 | # undef YYCASE_ | |
1762 | } | |
1763 | ||
1764 | yysize1 = yysize + yystrlen (yyformat); | |
1765 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | |
1766 | return 2; | |
1767 | yysize = yysize1; | |
1768 | ||
1769 | if (*yymsg_alloc < yysize) | |
1770 | { | |
1771 | *yymsg_alloc = 2 * yysize; | |
1772 | if (! (yysize <= *yymsg_alloc | |
1773 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) | |
1774 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; | |
1775 | return 1; | |
1776 | } | |
1777 | ||
1778 | /* Avoid sprintf, as that infringes on the user's name space. | |
1779 | Don't have undefined behavior even if the translation | |
1780 | produced a string with the wrong number of "%s"s. */ | |
1781 | { | |
1782 | char *yyp = *yymsg; | |
1783 | int yyi = 0; | |
1784 | while ((*yyp = *yyformat) != '\0') | |
1785 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) | |
1786 | { | |
1787 | yyp += yytnamerr (yyp, yyarg[yyi++]); | |
1788 | yyformat += 2; | |
1789 | } | |
1790 | else | |
1791 | { | |
1792 | yyp++; | |
1793 | yyformat++; | |
1794 | } | |
1795 | } | |
1796 | return 0; | |
1797 | } | |
1798 | #endif /* YYERROR_VERBOSE */ | |
1799 | ||
1800 | /*-----------------------------------------------. | |
1801 | | Release the memory associated to this symbol. | | |
1802 | `-----------------------------------------------*/ | |
1803 | ||
1804 | /*ARGSUSED*/ | |
1805 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1806 | || defined __cplusplus || defined _MSC_VER) | |
1807 | static void | |
1808 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) | |
1809 | #else | |
1810 | static void | |
1811 | yydestruct (yymsg, yytype, yyvaluep, yylocationp) | |
1812 | const char *yymsg; | |
1813 | int yytype; | |
1814 | YYSTYPE *yyvaluep; | |
1815 | YYLTYPE *yylocationp; | |
1816 | #endif | |
1817 | { | |
1818 | YYUSE (yyvaluep); | |
1819 | YYUSE (yylocationp); | |
1820 | ||
1821 | if (!yymsg) | |
1822 | yymsg = "Deleting"; | |
1823 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | |
1824 | ||
1825 | switch (yytype) | |
1826 | { | |
1827 | ||
1828 | default: | |
1829 | break; | |
1830 | } | |
1831 | } | |
1832 | ||
1833 | ||
1834 | /* Prevent warnings from -Wmissing-prototypes. */ | |
1835 | #ifdef YYPARSE_PARAM | |
1836 | #if defined __STDC__ || defined __cplusplus | |
1837 | int yyparse (void *YYPARSE_PARAM); | |
1838 | #else | |
1839 | int yyparse (); | |
1840 | #endif | |
1841 | #else /* ! YYPARSE_PARAM */ | |
1842 | #if defined __STDC__ || defined __cplusplus | |
1843 | int yyparse (void); | |
1844 | #else | |
1845 | int yyparse (); | |
1846 | #endif | |
1847 | #endif /* ! YYPARSE_PARAM */ | |
1848 | ||
1849 | ||
1850 | /*----------. | |
1851 | | yyparse. | | |
1852 | `----------*/ | |
1853 | ||
1854 | #ifdef YYPARSE_PARAM | |
1855 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1856 | || defined __cplusplus || defined _MSC_VER) | |
1857 | int | |
1858 | yyparse (void *YYPARSE_PARAM) | |
1859 | #else | |
1860 | int | |
1861 | yyparse (YYPARSE_PARAM) | |
1862 | void *YYPARSE_PARAM; | |
1863 | #endif | |
1864 | #else /* ! YYPARSE_PARAM */ | |
1865 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1866 | || defined __cplusplus || defined _MSC_VER) | |
1867 | int | |
1868 | yyparse (void) | |
1869 | #else | |
1870 | int | |
1871 | yyparse () | |
1872 | ||
1873 | #endif | |
1874 | #endif | |
1875 | { | |
1876 | /* The lookahead symbol. */ | |
1877 | int yychar; | |
1878 | ||
1879 | /* The semantic value of the lookahead symbol. */ | |
1880 | YYSTYPE yylval; | |
1881 | ||
1882 | /* Location data for the lookahead symbol. */ | |
1883 | YYLTYPE yylloc; | |
1884 | ||
1885 | /* Number of syntax errors so far. */ | |
1886 | int yynerrs; | |
1887 | ||
1888 | int yystate; | |
1889 | /* Number of tokens to shift before error messages enabled. */ | |
1890 | int yyerrstatus; | |
1891 | ||
1892 | /* The stacks and their tools: | |
1893 | `yyss': related to states. | |
1894 | `yyvs': related to semantic values. | |
1895 | `yyls': related to locations. | |
1896 | ||
1897 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
1898 | to reallocate them elsewhere. */ | |
1899 | ||
1900 | /* The state stack. */ | |
1901 | yytype_int16 yyssa[YYINITDEPTH]; | |
1902 | yytype_int16 *yyss; | |
1903 | yytype_int16 *yyssp; | |
1904 | ||
1905 | /* The semantic value stack. */ | |
1906 | YYSTYPE yyvsa[YYINITDEPTH]; | |
1907 | YYSTYPE *yyvs; | |
1908 | YYSTYPE *yyvsp; | |
1909 | ||
1910 | /* The location stack. */ | |
1911 | YYLTYPE yylsa[YYINITDEPTH]; | |
1912 | YYLTYPE *yyls; | |
1913 | YYLTYPE *yylsp; | |
1914 | ||
1915 | /* The locations where the error started and ended. */ | |
1916 | YYLTYPE yyerror_range[3]; | |
1917 | ||
1918 | YYSIZE_T yystacksize; | |
1919 | ||
1920 | yytype_int16 yyesa[20]; | |
1921 | yytype_int16 *yyes; | |
1922 | YYSIZE_T yyes_capacity; | |
1923 | ||
1924 | int yy_lac_established = 0; | |
1925 | int yyn; | |
1926 | int yyresult; | |
1927 | /* Lookahead token as an internal (translated) token number. */ | |
1928 | int yytoken; | |
1929 | /* The variables used to return semantic value and location from the | |
1930 | action routines. */ | |
1931 | YYSTYPE yyval; | |
1932 | YYLTYPE yyloc; | |
1933 | ||
1934 | #if YYERROR_VERBOSE | |
1935 | /* Buffer for error messages, and its allocated size. */ | |
1936 | char yymsgbuf[128]; | |
1937 | char *yymsg = yymsgbuf; | |
1938 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | |
1939 | #endif | |
1940 | ||
1941 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) | |
1942 | ||
1943 | /* The number of symbols on the RHS of the reduced rule. | |
1944 | Keep to zero when no symbol should be popped. */ | |
1945 | int yylen = 0; | |
1946 | ||
1947 | yytoken = 0; | |
1948 | yyss = yyssa; | |
1949 | yyvs = yyvsa; | |
1950 | yyls = yylsa; | |
1951 | yystacksize = YYINITDEPTH; | |
1952 | ||
1953 | yyes = yyesa; | |
1954 | yyes_capacity = sizeof yyesa / sizeof *yyes; | |
1955 | if (YYMAXDEPTH < yyes_capacity) | |
1956 | yyes_capacity = YYMAXDEPTH; | |
1957 | ||
1958 | YYDPRINTF ((stderr, "Starting parse\n")); | |
1959 | ||
1960 | yystate = 0; | |
1961 | yyerrstatus = 0; | |
1962 | yynerrs = 0; | |
1963 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
1964 | ||
1965 | /* Initialize stack pointers. | |
1966 | Waste one element of value and location stack | |
1967 | so that they stay on the same level as the state stack. | |
1968 | The wasted elements are never initialized. */ | |
1969 | yyssp = yyss; | |
1970 | yyvsp = yyvs; | |
1971 | yylsp = yyls; | |
1972 | ||
1973 | #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL | |
1974 | /* Initialize the default location before parsing starts. */ | |
1975 | yylloc.first_line = yylloc.last_line = 1; | |
1976 | yylloc.first_column = yylloc.last_column = 1; | |
1977 | #endif | |
1978 | ||
1979 | /* User initialization code. */ | |
1980 | ||
1981 | /* Line 1590 of yacc.c */ | |
1982 | #line 86 "parse-gram.y" | |
1983 | { | |
1984 | /* Bison's grammar can initial empty locations, hence a default | |
1985 | location is needed. */ | |
1986 | boundary_set (&yylloc.start, current_file, 1, 1); | |
1987 | boundary_set (&yylloc.end, current_file, 1, 1); | |
1988 | } | |
1989 | ||
1990 | /* Line 1590 of yacc.c */ | |
1991 | #line 1992 "parse-gram.c" | |
1992 | yylsp[0] = yylloc; | |
1993 | ||
1994 | goto yysetstate; | |
1995 | ||
1996 | /*------------------------------------------------------------. | |
1997 | | yynewstate -- Push a new state, which is found in yystate. | | |
1998 | `------------------------------------------------------------*/ | |
1999 | yynewstate: | |
2000 | /* In all cases, when you get here, the value and location stacks | |
2001 | have just been pushed. So pushing a state here evens the stacks. */ | |
2002 | yyssp++; | |
2003 | ||
2004 | yysetstate: | |
2005 | *yyssp = yystate; | |
2006 | ||
2007 | if (yyss + yystacksize - 1 <= yyssp) | |
2008 | { | |
2009 | /* Get the current used size of the three stacks, in elements. */ | |
2010 | YYSIZE_T yysize = yyssp - yyss + 1; | |
2011 | ||
2012 | #ifdef yyoverflow | |
2013 | { | |
2014 | /* Give user a chance to reallocate the stack. Use copies of | |
2015 | these so that the &'s don't force the real ones into | |
2016 | memory. */ | |
2017 | YYSTYPE *yyvs1 = yyvs; | |
2018 | yytype_int16 *yyss1 = yyss; | |
2019 | YYLTYPE *yyls1 = yyls; | |
2020 | ||
2021 | /* Each stack pointer address is followed by the size of the | |
2022 | data in use in that stack, in bytes. This used to be a | |
2023 | conditional around just the two extra args, but that might | |
2024 | be undefined if yyoverflow is a macro. */ | |
2025 | yyoverflow (YY_("memory exhausted"), | |
2026 | &yyss1, yysize * sizeof (*yyssp), | |
2027 | &yyvs1, yysize * sizeof (*yyvsp), | |
2028 | &yyls1, yysize * sizeof (*yylsp), | |
2029 | &yystacksize); | |
2030 | ||
2031 | yyls = yyls1; | |
2032 | yyss = yyss1; | |
2033 | yyvs = yyvs1; | |
2034 | } | |
2035 | #else /* no yyoverflow */ | |
2036 | # ifndef YYSTACK_RELOCATE | |
2037 | goto yyexhaustedlab; | |
2038 | # else | |
2039 | /* Extend the stack our own way. */ | |
2040 | if (YYMAXDEPTH <= yystacksize) | |
2041 | goto yyexhaustedlab; | |
2042 | yystacksize *= 2; | |
2043 | if (YYMAXDEPTH < yystacksize) | |
2044 | yystacksize = YYMAXDEPTH; | |
2045 | ||
2046 | { | |
2047 | yytype_int16 *yyss1 = yyss; | |
2048 | union yyalloc *yyptr = | |
2049 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
2050 | if (! yyptr) | |
2051 | goto yyexhaustedlab; | |
2052 | YYSTACK_RELOCATE (yyss_alloc, yyss); | |
2053 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | |
2054 | YYSTACK_RELOCATE (yyls_alloc, yyls); | |
2055 | # undef YYSTACK_RELOCATE | |
2056 | if (yyss1 != yyssa) | |
2057 | YYSTACK_FREE (yyss1); | |
2058 | } | |
2059 | # endif | |
2060 | #endif /* no yyoverflow */ | |
2061 | ||
2062 | yyssp = yyss + yysize - 1; | |
2063 | yyvsp = yyvs + yysize - 1; | |
2064 | yylsp = yyls + yysize - 1; | |
2065 | ||
2066 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | |
2067 | (unsigned long int) yystacksize)); | |
2068 | ||
2069 | if (yyss + yystacksize - 1 <= yyssp) | |
2070 | YYABORT; | |
2071 | } | |
2072 | ||
2073 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | |
2074 | ||
2075 | if (yystate == YYFINAL) | |
2076 | YYACCEPT; | |
2077 | ||
2078 | goto yybackup; | |
2079 | ||
2080 | /*-----------. | |
2081 | | yybackup. | | |
2082 | `-----------*/ | |
2083 | yybackup: | |
2084 | ||
2085 | /* Do appropriate processing given the current state. Read a | |
2086 | lookahead token if we need one and don't already have one. */ | |
2087 | ||
2088 | /* First try to decide what to do without reference to lookahead token. */ | |
2089 | yyn = yypact[yystate]; | |
2090 | if (yypact_value_is_default (yyn)) | |
2091 | goto yydefault; | |
2092 | ||
2093 | /* Not known => get a lookahead token if don't already have one. */ | |
2094 | ||
2095 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | |
2096 | if (yychar == YYEMPTY) | |
2097 | { | |
2098 | YYDPRINTF ((stderr, "Reading a token: ")); | |
2099 | yychar = YYLEX; | |
2100 | } | |
2101 | ||
2102 | if (yychar <= YYEOF) | |
2103 | { | |
2104 | yychar = yytoken = YYEOF; | |
2105 | YYDPRINTF ((stderr, "Now at end of input.\n")); | |
2106 | } | |
2107 | else | |
2108 | { | |
2109 | yytoken = YYTRANSLATE (yychar); | |
2110 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | |
2111 | } | |
2112 | ||
2113 | /* If the proper action on seeing token YYTOKEN is to reduce or to | |
2114 | detect an error, take that action. */ | |
2115 | yyn += yytoken; | |
2116 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | |
2117 | { | |
2118 | YY_LAC_ESTABLISH; | |
2119 | goto yydefault; | |
2120 | } | |
2121 | yyn = yytable[yyn]; | |
2122 | if (yyn <= 0) | |
2123 | { | |
2124 | if (yytable_value_is_error (yyn)) | |
2125 | goto yyerrlab; | |
2126 | YY_LAC_ESTABLISH; | |
2127 | yyn = -yyn; | |
2128 | goto yyreduce; | |
2129 | } | |
2130 | ||
2131 | /* Count tokens shifted since error; after three, turn off error | |
2132 | status. */ | |
2133 | if (yyerrstatus) | |
2134 | yyerrstatus--; | |
2135 | ||
2136 | /* Shift the lookahead token. */ | |
2137 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | |
2138 | ||
2139 | /* Discard the shifted token. */ | |
2140 | yychar = YYEMPTY; | |
2141 | YY_LAC_DISCARD ("shift"); | |
2142 | ||
2143 | yystate = yyn; | |
2144 | *++yyvsp = yylval; | |
2145 | *++yylsp = yylloc; | |
2146 | goto yynewstate; | |
2147 | ||
2148 | ||
2149 | /*-----------------------------------------------------------. | |
2150 | | yydefault -- do the default action for the current state. | | |
2151 | `-----------------------------------------------------------*/ | |
2152 | yydefault: | |
2153 | yyn = yydefact[yystate]; | |
2154 | if (yyn == 0) | |
2155 | goto yyerrlab; | |
2156 | goto yyreduce; | |
2157 | ||
2158 | ||
2159 | /*-----------------------------. | |
2160 | | yyreduce -- Do a reduction. | | |
2161 | `-----------------------------*/ | |
2162 | yyreduce: | |
2163 | /* yyn is the number of a rule to reduce with. */ | |
2164 | yylen = yyr2[yyn]; | |
2165 | ||
2166 | /* If YYLEN is nonzero, implement the default value of the action: | |
2167 | `$$ = $1'. | |
2168 | ||
2169 | Otherwise, the following line sets YYVAL to garbage. | |
2170 | This behavior is undocumented and Bison | |
2171 | users should not rely upon it. Assigning to YYVAL | |
2172 | unconditionally makes the parser a bit smaller, and it avoids a | |
2173 | GCC warning that YYVAL may be used uninitialized. */ | |
2174 | yyval = yyvsp[1-yylen]; | |
2175 | ||
2176 | /* Default location. */ | |
2177 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); | |
2178 | YY_REDUCE_PRINT (yyn); | |
2179 | { | |
2180 | int yychar_backup = yychar; | |
2181 | switch (yyn) | |
2182 | { | |
2183 | case 6: | |
2184 | ||
2185 | /* Line 1806 of yacc.c */ | |
2186 | #line 225 "parse-gram.y" | |
2187 | { | |
2188 | code_props plain_code; | |
2189 | code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); | |
2190 | code_props_translate_code (&plain_code); | |
2191 | gram_scanner_last_string_free (); | |
2192 | muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue", | |
2193 | plain_code.code, (yylsp[(1) - (1)])); | |
2194 | code_scanner_last_string_free (); | |
2195 | } | |
2196 | break; | |
2197 | ||
2198 | case 7: | |
2199 | ||
2200 | /* Line 1806 of yacc.c */ | |
2201 | #line 234 "parse-gram.y" | |
2202 | { debug_flag = true; } | |
2203 | break; | |
2204 | ||
2205 | case 8: | |
2206 | ||
2207 | /* Line 1806 of yacc.c */ | |
2208 | #line 236 "parse-gram.y" | |
2209 | { | |
2210 | muscle_percent_define_insert ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), | |
2211 | MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE); | |
2212 | } | |
2213 | break; | |
2214 | ||
2215 | case 9: | |
2216 | ||
2217 | /* Line 1806 of yacc.c */ | |
2218 | #line 240 "parse-gram.y" | |
2219 | { defines_flag = true; } | |
2220 | break; | |
2221 | ||
2222 | case 10: | |
2223 | ||
2224 | /* Line 1806 of yacc.c */ | |
2225 | #line 242 "parse-gram.y" | |
2226 | { | |
2227 | defines_flag = true; | |
2228 | spec_defines_file = xstrdup ((yyvsp[(2) - (2)].chars)); | |
2229 | } | |
2230 | break; | |
2231 | ||
2232 | case 11: | |
2233 | ||
2234 | /* Line 1806 of yacc.c */ | |
2235 | #line 246 "parse-gram.y" | |
2236 | { error_verbose = true; } | |
2237 | break; | |
2238 | ||
2239 | case 12: | |
2240 | ||
2241 | /* Line 1806 of yacc.c */ | |
2242 | #line 247 "parse-gram.y" | |
2243 | { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } | |
2244 | break; | |
2245 | ||
2246 | case 13: | |
2247 | ||
2248 | /* Line 1806 of yacc.c */ | |
2249 | #line 248 "parse-gram.y" | |
2250 | { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } | |
2251 | break; | |
2252 | ||
2253 | case 14: | |
2254 | ||
2255 | /* Line 1806 of yacc.c */ | |
2256 | #line 249 "parse-gram.y" | |
2257 | { spec_file_prefix = (yyvsp[(2) - (2)].chars); } | |
2258 | break; | |
2259 | ||
2260 | case 15: | |
2261 | ||
2262 | /* Line 1806 of yacc.c */ | |
2263 | #line 250 "parse-gram.y" | |
2264 | { spec_file_prefix = (yyvsp[(3) - (3)].chars); } | |
2265 | break; | |
2266 | ||
2267 | case 16: | |
2268 | ||
2269 | /* Line 1806 of yacc.c */ | |
2270 | #line 252 "parse-gram.y" | |
2271 | { | |
2272 | nondeterministic_parser = true; | |
2273 | glr_parser = true; | |
2274 | } | |
2275 | break; | |
2276 | ||
2277 | case 17: | |
2278 | ||
2279 | /* Line 1806 of yacc.c */ | |
2280 | #line 257 "parse-gram.y" | |
2281 | { | |
2282 | code_props action; | |
2283 | code_props_symbol_action_init (&action, (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); | |
2284 | code_props_translate_code (&action); | |
2285 | gram_scanner_last_string_free (); | |
2286 | muscle_code_grow ("initial_action", action.code, (yylsp[(2) - (2)])); | |
2287 | code_scanner_last_string_free (); | |
2288 | } | |
2289 | break; | |
2290 | ||
2291 | case 18: | |
2292 | ||
2293 | /* Line 1806 of yacc.c */ | |
2294 | #line 265 "parse-gram.y" | |
2295 | { language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, (yylsp[(1) - (2)])); } | |
2296 | break; | |
2297 | ||
2298 | case 19: | |
2299 | ||
2300 | /* Line 1806 of yacc.c */ | |
2301 | #line 266 "parse-gram.y" | |
2302 | { add_param ("lex_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } | |
2303 | break; | |
2304 | ||
2305 | case 20: | |
2306 | ||
2307 | /* Line 1806 of yacc.c */ | |
2308 | #line 267 "parse-gram.y" | |
2309 | { locations_flag = true; } | |
2310 | break; | |
2311 | ||
2312 | case 21: | |
2313 | ||
2314 | /* Line 1806 of yacc.c */ | |
2315 | #line 268 "parse-gram.y" | |
2316 | { spec_name_prefix = (yyvsp[(2) - (2)].chars); } | |
2317 | break; | |
2318 | ||
2319 | case 22: | |
2320 | ||
2321 | /* Line 1806 of yacc.c */ | |
2322 | #line 269 "parse-gram.y" | |
2323 | { spec_name_prefix = (yyvsp[(3) - (3)].chars); } | |
2324 | break; | |
2325 | ||
2326 | case 23: | |
2327 | ||
2328 | /* Line 1806 of yacc.c */ | |
2329 | #line 270 "parse-gram.y" | |
2330 | { no_lines_flag = true; } | |
2331 | break; | |
2332 | ||
2333 | case 24: | |
2334 | ||
2335 | /* Line 1806 of yacc.c */ | |
2336 | #line 271 "parse-gram.y" | |
2337 | { nondeterministic_parser = true; } | |
2338 | break; | |
2339 | ||
2340 | case 25: | |
2341 | ||
2342 | /* Line 1806 of yacc.c */ | |
2343 | #line 272 "parse-gram.y" | |
2344 | { spec_outfile = (yyvsp[(2) - (2)].chars); } | |
2345 | break; | |
2346 | ||
2347 | case 26: | |
2348 | ||
2349 | /* Line 1806 of yacc.c */ | |
2350 | #line 273 "parse-gram.y" | |
2351 | { spec_outfile = (yyvsp[(3) - (3)].chars); } | |
2352 | break; | |
2353 | ||
2354 | case 27: | |
2355 | ||
2356 | /* Line 1806 of yacc.c */ | |
2357 | #line 274 "parse-gram.y" | |
2358 | { add_param ("parse_param", (yyvsp[(2) - (2)].code), (yylsp[(2) - (2)])); } | |
2359 | break; | |
2360 | ||
2361 | case 28: | |
2362 | ||
2363 | /* Line 1806 of yacc.c */ | |
2364 | #line 276 "parse-gram.y" | |
2365 | { | |
2366 | /* %pure-parser is deprecated in favor of `%define api.pure', so use | |
2367 | `%define api.pure' in a backward-compatible manner here. First, don't | |
2368 | complain if %pure-parser is specified multiple times. */ | |
2369 | if (!muscle_find_const ("percent_define(api.pure)")) | |
2370 | muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), "", | |
2371 | MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE); | |
2372 | /* In all cases, use api.pure now so that the backend doesn't complain if | |
2373 | the skeleton ignores api.pure, but do warn now if there's a previous | |
2374 | conflicting definition from an actual %define. */ | |
2375 | if (!muscle_percent_define_flag_if ("api.pure")) | |
2376 | muscle_percent_define_insert ("api.pure", (yylsp[(1) - (1)]), "", | |
2377 | MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE); | |
2378 | } | |
2379 | break; | |
2380 | ||
2381 | case 29: | |
2382 | ||
2383 | /* Line 1806 of yacc.c */ | |
2384 | #line 290 "parse-gram.y" | |
2385 | { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } | |
2386 | break; | |
2387 | ||
2388 | case 30: | |
2389 | ||
2390 | /* Line 1806 of yacc.c */ | |
2391 | #line 292 "parse-gram.y" | |
2392 | { | |
2393 | char const *skeleton_user = (yyvsp[(2) - (2)].chars); | |
2394 | if (strchr (skeleton_user, '/')) | |
2395 | { | |
2396 | size_t dir_length = strlen (current_file); | |
2397 | char *skeleton_build; | |
2398 | while (dir_length && current_file[dir_length - 1] != '/') | |
2399 | --dir_length; | |
2400 | while (dir_length && current_file[dir_length - 1] == '/') | |
2401 | --dir_length; | |
2402 | skeleton_build = | |
2403 | xmalloc (dir_length + 1 + strlen (skeleton_user) + 1); | |
2404 | if (dir_length > 0) | |
2405 | { | |
2406 | strncpy (skeleton_build, current_file, dir_length); | |
2407 | skeleton_build[dir_length++] = '/'; | |
2408 | } | |
2409 | strcpy (skeleton_build + dir_length, skeleton_user); | |
2410 | skeleton_user = uniqstr_new (skeleton_build); | |
2411 | free (skeleton_build); | |
2412 | } | |
2413 | skeleton_arg (skeleton_user, grammar_prio, (yylsp[(1) - (2)])); | |
2414 | } | |
2415 | break; | |
2416 | ||
2417 | case 31: | |
2418 | ||
2419 | /* Line 1806 of yacc.c */ | |
2420 | #line 315 "parse-gram.y" | |
2421 | { token_table_flag = true; } | |
2422 | break; | |
2423 | ||
2424 | case 32: | |
2425 | ||
2426 | /* Line 1806 of yacc.c */ | |
2427 | #line 316 "parse-gram.y" | |
2428 | { report_flag |= report_states; } | |
2429 | break; | |
2430 | ||
2431 | case 33: | |
2432 | ||
2433 | /* Line 1806 of yacc.c */ | |
2434 | #line 317 "parse-gram.y" | |
2435 | { yacc_flag = true; } | |
2436 | break; | |
2437 | ||
2438 | case 37: | |
2439 | ||
2440 | /* Line 1806 of yacc.c */ | |
2441 | #line 325 "parse-gram.y" | |
2442 | { | |
2443 | grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); | |
2444 | } | |
2445 | break; | |
2446 | ||
2447 | case 38: | |
2448 | ||
2449 | /* Line 1806 of yacc.c */ | |
2450 | #line 329 "parse-gram.y" | |
2451 | { | |
2452 | symbol_list *list; | |
2453 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2454 | symbol_list_destructor_set (list, (yyvsp[(2) - (3)].code), (yylsp[(2) - (3)])); | |
2455 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2456 | } | |
2457 | break; | |
2458 | ||
2459 | case 39: | |
2460 | ||
2461 | /* Line 1806 of yacc.c */ | |
2462 | #line 336 "parse-gram.y" | |
2463 | { | |
2464 | symbol_list *list; | |
2465 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2466 | symbol_list_printer_set (list, (yyvsp[(2) - (3)].code), (yylsp[(2) - (3)])); | |
2467 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2468 | } | |
2469 | break; | |
2470 | ||
2471 | case 40: | |
2472 | ||
2473 | /* Line 1806 of yacc.c */ | |
2474 | #line 343 "parse-gram.y" | |
2475 | { | |
2476 | default_prec = true; | |
2477 | } | |
2478 | break; | |
2479 | ||
2480 | case 41: | |
2481 | ||
2482 | /* Line 1806 of yacc.c */ | |
2483 | #line 347 "parse-gram.y" | |
2484 | { | |
2485 | default_prec = false; | |
2486 | } | |
2487 | break; | |
2488 | ||
2489 | case 42: | |
2490 | ||
2491 | /* Line 1806 of yacc.c */ | |
2492 | #line 351 "parse-gram.y" | |
2493 | { | |
2494 | /* Do not invoke muscle_percent_code_grow here since it invokes | |
2495 | muscle_user_name_list_grow. */ | |
2496 | muscle_code_grow ("percent_code()", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); | |
2497 | code_scanner_last_string_free (); | |
2498 | } | |
2499 | break; | |
2500 | ||
2501 | case 43: | |
2502 | ||
2503 | /* Line 1806 of yacc.c */ | |
2504 | #line 358 "parse-gram.y" | |
2505 | { | |
2506 | muscle_percent_code_grow ((yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); | |
2507 | code_scanner_last_string_free (); | |
2508 | } | |
2509 | break; | |
2510 | ||
2511 | case 44: | |
2512 | ||
2513 | /* Line 1806 of yacc.c */ | |
2514 | #line 372 "parse-gram.y" | |
2515 | {} | |
2516 | break; | |
2517 | ||
2518 | case 45: | |
2519 | ||
2520 | /* Line 1806 of yacc.c */ | |
2521 | #line 373 "parse-gram.y" | |
2522 | { muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2523 | break; | |
2524 | ||
2525 | case 46: | |
2526 | ||
2527 | /* Line 1806 of yacc.c */ | |
2528 | #line 378 "parse-gram.y" | |
2529 | { | |
2530 | union_seen = true; | |
2531 | muscle_code_grow ("stype", (yyvsp[(3) - (3)].chars), (yylsp[(3) - (3)])); | |
2532 | code_scanner_last_string_free (); | |
2533 | } | |
2534 | break; | |
2535 | ||
2536 | case 47: | |
2537 | ||
2538 | /* Line 1806 of yacc.c */ | |
2539 | #line 389 "parse-gram.y" | |
2540 | { current_class = nterm_sym; } | |
2541 | break; | |
2542 | ||
2543 | case 48: | |
2544 | ||
2545 | /* Line 1806 of yacc.c */ | |
2546 | #line 390 "parse-gram.y" | |
2547 | { | |
2548 | current_class = unknown_sym; | |
2549 | current_type = NULL; | |
2550 | } | |
2551 | break; | |
2552 | ||
2553 | case 49: | |
2554 | ||
2555 | /* Line 1806 of yacc.c */ | |
2556 | #line 394 "parse-gram.y" | |
2557 | { current_class = token_sym; } | |
2558 | break; | |
2559 | ||
2560 | case 50: | |
2561 | ||
2562 | /* Line 1806 of yacc.c */ | |
2563 | #line 395 "parse-gram.y" | |
2564 | { | |
2565 | current_class = unknown_sym; | |
2566 | current_type = NULL; | |
2567 | } | |
2568 | break; | |
2569 | ||
2570 | case 51: | |
2571 | ||
2572 | /* Line 1806 of yacc.c */ | |
2573 | #line 400 "parse-gram.y" | |
2574 | { | |
2575 | symbol_list *list; | |
2576 | tag_seen = true; | |
2577 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2578 | symbol_type_set (list->content.sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); | |
2579 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2580 | } | |
2581 | break; | |
2582 | ||
2583 | case 52: | |
2584 | ||
2585 | /* Line 1806 of yacc.c */ | |
2586 | #line 411 "parse-gram.y" | |
2587 | { | |
2588 | symbol_list *list; | |
2589 | ++current_prec; | |
2590 | for (list = (yyvsp[(3) - (3)].list); list; list = list->next) | |
2591 | { | |
2592 | symbol_type_set (list->content.sym, current_type, (yylsp[(2) - (3)])); | |
2593 | symbol_precedence_set (list->content.sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); | |
2594 | } | |
2595 | symbol_list_free ((yyvsp[(3) - (3)].list)); | |
2596 | current_type = NULL; | |
2597 | } | |
2598 | break; | |
2599 | ||
2600 | case 53: | |
2601 | ||
2602 | /* Line 1806 of yacc.c */ | |
2603 | #line 425 "parse-gram.y" | |
2604 | { (yyval.assoc) = left_assoc; } | |
2605 | break; | |
2606 | ||
2607 | case 54: | |
2608 | ||
2609 | /* Line 1806 of yacc.c */ | |
2610 | #line 426 "parse-gram.y" | |
2611 | { (yyval.assoc) = right_assoc; } | |
2612 | break; | |
2613 | ||
2614 | case 55: | |
2615 | ||
2616 | /* Line 1806 of yacc.c */ | |
2617 | #line 427 "parse-gram.y" | |
2618 | { (yyval.assoc) = non_assoc; } | |
2619 | break; | |
2620 | ||
2621 | case 56: | |
2622 | ||
2623 | /* Line 1806 of yacc.c */ | |
2624 | #line 431 "parse-gram.y" | |
2625 | { current_type = NULL; } | |
2626 | break; | |
2627 | ||
2628 | case 57: | |
2629 | ||
2630 | /* Line 1806 of yacc.c */ | |
2631 | #line 432 "parse-gram.y" | |
2632 | { current_type = (yyvsp[(1) - (1)].uniqstr); tag_seen = true; } | |
2633 | break; | |
2634 | ||
2635 | case 58: | |
2636 | ||
2637 | /* Line 1806 of yacc.c */ | |
2638 | #line 438 "parse-gram.y" | |
2639 | { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } | |
2640 | break; | |
2641 | ||
2642 | case 59: | |
2643 | ||
2644 | /* Line 1806 of yacc.c */ | |
2645 | #line 440 "parse-gram.y" | |
2646 | { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } | |
2647 | break; | |
2648 | ||
2649 | case 60: | |
2650 | ||
2651 | /* Line 1806 of yacc.c */ | |
2652 | #line 444 "parse-gram.y" | |
2653 | { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } | |
2654 | break; | |
2655 | ||
2656 | case 61: | |
2657 | ||
2658 | /* Line 1806 of yacc.c */ | |
2659 | #line 445 "parse-gram.y" | |
2660 | { (yyval.symbol) = (yyvsp[(1) - (2)].symbol); symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); } | |
2661 | break; | |
2662 | ||
2663 | case 62: | |
2664 | ||
2665 | /* Line 1806 of yacc.c */ | |
2666 | #line 451 "parse-gram.y" | |
2667 | { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } | |
2668 | break; | |
2669 | ||
2670 | case 63: | |
2671 | ||
2672 | /* Line 1806 of yacc.c */ | |
2673 | #line 453 "parse-gram.y" | |
2674 | { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), symbol_list_sym_new ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]))); } | |
2675 | break; | |
2676 | ||
2677 | case 64: | |
2678 | ||
2679 | /* Line 1806 of yacc.c */ | |
2680 | #line 457 "parse-gram.y" | |
2681 | { (yyval.list) = (yyvsp[(1) - (1)].list); } | |
2682 | break; | |
2683 | ||
2684 | case 65: | |
2685 | ||
2686 | /* Line 1806 of yacc.c */ | |
2687 | #line 458 "parse-gram.y" | |
2688 | { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].list)); } | |
2689 | break; | |
2690 | ||
2691 | case 66: | |
2692 | ||
2693 | /* Line 1806 of yacc.c */ | |
2694 | #line 462 "parse-gram.y" | |
2695 | { (yyval.list) = symbol_list_sym_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } | |
2696 | break; | |
2697 | ||
2698 | case 67: | |
2699 | ||
2700 | /* Line 1806 of yacc.c */ | |
2701 | #line 463 "parse-gram.y" | |
2702 | { (yyval.list) = symbol_list_type_new ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2703 | break; | |
2704 | ||
2705 | case 68: | |
2706 | ||
2707 | /* Line 1806 of yacc.c */ | |
2708 | #line 464 "parse-gram.y" | |
2709 | { (yyval.list) = symbol_list_default_tagged_new ((yylsp[(1) - (1)])); } | |
2710 | break; | |
2711 | ||
2712 | case 69: | |
2713 | ||
2714 | /* Line 1806 of yacc.c */ | |
2715 | #line 465 "parse-gram.y" | |
2716 | { (yyval.list) = symbol_list_default_tagless_new ((yylsp[(1) - (1)])); } | |
2717 | break; | |
2718 | ||
2719 | case 70: | |
2720 | ||
2721 | /* Line 1806 of yacc.c */ | |
2722 | #line 471 "parse-gram.y" | |
2723 | { | |
2724 | current_type = (yyvsp[(1) - (1)].uniqstr); | |
2725 | tag_seen = true; | |
2726 | } | |
2727 | break; | |
2728 | ||
2729 | case 71: | |
2730 | ||
2731 | /* Line 1806 of yacc.c */ | |
2732 | #line 476 "parse-gram.y" | |
2733 | { | |
2734 | symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); | |
2735 | symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); | |
2736 | } | |
2737 | break; | |
2738 | ||
2739 | case 72: | |
2740 | ||
2741 | /* Line 1806 of yacc.c */ | |
2742 | #line 481 "parse-gram.y" | |
2743 | { | |
2744 | symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); | |
2745 | symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); | |
2746 | symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); | |
2747 | } | |
2748 | break; | |
2749 | ||
2750 | case 73: | |
2751 | ||
2752 | /* Line 1806 of yacc.c */ | |
2753 | #line 487 "parse-gram.y" | |
2754 | { | |
2755 | symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); | |
2756 | symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); | |
2757 | symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc)); | |
2758 | } | |
2759 | break; | |
2760 | ||
2761 | case 74: | |
2762 | ||
2763 | /* Line 1806 of yacc.c */ | |
2764 | #line 493 "parse-gram.y" | |
2765 | { | |
2766 | symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); | |
2767 | symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); | |
2768 | symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)])); | |
2769 | symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc)); | |
2770 | } | |
2771 | break; | |
2772 | ||
2773 | case 81: | |
2774 | ||
2775 | /* Line 1806 of yacc.c */ | |
2776 | #line 523 "parse-gram.y" | |
2777 | { | |
2778 | yyerrok; | |
2779 | } | |
2780 | break; | |
2781 | ||
2782 | case 82: | |
2783 | ||
2784 | /* Line 1806 of yacc.c */ | |
2785 | #line 529 "parse-gram.y" | |
2786 | { current_lhs = (yyvsp[(1) - (2)].symbol); current_lhs_location = (yylsp[(1) - (2)]); | |
2787 | current_lhs_named_ref = (yyvsp[(2) - (2)].named_ref); } | |
2788 | break; | |
2789 | ||
2790 | case 84: | |
2791 | ||
2792 | /* Line 1806 of yacc.c */ | |
2793 | #line 534 "parse-gram.y" | |
2794 | { grammar_current_rule_end ((yylsp[(1) - (1)])); } | |
2795 | break; | |
2796 | ||
2797 | case 85: | |
2798 | ||
2799 | /* Line 1806 of yacc.c */ | |
2800 | #line 535 "parse-gram.y" | |
2801 | { grammar_current_rule_end ((yylsp[(3) - (3)])); } | |
2802 | break; | |
2803 | ||
2804 | case 87: | |
2805 | ||
2806 | /* Line 1806 of yacc.c */ | |
2807 | #line 541 "parse-gram.y" | |
2808 | { grammar_current_rule_begin (current_lhs, current_lhs_location, | |
2809 | current_lhs_named_ref); } | |
2810 | break; | |
2811 | ||
2812 | case 88: | |
2813 | ||
2814 | /* Line 1806 of yacc.c */ | |
2815 | #line 544 "parse-gram.y" | |
2816 | { grammar_current_rule_symbol_append ((yyvsp[(2) - (3)].symbol), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].named_ref)); } | |
2817 | break; | |
2818 | ||
2819 | case 89: | |
2820 | ||
2821 | /* Line 1806 of yacc.c */ | |
2822 | #line 546 "parse-gram.y" | |
2823 | { grammar_current_rule_action_append ((yyvsp[(2) - (3)].code), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].named_ref)); } | |
2824 | break; | |
2825 | ||
2826 | case 90: | |
2827 | ||
2828 | /* Line 1806 of yacc.c */ | |
2829 | #line 548 "parse-gram.y" | |
2830 | { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } | |
2831 | break; | |
2832 | ||
2833 | case 91: | |
2834 | ||
2835 | /* Line 1806 of yacc.c */ | |
2836 | #line 550 "parse-gram.y" | |
2837 | { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } | |
2838 | break; | |
2839 | ||
2840 | case 92: | |
2841 | ||
2842 | /* Line 1806 of yacc.c */ | |
2843 | #line 552 "parse-gram.y" | |
2844 | { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } | |
2845 | break; | |
2846 | ||
2847 | case 93: | |
2848 | ||
2849 | /* Line 1806 of yacc.c */ | |
2850 | #line 556 "parse-gram.y" | |
2851 | { (yyval.named_ref) = 0; } | |
2852 | break; | |
2853 | ||
2854 | case 94: | |
2855 | ||
2856 | /* Line 1806 of yacc.c */ | |
2857 | #line 558 "parse-gram.y" | |
2858 | { (yyval.named_ref) = named_ref_new((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2859 | break; | |
2860 | ||
2861 | case 96: | |
2862 | ||
2863 | /* Line 1806 of yacc.c */ | |
2864 | #line 570 "parse-gram.y" | |
2865 | { (yyval.uniqstr) = uniqstr_new ((yyvsp[(1) - (1)].chars)); } | |
2866 | break; | |
2867 | ||
2868 | case 97: | |
2869 | ||
2870 | /* Line 1806 of yacc.c */ | |
2871 | #line 575 "parse-gram.y" | |
2872 | { (yyval.chars) = ""; } | |
2873 | break; | |
2874 | ||
2875 | case 98: | |
2876 | ||
2877 | /* Line 1806 of yacc.c */ | |
2878 | #line 576 "parse-gram.y" | |
2879 | { (yyval.chars) = (yyvsp[(1) - (1)].uniqstr); } | |
2880 | break; | |
2881 | ||
2882 | case 100: | |
2883 | ||
2884 | /* Line 1806 of yacc.c */ | |
2885 | #line 587 "parse-gram.y" | |
2886 | { | |
2887 | code_props plain_code; | |
2888 | (yyvsp[(1) - (1)].code)[strlen ((yyvsp[(1) - (1)].code)) - 1] = '\n'; | |
2889 | code_props_plain_init (&plain_code, (yyvsp[(1) - (1)].code)+1, (yylsp[(1) - (1)])); | |
2890 | code_props_translate_code (&plain_code); | |
2891 | gram_scanner_last_string_free (); | |
2892 | (yyval.chars) = plain_code.code; | |
2893 | } | |
2894 | break; | |
2895 | ||
2896 | case 101: | |
2897 | ||
2898 | /* Line 1806 of yacc.c */ | |
2899 | #line 607 "parse-gram.y" | |
2900 | { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2901 | break; | |
2902 | ||
2903 | case 102: | |
2904 | ||
2905 | /* Line 1806 of yacc.c */ | |
2906 | #line 609 "parse-gram.y" | |
2907 | { | |
2908 | (yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)])); | |
2909 | symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); | |
2910 | symbol_user_token_number_set ((yyval.symbol), (yyvsp[(1) - (1)].character), (yylsp[(1) - (1)])); | |
2911 | } | |
2912 | break; | |
2913 | ||
2914 | case 103: | |
2915 | ||
2916 | /* Line 1806 of yacc.c */ | |
2917 | #line 617 "parse-gram.y" | |
2918 | { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); } | |
2919 | break; | |
2920 | ||
2921 | case 106: | |
2922 | ||
2923 | /* Line 1806 of yacc.c */ | |
2924 | #line 629 "parse-gram.y" | |
2925 | { | |
2926 | (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); | |
2927 | symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); | |
2928 | } | |
2929 | break; | |
2930 | ||
2931 | case 108: | |
2932 | ||
2933 | /* Line 1806 of yacc.c */ | |
2934 | #line 638 "parse-gram.y" | |
2935 | { | |
2936 | code_props plain_code; | |
2937 | code_props_plain_init (&plain_code, (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); | |
2938 | code_props_translate_code (&plain_code); | |
2939 | gram_scanner_last_string_free (); | |
2940 | muscle_code_grow ("epilogue", plain_code.code, (yylsp[(2) - (2)])); | |
2941 | code_scanner_last_string_free (); | |
2942 | } | |
2943 | break; | |
2944 | ||
2945 | ||
2946 | ||
2947 | /* Line 1806 of yacc.c */ | |
2948 | #line 2949 "parse-gram.c" | |
2949 | default: break; | |
2950 | } | |
2951 | if (yychar_backup != yychar) | |
2952 | YY_LAC_DISCARD ("yychar change"); | |
2953 | } | |
2954 | /* User semantic actions sometimes alter yychar, and that requires | |
2955 | that yytoken be updated with the new translation. We take the | |
2956 | approach of translating immediately before every use of yytoken. | |
2957 | One alternative is translating here after every semantic action, | |
2958 | but that translation would be missed if the semantic action invokes | |
2959 | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or | |
2960 | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an | |
2961 | incorrect destructor might then be invoked immediately. In the | |
2962 | case of YYERROR or YYBACKUP, subsequent parser actions might lead | |
2963 | to an incorrect destructor call or verbose syntax error message | |
2964 | before the lookahead is translated. */ | |
2965 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); | |
2966 | ||
2967 | YYPOPSTACK (yylen); | |
2968 | yylen = 0; | |
2969 | YY_STACK_PRINT (yyss, yyssp); | |
2970 | ||
2971 | *++yyvsp = yyval; | |
2972 | *++yylsp = yyloc; | |
2973 | ||
2974 | /* Now `shift' the result of the reduction. Determine what state | |
2975 | that goes to, based on the state we popped back to and the rule | |
2976 | number reduced by. */ | |
2977 | ||
2978 | yyn = yyr1[yyn]; | |
2979 | ||
2980 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | |
2981 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
2982 | yystate = yytable[yystate]; | |
2983 | else | |
2984 | yystate = yydefgoto[yyn - YYNTOKENS]; | |
2985 | ||
2986 | goto yynewstate; | |
2987 | ||
2988 | ||
2989 | /*------------------------------------. | |
2990 | | yyerrlab -- here on detecting error | | |
2991 | `------------------------------------*/ | |
2992 | yyerrlab: | |
2993 | /* Make sure we have latest lookahead translation. See comments at | |
2994 | user semantic actions for why this is necessary. */ | |
2995 | yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); | |
2996 | ||
2997 | /* If not already recovering from an error, report this error. */ | |
2998 | if (!yyerrstatus) | |
2999 | { | |
3000 | ++yynerrs; | |
3001 | #if ! YYERROR_VERBOSE | |
3002 | yyerror (YY_("syntax error")); | |
3003 | #else | |
3004 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ | |
3005 | yyesa, &yyes, &yyes_capacity, \ | |
3006 | yyssp, yytoken) | |
3007 | { | |
3008 | char const *yymsgp = YY_("syntax error"); | |
3009 | int yysyntax_error_status; | |
3010 | if (yychar != YYEMPTY) | |
3011 | YY_LAC_ESTABLISH; | |
3012 | yysyntax_error_status = YYSYNTAX_ERROR; | |
3013 | if (yysyntax_error_status == 0) | |
3014 | yymsgp = yymsg; | |
3015 | else if (yysyntax_error_status == 1) | |
3016 | { | |
3017 | if (yymsg != yymsgbuf) | |
3018 | YYSTACK_FREE (yymsg); | |
3019 | yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); | |
3020 | if (!yymsg) | |
3021 | { | |
3022 | yymsg = yymsgbuf; | |
3023 | yymsg_alloc = sizeof yymsgbuf; | |
3024 | yysyntax_error_status = 2; | |
3025 | } | |
3026 | else | |
3027 | { | |
3028 | yysyntax_error_status = YYSYNTAX_ERROR; | |
3029 | yymsgp = yymsg; | |
3030 | } | |
3031 | } | |
3032 | yyerror (yymsgp); | |
3033 | if (yysyntax_error_status == 2) | |
3034 | goto yyexhaustedlab; | |
3035 | } | |
3036 | # undef YYSYNTAX_ERROR | |
3037 | #endif | |
3038 | } | |
3039 | ||
3040 | yyerror_range[1] = yylloc; | |
3041 | ||
3042 | if (yyerrstatus == 3) | |
3043 | { | |
3044 | /* If just tried and failed to reuse lookahead token after an | |
3045 | error, discard it. */ | |
3046 | ||
3047 | if (yychar <= YYEOF) | |
3048 | { | |
3049 | /* Return failure if at end of input. */ | |
3050 | if (yychar == YYEOF) | |
3051 | YYABORT; | |
3052 | } | |
3053 | else | |
3054 | { | |
3055 | yydestruct ("Error: discarding", | |
3056 | yytoken, &yylval, &yylloc); | |
3057 | yychar = YYEMPTY; | |
3058 | } | |
3059 | } | |
3060 | ||
3061 | /* Else will try to reuse lookahead token after shifting the error | |
3062 | token. */ | |
3063 | goto yyerrlab1; | |
3064 | ||
3065 | ||
3066 | /*---------------------------------------------------. | |
3067 | | yyerrorlab -- error raised explicitly by YYERROR. | | |
3068 | `---------------------------------------------------*/ | |
3069 | yyerrorlab: | |
3070 | ||
3071 | /* Pacify compilers like GCC when the user code never invokes | |
3072 | YYERROR and the label yyerrorlab therefore never appears in user | |
3073 | code. */ | |
3074 | if (/*CONSTCOND*/ 0) | |
3075 | goto yyerrorlab; | |
3076 | ||
3077 | yyerror_range[1] = yylsp[1-yylen]; | |
3078 | /* Do not reclaim the symbols of the rule which action triggered | |
3079 | this YYERROR. */ | |
3080 | YYPOPSTACK (yylen); | |
3081 | yylen = 0; | |
3082 | YY_STACK_PRINT (yyss, yyssp); | |
3083 | yystate = *yyssp; | |
3084 | goto yyerrlab1; | |
3085 | ||
3086 | ||
3087 | /*-------------------------------------------------------------. | |
3088 | | yyerrlab1 -- common code for both syntax error and YYERROR. | | |
3089 | `-------------------------------------------------------------*/ | |
3090 | yyerrlab1: | |
3091 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | |
3092 | ||
3093 | for (;;) | |
3094 | { | |
3095 | yyn = yypact[yystate]; | |
3096 | if (!yypact_value_is_default (yyn)) | |
3097 | { | |
3098 | yyn += YYTERROR; | |
3099 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | |
3100 | { | |
3101 | yyn = yytable[yyn]; | |
3102 | if (0 < yyn) | |
3103 | break; | |
3104 | } | |
3105 | } | |
3106 | ||
3107 | /* Pop the current state because it cannot handle the error token. */ | |
3108 | if (yyssp == yyss) | |
3109 | YYABORT; | |
3110 | ||
3111 | yyerror_range[1] = *yylsp; | |
3112 | yydestruct ("Error: popping", | |
3113 | yystos[yystate], yyvsp, yylsp); | |
3114 | YYPOPSTACK (1); | |
3115 | yystate = *yyssp; | |
3116 | YY_STACK_PRINT (yyss, yyssp); | |
3117 | } | |
3118 | ||
3119 | /* If the stack popping above didn't lose the initial context for the | |
3120 | current lookahead token, the shift below will for sure. */ | |
3121 | YY_LAC_DISCARD ("error recovery"); | |
3122 | ||
3123 | *++yyvsp = yylval; | |
3124 | ||
3125 | yyerror_range[2] = yylloc; | |
3126 | /* Using YYLLOC is tempting, but would change the location of | |
3127 | the lookahead. YYLOC is available though. */ | |
3128 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); | |
3129 | *++yylsp = yyloc; | |
3130 | ||
3131 | /* Shift the error token. */ | |
3132 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | |
3133 | ||
3134 | yystate = yyn; | |
3135 | goto yynewstate; | |
3136 | ||
3137 | ||
3138 | /*-------------------------------------. | |
3139 | | yyacceptlab -- YYACCEPT comes here. | | |
3140 | `-------------------------------------*/ | |
3141 | yyacceptlab: | |
3142 | yyresult = 0; | |
3143 | goto yyreturn; | |
3144 | ||
3145 | /*-----------------------------------. | |
3146 | | yyabortlab -- YYABORT comes here. | | |
3147 | `-----------------------------------*/ | |
3148 | yyabortlab: | |
3149 | yyresult = 1; | |
3150 | goto yyreturn; | |
3151 | ||
3152 | #if 1 | |
3153 | /*-------------------------------------------------. | |
3154 | | yyexhaustedlab -- memory exhaustion comes here. | | |
3155 | `-------------------------------------------------*/ | |
3156 | yyexhaustedlab: | |
3157 | yyerror (YY_("memory exhausted")); | |
3158 | yyresult = 2; | |
3159 | /* Fall through. */ | |
3160 | #endif | |
3161 | ||
3162 | yyreturn: | |
3163 | if (yychar != YYEMPTY) | |
3164 | { | |
3165 | /* Make sure we have latest lookahead translation. See comments at | |
3166 | user semantic actions for why this is necessary. */ | |
3167 | yytoken = YYTRANSLATE (yychar); | |
3168 | yydestruct ("Cleanup: discarding lookahead", | |
3169 | yytoken, &yylval, &yylloc); | |
3170 | } | |
3171 | /* Do not reclaim the symbols of the rule which action triggered | |
3172 | this YYABORT or YYACCEPT. */ | |
3173 | YYPOPSTACK (yylen); | |
3174 | YY_STACK_PRINT (yyss, yyssp); | |
3175 | while (yyssp != yyss) | |
3176 | { | |
3177 | yydestruct ("Cleanup: popping", | |
3178 | yystos[*yyssp], yyvsp, yylsp); | |
3179 | YYPOPSTACK (1); | |
3180 | } | |
3181 | #ifndef yyoverflow | |
3182 | if (yyss != yyssa) | |
3183 | YYSTACK_FREE (yyss); | |
3184 | #endif | |
3185 | if (yyes != yyesa) | |
3186 | YYSTACK_FREE (yyes); | |
3187 | #if YYERROR_VERBOSE | |
3188 | if (yymsg != yymsgbuf) | |
3189 | YYSTACK_FREE (yymsg); | |
3190 | #endif | |
3191 | /* Make sure YYID is used. */ | |
3192 | return YYID (yyresult); | |
3193 | } | |
3194 | ||
3195 | ||
3196 | ||
3197 | /* Line 2067 of yacc.c */ | |
3198 | #line 648 "parse-gram.y" | |
3199 | ||
3200 | ||
3201 | ||
3202 | /* Return the location of the left-hand side of a rule whose | |
3203 | right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in | |
3204 | the right-hand side, and return an empty location equal to the end | |
3205 | boundary of RHS[0] if the right-hand side is empty. */ | |
3206 | ||
3207 | static YYLTYPE | |
3208 | lloc_default (YYLTYPE const *rhs, int n) | |
3209 | { | |
3210 | int i; | |
3211 | YYLTYPE loc; | |
3212 | ||
3213 | /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;". | |
3214 | The bug is fixed in 7.4.2m, but play it safe for now. */ | |
3215 | loc.start = rhs[n].end; | |
3216 | loc.end = rhs[n].end; | |
3217 | ||
3218 | /* Ignore empty nonterminals the start of the the right-hand side. | |
3219 | Do not bother to ignore them at the end of the right-hand side, | |
3220 | since empty nonterminals have the same end as their predecessors. */ | |
3221 | for (i = 1; i <= n; i++) | |
3222 | if (! equal_boundaries (rhs[i].start, rhs[i].end)) | |
3223 | { | |
3224 | loc.start = rhs[i].start; | |
3225 | break; | |
3226 | } | |
3227 | ||
3228 | return loc; | |
3229 | } | |
3230 | ||
3231 | ||
3232 | /* Add a lex-param or a parse-param (depending on TYPE) with | |
3233 | declaration DECL and location LOC. */ | |
3234 | ||
3235 | static void | |
3236 | add_param (char const *type, char *decl, location loc) | |
3237 | { | |
3238 | static char const alphanum[26 + 26 + 1 + 10] = | |
3239 | "abcdefghijklmnopqrstuvwxyz" | |
3240 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
3241 | "_" | |
3242 | "0123456789"; | |
3243 | char const *name_start = NULL; | |
3244 | char *p; | |
3245 | ||
3246 | /* Stop on last actual character. */ | |
3247 | for (p = decl; p[1]; p++) | |
3248 | if ((p == decl | |
3249 | || ! memchr (alphanum, p[-1], sizeof alphanum)) | |
3250 | && memchr (alphanum, p[0], sizeof alphanum - 10)) | |
3251 | name_start = p; | |
3252 | ||
3253 | /* Strip the surrounding '{' and '}', and any blanks just inside | |
3254 | the braces. */ | |
3255 | while (*--p == ' ' || *p == '\t') | |
3256 | continue; | |
3257 | p[1] = '\0'; | |
3258 | while (*++decl == ' ' || *decl == '\t') | |
3259 | continue; | |
3260 | ||
3261 | if (! name_start) | |
3262 | complain_at (loc, _("missing identifier in parameter declaration")); | |
3263 | else | |
3264 | { | |
3265 | char *name; | |
3266 | size_t name_len; | |
3267 | ||
3268 | for (name_len = 1; | |
3269 | memchr (alphanum, name_start[name_len], sizeof alphanum); | |
3270 | name_len++) | |
3271 | continue; | |
3272 | ||
3273 | name = xmalloc (name_len + 1); | |
3274 | memcpy (name, name_start, name_len); | |
3275 | name[name_len] = '\0'; | |
3276 | muscle_pair_list_grow (type, decl, name); | |
3277 | free (name); | |
3278 | } | |
3279 | ||
3280 | gram_scanner_last_string_free (); | |
3281 | } | |
3282 | ||
3283 | ||
3284 | static void | |
3285 | version_check (location const *loc, char const *version) | |
3286 | { | |
3287 | if (strverscmp (version, PACKAGE_VERSION) > 0) | |
3288 | { | |
3289 | complain_at (*loc, "require bison %s, but have %s", | |
3290 | version, PACKAGE_VERSION); | |
3291 | exit (63); | |
3292 | } | |
3293 | } | |
3294 | ||
3295 | static void | |
3296 | gram_error (location const *loc, char const *msg) | |
3297 | { | |
3298 | complain_at (*loc, "%s", msg); | |
3299 | } | |
3300 | ||
3301 | char const * | |
3302 | token_name (int type) | |
3303 | { | |
3304 | return yytname[YYTRANSLATE (type)]; | |
3305 | } | |
3306 | ||
3307 | static char const * | |
3308 | char_name (char c) | |
3309 | { | |
3310 | if (c == '\'') | |
3311 | return "'\\''"; | |
3312 | else | |
3313 | { | |
3314 | char buf[4]; | |
3315 | buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0'; | |
3316 | return quotearg_style (escape_quoting_style, buf); | |
3317 | } | |
3318 | } | |
3319 |