1 /* A Bison parser, made by GNU Bison 2.3+. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3+"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 1
61 /* Substitute the variable and function names. */
62 #define yyparse gram_parse
63 #define yylex gram_lex
64 #define yyerror gram_error
65 #define yylval gram_lval
66 #define yychar gram_char
67 #define yydebug gram_debug
68 #define yynerrs gram_nerrs
69 #define yylloc gram_lloc
71 /* Copy the first part of user declarations. */
72 /* Line 164 of yacc.c. */
73 #line 1 "../../src/parse-gram.y"
74 /* Bison Grammar Parser -*- C -*-
76 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
78 This file is part of Bison, the GNU Compiler Compiler.
80 This program is free software; you can redistribute it and/or modify
81 it under the terms of the GNU General Public License as published by
82 the Free Software Foundation; either version 2 of the License, or
83 (at your option) any later version.
85 This program is distributed in the hope that it will be useful,
86 but WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
90 You should have received a copy of the GNU General Public License
91 along with this program; if not, write to the Free Software
92 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
100 #include "conflicts.h"
104 #include "muscle_tab.h"
105 #include "quotearg.h"
108 #include "scan-gram.h"
109 #include "scan-code.h"
110 #include "strverscmp.h"
112 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
113 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
115 #define YY_LOCATION_PRINT(File, Loc) \
116 location_print (File, Loc)
118 static void version_check (location
const *loc
, char const *version
);
120 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
121 FIXME: depends on the undocumented availability of YYLLOC. */
123 #define yyerror(Msg) \
124 gram_error (&yylloc, Msg)
125 static void gram_error (location
const *, char const *);
127 static char const *char_name (char);
129 static void add_param (char const *, char *, location
);
131 static symbol_class current_class
= unknown_sym
;
132 static uniqstr current_type
= 0;
133 static symbol
*current_lhs
;
134 static location current_lhs_location
;
135 static int current_prec
= 0;
137 #ifdef UINT_FAST8_MAX
138 # define YYTYPE_UINT8 uint_fast8_t
141 # define YYTYPE_INT8 int_fast8_t
143 #ifdef UINT_FAST16_MAX
144 # define YYTYPE_UINT16 uint_fast16_t
146 #ifdef INT_FAST16_MAX
147 # define YYTYPE_INT16 int_fast16_t
151 /* Enabling traces. */
156 /* Enabling verbose error messages. */
157 #ifdef YYERROR_VERBOSE
158 # undef YYERROR_VERBOSE
159 # define YYERROR_VERBOSE 1
161 # define YYERROR_VERBOSE 1
164 /* Enabling the token table. */
165 #ifndef YYTOKEN_TABLE
166 # define YYTOKEN_TABLE 0
173 /* Put the tokens into the symbol table, so that GDB and other debuggers
182 PERCENT_DESTRUCTOR
= 263,
183 PERCENT_PRINTER
= 264,
186 PERCENT_NONASSOC
= 267,
190 PERCENT_AFTER_HEADER
= 271,
191 PERCENT_BEFORE_HEADER
= 272,
193 PERCENT_DEFAULT_PREC
= 274,
194 PERCENT_DEFINE
= 275,
195 PERCENT_DEFINES
= 276,
196 PERCENT_END_HEADER
= 277,
197 PERCENT_ERROR_VERBOSE
= 278,
198 PERCENT_EXPECT
= 279,
199 PERCENT_EXPECT_RR
= 280,
200 PERCENT_FILE_PREFIX
= 281,
201 PERCENT_GLR_PARSER
= 282,
202 PERCENT_INITIAL_ACTION
= 283,
203 PERCENT_LEX_PARAM
= 284,
204 PERCENT_LOCATIONS
= 285,
205 PERCENT_NAME_PREFIX
= 286,
206 PERCENT_NO_DEFAULT_PREC
= 287,
207 PERCENT_NO_LINES
= 288,
208 PERCENT_NONDETERMINISTIC_PARSER
= 289,
209 PERCENT_OUTPUT
= 290,
210 PERCENT_PARSE_PARAM
= 291,
211 PERCENT_PURE_PARSER
= 292,
212 PERCENT_REQUIRE
= 293,
213 PERCENT_SKELETON
= 294,
215 PERCENT_START_HEADER
= 296,
216 PERCENT_TOKEN_TABLE
= 297,
217 PERCENT_VERBOSE
= 298,
225 PERCENT_PERCENT
= 306,
237 #define PERCENT_TOKEN 260
238 #define PERCENT_NTERM 261
239 #define PERCENT_TYPE 262
240 #define PERCENT_DESTRUCTOR 263
241 #define PERCENT_PRINTER 264
242 #define PERCENT_LEFT 265
243 #define PERCENT_RIGHT 266
244 #define PERCENT_NONASSOC 267
245 #define PERCENT_PREC 268
246 #define PERCENT_DPREC 269
247 #define PERCENT_MERGE 270
248 #define PERCENT_AFTER_HEADER 271
249 #define PERCENT_BEFORE_HEADER 272
250 #define PERCENT_DEBUG 273
251 #define PERCENT_DEFAULT_PREC 274
252 #define PERCENT_DEFINE 275
253 #define PERCENT_DEFINES 276
254 #define PERCENT_END_HEADER 277
255 #define PERCENT_ERROR_VERBOSE 278
256 #define PERCENT_EXPECT 279
257 #define PERCENT_EXPECT_RR 280
258 #define PERCENT_FILE_PREFIX 281
259 #define PERCENT_GLR_PARSER 282
260 #define PERCENT_INITIAL_ACTION 283
261 #define PERCENT_LEX_PARAM 284
262 #define PERCENT_LOCATIONS 285
263 #define PERCENT_NAME_PREFIX 286
264 #define PERCENT_NO_DEFAULT_PREC 287
265 #define PERCENT_NO_LINES 288
266 #define PERCENT_NONDETERMINISTIC_PARSER 289
267 #define PERCENT_OUTPUT 290
268 #define PERCENT_PARSE_PARAM 291
269 #define PERCENT_PURE_PARSER 292
270 #define PERCENT_REQUIRE 293
271 #define PERCENT_SKELETON 294
272 #define PERCENT_START 295
273 #define PERCENT_START_HEADER 296
274 #define PERCENT_TOKEN_TABLE 297
275 #define PERCENT_VERBOSE 298
276 #define PERCENT_YACC 299
277 #define BRACED_CODE 300
283 #define PERCENT_PERCENT 306
286 #define SEMICOLON 309
288 #define PERCENT_UNION 311
293 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
294 typedef union YYSTYPE
295 /* Line 195 of yacc.c. */
296 #line 97 "../../src/parse-gram.y"
304 unsigned char character
;
306 /* Line 195 of yacc.c. */
307 #line 308 "../../src/parse-gram.c"
309 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
310 # define YYSTYPE_IS_DECLARED 1
311 # define YYSTYPE_IS_TRIVIAL 1
314 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
315 typedef struct YYLTYPE
322 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
323 # define YYLTYPE_IS_DECLARED 1
324 # define YYLTYPE_IS_TRIVIAL 1
328 /* Copy the second part of user declarations. */
330 /* Line 219 of yacc.c. */
331 #line 332 "../../src/parse-gram.c"
338 typedef YYTYPE_UINT8 yytype_uint8
;
340 typedef unsigned char yytype_uint8
;
344 typedef YYTYPE_INT8 yytype_int8
;
345 #elif (defined __STDC__ || defined __C99__FUNC__ \
346 || defined __cplusplus || defined _MSC_VER)
347 typedef signed char yytype_int8
;
349 typedef short int yytype_int8
;
353 typedef YYTYPE_UINT16 yytype_uint16
;
355 typedef unsigned short int yytype_uint16
;
359 typedef YYTYPE_INT16 yytype_int16
;
361 typedef short int yytype_int16
;
365 # ifdef __SIZE_TYPE__
366 # define YYSIZE_T __SIZE_TYPE__
367 # elif defined size_t
368 # define YYSIZE_T size_t
369 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
370 || defined __cplusplus || defined _MSC_VER)
371 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
372 # define YYSIZE_T size_t
374 # define YYSIZE_T unsigned int
378 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
383 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
384 # define YY_(msgid) dgettext ("bison-runtime", msgid)
388 # define YY_(msgid) msgid
392 /* Suppress unused-variable warnings by "using" E. */
393 #if ! defined lint || defined __GNUC__
394 # define YYUSE(e) ((void) (e))
396 # define YYUSE(e) /* empty */
399 /* Identity function, used to suppress warnings about constant conditions. */
403 #if (defined __STDC__ || defined __C99__FUNC__ \
404 || defined __cplusplus || defined _MSC_VER)
417 #if ! defined yyoverflow || YYERROR_VERBOSE
419 /* The parser invokes alloca or malloc; define the necessary symbols. */
421 # ifdef YYSTACK_USE_ALLOCA
422 # if YYSTACK_USE_ALLOCA
424 # define YYSTACK_ALLOC __builtin_alloca
425 # elif defined __BUILTIN_VA_ARG_INCR
426 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
428 # define YYSTACK_ALLOC __alloca
429 # elif defined _MSC_VER
430 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
431 # define alloca _alloca
433 # define YYSTACK_ALLOC alloca
434 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
435 || defined __cplusplus || defined _MSC_VER)
436 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
445 # ifdef YYSTACK_ALLOC
446 /* Pacify GCC's `empty if-body' warning. */
447 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
448 # ifndef YYSTACK_ALLOC_MAXIMUM
449 /* The OS might guarantee only one guard page at the bottom of the stack,
450 and a page size can be as small as 4096 bytes. So we cannot safely
451 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
452 to allow for a few compiler-allocated temporary stack slots. */
453 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
456 # define YYSTACK_ALLOC YYMALLOC
457 # define YYSTACK_FREE YYFREE
458 # ifndef YYSTACK_ALLOC_MAXIMUM
459 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
461 # if (defined __cplusplus && ! defined _STDLIB_H \
462 && ! ((defined YYMALLOC || defined malloc) \
463 && (defined YYFREE || defined free)))
464 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
470 # define YYMALLOC malloc
471 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
478 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
479 || defined __cplusplus || defined _MSC_VER)
480 void free (void *); /* INFRINGES ON USER NAME SPACE */
484 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
487 #if (! defined yyoverflow \
488 && (! defined __cplusplus \
489 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
490 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
492 /* A type that is properly aligned for any stack member. */
500 /* The size of the maximum gap between one aligned stack and the next. */
501 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
503 /* The size of an array large to enough to hold all stacks, each with
505 # define YYSTACK_BYTES(N) \
506 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
507 + 2 * YYSTACK_GAP_MAXIMUM)
509 /* Copy COUNT objects from FROM to TO. The source and destination do
512 # if defined __GNUC__ && 1 < __GNUC__
513 # define YYCOPY(To, From, Count) \
514 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
516 # define YYCOPY(To, From, Count) \
520 for (yyi = 0; yyi < (Count); yyi++) \
521 (To)[yyi] = (From)[yyi]; \
527 /* Relocate STACK from its old location to the new one. The
528 local variables YYSIZE and YYSTACKSIZE give the old and new number of
529 elements in the stack, and YYPTR gives the new location of the
530 stack. Advance YYPTR to a properly aligned location for the next
532 # define YYSTACK_RELOCATE(Stack) \
535 YYSIZE_T yynewbytes; \
536 YYCOPY (&yyptr->Stack, Stack, yysize); \
537 Stack = &yyptr->Stack; \
538 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
539 yyptr += yynewbytes / sizeof (*yyptr); \
545 /* YYFINAL -- State number of the termination state. */
547 /* YYLAST -- Last index in YYTABLE. */
550 /* YYNTOKENS -- Number of terminals. */
552 /* YYNNTS -- Number of nonterminals. */
554 /* YYNRULES -- Number of rules. */
556 /* YYNRULES -- Number of states. */
557 #define YYNSTATES 128
559 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
561 #define YYMAXUTOK 311
563 #define YYTRANSLATE(YYX) \
564 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
566 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
567 static const yytype_uint8 yytranslate
[] =
569 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
595 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
596 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
597 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
598 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
599 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
604 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
606 static const yytype_uint8 yyprhs
[] =
608 0, 0, 3, 8, 9, 12, 14, 16, 19, 22,
609 24, 27, 31, 33, 36, 38, 41, 44, 48, 50,
610 53, 56, 58, 62, 64, 66, 70, 73, 75, 78,
611 81, 84, 86, 88, 90, 92, 94, 96, 99, 103,
612 107, 109, 111, 112, 114, 118, 119, 123, 124, 128,
613 132, 136, 138, 140, 142, 143, 145, 147, 150, 152,
614 154, 157, 160, 164, 166, 169, 171, 174, 176, 179,
615 182, 183, 187, 189, 193, 196, 197, 200, 203, 207,
616 211, 215, 217, 219, 221, 223, 225, 227, 229, 230
619 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
620 static const yytype_int8 yyrhs
[] =
622 58, 0, -1, 59, 51, 72, 83, -1, -1, 59,
623 60, -1, 61, -1, 53, -1, 16, 45, -1, 17,
624 45, -1, 18, -1, 20, 82, -1, 20, 82, 82,
625 -1, 21, -1, 22, 45, -1, 23, -1, 24, 4,
626 -1, 25, 4, -1, 26, 48, 82, -1, 27, -1,
627 28, 45, -1, 29, 45, -1, 30, -1, 31, 48,
628 82, -1, 33, -1, 34, -1, 35, 48, 82, -1,
629 36, 45, -1, 37, -1, 38, 82, -1, 39, 82,
630 -1, 41, 45, -1, 42, -1, 43, -1, 44, -1,
631 54, -1, 66, -1, 63, -1, 40, 80, -1, 8,
632 45, 69, -1, 9, 45, 69, -1, 19, -1, 32,
633 -1, -1, 49, -1, 56, 62, 45, -1, -1, 6,
634 64, 71, -1, -1, 5, 65, 71, -1, 7, 55,
635 69, -1, 67, 68, 69, -1, 10, -1, 11, -1,
636 12, -1, -1, 55, -1, 80, -1, 69, 80, -1,
637 55, -1, 78, -1, 78, 4, -1, 78, 81, -1,
638 78, 4, 81, -1, 70, -1, 71, 70, -1, 73,
639 -1, 72, 73, -1, 74, -1, 61, 54, -1, 1,
640 54, -1, -1, 79, 75, 76, -1, 77, -1, 76,
641 52, 77, -1, 76, 54, -1, -1, 77, 80, -1,
642 77, 45, -1, 77, 13, 80, -1, 77, 14, 4,
643 -1, 77, 15, 55, -1, 49, -1, 46, -1, 50,
644 -1, 78, -1, 81, -1, 3, -1, 3, -1, -1,
648 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
649 static const yytype_uint16 yyrline
[] =
651 0, 202, 202, 210, 212, 216, 217, 221, 227, 233,
652 234, 239, 240, 241, 247, 248, 249, 250, 251, 256,
653 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
654 270, 276, 277, 278, 279, 283, 284, 285, 289, 297,
655 305, 309, 323, 324, 328, 350, 350, 355, 355, 360,
656 370, 385, 386, 387, 391, 392, 397, 398, 403, 407,
657 412, 418, 424, 435, 436, 445, 446, 452, 453, 454,
658 461, 461, 465, 466, 467, 472, 473, 475, 477, 479,
659 481, 494, 496, 505, 510, 511, 516, 525, 530, 532
663 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
664 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
665 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
666 static const char *const yytname
[] =
668 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
669 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
670 "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"",
671 "\"%dprec\"", "\"%merge\"", "\"%after-header\"", "\"%before-header\"",
672 "\"%debug\"", "\"%default-prec\"", "\"%define\"", "\"%defines\"",
673 "\"%end-header\"", "\"%error-verbose\"", "\"%expect\"", "\"%expect-rr\"",
674 "\"%file-prefix\"", "\"%glr-parser\"", "\"%initial-action\"",
675 "\"%lex-param\"", "\"%locations\"", "\"%name-prefix\"",
676 "\"%no-default-prec\"", "\"%no-lines\"", "\"%nondeterministic-parser\"",
677 "\"%output\"", "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"",
678 "\"%skeleton\"", "\"%start\"", "\"%start-header\"", "\"%token-table\"",
679 "\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"char\"", "\"epilogue\"",
680 "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"",
681 "\"%{...%}\"", "\";\"", "\"type\"", "\"%union\"", "$accept", "input",
682 "declarations", "declaration", "grammar_declaration", "union_name",
683 "symbol_declaration", "@1", "@2", "precedence_declaration",
684 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
685 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
686 "@3", "rhses.1", "rhs", "id", "id_colon", "symbol", "string_as_id",
687 "string_content", "epilogue.opt", 0
692 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
694 static const yytype_uint16 yytoknum
[] =
696 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
697 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
698 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
699 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
700 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
701 305, 306, 307, 308, 309, 310, 311
705 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
706 static const yytype_uint8 yyr1
[] =
708 0, 57, 58, 59, 59, 60, 60, 60, 60, 60,
709 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
710 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
711 60, 60, 60, 60, 60, 61, 61, 61, 61, 61,
712 61, 61, 62, 62, 61, 64, 63, 65, 63, 63,
713 66, 67, 67, 67, 68, 68, 69, 69, 70, 70,
714 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
715 75, 74, 76, 76, 76, 77, 77, 77, 77, 77,
716 77, 78, 78, 79, 80, 80, 81, 82, 83, 83
719 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
720 static const yytype_uint8 yyr2
[] =
722 0, 2, 4, 0, 2, 1, 1, 2, 2, 1,
723 2, 3, 1, 2, 1, 2, 2, 3, 1, 2,
724 2, 1, 3, 1, 1, 3, 2, 1, 2, 2,
725 2, 1, 1, 1, 1, 1, 1, 2, 3, 3,
726 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
727 3, 1, 1, 1, 0, 1, 1, 2, 1, 1,
728 2, 2, 3, 1, 2, 1, 2, 1, 2, 2,
729 0, 3, 1, 3, 2, 0, 2, 2, 3, 3,
730 3, 1, 1, 1, 1, 1, 1, 1, 0, 2
733 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
734 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
735 means the default is an error. */
736 static const yytype_uint8 yydefact
[] =
738 3, 0, 0, 1, 47, 45, 0, 0, 0, 51,
739 52, 53, 0, 0, 9, 40, 0, 12, 0, 14,
740 0, 0, 0, 18, 0, 0, 21, 0, 41, 23,
741 24, 0, 0, 27, 0, 0, 0, 0, 31, 32,
742 33, 0, 6, 34, 42, 4, 5, 36, 35, 54,
743 0, 0, 0, 0, 0, 7, 8, 87, 10, 13,
744 15, 16, 0, 19, 20, 0, 0, 26, 28, 29,
745 86, 82, 81, 84, 37, 85, 30, 0, 83, 0,
746 0, 65, 67, 70, 43, 0, 55, 0, 58, 63,
747 48, 59, 46, 49, 56, 38, 39, 11, 17, 22,
748 25, 69, 68, 0, 66, 2, 75, 44, 50, 64,
749 60, 61, 57, 89, 71, 72, 62, 75, 74, 0,
750 0, 0, 77, 76, 73, 78, 79, 80
753 /* YYDEFGOTO[NTERM-NUM]. */
754 static const yytype_int8 yydefgoto
[] =
756 -1, 1, 2, 45, 79, 85, 47, 51, 50, 48,
757 49, 87, 93, 89, 90, 80, 81, 82, 106, 114,
758 115, 73, 83, 94, 75, 58, 105
761 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
763 #define YYPACT_NINF -76
764 static const yytype_int16 yypact
[] =
766 -76, 6, 136, -76, -76, -76, -40, -12, -9, -76,
767 -76, -76, -5, 1, -76, -76, 40, -76, 5, -76,
768 47, 50, 7, -76, 11, 18, -76, 19, -76, -76,
769 -76, 20, 25, -76, 40, 40, -2, 26, -76, -76,
770 -76, 84, -76, -76, 27, -76, -76, -76, -76, 14,
771 -23, -23, -2, -2, -2, -76, -76, -76, 40, -76,
772 -76, -76, 40, -76, -76, 40, 40, -76, -76, -76,
773 -76, -76, -76, -76, -76, -76, -76, 21, -76, 23,
774 2, -76, -76, -76, -76, 28, -76, -2, -76, -76,
775 -23, 24, -23, -2, -76, -2, -2, -76, -76, -76,
776 -76, -76, -76, 31, -76, -76, -76, -76, -2, -76,
777 71, -76, -76, -76, -32, 16, -76, -76, -76, -2,
778 76, 29, -76, -76, 16, -76, -76, -76
781 /* YYPGOTO[NTERM-NUM]. */
782 static const yytype_int8 yypgoto
[] =
784 -76, -76, -76, -76, 79, -76, -76, -76, -76, -76,
785 -76, -76, -49, -53, 35, -76, 17, -76, -76, -76,
786 -35, -26, -76, -36, -75, -17, -76
789 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
790 positive, shift that token. If negative, reduce the rule which
791 number is the opposite. If zero, do what YYDEFACT says.
792 If YYTABLE_NINF, syntax error. */
793 #define YYTABLE_NINF -89
794 static const yytype_int8 yytable
[] =
796 74, 70, -88, 77, 95, 96, 3, 4, 5, 6,
797 7, 8, 9, 10, 11, 52, 111, 68, 69, 70,
798 117, 15, 118, 71, 91, 91, 72, 70, 110, 119,
799 120, 121, 88, 53, 28, 116, 54, 109, 108, 109,
800 55, 97, 36, 57, 71, 98, 56, 72, 99, 100,
801 59, 60, 78, 103, 61, 62, 63, 112, 44, 112,
802 112, 122, 71, 64, 91, 72, 91, 65, 66, 86,
803 67, 76, 112, 107, 70, 101, 84, 102, 113, 123,
804 126, 46, 124, 125, 127, 77, 92, 0, 123, 4,
805 5, 6, 7, 8, 9, 10, 11, 104, 0, 0,
806 0, 0, 0, 15, 0, 0, 0, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
808 0, 0, 0, 0, 36, 0, 0, 0, 0, 0,
809 0, 0, 0, 0, 78, 0, 0, 0, 0, 0,
810 44, 4, 5, 6, 7, 8, 9, 10, 11, 0,
811 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
812 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
813 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
814 40, 0, 0, 0, 0, 0, 0, 41, 0, 42,
818 static const yytype_int8 yycheck
[] =
820 36, 3, 0, 1, 53, 54, 0, 5, 6, 7,
821 8, 9, 10, 11, 12, 55, 91, 34, 35, 3,
822 52, 19, 54, 46, 50, 51, 49, 3, 4, 13,
823 14, 15, 55, 45, 32, 110, 45, 90, 87, 92,
824 45, 58, 40, 3, 46, 62, 45, 49, 65, 66,
825 45, 4, 50, 51, 4, 48, 45, 93, 56, 95,
826 96, 45, 46, 45, 90, 49, 92, 48, 48, 55,
827 45, 45, 108, 45, 3, 54, 49, 54, 47, 115,
828 4, 2, 117, 119, 55, 1, 51, -1, 124, 5,
829 6, 7, 8, 9, 10, 11, 12, 80, -1, -1,
830 -1, -1, -1, 19, -1, -1, -1, -1, -1, -1,
831 -1, -1, -1, -1, -1, -1, 32, -1, -1, -1,
832 -1, -1, -1, -1, 40, -1, -1, -1, -1, -1,
833 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
834 56, 5, 6, 7, 8, 9, 10, 11, 12, -1,
835 -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,
836 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
837 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
838 44, -1, -1, -1, -1, -1, -1, 51, -1, 53,
842 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
843 symbol of state STATE-NUM. */
844 static const yytype_uint8 yystos
[] =
846 0, 58, 59, 0, 5, 6, 7, 8, 9, 10,
847 11, 12, 16, 17, 18, 19, 20, 21, 22, 23,
848 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
849 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
850 44, 51, 53, 54, 56, 60, 61, 63, 66, 67,
851 65, 64, 55, 45, 45, 45, 45, 3, 82, 45,
852 4, 4, 48, 45, 45, 48, 48, 45, 82, 82,
853 3, 46, 49, 78, 80, 81, 45, 1, 50, 61,
854 72, 73, 74, 79, 49, 62, 55, 68, 55, 70,
855 71, 78, 71, 69, 80, 69, 69, 82, 82, 82,
856 82, 54, 54, 51, 73, 83, 75, 45, 69, 70,
857 4, 81, 80, 47, 76, 77, 81, 52, 54, 13,
858 14, 15, 45, 80, 77, 80, 4, 55
861 #define yyerrok (yyerrstatus = 0)
862 #define yyclearin (yychar = YYEMPTY)
866 #define YYACCEPT goto yyacceptlab
867 #define YYABORT goto yyabortlab
868 #define YYERROR goto yyerrorlab
871 /* Like YYERROR except do call yyerror. This remains here temporarily
872 to ease the transition to the new meaning of YYERROR, for GCC.
873 Once GCC version 2 has supplanted version 1, this can go. */
875 #define YYFAIL goto yyerrlab
877 #define YYRECOVERING() (!!yyerrstatus)
879 #define YYBACKUP(Token, Value) \
881 if (yychar == YYEMPTY && yylen == 1) \
885 yytoken = YYTRANSLATE (yychar); \
891 yyerror (YY_("syntax error: cannot back up")); \
898 #define YYERRCODE 256
901 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
902 If N is 0, then set CURRENT to the empty location which ends
903 the previous symbol: RHS[0] (always defined). */
905 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
906 #ifndef YYLLOC_DEFAULT
907 # define YYLLOC_DEFAULT(Current, Rhs, N) \
911 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
912 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
913 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
914 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
918 (Current).first_line = (Current).last_line = \
919 YYRHSLOC (Rhs, 0).last_line; \
920 (Current).first_column = (Current).last_column = \
921 YYRHSLOC (Rhs, 0).last_column; \
927 /* YY_LOCATION_PRINT -- Print the location on the stream.
928 This macro was not mandated originally: define only if we know
929 we won't break user code: when these are the locations we know. */
931 #ifndef YY_LOCATION_PRINT
932 # if YYLTYPE_IS_TRIVIAL
933 # define YY_LOCATION_PRINT(File, Loc) \
934 fprintf (File, "%d.%d-%d.%d", \
935 (Loc).first_line, (Loc).first_column, \
936 (Loc).last_line, (Loc).last_column)
938 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
943 /* YYLEX -- calling `yylex' with the right arguments. */
946 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
948 # define YYLEX yylex (&yylval, &yylloc)
951 /* Enable debugging if requested. */
955 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
956 # define YYFPRINTF fprintf
959 # define YYDPRINTF(Args) \
965 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
969 YYFPRINTF (stderr, "%s ", Title); \
970 yy_symbol_print (stderr, \
971 Type, Value, Location); \
972 YYFPRINTF (stderr, "\n"); \
977 /*--------------------------------.
978 | Print this symbol on YYOUTPUT. |
979 `--------------------------------*/
982 #if (defined __STDC__ || defined __C99__FUNC__ \
983 || defined __cplusplus || defined _MSC_VER)
985 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
988 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
991 YYSTYPE
const * const yyvaluep
;
992 YYLTYPE
const * const yylocationp
;
999 if (yytype
< YYNTOKENS
)
1000 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1006 case 3: /* "\"string\"" */
1007 /* Line 668 of yacc.c. */
1008 #line 181 "../../src/parse-gram.y"
1009 { fputs (quotearg_style (c_quoting_style
, (yyvaluep
->chars
)), stderr
); };
1010 /* Line 668 of yacc.c. */
1011 #line 1012 "../../src/parse-gram.c"
1013 case 4: /* "\"integer\"" */
1014 /* Line 668 of yacc.c. */
1015 #line 191 "../../src/parse-gram.y"
1016 { fprintf (stderr
, "%d", (yyvaluep
->integer
)); };
1017 /* Line 668 of yacc.c. */
1018 #line 1019 "../../src/parse-gram.c"
1020 case 45: /* "\"{...}\"" */
1021 /* Line 668 of yacc.c. */
1022 #line 183 "../../src/parse-gram.y"
1023 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1024 /* Line 668 of yacc.c. */
1025 #line 1026 "../../src/parse-gram.c"
1027 case 46: /* "\"char\"" */
1028 /* Line 668 of yacc.c. */
1029 #line 178 "../../src/parse-gram.y"
1030 { fputs (char_name ((yyvaluep
->character
)), stderr
); };
1031 /* Line 668 of yacc.c. */
1032 #line 1033 "../../src/parse-gram.c"
1034 case 47: /* "\"epilogue\"" */
1035 /* Line 668 of yacc.c. */
1036 #line 183 "../../src/parse-gram.y"
1037 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1038 /* Line 668 of yacc.c. */
1039 #line 1040 "../../src/parse-gram.c"
1041 case 49: /* "\"identifier\"" */
1042 /* Line 668 of yacc.c. */
1043 #line 187 "../../src/parse-gram.y"
1044 { fputs ((yyvaluep
->uniqstr
), stderr
); };
1045 /* Line 668 of yacc.c. */
1046 #line 1047 "../../src/parse-gram.c"
1048 case 50: /* "\"identifier:\"" */
1049 /* Line 668 of yacc.c. */
1050 #line 188 "../../src/parse-gram.y"
1051 { fprintf (stderr
, "%s:", (yyvaluep
->uniqstr
)); };
1052 /* Line 668 of yacc.c. */
1053 #line 1054 "../../src/parse-gram.c"
1055 case 53: /* "\"%{...%}\"" */
1056 /* Line 668 of yacc.c. */
1057 #line 183 "../../src/parse-gram.y"
1058 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1059 /* Line 668 of yacc.c. */
1060 #line 1061 "../../src/parse-gram.c"
1062 case 55: /* "\"type\"" */
1063 /* Line 668 of yacc.c. */
1064 #line 186 "../../src/parse-gram.y"
1065 { fprintf (stderr
, "<%s>", (yyvaluep
->uniqstr
)); };
1066 /* Line 668 of yacc.c. */
1067 #line 1068 "../../src/parse-gram.c"
1070 /* Line 668 of yacc.c. */
1071 #line 194 "../../src/parse-gram.y"
1072 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1073 /* Line 668 of yacc.c. */
1074 #line 1075 "../../src/parse-gram.c"
1076 case 79: /* "id_colon" */
1077 /* Line 668 of yacc.c. */
1078 #line 195 "../../src/parse-gram.y"
1079 { fprintf (stderr
, "%s:", (yyvaluep
->symbol
)->tag
); };
1080 /* Line 668 of yacc.c. */
1081 #line 1082 "../../src/parse-gram.c"
1083 case 80: /* "symbol" */
1084 /* Line 668 of yacc.c. */
1085 #line 194 "../../src/parse-gram.y"
1086 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1087 /* Line 668 of yacc.c. */
1088 #line 1089 "../../src/parse-gram.c"
1090 case 81: /* "string_as_id" */
1091 /* Line 668 of yacc.c. */
1092 #line 194 "../../src/parse-gram.y"
1093 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1094 /* Line 668 of yacc.c. */
1095 #line 1096 "../../src/parse-gram.c"
1097 case 82: /* "string_content" */
1098 /* Line 668 of yacc.c. */
1099 #line 181 "../../src/parse-gram.y"
1100 { fputs (quotearg_style (c_quoting_style
, (yyvaluep
->chars
)), stderr
); };
1101 /* Line 668 of yacc.c. */
1102 #line 1103 "../../src/parse-gram.c"
1110 /*--------------------------------.
1111 | Print this symbol on YYOUTPUT. |
1112 `--------------------------------*/
1114 #if (defined __STDC__ || defined __C99__FUNC__ \
1115 || defined __cplusplus || defined _MSC_VER)
1117 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1120 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1123 YYSTYPE
const * const yyvaluep
;
1124 YYLTYPE
const * const yylocationp
;
1127 if (yytype
< YYNTOKENS
)
1128 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1130 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1132 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1133 YYFPRINTF (yyoutput
, ": ");
1134 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1135 YYFPRINTF (yyoutput
, ")");
1138 /*------------------------------------------------------------------.
1139 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1141 `------------------------------------------------------------------*/
1143 #if (defined __STDC__ || defined __C99__FUNC__ \
1144 || defined __cplusplus || defined _MSC_VER)
1146 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
1149 yy_stack_print (bottom
, top
)
1150 yytype_int16
*bottom
;
1154 YYFPRINTF (stderr
, "Stack now");
1155 for (; bottom
<= top
; ++bottom
)
1156 YYFPRINTF (stderr
, " %d", *bottom
);
1157 YYFPRINTF (stderr
, "\n");
1160 # define YY_STACK_PRINT(Bottom, Top) \
1163 yy_stack_print ((Bottom), (Top)); \
1167 /*------------------------------------------------.
1168 | Report that the YYRULE is going to be reduced. |
1169 `------------------------------------------------*/
1171 #if (defined __STDC__ || defined __C99__FUNC__ \
1172 || defined __cplusplus || defined _MSC_VER)
1174 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1177 yy_reduce_print (yyvsp
, yylsp
, yyrule
)
1183 int yynrhs
= yyr2
[yyrule
];
1185 unsigned long int yylno
= yyrline
[yyrule
];
1186 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1188 /* The symbols being reduced. */
1189 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1191 fprintf (stderr
, " $%d = ", yyi
+ 1);
1192 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1193 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1194 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1195 fprintf (stderr
, "\n");
1199 # define YY_REDUCE_PRINT(Rule) \
1202 yy_reduce_print (yyvsp, yylsp, Rule); \
1205 /* Nonzero means print parse trace. It is left uninitialized so that
1206 multiple parsers can coexist. */
1208 #else /* !YYDEBUG */
1209 # define YYDPRINTF(Args)
1210 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1211 # define YY_STACK_PRINT(Bottom, Top)
1212 # define YY_REDUCE_PRINT(Rule)
1213 #endif /* !YYDEBUG */
1216 /* YYINITDEPTH -- initial size of the parser's stacks. */
1218 # define YYINITDEPTH 200
1221 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1222 if the built-in stack extension method is used).
1224 Do not make this value too large; the results are undefined if
1225 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1226 evaluated with infinite-precision integer arithmetic. */
1229 # define YYMAXDEPTH 10000
1237 # if defined __GLIBC__ && defined _STRING_H
1238 # define yystrlen strlen
1240 /* Return the length of YYSTR. */
1241 #if (defined __STDC__ || defined __C99__FUNC__ \
1242 || defined __cplusplus || defined _MSC_VER)
1244 yystrlen (const char *yystr
)
1252 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1260 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1261 # define yystpcpy stpcpy
1263 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1265 #if (defined __STDC__ || defined __C99__FUNC__ \
1266 || defined __cplusplus || defined _MSC_VER)
1268 yystpcpy (char *yydest
, const char *yysrc
)
1271 yystpcpy (yydest
, yysrc
)
1277 const char *yys
= yysrc
;
1279 while ((*yyd
++ = *yys
++) != '\0')
1288 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1289 quotes and backslashes, so that it's suitable for yyerror. The
1290 heuristic is that double-quoting is unnecessary unless the string
1291 contains an apostrophe, a comma, or backslash (other than
1292 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1293 null, do not copy; instead, return the length of what the result
1296 yytnamerr (char *yyres
, const char *yystr
)
1301 char const *yyp
= yystr
;
1308 goto do_not_strip_quotes
;
1312 goto do_not_strip_quotes
;
1325 do_not_strip_quotes
: ;
1329 return yystrlen (yystr
);
1331 return yystpcpy (yyres
, yystr
) - yyres
;
1335 /* Copy into YYRESULT an error message about the unexpected token
1336 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1337 including the terminating null byte. If YYRESULT is null, do not
1338 copy anything; just return the number of bytes that would be
1339 copied. As a special case, return 0 if an ordinary "syntax error"
1340 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1341 size calculation. */
1343 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1345 int yyn
= yypact
[yystate
];
1347 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1351 int yytype
= YYTRANSLATE (yychar
);
1352 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1353 YYSIZE_T yysize
= yysize0
;
1355 int yysize_overflow
= 0;
1356 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1357 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1361 /* This is so xgettext sees the translatable formats that are
1362 constructed on the fly. */
1363 YY_("syntax error, unexpected %s");
1364 YY_("syntax error, unexpected %s, expecting %s");
1365 YY_("syntax error, unexpected %s, expecting %s or %s");
1366 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1367 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1371 static char const yyunexpected
[] = "syntax error, unexpected %s";
1372 static char const yyexpecting
[] = ", expecting %s";
1373 static char const yyor
[] = " or %s";
1374 char yyformat
[sizeof yyunexpected
1375 + sizeof yyexpecting
- 1
1376 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1377 * (sizeof yyor
- 1))];
1378 char const *yyprefix
= yyexpecting
;
1380 /* Start YYX at -YYN if negative to avoid negative indexes in
1382 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1384 /* Stay within bounds of both yycheck and yytname. */
1385 int yychecklim
= YYLAST
- yyn
+ 1;
1386 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1389 yyarg
[0] = yytname
[yytype
];
1390 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1392 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1393 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1395 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1399 yyformat
[sizeof yyunexpected
- 1] = '\0';
1402 yyarg
[yycount
++] = yytname
[yyx
];
1403 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1404 yysize_overflow
|= (yysize1
< yysize
);
1406 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1410 yyf
= YY_(yyformat
);
1411 yysize1
= yysize
+ yystrlen (yyf
);
1412 yysize_overflow
|= (yysize1
< yysize
);
1415 if (yysize_overflow
)
1416 return YYSIZE_MAXIMUM
;
1420 /* Avoid sprintf, as that infringes on the user's name space.
1421 Don't have undefined behavior even if the translation
1422 produced a string with the wrong number of "%s"s. */
1423 char *yyp
= yyresult
;
1425 while ((*yyp
= *yyf
) != '\0')
1427 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1429 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1442 #endif /* YYERROR_VERBOSE */
1445 /*-----------------------------------------------.
1446 | Release the memory associated to this symbol. |
1447 `-----------------------------------------------*/
1450 #if (defined __STDC__ || defined __C99__FUNC__ \
1451 || defined __cplusplus || defined _MSC_VER)
1453 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1456 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
1460 YYLTYPE
*yylocationp
;
1464 YYUSE (yylocationp
);
1468 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1479 /* Prevent warnings from -Wmissing-prototypes. */
1481 #ifdef YYPARSE_PARAM
1482 #if defined __STDC__ || defined __cplusplus
1483 int yyparse (void *YYPARSE_PARAM
);
1487 #else /* ! YYPARSE_PARAM */
1488 #if defined __STDC__ || defined __cplusplus
1493 #endif /* ! YYPARSE_PARAM */
1504 #ifdef YYPARSE_PARAM
1505 #if (defined __STDC__ || defined __C99__FUNC__ \
1506 || defined __cplusplus || defined _MSC_VER)
1508 yyparse (void *YYPARSE_PARAM
)
1511 yyparse (YYPARSE_PARAM
)
1512 void *YYPARSE_PARAM
;
1514 #else /* ! YYPARSE_PARAM */
1515 #if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1526 /* The lookahead symbol. */
1529 /* The semantic value of the lookahead symbol. */
1532 /* Number of syntax errors so far. */
1534 /* Location data for the lookahead symbol. */
1540 /* Number of tokens to shift before error messages enabled. */
1542 /* Lookahead token as an internal (translated) token number. */
1545 /* Buffer for error messages, and its allocated size. */
1547 char *yymsg
= yymsgbuf
;
1548 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1551 /* Three stacks and their tools:
1552 `yyss': related to states,
1553 `yyvs': related to semantic values,
1554 `yyls': related to locations.
1556 Refer to the stacks thru separate pointers, to allow yyoverflow
1557 to reallocate them elsewhere. */
1559 /* The state stack. */
1560 yytype_int16 yyssa
[YYINITDEPTH
];
1561 yytype_int16
*yyss
= yyssa
;
1562 yytype_int16
*yyssp
;
1564 /* The semantic value stack. */
1565 YYSTYPE yyvsa
[YYINITDEPTH
];
1566 YYSTYPE
*yyvs
= yyvsa
;
1569 /* The location stack. */
1570 YYLTYPE yylsa
[YYINITDEPTH
];
1571 YYLTYPE
*yyls
= yylsa
;
1573 /* The locations where the error started and ended. */
1574 YYLTYPE yyerror_range
[2];
1576 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1578 YYSIZE_T yystacksize
= YYINITDEPTH
;
1580 /* The variables used to return semantic value and location from the
1585 /* The number of symbols on the RHS of the reduced rule.
1586 Keep to zero when no symbol should be popped. */
1589 YYDPRINTF ((stderr
, "Starting parse\n"));
1594 yychar
= YYEMPTY
; /* Cause a token to be read. */
1596 /* Initialize stack pointers.
1597 Waste one element of value and location stack
1598 so that they stay on the same level as the state stack.
1599 The wasted elements are never initialized. */
1604 #if YYLTYPE_IS_TRIVIAL
1605 /* Initialize the default location before parsing starts. */
1606 yylloc
.first_line
= yylloc
.last_line
= 1;
1607 yylloc
.first_column
= yylloc
.last_column
= 0;
1611 /* User initialization code. */
1612 /* Line 1077 of yacc.c. */
1613 #line 88 "../../src/parse-gram.y"
1615 /* Bison's grammar can initial empty locations, hence a default
1616 location is needed. */
1617 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1618 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1620 /* Line 1077 of yacc.c. */
1621 #line 1622 "../../src/parse-gram.c"
1625 /*------------------------------------------------------------.
1626 | yynewstate -- Push a new state, which is found in yystate. |
1627 `------------------------------------------------------------*/
1629 /* In all cases, when you get here, the value and location stacks
1630 have just been pushed. So pushing a state here evens the stacks. */
1636 if (yyss
+ yystacksize
- 1 <= yyssp
)
1638 /* Get the current used size of the three stacks, in elements. */
1639 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1643 /* Give user a chance to reallocate the stack. Use copies of
1644 these so that the &'s don't force the real ones into
1646 YYSTYPE
*yyvs1
= yyvs
;
1647 yytype_int16
*yyss1
= yyss
;
1648 YYLTYPE
*yyls1
= yyls
;
1650 /* Each stack pointer address is followed by the size of the
1651 data in use in that stack, in bytes. This used to be a
1652 conditional around just the two extra args, but that might
1653 be undefined if yyoverflow is a macro. */
1654 yyoverflow (YY_("memory exhausted"),
1655 &yyss1
, yysize
* sizeof (*yyssp
),
1656 &yyvs1
, yysize
* sizeof (*yyvsp
),
1657 &yyls1
, yysize
* sizeof (*yylsp
),
1663 #else /* no yyoverflow */
1664 # ifndef YYSTACK_RELOCATE
1665 goto yyexhaustedlab
;
1667 /* Extend the stack our own way. */
1668 if (YYMAXDEPTH
<= yystacksize
)
1669 goto yyexhaustedlab
;
1671 if (YYMAXDEPTH
< yystacksize
)
1672 yystacksize
= YYMAXDEPTH
;
1675 yytype_int16
*yyss1
= yyss
;
1676 union yyalloc
*yyptr
=
1677 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1679 goto yyexhaustedlab
;
1680 YYSTACK_RELOCATE (yyss
);
1681 YYSTACK_RELOCATE (yyvs
);
1682 YYSTACK_RELOCATE (yyls
);
1683 # undef YYSTACK_RELOCATE
1685 YYSTACK_FREE (yyss1
);
1688 #endif /* no yyoverflow */
1690 yyssp
= yyss
+ yysize
- 1;
1691 yyvsp
= yyvs
+ yysize
- 1;
1692 yylsp
= yyls
+ yysize
- 1;
1694 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1695 (unsigned long int) yystacksize
));
1697 if (yyss
+ yystacksize
- 1 <= yyssp
)
1701 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1710 /* Do appropriate processing given the current state. Read a
1711 lookahead token if we need one and don't already have one. */
1713 /* First try to decide what to do without reference to lookahead token. */
1714 yyn
= yypact
[yystate
];
1715 if (yyn
== YYPACT_NINF
)
1718 /* Not known => get a lookahead token if don't already have one. */
1720 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1721 if (yychar
== YYEMPTY
)
1723 YYDPRINTF ((stderr
, "Reading a token: "));
1727 if (yychar
<= YYEOF
)
1729 yychar
= yytoken
= YYEOF
;
1730 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1734 yytoken
= YYTRANSLATE (yychar
);
1735 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1738 /* If the proper action on seeing token YYTOKEN is to reduce or to
1739 detect an error, take that action. */
1741 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1746 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1755 /* Count tokens shifted since error; after three, turn off error
1760 /* Shift the lookahead token. */
1761 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1763 /* Discard the shifted token unless it is eof. */
1764 if (yychar
!= YYEOF
)
1773 /*-----------------------------------------------------------.
1774 | yydefault -- do the default action for the current state. |
1775 `-----------------------------------------------------------*/
1777 yyn
= yydefact
[yystate
];
1783 /*-----------------------------.
1784 | yyreduce -- Do a reduction. |
1785 `-----------------------------*/
1787 /* yyn is the number of a rule to reduce with. */
1790 /* If YYLEN is nonzero, implement the default value of the action:
1793 Otherwise, the following line sets YYVAL to garbage.
1794 This behavior is undocumented and Bison
1795 users should not rely upon it. Assigning to YYVAL
1796 unconditionally makes the parser a bit smaller, and it avoids a
1797 GCC warning that YYVAL may be used uninitialized. */
1798 yyval
= yyvsp
[1-yylen
];
1800 /* Default location. */
1801 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1802 YY_REDUCE_PRINT (yyn
);
1806 /* Line 1265 of yacc.c. */
1807 #line 218 "../../src/parse-gram.y"
1809 prologue_augment (translate_code ((yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)])), (yylsp
[(1) - (1)]), typed
);
1814 /* Line 1265 of yacc.c. */
1815 #line 222 "../../src/parse-gram.y"
1817 /* Remove the '{', and replace the '}' with '\n'. */
1818 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1819 prologue_augment (translate_code ((yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]), true);
1824 /* Line 1265 of yacc.c. */
1825 #line 228 "../../src/parse-gram.y"
1827 /* Remove the '{', and replace the '}' with '\n'. */
1828 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1829 prologue_augment (translate_code ((yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]), false);
1834 /* Line 1265 of yacc.c. */
1835 #line 233 "../../src/parse-gram.y"
1836 { debug_flag
= true; }
1840 /* Line 1265 of yacc.c. */
1841 #line 235 "../../src/parse-gram.y"
1843 static char one
[] = "1";
1844 muscle_insert ((yyvsp
[(2) - (2)].chars
), one
);
1849 /* Line 1265 of yacc.c. */
1850 #line 239 "../../src/parse-gram.y"
1851 { muscle_insert ((yyvsp
[(2) - (3)].chars
), (yyvsp
[(3) - (3)].chars
)); }
1855 /* Line 1265 of yacc.c. */
1856 #line 240 "../../src/parse-gram.y"
1857 { defines_flag
= true; }
1861 /* Line 1265 of yacc.c. */
1862 #line 242 "../../src/parse-gram.y"
1864 /* Remove the '{', and replace the '}' with '\n'. */
1865 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1866 muscle_code_grow ("end_header", translate_code ((yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
1871 /* Line 1265 of yacc.c. */
1872 #line 247 "../../src/parse-gram.y"
1873 { error_verbose
= true; }
1877 /* Line 1265 of yacc.c. */
1878 #line 248 "../../src/parse-gram.y"
1879 { expected_sr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1883 /* Line 1265 of yacc.c. */
1884 #line 249 "../../src/parse-gram.y"
1885 { expected_rr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1889 /* Line 1265 of yacc.c. */
1890 #line 250 "../../src/parse-gram.y"
1891 { spec_file_prefix
= (yyvsp
[(3) - (3)].chars
); }
1895 /* Line 1265 of yacc.c. */
1896 #line 252 "../../src/parse-gram.y"
1898 nondeterministic_parser
= true;
1904 /* Line 1265 of yacc.c. */
1905 #line 257 "../../src/parse-gram.y"
1907 muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
1912 /* Line 1265 of yacc.c. */
1913 #line 260 "../../src/parse-gram.y"
1914 { add_param ("lex_param", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])); }
1918 /* Line 1265 of yacc.c. */
1919 #line 261 "../../src/parse-gram.y"
1920 { locations_flag
= true; }
1924 /* Line 1265 of yacc.c. */
1925 #line 262 "../../src/parse-gram.y"
1926 { spec_name_prefix
= (yyvsp
[(3) - (3)].chars
); }
1930 /* Line 1265 of yacc.c. */
1931 #line 263 "../../src/parse-gram.y"
1932 { no_lines_flag
= true; }
1936 /* Line 1265 of yacc.c. */
1937 #line 264 "../../src/parse-gram.y"
1938 { nondeterministic_parser
= true; }
1942 /* Line 1265 of yacc.c. */
1943 #line 265 "../../src/parse-gram.y"
1944 { spec_outfile
= (yyvsp
[(3) - (3)].chars
); }
1948 /* Line 1265 of yacc.c. */
1949 #line 266 "../../src/parse-gram.y"
1950 { add_param ("parse_param", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])); }
1954 /* Line 1265 of yacc.c. */
1955 #line 267 "../../src/parse-gram.y"
1956 { pure_parser
= true; }
1960 /* Line 1265 of yacc.c. */
1961 #line 268 "../../src/parse-gram.y"
1962 { version_check (&(yylsp
[(2) - (2)]), (yyvsp
[(2) - (2)].chars
)); }
1966 /* Line 1265 of yacc.c. */
1967 #line 269 "../../src/parse-gram.y"
1968 { skeleton
= (yyvsp
[(2) - (2)].chars
); }
1972 /* Line 1265 of yacc.c. */
1973 #line 271 "../../src/parse-gram.y"
1975 /* Remove the '{', and replace the '}' with '\n'. */
1976 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1977 muscle_code_grow ("start_header", translate_code ((yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
1982 /* Line 1265 of yacc.c. */
1983 #line 276 "../../src/parse-gram.y"
1984 { token_table_flag
= true; }
1988 /* Line 1265 of yacc.c. */
1989 #line 277 "../../src/parse-gram.y"
1990 { report_flag
= report_states
; }
1994 /* Line 1265 of yacc.c. */
1995 #line 278 "../../src/parse-gram.y"
1996 { yacc_flag
= true; }
2000 /* Line 1265 of yacc.c. */
2001 #line 286 "../../src/parse-gram.y"
2003 grammar_start_symbol_set ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)]));
2008 /* Line 1265 of yacc.c. */
2009 #line 290 "../../src/parse-gram.y"
2012 const char *action
= translate_symbol_action ((yyvsp
[(2) - (3)].chars
), (yylsp
[(2) - (3)]));
2013 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2014 symbol_destructor_set (list
->sym
, action
, (yylsp
[(2) - (3)]));
2015 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2020 /* Line 1265 of yacc.c. */
2021 #line 298 "../../src/parse-gram.y"
2024 const char *action
= translate_symbol_action ((yyvsp
[(2) - (3)].chars
), (yylsp
[(2) - (3)]));
2025 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2026 symbol_printer_set (list
->sym
, action
, (yylsp
[(2) - (3)]));
2027 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2032 /* Line 1265 of yacc.c. */
2033 #line 306 "../../src/parse-gram.y"
2035 default_prec
= true;
2040 /* Line 1265 of yacc.c. */
2041 #line 310 "../../src/parse-gram.y"
2043 default_prec
= false;
2048 /* Line 1265 of yacc.c. */
2049 #line 323 "../../src/parse-gram.y"
2054 /* Line 1265 of yacc.c. */
2055 #line 324 "../../src/parse-gram.y"
2056 { muscle_code_grow ("union_name", (yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2060 /* Line 1265 of yacc.c. */
2061 #line 329 "../../src/parse-gram.y"
2063 char const *body
= (yyvsp
[(3) - (3)].chars
);
2067 /* Concatenate the union bodies, turning the first one's
2068 trailing '}' into '\n', and omitting the second one's '{'. */
2069 char *code
= muscle_find ("stype");
2070 code
[strlen (code
) - 1] = '\n';
2075 muscle_code_grow ("stype", body
, (yylsp
[(3) - (3)]));
2080 /* Line 1265 of yacc.c. */
2081 #line 350 "../../src/parse-gram.y"
2082 { current_class
= nterm_sym
; }
2086 /* Line 1265 of yacc.c. */
2087 #line 351 "../../src/parse-gram.y"
2089 current_class
= unknown_sym
;
2090 current_type
= NULL
;
2095 /* Line 1265 of yacc.c. */
2096 #line 355 "../../src/parse-gram.y"
2097 { current_class
= token_sym
; }
2101 /* Line 1265 of yacc.c. */
2102 #line 356 "../../src/parse-gram.y"
2104 current_class
= unknown_sym
;
2105 current_type
= NULL
;
2110 /* Line 1265 of yacc.c. */
2111 #line 361 "../../src/parse-gram.y"
2114 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2115 symbol_type_set (list
->sym
, (yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]));
2116 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2121 /* Line 1265 of yacc.c. */
2122 #line 371 "../../src/parse-gram.y"
2126 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2128 symbol_type_set (list
->sym
, current_type
, (yylsp
[(2) - (3)]));
2129 symbol_precedence_set (list
->sym
, current_prec
, (yyvsp
[(1) - (3)].assoc
), (yylsp
[(1) - (3)]));
2131 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2132 current_type
= NULL
;
2137 /* Line 1265 of yacc.c. */
2138 #line 385 "../../src/parse-gram.y"
2139 { (yyval
.assoc
) = left_assoc
; }
2143 /* Line 1265 of yacc.c. */
2144 #line 386 "../../src/parse-gram.y"
2145 { (yyval
.assoc
) = right_assoc
; }
2149 /* Line 1265 of yacc.c. */
2150 #line 387 "../../src/parse-gram.y"
2151 { (yyval
.assoc
) = non_assoc
; }
2155 /* Line 1265 of yacc.c. */
2156 #line 391 "../../src/parse-gram.y"
2157 { current_type
= NULL
; }
2161 /* Line 1265 of yacc.c. */
2162 #line 392 "../../src/parse-gram.y"
2163 { current_type
= (yyvsp
[(1) - (1)].uniqstr
); }
2167 /* Line 1265 of yacc.c. */
2168 #line 397 "../../src/parse-gram.y"
2169 { (yyval
.list
) = symbol_list_new ((yyvsp
[(1) - (1)].symbol
), (yylsp
[(1) - (1)])); }
2173 /* Line 1265 of yacc.c. */
2174 #line 398 "../../src/parse-gram.y"
2175 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[(1) - (2)].list
), (yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2179 /* Line 1265 of yacc.c. */
2180 #line 404 "../../src/parse-gram.y"
2182 current_type
= (yyvsp
[(1) - (1)].uniqstr
);
2187 /* Line 1265 of yacc.c. */
2188 #line 408 "../../src/parse-gram.y"
2190 symbol_class_set ((yyvsp
[(1) - (1)].symbol
), current_class
, (yylsp
[(1) - (1)]), true);
2191 symbol_type_set ((yyvsp
[(1) - (1)].symbol
), current_type
, (yylsp
[(1) - (1)]));
2196 /* Line 1265 of yacc.c. */
2197 #line 413 "../../src/parse-gram.y"
2199 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2200 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2201 symbol_user_token_number_set ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].integer
), (yylsp
[(2) - (2)]));
2206 /* Line 1265 of yacc.c. */
2207 #line 419 "../../src/parse-gram.y"
2209 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2210 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2211 symbol_make_alias ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].symbol
), (yyloc
));
2216 /* Line 1265 of yacc.c. */
2217 #line 425 "../../src/parse-gram.y"
2219 symbol_class_set ((yyvsp
[(1) - (3)].symbol
), current_class
, (yylsp
[(1) - (3)]), true);
2220 symbol_type_set ((yyvsp
[(1) - (3)].symbol
), current_type
, (yylsp
[(1) - (3)]));
2221 symbol_user_token_number_set ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(2) - (3)].integer
), (yylsp
[(2) - (3)]));
2222 symbol_make_alias ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(3) - (3)].symbol
), (yyloc
));
2227 /* Line 1265 of yacc.c. */
2228 #line 455 "../../src/parse-gram.y"
2235 /* Line 1265 of yacc.c. */
2236 #line 461 "../../src/parse-gram.y"
2237 { current_lhs
= (yyvsp
[(1) - (1)].symbol
); current_lhs_location
= (yylsp
[(1) - (1)]); }
2241 /* Line 1265 of yacc.c. */
2242 #line 465 "../../src/parse-gram.y"
2243 { grammar_current_rule_end ((yylsp
[(1) - (1)])); }
2247 /* Line 1265 of yacc.c. */
2248 #line 466 "../../src/parse-gram.y"
2249 { grammar_current_rule_end ((yylsp
[(3) - (3)])); }
2253 /* Line 1265 of yacc.c. */
2254 #line 472 "../../src/parse-gram.y"
2255 { grammar_current_rule_begin (current_lhs
, current_lhs_location
); }
2259 /* Line 1265 of yacc.c. */
2260 #line 474 "../../src/parse-gram.y"
2261 { grammar_current_rule_symbol_append ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2265 /* Line 1265 of yacc.c. */
2266 #line 476 "../../src/parse-gram.y"
2267 { grammar_current_rule_action_append ((yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])); }
2271 /* Line 1265 of yacc.c. */
2272 #line 478 "../../src/parse-gram.y"
2273 { grammar_current_rule_prec_set ((yyvsp
[(3) - (3)].symbol
), (yylsp
[(3) - (3)])); }
2277 /* Line 1265 of yacc.c. */
2278 #line 480 "../../src/parse-gram.y"
2279 { grammar_current_rule_dprec_set ((yyvsp
[(3) - (3)].integer
), (yylsp
[(3) - (3)])); }
2283 /* Line 1265 of yacc.c. */
2284 #line 482 "../../src/parse-gram.y"
2285 { grammar_current_rule_merge_set ((yyvsp
[(3) - (3)].uniqstr
), (yylsp
[(3) - (3)])); }
2289 /* Line 1265 of yacc.c. */
2290 #line 495 "../../src/parse-gram.y"
2291 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2295 /* Line 1265 of yacc.c. */
2296 #line 497 "../../src/parse-gram.y"
2298 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[(1) - (1)].character
)), (yylsp
[(1) - (1)]));
2299 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2300 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[(1) - (1)].character
), (yylsp
[(1) - (1)]));
2305 /* Line 1265 of yacc.c. */
2306 #line 505 "../../src/parse-gram.y"
2307 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2311 /* Line 1265 of yacc.c. */
2312 #line 517 "../../src/parse-gram.y"
2314 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[(1) - (1)].chars
)), (yylsp
[(1) - (1)]));
2315 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2320 /* Line 1265 of yacc.c. */
2321 #line 526 "../../src/parse-gram.y"
2322 { (yyval
.chars
) = (yyvsp
[(1) - (1)].chars
); }
2326 /* Line 1265 of yacc.c. */
2327 #line 533 "../../src/parse-gram.y"
2329 muscle_code_grow ("epilogue", translate_code ((yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
2330 gram_scanner_last_string_free ();
2335 /* Line 1265 of yacc.c. */
2336 #line 2337 "../../src/parse-gram.c"
2339 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2343 YY_STACK_PRINT (yyss
, yyssp
);
2348 /* Now `shift' the result of the reduction. Determine what state
2349 that goes to, based on the state we popped back to and the rule
2350 number reduced by. */
2354 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2355 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2356 yystate
= yytable
[yystate
];
2358 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2363 /*------------------------------------.
2364 | yyerrlab -- here on detecting error |
2365 `------------------------------------*/
2367 /* If not already recovering from an error, report this error. */
2371 #if ! YYERROR_VERBOSE
2372 yyerror (YY_("syntax error"));
2375 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2376 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2378 YYSIZE_T yyalloc
= 2 * yysize
;
2379 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2380 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2381 if (yymsg
!= yymsgbuf
)
2382 YYSTACK_FREE (yymsg
);
2383 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2385 yymsg_alloc
= yyalloc
;
2389 yymsg_alloc
= sizeof yymsgbuf
;
2393 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2395 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2400 yyerror (YY_("syntax error"));
2402 goto yyexhaustedlab
;
2408 yyerror_range
[0] = yylloc
;
2410 if (yyerrstatus
== 3)
2412 /* If just tried and failed to reuse lookahead token after an
2413 error, discard it. */
2415 if (yychar
<= YYEOF
)
2417 /* Return failure if at end of input. */
2418 if (yychar
== YYEOF
)
2423 yydestruct ("Error: discarding",
2424 yytoken
, &yylval
, &yylloc
);
2429 /* Else will try to reuse lookahead token after shifting the error
2434 /*---------------------------------------------------.
2435 | yyerrorlab -- error raised explicitly by YYERROR. |
2436 `---------------------------------------------------*/
2439 /* Pacify compilers like GCC when the user code never invokes
2440 YYERROR and the label yyerrorlab therefore never appears in user
2442 if (/*CONSTCOND*/ 0)
2445 yyerror_range
[0] = yylsp
[1-yylen
];
2446 /* Do not reclaim the symbols of the rule which action triggered
2450 YY_STACK_PRINT (yyss
, yyssp
);
2455 /*-------------------------------------------------------------.
2456 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2457 `-------------------------------------------------------------*/
2459 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2463 yyn
= yypact
[yystate
];
2464 if (yyn
!= YYPACT_NINF
)
2467 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2475 /* Pop the current state because it cannot handle the error token. */
2479 yyerror_range
[0] = *yylsp
;
2480 yydestruct ("Error: popping",
2481 yystos
[yystate
], yyvsp
, yylsp
);
2484 YY_STACK_PRINT (yyss
, yyssp
);
2492 yyerror_range
[1] = yylloc
;
2493 /* Using YYLLOC is tempting, but would change the location of
2494 the lookahead. YYLOC is available though. */
2495 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
2498 /* Shift the error token. */
2499 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2505 /*-------------------------------------.
2506 | yyacceptlab -- YYACCEPT comes here. |
2507 `-------------------------------------*/
2512 /*-----------------------------------.
2513 | yyabortlab -- YYABORT comes here. |
2514 `-----------------------------------*/
2520 /*-------------------------------------------------.
2521 | yyexhaustedlab -- memory exhaustion comes here. |
2522 `-------------------------------------------------*/
2524 yyerror (YY_("memory exhausted"));
2530 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2531 yydestruct ("Cleanup: discarding lookahead",
2532 yytoken
, &yylval
, &yylloc
);
2533 /* Do not reclaim the symbols of the rule which action triggered
2534 this YYABORT or YYACCEPT. */
2536 YY_STACK_PRINT (yyss
, yyssp
);
2537 while (yyssp
!= yyss
)
2539 yydestruct ("Cleanup: popping",
2540 yystos
[*yyssp
], yyvsp
, yylsp
);
2545 YYSTACK_FREE (yyss
);
2548 if (yymsg
!= yymsgbuf
)
2549 YYSTACK_FREE (yymsg
);
2551 /* Make sure YYID is used. */
2552 return YYID (yyresult
);
2556 /* Line 1485 of yacc.c. */
2557 #line 539 "../../src/parse-gram.y"
2561 /* Return the location of the left-hand side of a rule whose
2562 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2563 the right-hand side, and return an empty location equal to the end
2564 boundary of RHS[0] if the right-hand side is empty. */
2567 lloc_default (YYLTYPE
const *rhs
, int n
)
2572 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2573 The bug is fixed in 7.4.2m, but play it safe for now. */
2574 loc
.start
= rhs
[n
].end
;
2575 loc
.end
= rhs
[n
].end
;
2577 /* Ignore empty nonterminals the start of the the right-hand side.
2578 Do not bother to ignore them at the end of the right-hand side,
2579 since empty nonterminals have the same end as their predecessors. */
2580 for (i
= 1; i
<= n
; i
++)
2581 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2583 loc
.start
= rhs
[i
].start
;
2591 /* Add a lex-param or a parse-param (depending on TYPE) with
2592 declaration DECL and location LOC. */
2595 add_param (char const *type
, char *decl
, location loc
)
2597 static char const alphanum
[26 + 26 + 1 + 10] =
2598 "abcdefghijklmnopqrstuvwxyz"
2599 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2602 char const *name_start
= NULL
;
2605 /* Stop on last actual character. */
2606 for (p
= decl
; p
[1]; p
++)
2608 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
2609 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
2612 /* Strip the surrounding '{' and '}', and any blanks just inside
2614 while (*--p
== ' ' || *p
== '\t')
2617 while (*++decl
== ' ' || *decl
== '\t')
2621 complain_at (loc
, _("missing identifier in parameter declaration"));
2628 memchr (alphanum
, name_start
[name_len
], sizeof alphanum
);
2632 name
= xmalloc (name_len
+ 1);
2633 memcpy (name
, name_start
, name_len
);
2634 name
[name_len
] = '\0';
2635 muscle_pair_list_grow (type
, decl
, name
);
2639 gram_scanner_last_string_free ();
2643 version_check (location
const *loc
, char const *version
)
2645 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
2647 complain_at (*loc
, "require bison %s, but have %s",
2648 version
, PACKAGE_VERSION
);
2654 gram_error (location
const *loc
, char const *msg
)
2656 complain_at (*loc
, "%s", msg
);
2660 token_name (int type
)
2662 return yytname
[YYTRANSLATE (type
)];
2673 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
2674 return quotearg_style (escape_quoting_style
, buf
);