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 1 "parse-gram.y"
73 /* Bison Grammar Parser -*- C -*-
75 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
77 This file is part of Bison, the GNU Compiler Compiler.
79 This program is free software; you can redistribute it and/or modify
80 it under the terms of the GNU General Public License as published by
81 the Free Software Foundation; either version 2 of the License, or
82 (at your option) any later version.
84 This program is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 GNU General Public License for more details.
89 You should have received a copy of the GNU General Public License
90 along with this program; if not, write to the Free Software
91 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
99 #include "conflicts.h"
103 #include "muscle_tab.h"
104 #include "quotearg.h"
107 #include "scan-gram.h"
108 #include "scan-code.h"
109 #include "strverscmp.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 static void add_param (char const *, char *, location
);
130 static symbol_class current_class
= unknown_sym
;
131 static uniqstr current_type
= 0;
132 static symbol
*current_lhs
;
133 static location current_lhs_location
;
134 static int current_prec
= 0;
136 #ifdef UINT_FAST8_MAX
137 # define YYTYPE_UINT8 uint_fast8_t
140 # define YYTYPE_INT8 int_fast8_t
142 #ifdef UINT_FAST16_MAX
143 # define YYTYPE_UINT16 uint_fast16_t
145 #ifdef INT_FAST16_MAX
146 # define YYTYPE_INT16 int_fast16_t
150 /* Enabling traces. */
155 /* Enabling verbose error messages. */
156 #ifdef YYERROR_VERBOSE
157 # undef YYERROR_VERBOSE
158 # define YYERROR_VERBOSE 1
160 # define YYERROR_VERBOSE 1
163 /* Enabling the token table. */
164 #ifndef YYTOKEN_TABLE
165 # define YYTOKEN_TABLE 0
172 /* Put the tokens into the symbol table, so that GDB and other debuggers
181 PERCENT_DESTRUCTOR
= 263,
182 PERCENT_PRINTER
= 264,
185 PERCENT_NONASSOC
= 267,
189 PERCENT_AFTER_DEFINITIONS
= 271,
190 PERCENT_BEFORE_DEFINITIONS
= 272,
192 PERCENT_DEFAULT_PREC
= 274,
193 PERCENT_DEFINE
= 275,
194 PERCENT_DEFINES
= 276,
195 PERCENT_ERROR_VERBOSE
= 277,
196 PERCENT_EXPECT
= 278,
197 PERCENT_EXPECT_RR
= 279,
198 PERCENT_FILE_PREFIX
= 280,
199 PERCENT_GLR_PARSER
= 281,
200 PERCENT_INITIAL_ACTION
= 282,
201 PERCENT_LEX_PARAM
= 283,
202 PERCENT_LOCATIONS
= 284,
203 PERCENT_NAME_PREFIX
= 285,
204 PERCENT_NO_DEFAULT_PREC
= 286,
205 PERCENT_NO_LINES
= 287,
206 PERCENT_NONDETERMINISTIC_PARSER
= 288,
207 PERCENT_OUTPUT
= 289,
208 PERCENT_PARSE_PARAM
= 290,
209 PERCENT_PURE_PARSER
= 291,
210 PERCENT_REQUIRE
= 292,
211 PERCENT_SKELETON
= 293,
213 PERCENT_TOKEN_TABLE
= 295,
214 PERCENT_VERBOSE
= 296,
222 PERCENT_PERCENT
= 304,
234 #define PERCENT_TOKEN 260
235 #define PERCENT_NTERM 261
236 #define PERCENT_TYPE 262
237 #define PERCENT_DESTRUCTOR 263
238 #define PERCENT_PRINTER 264
239 #define PERCENT_LEFT 265
240 #define PERCENT_RIGHT 266
241 #define PERCENT_NONASSOC 267
242 #define PERCENT_PREC 268
243 #define PERCENT_DPREC 269
244 #define PERCENT_MERGE 270
245 #define PERCENT_AFTER_DEFINITIONS 271
246 #define PERCENT_BEFORE_DEFINITIONS 272
247 #define PERCENT_DEBUG 273
248 #define PERCENT_DEFAULT_PREC 274
249 #define PERCENT_DEFINE 275
250 #define PERCENT_DEFINES 276
251 #define PERCENT_ERROR_VERBOSE 277
252 #define PERCENT_EXPECT 278
253 #define PERCENT_EXPECT_RR 279
254 #define PERCENT_FILE_PREFIX 280
255 #define PERCENT_GLR_PARSER 281
256 #define PERCENT_INITIAL_ACTION 282
257 #define PERCENT_LEX_PARAM 283
258 #define PERCENT_LOCATIONS 284
259 #define PERCENT_NAME_PREFIX 285
260 #define PERCENT_NO_DEFAULT_PREC 286
261 #define PERCENT_NO_LINES 287
262 #define PERCENT_NONDETERMINISTIC_PARSER 288
263 #define PERCENT_OUTPUT 289
264 #define PERCENT_PARSE_PARAM 290
265 #define PERCENT_PURE_PARSER 291
266 #define PERCENT_REQUIRE 292
267 #define PERCENT_SKELETON 293
268 #define PERCENT_START 294
269 #define PERCENT_TOKEN_TABLE 295
270 #define PERCENT_VERBOSE 296
271 #define PERCENT_YACC 297
272 #define BRACED_CODE 298
278 #define PERCENT_PERCENT 304
281 #define SEMICOLON 307
283 #define PERCENT_UNION 309
288 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
289 typedef union YYSTYPE
290 #line 97 "parse-gram.y"
298 unsigned char character
;
300 /* Line 197 of yacc.c. */
301 #line 302 "parse-gram.c"
303 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
304 # define YYSTYPE_IS_DECLARED 1
305 # define YYSTYPE_IS_TRIVIAL 1
308 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
309 typedef struct YYLTYPE
316 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
317 # define YYLTYPE_IS_DECLARED 1
318 # define YYLTYPE_IS_TRIVIAL 1
322 /* Copy the second part of user declarations. */
325 /* Line __line__ of yacc.c. */
326 #line 327 "parse-gram.c"
333 typedef YYTYPE_UINT8 yytype_uint8
;
335 typedef unsigned char yytype_uint8
;
339 typedef YYTYPE_INT8 yytype_int8
;
340 #elif (defined __STDC__ || defined __C99__FUNC__ \
341 || defined __cplusplus || defined _MSC_VER)
342 typedef signed char yytype_int8
;
344 typedef short int yytype_int8
;
348 typedef YYTYPE_UINT16 yytype_uint16
;
350 typedef unsigned short int yytype_uint16
;
354 typedef YYTYPE_INT16 yytype_int16
;
356 typedef short int yytype_int16
;
360 # ifdef __SIZE_TYPE__
361 # define YYSIZE_T __SIZE_TYPE__
362 # elif defined size_t
363 # define YYSIZE_T size_t
364 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
365 || defined __cplusplus || defined _MSC_VER)
366 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
367 # define YYSIZE_T size_t
369 # define YYSIZE_T unsigned int
373 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
378 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
379 # define YY_(msgid) dgettext ("bison-runtime", msgid)
383 # define YY_(msgid) msgid
387 /* Suppress unused-variable warnings by "using" E. */
388 #if ! defined lint || defined __GNUC__
389 # define YYUSE(e) ((void) (e))
391 # define YYUSE(e) /* empty */
394 /* Identity function, used to suppress warnings about constant conditions. */
398 #if (defined __STDC__ || defined __C99__FUNC__ \
399 || defined __cplusplus || defined _MSC_VER)
412 #if ! defined yyoverflow || YYERROR_VERBOSE
414 /* The parser invokes alloca or malloc; define the necessary symbols. */
416 # ifdef YYSTACK_USE_ALLOCA
417 # if YYSTACK_USE_ALLOCA
419 # define YYSTACK_ALLOC __builtin_alloca
420 # elif defined __BUILTIN_VA_ARG_INCR
421 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
423 # define YYSTACK_ALLOC __alloca
424 # elif defined _MSC_VER
425 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
426 # define alloca _alloca
428 # define YYSTACK_ALLOC alloca
429 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
430 || defined __cplusplus || defined _MSC_VER)
431 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
440 # ifdef YYSTACK_ALLOC
441 /* Pacify GCC's `empty if-body' warning. */
442 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
443 # ifndef YYSTACK_ALLOC_MAXIMUM
444 /* The OS might guarantee only one guard page at the bottom of the stack,
445 and a page size can be as small as 4096 bytes. So we cannot safely
446 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
447 to allow for a few compiler-allocated temporary stack slots. */
448 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
451 # define YYSTACK_ALLOC YYMALLOC
452 # define YYSTACK_FREE YYFREE
453 # ifndef YYSTACK_ALLOC_MAXIMUM
454 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
456 # if (defined __cplusplus && ! defined _STDLIB_H \
457 && ! ((defined YYMALLOC || defined malloc) \
458 && (defined YYFREE || defined free)))
459 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
465 # define YYMALLOC malloc
466 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
467 || defined __cplusplus || defined _MSC_VER)
468 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
473 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
474 || defined __cplusplus || defined _MSC_VER)
475 void free (void *); /* INFRINGES ON USER NAME SPACE */
479 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
482 #if (! defined yyoverflow \
483 && (! defined __cplusplus \
484 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
485 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
487 /* A type that is properly aligned for any stack member. */
495 /* The size of the maximum gap between one aligned stack and the next. */
496 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
498 /* The size of an array large to enough to hold all stacks, each with
500 # define YYSTACK_BYTES(N) \
501 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
502 + 2 * YYSTACK_GAP_MAXIMUM)
504 /* Copy COUNT objects from FROM to TO. The source and destination do
507 # if defined __GNUC__ && 1 < __GNUC__
508 # define YYCOPY(To, From, Count) \
509 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
511 # define YYCOPY(To, From, Count) \
515 for (yyi = 0; yyi < (Count); yyi++) \
516 (To)[yyi] = (From)[yyi]; \
522 /* Relocate STACK from its old location to the new one. The
523 local variables YYSIZE and YYSTACKSIZE give the old and new number of
524 elements in the stack, and YYPTR gives the new location of the
525 stack. Advance YYPTR to a properly aligned location for the next
527 # define YYSTACK_RELOCATE(Stack) \
530 YYSIZE_T yynewbytes; \
531 YYCOPY (&yyptr->Stack, Stack, yysize); \
532 Stack = &yyptr->Stack; \
533 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
534 yyptr += yynewbytes / sizeof (*yyptr); \
540 /* YYFINAL -- State number of the termination state. */
542 /* YYLAST -- Last index in YYTABLE. */
545 /* YYNTOKENS -- Number of terminals. */
547 /* YYNNTS -- Number of nonterminals. */
549 /* YYNRULES -- Number of rules. */
551 /* YYNRULES -- Number of states. */
552 #define YYNSTATES 124
554 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
556 #define YYMAXUTOK 309
558 #define YYTRANSLATE(YYX) \
559 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
561 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
562 static const yytype_uint8 yytranslate
[] =
564 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
590 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
591 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
592 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
593 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
594 45, 46, 47, 48, 49, 50, 51, 52, 53, 54
598 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
600 static const yytype_uint8 yyprhs
[] =
602 0, 0, 3, 8, 9, 12, 14, 16, 19, 22,
603 24, 27, 31, 33, 35, 38, 41, 45, 47, 50,
604 53, 55, 59, 61, 63, 67, 70, 72, 75, 78,
605 80, 82, 84, 86, 88, 90, 93, 97, 101, 103,
606 105, 106, 108, 112, 113, 117, 118, 122, 126, 130,
607 132, 134, 136, 137, 139, 141, 144, 146, 148, 151,
608 154, 158, 160, 163, 165, 168, 170, 173, 176, 177,
609 181, 183, 187, 190, 191, 194, 197, 201, 205, 209,
610 211, 213, 215, 217, 219, 221, 223, 224
613 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
614 static const yytype_int8 yyrhs
[] =
616 56, 0, -1, 57, 49, 70, 81, -1, -1, 57,
617 58, -1, 59, -1, 51, -1, 16, 43, -1, 17,
618 43, -1, 18, -1, 20, 80, -1, 20, 80, 80,
619 -1, 21, -1, 22, -1, 23, 4, -1, 24, 4,
620 -1, 25, 46, 80, -1, 26, -1, 27, 43, -1,
621 28, 43, -1, 29, -1, 30, 46, 80, -1, 32,
622 -1, 33, -1, 34, 46, 80, -1, 35, 43, -1,
623 36, -1, 37, 80, -1, 38, 80, -1, 40, -1,
624 41, -1, 42, -1, 52, -1, 64, -1, 61, -1,
625 39, 78, -1, 8, 43, 67, -1, 9, 43, 67,
626 -1, 19, -1, 31, -1, -1, 47, -1, 54, 60,
627 43, -1, -1, 6, 62, 69, -1, -1, 5, 63,
628 69, -1, 7, 53, 67, -1, 65, 66, 67, -1,
629 10, -1, 11, -1, 12, -1, -1, 53, -1, 78,
630 -1, 67, 78, -1, 53, -1, 76, -1, 76, 4,
631 -1, 76, 79, -1, 76, 4, 79, -1, 68, -1,
632 69, 68, -1, 71, -1, 70, 71, -1, 72, -1,
633 59, 52, -1, 1, 52, -1, -1, 77, 73, 74,
634 -1, 75, -1, 74, 50, 75, -1, 74, 52, -1,
635 -1, 75, 78, -1, 75, 43, -1, 75, 13, 78,
636 -1, 75, 14, 4, -1, 75, 15, 53, -1, 47,
637 -1, 44, -1, 48, -1, 76, -1, 79, -1, 3,
638 -1, 3, -1, -1, 49, 45, -1
641 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
642 static const yytype_uint16 yyrline
[] =
644 0, 202, 202, 210, 212, 216, 217, 219, 226, 233,
645 234, 239, 240, 241, 242, 243, 244, 245, 250, 254,
646 255, 256, 257, 258, 259, 260, 261, 262, 263, 264,
647 265, 266, 267, 271, 272, 273, 277, 285, 293, 297,
648 311, 312, 316, 338, 338, 343, 343, 348, 358, 373,
649 374, 375, 379, 380, 385, 386, 391, 395, 400, 406,
650 412, 423, 424, 433, 434, 440, 441, 442, 449, 449,
651 453, 454, 455, 460, 461, 463, 466, 468, 470, 483,
652 485, 494, 499, 500, 505, 514, 519, 521
656 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
657 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
658 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
659 static const char *const yytname
[] =
661 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
662 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
663 "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"",
664 "\"%dprec\"", "\"%merge\"", "\"%after-definitions\"",
665 "\"%before-definitions\"", "\"%debug\"", "\"%default-prec\"",
666 "\"%define\"", "\"%defines\"", "\"%error-verbose\"", "\"%expect\"",
667 "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
668 "\"%initial-action\"", "\"%lex-param\"", "\"%locations\"",
669 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
670 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param\"",
671 "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"",
672 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"char\"",
673 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
674 "\"|\"", "\"%{...%}\"", "\";\"", "\"type\"", "\"%union\"", "$accept",
675 "input", "declarations", "declaration", "grammar_declaration",
676 "union_name", "symbol_declaration", "@1", "@2", "precedence_declaration",
677 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
678 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
679 "@3", "rhses.1", "rhs", "id", "id_colon", "symbol", "string_as_id",
680 "string_content", "epilogue.opt", 0
685 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
687 static const yytype_uint16 yytoknum
[] =
689 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
690 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
691 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
692 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
693 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
694 305, 306, 307, 308, 309
698 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
699 static const yytype_uint8 yyr1
[] =
701 0, 55, 56, 57, 57, 58, 58, 58, 58, 58,
702 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
703 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
704 58, 58, 58, 59, 59, 59, 59, 59, 59, 59,
705 60, 60, 59, 62, 61, 63, 61, 61, 64, 65,
706 65, 65, 66, 66, 67, 67, 68, 68, 68, 68,
707 68, 69, 69, 70, 70, 71, 71, 71, 73, 72,
708 74, 74, 74, 75, 75, 75, 75, 75, 75, 76,
709 76, 77, 78, 78, 79, 80, 81, 81
712 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
713 static const yytype_uint8 yyr2
[] =
715 0, 2, 4, 0, 2, 1, 1, 2, 2, 1,
716 2, 3, 1, 1, 2, 2, 3, 1, 2, 2,
717 1, 3, 1, 1, 3, 2, 1, 2, 2, 1,
718 1, 1, 1, 1, 1, 2, 3, 3, 1, 1,
719 0, 1, 3, 0, 3, 0, 3, 3, 3, 1,
720 1, 1, 0, 1, 1, 2, 1, 1, 2, 2,
721 3, 1, 2, 1, 2, 1, 2, 2, 0, 3,
722 1, 3, 2, 0, 2, 2, 3, 3, 3, 1,
723 1, 1, 1, 1, 1, 1, 0, 2
726 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
727 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
728 means the default is an error. */
729 static const yytype_uint8 yydefact
[] =
731 3, 0, 0, 1, 45, 43, 0, 0, 0, 49,
732 50, 51, 0, 0, 9, 38, 0, 12, 13, 0,
733 0, 0, 17, 0, 0, 20, 0, 39, 22, 23,
734 0, 0, 26, 0, 0, 0, 29, 30, 31, 0,
735 6, 32, 40, 4, 5, 34, 33, 52, 0, 0,
736 0, 0, 0, 7, 8, 85, 10, 14, 15, 0,
737 18, 19, 0, 0, 25, 27, 28, 84, 80, 79,
738 82, 35, 83, 0, 81, 0, 0, 63, 65, 68,
739 41, 0, 53, 0, 56, 61, 46, 57, 44, 47,
740 54, 36, 37, 11, 16, 21, 24, 67, 66, 0,
741 64, 2, 73, 42, 48, 62, 58, 59, 55, 87,
742 69, 70, 60, 73, 72, 0, 0, 0, 75, 74,
746 /* YYDEFGOTO[NTERM-NUM]. */
747 static const yytype_int8 yydefgoto
[] =
749 -1, 1, 2, 43, 75, 81, 45, 49, 48, 46,
750 47, 83, 89, 85, 86, 76, 77, 78, 102, 110,
751 111, 70, 79, 90, 72, 56, 101
754 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
756 #define YYPACT_NINF -74
757 static const yytype_int16 yypact
[] =
759 -74, 34, 131, -74, -74, -74, -38, -5, -2, -74,
760 -74, -74, 5, 8, -74, -74, 40, -74, -74, 48,
761 49, 14, -74, 21, 22, -74, 20, -74, -74, -74,
762 24, 25, -74, 40, 40, 0, -74, -74, -74, 81,
763 -74, -74, 26, -74, -74, -74, -74, 18, -22, -22,
764 0, 0, 0, -74, -74, -74, 40, -74, -74, 40,
765 -74, -74, 40, 40, -74, -74, -74, -74, -74, -74,
766 -74, -74, -74, 27, -74, 29, 1, -74, -74, -74,
767 -74, 31, -74, 0, -74, -74, -22, 23, -22, 0,
768 -74, 0, 0, -74, -74, -74, -74, -74, -74, 30,
769 -74, -74, -74, -74, 0, -74, 64, -74, -74, -74,
770 -31, 15, -74, -74, -74, 0, 68, 41, -74, -74,
774 /* YYPGOTO[NTERM-NUM]. */
775 static const yytype_int8 yypgoto
[] =
777 -74, -74, -74, -74, 75, -74, -74, -74, -74, -74,
778 -74, -74, -47, -51, 35, -74, 2, -74, -74, -74,
779 -30, -25, -74, -35, -73, -17, -74
782 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
783 positive, shift that token. If negative, reduce the rule which
784 number is the opposite. If zero, do what YYDEFACT says.
785 If YYTABLE_NINF, syntax error. */
786 #define YYTABLE_NINF -87
787 static const yytype_int8 yytable
[] =
789 71, -86, 73, 67, 91, 92, 4, 5, 6, 7,
790 8, 9, 10, 11, 107, 50, 65, 66, 67, 113,
791 15, 114, 68, 87, 87, 69, 67, 106, 115, 116,
792 117, 84, 27, 112, 3, 105, 104, 105, 51, 93,
793 35, 52, 94, 55, 68, 95, 96, 69, 53, 74,
794 99, 54, 57, 58, 108, 42, 108, 108, 118, 68,
795 59, 87, 69, 87, 60, 61, 62, 67, 64, 108,
796 63, 82, 122, 80, 103, 109, 119, 44, 100, 97,
797 121, 98, 73, 120, 88, 119, 4, 5, 6, 7,
798 8, 9, 10, 11, 123, 0, 0, 0, 0, 0,
799 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
800 0, 0, 27, 0, 0, 0, 0, 0, 0, 0,
801 35, 0, 0, 0, 0, 0, 0, 0, 0, 74,
802 0, 0, 0, 0, 0, 42, 4, 5, 6, 7,
803 8, 9, 10, 11, 0, 0, 0, 12, 13, 14,
804 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
805 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
806 35, 36, 37, 38, 0, 0, 0, 0, 0, 0,
810 static const yytype_int8 yycheck
[] =
812 35, 0, 1, 3, 51, 52, 5, 6, 7, 8,
813 9, 10, 11, 12, 87, 53, 33, 34, 3, 50,
814 19, 52, 44, 48, 49, 47, 3, 4, 13, 14,
815 15, 53, 31, 106, 0, 86, 83, 88, 43, 56,
816 39, 43, 59, 3, 44, 62, 63, 47, 43, 48,
817 49, 43, 4, 4, 89, 54, 91, 92, 43, 44,
818 46, 86, 47, 88, 43, 43, 46, 3, 43, 104,
819 46, 53, 4, 47, 43, 45, 111, 2, 76, 52,
820 115, 52, 1, 113, 49, 120, 5, 6, 7, 8,
821 9, 10, 11, 12, 53, -1, -1, -1, -1, -1,
822 19, -1, -1, -1, -1, -1, -1, -1, -1, -1,
823 -1, -1, 31, -1, -1, -1, -1, -1, -1, -1,
824 39, -1, -1, -1, -1, -1, -1, -1, -1, 48,
825 -1, -1, -1, -1, -1, 54, 5, 6, 7, 8,
826 9, 10, 11, 12, -1, -1, -1, 16, 17, 18,
827 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
828 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
829 39, 40, 41, 42, -1, -1, -1, -1, -1, -1,
830 49, -1, 51, 52, -1, 54
833 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
834 symbol of state STATE-NUM. */
835 static const yytype_uint8 yystos
[] =
837 0, 56, 57, 0, 5, 6, 7, 8, 9, 10,
838 11, 12, 16, 17, 18, 19, 20, 21, 22, 23,
839 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
840 34, 35, 36, 37, 38, 39, 40, 41, 42, 49,
841 51, 52, 54, 58, 59, 61, 64, 65, 63, 62,
842 53, 43, 43, 43, 43, 3, 80, 4, 4, 46,
843 43, 43, 46, 46, 43, 80, 80, 3, 44, 47,
844 76, 78, 79, 1, 48, 59, 70, 71, 72, 77,
845 47, 60, 53, 66, 53, 68, 69, 76, 69, 67,
846 78, 67, 67, 80, 80, 80, 80, 52, 52, 49,
847 71, 81, 73, 43, 67, 68, 4, 79, 78, 45,
848 74, 75, 79, 50, 52, 13, 14, 15, 43, 78,
852 #define yyerrok (yyerrstatus = 0)
853 #define yyclearin (yychar = YYEMPTY)
857 #define YYACCEPT goto yyacceptlab
858 #define YYABORT goto yyabortlab
859 #define YYERROR goto yyerrorlab
862 /* Like YYERROR except do call yyerror. This remains here temporarily
863 to ease the transition to the new meaning of YYERROR, for GCC.
864 Once GCC version 2 has supplanted version 1, this can go. */
866 #define YYFAIL goto yyerrlab
868 #define YYRECOVERING() (!!yyerrstatus)
870 #define YYBACKUP(Token, Value) \
872 if (yychar == YYEMPTY && yylen == 1) \
876 yytoken = YYTRANSLATE (yychar); \
882 yyerror (YY_("syntax error: cannot back up")); \
889 #define YYERRCODE 256
892 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
893 If N is 0, then set CURRENT to the empty location which ends
894 the previous symbol: RHS[0] (always defined). */
896 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
897 #ifndef YYLLOC_DEFAULT
898 # define YYLLOC_DEFAULT(Current, Rhs, N) \
902 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
903 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
904 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
905 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
909 (Current).first_line = (Current).last_line = \
910 YYRHSLOC (Rhs, 0).last_line; \
911 (Current).first_column = (Current).last_column = \
912 YYRHSLOC (Rhs, 0).last_column; \
918 /* YY_LOCATION_PRINT -- Print the location on the stream.
919 This macro was not mandated originally: define only if we know
920 we won't break user code: when these are the locations we know. */
922 #ifndef YY_LOCATION_PRINT
923 # if YYLTYPE_IS_TRIVIAL
924 # define YY_LOCATION_PRINT(File, Loc) \
925 fprintf (File, "%d.%d-%d.%d", \
926 (Loc).first_line, (Loc).first_column, \
927 (Loc).last_line, (Loc).last_column)
929 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
934 /* YYLEX -- calling `yylex' with the right arguments. */
937 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
939 # define YYLEX yylex (&yylval, &yylloc)
942 /* Enable debugging if requested. */
946 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
947 # define YYFPRINTF fprintf
950 # define YYDPRINTF(Args) \
956 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
960 YYFPRINTF (stderr, "%s ", Title); \
961 yy_symbol_print (stderr, \
962 Type, Value, Location); \
963 YYFPRINTF (stderr, "\n"); \
968 /*--------------------------------.
969 | Print this symbol on YYOUTPUT. |
970 `--------------------------------*/
973 #if (defined __STDC__ || defined __C99__FUNC__ \
974 || defined __cplusplus || defined _MSC_VER)
976 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
979 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
982 YYSTYPE
const * const yyvaluep
;
983 YYLTYPE
const * const yylocationp
;
990 if (yytype
< YYNTOKENS
)
991 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
997 case 3: /* "\"string\"" */
998 #line 181 "parse-gram.y"
999 { fputs (quotearg_style (c_quoting_style
, (yyvaluep
->chars
)), stderr
); };
1000 #line 1001 "parse-gram.c"
1002 case 4: /* "\"integer\"" */
1003 #line 191 "parse-gram.y"
1004 { fprintf (stderr
, "%d", (yyvaluep
->integer
)); };
1005 #line 1006 "parse-gram.c"
1007 case 43: /* "\"{...}\"" */
1008 #line 183 "parse-gram.y"
1009 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1010 #line 1011 "parse-gram.c"
1012 case 44: /* "\"char\"" */
1013 #line 178 "parse-gram.y"
1014 { fputs (char_name ((yyvaluep
->character
)), stderr
); };
1015 #line 1016 "parse-gram.c"
1017 case 45: /* "\"epilogue\"" */
1018 #line 183 "parse-gram.y"
1019 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1020 #line 1021 "parse-gram.c"
1022 case 47: /* "\"identifier\"" */
1023 #line 187 "parse-gram.y"
1024 { fputs ((yyvaluep
->uniqstr
), stderr
); };
1025 #line 1026 "parse-gram.c"
1027 case 48: /* "\"identifier:\"" */
1028 #line 188 "parse-gram.y"
1029 { fprintf (stderr
, "%s:", (yyvaluep
->uniqstr
)); };
1030 #line 1031 "parse-gram.c"
1032 case 51: /* "\"%{...%}\"" */
1033 #line 183 "parse-gram.y"
1034 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1035 #line 1036 "parse-gram.c"
1037 case 53: /* "\"type\"" */
1038 #line 186 "parse-gram.y"
1039 { fprintf (stderr
, "<%s>", (yyvaluep
->uniqstr
)); };
1040 #line 1041 "parse-gram.c"
1043 #line 194 "parse-gram.y"
1044 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1045 #line 1046 "parse-gram.c"
1047 case 77: /* "id_colon" */
1048 #line 195 "parse-gram.y"
1049 { fprintf (stderr
, "%s:", (yyvaluep
->symbol
)->tag
); };
1050 #line 1051 "parse-gram.c"
1052 case 78: /* "symbol" */
1053 #line 194 "parse-gram.y"
1054 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1055 #line 1056 "parse-gram.c"
1057 case 79: /* "string_as_id" */
1058 #line 194 "parse-gram.y"
1059 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1060 #line 1061 "parse-gram.c"
1062 case 80: /* "string_content" */
1063 #line 181 "parse-gram.y"
1064 { fputs (quotearg_style (c_quoting_style
, (yyvaluep
->chars
)), stderr
); };
1065 #line 1066 "parse-gram.c"
1073 /*--------------------------------.
1074 | Print this symbol on YYOUTPUT. |
1075 `--------------------------------*/
1077 #if (defined __STDC__ || defined __C99__FUNC__ \
1078 || defined __cplusplus || defined _MSC_VER)
1080 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1083 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1086 YYSTYPE
const * const yyvaluep
;
1087 YYLTYPE
const * const yylocationp
;
1090 if (yytype
< YYNTOKENS
)
1091 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1093 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1095 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1096 YYFPRINTF (yyoutput
, ": ");
1097 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1098 YYFPRINTF (yyoutput
, ")");
1101 /*------------------------------------------------------------------.
1102 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1104 `------------------------------------------------------------------*/
1106 #if (defined __STDC__ || defined __C99__FUNC__ \
1107 || defined __cplusplus || defined _MSC_VER)
1109 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
1112 yy_stack_print (bottom
, top
)
1113 yytype_int16
*bottom
;
1117 YYFPRINTF (stderr
, "Stack now");
1118 for (; bottom
<= top
; ++bottom
)
1119 YYFPRINTF (stderr
, " %d", *bottom
);
1120 YYFPRINTF (stderr
, "\n");
1123 # define YY_STACK_PRINT(Bottom, Top) \
1126 yy_stack_print ((Bottom), (Top)); \
1130 /*------------------------------------------------.
1131 | Report that the YYRULE is going to be reduced. |
1132 `------------------------------------------------*/
1134 #if (defined __STDC__ || defined __C99__FUNC__ \
1135 || defined __cplusplus || defined _MSC_VER)
1137 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1140 yy_reduce_print (yyvsp
, yylsp
, yyrule
)
1146 int yynrhs
= yyr2
[yyrule
];
1148 unsigned long int yylno
= yyrline
[yyrule
];
1149 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1151 /* The symbols being reduced. */
1152 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1154 fprintf (stderr
, " $%d = ", yyi
+ 1);
1155 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1156 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1157 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1158 fprintf (stderr
, "\n");
1162 # define YY_REDUCE_PRINT(Rule) \
1165 yy_reduce_print (yyvsp, yylsp, Rule); \
1168 /* Nonzero means print parse trace. It is left uninitialized so that
1169 multiple parsers can coexist. */
1171 #else /* !YYDEBUG */
1172 # define YYDPRINTF(Args)
1173 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1174 # define YY_STACK_PRINT(Bottom, Top)
1175 # define YY_REDUCE_PRINT(Rule)
1176 #endif /* !YYDEBUG */
1179 /* YYINITDEPTH -- initial size of the parser's stacks. */
1181 # define YYINITDEPTH 200
1184 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1185 if the built-in stack extension method is used).
1187 Do not make this value too large; the results are undefined if
1188 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1189 evaluated with infinite-precision integer arithmetic. */
1192 # define YYMAXDEPTH 10000
1200 # if defined __GLIBC__ && defined _STRING_H
1201 # define yystrlen strlen
1203 /* Return the length of YYSTR. */
1204 #if (defined __STDC__ || defined __C99__FUNC__ \
1205 || defined __cplusplus || defined _MSC_VER)
1207 yystrlen (const char *yystr
)
1215 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1223 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1224 # define yystpcpy stpcpy
1226 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1228 #if (defined __STDC__ || defined __C99__FUNC__ \
1229 || defined __cplusplus || defined _MSC_VER)
1231 yystpcpy (char *yydest
, const char *yysrc
)
1234 yystpcpy (yydest
, yysrc
)
1240 const char *yys
= yysrc
;
1242 while ((*yyd
++ = *yys
++) != '\0')
1251 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1252 quotes and backslashes, so that it's suitable for yyerror. The
1253 heuristic is that double-quoting is unnecessary unless the string
1254 contains an apostrophe, a comma, or backslash (other than
1255 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1256 null, do not copy; instead, return the length of what the result
1259 yytnamerr (char *yyres
, const char *yystr
)
1264 char const *yyp
= yystr
;
1271 goto do_not_strip_quotes
;
1275 goto do_not_strip_quotes
;
1288 do_not_strip_quotes
: ;
1292 return yystrlen (yystr
);
1294 return yystpcpy (yyres
, yystr
) - yyres
;
1298 /* Copy into YYRESULT an error message about the unexpected token
1299 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1300 including the terminating null byte. If YYRESULT is null, do not
1301 copy anything; just return the number of bytes that would be
1302 copied. As a special case, return 0 if an ordinary "syntax error"
1303 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1304 size calculation. */
1306 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1308 int yyn
= yypact
[yystate
];
1310 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1314 int yytype
= YYTRANSLATE (yychar
);
1315 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1316 YYSIZE_T yysize
= yysize0
;
1318 int yysize_overflow
= 0;
1319 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1320 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1324 /* This is so xgettext sees the translatable formats that are
1325 constructed on the fly. */
1326 YY_("syntax error, unexpected %s");
1327 YY_("syntax error, unexpected %s, expecting %s");
1328 YY_("syntax error, unexpected %s, expecting %s or %s");
1329 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1330 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1334 static char const yyunexpected
[] = "syntax error, unexpected %s";
1335 static char const yyexpecting
[] = ", expecting %s";
1336 static char const yyor
[] = " or %s";
1337 char yyformat
[sizeof yyunexpected
1338 + sizeof yyexpecting
- 1
1339 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1340 * (sizeof yyor
- 1))];
1341 char const *yyprefix
= yyexpecting
;
1343 /* Start YYX at -YYN if negative to avoid negative indexes in
1345 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1347 /* Stay within bounds of both yycheck and yytname. */
1348 int yychecklim
= YYLAST
- yyn
+ 1;
1349 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1352 yyarg
[0] = yytname
[yytype
];
1353 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1355 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1356 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1358 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1362 yyformat
[sizeof yyunexpected
- 1] = '\0';
1365 yyarg
[yycount
++] = yytname
[yyx
];
1366 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1367 yysize_overflow
|= (yysize1
< yysize
);
1369 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1373 yyf
= YY_(yyformat
);
1374 yysize1
= yysize
+ yystrlen (yyf
);
1375 yysize_overflow
|= (yysize1
< yysize
);
1378 if (yysize_overflow
)
1379 return YYSIZE_MAXIMUM
;
1383 /* Avoid sprintf, as that infringes on the user's name space.
1384 Don't have undefined behavior even if the translation
1385 produced a string with the wrong number of "%s"s. */
1386 char *yyp
= yyresult
;
1388 while ((*yyp
= *yyf
) != '\0')
1390 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1392 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1405 #endif /* YYERROR_VERBOSE */
1408 /*-----------------------------------------------.
1409 | Release the memory associated to this symbol. |
1410 `-----------------------------------------------*/
1413 #if (defined __STDC__ || defined __C99__FUNC__ \
1414 || defined __cplusplus || defined _MSC_VER)
1416 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1419 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
1423 YYLTYPE
*yylocationp
;
1427 YYUSE (yylocationp
);
1431 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1442 /* Prevent warnings from -Wmissing-prototypes. */
1444 #ifdef YYPARSE_PARAM
1445 #if defined __STDC__ || defined __cplusplus
1446 int yyparse (void *YYPARSE_PARAM
);
1450 #else /* ! YYPARSE_PARAM */
1451 #if defined __STDC__ || defined __cplusplus
1456 #endif /* ! YYPARSE_PARAM */
1467 #ifdef YYPARSE_PARAM
1468 #if (defined __STDC__ || defined __C99__FUNC__ \
1469 || defined __cplusplus || defined _MSC_VER)
1471 yyparse (void *YYPARSE_PARAM
)
1474 yyparse (YYPARSE_PARAM
)
1475 void *YYPARSE_PARAM
;
1477 #else /* ! YYPARSE_PARAM */
1478 #if (defined __STDC__ || defined __C99__FUNC__ \
1479 || defined __cplusplus || defined _MSC_VER)
1489 /* The lookahead symbol. */
1492 /* The semantic value of the lookahead symbol. */
1495 /* Number of syntax errors so far. */
1497 /* Location data for the lookahead symbol. */
1503 /* Number of tokens to shift before error messages enabled. */
1505 /* Lookahead token as an internal (translated) token number. */
1508 /* Buffer for error messages, and its allocated size. */
1510 char *yymsg
= yymsgbuf
;
1511 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1514 /* Three stacks and their tools:
1515 `yyss': related to states,
1516 `yyvs': related to semantic values,
1517 `yyls': related to locations.
1519 Refer to the stacks thru separate pointers, to allow yyoverflow
1520 to reallocate them elsewhere. */
1522 /* The state stack. */
1523 yytype_int16 yyssa
[YYINITDEPTH
];
1524 yytype_int16
*yyss
= yyssa
;
1525 yytype_int16
*yyssp
;
1527 /* The semantic value stack. */
1528 YYSTYPE yyvsa
[YYINITDEPTH
];
1529 YYSTYPE
*yyvs
= yyvsa
;
1532 /* The location stack. */
1533 YYLTYPE yylsa
[YYINITDEPTH
];
1534 YYLTYPE
*yyls
= yylsa
;
1536 /* The locations where the error started and ended. */
1537 YYLTYPE yyerror_range
[2];
1539 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1541 YYSIZE_T yystacksize
= YYINITDEPTH
;
1543 /* The variables used to return semantic value and location from the
1548 /* The number of symbols on the RHS of the reduced rule.
1549 Keep to zero when no symbol should be popped. */
1552 YYDPRINTF ((stderr
, "Starting parse\n"));
1557 yychar
= YYEMPTY
; /* Cause a token to be read. */
1559 /* Initialize stack pointers.
1560 Waste one element of value and location stack
1561 so that they stay on the same level as the state stack.
1562 The wasted elements are never initialized. */
1567 #if YYLTYPE_IS_TRIVIAL
1568 /* Initialize the default location before parsing starts. */
1569 yylloc
.first_line
= yylloc
.last_line
= 1;
1570 yylloc
.first_column
= yylloc
.last_column
= 0;
1574 /* User initialization code. */
1575 #line 88 "parse-gram.y"
1577 /* Bison's grammar can initial empty locations, hence a default
1578 location is needed. */
1579 boundary_set (&yylloc
.start
, current_file
, 1, 0);
1580 boundary_set (&yylloc
.end
, current_file
, 1, 0);
1582 /* Line 1085 of yacc.c. */
1583 #line 1584 "parse-gram.c"
1587 /*------------------------------------------------------------.
1588 | yynewstate -- Push a new state, which is found in yystate. |
1589 `------------------------------------------------------------*/
1591 /* In all cases, when you get here, the value and location stacks
1592 have just been pushed. So pushing a state here evens the stacks. */
1598 if (yyss
+ yystacksize
- 1 <= yyssp
)
1600 /* Get the current used size of the three stacks, in elements. */
1601 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1605 /* Give user a chance to reallocate the stack. Use copies of
1606 these so that the &'s don't force the real ones into
1608 YYSTYPE
*yyvs1
= yyvs
;
1609 yytype_int16
*yyss1
= yyss
;
1610 YYLTYPE
*yyls1
= yyls
;
1612 /* Each stack pointer address is followed by the size of the
1613 data in use in that stack, in bytes. This used to be a
1614 conditional around just the two extra args, but that might
1615 be undefined if yyoverflow is a macro. */
1616 yyoverflow (YY_("memory exhausted"),
1617 &yyss1
, yysize
* sizeof (*yyssp
),
1618 &yyvs1
, yysize
* sizeof (*yyvsp
),
1619 &yyls1
, yysize
* sizeof (*yylsp
),
1625 #else /* no yyoverflow */
1626 # ifndef YYSTACK_RELOCATE
1627 goto yyexhaustedlab
;
1629 /* Extend the stack our own way. */
1630 if (YYMAXDEPTH
<= yystacksize
)
1631 goto yyexhaustedlab
;
1633 if (YYMAXDEPTH
< yystacksize
)
1634 yystacksize
= YYMAXDEPTH
;
1637 yytype_int16
*yyss1
= yyss
;
1638 union yyalloc
*yyptr
=
1639 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1641 goto yyexhaustedlab
;
1642 YYSTACK_RELOCATE (yyss
);
1643 YYSTACK_RELOCATE (yyvs
);
1644 YYSTACK_RELOCATE (yyls
);
1645 # undef YYSTACK_RELOCATE
1647 YYSTACK_FREE (yyss1
);
1650 #endif /* no yyoverflow */
1652 yyssp
= yyss
+ yysize
- 1;
1653 yyvsp
= yyvs
+ yysize
- 1;
1654 yylsp
= yyls
+ yysize
- 1;
1656 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1657 (unsigned long int) yystacksize
));
1659 if (yyss
+ yystacksize
- 1 <= yyssp
)
1663 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1672 /* Do appropriate processing given the current state. Read a
1673 lookahead token if we need one and don't already have one. */
1675 /* First try to decide what to do without reference to lookahead token. */
1676 yyn
= yypact
[yystate
];
1677 if (yyn
== YYPACT_NINF
)
1680 /* Not known => get a lookahead token if don't already have one. */
1682 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1683 if (yychar
== YYEMPTY
)
1685 YYDPRINTF ((stderr
, "Reading a token: "));
1689 if (yychar
<= YYEOF
)
1691 yychar
= yytoken
= YYEOF
;
1692 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1696 yytoken
= YYTRANSLATE (yychar
);
1697 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1700 /* If the proper action on seeing token YYTOKEN is to reduce or to
1701 detect an error, take that action. */
1703 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1708 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1717 /* Count tokens shifted since error; after three, turn off error
1722 /* Shift the lookahead token. */
1723 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1725 /* Discard the shifted token unless it is eof. */
1726 if (yychar
!= YYEOF
)
1735 /*-----------------------------------------------------------.
1736 | yydefault -- do the default action for the current state. |
1737 `-----------------------------------------------------------*/
1739 yyn
= yydefact
[yystate
];
1745 /*-----------------------------.
1746 | yyreduce -- Do a reduction. |
1747 `-----------------------------*/
1749 /* yyn is the number of a rule to reduce with. */
1752 /* If YYLEN is nonzero, implement the default value of the action:
1755 Otherwise, the following line sets YYVAL to garbage.
1756 This behavior is undocumented and Bison
1757 users should not rely upon it. Assigning to YYVAL
1758 unconditionally makes the parser a bit smaller, and it avoids a
1759 GCC warning that YYVAL may be used uninitialized. */
1760 yyval
= yyvsp
[1-yylen
];
1762 /* Default location. */
1763 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1764 YY_REDUCE_PRINT (yyn
);
1768 #line 217 "parse-gram.y"
1769 { prologue_augment (translate_code ((yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)])),
1770 (yylsp
[(1) - (1)])); }
1774 #line 220 "parse-gram.y"
1776 after_definitions
= true;
1777 /* Remove the '{', and replace the '}' with '\n'. */
1778 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1779 muscle_code_grow ("after_definitions", (yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)]));
1784 #line 227 "parse-gram.y"
1786 before_definitions
= true;
1787 /* Remove the '{', and replace the '}' with '\n'. */
1788 (yyvsp
[(2) - (2)].chars
)[strlen ((yyvsp
[(2) - (2)].chars
)) - 1] = '\n';
1789 muscle_code_grow ("before_definitions", (yyvsp
[(2) - (2)].chars
)+1, (yylsp
[(2) - (2)]));
1794 #line 233 "parse-gram.y"
1795 { debug_flag
= true; }
1799 #line 235 "parse-gram.y"
1801 static char one
[] = "1";
1802 muscle_insert ((yyvsp
[(2) - (2)].chars
), one
);
1807 #line 239 "parse-gram.y"
1808 { muscle_insert ((yyvsp
[(2) - (3)].chars
), (yyvsp
[(3) - (3)].chars
)); }
1812 #line 240 "parse-gram.y"
1813 { defines_flag
= true; }
1817 #line 241 "parse-gram.y"
1818 { error_verbose
= true; }
1822 #line 242 "parse-gram.y"
1823 { expected_sr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1827 #line 243 "parse-gram.y"
1828 { expected_rr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1832 #line 244 "parse-gram.y"
1833 { spec_file_prefix
= (yyvsp
[(3) - (3)].chars
); }
1837 #line 246 "parse-gram.y"
1839 nondeterministic_parser
= true;
1845 #line 251 "parse-gram.y"
1847 muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
1852 #line 254 "parse-gram.y"
1853 { add_param ("lex_param", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])); }
1857 #line 255 "parse-gram.y"
1858 { locations_flag
= true; }
1862 #line 256 "parse-gram.y"
1863 { spec_name_prefix
= (yyvsp
[(3) - (3)].chars
); }
1867 #line 257 "parse-gram.y"
1868 { no_lines_flag
= true; }
1872 #line 258 "parse-gram.y"
1873 { nondeterministic_parser
= true; }
1877 #line 259 "parse-gram.y"
1878 { spec_outfile
= (yyvsp
[(3) - (3)].chars
); }
1882 #line 260 "parse-gram.y"
1883 { add_param ("parse_param", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])); }
1887 #line 261 "parse-gram.y"
1888 { pure_parser
= true; }
1892 #line 262 "parse-gram.y"
1893 { version_check (&(yylsp
[(2) - (2)]), (yyvsp
[(2) - (2)].chars
)); }
1897 #line 263 "parse-gram.y"
1898 { skeleton
= (yyvsp
[(2) - (2)].chars
); }
1902 #line 264 "parse-gram.y"
1903 { token_table_flag
= true; }
1907 #line 265 "parse-gram.y"
1908 { report_flag
= report_states
; }
1912 #line 266 "parse-gram.y"
1913 { yacc_flag
= true; }
1917 #line 274 "parse-gram.y"
1919 grammar_start_symbol_set ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)]));
1924 #line 278 "parse-gram.y"
1927 const char *action
= translate_symbol_action ((yyvsp
[(2) - (3)].chars
), (yylsp
[(2) - (3)]));
1928 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
1929 symbol_destructor_set (list
->sym
, action
, (yylsp
[(2) - (3)]));
1930 symbol_list_free ((yyvsp
[(3) - (3)].list
));
1935 #line 286 "parse-gram.y"
1938 const char *action
= translate_symbol_action ((yyvsp
[(2) - (3)].chars
), (yylsp
[(2) - (3)]));
1939 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
1940 symbol_printer_set (list
->sym
, action
, (yylsp
[(2) - (3)]));
1941 symbol_list_free ((yyvsp
[(3) - (3)].list
));
1946 #line 294 "parse-gram.y"
1948 default_prec
= true;
1953 #line 298 "parse-gram.y"
1955 default_prec
= false;
1960 #line 311 "parse-gram.y"
1965 #line 312 "parse-gram.y"
1966 { muscle_code_grow ("union_name", (yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
1970 #line 317 "parse-gram.y"
1972 char const *body
= (yyvsp
[(3) - (3)].chars
);
1976 /* Concatenate the union bodies, turning the first one's
1977 trailing '}' into '\n', and omitting the second one's '{'. */
1978 char *code
= muscle_find ("stype");
1979 code
[strlen (code
) - 1] = '\n';
1984 muscle_code_grow ("stype", body
, (yylsp
[(3) - (3)]));
1989 #line 338 "parse-gram.y"
1990 { current_class
= nterm_sym
; }
1994 #line 339 "parse-gram.y"
1996 current_class
= unknown_sym
;
1997 current_type
= NULL
;
2002 #line 343 "parse-gram.y"
2003 { current_class
= token_sym
; }
2007 #line 344 "parse-gram.y"
2009 current_class
= unknown_sym
;
2010 current_type
= NULL
;
2015 #line 349 "parse-gram.y"
2018 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2019 symbol_type_set (list
->sym
, (yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]));
2020 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2025 #line 359 "parse-gram.y"
2029 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
2031 symbol_type_set (list
->sym
, current_type
, (yylsp
[(2) - (3)]));
2032 symbol_precedence_set (list
->sym
, current_prec
, (yyvsp
[(1) - (3)].assoc
), (yylsp
[(1) - (3)]));
2034 symbol_list_free ((yyvsp
[(3) - (3)].list
));
2035 current_type
= NULL
;
2040 #line 373 "parse-gram.y"
2041 { (yyval
.assoc
) = left_assoc
; }
2045 #line 374 "parse-gram.y"
2046 { (yyval
.assoc
) = right_assoc
; }
2050 #line 375 "parse-gram.y"
2051 { (yyval
.assoc
) = non_assoc
; }
2055 #line 379 "parse-gram.y"
2056 { current_type
= NULL
; }
2060 #line 380 "parse-gram.y"
2061 { current_type
= (yyvsp
[(1) - (1)].uniqstr
); }
2065 #line 385 "parse-gram.y"
2066 { (yyval
.list
) = symbol_list_new ((yyvsp
[(1) - (1)].symbol
), (yylsp
[(1) - (1)])); }
2070 #line 386 "parse-gram.y"
2071 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[(1) - (2)].list
), (yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2075 #line 392 "parse-gram.y"
2077 current_type
= (yyvsp
[(1) - (1)].uniqstr
);
2082 #line 396 "parse-gram.y"
2084 symbol_class_set ((yyvsp
[(1) - (1)].symbol
), current_class
, (yylsp
[(1) - (1)]), true);
2085 symbol_type_set ((yyvsp
[(1) - (1)].symbol
), current_type
, (yylsp
[(1) - (1)]));
2090 #line 401 "parse-gram.y"
2092 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2093 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2094 symbol_user_token_number_set ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].integer
), (yylsp
[(2) - (2)]));
2099 #line 407 "parse-gram.y"
2101 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2102 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2103 symbol_make_alias ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].symbol
), (yyloc
));
2108 #line 413 "parse-gram.y"
2110 symbol_class_set ((yyvsp
[(1) - (3)].symbol
), current_class
, (yylsp
[(1) - (3)]), true);
2111 symbol_type_set ((yyvsp
[(1) - (3)].symbol
), current_type
, (yylsp
[(1) - (3)]));
2112 symbol_user_token_number_set ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(2) - (3)].integer
), (yylsp
[(2) - (3)]));
2113 symbol_make_alias ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(3) - (3)].symbol
), (yyloc
));
2118 #line 443 "parse-gram.y"
2125 #line 449 "parse-gram.y"
2126 { current_lhs
= (yyvsp
[(1) - (1)].symbol
); current_lhs_location
= (yylsp
[(1) - (1)]); }
2130 #line 453 "parse-gram.y"
2131 { grammar_current_rule_end ((yylsp
[(1) - (1)])); }
2135 #line 454 "parse-gram.y"
2136 { grammar_current_rule_end ((yylsp
[(3) - (3)])); }
2140 #line 460 "parse-gram.y"
2141 { grammar_current_rule_begin (current_lhs
, current_lhs_location
); }
2145 #line 462 "parse-gram.y"
2146 { grammar_current_rule_symbol_append ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2150 #line 464 "parse-gram.y"
2151 { grammar_current_rule_action_append (gram_last_string
,
2152 gram_last_braced_code_loc
); }
2156 #line 467 "parse-gram.y"
2157 { grammar_current_rule_prec_set ((yyvsp
[(3) - (3)].symbol
), (yylsp
[(3) - (3)])); }
2161 #line 469 "parse-gram.y"
2162 { grammar_current_rule_dprec_set ((yyvsp
[(3) - (3)].integer
), (yylsp
[(3) - (3)])); }
2166 #line 471 "parse-gram.y"
2167 { grammar_current_rule_merge_set ((yyvsp
[(3) - (3)].uniqstr
), (yylsp
[(3) - (3)])); }
2171 #line 484 "parse-gram.y"
2172 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2176 #line 486 "parse-gram.y"
2178 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[(1) - (1)].character
)), (yylsp
[(1) - (1)]));
2179 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2180 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[(1) - (1)].character
), (yylsp
[(1) - (1)]));
2185 #line 494 "parse-gram.y"
2186 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[(1) - (1)].uniqstr
), (yylsp
[(1) - (1)])); }
2190 #line 506 "parse-gram.y"
2192 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[(1) - (1)].chars
)), (yylsp
[(1) - (1)]));
2193 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2198 #line 515 "parse-gram.y"
2199 { (yyval
.chars
) = (yyvsp
[(1) - (1)].chars
); }
2203 #line 522 "parse-gram.y"
2205 muscle_code_grow ("epilogue", translate_code ((yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)])), (yylsp
[(2) - (2)]));
2206 gram_scanner_last_string_free ();
2211 /* Line 1274 of yacc.c. */
2212 #line 2213 "parse-gram.c"
2215 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2219 YY_STACK_PRINT (yyss
, yyssp
);
2224 /* Now `shift' the result of the reduction. Determine what state
2225 that goes to, based on the state we popped back to and the rule
2226 number reduced by. */
2230 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2231 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2232 yystate
= yytable
[yystate
];
2234 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2239 /*------------------------------------.
2240 | yyerrlab -- here on detecting error |
2241 `------------------------------------*/
2243 /* If not already recovering from an error, report this error. */
2247 #if ! YYERROR_VERBOSE
2248 yyerror (YY_("syntax error"));
2251 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2252 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2254 YYSIZE_T yyalloc
= 2 * yysize
;
2255 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2256 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2257 if (yymsg
!= yymsgbuf
)
2258 YYSTACK_FREE (yymsg
);
2259 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2261 yymsg_alloc
= yyalloc
;
2265 yymsg_alloc
= sizeof yymsgbuf
;
2269 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2271 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2276 yyerror (YY_("syntax error"));
2278 goto yyexhaustedlab
;
2284 yyerror_range
[0] = yylloc
;
2286 if (yyerrstatus
== 3)
2288 /* If just tried and failed to reuse lookahead token after an
2289 error, discard it. */
2291 if (yychar
<= YYEOF
)
2293 /* Return failure if at end of input. */
2294 if (yychar
== YYEOF
)
2299 yydestruct ("Error: discarding",
2300 yytoken
, &yylval
, &yylloc
);
2305 /* Else will try to reuse lookahead token after shifting the error
2310 /*---------------------------------------------------.
2311 | yyerrorlab -- error raised explicitly by YYERROR. |
2312 `---------------------------------------------------*/
2315 /* Pacify compilers like GCC when the user code never invokes
2316 YYERROR and the label yyerrorlab therefore never appears in user
2318 if (/*CONSTCOND*/ 0)
2321 yyerror_range
[0] = yylsp
[1-yylen
];
2322 /* Do not reclaim the symbols of the rule which action triggered
2326 YY_STACK_PRINT (yyss
, yyssp
);
2331 /*-------------------------------------------------------------.
2332 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2333 `-------------------------------------------------------------*/
2335 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2339 yyn
= yypact
[yystate
];
2340 if (yyn
!= YYPACT_NINF
)
2343 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2351 /* Pop the current state because it cannot handle the error token. */
2355 yyerror_range
[0] = *yylsp
;
2356 yydestruct ("Error: popping",
2357 yystos
[yystate
], yyvsp
, yylsp
);
2360 YY_STACK_PRINT (yyss
, yyssp
);
2368 yyerror_range
[1] = yylloc
;
2369 /* Using YYLLOC is tempting, but would change the location of
2370 the lookahead. YYLOC is available though. */
2371 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
2374 /* Shift the error token. */
2375 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2381 /*-------------------------------------.
2382 | yyacceptlab -- YYACCEPT comes here. |
2383 `-------------------------------------*/
2388 /*-----------------------------------.
2389 | yyabortlab -- YYABORT comes here. |
2390 `-----------------------------------*/
2396 /*-------------------------------------------------.
2397 | yyexhaustedlab -- memory exhaustion comes here. |
2398 `-------------------------------------------------*/
2400 yyerror (YY_("memory exhausted"));
2406 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2407 yydestruct ("Cleanup: discarding lookahead",
2408 yytoken
, &yylval
, &yylloc
);
2409 /* Do not reclaim the symbols of the rule which action triggered
2410 this YYABORT or YYACCEPT. */
2412 YY_STACK_PRINT (yyss
, yyssp
);
2413 while (yyssp
!= yyss
)
2415 yydestruct ("Cleanup: popping",
2416 yystos
[*yyssp
], yyvsp
, yylsp
);
2421 YYSTACK_FREE (yyss
);
2424 if (yymsg
!= yymsgbuf
)
2425 YYSTACK_FREE (yymsg
);
2427 /* Make sure YYID is used. */
2428 return YYID (yyresult
);
2432 #line 528 "parse-gram.y"
2436 /* Return the location of the left-hand side of a rule whose
2437 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2438 the right-hand side, and return an empty location equal to the end
2439 boundary of RHS[0] if the right-hand side is empty. */
2442 lloc_default (YYLTYPE
const *rhs
, int n
)
2447 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2448 The bug is fixed in 7.4.2m, but play it safe for now. */
2449 loc
.start
= rhs
[n
].end
;
2450 loc
.end
= rhs
[n
].end
;
2452 /* Ignore empty nonterminals the start of the the right-hand side.
2453 Do not bother to ignore them at the end of the right-hand side,
2454 since empty nonterminals have the same end as their predecessors. */
2455 for (i
= 1; i
<= n
; i
++)
2456 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2458 loc
.start
= rhs
[i
].start
;
2466 /* Add a lex-param or a parse-param (depending on TYPE) with
2467 declaration DECL and location LOC. */
2470 add_param (char const *type
, char *decl
, location loc
)
2472 static char const alphanum
[26 + 26 + 1 + 10] =
2473 "abcdefghijklmnopqrstuvwxyz"
2474 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2477 char const *name_start
= NULL
;
2480 /* Stop on last actual character. */
2481 for (p
= decl
; p
[1]; p
++)
2483 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
2484 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
2487 /* Strip the surrounding '{' and '}', and any blanks just inside
2489 while (*--p
== ' ' || *p
== '\t')
2492 while (*++decl
== ' ' || *decl
== '\t')
2496 complain_at (loc
, _("missing identifier in parameter declaration"));
2503 memchr (alphanum
, name_start
[name_len
], sizeof alphanum
);
2507 name
= xmalloc (name_len
+ 1);
2508 memcpy (name
, name_start
, name_len
);
2509 name
[name_len
] = '\0';
2510 muscle_pair_list_grow (type
, decl
, name
);
2514 gram_scanner_last_string_free ();
2518 version_check (location
const *loc
, char const *version
)
2520 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
2522 complain_at (*loc
, "require bison %s, but have %s",
2523 version
, PACKAGE_VERSION
);
2529 gram_error (location
const *loc
, char const *msg
)
2531 complain_at (*loc
, "%s", msg
);
2535 token_name (int type
)
2537 return yytname
[YYTRANSLATE (type
)];
2548 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
2549 return quotearg_style (escape_quoting_style
, buf
);