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