2 /* A Bison parser, made by GNU Bison 2.3a+. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.3a+"
52 #define YYSKELETON_NAME "yacc.c"
57 /* Using locations. */
58 #define YYLSP_NEEDED 1
60 /* Substitute the variable and function names. */
61 #define yyparse gram_parse
62 #define yylex gram_lex
63 #define yyerror gram_error
64 #define yylval gram_lval
65 #define yychar gram_char
66 #define yydebug gram_debug
67 #define yynerrs gram_nerrs
68 #define yylloc gram_lloc
70 /* Copy the first part of user declarations. */
72 /* Line 1538 of yacc.c */
73 #line 1 "parse-gram.y"
74 /* Bison Grammar Parser -*- C -*-
76 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
79 This file is part of Bison, the GNU Compiler Compiler.
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.
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.
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/>. */
97 #include <strverscmp.h>
100 #include "conflicts.h"
104 #include "muscle_tab.h"
105 #include "quotearg.h"
108 #include "scan-gram.h"
109 #include "scan-code.h"
111 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
112 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
114 #define YY_LOCATION_PRINT(File, Loc) \
115 location_print (File, Loc)
117 static void version_check (location
const *loc
, char const *version
);
119 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
120 FIXME: depends on the undocumented availability of YYLLOC. */
122 #define yyerror(Msg) \
123 gram_error (&yylloc, Msg)
124 static void gram_error (location
const *, char const *);
126 static char const *char_name (char);
128 /** Add a lex-param or a parse-param.
130 * \param type \a lex_param or \a parse_param
131 * \param decl the formal argument
132 * \param loc the location in the source.
134 static void add_param (char const *type
, char *decl
, location loc
);
137 static symbol_class current_class
= unknown_sym
;
138 static uniqstr current_type
= NULL
;
139 static symbol
*current_lhs
;
140 static location current_lhs_location
;
141 static int current_prec
= 0;
143 #define YYTYPE_INT16 int_fast16_t
144 #define YYTYPE_INT8 int_fast8_t
145 #define YYTYPE_UINT16 uint_fast16_t
146 #define YYTYPE_UINT8 uint_fast8_t
149 /* Line 1538 of yacc.c */
150 #line 151 "parse-gram.c"
152 /* Enabling traces. */
157 /* Enabling verbose error messages. */
158 #ifdef YYERROR_VERBOSE
159 # undef YYERROR_VERBOSE
160 # define YYERROR_VERBOSE 1
162 # define YYERROR_VERBOSE 1
165 /* Enabling the token table. */
166 #ifndef YYTOKEN_TABLE
167 # define YYTOKEN_TABLE 0
174 /* Put the tokens into the symbol table, so that GDB and other debuggers
183 PERCENT_DESTRUCTOR
= 263,
184 PERCENT_PRINTER
= 264,
187 PERCENT_NONASSOC
= 267,
193 PERCENT_DEFAULT_PREC
= 273,
194 PERCENT_DEFINE
= 274,
195 PERCENT_DEFINES
= 275,
196 PERCENT_ERROR_VERBOSE
= 276,
197 PERCENT_EXPECT
= 277,
198 PERCENT_EXPECT_RR
= 278,
199 PERCENT_FILE_PREFIX
= 279,
200 PERCENT_GLR_PARSER
= 280,
201 PERCENT_INITIAL_ACTION
= 281,
202 PERCENT_LANGUAGE
= 282,
203 PERCENT_LEX_PARAM
= 283,
204 PERCENT_LOCATIONS
= 284,
205 PERCENT_NAME_PREFIX
= 285,
206 PERCENT_NO_DEFAULT_PREC
= 286,
207 PERCENT_NO_LINES
= 287,
208 PERCENT_NONDETERMINISTIC_PARSER
= 288,
209 PERCENT_OUTPUT
= 289,
210 PERCENT_PARSE_PARAM
= 290,
211 PERCENT_PURE_PARSER
= 291,
212 PERCENT_REQUIRE
= 292,
213 PERCENT_SKELETON
= 293,
215 PERCENT_TOKEN_TABLE
= 295,
216 PERCENT_VERBOSE
= 296,
224 PERCENT_PERCENT
= 304,
238 #define PERCENT_TOKEN 260
239 #define PERCENT_NTERM 261
240 #define PERCENT_TYPE 262
241 #define PERCENT_DESTRUCTOR 263
242 #define PERCENT_PRINTER 264
243 #define PERCENT_LEFT 265
244 #define PERCENT_RIGHT 266
245 #define PERCENT_NONASSOC 267
246 #define PERCENT_PREC 268
247 #define PERCENT_DPREC 269
248 #define PERCENT_MERGE 270
249 #define PERCENT_CODE 271
250 #define PERCENT_DEBUG 272
251 #define PERCENT_DEFAULT_PREC 273
252 #define PERCENT_DEFINE 274
253 #define PERCENT_DEFINES 275
254 #define PERCENT_ERROR_VERBOSE 276
255 #define PERCENT_EXPECT 277
256 #define PERCENT_EXPECT_RR 278
257 #define PERCENT_FILE_PREFIX 279
258 #define PERCENT_GLR_PARSER 280
259 #define PERCENT_INITIAL_ACTION 281
260 #define PERCENT_LANGUAGE 282
261 #define PERCENT_LEX_PARAM 283
262 #define PERCENT_LOCATIONS 284
263 #define PERCENT_NAME_PREFIX 285
264 #define PERCENT_NO_DEFAULT_PREC 286
265 #define PERCENT_NO_LINES 287
266 #define PERCENT_NONDETERMINISTIC_PARSER 288
267 #define PERCENT_OUTPUT 289
268 #define PERCENT_PARSE_PARAM 290
269 #define PERCENT_PURE_PARSER 291
270 #define PERCENT_REQUIRE 292
271 #define PERCENT_SKELETON 293
272 #define PERCENT_START 294
273 #define PERCENT_TOKEN_TABLE 295
274 #define PERCENT_VERBOSE 296
275 #define PERCENT_YACC 297
276 #define BRACED_CODE 298
282 #define PERCENT_PERCENT 304
285 #define SEMICOLON 307
287 #define TYPE_TAG_ANY 309
288 #define TYPE_TAG_NONE 310
289 #define PERCENT_UNION 311
294 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
295 typedef union YYSTYPE
298 /* Line 1538 of yacc.c */
299 #line 94 "parse-gram.y"
308 unsigned char character
;
312 /* Line 1538 of yacc.c */
313 #line 314 "parse-gram.c"
315 # define YYSTYPE_IS_TRIVIAL 1
316 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
317 # define YYSTYPE_IS_DECLARED 1
320 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
321 typedef struct YYLTYPE
328 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
329 # define YYLTYPE_IS_DECLARED 1
330 # define YYLTYPE_IS_TRIVIAL 1
334 /* Copy the second part of user declarations. */
337 /* Line 1538 of yacc.c */
338 #line 339 "parse-gram.c"
345 typedef YYTYPE_UINT8 yytype_uint8
;
347 typedef unsigned char yytype_uint8
;
351 typedef YYTYPE_INT8 yytype_int8
;
352 #elif (defined __STDC__ || defined __C99__FUNC__ \
353 || defined __cplusplus || defined _MSC_VER)
354 typedef signed char yytype_int8
;
356 typedef short int yytype_int8
;
360 typedef YYTYPE_UINT16 yytype_uint16
;
362 typedef unsigned short int yytype_uint16
;
366 typedef YYTYPE_INT16 yytype_int16
;
368 typedef short int yytype_int16
;
372 # ifdef __SIZE_TYPE__
373 # define YYSIZE_T __SIZE_TYPE__
374 # elif defined size_t
375 # define YYSIZE_T size_t
376 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
377 || defined __cplusplus || defined _MSC_VER)
378 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
379 # define YYSIZE_T size_t
381 # define YYSIZE_T unsigned int
385 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
390 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
391 # define YY_(msgid) dgettext ("bison-runtime", msgid)
395 # define YY_(msgid) msgid
399 /* Suppress unused-variable warnings by "using" E. */
400 #if ! defined lint || defined __GNUC__
401 # define YYUSE(e) ((void) (e))
403 # define YYUSE(e) /* empty */
406 /* Identity function, used to suppress warnings about constant conditions. */
410 #if (defined __STDC__ || defined __C99__FUNC__ \
411 || defined __cplusplus || defined _MSC_VER)
424 #if ! defined yyoverflow || YYERROR_VERBOSE
426 /* The parser invokes alloca or malloc; define the necessary symbols. */
428 # ifdef YYSTACK_USE_ALLOCA
429 # if YYSTACK_USE_ALLOCA
431 # define YYSTACK_ALLOC __builtin_alloca
432 # elif defined __BUILTIN_VA_ARG_INCR
433 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
435 # define YYSTACK_ALLOC __alloca
436 # elif defined _MSC_VER
437 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
438 # define alloca _alloca
440 # define YYSTACK_ALLOC alloca
441 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
442 || defined __cplusplus || defined _MSC_VER)
443 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
452 # ifdef YYSTACK_ALLOC
453 /* Pacify GCC's `empty if-body' warning. */
454 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
455 # ifndef YYSTACK_ALLOC_MAXIMUM
456 /* The OS might guarantee only one guard page at the bottom of the stack,
457 and a page size can be as small as 4096 bytes. So we cannot safely
458 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
459 to allow for a few compiler-allocated temporary stack slots. */
460 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
463 # define YYSTACK_ALLOC YYMALLOC
464 # define YYSTACK_FREE YYFREE
465 # ifndef YYSTACK_ALLOC_MAXIMUM
466 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
468 # if (defined __cplusplus && ! defined _STDLIB_H \
469 && ! ((defined YYMALLOC || defined malloc) \
470 && (defined YYFREE || defined free)))
471 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
477 # define YYMALLOC malloc
478 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
479 || defined __cplusplus || defined _MSC_VER)
480 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
485 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
486 || defined __cplusplus || defined _MSC_VER)
487 void free (void *); /* INFRINGES ON USER NAME SPACE */
491 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
494 #if (! defined yyoverflow \
495 && (! defined __cplusplus \
496 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
497 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
499 /* A type that is properly aligned for any stack member. */
507 /* The size of the maximum gap between one aligned stack and the next. */
508 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
510 /* The size of an array large to enough to hold all stacks, each with
512 # define YYSTACK_BYTES(N) \
513 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
514 + 2 * YYSTACK_GAP_MAXIMUM)
516 /* Copy COUNT objects from FROM to TO. The source and destination do
519 # if defined __GNUC__ && 1 < __GNUC__
520 # define YYCOPY(To, From, Count) \
521 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
523 # define YYCOPY(To, From, Count) \
527 for (yyi = 0; yyi < (Count); yyi++) \
528 (To)[yyi] = (From)[yyi]; \
534 /* Relocate STACK from its old location to the new one. The
535 local variables YYSIZE and YYSTACKSIZE give the old and new number of
536 elements in the stack, and YYPTR gives the new location of the
537 stack. Advance YYPTR to a properly aligned location for the next
539 # define YYSTACK_RELOCATE(Stack) \
542 YYSIZE_T yynewbytes; \
543 YYCOPY (&yyptr->Stack, Stack, yysize); \
544 Stack = &yyptr->Stack; \
545 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
546 yyptr += yynewbytes / sizeof (*yyptr); \
552 /* YYFINAL -- State number of the termination state. */
554 /* YYLAST -- Last index in YYTABLE. */
557 /* YYNTOKENS -- Number of terminals. */
559 /* YYNNTS -- Number of nonterminals. */
561 /* YYNRULES -- Number of rules. */
563 /* YYNRULES -- Number of states. */
564 #define YYNSTATES 139
566 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
568 #define YYMAXUTOK 311
570 #define YYTRANSLATE(YYX) \
571 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
573 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
574 static const yytype_uint8 yytranslate
[] =
576 0, 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, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
602 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
603 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
604 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
605 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
606 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
611 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
613 static const yytype_uint16 yyprhs
[] =
615 0, 0, 3, 8, 9, 12, 14, 16, 18, 22,
616 24, 27, 29, 32, 35, 38, 42, 44, 47, 50,
617 53, 55, 58, 62, 64, 66, 69, 73, 76, 78,
618 81, 84, 86, 88, 90, 92, 94, 96, 99, 103,
619 107, 109, 111, 114, 118, 119, 121, 125, 126, 130,
620 131, 135, 139, 143, 145, 147, 149, 150, 152, 154,
621 157, 159, 162, 164, 166, 168, 170, 172, 174, 177,
622 180, 184, 186, 189, 191, 194, 196, 199, 202, 203,
623 207, 209, 213, 216, 217, 220, 223, 227, 231, 235,
624 237, 239, 240, 242, 244, 246, 248, 250, 252, 254,
628 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
629 static const yytype_int8 yyrhs
[] =
631 58, 0, -1, 59, 49, 74, 87, -1, -1, 59,
632 60, -1, 61, -1, 51, -1, 17, -1, 19, 80,
633 81, -1, 20, -1, 20, 3, -1, 21, -1, 22,
634 4, -1, 23, 4, -1, 24, 3, -1, 24, 46,
635 3, -1, 25, -1, 26, 43, -1, 27, 3, -1,
636 28, 43, -1, 29, -1, 30, 3, -1, 30, 46,
637 3, -1, 32, -1, 33, -1, 34, 3, -1, 34,
638 46, 3, -1, 35, 43, -1, 36, -1, 37, 3,
639 -1, 38, 3, -1, 40, -1, 41, -1, 42, -1,
640 52, -1, 66, -1, 63, -1, 39, 85, -1, 8,
641 43, 70, -1, 9, 43, 70, -1, 18, -1, 31,
642 -1, 16, 82, -1, 16, 47, 82, -1, -1, 47,
643 -1, 56, 62, 82, -1, -1, 6, 64, 73, -1,
644 -1, 5, 65, 73, -1, 7, 53, 69, -1, 67,
645 68, 69, -1, 10, -1, 11, -1, 12, -1, -1,
646 53, -1, 85, -1, 69, 85, -1, 71, -1, 70,
647 71, -1, 85, -1, 53, -1, 54, -1, 55, -1,
648 53, -1, 83, -1, 83, 4, -1, 83, 86, -1,
649 83, 4, 86, -1, 72, -1, 73, 72, -1, 75,
650 -1, 74, 75, -1, 76, -1, 61, 52, -1, 1,
651 52, -1, -1, 84, 77, 78, -1, 79, -1, 78,
652 50, 79, -1, 78, 52, -1, -1, 79, 85, -1,
653 79, 43, -1, 79, 13, 85, -1, 79, 14, 4,
654 -1, 79, 15, 53, -1, 47, -1, 3, -1, -1,
655 3, -1, 43, -1, 47, -1, 44, -1, 48, -1,
656 83, -1, 86, -1, 3, -1, -1, 49, 45, -1
659 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
660 static const yytype_uint16 yyrline
[] =
662 0, 204, 204, 212, 214, 218, 219, 229, 230, 234,
663 235, 240, 241, 242, 243, 244, 245, 250, 259, 260,
664 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
665 271, 295, 296, 297, 298, 302, 303, 304, 308, 315,
666 322, 326, 330, 337, 352, 353, 357, 369, 369, 374,
667 374, 379, 390, 405, 406, 407, 411, 412, 417, 419,
668 424, 425, 429, 430, 431, 432, 437, 442, 447, 453,
669 459, 470, 471, 480, 481, 487, 488, 489, 496, 496,
670 500, 501, 502, 507, 508, 510, 512, 514, 516, 526,
671 527, 533, 536, 545, 565, 567, 576, 581, 582, 587,
676 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
677 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
678 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
679 static const char *const yytname
[] =
681 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
682 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
683 "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"",
684 "\"%dprec\"", "\"%merge\"", "\"%code\"", "\"%debug\"",
685 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
686 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
687 "\"%initial-action\"", "\"%language\"", "\"%lex-param\"",
688 "\"%locations\"", "\"%name-prefix\"", "\"%no-default-prec\"",
689 "\"%no-lines\"", "\"%nondeterministic-parser\"", "\"%output\"",
690 "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"",
691 "\"%start\"", "\"%token-table\"", "\"%verbose\"", "\"%yacc\"",
692 "\"{...}\"", "\"char\"", "\"epilogue\"", "\"=\"", "\"identifier\"",
693 "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"", "\";\"", "\"type\"",
694 "\"<*>\"", "\"<>\"", "\"%union\"", "$accept", "input",
695 "prologue_declarations", "prologue_declaration", "grammar_declaration",
696 "union_name", "symbol_declaration", "$@1", "$@2",
697 "precedence_declaration", "precedence_declarator", "type.opt",
698 "symbols.1", "generic_symlist", "generic_symlist_item", "symbol_def",
699 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
700 "$@3", "rhses.1", "rhs", "variable", "content.opt", "braceless", "id",
701 "id_colon", "symbol", "string_as_id", "epilogue.opt", 0
706 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
708 static const yytype_uint16 yytoknum
[] =
710 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
711 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
712 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
713 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
714 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
715 305, 306, 307, 308, 309, 310, 311
719 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
720 static const yytype_uint8 yyr1
[] =
722 0, 57, 58, 59, 59, 60, 60, 60, 60, 60,
723 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
724 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
725 60, 60, 60, 60, 60, 61, 61, 61, 61, 61,
726 61, 61, 61, 61, 62, 62, 61, 64, 63, 65,
727 63, 63, 66, 67, 67, 67, 68, 68, 69, 69,
728 70, 70, 71, 71, 71, 71, 72, 72, 72, 72,
729 72, 73, 73, 74, 74, 75, 75, 75, 77, 76,
730 78, 78, 78, 79, 79, 79, 79, 79, 79, 80,
731 80, 81, 81, 82, 83, 83, 84, 85, 85, 86,
735 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
736 static const yytype_uint8 yyr2
[] =
738 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
739 2, 1, 2, 2, 2, 3, 1, 2, 2, 2,
740 1, 2, 3, 1, 1, 2, 3, 2, 1, 2,
741 2, 1, 1, 1, 1, 1, 1, 2, 3, 3,
742 1, 1, 2, 3, 0, 1, 3, 0, 3, 0,
743 3, 3, 3, 1, 1, 1, 0, 1, 1, 2,
744 1, 2, 1, 1, 1, 1, 1, 1, 2, 2,
745 3, 1, 2, 1, 2, 1, 2, 2, 0, 3,
746 1, 3, 2, 0, 2, 2, 3, 3, 3, 1,
747 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
751 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
752 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
753 means the default is an error. */
754 static const yytype_uint8 yydefact
[] =
756 3, 0, 0, 1, 49, 47, 0, 0, 0, 53,
757 54, 55, 0, 7, 40, 0, 9, 11, 0, 0,
758 0, 16, 0, 0, 0, 20, 0, 41, 23, 24,
759 0, 0, 28, 0, 0, 0, 31, 32, 33, 0,
760 6, 34, 44, 4, 5, 36, 35, 56, 0, 0,
761 0, 0, 0, 93, 0, 42, 90, 89, 91, 10,
762 12, 13, 14, 0, 17, 18, 19, 21, 0, 25,
763 0, 27, 29, 30, 99, 95, 94, 97, 37, 98,
764 0, 96, 0, 0, 73, 75, 78, 45, 0, 57,
765 0, 66, 71, 50, 67, 48, 51, 58, 63, 64,
766 65, 38, 60, 62, 39, 43, 92, 8, 15, 22,
767 26, 77, 76, 0, 74, 2, 83, 46, 52, 72,
768 68, 69, 59, 61, 101, 79, 80, 70, 83, 82,
769 0, 0, 0, 85, 84, 81, 86, 87, 88
772 /* YYDEFGOTO[NTERM-NUM]. */
773 static const yytype_int8 yydefgoto
[] =
775 -1, 1, 2, 43, 82, 88, 45, 49, 48, 46,
776 47, 90, 96, 101, 102, 92, 93, 83, 84, 85,
777 116, 125, 126, 58, 107, 55, 77, 86, 103, 79,
781 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
783 #define YYPACT_NINF -60
784 static const yytype_int16 yypact
[] =
786 -60, 18, 96, -60, -60, -60, -16, 17, 24, -60,
787 -60, -60, -8, -60, -60, 11, 70, -60, 71, 80,
788 2, -60, 46, 87, 49, -60, 31, -60, -60, -60,
789 40, 50, -60, 91, 93, 0, -60, -60, -60, 15,
790 -60, -60, 51, -60, -60, -60, -60, 44, 12, 12,
791 0, 25, 25, -60, 56, -60, -60, -60, 106, -60,
792 -60, -60, -60, 107, -60, -60, -60, -60, 108, -60,
793 136, -60, -60, -60, -60, -60, -60, -60, -60, -60,
794 88, -60, 89, 1, -60, -60, -60, -60, 56, -60,
795 0, -60, -60, 12, 84, 12, 0, -60, -60, -60,
796 -60, 25, -60, -60, 25, -60, -60, -60, -60, -60,
797 -60, -60, -60, 97, -60, -60, -60, -60, 0, -60,
798 140, -60, -60, -60, -60, 14, 38, -60, -60, -60,
799 0, 142, 98, -60, -60, 38, -60, -60, -60
802 /* YYPGOTO[NTERM-NUM]. */
803 static const yytype_int16 yypgoto
[] =
805 -60, -60, -60, -60, 147, -60, -60, -60, -60, -60,
806 -60, -60, 54, 101, -59, -25, 105, -60, 67, -60,
807 -60, -60, 27, -60, -60, -50, -19, -60, -35, -58,
811 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
812 positive, shift that token. If negative, reduce the rule which
813 number is the opposite. If zero, do what YYDEFACT says.
814 If YYTABLE_NINF, syntax error. */
815 #define YYTABLE_NINF -101
816 static const yytype_int16 yytable
[] =
818 78, -100, 80, 74, 105, 62, 4, 5, 6, 7,
819 8, 9, 10, 11, 56, 97, 80, 12, 3, 14,
820 4, 5, 6, 7, 8, 9, 10, 11, 74, 94,
821 94, 12, 27, 14, 67, 53, 121, 50, 117, 54,
822 35, 74, 123, 69, 75, 123, 27, 76, 63, 81,
823 113, 130, 131, 132, 35, 97, 75, 42, 57, 76,
824 51, 122, 127, 81, 128, 91, 129, 52, 119, 75,
825 119, 42, 76, 59, 94, 60, 94, 68, 98, 99,
826 100, 133, 75, 122, 61, 76, 70, 74, 120, 64,
827 65, 134, 66, 71, 72, 136, 73, 89, 87, 53,
828 134, 4, 5, 6, 7, 8, 9, 10, 11, 106,
829 108, 109, 12, 13, 14, 15, 16, 17, 18, 19,
830 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
831 30, 31, 32, 33, 34, 35, 36, 37, 38, 110,
832 111, 112, 124, 74, 118, 39, 137, 40, 41, 44,
833 114, 138, 42, 104, 95, 135
836 static const yytype_uint8 yycheck
[] =
838 35, 0, 1, 3, 54, 3, 5, 6, 7, 8,
839 9, 10, 11, 12, 3, 50, 1, 16, 0, 18,
840 5, 6, 7, 8, 9, 10, 11, 12, 3, 48,
841 49, 16, 31, 18, 3, 43, 94, 53, 88, 47,
842 39, 3, 101, 3, 44, 104, 31, 47, 46, 48,
843 49, 13, 14, 15, 39, 90, 44, 56, 47, 47,
844 43, 96, 120, 48, 50, 53, 52, 43, 93, 44,
845 95, 56, 47, 3, 93, 4, 95, 46, 53, 54,
846 55, 43, 44, 118, 4, 47, 46, 3, 4, 43,
847 3, 126, 43, 43, 3, 130, 3, 53, 47, 43,
848 135, 5, 6, 7, 8, 9, 10, 11, 12, 3,
849 3, 3, 16, 17, 18, 19, 20, 21, 22, 23,
850 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
851 34, 35, 36, 37, 38, 39, 40, 41, 42, 3,
852 52, 52, 45, 3, 90, 49, 4, 51, 52, 2,
853 83, 53, 56, 52, 49, 128
856 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
857 symbol of state STATE-NUM. */
858 static const yytype_uint8 yystos
[] =
860 0, 58, 59, 0, 5, 6, 7, 8, 9, 10,
861 11, 12, 16, 17, 18, 19, 20, 21, 22, 23,
862 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
863 34, 35, 36, 37, 38, 39, 40, 41, 42, 49,
864 51, 52, 56, 60, 61, 63, 66, 67, 65, 64,
865 53, 43, 43, 43, 47, 82, 3, 47, 80, 3,
866 4, 4, 3, 46, 43, 3, 43, 3, 46, 3,
867 46, 43, 3, 3, 3, 44, 47, 83, 85, 86,
868 1, 48, 61, 74, 75, 76, 84, 47, 62, 53,
869 68, 53, 72, 73, 83, 73, 69, 85, 53, 54,
870 55, 70, 71, 85, 70, 82, 3, 81, 3, 3,
871 3, 52, 52, 49, 75, 87, 77, 82, 69, 72,
872 4, 86, 85, 71, 45, 78, 79, 86, 50, 52,
873 13, 14, 15, 43, 85, 79, 85, 4, 53
876 #define yyerrok (yyerrstatus = 0)
877 #define yyclearin (yychar = YYEMPTY)
881 #define YYACCEPT goto yyacceptlab
882 #define YYABORT goto yyabortlab
883 #define YYERROR goto yyerrorlab
886 /* Like YYERROR except do call yyerror. This remains here temporarily
887 to ease the transition to the new meaning of YYERROR, for GCC.
888 Once GCC version 2 has supplanted version 1, this can go. */
890 #define YYFAIL goto yyerrlab
892 #define YYRECOVERING() (!!yyerrstatus)
894 #define YYBACKUP(Token, Value) \
896 if (yychar == YYEMPTY && yylen == 1) \
900 yytoken = YYTRANSLATE (yychar); \
906 yyerror (YY_("syntax error: cannot back up")); \
913 #define YYERRCODE 256
916 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
917 If N is 0, then set CURRENT to the empty location which ends
918 the previous symbol: RHS[0] (always defined). */
920 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
921 #ifndef YYLLOC_DEFAULT
922 # define YYLLOC_DEFAULT(Current, Rhs, N) \
926 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
927 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
928 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
929 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
933 (Current).first_line = (Current).last_line = \
934 YYRHSLOC (Rhs, 0).last_line; \
935 (Current).first_column = (Current).last_column = \
936 YYRHSLOC (Rhs, 0).last_column; \
942 /* YY_LOCATION_PRINT -- Print the location on the stream.
943 This macro was not mandated originally: define only if we know
944 we won't break user code: when these are the locations we know. */
946 #ifndef YY_LOCATION_PRINT
947 # if YYLTYPE_IS_TRIVIAL
948 # define YY_LOCATION_PRINT(File, Loc) \
949 fprintf (File, "%d.%d-%d.%d", \
950 (Loc).first_line, (Loc).first_column, \
951 (Loc).last_line, (Loc).last_column)
953 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
958 /* YYLEX -- calling `yylex' with the right arguments. */
961 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
963 # define YYLEX yylex (&yylval, &yylloc)
966 /* Enable debugging if requested. */
970 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
971 # define YYFPRINTF fprintf
974 # define YYDPRINTF(Args) \
980 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
984 YYFPRINTF (stderr, "%s ", Title); \
985 yy_symbol_print (stderr, \
986 Type, Value, Location); \
987 YYFPRINTF (stderr, "\n"); \
992 /*--------------------------------.
993 | Print this symbol on YYOUTPUT. |
994 `--------------------------------*/
997 #if (defined __STDC__ || defined __C99__FUNC__ \
998 || defined __cplusplus || defined _MSC_VER)
1000 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1003 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1006 YYSTYPE
const * const yyvaluep
;
1007 YYLTYPE
const * const yylocationp
;
1012 YYUSE (yylocationp
);
1014 if (yytype
< YYNTOKENS
)
1015 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1021 case 3: /* "\"string\"" */
1023 /* Line 1538 of yacc.c */
1024 #line 182 "parse-gram.y"
1025 { fputs (quotearg_style (c_quoting_style
, (yyvaluep
->chars
)), stderr
); };
1027 /* Line 1538 of yacc.c */
1028 #line 1029 "parse-gram.c"
1030 case 4: /* "\"integer\"" */
1032 /* Line 1538 of yacc.c */
1033 #line 193 "parse-gram.y"
1034 { fprintf (stderr
, "%d", (yyvaluep
->integer
)); };
1036 /* Line 1538 of yacc.c */
1037 #line 1038 "parse-gram.c"
1039 case 43: /* "\"{...}\"" */
1041 /* Line 1538 of yacc.c */
1042 #line 184 "parse-gram.y"
1043 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->code
)); };
1045 /* Line 1538 of yacc.c */
1046 #line 1047 "parse-gram.c"
1048 case 44: /* "\"char\"" */
1050 /* Line 1538 of yacc.c */
1051 #line 176 "parse-gram.y"
1052 { fputs (char_name ((yyvaluep
->character
)), stderr
); };
1054 /* Line 1538 of yacc.c */
1055 #line 1056 "parse-gram.c"
1057 case 45: /* "\"epilogue\"" */
1059 /* Line 1538 of yacc.c */
1060 #line 184 "parse-gram.y"
1061 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1063 /* Line 1538 of yacc.c */
1064 #line 1065 "parse-gram.c"
1066 case 47: /* "\"identifier\"" */
1068 /* Line 1538 of yacc.c */
1069 #line 189 "parse-gram.y"
1070 { fputs ((yyvaluep
->uniqstr
), stderr
); };
1072 /* Line 1538 of yacc.c */
1073 #line 1074 "parse-gram.c"
1075 case 48: /* "\"identifier:\"" */
1077 /* Line 1538 of yacc.c */
1078 #line 190 "parse-gram.y"
1079 { fprintf (stderr
, "%s:", (yyvaluep
->uniqstr
)); };
1081 /* Line 1538 of yacc.c */
1082 #line 1083 "parse-gram.c"
1084 case 51: /* "\"%{...%}\"" */
1086 /* Line 1538 of yacc.c */
1087 #line 184 "parse-gram.y"
1088 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1090 /* Line 1538 of yacc.c */
1091 #line 1092 "parse-gram.c"
1093 case 53: /* "\"type\"" */
1095 /* Line 1538 of yacc.c */
1096 #line 188 "parse-gram.y"
1097 { fprintf (stderr
, "<%s>", (yyvaluep
->uniqstr
)); };
1099 /* Line 1538 of yacc.c */
1100 #line 1101 "parse-gram.c"
1102 case 80: /* "variable" */
1104 /* Line 1538 of yacc.c */
1105 #line 189 "parse-gram.y"
1106 { fputs ((yyvaluep
->uniqstr
), stderr
); };
1108 /* Line 1538 of yacc.c */
1109 #line 1110 "parse-gram.c"
1111 case 81: /* "content.opt" */
1113 /* Line 1538 of yacc.c */
1114 #line 184 "parse-gram.y"
1115 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1117 /* Line 1538 of yacc.c */
1118 #line 1119 "parse-gram.c"
1120 case 82: /* "braceless" */
1122 /* Line 1538 of yacc.c */
1123 #line 184 "parse-gram.y"
1124 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1126 /* Line 1538 of yacc.c */
1127 #line 1128 "parse-gram.c"
1131 /* Line 1538 of yacc.c */
1132 #line 196 "parse-gram.y"
1133 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1135 /* Line 1538 of yacc.c */
1136 #line 1137 "parse-gram.c"
1138 case 84: /* "id_colon" */
1140 /* Line 1538 of yacc.c */
1141 #line 197 "parse-gram.y"
1142 { fprintf (stderr
, "%s:", (yyvaluep
->symbol
)->tag
); };
1144 /* Line 1538 of yacc.c */
1145 #line 1146 "parse-gram.c"
1147 case 85: /* "symbol" */
1149 /* Line 1538 of yacc.c */
1150 #line 196 "parse-gram.y"
1151 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1153 /* Line 1538 of yacc.c */
1154 #line 1155 "parse-gram.c"
1156 case 86: /* "string_as_id" */
1158 /* Line 1538 of yacc.c */
1159 #line 196 "parse-gram.y"
1160 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1162 /* Line 1538 of yacc.c */
1163 #line 1164 "parse-gram.c"
1171 /*--------------------------------.
1172 | Print this symbol on YYOUTPUT. |
1173 `--------------------------------*/
1175 #if (defined __STDC__ || defined __C99__FUNC__ \
1176 || defined __cplusplus || defined _MSC_VER)
1178 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1181 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1184 YYSTYPE
const * const yyvaluep
;
1185 YYLTYPE
const * const yylocationp
;
1188 if (yytype
< YYNTOKENS
)
1189 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1191 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1193 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1194 YYFPRINTF (yyoutput
, ": ");
1195 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1196 YYFPRINTF (yyoutput
, ")");
1199 /*------------------------------------------------------------------.
1200 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1202 `------------------------------------------------------------------*/
1204 #if (defined __STDC__ || defined __C99__FUNC__ \
1205 || defined __cplusplus || defined _MSC_VER)
1207 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1210 yy_stack_print (yybottom
, yytop
)
1211 yytype_int16
*yybottom
;
1212 yytype_int16
*yytop
;
1215 YYFPRINTF (stderr
, "Stack now");
1216 for (; yybottom
<= yytop
; yybottom
++)
1218 int yybot
= *yybottom
;
1219 YYFPRINTF (stderr
, " %d", yybot
);
1221 YYFPRINTF (stderr
, "\n");
1224 # define YY_STACK_PRINT(Bottom, Top) \
1227 yy_stack_print ((Bottom), (Top)); \
1231 /*------------------------------------------------.
1232 | Report that the YYRULE is going to be reduced. |
1233 `------------------------------------------------*/
1235 #if (defined __STDC__ || defined __C99__FUNC__ \
1236 || defined __cplusplus || defined _MSC_VER)
1238 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1241 yy_reduce_print (yyvsp
, yylsp
, yyrule
)
1247 int yynrhs
= yyr2
[yyrule
];
1249 unsigned long int yylno
= yyrline
[yyrule
];
1250 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1252 /* The symbols being reduced. */
1253 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1255 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1256 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1257 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1258 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1259 YYFPRINTF (stderr
, "\n");
1263 # define YY_REDUCE_PRINT(Rule) \
1266 yy_reduce_print (yyvsp, yylsp, Rule); \
1269 /* Nonzero means print parse trace. It is left uninitialized so that
1270 multiple parsers can coexist. */
1272 #else /* !YYDEBUG */
1273 # define YYDPRINTF(Args)
1274 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1275 # define YY_STACK_PRINT(Bottom, Top)
1276 # define YY_REDUCE_PRINT(Rule)
1277 #endif /* !YYDEBUG */
1280 /* YYINITDEPTH -- initial size of the parser's stacks. */
1282 # define YYINITDEPTH 200
1285 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1286 if the built-in stack extension method is used).
1288 Do not make this value too large; the results are undefined if
1289 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1290 evaluated with infinite-precision integer arithmetic. */
1293 # define YYMAXDEPTH 10000
1301 # if defined __GLIBC__ && defined _STRING_H
1302 # define yystrlen strlen
1304 /* Return the length of YYSTR. */
1305 #if (defined __STDC__ || defined __C99__FUNC__ \
1306 || defined __cplusplus || defined _MSC_VER)
1308 yystrlen (const char *yystr
)
1316 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1324 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1325 # define yystpcpy stpcpy
1327 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1329 #if (defined __STDC__ || defined __C99__FUNC__ \
1330 || defined __cplusplus || defined _MSC_VER)
1332 yystpcpy (char *yydest
, const char *yysrc
)
1335 yystpcpy (yydest
, yysrc
)
1341 const char *yys
= yysrc
;
1343 while ((*yyd
++ = *yys
++) != '\0')
1352 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1353 quotes and backslashes, so that it's suitable for yyerror. The
1354 heuristic is that double-quoting is unnecessary unless the string
1355 contains an apostrophe, a comma, or backslash (other than
1356 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1357 null, do not copy; instead, return the length of what the result
1360 yytnamerr (char *yyres
, const char *yystr
)
1365 char const *yyp
= yystr
;
1372 goto do_not_strip_quotes
;
1376 goto do_not_strip_quotes
;
1389 do_not_strip_quotes
: ;
1393 return yystrlen (yystr
);
1395 return yystpcpy (yyres
, yystr
) - yyres
;
1399 /* Copy into YYRESULT an error message about the unexpected token
1400 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1401 including the terminating null byte. If YYRESULT is null, do not
1402 copy anything; just return the number of bytes that would be
1403 copied. As a special case, return 0 if an ordinary "syntax error"
1404 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1405 size calculation. */
1407 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1409 int yyn
= yypact
[yystate
];
1411 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1415 int yytype
= YYTRANSLATE (yychar
);
1416 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1417 YYSIZE_T yysize
= yysize0
;
1419 int yysize_overflow
= 0;
1420 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1421 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1425 /* This is so xgettext sees the translatable formats that are
1426 constructed on the fly. */
1427 YY_("syntax error, unexpected %s");
1428 YY_("syntax error, unexpected %s, expecting %s");
1429 YY_("syntax error, unexpected %s, expecting %s or %s");
1430 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1431 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1435 static char const yyunexpected
[] = "syntax error, unexpected %s";
1436 static char const yyexpecting
[] = ", expecting %s";
1437 static char const yyor
[] = " or %s";
1438 char yyformat
[sizeof yyunexpected
1439 + sizeof yyexpecting
- 1
1440 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1441 * (sizeof yyor
- 1))];
1442 char const *yyprefix
= yyexpecting
;
1444 /* Start YYX at -YYN if negative to avoid negative indexes in
1446 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1448 /* Stay within bounds of both yycheck and yytname. */
1449 int yychecklim
= YYLAST
- yyn
+ 1;
1450 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1453 yyarg
[0] = yytname
[yytype
];
1454 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1456 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1457 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1459 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1463 yyformat
[sizeof yyunexpected
- 1] = '\0';
1466 yyarg
[yycount
++] = yytname
[yyx
];
1467 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1468 yysize_overflow
|= (yysize1
< yysize
);
1470 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1474 yyf
= YY_(yyformat
);
1475 yysize1
= yysize
+ yystrlen (yyf
);
1476 yysize_overflow
|= (yysize1
< yysize
);
1479 if (yysize_overflow
)
1480 return YYSIZE_MAXIMUM
;
1484 /* Avoid sprintf, as that infringes on the user's name space.
1485 Don't have undefined behavior even if the translation
1486 produced a string with the wrong number of "%s"s. */
1487 char *yyp
= yyresult
;
1489 while ((*yyp
= *yyf
) != '\0')
1491 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1493 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1506 #endif /* YYERROR_VERBOSE */
1509 /*-----------------------------------------------.
1510 | Release the memory associated to this symbol. |
1511 `-----------------------------------------------*/
1514 #if (defined __STDC__ || defined __C99__FUNC__ \
1515 || defined __cplusplus || defined _MSC_VER)
1517 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1520 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
1524 YYLTYPE
*yylocationp
;
1528 YYUSE (yylocationp
);
1532 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1543 /* Prevent warnings from -Wmissing-prototypes. */
1545 #ifdef YYPARSE_PARAM
1546 #if defined __STDC__ || defined __cplusplus
1547 int yyparse (void *YYPARSE_PARAM
);
1551 #else /* ! YYPARSE_PARAM */
1552 #if defined __STDC__ || defined __cplusplus
1557 #endif /* ! YYPARSE_PARAM */
1568 #ifdef YYPARSE_PARAM
1569 #if (defined __STDC__ || defined __C99__FUNC__ \
1570 || defined __cplusplus || defined _MSC_VER)
1572 yyparse (void *YYPARSE_PARAM
)
1575 yyparse (YYPARSE_PARAM
)
1576 void *YYPARSE_PARAM
;
1578 #else /* ! YYPARSE_PARAM */
1579 #if (defined __STDC__ || defined __C99__FUNC__ \
1580 || defined __cplusplus || defined _MSC_VER)
1590 /* The lookahead symbol. */
1593 /* The semantic value of the lookahead symbol. */
1596 /* Number of syntax errors so far. */
1598 /* Location data for the lookahead symbol. */
1604 /* Number of tokens to shift before error messages enabled. */
1606 /* Lookahead token as an internal (translated) token number. */
1609 /* Buffer for error messages, and its allocated size. */
1611 char *yymsg
= yymsgbuf
;
1612 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1615 /* Three stacks and their tools:
1616 `yyss': related to states,
1617 `yyvs': related to semantic values,
1618 `yyls': related to locations.
1620 Refer to the stacks thru separate pointers, to allow yyoverflow
1621 to reallocate them elsewhere. */
1623 /* The state stack. */
1624 yytype_int16 yyssa
[YYINITDEPTH
];
1625 yytype_int16
*yyss
= yyssa
;
1626 yytype_int16
*yyssp
;
1628 /* The semantic value stack. */
1629 YYSTYPE yyvsa
[YYINITDEPTH
];
1630 YYSTYPE
*yyvs
= yyvsa
;
1633 /* The location stack. */
1634 YYLTYPE yylsa
[YYINITDEPTH
];
1635 YYLTYPE
*yyls
= yylsa
;
1637 /* The locations where the error started and ended. */
1638 YYLTYPE yyerror_range
[2];
1640 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1642 YYSIZE_T yystacksize
= YYINITDEPTH
;
1644 /* The variables used to return semantic value and location from the
1649 /* The number of symbols on the RHS of the reduced rule.
1650 Keep to zero when no symbol should be popped. */
1653 YYDPRINTF ((stderr
, "Starting parse\n"));
1658 yychar
= YYEMPTY
; /* Cause a token to be read. */
1660 /* Initialize stack pointers.
1661 Waste one element of value and location stack
1662 so that they stay on the same level as the state stack.
1663 The wasted elements are never initialized. */
1668 #if YYLTYPE_IS_TRIVIAL
1669 /* Initialize the default location before parsing starts. */
1670 yylloc
.first_line
= yylloc
.last_line
= 1;
1671 yylloc
.first_column
= yylloc
.last_column
= 1;
1675 /* User initialization code. */
1677 /* Line 1538 of yacc.c */
1678 #line 86 "parse-gram.y"
1680 /* Bison's grammar can initial empty locations, hence a default
1681 location is needed. */
1682 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1683 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1686 /* Line 1538 of yacc.c */
1687 #line 1688 "parse-gram.c"
1691 /*------------------------------------------------------------.
1692 | yynewstate -- Push a new state, which is found in yystate. |
1693 `------------------------------------------------------------*/
1695 /* In all cases, when you get here, the value and location stacks
1696 have just been pushed. So pushing a state here evens the stacks. */
1702 if (yyss
+ yystacksize
- 1 <= yyssp
)
1704 /* Get the current used size of the three stacks, in elements. */
1705 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1709 /* Give user a chance to reallocate the stack. Use copies of
1710 these so that the &'s don't force the real ones into
1712 YYSTYPE
*yyvs1
= yyvs
;
1713 yytype_int16
*yyss1
= yyss
;
1714 YYLTYPE
*yyls1
= yyls
;
1716 /* Each stack pointer address is followed by the size of the
1717 data in use in that stack, in bytes. This used to be a
1718 conditional around just the two extra args, but that might
1719 be undefined if yyoverflow is a macro. */
1720 yyoverflow (YY_("memory exhausted"),
1721 &yyss1
, yysize
* sizeof (*yyssp
),
1722 &yyvs1
, yysize
* sizeof (*yyvsp
),
1723 &yyls1
, yysize
* sizeof (*yylsp
),
1729 #else /* no yyoverflow */
1730 # ifndef YYSTACK_RELOCATE
1731 goto yyexhaustedlab
;
1733 /* Extend the stack our own way. */
1734 if (YYMAXDEPTH
<= yystacksize
)
1735 goto yyexhaustedlab
;
1737 if (YYMAXDEPTH
< yystacksize
)
1738 yystacksize
= YYMAXDEPTH
;
1741 yytype_int16
*yyss1
= yyss
;
1742 union yyalloc
*yyptr
=
1743 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1745 goto yyexhaustedlab
;
1746 YYSTACK_RELOCATE (yyss
);
1747 YYSTACK_RELOCATE (yyvs
);
1748 YYSTACK_RELOCATE (yyls
);
1749 # undef YYSTACK_RELOCATE
1751 YYSTACK_FREE (yyss1
);
1754 #endif /* no yyoverflow */
1756 yyssp
= yyss
+ yysize
- 1;
1757 yyvsp
= yyvs
+ yysize
- 1;
1758 yylsp
= yyls
+ yysize
- 1;
1760 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1761 (unsigned long int) yystacksize
));
1763 if (yyss
+ yystacksize
- 1 <= yyssp
)
1767 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1769 if (yystate
== YYFINAL
)
1779 /* Do appropriate processing given the current state. Read a
1780 lookahead token if we need one and don't already have one. */
1782 /* First try to decide what to do without reference to lookahead token. */
1783 yyn
= yypact
[yystate
];
1784 if (yyn
== YYPACT_NINF
)
1787 /* Not known => get a lookahead token if don't already have one. */
1789 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1790 if (yychar
== YYEMPTY
)
1792 YYDPRINTF ((stderr
, "Reading a token: "));
1796 if (yychar
<= YYEOF
)
1798 yychar
= yytoken
= YYEOF
;
1799 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1803 yytoken
= YYTRANSLATE (yychar
);
1804 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1807 /* If the proper action on seeing token YYTOKEN is to reduce or to
1808 detect an error, take that action. */
1810 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1815 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1821 /* Count tokens shifted since error; after three, turn off error
1826 /* Shift the lookahead token. */
1827 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1829 /* Discard the shifted token. */
1838 /*-----------------------------------------------------------.
1839 | yydefault -- do the default action for the current state. |
1840 `-----------------------------------------------------------*/
1842 yyn
= yydefact
[yystate
];
1848 /*-----------------------------.
1849 | yyreduce -- Do a reduction. |
1850 `-----------------------------*/
1852 /* yyn is the number of a rule to reduce with. */
1855 /* If YYLEN is nonzero, implement the default value of the action:
1858 Otherwise, the following line sets YYVAL to garbage.
1859 This behavior is undocumented and Bison
1860 users should not rely upon it. Assigning to YYVAL
1861 unconditionally makes the parser a bit smaller, and it avoids a
1862 GCC warning that YYVAL may be used uninitialized. */
1863 yyval
= yyvsp
[1-yylen
];
1865 /* Default location. */
1866 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1867 YY_REDUCE_PRINT (yyn
);
1872 /* Line 1538 of yacc.c */
1873 #line 220 "parse-gram.y"
1875 code_props plain_code
;
1876 code_props_plain_init (&plain_code
, (yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)]));
1877 code_props_translate_code (&plain_code
);
1878 gram_scanner_last_string_free ();
1879 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
1880 plain_code
.code
, (yylsp
[(1) - (1)]));
1881 code_scanner_last_string_free ();
1887 /* Line 1538 of yacc.c */
1888 #line 229 "parse-gram.y"
1889 { debug_flag
= true; }
1894 /* Line 1538 of yacc.c */
1895 #line 231 "parse-gram.y"
1897 muscle_percent_define_insert ((yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]), (yyvsp
[(3) - (3)].chars
));
1903 /* Line 1538 of yacc.c */
1904 #line 234 "parse-gram.y"
1905 { defines_flag
= true; }
1910 /* Line 1538 of yacc.c */
1911 #line 236 "parse-gram.y"
1913 defines_flag
= true;
1914 spec_defines_file
= xstrdup ((yyvsp
[(2) - (2)].chars
));
1920 /* Line 1538 of yacc.c */
1921 #line 240 "parse-gram.y"
1922 { error_verbose
= true; }
1927 /* Line 1538 of yacc.c */
1928 #line 241 "parse-gram.y"
1929 { expected_sr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1934 /* Line 1538 of yacc.c */
1935 #line 242 "parse-gram.y"
1936 { expected_rr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1941 /* Line 1538 of yacc.c */
1942 #line 243 "parse-gram.y"
1943 { spec_file_prefix
= (yyvsp
[(2) - (2)].chars
); }
1948 /* Line 1538 of yacc.c */
1949 #line 244 "parse-gram.y"
1950 { spec_file_prefix
= (yyvsp
[(3) - (3)].chars
); }
1955 /* Line 1538 of yacc.c */
1956 #line 246 "parse-gram.y"
1958 nondeterministic_parser
= true;
1965 /* Line 1538 of yacc.c */
1966 #line 251 "parse-gram.y"
1969 code_props_symbol_action_init (&action
, (yyvsp
[(2) - (2)].code
), (yylsp
[(2) - (2)]));
1970 code_props_translate_code (&action
);
1971 gram_scanner_last_string_free ();
1972 muscle_code_grow ("initial_action", action
.code
, (yylsp
[(2) - (2)]));
1973 code_scanner_last_string_free ();
1979 /* Line 1538 of yacc.c */
1980 #line 259 "parse-gram.y"
1981 { language_argmatch ((yyvsp
[(2) - (2)].chars
), 1, &(yylsp
[(1) - (2)])); }
1986 /* Line 1538 of yacc.c */
1987 #line 260 "parse-gram.y"
1988 { add_param ("lex_param", (yyvsp
[(2) - (2)].code
), (yylsp
[(2) - (2)])); }
1993 /* Line 1538 of yacc.c */
1994 #line 261 "parse-gram.y"
1995 { locations_flag
= true; }
2000 /* Line 1538 of yacc.c */
2001 #line 262 "parse-gram.y"
2002 { spec_name_prefix
= (yyvsp
[(2) - (2)].chars
); }
2007 /* Line 1538 of yacc.c */
2008 #line 263 "parse-gram.y"
2009 { spec_name_prefix
= (yyvsp
[(3) - (3)].chars
); }
2014 /* Line 1538 of yacc.c */
2015 #line 264 "parse-gram.y"
2016 { no_lines_flag
= true; }
2021 /* Line 1538 of yacc.c */
2022 #line 265 "parse-gram.y"
2023 { nondeterministic_parser
= true; }
2028 /* Line 1538 of yacc.c */
2029 #line 266 "parse-gram.y"
2030 { spec_outfile
= (yyvsp
[(2) - (2)].chars
); }
2035 /* Line 1538 of yacc.c */
2036 #line 267 "parse-gram.y"
2037 { spec_outfile
= (yyvsp
[(3) - (3)].chars
); }
2042 /* Line 1538 of yacc.c */
2043 #line 268 "parse-gram.y"
2044 { add_param ("parse_param", (yyvsp
[(2) - (2)].code
), (yylsp
[(2) - (2)])); }
2049 /* Line 1538 of yacc.c */
2050 #line 269 "parse-gram.y"
2051 { pure_parser
= true; }
2056 /* Line 1538 of yacc.c */
2057 #line 270 "parse-gram.y"
2058 { version_check (&(yylsp
[(2) - (2)]), (yyvsp
[(2) - (2)].chars
)); }
2063 /* Line 1538 of yacc.c */
2064 #line 272 "parse-gram.y"
2066 char const *skeleton_user
= (yyvsp
[(2) - (2)].chars
);
2067 if (strchr (skeleton_user
, '/'))
2069 size_t dir_length
= strlen (current_file
);
2070 char *skeleton_build
;
2071 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2073 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2076 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2079 strncpy (skeleton_build
, current_file
, dir_length
);
2080 skeleton_build
[dir_length
++] = '/';
2082 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2083 skeleton_user
= uniqstr_new (skeleton_build
);
2084 free (skeleton_build
);
2086 skeleton_arg (skeleton_user
, 1, &(yylsp
[(1) - (2)]));
2092 /* Line 1538 of yacc.c */
2093 #line 295 "parse-gram.y"
2094 { token_table_flag
= true; }
2099 /* Line 1538 of yacc.c */
2100 #line 296 "parse-gram.y"
2101 { report_flag
= report_states
; }
2106 /* Line 1538 of yacc.c */
2107 #line 297 "parse-gram.y"
2108 { yacc_flag
= true; }
2113 /* Line 1538 of yacc.c */
2114 #line 305 "parse-gram.y"
2116 grammar_start_symbol_set ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)]));
2122 /* Line 1538 of yacc.c */
2123 #line 309 "parse-gram.y"
2126 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2127 symbol_list_destructor_set (list
, (yyvsp
[(2) - (3)].code
), (yylsp
[(2) - (3)]));
2128 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2134 /* Line 1538 of yacc.c */
2135 #line 316 "parse-gram.y"
2138 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2139 symbol_list_printer_set (list
, (yyvsp
[(2) - (3)].code
), (yylsp
[(2) - (3)]));
2140 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2146 /* Line 1538 of yacc.c */
2147 #line 323 "parse-gram.y"
2149 default_prec
= true;
2155 /* Line 1538 of yacc.c */
2156 #line 327 "parse-gram.y"
2158 default_prec
= false;
2164 /* Line 1538 of yacc.c */
2165 #line 331 "parse-gram.y"
2167 /* Do not invoke muscle_percent_code_grow here since it invokes
2168 muscle_user_name_list_grow. */
2169 muscle_code_grow ("percent_code()", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)]));
2170 code_scanner_last_string_free ();
2176 /* Line 1538 of yacc.c */
2177 #line 338 "parse-gram.y"
2179 muscle_percent_code_grow ((yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]), (yyvsp
[(3) - (3)].chars
), (yylsp
[(3) - (3)]));
2180 code_scanner_last_string_free ();
2186 /* Line 1538 of yacc.c */
2187 #line 352 "parse-gram.y"
2193 /* Line 1538 of yacc.c */
2194 #line 353 "parse-gram.y"
2195 { muscle_code_grow ("union_name", (yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2200 /* Line 1538 of yacc.c */
2201 #line 358 "parse-gram.y"
2204 muscle_code_grow ("stype", (yyvsp
[(3) - (3)].chars
), (yylsp
[(3) - (3)]));
2205 code_scanner_last_string_free ();
2211 /* Line 1538 of yacc.c */
2212 #line 369 "parse-gram.y"
2213 { current_class
= nterm_sym
; }
2218 /* Line 1538 of yacc.c */
2219 #line 370 "parse-gram.y"
2221 current_class
= unknown_sym
;
2222 current_type
= NULL
;
2228 /* Line 1538 of yacc.c */
2229 #line 374 "parse-gram.y"
2230 { current_class
= token_sym
; }
2235 /* Line 1538 of yacc.c */
2236 #line 375 "parse-gram.y"
2238 current_class
= unknown_sym
;
2239 current_type
= NULL
;
2245 /* Line 1538 of yacc.c */
2246 #line 380 "parse-gram.y"
2250 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2251 symbol_type_set (list
->content
.sym
, (yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]));
2252 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2258 /* Line 1538 of yacc.c */
2259 #line 391 "parse-gram.y"
2263 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2265 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[(2) - (3)]));
2266 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[(1) - (3)].assoc
), (yylsp
[(1) - (3)]));
2268 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2269 current_type
= NULL
;
2275 /* Line 1538 of yacc.c */
2276 #line 405 "parse-gram.y"
2277 { (yyval
.assoc
) = left_assoc
; }
2282 /* Line 1538 of yacc.c */
2283 #line 406 "parse-gram.y"
2284 { (yyval
.assoc
) = right_assoc
; }
2289 /* Line 1538 of yacc.c */
2290 #line 407 "parse-gram.y"
2291 { (yyval
.assoc
) = non_assoc
; }
2296 /* Line 1538 of yacc.c */
2297 #line 411 "parse-gram.y"
2298 { current_type
= NULL
; }
2303 /* Line 1538 of yacc.c */
2304 #line 412 "parse-gram.y"
2305 { current_type
= (yyvsp
[(1) - (1)].uniqstr
); tag_seen
= true; }
2310 /* Line 1538 of yacc.c */
2311 #line 418 "parse-gram.y"
2312 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[(1) - (1)].symbol
), (yylsp
[(1) - (1)])); }
2317 /* Line 1538 of yacc.c */
2318 #line 420 "parse-gram.y"
2319 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[(1) - (2)].list
), symbol_list_sym_new ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)]))); }
2324 /* Line 1538 of yacc.c */
2325 #line 424 "parse-gram.y"
2326 { (yyval
.list
) = (yyvsp
[(1) - (1)].list
); }
2331 /* Line 1538 of yacc.c */
2332 #line 425 "parse-gram.y"
2333 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[(1) - (2)].list
), (yyvsp
[(2) - (2)].list
)); }
2338 /* Line 1538 of yacc.c */
2339 #line 429 "parse-gram.y"
2340 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[(1) - (1)].symbol
), (yylsp
[(1) - (1)])); }
2345 /* Line 1538 of yacc.c */
2346 #line 430 "parse-gram.y"
2347 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2352 /* Line 1538 of yacc.c */
2353 #line 431 "parse-gram.y"
2354 { (yyval
.list
) = symbol_list_default_tagged_new ((yylsp
[(1) - (1)])); }
2359 /* Line 1538 of yacc.c */
2360 #line 432 "parse-gram.y"
2361 { (yyval
.list
) = symbol_list_default_tagless_new ((yylsp
[(1) - (1)])); }
2366 /* Line 1538 of yacc.c */
2367 #line 438 "parse-gram.y"
2369 current_type
= (yyvsp
[(1) - (1)].uniqstr
);
2376 /* Line 1538 of yacc.c */
2377 #line 443 "parse-gram.y"
2379 symbol_class_set ((yyvsp
[(1) - (1)].symbol
), current_class
, (yylsp
[(1) - (1)]), true);
2380 symbol_type_set ((yyvsp
[(1) - (1)].symbol
), current_type
, (yylsp
[(1) - (1)]));
2386 /* Line 1538 of yacc.c */
2387 #line 448 "parse-gram.y"
2389 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2390 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2391 symbol_user_token_number_set ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].integer
), (yylsp
[(2) - (2)]));
2397 /* Line 1538 of yacc.c */
2398 #line 454 "parse-gram.y"
2400 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2401 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2402 symbol_make_alias ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].symbol
), (yyloc
));
2408 /* Line 1538 of yacc.c */
2409 #line 460 "parse-gram.y"
2411 symbol_class_set ((yyvsp
[(1) - (3)].symbol
), current_class
, (yylsp
[(1) - (3)]), true);
2412 symbol_type_set ((yyvsp
[(1) - (3)].symbol
), current_type
, (yylsp
[(1) - (3)]));
2413 symbol_user_token_number_set ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(2) - (3)].integer
), (yylsp
[(2) - (3)]));
2414 symbol_make_alias ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(3) - (3)].symbol
), (yyloc
));
2420 /* Line 1538 of yacc.c */
2421 #line 490 "parse-gram.y"
2429 /* Line 1538 of yacc.c */
2430 #line 496 "parse-gram.y"
2431 { current_lhs
= (yyvsp
[(1) - (1)].symbol
); current_lhs_location
= (yylsp
[(1) - (1)]); }
2436 /* Line 1538 of yacc.c */
2437 #line 500 "parse-gram.y"
2438 { grammar_current_rule_end ((yylsp
[(1) - (1)])); }
2443 /* Line 1538 of yacc.c */
2444 #line 501 "parse-gram.y"
2445 { grammar_current_rule_end ((yylsp
[(3) - (3)])); }
2450 /* Line 1538 of yacc.c */
2451 #line 507 "parse-gram.y"
2452 { grammar_current_rule_begin (current_lhs
, current_lhs_location
); }
2457 /* Line 1538 of yacc.c */
2458 #line 509 "parse-gram.y"
2459 { grammar_current_rule_symbol_append ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2464 /* Line 1538 of yacc.c */
2465 #line 511 "parse-gram.y"
2466 { grammar_current_rule_action_append ((yyvsp
[(2) - (2)].code
), (yylsp
[(2) - (2)])); }
2471 /* Line 1538 of yacc.c */
2472 #line 513 "parse-gram.y"
2473 { grammar_current_rule_prec_set ((yyvsp
[(3) - (3)].symbol
), (yylsp
[(3) - (3)])); }
2478 /* Line 1538 of yacc.c */
2479 #line 515 "parse-gram.y"
2480 { grammar_current_rule_dprec_set ((yyvsp
[(3) - (3)].integer
), (yylsp
[(3) - (3)])); }
2485 /* Line 1538 of yacc.c */
2486 #line 517 "parse-gram.y"
2487 { grammar_current_rule_merge_set ((yyvsp
[(3) - (3)].uniqstr
), (yylsp
[(3) - (3)])); }
2492 /* Line 1538 of yacc.c */
2493 #line 527 "parse-gram.y"
2494 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[(1) - (1)].chars
)); }
2499 /* Line 1538 of yacc.c */
2500 #line 533 "parse-gram.y"
2508 /* Line 1538 of yacc.c */
2509 #line 546 "parse-gram.y"
2511 code_props plain_code
;
2512 (yyvsp
[(1) - (1)].code
)[strlen ((yyvsp
[(1) - (1)].code
)) - 1] = '\n';
2513 code_props_plain_init (&plain_code
, (yyvsp
[(1) - (1)].code
)+1, (yylsp
[(1) - (1)]));
2514 code_props_translate_code (&plain_code
);
2515 gram_scanner_last_string_free ();
2516 (yyval
.chars
) = plain_code
.code
;
2522 /* Line 1538 of yacc.c */
2523 #line 566 "parse-gram.y"
2524 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2529 /* Line 1538 of yacc.c */
2530 #line 568 "parse-gram.y"
2532 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[(1) - (1)].character
)), (yylsp
[(1) - (1)]));
2533 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2534 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[(1) - (1)].character
), (yylsp
[(1) - (1)]));
2540 /* Line 1538 of yacc.c */
2541 #line 576 "parse-gram.y"
2542 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2547 /* Line 1538 of yacc.c */
2548 #line 588 "parse-gram.y"
2550 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[(1) - (1)].chars
)), (yylsp
[(1) - (1)]));
2551 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2557 /* Line 1538 of yacc.c */
2558 #line 597 "parse-gram.y"
2560 code_props plain_code
;
2561 code_props_plain_init (&plain_code
, (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)]));
2562 code_props_translate_code (&plain_code
);
2563 gram_scanner_last_string_free ();
2564 muscle_code_grow ("epilogue", plain_code
.code
, (yylsp
[(2) - (2)]));
2565 code_scanner_last_string_free ();
2571 /* Line 1538 of yacc.c */
2572 #line 2573 "parse-gram.c"
2575 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2579 YY_STACK_PRINT (yyss
, yyssp
);
2584 /* Now `shift' the result of the reduction. Determine what state
2585 that goes to, based on the state we popped back to and the rule
2586 number reduced by. */
2590 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2591 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2592 yystate
= yytable
[yystate
];
2594 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2599 /*------------------------------------.
2600 | yyerrlab -- here on detecting error |
2601 `------------------------------------*/
2603 /* If not already recovering from an error, report this error. */
2607 #if ! YYERROR_VERBOSE
2608 yyerror (YY_("syntax error"));
2611 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2612 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2614 YYSIZE_T yyalloc
= 2 * yysize
;
2615 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2616 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2617 if (yymsg
!= yymsgbuf
)
2618 YYSTACK_FREE (yymsg
);
2619 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2621 yymsg_alloc
= yyalloc
;
2625 yymsg_alloc
= sizeof yymsgbuf
;
2629 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2631 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2636 yyerror (YY_("syntax error"));
2638 goto yyexhaustedlab
;
2644 yyerror_range
[0] = yylloc
;
2646 if (yyerrstatus
== 3)
2648 /* If just tried and failed to reuse lookahead token after an
2649 error, discard it. */
2651 if (yychar
<= YYEOF
)
2653 /* Return failure if at end of input. */
2654 if (yychar
== YYEOF
)
2659 yydestruct ("Error: discarding",
2660 yytoken
, &yylval
, &yylloc
);
2665 /* Else will try to reuse lookahead token after shifting the error
2670 /*---------------------------------------------------.
2671 | yyerrorlab -- error raised explicitly by YYERROR. |
2672 `---------------------------------------------------*/
2675 /* Pacify compilers like GCC when the user code never invokes
2676 YYERROR and the label yyerrorlab therefore never appears in user
2678 if (/*CONSTCOND*/ 0)
2681 yyerror_range
[0] = yylsp
[1-yylen
];
2682 /* Do not reclaim the symbols of the rule which action triggered
2686 YY_STACK_PRINT (yyss
, yyssp
);
2691 /*-------------------------------------------------------------.
2692 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2693 `-------------------------------------------------------------*/
2695 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2699 yyn
= yypact
[yystate
];
2700 if (yyn
!= YYPACT_NINF
)
2703 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2711 /* Pop the current state because it cannot handle the error token. */
2715 yyerror_range
[0] = *yylsp
;
2716 yydestruct ("Error: popping",
2717 yystos
[yystate
], yyvsp
, yylsp
);
2720 YY_STACK_PRINT (yyss
, yyssp
);
2725 yyerror_range
[1] = yylloc
;
2726 /* Using YYLLOC is tempting, but would change the location of
2727 the lookahead. YYLOC is available though. */
2728 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
2731 /* Shift the error token. */
2732 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2738 /*-------------------------------------.
2739 | yyacceptlab -- YYACCEPT comes here. |
2740 `-------------------------------------*/
2745 /*-----------------------------------.
2746 | yyabortlab -- YYABORT comes here. |
2747 `-----------------------------------*/
2752 #if !defined(yyoverflow) || YYERROR_VERBOSE
2753 /*-------------------------------------------------.
2754 | yyexhaustedlab -- memory exhaustion comes here. |
2755 `-------------------------------------------------*/
2757 yyerror (YY_("memory exhausted"));
2763 if (yychar
!= YYEMPTY
)
2764 yydestruct ("Cleanup: discarding lookahead",
2765 yytoken
, &yylval
, &yylloc
);
2766 /* Do not reclaim the symbols of the rule which action triggered
2767 this YYABORT or YYACCEPT. */
2769 YY_STACK_PRINT (yyss
, yyssp
);
2770 while (yyssp
!= yyss
)
2772 yydestruct ("Cleanup: popping",
2773 yystos
[*yyssp
], yyvsp
, yylsp
);
2778 YYSTACK_FREE (yyss
);
2781 if (yymsg
!= yymsgbuf
)
2782 YYSTACK_FREE (yymsg
);
2784 /* Make sure YYID is used. */
2785 return YYID (yyresult
);
2790 /* Line 1538 of yacc.c */
2791 #line 607 "parse-gram.y"
2795 /* Return the location of the left-hand side of a rule whose
2796 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2797 the right-hand side, and return an empty location equal to the end
2798 boundary of RHS[0] if the right-hand side is empty. */
2801 lloc_default (YYLTYPE
const *rhs
, int n
)
2806 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2807 The bug is fixed in 7.4.2m, but play it safe for now. */
2808 loc
.start
= rhs
[n
].end
;
2809 loc
.end
= rhs
[n
].end
;
2811 /* Ignore empty nonterminals the start of the the right-hand side.
2812 Do not bother to ignore them at the end of the right-hand side,
2813 since empty nonterminals have the same end as their predecessors. */
2814 for (i
= 1; i
<= n
; i
++)
2815 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2817 loc
.start
= rhs
[i
].start
;
2825 /* Add a lex-param or a parse-param (depending on TYPE) with
2826 declaration DECL and location LOC. */
2829 add_param (char const *type
, char *decl
, location loc
)
2831 static char const alphanum
[26 + 26 + 1 + 10] =
2832 "abcdefghijklmnopqrstuvwxyz"
2833 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2836 char const *name_start
= NULL
;
2839 /* Stop on last actual character. */
2840 for (p
= decl
; p
[1]; p
++)
2842 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
2843 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
2846 /* Strip the surrounding '{' and '}', and any blanks just inside
2848 while (*--p
== ' ' || *p
== '\t')
2851 while (*++decl
== ' ' || *decl
== '\t')
2855 complain_at (loc
, _("missing identifier in parameter declaration"));
2862 memchr (alphanum
, name_start
[name_len
], sizeof alphanum
);
2866 name
= xmalloc (name_len
+ 1);
2867 memcpy (name
, name_start
, name_len
);
2868 name
[name_len
] = '\0';
2869 muscle_pair_list_grow (type
, decl
, name
);
2873 gram_scanner_last_string_free ();
2878 version_check (location
const *loc
, char const *version
)
2880 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
2882 complain_at (*loc
, "require bison %s, but have %s",
2883 version
, PACKAGE_VERSION
);
2889 gram_error (location
const *loc
, char const *msg
)
2891 complain_at (*loc
, "%s", msg
);
2895 token_name (int type
)
2897 return yytname
[YYTRANSLATE (type
)];
2908 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
2909 return quotearg_style (escape_quoting_style
, buf
);