1 /* A Bison parser, made by GNU Bison 2.2a. */
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.2a"
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
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
83 PERCENT_DESTRUCTOR
= 263,
84 PERCENT_PRINTER
= 264,
88 PERCENT_NONASSOC
= 268,
93 PERCENT_DEFAULT_PREC
= 273,
95 PERCENT_DEFINES
= 275,
96 PERCENT_ERROR_VERBOSE
= 276,
98 PERCENT_EXPECT_RR
= 278,
99 PERCENT_FILE_PREFIX
= 279,
100 PERCENT_GLR_PARSER
= 280,
101 PERCENT_INITIAL_ACTION
= 281,
102 PERCENT_LEX_PARAM
= 282,
103 PERCENT_LOCATIONS
= 283,
104 PERCENT_NAME_PREFIX
= 284,
105 PERCENT_NO_DEFAULT_PREC
= 285,
106 PERCENT_NO_LINES
= 286,
107 PERCENT_NONDETERMINISTIC_PARSER
= 287,
108 PERCENT_OUTPUT
= 288,
109 PERCENT_PARSE_PARAM
= 289,
110 PERCENT_PURE_PARSER
= 290,
111 PERCENT_REQUIRE
= 291,
112 PERCENT_SKELETON
= 292,
114 PERCENT_TOKEN_TABLE
= 294,
115 PERCENT_VERBOSE
= 295,
123 PERCENT_PERCENT
= 303,
133 #define PERCENT_TOKEN 260
134 #define PERCENT_NTERM 261
135 #define PERCENT_TYPE 262
136 #define PERCENT_DESTRUCTOR 263
137 #define PERCENT_PRINTER 264
138 #define PERCENT_UNION 265
139 #define PERCENT_LEFT 266
140 #define PERCENT_RIGHT 267
141 #define PERCENT_NONASSOC 268
142 #define PERCENT_PREC 269
143 #define PERCENT_DPREC 270
144 #define PERCENT_MERGE 271
145 #define PERCENT_DEBUG 272
146 #define PERCENT_DEFAULT_PREC 273
147 #define PERCENT_DEFINE 274
148 #define PERCENT_DEFINES 275
149 #define PERCENT_ERROR_VERBOSE 276
150 #define PERCENT_EXPECT 277
151 #define PERCENT_EXPECT_RR 278
152 #define PERCENT_FILE_PREFIX 279
153 #define PERCENT_GLR_PARSER 280
154 #define PERCENT_INITIAL_ACTION 281
155 #define PERCENT_LEX_PARAM 282
156 #define PERCENT_LOCATIONS 283
157 #define PERCENT_NAME_PREFIX 284
158 #define PERCENT_NO_DEFAULT_PREC 285
159 #define PERCENT_NO_LINES 286
160 #define PERCENT_NONDETERMINISTIC_PARSER 287
161 #define PERCENT_OUTPUT 288
162 #define PERCENT_PARSE_PARAM 289
163 #define PERCENT_PURE_PARSER 290
164 #define PERCENT_REQUIRE 291
165 #define PERCENT_SKELETON 292
166 #define PERCENT_START 293
167 #define PERCENT_TOKEN_TABLE 294
168 #define PERCENT_VERBOSE 295
169 #define PERCENT_YACC 296
172 #define SEMICOLON 299
176 #define PERCENT_PERCENT 303
179 #define BRACED_CODE 306
184 /* Copy the first part of user declarations. */
185 #line 1 "parse-gram.y"
186 /* Bison Grammar Parser -*- C -*-
188 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
190 This file is part of Bison, the GNU Compiler Compiler.
192 This program is free software; you can redistribute it and/or modify
193 it under the terms of the GNU General Public License as published by
194 the Free Software Foundation; either version 2 of the License, or
195 (at your option) any later version.
197 This program is distributed in the hope that it will be useful,
198 but WITHOUT ANY WARRANTY; without even the implied warranty of
199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200 GNU General Public License for more details.
202 You should have received a copy of the GNU General Public License
203 along with this program; if not, write to the Free Software
204 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
211 #include "complain.h"
212 #include "conflicts.h"
216 #include "muscle_tab.h"
217 #include "quotearg.h"
220 #include "strverscmp.h"
222 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
223 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
225 #define YY_LOCATION_PRINT(File, Loc) \
226 location_print (File, Loc)
228 static void version_check (location
const *loc
, char const *version
);
230 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
231 FIXME: depends on the undocumented availability of YYLLOC. */
233 #define yyerror(Msg) \
234 gram_error (&yylloc, Msg)
235 static void gram_error (location
const *, char const *);
237 static void add_param (char const *, char *, location
);
239 static symbol_class current_class
= unknown_sym
;
240 static uniqstr current_type
= 0;
241 static symbol
*current_lhs
;
242 static location current_lhs_location
;
243 static int current_prec
= 0;
245 #ifdef UINT_FAST8_MAX
246 # define YYTYPE_UINT8 uint_fast8_t
249 # define YYTYPE_INT8 int_fast8_t
251 #ifdef UINT_FAST16_MAX
252 # define YYTYPE_UINT16 uint_fast16_t
254 #ifdef INT_FAST16_MAX
255 # define YYTYPE_INT16 int_fast16_t
259 /* Enabling traces. */
264 /* Enabling verbose error messages. */
265 #ifdef YYERROR_VERBOSE
266 # undef YYERROR_VERBOSE
267 # define YYERROR_VERBOSE 1
269 # define YYERROR_VERBOSE 1
272 /* Enabling the token table. */
273 #ifndef YYTOKEN_TABLE
274 # define YYTOKEN_TABLE 0
277 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
278 typedef union YYSTYPE
279 #line 94 "parse-gram.y"
288 /* Line 193 of yacc.c. */
289 #line 290 "parse-gram.c"
291 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
292 # define YYSTYPE_IS_DECLARED 1
293 # define YYSTYPE_IS_TRIVIAL 1
296 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
297 typedef struct YYLTYPE
304 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
305 # define YYLTYPE_IS_DECLARED 1
306 # define YYLTYPE_IS_TRIVIAL 1
310 /* Copy the second part of user declarations. */
313 /* Line 216 of yacc.c. */
314 #line 315 "parse-gram.c"
321 typedef YYTYPE_UINT8 yytype_uint8
;
323 typedef unsigned char yytype_uint8
;
327 typedef YYTYPE_INT8 yytype_int8
;
328 #elif (defined __STDC__ || defined __C99__FUNC__ \
329 || defined __cplusplus || defined _MSC_VER)
330 typedef signed char yytype_int8
;
332 typedef short int yytype_int8
;
336 typedef YYTYPE_UINT16 yytype_uint16
;
338 typedef unsigned short int yytype_uint16
;
342 typedef YYTYPE_INT16 yytype_int16
;
344 typedef short int yytype_int16
;
348 # ifdef __SIZE_TYPE__
349 # define YYSIZE_T __SIZE_TYPE__
350 # elif defined size_t
351 # define YYSIZE_T size_t
352 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
353 || defined __cplusplus || defined _MSC_VER)
354 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
355 # define YYSIZE_T size_t
357 # define YYSIZE_T unsigned int
361 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
366 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
367 # define YY_(msgid) dgettext ("bison-runtime", msgid)
371 # define YY_(msgid) msgid
375 /* Suppress unused-variable warnings by "using" E. */
376 #if ! defined lint || defined __GNUC__
377 # define YYUSE(e) ((void) (e))
379 # define YYUSE(e) /* empty */
382 /* Identity function, used to suppress warnings about constant conditions. */
386 #if (defined __STDC__ || defined __C99__FUNC__ \
387 || defined __cplusplus || defined _MSC_VER)
400 #if ! defined yyoverflow || YYERROR_VERBOSE
402 /* The parser invokes alloca or malloc; define the necessary symbols. */
404 # ifdef YYSTACK_USE_ALLOCA
405 # if YYSTACK_USE_ALLOCA
407 # define YYSTACK_ALLOC __builtin_alloca
408 # elif defined __BUILTIN_VA_ARG_INCR
409 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
411 # define YYSTACK_ALLOC __alloca
412 # elif defined _MSC_VER
413 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
414 # define alloca _alloca
416 # define YYSTACK_ALLOC alloca
417 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
418 || defined __cplusplus || defined _MSC_VER)
419 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
428 # ifdef YYSTACK_ALLOC
429 /* Pacify GCC's `empty if-body' warning. */
430 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
431 # ifndef YYSTACK_ALLOC_MAXIMUM
432 /* The OS might guarantee only one guard page at the bottom of the stack,
433 and a page size can be as small as 4096 bytes. So we cannot safely
434 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
435 to allow for a few compiler-allocated temporary stack slots. */
436 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
439 # define YYSTACK_ALLOC YYMALLOC
440 # define YYSTACK_FREE YYFREE
441 # ifndef YYSTACK_ALLOC_MAXIMUM
442 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
444 # if (defined __cplusplus && ! defined _STDLIB_H \
445 && ! ((defined YYMALLOC || defined malloc) \
446 && (defined YYFREE || defined free)))
447 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
453 # define YYMALLOC malloc
454 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
455 || defined __cplusplus || defined _MSC_VER)
456 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
461 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
462 || defined __cplusplus || defined _MSC_VER)
463 void free (void *); /* INFRINGES ON USER NAME SPACE */
467 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
470 #if (! defined yyoverflow \
471 && (! defined __cplusplus \
472 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
473 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
475 /* A type that is properly aligned for any stack member. */
483 /* The size of the maximum gap between one aligned stack and the next. */
484 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
486 /* The size of an array large to enough to hold all stacks, each with
488 # define YYSTACK_BYTES(N) \
489 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
490 + 2 * YYSTACK_GAP_MAXIMUM)
492 /* Copy COUNT objects from FROM to TO. The source and destination do
495 # if defined __GNUC__ && 1 < __GNUC__
496 # define YYCOPY(To, From, Count) \
497 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
499 # define YYCOPY(To, From, Count) \
503 for (yyi = 0; yyi < (Count); yyi++) \
504 (To)[yyi] = (From)[yyi]; \
510 /* Relocate STACK from its old location to the new one. The
511 local variables YYSIZE and YYSTACKSIZE give the old and new number of
512 elements in the stack, and YYPTR gives the new location of the
513 stack. Advance YYPTR to a properly aligned location for the next
515 # define YYSTACK_RELOCATE(Stack) \
518 YYSIZE_T yynewbytes; \
519 YYCOPY (&yyptr->Stack, Stack, yysize); \
520 Stack = &yyptr->Stack; \
521 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
522 yyptr += yynewbytes / sizeof (*yyptr); \
528 /* YYFINAL -- State number of the termination state. */
530 /* YYLAST -- Last index in YYTABLE. */
533 /* YYNTOKENS -- Number of terminals. */
535 /* YYNNTS -- Number of nonterminals. */
537 /* YYNRULES -- Number of rules. */
539 /* YYNRULES -- Number of states. */
540 #define YYNSTATES 111
542 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
544 #define YYMAXUTOK 306
546 #define YYTRANSLATE(YYX) \
547 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
549 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
550 static const yytype_uint8 yytranslate
[] =
552 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
578 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
579 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
580 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
581 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
582 45, 46, 47, 48, 49, 50, 51
586 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
588 static const yytype_uint8 yyprhs
[] =
590 0, 0, 3, 8, 9, 12, 14, 16, 18, 21,
591 25, 27, 29, 32, 35, 39, 41, 43, 45, 47,
592 51, 53, 55, 59, 61, 63, 66, 69, 71, 73,
593 75, 77, 79, 81, 84, 86, 89, 92, 94, 96,
594 97, 101, 102, 106, 110, 114, 116, 118, 120, 121,
595 123, 125, 128, 130, 132, 135, 138, 142, 144, 147,
596 149, 152, 154, 157, 160, 161, 165, 167, 171, 174,
597 175, 178, 181, 185, 189, 193, 195, 197, 198, 201,
601 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
602 static const yytype_int8 yyrhs
[] =
604 53, 0, -1, 54, 48, 66, 77, -1, -1, 54,
605 55, -1, 56, -1, 49, -1, 17, -1, 19, 76,
606 -1, 19, 76, 76, -1, 20, -1, 21, -1, 22,
607 4, -1, 23, 4, -1, 24, 43, 76, -1, 25,
608 -1, 26, -1, 27, -1, 28, -1, 29, 43, 76,
609 -1, 31, -1, 32, -1, 33, 43, 76, -1, 34,
610 -1, 35, -1, 36, 76, -1, 37, 76, -1, 39,
611 -1, 40, -1, 41, -1, 44, -1, 60, -1, 57,
612 -1, 38, 72, -1, 10, -1, 8, 63, -1, 9,
613 63, -1, 18, -1, 30, -1, -1, 6, 58, 65,
614 -1, -1, 5, 59, 65, -1, 7, 42, 63, -1,
615 61, 62, 63, -1, 11, -1, 12, -1, 13, -1,
616 -1, 42, -1, 72, -1, 63, 72, -1, 42, -1,
617 46, -1, 46, 4, -1, 46, 75, -1, 46, 4,
618 75, -1, 64, -1, 65, 64, -1, 67, -1, 66,
619 67, -1, 68, -1, 56, 44, -1, 1, 44, -1,
620 -1, 47, 69, 70, -1, 71, -1, 70, 45, 71,
621 -1, 70, 44, -1, -1, 71, 72, -1, 71, 73,
622 -1, 71, 14, 72, -1, 71, 15, 4, -1, 71,
623 16, 42, -1, 46, -1, 75, -1, -1, 74, 51,
624 -1, 3, -1, 3, -1, -1, 48, 50, -1
627 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
628 static const yytype_uint16 yyrline
[] =
630 0, 202, 202, 210, 212, 216, 217, 218, 219, 224,
631 225, 226, 227, 228, 229, 230, 235, 239, 240, 241,
632 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
633 252, 256, 257, 258, 262, 278, 285, 292, 296, 303,
634 303, 308, 308, 313, 323, 338, 339, 340, 344, 345,
635 351, 352, 357, 361, 366, 372, 378, 389, 390, 399,
636 400, 406, 407, 408, 415, 415, 419, 420, 421, 426,
637 427, 429, 430, 432, 434, 439, 440, 456, 456, 462,
642 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
643 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
644 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
645 static const char *const yytname
[] =
647 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
648 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
649 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
650 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
651 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
652 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
653 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
654 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
655 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
656 "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"",
657 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"",
658 "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
659 "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input",
660 "declarations", "declaration", "grammar_declaration",
661 "symbol_declaration", "@1", "@2", "precedence_declaration",
662 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
663 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
664 "@3", "rhses.1", "rhs", "symbol", "action", "@4", "string_as_id",
665 "string_content", "epilogue.opt", 0
670 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
672 static const yytype_uint16 yytoknum
[] =
674 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
675 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
676 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
677 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
678 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
683 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
684 static const yytype_uint8 yyr1
[] =
686 0, 52, 53, 54, 54, 55, 55, 55, 55, 55,
687 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
688 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
689 55, 56, 56, 56, 56, 56, 56, 56, 56, 58,
690 57, 59, 57, 57, 60, 61, 61, 61, 62, 62,
691 63, 63, 64, 64, 64, 64, 64, 65, 65, 66,
692 66, 67, 67, 67, 69, 68, 70, 70, 70, 71,
693 71, 71, 71, 71, 71, 72, 72, 74, 73, 75,
697 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
698 static const yytype_uint8 yyr2
[] =
700 0, 2, 4, 0, 2, 1, 1, 1, 2, 3,
701 1, 1, 2, 2, 3, 1, 1, 1, 1, 3,
702 1, 1, 3, 1, 1, 2, 2, 1, 1, 1,
703 1, 1, 1, 2, 1, 2, 2, 1, 1, 0,
704 3, 0, 3, 3, 3, 1, 1, 1, 0, 1,
705 1, 2, 1, 1, 2, 2, 3, 1, 2, 1,
706 2, 1, 2, 2, 0, 3, 1, 3, 2, 0,
707 2, 2, 3, 3, 3, 1, 1, 0, 2, 1,
711 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
712 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
713 means the default is an error. */
714 static const yytype_uint8 yydefact
[] =
716 3, 0, 0, 1, 41, 39, 0, 0, 0, 34,
717 45, 46, 47, 7, 37, 0, 10, 11, 0, 0,
718 0, 15, 16, 17, 18, 0, 38, 20, 21, 0,
719 23, 24, 0, 0, 0, 27, 28, 29, 30, 0,
720 6, 4, 5, 32, 31, 48, 0, 0, 0, 79,
721 75, 35, 50, 76, 36, 80, 8, 12, 13, 0,
722 0, 0, 25, 26, 33, 0, 64, 0, 0, 59,
723 61, 49, 0, 52, 53, 57, 42, 40, 43, 51,
724 9, 14, 19, 22, 63, 69, 62, 0, 60, 2,
725 44, 54, 55, 58, 65, 66, 82, 56, 68, 69,
726 0, 0, 0, 70, 71, 0, 67, 72, 73, 74,
730 /* YYDEFGOTO[NTERM-NUM]. */
731 static const yytype_int8 yydefgoto
[] =
733 -1, 1, 2, 41, 67, 43, 47, 46, 44, 45,
734 72, 51, 75, 76, 68, 69, 70, 85, 94, 95,
735 52, 104, 105, 53, 56, 89
738 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
740 #define YYPACT_NINF -69
741 static const yytype_int8 yypact
[] =
743 -69, 5, 112, -69, -69, -69, -35, 0, 0, -69,
744 -69, -69, -69, -69, -69, 13, -69, -69, 20, 31,
745 -18, -69, -69, -69, -69, -6, -69, -69, -69, -5,
746 -69, -69, 13, 13, 0, -69, -69, -69, -69, 69,
747 -69, -69, -69, -69, -69, -2, -38, -38, 0, -69,
748 -69, 0, -69, -69, 0, -69, 13, -69, -69, 13,
749 13, 13, -69, -69, -69, -8, -69, 3, 21, -69,
750 -69, -69, 0, -69, 6, -69, -38, -38, 0, -69,
751 -69, -69, -69, -69, -69, -69, -69, 2, -69, -69,
752 0, 39, -69, -69, -33, -1, -69, -69, -69, -69,
753 0, 44, 1, -69, -69, 4, -1, -69, -69, -69,
757 /* YYPGOTO[NTERM-NUM]. */
758 static const yytype_int8 yypgoto
[] =
760 -69, -69, -69, -69, 47, -69, -69, -69, -69, -69,
761 -69, -7, -58, 7, -69, -15, -69, -69, -69, -42,
762 -34, -69, -69, -68, 30, -69
765 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
766 positive, shift that token. If negative, reduce the rule which
767 number is the opposite. If zero, do what YYDEFACT says.
768 If YYTABLE_NINF, syntax error. */
769 #define YYTABLE_NINF -82
770 static const yytype_int8 yytable
[] =
772 64, 54, 49, 49, 73, 3, 92, 48, 74, 49,
773 91, 98, 99, 100, 101, 102, 55, 79, 93, 93,
774 79, -81, 65, 97, 57, 59, 4, 5, 6, 7,
775 8, 9, 10, 11, 12, 58, 84, 60, 61, 14,
776 71, 78, 49, 109, 79, 50, 50, 86, 108, 42,
777 -77, 26, 96, 88, 77, 110, 79, 106, 0, 34,
778 0, 103, 62, 63, 0, 90, 107, 0, 66, 87,
779 65, 0, 103, 0, 4, 5, 6, 7, 8, 9,
780 10, 11, 12, 0, 0, 0, 80, 14, 0, 81,
781 82, 83, 0, 0, 0, 0, 0, 0, 0, 26,
782 0, 0, 0, 0, 0, 0, 0, 34, 0, 0,
783 0, 0, 0, 0, 0, 0, 66, 4, 5, 6,
784 7, 8, 9, 10, 11, 12, 0, 0, 0, 13,
785 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
786 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
787 34, 35, 36, 37, 0, 0, 38, 0, 0, 0,
791 static const yytype_int8 yycheck
[] =
793 34, 8, 3, 3, 42, 0, 74, 42, 46, 3,
794 4, 44, 45, 14, 15, 16, 3, 51, 76, 77,
795 54, 0, 1, 91, 4, 43, 5, 6, 7, 8,
796 9, 10, 11, 12, 13, 4, 44, 43, 43, 18,
797 42, 48, 3, 42, 78, 46, 46, 44, 4, 2,
798 51, 30, 50, 68, 47, 51, 90, 99, -1, 38,
799 -1, 95, 32, 33, -1, 72, 100, -1, 47, 48,
800 1, -1, 106, -1, 5, 6, 7, 8, 9, 10,
801 11, 12, 13, -1, -1, -1, 56, 18, -1, 59,
802 60, 61, -1, -1, -1, -1, -1, -1, -1, 30,
803 -1, -1, -1, -1, -1, -1, -1, 38, -1, -1,
804 -1, -1, -1, -1, -1, -1, 47, 5, 6, 7,
805 8, 9, 10, 11, 12, 13, -1, -1, -1, 17,
806 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
807 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
808 38, 39, 40, 41, -1, -1, 44, -1, -1, -1,
812 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
813 symbol of state STATE-NUM. */
814 static const yytype_uint8 yystos
[] =
816 0, 53, 54, 0, 5, 6, 7, 8, 9, 10,
817 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
818 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
819 34, 35, 36, 37, 38, 39, 40, 41, 44, 48,
820 49, 55, 56, 57, 60, 61, 59, 58, 42, 3,
821 46, 63, 72, 75, 63, 3, 76, 4, 4, 43,
822 43, 43, 76, 76, 72, 1, 47, 56, 66, 67,
823 68, 42, 62, 42, 46, 64, 65, 65, 63, 72,
824 76, 76, 76, 76, 44, 69, 44, 48, 67, 77,
825 63, 4, 75, 64, 70, 71, 50, 75, 44, 45,
826 14, 15, 16, 72, 73, 74, 71, 72, 4, 42,
830 #define yyerrok (yyerrstatus = 0)
831 #define yyclearin (yychar = YYEMPTY)
835 #define YYACCEPT goto yyacceptlab
836 #define YYABORT goto yyabortlab
837 #define YYERROR goto yyerrorlab
840 /* Like YYERROR except do call yyerror. This remains here temporarily
841 to ease the transition to the new meaning of YYERROR, for GCC.
842 Once GCC version 2 has supplanted version 1, this can go. */
844 #define YYFAIL goto yyerrlab
846 #define YYRECOVERING() (!!yyerrstatus)
848 #define YYBACKUP(Token, Value) \
850 if (yychar == YYEMPTY && yylen == 1) \
854 yytoken = YYTRANSLATE (yychar); \
860 yyerror (YY_("syntax error: cannot back up")); \
867 #define YYERRCODE 256
870 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
871 If N is 0, then set CURRENT to the empty location which ends
872 the previous symbol: RHS[0] (always defined). */
874 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
875 #ifndef YYLLOC_DEFAULT
876 # define YYLLOC_DEFAULT(Current, Rhs, N) \
880 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
881 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
882 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
883 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
887 (Current).first_line = (Current).last_line = \
888 YYRHSLOC (Rhs, 0).last_line; \
889 (Current).first_column = (Current).last_column = \
890 YYRHSLOC (Rhs, 0).last_column; \
896 /* YY_LOCATION_PRINT -- Print the location on the stream.
897 This macro was not mandated originally: define only if we know
898 we won't break user code: when these are the locations we know. */
900 #ifndef YY_LOCATION_PRINT
901 # if YYLTYPE_IS_TRIVIAL
902 # define YY_LOCATION_PRINT(File, Loc) \
903 fprintf (File, "%d.%d-%d.%d", \
904 (Loc).first_line, (Loc).first_column, \
905 (Loc).last_line, (Loc).last_column)
907 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
912 /* YYLEX -- calling `yylex' with the right arguments. */
915 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
917 # define YYLEX yylex (&yylval, &yylloc)
920 /* Enable debugging if requested. */
924 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
925 # define YYFPRINTF fprintf
928 # define YYDPRINTF(Args) \
934 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
938 YYFPRINTF (stderr, "%s ", Title); \
939 yy_symbol_print (stderr, \
940 Type, Value, Location); \
941 YYFPRINTF (stderr, "\n"); \
946 /*--------------------------------.
947 | Print this symbol on YYOUTPUT. |
948 `--------------------------------*/
951 #if (defined __STDC__ || defined __C99__FUNC__ \
952 || defined __cplusplus || defined _MSC_VER)
954 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
957 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
960 YYSTYPE
const * const yyvaluep
;
961 YYLTYPE
const * const yylocationp
;
968 if (yytype
< YYNTOKENS
)
969 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
975 case 3: /* "\"string\"" */
976 #line 179 "parse-gram.y"
977 { fprintf (stderr
, "\"%s\"", (yyvaluep
->chars
)); };
978 #line 979 "parse-gram.c"
980 case 4: /* "\"integer\"" */
981 #line 192 "parse-gram.y"
982 { fprintf (stderr
, "%d", (yyvaluep
->integer
)); };
983 #line 984 "parse-gram.c"
985 case 8: /* "\"%destructor {...}\"" */
986 #line 181 "parse-gram.y"
987 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
988 #line 989 "parse-gram.c"
990 case 9: /* "\"%printer {...}\"" */
991 #line 181 "parse-gram.y"
992 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
993 #line 994 "parse-gram.c"
995 case 10: /* "\"%union {...}\"" */
996 #line 181 "parse-gram.y"
997 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
998 #line 999 "parse-gram.c"
1000 case 26: /* "\"%initial-action {...}\"" */
1001 #line 181 "parse-gram.y"
1002 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1003 #line 1004 "parse-gram.c"
1005 case 27: /* "\"%lex-param {...}\"" */
1006 #line 181 "parse-gram.y"
1007 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1008 #line 1009 "parse-gram.c"
1010 case 34: /* "\"%parse-param {...}\"" */
1011 #line 181 "parse-gram.y"
1012 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1013 #line 1014 "parse-gram.c"
1015 case 42: /* "\"type\"" */
1016 #line 190 "parse-gram.y"
1017 { fprintf (stderr
, "<%s>", (yyvaluep
->uniqstr
)); };
1018 #line 1019 "parse-gram.c"
1020 case 46: /* "\"identifier\"" */
1021 #line 194 "parse-gram.y"
1022 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1023 #line 1024 "parse-gram.c"
1025 case 47: /* "\"identifier:\"" */
1026 #line 196 "parse-gram.y"
1027 { fprintf (stderr
, "%s:", (yyvaluep
->symbol
)->tag
); };
1028 #line 1029 "parse-gram.c"
1030 case 49: /* "\"%{...%}\"" */
1031 #line 181 "parse-gram.y"
1032 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1033 #line 1034 "parse-gram.c"
1035 case 50: /* "\"epilogue\"" */
1036 #line 181 "parse-gram.y"
1037 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1038 #line 1039 "parse-gram.c"
1040 case 72: /* "symbol" */
1041 #line 194 "parse-gram.y"
1042 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1043 #line 1044 "parse-gram.c"
1045 case 75: /* "string_as_id" */
1046 #line 194 "parse-gram.y"
1047 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1048 #line 1049 "parse-gram.c"
1050 case 76: /* "string_content" */
1051 #line 179 "parse-gram.y"
1052 { fprintf (stderr
, "\"%s\"", (yyvaluep
->chars
)); };
1053 #line 1054 "parse-gram.c"
1061 /*--------------------------------.
1062 | Print this symbol on YYOUTPUT. |
1063 `--------------------------------*/
1065 #if (defined __STDC__ || defined __C99__FUNC__ \
1066 || defined __cplusplus || defined _MSC_VER)
1068 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1071 yy_symbol_print (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1074 YYSTYPE
const * const yyvaluep
;
1075 YYLTYPE
const * const yylocationp
;
1078 if (yytype
< YYNTOKENS
)
1079 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1081 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1083 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1084 YYFPRINTF (yyoutput
, ": ");
1085 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1086 YYFPRINTF (yyoutput
, ")");
1089 /*------------------------------------------------------------------.
1090 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1092 `------------------------------------------------------------------*/
1094 #if (defined __STDC__ || defined __C99__FUNC__ \
1095 || defined __cplusplus || defined _MSC_VER)
1097 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
1100 yy_stack_print (bottom
, top
)
1101 yytype_int16
*bottom
;
1105 YYFPRINTF (stderr
, "Stack now");
1106 for (; bottom
<= top
; ++bottom
)
1107 YYFPRINTF (stderr
, " %d", *bottom
);
1108 YYFPRINTF (stderr
, "\n");
1111 # define YY_STACK_PRINT(Bottom, Top) \
1114 yy_stack_print ((Bottom), (Top)); \
1118 /*------------------------------------------------.
1119 | Report that the YYRULE is going to be reduced. |
1120 `------------------------------------------------*/
1122 #if (defined __STDC__ || defined __C99__FUNC__ \
1123 || defined __cplusplus || defined _MSC_VER)
1125 yy_reduce_print (YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1128 yy_reduce_print (yyvsp
, yylsp
, yyrule
)
1134 int yynrhs
= yyr2
[yyrule
];
1136 unsigned long int yylno
= yyrline
[yyrule
];
1137 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1139 /* The symbols being reduced. */
1140 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1142 fprintf (stderr
, " $%d = ", yyi
+ 1);
1143 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1144 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1145 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1146 fprintf (stderr
, "\n");
1150 # define YY_REDUCE_PRINT(Rule) \
1153 yy_reduce_print (yyvsp, yylsp, Rule); \
1156 /* Nonzero means print parse trace. It is left uninitialized so that
1157 multiple parsers can coexist. */
1159 #else /* !YYDEBUG */
1160 # define YYDPRINTF(Args)
1161 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1162 # define YY_STACK_PRINT(Bottom, Top)
1163 # define YY_REDUCE_PRINT(Rule)
1164 #endif /* !YYDEBUG */
1167 /* YYINITDEPTH -- initial size of the parser's stacks. */
1169 # define YYINITDEPTH 200
1172 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1173 if the built-in stack extension method is used).
1175 Do not make this value too large; the results are undefined if
1176 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1177 evaluated with infinite-precision integer arithmetic. */
1180 # define YYMAXDEPTH 10000
1188 # if defined __GLIBC__ && defined _STRING_H
1189 # define yystrlen strlen
1191 /* Return the length of YYSTR. */
1192 #if (defined __STDC__ || defined __C99__FUNC__ \
1193 || defined __cplusplus || defined _MSC_VER)
1195 yystrlen (const char *yystr
)
1203 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1211 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1212 # define yystpcpy stpcpy
1214 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1216 #if (defined __STDC__ || defined __C99__FUNC__ \
1217 || defined __cplusplus || defined _MSC_VER)
1219 yystpcpy (char *yydest
, const char *yysrc
)
1222 yystpcpy (yydest
, yysrc
)
1228 const char *yys
= yysrc
;
1230 while ((*yyd
++ = *yys
++) != '\0')
1239 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1240 quotes and backslashes, so that it's suitable for yyerror. The
1241 heuristic is that double-quoting is unnecessary unless the string
1242 contains an apostrophe, a comma, or backslash (other than
1243 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1244 null, do not copy; instead, return the length of what the result
1247 yytnamerr (char *yyres
, const char *yystr
)
1252 char const *yyp
= yystr
;
1259 goto do_not_strip_quotes
;
1263 goto do_not_strip_quotes
;
1276 do_not_strip_quotes
: ;
1280 return yystrlen (yystr
);
1282 return yystpcpy (yyres
, yystr
) - yyres
;
1286 /* Copy into YYRESULT an error message about the unexpected token
1287 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1288 including the terminating null byte. If YYRESULT is null, do not
1289 copy anything; just return the number of bytes that would be
1290 copied. As a special case, return 0 if an ordinary "syntax error"
1291 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1292 size calculation. */
1294 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1296 int yyn
= yypact
[yystate
];
1298 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1302 int yytype
= YYTRANSLATE (yychar
);
1303 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1304 YYSIZE_T yysize
= yysize0
;
1306 int yysize_overflow
= 0;
1307 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1308 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1312 /* This is so xgettext sees the translatable formats that are
1313 constructed on the fly. */
1314 YY_("syntax error, unexpected %s");
1315 YY_("syntax error, unexpected %s, expecting %s");
1316 YY_("syntax error, unexpected %s, expecting %s or %s");
1317 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1318 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1322 static char const yyunexpected
[] = "syntax error, unexpected %s";
1323 static char const yyexpecting
[] = ", expecting %s";
1324 static char const yyor
[] = " or %s";
1325 char yyformat
[sizeof yyunexpected
1326 + sizeof yyexpecting
- 1
1327 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1328 * (sizeof yyor
- 1))];
1329 char const *yyprefix
= yyexpecting
;
1331 /* Start YYX at -YYN if negative to avoid negative indexes in
1333 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1335 /* Stay within bounds of both yycheck and yytname. */
1336 int yychecklim
= YYLAST
- yyn
+ 1;
1337 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1340 yyarg
[0] = yytname
[yytype
];
1341 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1343 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1344 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1346 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1350 yyformat
[sizeof yyunexpected
- 1] = '\0';
1353 yyarg
[yycount
++] = yytname
[yyx
];
1354 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1355 yysize_overflow
|= (yysize1
< yysize
);
1357 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1361 yyf
= YY_(yyformat
);
1362 yysize1
= yysize
+ yystrlen (yyf
);
1363 yysize_overflow
|= (yysize1
< yysize
);
1366 if (yysize_overflow
)
1367 return YYSIZE_MAXIMUM
;
1371 /* Avoid sprintf, as that infringes on the user's name space.
1372 Don't have undefined behavior even if the translation
1373 produced a string with the wrong number of "%s"s. */
1374 char *yyp
= yyresult
;
1376 while ((*yyp
= *yyf
) != '\0')
1378 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1380 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1393 #endif /* YYERROR_VERBOSE */
1396 /*-----------------------------------------------.
1397 | Release the memory associated to this symbol. |
1398 `-----------------------------------------------*/
1401 #if (defined __STDC__ || defined __C99__FUNC__ \
1402 || defined __cplusplus || defined _MSC_VER)
1404 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1407 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
1411 YYLTYPE
*yylocationp
;
1415 YYUSE (yylocationp
);
1419 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1430 /* Prevent warnings from -Wmissing-prototypes. */
1432 #ifdef YYPARSE_PARAM
1433 #if defined __STDC__ || defined __cplusplus
1434 int yyparse (void *YYPARSE_PARAM
);
1438 #else /* ! YYPARSE_PARAM */
1439 #if defined __STDC__ || defined __cplusplus
1444 #endif /* ! YYPARSE_PARAM */
1455 #ifdef YYPARSE_PARAM
1456 #if (defined __STDC__ || defined __C99__FUNC__ \
1457 || defined __cplusplus || defined _MSC_VER)
1459 yyparse (void *YYPARSE_PARAM
)
1462 yyparse (YYPARSE_PARAM
)
1463 void *YYPARSE_PARAM
;
1465 #else /* ! YYPARSE_PARAM */
1466 #if (defined __STDC__ || defined __C99__FUNC__ \
1467 || defined __cplusplus || defined _MSC_VER)
1477 /* The look-ahead symbol. */
1480 /* The semantic value of the look-ahead symbol. */
1483 /* Number of syntax errors so far. */
1485 /* Location data for the look-ahead symbol. */
1491 /* Number of tokens to shift before error messages enabled. */
1493 /* Look-ahead token as an internal (translated) token number. */
1496 /* Buffer for error messages, and its allocated size. */
1498 char *yymsg
= yymsgbuf
;
1499 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1502 /* Three stacks and their tools:
1503 `yyss': related to states,
1504 `yyvs': related to semantic values,
1505 `yyls': related to locations.
1507 Refer to the stacks thru separate pointers, to allow yyoverflow
1508 to reallocate them elsewhere. */
1510 /* The state stack. */
1511 yytype_int16 yyssa
[YYINITDEPTH
];
1512 yytype_int16
*yyss
= yyssa
;
1513 yytype_int16
*yyssp
;
1515 /* The semantic value stack. */
1516 YYSTYPE yyvsa
[YYINITDEPTH
];
1517 YYSTYPE
*yyvs
= yyvsa
;
1520 /* The location stack. */
1521 YYLTYPE yylsa
[YYINITDEPTH
];
1522 YYLTYPE
*yyls
= yylsa
;
1524 /* The locations where the error started and ended. */
1525 YYLTYPE yyerror_range
[2];
1527 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1529 YYSIZE_T yystacksize
= YYINITDEPTH
;
1531 /* The variables used to return semantic value and location from the
1536 /* The number of symbols on the RHS of the reduced rule.
1537 Keep to zero when no symbol should be popped. */
1540 YYDPRINTF ((stderr
, "Starting parse\n"));
1545 yychar
= YYEMPTY
; /* Cause a token to be read. */
1547 /* Initialize stack pointers.
1548 Waste one element of value and location stack
1549 so that they stay on the same level as the state stack.
1550 The wasted elements are never initialized. */
1555 #if YYLTYPE_IS_TRIVIAL
1556 /* Initialize the default location before parsing starts. */
1557 yylloc
.first_line
= yylloc
.last_line
= 1;
1558 yylloc
.first_column
= yylloc
.last_column
= 0;
1562 /* User initialization code. */
1563 #line 84 "parse-gram.y"
1565 /* Bison's grammar can initial empty locations, hence a default
1566 location is needed. */
1567 yylloc
.start
.file
= yylloc
.end
.file
= current_file
;
1568 yylloc
.start
.line
= yylloc
.end
.line
= 1;
1569 yylloc
.start
.column
= yylloc
.end
.column
= 0;
1571 /* Line 1078 of yacc.c. */
1572 #line 1573 "parse-gram.c"
1576 /*------------------------------------------------------------.
1577 | yynewstate -- Push a new state, which is found in yystate. |
1578 `------------------------------------------------------------*/
1580 /* In all cases, when you get here, the value and location stacks
1581 have just been pushed. So pushing a state here evens the stacks. */
1587 if (yyss
+ yystacksize
- 1 <= yyssp
)
1589 /* Get the current used size of the three stacks, in elements. */
1590 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1594 /* Give user a chance to reallocate the stack. Use copies of
1595 these so that the &'s don't force the real ones into
1597 YYSTYPE
*yyvs1
= yyvs
;
1598 yytype_int16
*yyss1
= yyss
;
1599 YYLTYPE
*yyls1
= yyls
;
1601 /* Each stack pointer address is followed by the size of the
1602 data in use in that stack, in bytes. This used to be a
1603 conditional around just the two extra args, but that might
1604 be undefined if yyoverflow is a macro. */
1605 yyoverflow (YY_("memory exhausted"),
1606 &yyss1
, yysize
* sizeof (*yyssp
),
1607 &yyvs1
, yysize
* sizeof (*yyvsp
),
1608 &yyls1
, yysize
* sizeof (*yylsp
),
1614 #else /* no yyoverflow */
1615 # ifndef YYSTACK_RELOCATE
1616 goto yyexhaustedlab
;
1618 /* Extend the stack our own way. */
1619 if (YYMAXDEPTH
<= yystacksize
)
1620 goto yyexhaustedlab
;
1622 if (YYMAXDEPTH
< yystacksize
)
1623 yystacksize
= YYMAXDEPTH
;
1626 yytype_int16
*yyss1
= yyss
;
1627 union yyalloc
*yyptr
=
1628 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1630 goto yyexhaustedlab
;
1631 YYSTACK_RELOCATE (yyss
);
1632 YYSTACK_RELOCATE (yyvs
);
1633 YYSTACK_RELOCATE (yyls
);
1634 # undef YYSTACK_RELOCATE
1636 YYSTACK_FREE (yyss1
);
1639 #endif /* no yyoverflow */
1641 yyssp
= yyss
+ yysize
- 1;
1642 yyvsp
= yyvs
+ yysize
- 1;
1643 yylsp
= yyls
+ yysize
- 1;
1645 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1646 (unsigned long int) yystacksize
));
1648 if (yyss
+ yystacksize
- 1 <= yyssp
)
1652 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1661 /* Do appropriate processing given the current state. Read a
1662 look-ahead token if we need one and don't already have one. */
1664 /* First try to decide what to do without reference to look-ahead token. */
1665 yyn
= yypact
[yystate
];
1666 if (yyn
== YYPACT_NINF
)
1669 /* Not known => get a look-ahead token if don't already have one. */
1671 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1672 if (yychar
== YYEMPTY
)
1674 YYDPRINTF ((stderr
, "Reading a token: "));
1678 if (yychar
<= YYEOF
)
1680 yychar
= yytoken
= YYEOF
;
1681 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1685 yytoken
= YYTRANSLATE (yychar
);
1686 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1689 /* If the proper action on seeing token YYTOKEN is to reduce or to
1690 detect an error, take that action. */
1692 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1697 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1706 /* Count tokens shifted since error; after three, turn off error
1711 /* Shift the look-ahead token. */
1712 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1714 /* Discard the shifted token unless it is eof. */
1715 if (yychar
!= YYEOF
)
1724 /*-----------------------------------------------------------.
1725 | yydefault -- do the default action for the current state. |
1726 `-----------------------------------------------------------*/
1728 yyn
= yydefact
[yystate
];
1734 /*-----------------------------.
1735 | yyreduce -- Do a reduction. |
1736 `-----------------------------*/
1738 /* yyn is the number of a rule to reduce with. */
1741 /* If YYLEN is nonzero, implement the default value of the action:
1744 Otherwise, the following line sets YYVAL to garbage.
1745 This behavior is undocumented and Bison
1746 users should not rely upon it. Assigning to YYVAL
1747 unconditionally makes the parser a bit smaller, and it avoids a
1748 GCC warning that YYVAL may be used uninitialized. */
1749 yyval
= yyvsp
[1-yylen
];
1751 /* Default location. */
1752 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1753 YY_REDUCE_PRINT (yyn
);
1757 #line 217 "parse-gram.y"
1758 { prologue_augment ((yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)])); }
1762 #line 218 "parse-gram.y"
1763 { debug_flag
= true; }
1767 #line 220 "parse-gram.y"
1769 static char one
[] = "1";
1770 muscle_insert ((yyvsp
[(2) - (2)].chars
), one
);
1775 #line 224 "parse-gram.y"
1776 { muscle_insert ((yyvsp
[(2) - (3)].chars
), (yyvsp
[(3) - (3)].chars
)); }
1780 #line 225 "parse-gram.y"
1781 { defines_flag
= true; }
1785 #line 226 "parse-gram.y"
1786 { error_verbose
= true; }
1790 #line 227 "parse-gram.y"
1791 { expected_sr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1795 #line 228 "parse-gram.y"
1796 { expected_rr_conflicts
= (yyvsp
[(2) - (2)].integer
); }
1800 #line 229 "parse-gram.y"
1801 { spec_file_prefix
= (yyvsp
[(3) - (3)].chars
); }
1805 #line 231 "parse-gram.y"
1807 nondeterministic_parser
= true;
1813 #line 236 "parse-gram.y"
1815 muscle_code_grow ("initial_action", (yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)]));
1820 #line 239 "parse-gram.y"
1821 { add_param ("lex_param", (yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)])); }
1825 #line 240 "parse-gram.y"
1826 { locations_flag
= true; }
1830 #line 241 "parse-gram.y"
1831 { spec_name_prefix
= (yyvsp
[(3) - (3)].chars
); }
1835 #line 242 "parse-gram.y"
1836 { no_lines_flag
= true; }
1840 #line 243 "parse-gram.y"
1841 { nondeterministic_parser
= true; }
1845 #line 244 "parse-gram.y"
1846 { spec_outfile
= (yyvsp
[(3) - (3)].chars
); }
1850 #line 245 "parse-gram.y"
1851 { add_param ("parse_param", (yyvsp
[(1) - (1)].chars
), (yylsp
[(1) - (1)])); }
1855 #line 246 "parse-gram.y"
1856 { pure_parser
= true; }
1860 #line 247 "parse-gram.y"
1861 { version_check (&(yylsp
[(2) - (2)]), (yyvsp
[(2) - (2)].chars
)); }
1865 #line 248 "parse-gram.y"
1866 { skeleton
= (yyvsp
[(2) - (2)].chars
); }
1870 #line 249 "parse-gram.y"
1871 { token_table_flag
= true; }
1875 #line 250 "parse-gram.y"
1876 { report_flag
= report_states
; }
1880 #line 251 "parse-gram.y"
1881 { yacc_flag
= true; }
1885 #line 259 "parse-gram.y"
1887 grammar_start_symbol_set ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)]));
1892 #line 263 "parse-gram.y"
1894 char const *body
= (yyvsp
[(1) - (1)].chars
);
1898 /* Concatenate the union bodies, turning the first one's
1899 trailing '}' into '\n', and omitting the second one's '{'. */
1900 char *code
= muscle_find ("stype");
1901 code
[strlen (code
) - 1] = '\n';
1906 muscle_code_grow ("stype", body
, (yylsp
[(1) - (1)]));
1911 #line 279 "parse-gram.y"
1914 for (list
= (yyvsp
[(2) - (2)].list
); list
; list
= list
->next
)
1915 symbol_destructor_set (list
->sym
, (yyvsp
[(1) - (2)].chars
), (yylsp
[(1) - (2)]));
1916 symbol_list_free ((yyvsp
[(2) - (2)].list
));
1921 #line 286 "parse-gram.y"
1924 for (list
= (yyvsp
[(2) - (2)].list
); list
; list
= list
->next
)
1925 symbol_printer_set (list
->sym
, (yyvsp
[(1) - (2)].chars
), (yylsp
[(1) - (2)]));
1926 symbol_list_free ((yyvsp
[(2) - (2)].list
));
1931 #line 293 "parse-gram.y"
1933 default_prec
= true;
1938 #line 297 "parse-gram.y"
1940 default_prec
= false;
1945 #line 303 "parse-gram.y"
1946 { current_class
= nterm_sym
; }
1950 #line 304 "parse-gram.y"
1952 current_class
= unknown_sym
;
1953 current_type
= NULL
;
1958 #line 308 "parse-gram.y"
1959 { current_class
= token_sym
; }
1963 #line 309 "parse-gram.y"
1965 current_class
= unknown_sym
;
1966 current_type
= NULL
;
1971 #line 314 "parse-gram.y"
1974 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
1975 symbol_type_set (list
->sym
, (yyvsp
[(2) - (3)].uniqstr
), (yylsp
[(2) - (3)]));
1976 symbol_list_free ((yyvsp
[(3) - (3)].list
));
1981 #line 324 "parse-gram.y"
1985 for (list
= (yyvsp
[(3) - (3)].list
); list
; list
= list
->next
)
1987 symbol_type_set (list
->sym
, current_type
, (yylsp
[(2) - (3)]));
1988 symbol_precedence_set (list
->sym
, current_prec
, (yyvsp
[(1) - (3)].assoc
), (yylsp
[(1) - (3)]));
1990 symbol_list_free ((yyvsp
[(3) - (3)].list
));
1991 current_type
= NULL
;
1996 #line 338 "parse-gram.y"
1997 { (yyval
.assoc
) = left_assoc
; }
2001 #line 339 "parse-gram.y"
2002 { (yyval
.assoc
) = right_assoc
; }
2006 #line 340 "parse-gram.y"
2007 { (yyval
.assoc
) = non_assoc
; }
2011 #line 344 "parse-gram.y"
2012 { current_type
= NULL
; }
2016 #line 345 "parse-gram.y"
2017 { current_type
= (yyvsp
[(1) - (1)].uniqstr
); }
2021 #line 351 "parse-gram.y"
2022 { (yyval
.list
) = symbol_list_new ((yyvsp
[(1) - (1)].symbol
), (yylsp
[(1) - (1)])); }
2026 #line 352 "parse-gram.y"
2027 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[(1) - (2)].list
), (yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2031 #line 358 "parse-gram.y"
2033 current_type
= (yyvsp
[(1) - (1)].uniqstr
);
2038 #line 362 "parse-gram.y"
2040 symbol_class_set ((yyvsp
[(1) - (1)].symbol
), current_class
, (yylsp
[(1) - (1)]), true);
2041 symbol_type_set ((yyvsp
[(1) - (1)].symbol
), current_type
, (yylsp
[(1) - (1)]));
2046 #line 367 "parse-gram.y"
2048 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2049 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2050 symbol_user_token_number_set ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].integer
), (yylsp
[(2) - (2)]));
2055 #line 373 "parse-gram.y"
2057 symbol_class_set ((yyvsp
[(1) - (2)].symbol
), current_class
, (yylsp
[(1) - (2)]), true);
2058 symbol_type_set ((yyvsp
[(1) - (2)].symbol
), current_type
, (yylsp
[(1) - (2)]));
2059 symbol_make_alias ((yyvsp
[(1) - (2)].symbol
), (yyvsp
[(2) - (2)].symbol
), (yyloc
));
2064 #line 379 "parse-gram.y"
2066 symbol_class_set ((yyvsp
[(1) - (3)].symbol
), current_class
, (yylsp
[(1) - (3)]), true);
2067 symbol_type_set ((yyvsp
[(1) - (3)].symbol
), current_type
, (yylsp
[(1) - (3)]));
2068 symbol_user_token_number_set ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(2) - (3)].integer
), (yylsp
[(2) - (3)]));
2069 symbol_make_alias ((yyvsp
[(1) - (3)].symbol
), (yyvsp
[(3) - (3)].symbol
), (yyloc
));
2074 #line 409 "parse-gram.y"
2081 #line 415 "parse-gram.y"
2082 { current_lhs
= (yyvsp
[(1) - (1)].symbol
); current_lhs_location
= (yylsp
[(1) - (1)]); }
2086 #line 419 "parse-gram.y"
2087 { grammar_current_rule_end ((yylsp
[(1) - (1)])); }
2091 #line 420 "parse-gram.y"
2092 { grammar_current_rule_end ((yylsp
[(3) - (3)])); }
2096 #line 426 "parse-gram.y"
2097 { grammar_current_rule_begin (current_lhs
, current_lhs_location
); }
2101 #line 428 "parse-gram.y"
2102 { grammar_current_rule_symbol_append ((yyvsp
[(2) - (2)].symbol
), (yylsp
[(2) - (2)])); }
2106 #line 431 "parse-gram.y"
2107 { grammar_current_rule_prec_set ((yyvsp
[(3) - (3)].symbol
), (yylsp
[(3) - (3)])); }
2111 #line 433 "parse-gram.y"
2112 { grammar_current_rule_dprec_set ((yyvsp
[(3) - (3)].integer
), (yylsp
[(3) - (3)])); }
2116 #line 435 "parse-gram.y"
2117 { grammar_current_rule_merge_set ((yyvsp
[(3) - (3)].uniqstr
), (yylsp
[(3) - (3)])); }
2121 #line 439 "parse-gram.y"
2122 { (yyval
.symbol
) = (yyvsp
[(1) - (1)].symbol
); }
2126 #line 440 "parse-gram.y"
2127 { (yyval
.symbol
) = (yyvsp
[(1) - (1)].symbol
); }
2131 #line 456 "parse-gram.y"
2132 { grammar_current_rule_action_append (last_string
, last_braced_code_loc
); }
2136 #line 463 "parse-gram.y"
2138 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[(1) - (1)].chars
)), (yylsp
[(1) - (1)]));
2139 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[(1) - (1)]), false);
2144 #line 472 "parse-gram.y"
2145 { (yyval
.chars
) = (yyvsp
[(1) - (1)].chars
); }
2149 #line 479 "parse-gram.y"
2151 muscle_code_grow ("epilogue", (yyvsp
[(2) - (2)].chars
), (yylsp
[(2) - (2)]));
2152 scanner_last_string_free ();
2157 /* Line 1267 of yacc.c. */
2158 #line 2159 "parse-gram.c"
2161 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2165 YY_STACK_PRINT (yyss
, yyssp
);
2170 /* Now `shift' the result of the reduction. Determine what state
2171 that goes to, based on the state we popped back to and the rule
2172 number reduced by. */
2176 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2177 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2178 yystate
= yytable
[yystate
];
2180 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2185 /*------------------------------------.
2186 | yyerrlab -- here on detecting error |
2187 `------------------------------------*/
2189 /* If not already recovering from an error, report this error. */
2193 #if ! YYERROR_VERBOSE
2194 yyerror (YY_("syntax error"));
2197 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2198 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2200 YYSIZE_T yyalloc
= 2 * yysize
;
2201 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2202 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2203 if (yymsg
!= yymsgbuf
)
2204 YYSTACK_FREE (yymsg
);
2205 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2207 yymsg_alloc
= yyalloc
;
2211 yymsg_alloc
= sizeof yymsgbuf
;
2215 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2217 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2222 yyerror (YY_("syntax error"));
2224 goto yyexhaustedlab
;
2230 yyerror_range
[0] = yylloc
;
2232 if (yyerrstatus
== 3)
2234 /* If just tried and failed to reuse look-ahead token after an
2235 error, discard it. */
2237 if (yychar
<= YYEOF
)
2239 /* Return failure if at end of input. */
2240 if (yychar
== YYEOF
)
2245 yydestruct ("Error: discarding",
2246 yytoken
, &yylval
, &yylloc
);
2251 /* Else will try to reuse look-ahead token after shifting the error
2256 /*---------------------------------------------------.
2257 | yyerrorlab -- error raised explicitly by YYERROR. |
2258 `---------------------------------------------------*/
2261 /* Pacify compilers like GCC when the user code never invokes
2262 YYERROR and the label yyerrorlab therefore never appears in user
2264 if (/*CONSTCOND*/ 0)
2267 yyerror_range
[0] = yylsp
[1-yylen
];
2268 /* Do not reclaim the symbols of the rule which action triggered
2272 YY_STACK_PRINT (yyss
, yyssp
);
2277 /*-------------------------------------------------------------.
2278 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2279 `-------------------------------------------------------------*/
2281 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2285 yyn
= yypact
[yystate
];
2286 if (yyn
!= YYPACT_NINF
)
2289 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2297 /* Pop the current state because it cannot handle the error token. */
2301 yyerror_range
[0] = *yylsp
;
2302 yydestruct ("Error: popping",
2303 yystos
[yystate
], yyvsp
, yylsp
);
2306 YY_STACK_PRINT (yyss
, yyssp
);
2314 yyerror_range
[1] = yylloc
;
2315 /* Using YYLLOC is tempting, but would change the location of
2316 the look-ahead. YYLOC is available though. */
2317 YYLLOC_DEFAULT (yyloc
, (yyerror_range
- 1), 2);
2320 /* Shift the error token. */
2321 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2327 /*-------------------------------------.
2328 | yyacceptlab -- YYACCEPT comes here. |
2329 `-------------------------------------*/
2334 /*-----------------------------------.
2335 | yyabortlab -- YYABORT comes here. |
2336 `-----------------------------------*/
2342 /*-------------------------------------------------.
2343 | yyexhaustedlab -- memory exhaustion comes here. |
2344 `-------------------------------------------------*/
2346 yyerror (YY_("memory exhausted"));
2352 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2353 yydestruct ("Cleanup: discarding lookahead",
2354 yytoken
, &yylval
, &yylloc
);
2355 /* Do not reclaim the symbols of the rule which action triggered
2356 this YYABORT or YYACCEPT. */
2358 YY_STACK_PRINT (yyss
, yyssp
);
2359 while (yyssp
!= yyss
)
2361 yydestruct ("Cleanup: popping",
2362 yystos
[*yyssp
], yyvsp
, yylsp
);
2367 YYSTACK_FREE (yyss
);
2370 if (yymsg
!= yymsgbuf
)
2371 YYSTACK_FREE (yymsg
);
2373 /* Make sure YYID is used. */
2374 return YYID (yyresult
);
2378 #line 485 "parse-gram.y"
2382 /* Return the location of the left-hand side of a rule whose
2383 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2384 the right-hand side, and return an empty location equal to the end
2385 boundary of RHS[0] if the right-hand side is empty. */
2388 lloc_default (YYLTYPE
const *rhs
, int n
)
2393 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2394 The bug is fixed in 7.4.2m, but play it safe for now. */
2395 loc
.start
= rhs
[n
].end
;
2396 loc
.end
= rhs
[n
].end
;
2398 /* Ignore empty nonterminals the start of the the right-hand side.
2399 Do not bother to ignore them at the end of the right-hand side,
2400 since empty nonterminals have the same end as their predecessors. */
2401 for (i
= 1; i
<= n
; i
++)
2402 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2404 loc
.start
= rhs
[i
].start
;
2412 /* Add a lex-param or a parse-param (depending on TYPE) with
2413 declaration DECL and location LOC. */
2416 add_param (char const *type
, char *decl
, location loc
)
2418 static char const alphanum
[26 + 26 + 1 + 10] =
2419 "abcdefghijklmnopqrstuvwxyz"
2420 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2423 char const *name_start
= NULL
;
2426 /* Stop on last actual character. */
2427 for (p
= decl
; p
[1]; p
++)
2429 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
2430 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
2433 /* Strip the surrounding '{' and '}', and any blanks just inside
2435 while (*--p
== ' ' || *p
== '\t')
2438 while (*++decl
== ' ' || *decl
== '\t')
2442 complain_at (loc
, _("missing identifier in parameter declaration"));
2449 memchr (alphanum
, name_start
[name_len
], sizeof alphanum
);
2453 name
= xmalloc (name_len
+ 1);
2454 memcpy (name
, name_start
, name_len
);
2455 name
[name_len
] = '\0';
2456 muscle_pair_list_grow (type
, decl
, name
);
2460 scanner_last_string_free ();
2464 version_check (location
const *loc
, char const *version
)
2466 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
2468 complain_at (*loc
, "require bison %s, but have %s",
2469 version
, PACKAGE_VERSION
);
2475 gram_error (location
const *loc
, char const *msg
)
2477 complain_at (*loc
, "%s", msg
);
2481 token_name (int type
)
2483 return yytname
[YYTRANSLATE (type
)];