1 /* A Bison parser, made by GNU Bison 2.7.987-a2db-dirty. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation,
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 3 of the License, or
11 (at your option) any later version.
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, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Identify Bison output. */
48 #define YYBISON_VERSION "2.7.987-a2db-dirty"
51 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the type names. */
63 #define YYSTYPE GRAM_STYPE
64 #define YYLTYPE GRAM_LTYPE
65 /* Substitute the variable and function names. */
66 #define yyparse gram_parse
67 #define yylex gram_lex
68 #define yyerror gram_error
69 #define yylval gram_lval
70 #define yychar gram_char
71 #define yydebug gram_debug
72 #define yynerrs gram_nerrs
73 #define yylloc gram_lloc
75 /* Copy the first part of user declarations. */
76 #line 1 "src/parse-gram.y" /* yacc.c:356 */
77 /* Bison Grammar Parser -*- C -*-
79 Copyright (C) 2002-2012 Free Software Foundation, Inc.
81 This file is part of Bison, the GNU Compiler Compiler.
83 This program is free software: you can redistribute it and/or modify
84 it under the terms of the GNU General Public License as published by
85 the Free Software Foundation, either version 3 of the License, or
86 (at your option) any later version.
88 This program is distributed in the hope that it will be useful,
89 but WITHOUT ANY WARRANTY; without even the implied warranty of
90 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91 GNU General Public License for more details.
93 You should have received a copy of the GNU General Public License
94 along with this program. If not, see <http://www.gnu.org/licenses/>. */
100 #include "complain.h"
101 #include "conflicts.h"
105 #include "muscle-tab.h"
106 #include "named-ref.h"
107 #include "quotearg.h"
111 #include "scan-gram.h"
112 #include "scan-code.h"
113 #include "xmemdup0.h"
115 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
116 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
118 #define YY_LOCATION_PRINT(File, Loc) \
119 location_print (File, Loc)
121 static void version_check (location
const *loc
, char const *version
);
123 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
124 FIXME: depends on the undocumented availability of YYLLOC. */
126 #define yyerror(Msg) \
127 gram_error (&yylloc, Msg)
128 static void gram_error (location
const *, char const *);
130 static char const *char_name (char);
132 #line 132 "src/parse-gram.c" /* yacc.c:356 */
135 # if defined __cplusplus && 201103L <= __cplusplus
136 # define YY_NULL nullptr
142 /* Enabling verbose error messages. */
143 #ifdef YYERROR_VERBOSE
144 # undef YYERROR_VERBOSE
145 # define YYERROR_VERBOSE 1
147 # define YYERROR_VERBOSE 1
150 /* In a future release of Bison, this section will be replaced
151 by #include "src/parse-gram.h". */
152 #ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
153 # define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
158 # define GRAM_DEBUG 1
160 # define GRAM_DEBUG 0
162 # else /* ! defined YYDEBUG */
163 # define GRAM_DEBUG 1
164 # endif /* ! defined YYDEBUG */
165 #endif /* ! defined GRAM_DEBUG */
167 extern int gram_debug
;
169 /* "%code requires" blocks. */
170 #line 223 "src/parse-gram.y" /* yacc.c:372 */
178 param_parse
= 1 << 1,
179 param_both
= param_lex
| param_parse
184 #line 184 "src/parse-gram.c" /* yacc.c:372 */
187 #ifndef GRAM_TOKENTYPE
188 # define GRAM_TOKENTYPE
197 PERCENT_DESTRUCTOR
= 263,
198 PERCENT_PRINTER
= 264,
201 PERCENT_NONASSOC
= 267,
202 PERCENT_PRECEDENCE
= 268,
207 PERCENT_DEFAULT_PREC
= 273,
208 PERCENT_DEFINE
= 274,
209 PERCENT_DEFINES
= 275,
210 PERCENT_ERROR_VERBOSE
= 276,
211 PERCENT_EXPECT
= 277,
212 PERCENT_EXPECT_RR
= 278,
214 PERCENT_FILE_PREFIX
= 280,
215 PERCENT_GLR_PARSER
= 281,
216 PERCENT_INITIAL_ACTION
= 282,
217 PERCENT_LANGUAGE
= 283,
218 PERCENT_NAME_PREFIX
= 284,
219 PERCENT_NO_DEFAULT_PREC
= 285,
220 PERCENT_NO_LINES
= 286,
221 PERCENT_NONDETERMINISTIC_PARSER
= 287,
222 PERCENT_OUTPUT
= 288,
223 PERCENT_REQUIRE
= 289,
224 PERCENT_SKELETON
= 290,
226 PERCENT_TOKEN_TABLE
= 292,
227 PERCENT_VERBOSE
= 293,
230 BRACED_PREDICATE
= 296,
237 PERCENT_PERCENT
= 303,
252 #define PERCENT_TOKEN 260
253 #define PERCENT_NTERM 261
254 #define PERCENT_TYPE 262
255 #define PERCENT_DESTRUCTOR 263
256 #define PERCENT_PRINTER 264
257 #define PERCENT_LEFT 265
258 #define PERCENT_RIGHT 266
259 #define PERCENT_NONASSOC 267
260 #define PERCENT_PRECEDENCE 268
261 #define PERCENT_PREC 269
262 #define PERCENT_DPREC 270
263 #define PERCENT_MERGE 271
264 #define PERCENT_CODE 272
265 #define PERCENT_DEFAULT_PREC 273
266 #define PERCENT_DEFINE 274
267 #define PERCENT_DEFINES 275
268 #define PERCENT_ERROR_VERBOSE 276
269 #define PERCENT_EXPECT 277
270 #define PERCENT_EXPECT_RR 278
271 #define PERCENT_FLAG 279
272 #define PERCENT_FILE_PREFIX 280
273 #define PERCENT_GLR_PARSER 281
274 #define PERCENT_INITIAL_ACTION 282
275 #define PERCENT_LANGUAGE 283
276 #define PERCENT_NAME_PREFIX 284
277 #define PERCENT_NO_DEFAULT_PREC 285
278 #define PERCENT_NO_LINES 286
279 #define PERCENT_NONDETERMINISTIC_PARSER 287
280 #define PERCENT_OUTPUT 288
281 #define PERCENT_REQUIRE 289
282 #define PERCENT_SKELETON 290
283 #define PERCENT_START 291
284 #define PERCENT_TOKEN_TABLE 292
285 #define PERCENT_VERBOSE 293
286 #define PERCENT_YACC 294
287 #define BRACED_CODE 295
288 #define BRACED_PREDICATE 296
289 #define BRACKETED_ID 297
295 #define PERCENT_PERCENT 303
298 #define SEMICOLON 306
302 #define PERCENT_PARAM 310
303 #define PERCENT_UNION 311
306 #if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
307 typedef union GRAM_STYPE GRAM_STYPE
;
310 #line 109 "src/parse-gram.y" /* yacc.c:372 */
316 named_ref
*named_ref
;
320 unsigned char character
;
322 #line 247 "src/parse-gram.y" /* yacc.c:372 */
326 #line 423 "src/parse-gram.y" /* yacc.c:372 */
327 code_props_type code_type
;
329 #line 329 "src/parse-gram.c" /* yacc.c:372 */
331 # define GRAM_STYPE_IS_TRIVIAL 1
332 # define GRAM_STYPE_IS_DECLARED 1
336 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
337 typedef struct GRAM_LTYPE GRAM_LTYPE
;
345 # define GRAM_LTYPE_IS_DECLARED 1
346 # define GRAM_LTYPE_IS_TRIVIAL 1
351 int gram_parse (void);
353 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
355 /* Copy the second part of user declarations. */
357 #line 357 "src/parse-gram.c" /* yacc.c:375 */
358 /* Unqualified %code blocks. */
359 #line 58 "src/parse-gram.y" /* yacc.c:376 */
361 static int current_prec
= 0;
362 static location current_lhs_location
;
363 static named_ref
*current_lhs_named_ref
;
364 static symbol
*current_lhs_symbol
;
365 static symbol_class current_class
= unknown_sym
;
366 static uniqstr current_type
= NULL
;
368 /** Set the new current left-hand side symbol, possibly common
369 * to several right-hand side parts of rule.
373 current_lhs(symbol
*sym
, location loc
, named_ref
*ref
)
375 current_lhs_symbol
= sym
;
376 current_lhs_location
= loc
;
377 /* In order to simplify memory management, named references for lhs
378 are always assigned by deep copy into the current symbol_list
379 node. This is because a single named-ref in the grammar may
380 result in several uses when the user factors lhs between several
381 rules using "|". Therefore free the parser's original copy. */
382 free (current_lhs_named_ref
);
383 current_lhs_named_ref
= ref
;
386 #define YYTYPE_INT16 int_fast16_t
387 #define YYTYPE_INT8 int_fast8_t
388 #define YYTYPE_UINT16 uint_fast16_t
389 #define YYTYPE_UINT8 uint_fast8_t
391 #line 236 "src/parse-gram.y" /* yacc.c:376 */
393 /** Add a lex-param and/or a parse-param.
395 * \param type where to push this formal argument.
396 * \param decl the formal argument. Destroyed.
397 * \param loc the location in the source.
399 static void add_param (param_type type
, char *decl
, location loc
);
400 static param_type current_param
= param_none
;
403 #line 403 "src/parse-gram.c" /* yacc.c:376 */
410 typedef YYTYPE_UINT8 yytype_uint8
;
412 typedef unsigned char yytype_uint8
;
416 typedef YYTYPE_INT8 yytype_int8
;
418 typedef signed char yytype_int8
;
422 typedef YYTYPE_UINT16 yytype_uint16
;
424 typedef unsigned short int yytype_uint16
;
428 typedef YYTYPE_INT16 yytype_int16
;
430 typedef short int yytype_int16
;
434 # ifdef __SIZE_TYPE__
435 # define YYSIZE_T __SIZE_TYPE__
436 # elif defined size_t
437 # define YYSIZE_T size_t
438 # elif ! defined YYSIZE_T
439 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
440 # define YYSIZE_T size_t
442 # define YYSIZE_T unsigned int
446 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
449 # if defined YYENABLE_NLS && YYENABLE_NLS
451 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
452 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
456 # define YY_(Msgid) Msgid
460 /* Suppress unused-variable warnings by "using" E. */
462 # define YYUSE(E) ((void) (E))
464 # define YYUSE(E) /* empty */
469 /* The parser invokes alloca or malloc; define the necessary symbols. */
471 # ifdef YYSTACK_ALLOC
472 /* Pacify GCC's `empty if-body' warning. */
473 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
474 # ifndef YYSTACK_ALLOC_MAXIMUM
475 /* The OS might guarantee only one guard page at the bottom of the stack,
476 and a page size can be as small as 4096 bytes. So we cannot safely
477 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
478 to allow for a few compiler-allocated temporary stack slots. */
479 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
482 # define YYSTACK_ALLOC YYMALLOC
483 # define YYSTACK_FREE YYFREE
484 # ifndef YYSTACK_ALLOC_MAXIMUM
485 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
487 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
488 && ! ((defined YYMALLOC || defined malloc) \
489 && (defined YYFREE || defined free)))
490 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
491 # ifndef EXIT_SUCCESS
492 # define EXIT_SUCCESS 0
496 # define YYMALLOC malloc
497 # if ! defined malloc && ! defined EXIT_SUCCESS
498 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
503 # if ! defined free && ! defined EXIT_SUCCESS
504 void free (void *); /* INFRINGES ON USER NAME SPACE */
508 # define YYCOPY_NEEDED 1
512 #if (! defined yyoverflow \
513 && (! defined __cplusplus \
514 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
515 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
517 /* A type that is properly aligned for any stack member. */
520 yytype_int16 yyss_alloc
;
525 /* The size of the maximum gap between one aligned stack and the next. */
526 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
528 /* The size of an array large to enough to hold all stacks, each with
530 # define YYSTACK_BYTES(N) \
531 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
532 + 2 * YYSTACK_GAP_MAXIMUM)
534 # define YYCOPY_NEEDED 1
536 /* Relocate STACK from its old location to the new one. The
537 local variables YYSIZE and YYSTACKSIZE give the old and new number of
538 elements in the stack, and YYPTR gives the new location of the
539 stack. Advance YYPTR to a properly aligned location for the next
541 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
544 YYSIZE_T yynewbytes; \
545 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
546 Stack = &yyptr->Stack_alloc; \
547 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
548 yyptr += yynewbytes / sizeof (*yyptr); \
554 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
555 /* Copy COUNT objects from SRC to DST. The source and destination do
558 # if defined __GNUC__ && 1 < __GNUC__
559 # define YYCOPY(Dst, Src, Count) \
560 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
562 # define YYCOPY(Dst, Src, Count) \
566 for (yyi = 0; yyi < (Count); yyi++) \
567 (Dst)[yyi] = (Src)[yyi]; \
572 #endif /* !YYCOPY_NEEDED */
574 /* YYFINAL -- State number of the termination state. */
576 /* YYLAST -- Last index in YYTABLE. */
579 /* YYNTOKENS -- Number of terminals. */
581 /* YYNNTS -- Number of nonterminals. */
583 /* YYNRULES -- Number of rules. */
585 /* YYNSTATES -- Number of states. */
586 #define YYNSTATES 143
588 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
589 by yylex, with out-of-bounds checking. */
591 #define YYMAXUTOK 311
593 #define YYTRANSLATE(YYX) \
594 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
596 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
597 as returned by yylex, without out-of-bounds checking. */
598 static const yytype_uint8 yytranslate
[] =
600 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
626 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
627 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
628 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
629 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
630 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
635 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
636 static const yytype_uint16 yyrline
[] =
638 0, 272, 272, 280, 282, 286, 287, 297, 301, 306,
639 307, 312, 317, 318, 319, 320, 325, 334, 335, 336,
640 337, 338, 339, 339, 340, 341, 365, 366, 367, 368,
641 372, 373, 382, 383, 384, 388, 400, 404, 408, 415,
642 426, 427, 437, 438, 442, 454, 454, 459, 459, 464,
643 475, 490, 491, 492, 493, 497, 498, 503, 505, 510,
644 511, 516, 518, 523, 524, 528, 529, 533, 534, 535,
645 540, 545, 550, 556, 562, 573, 574, 583, 584, 590,
646 591, 592, 599, 599, 607, 608, 609, 614, 616, 618,
647 620, 622, 624, 626, 631, 633, 643, 644, 649, 650,
648 651, 660, 680, 682, 691, 696, 697, 702, 709, 711
652 #if GRAM_DEBUG || YYERROR_VERBOSE || 1
653 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
654 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
655 static const char *const yytname
[] =
657 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
658 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
659 "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"",
660 "\"%precedence\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
661 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
662 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
663 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
664 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
665 "\"%nondeterministic-parser\"", "\"%output\"", "\"%require\"",
666 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
667 "\"%yacc\"", "\"{...}\"", "\"%?{...}\"", "\"[identifier]\"", "\"char\"",
668 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
669 "\"|\"", "\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"",
670 "\"%param\"", "\"%union\"", "$accept", "input", "prologue_declarations",
671 "prologue_declaration", "$@1", "params", "grammar_declaration",
672 "code_props_type", "union_name", "symbol_declaration", "$@2", "$@3",
673 "precedence_declaration", "precedence_declarator", "tag.opt",
674 "symbols.prec", "symbol.prec", "symbols.1", "generic_symlist",
675 "generic_symlist_item", "tag", "symbol_def", "symbol_defs.1", "grammar",
676 "rules_or_grammar_declaration", "rules", "$@4", "rhses.1", "rhs",
677 "named_ref.opt", "variable", "content.opt", "braceless", "id",
678 "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
683 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
684 (internal) symbol number NUM (which must be that of a token). */
685 static const yytype_uint16 yytoknum
[] =
687 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
688 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
689 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
690 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
691 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
692 305, 306, 307, 308, 309, 310, 311
696 #define YYPACT_NINF -74
698 #define yypact_value_is_default(Yystate) \
699 (!!((Yystate) == (-74)))
701 #define YYTABLE_NINF -109
703 #define yytable_value_is_error(Yytable_value) \
706 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
708 static const yytype_int16 yypact
[] =
710 -74, 40, 101, -74, -74, -74, -48, -74, -74, -74,
711 -74, -74, -74, 19, -74, 0, 52, -74, 56, 79,
712 -74, 81, -74, 45, 83, 84, -74, -74, -74, 85,
713 86, 87, 31, -74, -74, -74, 15, -74, -74, -74,
714 46, -74, -74, 51, -74, -74, 42, 4, 4, 31,
715 -74, 57, -74, -74, -74, 36, -74, -74, -74, -74,
716 -74, -74, -74, -74, -74, -74, -74, -74, -74, -74,
717 -74, -74, 47, -74, 49, 1, -74, -74, 59, 62,
718 -74, 57, 26, -74, 31, -74, -74, 4, 72, 4,
719 31, -74, -74, -74, -74, -74, -74, -74, 60, -74,
720 -74, -74, -74, -74, 63, -74, -74, -74, -74, 26,
721 -74, -74, -74, 31, -74, 111, -74, 113, -74, -74,
722 -74, -74, -74, -74, -74, -74, -74, -13, 27, -74,
723 -74, 31, 137, 65, 59, -74, 59, 27, -74, -74,
727 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
728 Performed when YYTABLE does not specify something else to do. Zero
729 means the default is an error. */
730 static const yytype_uint8 yydefact
[] =
732 3, 0, 0, 1, 47, 45, 0, 40, 41, 51,
733 52, 53, 54, 0, 36, 0, 9, 11, 0, 0,
734 7, 0, 15, 0, 0, 0, 37, 19, 20, 0,
735 0, 0, 0, 26, 27, 28, 0, 6, 29, 22,
736 42, 4, 5, 0, 33, 32, 55, 0, 0, 0,
737 101, 0, 38, 97, 96, 98, 10, 12, 13, 14,
738 16, 17, 18, 21, 24, 25, 107, 103, 102, 105,
739 34, 106, 0, 104, 0, 0, 77, 79, 94, 0,
740 43, 0, 0, 56, 0, 70, 75, 48, 71, 46,
741 49, 61, 39, 100, 99, 8, 81, 80, 0, 78,
742 2, 95, 82, 31, 23, 44, 67, 68, 69, 35,
743 63, 66, 65, 50, 57, 59, 76, 72, 73, 62,
744 109, 87, 30, 64, 58, 60, 74, 83, 84, 87,
745 86, 0, 0, 0, 94, 90, 94, 85, 91, 92,
749 /* YYPGOTO[NTERM-NUM]. */
750 static const yytype_int16 yypgoto
[] =
752 -74, -74, -74, -74, -74, -74, 140, -74, -74, -74,
753 -74, -74, -74, -74, -74, -74, 30, -74, -74, 35,
754 -74, -26, 97, -74, 71, -74, -74, -74, 18, -70,
755 -74, -74, -46, 6, -74, -32, -73, -74
758 /* YYDEFGOTO[NTERM-NUM]. */
759 static const yytype_int16 yydefgoto
[] =
761 -1, 1, 2, 41, 79, 104, 74, 43, 81, 44,
762 48, 47, 45, 46, 84, 113, 114, 90, 109, 110,
763 111, 86, 87, 75, 76, 77, 121, 127, 128, 102,
764 55, 95, 52, 69, 78, 112, 71, 100
767 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
768 positive, shift that token. If negative, reduce the rule whose
769 number is the opposite. If YYTABLE_NINF, syntax error. */
770 static const yytype_int16 yytable
[] =
772 70, -108, 72, 53, 49, 92, 4, 5, 6, 7,
773 8, 9, 10, 11, 12, 118, 72, 91, 13, 14,
774 4, 5, 6, 7, 8, 9, 10, 11, 12, 66,
775 66, 26, 13, 14, 66, 105, 129, 32, 130, 93,
776 3, 131, 132, 133, 126, 26, 54, 67, 73, 98,
777 68, 32, 115, 88, 88, 56, 85, 40, 119, 50,
778 57, 116, 73, 116, 141, 51, 142, 134, 135, 67,
779 67, 40, 68, 68, 67, 66, 117, 68, 106, 107,
780 108, 115, 94, 58, 59, 60, 61, 62, 63, 64,
781 65, 82, 80, 88, 83, 88, 136, 50, 96, 138,
782 97, 101, 103, 122, 120, 136, 4, 5, 6, 7,
783 8, 9, 10, 11, 12, 125, 66, 140, 13, 14,
784 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
785 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
786 35, 139, 42, 124, 123, 89, 99, 137, 0, 36,
787 0, 37, 38, 0, 0, 0, 39, 40
790 static const yytype_int16 yycheck
[] =
792 32, 0, 1, 3, 52, 51, 5, 6, 7, 8,
793 9, 10, 11, 12, 13, 88, 1, 49, 17, 18,
794 5, 6, 7, 8, 9, 10, 11, 12, 13, 3,
795 3, 30, 17, 18, 3, 81, 49, 36, 51, 3,
796 0, 14, 15, 16, 117, 30, 46, 43, 47, 48,
797 46, 36, 84, 47, 48, 3, 52, 56, 90, 40,
798 4, 87, 47, 89, 134, 46, 136, 40, 41, 43,
799 43, 56, 46, 46, 43, 3, 4, 46, 52, 53,
800 54, 113, 46, 4, 3, 40, 3, 3, 3, 3,
801 3, 40, 46, 87, 52, 89, 128, 40, 51, 131,
802 51, 42, 40, 40, 44, 137, 5, 6, 7, 8,
803 9, 10, 11, 12, 13, 4, 3, 52, 17, 18,
804 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
805 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
806 39, 4, 2, 113, 109, 48, 75, 129, -1, 48,
807 -1, 50, 51, -1, -1, -1, 55, 56
810 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
811 symbol of state STATE-NUM. */
812 static const yytype_uint8 yystos
[] =
814 0, 58, 59, 0, 5, 6, 7, 8, 9, 10,
815 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
816 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
817 34, 35, 36, 37, 38, 39, 48, 50, 51, 55,
818 56, 60, 63, 64, 66, 69, 70, 68, 67, 52,
819 40, 46, 89, 3, 46, 87, 3, 4, 4, 3,
820 40, 3, 3, 3, 3, 3, 3, 43, 46, 90,
821 92, 93, 1, 47, 63, 80, 81, 82, 91, 61,
822 46, 65, 40, 52, 71, 52, 78, 79, 90, 79,
823 74, 92, 89, 3, 46, 88, 51, 51, 48, 81,
824 94, 42, 86, 40, 62, 89, 52, 53, 54, 75,
825 76, 77, 92, 72, 73, 92, 78, 4, 93, 92,
826 44, 83, 40, 76, 73, 4, 93, 84, 85, 49,
827 51, 14, 15, 16, 40, 41, 92, 85, 92, 4,
831 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
832 static const yytype_uint8 yyr1
[] =
834 0, 57, 58, 59, 59, 60, 60, 60, 60, 60,
835 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
836 60, 60, 61, 60, 60, 60, 60, 60, 60, 60,
837 62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
838 64, 64, 65, 65, 63, 67, 66, 68, 66, 66,
839 69, 70, 70, 70, 70, 71, 71, 72, 72, 73,
840 73, 74, 74, 75, 75, 76, 76, 77, 77, 77,
841 78, 78, 78, 78, 78, 79, 79, 80, 80, 81,
842 81, 81, 83, 82, 84, 84, 84, 85, 85, 85,
843 85, 85, 85, 85, 86, 86, 87, 87, 88, 88,
844 88, 89, 90, 90, 91, 92, 92, 93, 94, 94
847 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
848 static const yytype_uint8 yyr2
[] =
850 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
851 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
852 1, 2, 0, 3, 2, 2, 1, 1, 1, 1,
853 2, 1, 1, 1, 2, 3, 1, 1, 2, 3,
854 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
855 3, 1, 1, 1, 1, 0, 1, 1, 2, 1,
856 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
857 1, 1, 2, 2, 3, 1, 2, 1, 2, 1,
858 2, 2, 0, 4, 1, 3, 2, 0, 3, 3,
859 2, 3, 3, 3, 0, 1, 1, 1, 0, 1,
860 1, 1, 1, 1, 1, 1, 1, 1, 0, 2
864 #define yyerrok (yyerrstatus = 0)
865 #define yyclearin (yychar = YYEMPTY)
869 #define YYACCEPT goto yyacceptlab
870 #define YYABORT goto yyabortlab
871 #define YYERROR goto yyerrorlab
874 #define YYRECOVERING() (!!yyerrstatus)
876 #define YYBACKUP(Token, Value) \
878 if (yychar == YYEMPTY) \
882 YYPOPSTACK (yylen); \
884 YY_LAC_DISCARD ("YYBACKUP"); \
889 yyerror (YY_("syntax error: cannot back up")); \
894 /* Error token number */
896 #define YYERRCODE 256
899 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
900 If N is 0, then set CURRENT to the empty location which ends
901 the previous symbol: RHS[0] (always defined). */
903 #ifndef YYLLOC_DEFAULT
904 # define YYLLOC_DEFAULT(Current, Rhs, N) \
908 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
909 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
910 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
911 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
915 (Current).first_line = (Current).last_line = \
916 YYRHSLOC (Rhs, 0).last_line; \
917 (Current).first_column = (Current).last_column = \
918 YYRHSLOC (Rhs, 0).last_column; \
923 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
926 /* YY_LOCATION_PRINT -- Print the location on the stream.
927 This macro was not mandated originally: define only if we know
928 we won't break user code: when these are the locations we know. */
930 #ifndef YY_LOCATION_PRINT
931 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
933 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
935 __attribute__((__unused__
))
937 yy_location_print_ (FILE *yyo
, YYLTYPE
const * const yylocp
)
940 int end_col
= 0 != yylocp
->last_column
? yylocp
->last_column
- 1 : 0;
941 if (0 <= yylocp
->first_line
)
943 res
+= fprintf (yyo
, "%d", yylocp
->first_line
);
944 if (0 <= yylocp
->first_column
)
945 res
+= fprintf (yyo
, ".%d", yylocp
->first_column
);
947 if (0 <= yylocp
->last_line
)
949 if (yylocp
->first_line
< yylocp
->last_line
)
951 res
+= fprintf (yyo
, "-%d", yylocp
->last_line
);
953 res
+= fprintf (yyo
, ".%d", end_col
);
955 else if (0 <= end_col
&& yylocp
->first_column
< end_col
)
956 res
+= fprintf (yyo
, "-%d", end_col
);
961 # define YY_LOCATION_PRINT(File, Loc) \
962 yy_location_print_ (File, &(Loc))
965 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
970 /* Enable debugging if requested. */
974 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
975 # define YYFPRINTF fprintf
978 # define YYDPRINTF(Args) \
984 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
988 YYFPRINTF (stderr, "%s ", Title); \
989 yy_symbol_print (stderr, \
990 Type, Value, Location); \
991 YYFPRINTF (stderr, "\n"); \
996 /*--------------------------------.
997 | Print this symbol on YYOUTPUT. |
998 `--------------------------------*/
1001 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1003 FILE *yyo
= yyoutput
;
1005 YYUSE (yylocationp
);
1009 if (yytype
< YYNTOKENS
)
1010 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1014 case 3: /* "string" */
1015 #line 196 "src/parse-gram.y" /* yacc.c:705 */
1016 { fputs (quotearg_style (c_quoting_style
, ((*yyvaluep
).chars
)), yyo
); }
1017 #line 1017 "src/parse-gram.c" /* yacc.c:705 */
1020 case 4: /* "integer" */
1021 #line 209 "src/parse-gram.y" /* yacc.c:705 */
1022 { fprintf (yyo
, "%d", ((*yyvaluep
).integer
)); }
1023 #line 1023 "src/parse-gram.c" /* yacc.c:705 */
1026 case 24: /* "%<flag>" */
1027 #line 205 "src/parse-gram.y" /* yacc.c:705 */
1028 { fprintf (yyo
, "%%%s", ((*yyvaluep
).uniqstr
)); }
1029 #line 1029 "src/parse-gram.c" /* yacc.c:705 */
1032 case 40: /* "{...}" */
1033 #line 198 "src/parse-gram.y" /* yacc.c:705 */
1034 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
1035 #line 1035 "src/parse-gram.c" /* yacc.c:705 */
1038 case 42: /* "[identifier]" */
1039 #line 203 "src/parse-gram.y" /* yacc.c:705 */
1040 { fprintf (yyo
, "[%s]", ((*yyvaluep
).uniqstr
)); }
1041 #line 1041 "src/parse-gram.c" /* yacc.c:705 */
1044 case 43: /* "char" */
1045 #line 190 "src/parse-gram.y" /* yacc.c:705 */
1046 { fputs (char_name (((*yyvaluep
).character
)), yyo
); }
1047 #line 1047 "src/parse-gram.c" /* yacc.c:705 */
1050 case 44: /* "epilogue" */
1051 #line 198 "src/parse-gram.y" /* yacc.c:705 */
1052 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1053 #line 1053 "src/parse-gram.c" /* yacc.c:705 */
1056 case 46: /* "identifier" */
1057 #line 202 "src/parse-gram.y" /* yacc.c:705 */
1058 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1059 #line 1059 "src/parse-gram.c" /* yacc.c:705 */
1062 case 47: /* "identifier:" */
1063 #line 204 "src/parse-gram.y" /* yacc.c:705 */
1064 { fprintf (yyo
, "%s:", ((*yyvaluep
).uniqstr
)); }
1065 #line 1065 "src/parse-gram.c" /* yacc.c:705 */
1068 case 50: /* "%{...%}" */
1069 #line 198 "src/parse-gram.y" /* yacc.c:705 */
1070 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1071 #line 1071 "src/parse-gram.c" /* yacc.c:705 */
1074 case 52: /* "<tag>" */
1075 #line 206 "src/parse-gram.y" /* yacc.c:705 */
1076 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1077 #line 1077 "src/parse-gram.c" /* yacc.c:705 */
1080 case 55: /* "%param" */
1081 #line 252 "src/parse-gram.y" /* yacc.c:705 */
1083 switch (((*yyvaluep
).param
))
1085 #define CASE(In, Out) \
1086 case param_ ## In: fputs ("%" #Out, stderr); break
1087 CASE(lex
, lex
-param
);
1088 CASE(parse
, parse
-param
);
1091 case param_none
: aver (false); break;
1094 #line 1094 "src/parse-gram.c" /* yacc.c:705 */
1097 case 64: /* code_props_type */
1098 #line 424 "src/parse-gram.y" /* yacc.c:705 */
1099 { fprintf (yyo
, "%s", code_props_type_string (((*yyvaluep
).code_type
))); }
1100 #line 1100 "src/parse-gram.c" /* yacc.c:705 */
1103 case 73: /* symbol.prec */
1104 #line 212 "src/parse-gram.y" /* yacc.c:705 */
1105 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1106 #line 1106 "src/parse-gram.c" /* yacc.c:705 */
1110 #line 206 "src/parse-gram.y" /* yacc.c:705 */
1111 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1112 #line 1112 "src/parse-gram.c" /* yacc.c:705 */
1115 case 87: /* variable */
1116 #line 202 "src/parse-gram.y" /* yacc.c:705 */
1117 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1118 #line 1118 "src/parse-gram.c" /* yacc.c:705 */
1121 case 88: /* content.opt */
1122 #line 198 "src/parse-gram.y" /* yacc.c:705 */
1123 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1124 #line 1124 "src/parse-gram.c" /* yacc.c:705 */
1127 case 89: /* braceless */
1128 #line 198 "src/parse-gram.y" /* yacc.c:705 */
1129 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1130 #line 1130 "src/parse-gram.c" /* yacc.c:705 */
1134 #line 212 "src/parse-gram.y" /* yacc.c:705 */
1135 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1136 #line 1136 "src/parse-gram.c" /* yacc.c:705 */
1139 case 91: /* id_colon */
1140 #line 213 "src/parse-gram.y" /* yacc.c:705 */
1141 { fprintf (yyo
, "%s:", ((*yyvaluep
).symbol
)->tag
); }
1142 #line 1142 "src/parse-gram.c" /* yacc.c:705 */
1145 case 92: /* symbol */
1146 #line 212 "src/parse-gram.y" /* yacc.c:705 */
1147 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1148 #line 1148 "src/parse-gram.c" /* yacc.c:705 */
1151 case 93: /* string_as_id */
1152 #line 212 "src/parse-gram.y" /* yacc.c:705 */
1153 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1154 #line 1154 "src/parse-gram.c" /* yacc.c:705 */
1163 /*--------------------------------.
1164 | Print this symbol on YYOUTPUT. |
1165 `--------------------------------*/
1168 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1170 if (yytype
< YYNTOKENS
)
1171 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1173 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1175 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1176 YYFPRINTF (yyoutput
, ": ");
1177 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1178 YYFPRINTF (yyoutput
, ")");
1181 /*------------------------------------------------------------------.
1182 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1184 `------------------------------------------------------------------*/
1187 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1189 YYFPRINTF (stderr
, "Stack now");
1190 for (; yybottom
<= yytop
; yybottom
++)
1192 int yybot
= *yybottom
;
1193 YYFPRINTF (stderr
, " %d", yybot
);
1195 YYFPRINTF (stderr
, "\n");
1198 # define YY_STACK_PRINT(Bottom, Top) \
1201 yy_stack_print ((Bottom), (Top)); \
1205 /*------------------------------------------------.
1206 | Report that the YYRULE is going to be reduced. |
1207 `------------------------------------------------*/
1210 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1212 unsigned long int yylno
= yyrline
[yyrule
];
1213 int yynrhs
= yyr2
[yyrule
];
1215 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1217 /* The symbols being reduced. */
1218 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1220 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1221 yy_symbol_print (stderr
,
1222 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1223 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1224 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1225 YYFPRINTF (stderr
, "\n");
1229 # define YY_REDUCE_PRINT(Rule) \
1232 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1235 /* Nonzero means print parse trace. It is left uninitialized so that
1236 multiple parsers can coexist. */
1238 #else /* !GRAM_DEBUG */
1239 # define YYDPRINTF(Args)
1240 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1241 # define YY_STACK_PRINT(Bottom, Top)
1242 # define YY_REDUCE_PRINT(Rule)
1243 #endif /* !GRAM_DEBUG */
1246 /* YYINITDEPTH -- initial size of the parser's stacks. */
1248 # define YYINITDEPTH 200
1251 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1252 if the built-in stack extension method is used).
1254 Do not make this value too large; the results are undefined if
1255 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1256 evaluated with infinite-precision integer arithmetic. */
1259 # define YYMAXDEPTH 10000
1262 /* Given a state stack such that *YYBOTTOM is its bottom, such that
1263 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1264 stack, and such that *YYCAPACITY is the maximum number of elements it
1265 can hold without a reallocation, make sure there is enough room to
1266 store YYADD more elements. If not, allocate a new stack using
1267 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1268 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1269 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1270 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1271 required. Return 1 if memory is exhausted. */
1273 yy_lac_stack_realloc (YYSIZE_T
*yycapacity
, YYSIZE_T yyadd
,
1275 char const *yydebug_prefix
,
1276 char const *yydebug_suffix
,
1278 yytype_int16
**yybottom
,
1279 yytype_int16
*yybottom_no_free
,
1280 yytype_int16
**yytop
, yytype_int16
*yytop_empty
)
1282 YYSIZE_T yysize_old
=
1283 *yytop
== yytop_empty
? 0 : *yytop
- *yybottom
+ 1;
1284 YYSIZE_T yysize_new
= yysize_old
+ yyadd
;
1285 if (*yycapacity
< yysize_new
)
1287 YYSIZE_T yyalloc
= 2 * yysize_new
;
1288 yytype_int16
*yybottom_new
;
1289 /* Use YYMAXDEPTH for maximum stack size given that the stack
1290 should never need to grow larger than the main state stack
1291 needs to grow without LAC. */
1292 if (YYMAXDEPTH
< yysize_new
)
1294 YYDPRINTF ((stderr
, "%smax size exceeded%s", yydebug_prefix
,
1298 if (YYMAXDEPTH
< yyalloc
)
1299 yyalloc
= YYMAXDEPTH
;
1301 (yytype_int16
*) YYSTACK_ALLOC (yyalloc
* sizeof *yybottom_new
);
1304 YYDPRINTF ((stderr
, "%srealloc failed%s", yydebug_prefix
,
1308 if (*yytop
!= yytop_empty
)
1310 YYCOPY (yybottom_new
, *yybottom
, yysize_old
);
1311 *yytop
= yybottom_new
+ (yysize_old
- 1);
1313 if (*yybottom
!= yybottom_no_free
)
1314 YYSTACK_FREE (*yybottom
);
1315 *yybottom
= yybottom_new
;
1316 *yycapacity
= yyalloc
;
1321 /* Establish the initial context for the current lookahead if no initial
1322 context is currently established.
1324 We define a context as a snapshot of the parser stacks. We define
1325 the initial context for a lookahead as the context in which the
1326 parser initially examines that lookahead in order to select a
1327 syntactic action. Thus, if the lookahead eventually proves
1328 syntactically unacceptable (possibly in a later context reached via a
1329 series of reductions), the initial context can be used to determine
1330 the exact set of tokens that would be syntactically acceptable in the
1331 lookahead's place. Moreover, it is the context after which any
1332 further semantic actions would be erroneous because they would be
1333 determined by a syntactically unacceptable token.
1335 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1336 performed in an inconsistent state (which, for the purposes of LAC,
1337 includes consistent states that don't know they're consistent because
1338 their default reductions have been disabled). Iff there is a
1339 lookahead token, it should also be invoked before reporting a syntax
1340 error. This latter case is for the sake of the debugging output.
1342 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1343 follows. If no initial context is currently established for the
1344 current lookahead, then check if that lookahead can eventually be
1345 shifted if syntactic actions continue from the current context.
1346 Report a syntax error if it cannot. */
1347 #define YY_LAC_ESTABLISH \
1349 if (!yy_lac_established) \
1351 YYDPRINTF ((stderr, \
1352 "LAC: initial context established for %s\n", \
1353 yytname[yytoken])); \
1354 yy_lac_established = 1; \
1356 int yy_lac_status = \
1357 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1358 if (yy_lac_status == 2) \
1359 goto yyexhaustedlab; \
1360 if (yy_lac_status == 1) \
1366 /* Discard any previous initial lookahead context because of Event,
1367 which may be a lookahead change or an invalidation of the currently
1368 established initial context for the current lookahead.
1370 The most common example of a lookahead change is a shift. An example
1371 of both cases is syntax error recovery. That is, a syntax error
1372 occurs when the lookahead is syntactically erroneous for the
1373 currently established initial context, so error recovery manipulates
1374 the parser stacks to try to find a new initial context in which the
1375 current lookahead is syntactically acceptable. If it fails to find
1376 such a context, it discards the lookahead. */
1378 # define YY_LAC_DISCARD(Event) \
1380 if (yy_lac_established) \
1383 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1385 yy_lac_established = 0; \
1389 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1392 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1393 eventually (after perhaps some reductions) be shifted, return 1 if
1394 not, or return 2 if memory is exhausted. As preconditions and
1395 postconditions: *YYES_CAPACITY is the allocated size of the array to
1396 which *YYES points, and either *YYES = YYESA or *YYES points to an
1397 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1398 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1399 any old *YYES other than YYESA. */
1401 yy_lac (yytype_int16
*yyesa
, yytype_int16
**yyes
,
1402 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1404 yytype_int16
*yyes_prev
= yyssp
;
1405 yytype_int16
*yyesp
= yyes_prev
;
1406 YYDPRINTF ((stderr
, "LAC: checking lookahead %s:", yytname
[yytoken
]));
1407 if (yytoken
== YYUNDEFTOK
)
1409 YYDPRINTF ((stderr
, " Always Err\n"));
1414 int yyrule
= yypact
[*yyesp
];
1415 if (yypact_value_is_default (yyrule
)
1416 || (yyrule
+= yytoken
) < 0 || YYLAST
< yyrule
1417 || yycheck
[yyrule
] != yytoken
)
1419 yyrule
= yydefact
[*yyesp
];
1422 YYDPRINTF ((stderr
, " Err\n"));
1428 yyrule
= yytable
[yyrule
];
1429 if (yytable_value_is_error (yyrule
))
1431 YYDPRINTF ((stderr
, " Err\n"));
1436 YYDPRINTF ((stderr
, " S%d\n", yyrule
));
1442 YYSIZE_T yylen
= yyr2
[yyrule
];
1443 YYDPRINTF ((stderr
, " R%d", yyrule
- 1));
1444 if (yyesp
!= yyes_prev
)
1446 YYSIZE_T yysize
= yyesp
- *yyes
+ 1;
1459 yyesp
= yyes_prev
-= yylen
;
1464 int yylhs
= yyr1
[yyrule
] - YYNTOKENS
;
1465 yystate
= yypgoto
[yylhs
] + *yyesp
;
1466 if (yystate
< 0 || YYLAST
< yystate
1467 || yycheck
[yystate
] != *yyesp
)
1468 yystate
= yydefgoto
[yylhs
];
1470 yystate
= yytable
[yystate
];
1472 if (yyesp
== yyes_prev
)
1479 if (yy_lac_stack_realloc (yyes_capacity
, 1,
1483 yyes
, yyesa
, &yyesp
, yyes_prev
))
1485 YYDPRINTF ((stderr
, "\n"));
1490 YYDPRINTF ((stderr
, " G%d", yystate
));
1499 # if defined __GLIBC__ && defined _STRING_H
1500 # define yystrlen strlen
1502 /* Return the length of YYSTR. */
1504 yystrlen (const char *yystr
)
1507 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1515 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1516 # define yystpcpy stpcpy
1518 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1521 yystpcpy (char *yydest
, const char *yysrc
)
1524 const char *yys
= yysrc
;
1526 while ((*yyd
++ = *yys
++) != '\0')
1535 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1536 quotes and backslashes, so that it's suitable for yyerror. The
1537 heuristic is that double-quoting is unnecessary unless the string
1538 contains an apostrophe, a comma, or backslash (other than
1539 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1540 null, do not copy; instead, return the length of what the result
1543 yytnamerr (char *yyres
, const char *yystr
)
1548 char const *yyp
= yystr
;
1555 goto do_not_strip_quotes
;
1559 goto do_not_strip_quotes
;
1572 do_not_strip_quotes
: ;
1576 return yystrlen (yystr
);
1578 return yystpcpy (yyres
, yystr
) - yyres
;
1582 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1583 about the unexpected token YYTOKEN for the state stack whose top is
1584 YYSSP. In order to see if a particular token T is a
1585 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1587 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1588 not large enough to hold the message. In that case, also set
1589 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1590 required number of bytes is too large to store or if
1591 yy_lac returned 2. */
1593 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1594 yytype_int16
*yyesa
, yytype_int16
**yyes
,
1595 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1597 YYSIZE_T yysize0
= yytnamerr (YY_NULL
, yytname
[yytoken
]);
1598 YYSIZE_T yysize
= yysize0
;
1599 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1600 /* Internationalized format string. */
1601 const char *yyformat
= YY_NULL
;
1602 /* Arguments of yyformat. */
1603 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1604 /* Number of reported tokens (one for the "unexpected", one per
1608 /* There are many possibilities here to consider:
1609 - If this state is a consistent state with a default action, then
1610 the only way this function was invoked is if the default action
1611 is an error action. In that case, don't check for expected
1612 tokens because there are none.
1613 - The only way there can be no lookahead present (in yychar) is if
1614 this state is a consistent state with a default action. Thus,
1615 detecting the absence of a lookahead is sufficient to determine
1616 that there is no unexpected or expected token to report. In that
1617 case, just report a simple "syntax error".
1618 - Don't assume there isn't a lookahead just because this state is a
1619 consistent state with a default action. There might have been a
1620 previous inconsistent state, consistent state with a non-default
1621 action, or user semantic action that manipulated yychar.
1622 In the first two cases, it might appear that the current syntax
1623 error should have been detected in the previous state when yy_lac
1624 was invoked. However, at that time, there might have been a
1625 different syntax error that discarded a different initial context
1626 during error recovery, leaving behind the current lookahead.
1628 if (yytoken
!= YYEMPTY
)
1630 int yyn
= yypact
[*yyssp
];
1631 YYDPRINTF ((stderr
, "Constructing syntax error message\n"));
1632 yyarg
[yycount
++] = yytname
[yytoken
];
1633 if (!yypact_value_is_default (yyn
))
1637 for (yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1638 if (yyx
!= YYTERROR
&& yyx
!= YYUNDEFTOK
)
1641 int yy_lac_status
= yy_lac (yyesa
, yyes
, yyes_capacity
,
1643 if (yy_lac_status
== 2)
1645 if (yy_lac_status
== 1)
1648 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1654 yyarg
[yycount
++] = yytname
[yyx
];
1656 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULL
, yytname
[yyx
]);
1657 if (! (yysize
<= yysize1
1658 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1666 YYFPRINTF (stderr
, "No expected tokens.\n");
1672 # define YYCASE_(N, S) \
1676 YYCASE_(0, YY_("syntax error"));
1677 YYCASE_(1, YY_("syntax error, unexpected %s"));
1678 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1679 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1680 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1681 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1686 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1687 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1692 if (*yymsg_alloc
< yysize
)
1694 *yymsg_alloc
= 2 * yysize
;
1695 if (! (yysize
<= *yymsg_alloc
1696 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1697 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1701 /* Avoid sprintf, as that infringes on the user's name space.
1702 Don't have undefined behavior even if the translation
1703 produced a string with the wrong number of "%s"s. */
1707 while ((*yyp
= *yyformat
) != '\0')
1708 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1710 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1721 #endif /* YYERROR_VERBOSE */
1723 /*-----------------------------------------------.
1724 | Release the memory associated to this symbol. |
1725 `-----------------------------------------------*/
1728 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1731 YYUSE (yylocationp
);
1734 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1753 /* The lookahead symbol. */
1757 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1758 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1759 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1760 _Pragma ("GCC diagnostic push") \
1761 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1762 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1763 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1764 _Pragma ("GCC diagnostic pop")
1766 /* Default value used for initialization, for pacifying older GCCs
1767 or non-GCC compilers. */
1768 static YYSTYPE yyval_default
;
1769 # define YY_INITIAL_VALUE(Value) = Value
1771 static YYLTYPE yyloc_default
1772 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1776 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1777 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1778 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1780 #ifndef YY_INITIAL_VALUE
1781 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1784 /* The semantic value of the lookahead symbol. */
1785 YYSTYPE yylval
YY_INITIAL_VALUE(yyval_default
);
1787 /* Location data for the lookahead symbol. */
1788 YYLTYPE yylloc
= yyloc_default
;
1791 /* Number of syntax errors so far. */
1795 /* Number of tokens to shift before error messages enabled. */
1798 /* The stacks and their tools:
1799 `yyss': related to states.
1800 `yyvs': related to semantic values.
1801 `yyls': related to locations.
1803 Refer to the stacks through separate pointers, to allow yyoverflow
1804 to reallocate them elsewhere. */
1806 /* The state stack. */
1807 yytype_int16 yyssa
[YYINITDEPTH
];
1809 yytype_int16
*yyssp
;
1811 /* The semantic value stack. */
1812 YYSTYPE yyvsa
[YYINITDEPTH
];
1816 /* The location stack. */
1817 YYLTYPE yylsa
[YYINITDEPTH
];
1821 /* The locations where the error started and ended. */
1822 YYLTYPE yyerror_range
[3];
1824 YYSIZE_T yystacksize
;
1826 yytype_int16 yyesa
[20];
1828 YYSIZE_T yyes_capacity
;
1830 int yy_lac_established
= 0;
1833 /* Lookahead token as an internal (translated) token number. */
1835 /* The variables used to return semantic value and location from the
1841 /* Buffer for error messages, and its allocated size. */
1843 char *yymsg
= yymsgbuf
;
1844 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1847 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1849 /* The number of symbols on the RHS of the reduced rule.
1850 Keep to zero when no symbol should be popped. */
1853 yyssp
= yyss
= yyssa
;
1854 yyvsp
= yyvs
= yyvsa
;
1855 yylsp
= yyls
= yylsa
;
1856 yystacksize
= YYINITDEPTH
;
1859 yyes_capacity
= sizeof yyesa
/ sizeof *yyes
;
1860 if (YYMAXDEPTH
< yyes_capacity
)
1861 yyes_capacity
= YYMAXDEPTH
;
1863 YYDPRINTF ((stderr
, "Starting parse\n"));
1868 yychar
= YYEMPTY
; /* Cause a token to be read. */
1870 /* User initialization code. */
1871 #line 101 "src/parse-gram.y" /* yacc.c:1450 */
1873 /* Bison's grammar can initial empty locations, hence a default
1874 location is needed. */
1875 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1876 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1878 #line 1878 "src/parse-gram.c" /* yacc.c:1450 */
1882 /*------------------------------------------------------------.
1883 | yynewstate -- Push a new state, which is found in yystate. |
1884 `------------------------------------------------------------*/
1886 /* In all cases, when you get here, the value and location stacks
1887 have just been pushed. So pushing a state here evens the stacks. */
1893 if (yyss
+ yystacksize
- 1 <= yyssp
)
1895 /* Get the current used size of the three stacks, in elements. */
1896 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1900 /* Give user a chance to reallocate the stack. Use copies of
1901 these so that the &'s don't force the real ones into
1903 YYSTYPE
*yyvs1
= yyvs
;
1904 yytype_int16
*yyss1
= yyss
;
1905 YYLTYPE
*yyls1
= yyls
;
1907 /* Each stack pointer address is followed by the size of the
1908 data in use in that stack, in bytes. This used to be a
1909 conditional around just the two extra args, but that might
1910 be undefined if yyoverflow is a macro. */
1911 yyoverflow (YY_("memory exhausted"),
1912 &yyss1
, yysize
* sizeof (*yyssp
),
1913 &yyvs1
, yysize
* sizeof (*yyvsp
),
1914 &yyls1
, yysize
* sizeof (*yylsp
),
1921 #else /* no yyoverflow */
1922 # ifndef YYSTACK_RELOCATE
1923 goto yyexhaustedlab
;
1925 /* Extend the stack our own way. */
1926 if (YYMAXDEPTH
<= yystacksize
)
1927 goto yyexhaustedlab
;
1929 if (YYMAXDEPTH
< yystacksize
)
1930 yystacksize
= YYMAXDEPTH
;
1933 yytype_int16
*yyss1
= yyss
;
1934 union yyalloc
*yyptr
=
1935 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1937 goto yyexhaustedlab
;
1938 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1939 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1940 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1941 # undef YYSTACK_RELOCATE
1943 YYSTACK_FREE (yyss1
);
1946 #endif /* no yyoverflow */
1948 yyssp
= yyss
+ yysize
- 1;
1949 yyvsp
= yyvs
+ yysize
- 1;
1950 yylsp
= yyls
+ yysize
- 1;
1952 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1953 (unsigned long int) yystacksize
));
1955 if (yyss
+ yystacksize
- 1 <= yyssp
)
1959 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1961 if (yystate
== YYFINAL
)
1971 /* Do appropriate processing given the current state. Read a
1972 lookahead token if we need one and don't already have one. */
1974 /* First try to decide what to do without reference to lookahead token. */
1975 yyn
= yypact
[yystate
];
1976 if (yypact_value_is_default (yyn
))
1979 /* Not known => get a lookahead token if don't already have one. */
1981 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1982 if (yychar
== YYEMPTY
)
1984 YYDPRINTF ((stderr
, "Reading a token: "));
1985 yychar
= yylex (&yylval
, &yylloc
);
1988 if (yychar
<= YYEOF
)
1990 yychar
= yytoken
= YYEOF
;
1991 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1995 yytoken
= YYTRANSLATE (yychar
);
1996 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1999 /* If the proper action on seeing token YYTOKEN is to reduce or to
2000 detect an error, take that action. */
2002 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
2010 if (yytable_value_is_error (yyn
))
2017 /* Count tokens shifted since error; after three, turn off error
2022 /* Shift the lookahead token. */
2023 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
2025 /* Discard the shifted token. */
2027 YY_LAC_DISCARD ("shift");
2030 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2032 YY_IGNORE_MAYBE_UNINITIALIZED_END
2037 /*-----------------------------------------------------------.
2038 | yydefault -- do the default action for the current state. |
2039 `-----------------------------------------------------------*/
2041 yyn
= yydefact
[yystate
];
2047 /*-----------------------------.
2048 | yyreduce -- Do a reduction. |
2049 `-----------------------------*/
2051 /* yyn is the number of a rule to reduce with. */
2054 /* If YYLEN is nonzero, implement the default value of the action:
2057 Otherwise, the following line sets YYVAL to garbage.
2058 This behavior is undocumented and Bison
2059 users should not rely upon it. Assigning to YYVAL
2060 unconditionally makes the parser a bit smaller, and it avoids a
2061 GCC warning that YYVAL may be used uninitialized. */
2062 yyval
= yyvsp
[1-yylen
];
2064 /* Default location. */
2065 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2066 YY_REDUCE_PRINT (yyn
);
2068 int yychar_backup
= yychar
;
2072 #line 288 "src/parse-gram.y" /* yacc.c:1667 */
2074 code_props plain_code
;
2075 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2076 code_props_translate_code (&plain_code
);
2077 gram_scanner_last_string_free ();
2078 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
2079 plain_code
.code
, (yylsp
[0]));
2080 code_scanner_last_string_free ();
2082 #line 2082 "src/parse-gram.c" /* yacc.c:1667 */
2086 #line 298 "src/parse-gram.y" /* yacc.c:1667 */
2088 muscle_percent_define_ensure ((yyvsp
[0].uniqstr
), (yylsp
[0]), true);
2090 #line 2090 "src/parse-gram.c" /* yacc.c:1667 */
2094 #line 302 "src/parse-gram.y" /* yacc.c:1667 */
2096 muscle_percent_define_insert ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
),
2097 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2099 #line 2099 "src/parse-gram.c" /* yacc.c:1667 */
2103 #line 306 "src/parse-gram.y" /* yacc.c:1667 */
2104 { defines_flag
= true; }
2105 #line 2105 "src/parse-gram.c" /* yacc.c:1667 */
2109 #line 308 "src/parse-gram.y" /* yacc.c:1667 */
2111 defines_flag
= true;
2112 spec_defines_file
= xstrdup ((yyvsp
[0].chars
));
2114 #line 2114 "src/parse-gram.c" /* yacc.c:1667 */
2118 #line 313 "src/parse-gram.y" /* yacc.c:1667 */
2120 muscle_percent_define_insert ("parse.error", (yylsp
[0]), "verbose",
2121 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2123 #line 2123 "src/parse-gram.c" /* yacc.c:1667 */
2127 #line 317 "src/parse-gram.y" /* yacc.c:1667 */
2128 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
2129 #line 2129 "src/parse-gram.c" /* yacc.c:1667 */
2133 #line 318 "src/parse-gram.y" /* yacc.c:1667 */
2134 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
2135 #line 2135 "src/parse-gram.c" /* yacc.c:1667 */
2139 #line 319 "src/parse-gram.y" /* yacc.c:1667 */
2140 { spec_file_prefix
= (yyvsp
[0].chars
); }
2141 #line 2141 "src/parse-gram.c" /* yacc.c:1667 */
2145 #line 321 "src/parse-gram.y" /* yacc.c:1667 */
2147 nondeterministic_parser
= true;
2150 #line 2150 "src/parse-gram.c" /* yacc.c:1667 */
2154 #line 326 "src/parse-gram.y" /* yacc.c:1667 */
2157 code_props_symbol_action_init (&action
, (yyvsp
[0].code
), (yylsp
[0]));
2158 code_props_translate_code (&action
);
2159 gram_scanner_last_string_free ();
2160 muscle_code_grow ("initial_action", action
.code
, (yylsp
[0]));
2161 code_scanner_last_string_free ();
2163 #line 2163 "src/parse-gram.c" /* yacc.c:1667 */
2167 #line 334 "src/parse-gram.y" /* yacc.c:1667 */
2168 { language_argmatch ((yyvsp
[0].chars
), grammar_prio
, (yylsp
[-1])); }
2169 #line 2169 "src/parse-gram.c" /* yacc.c:1667 */
2173 #line 335 "src/parse-gram.y" /* yacc.c:1667 */
2174 { spec_name_prefix
= (yyvsp
[0].chars
); }
2175 #line 2175 "src/parse-gram.c" /* yacc.c:1667 */
2179 #line 336 "src/parse-gram.y" /* yacc.c:1667 */
2180 { no_lines_flag
= true; }
2181 #line 2181 "src/parse-gram.c" /* yacc.c:1667 */
2185 #line 337 "src/parse-gram.y" /* yacc.c:1667 */
2186 { nondeterministic_parser
= true; }
2187 #line 2187 "src/parse-gram.c" /* yacc.c:1667 */
2191 #line 338 "src/parse-gram.y" /* yacc.c:1667 */
2192 { spec_outfile
= (yyvsp
[0].chars
); }
2193 #line 2193 "src/parse-gram.c" /* yacc.c:1667 */
2197 #line 339 "src/parse-gram.y" /* yacc.c:1667 */
2198 { current_param
= (yyvsp
[0].param
); }
2199 #line 2199 "src/parse-gram.c" /* yacc.c:1667 */
2203 #line 339 "src/parse-gram.y" /* yacc.c:1667 */
2204 { current_param
= param_none
; }
2205 #line 2205 "src/parse-gram.c" /* yacc.c:1667 */
2209 #line 340 "src/parse-gram.y" /* yacc.c:1667 */
2210 { version_check (&(yylsp
[0]), (yyvsp
[0].chars
)); }
2211 #line 2211 "src/parse-gram.c" /* yacc.c:1667 */
2215 #line 342 "src/parse-gram.y" /* yacc.c:1667 */
2217 char const *skeleton_user
= (yyvsp
[0].chars
);
2218 if (strchr (skeleton_user
, '/'))
2220 size_t dir_length
= strlen (current_file
);
2221 char *skeleton_build
;
2222 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2224 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2227 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2230 memcpy (skeleton_build
, current_file
, dir_length
);
2231 skeleton_build
[dir_length
++] = '/';
2233 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2234 skeleton_user
= uniqstr_new (skeleton_build
);
2235 free (skeleton_build
);
2237 skeleton_arg (skeleton_user
, grammar_prio
, (yylsp
[-1]));
2239 #line 2239 "src/parse-gram.c" /* yacc.c:1667 */
2243 #line 365 "src/parse-gram.y" /* yacc.c:1667 */
2244 { token_table_flag
= true; }
2245 #line 2245 "src/parse-gram.c" /* yacc.c:1667 */
2249 #line 366 "src/parse-gram.y" /* yacc.c:1667 */
2250 { report_flag
|= report_states
; }
2251 #line 2251 "src/parse-gram.c" /* yacc.c:1667 */
2255 #line 367 "src/parse-gram.y" /* yacc.c:1667 */
2256 { yacc_flag
= true; }
2257 #line 2257 "src/parse-gram.c" /* yacc.c:1667 */
2261 #line 372 "src/parse-gram.y" /* yacc.c:1667 */
2262 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2263 #line 2263 "src/parse-gram.c" /* yacc.c:1667 */
2267 #line 373 "src/parse-gram.y" /* yacc.c:1667 */
2268 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2269 #line 2269 "src/parse-gram.c" /* yacc.c:1667 */
2273 #line 385 "src/parse-gram.y" /* yacc.c:1667 */
2275 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
2277 #line 2277 "src/parse-gram.c" /* yacc.c:1667 */
2281 #line 389 "src/parse-gram.y" /* yacc.c:1667 */
2284 code_props_symbol_action_init (&code
, (yyvsp
[-1].code
), (yylsp
[-1]));
2285 code_props_translate_code (&code
);
2288 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2289 symbol_list_code_props_set (list
, (yyvsp
[-2].code_type
), &code
);
2290 symbol_list_free ((yyvsp
[0].list
));
2293 #line 2293 "src/parse-gram.c" /* yacc.c:1667 */
2297 #line 401 "src/parse-gram.y" /* yacc.c:1667 */
2299 default_prec
= true;
2301 #line 2301 "src/parse-gram.c" /* yacc.c:1667 */
2305 #line 405 "src/parse-gram.y" /* yacc.c:1667 */
2307 default_prec
= false;
2309 #line 2309 "src/parse-gram.c" /* yacc.c:1667 */
2313 #line 409 "src/parse-gram.y" /* yacc.c:1667 */
2315 /* Do not invoke muscle_percent_code_grow here since it invokes
2316 muscle_user_name_list_grow. */
2317 muscle_code_grow ("percent_code()", (yyvsp
[0].chars
), (yylsp
[0]));
2318 code_scanner_last_string_free ();
2320 #line 2320 "src/parse-gram.c" /* yacc.c:1667 */
2324 #line 416 "src/parse-gram.y" /* yacc.c:1667 */
2326 muscle_percent_code_grow ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
), (yylsp
[0]));
2327 code_scanner_last_string_free ();
2329 #line 2329 "src/parse-gram.c" /* yacc.c:1667 */
2333 #line 426 "src/parse-gram.y" /* yacc.c:1667 */
2334 { (yyval
.code_type
) = destructor
; }
2335 #line 2335 "src/parse-gram.c" /* yacc.c:1667 */
2339 #line 427 "src/parse-gram.y" /* yacc.c:1667 */
2340 { (yyval
.code_type
) = printer
; }
2341 #line 2341 "src/parse-gram.c" /* yacc.c:1667 */
2345 #line 437 "src/parse-gram.y" /* yacc.c:1667 */
2347 #line 2347 "src/parse-gram.c" /* yacc.c:1667 */
2351 #line 438 "src/parse-gram.y" /* yacc.c:1667 */
2352 { muscle_code_grow ("union_name", (yyvsp
[0].uniqstr
), (yylsp
[0])); }
2353 #line 2353 "src/parse-gram.c" /* yacc.c:1667 */
2357 #line 443 "src/parse-gram.y" /* yacc.c:1667 */
2360 muscle_code_grow ("stype", (yyvsp
[0].chars
), (yylsp
[0]));
2361 code_scanner_last_string_free ();
2363 #line 2363 "src/parse-gram.c" /* yacc.c:1667 */
2367 #line 454 "src/parse-gram.y" /* yacc.c:1667 */
2368 { current_class
= nterm_sym
; }
2369 #line 2369 "src/parse-gram.c" /* yacc.c:1667 */
2373 #line 455 "src/parse-gram.y" /* yacc.c:1667 */
2375 current_class
= unknown_sym
;
2376 current_type
= NULL
;
2378 #line 2378 "src/parse-gram.c" /* yacc.c:1667 */
2382 #line 459 "src/parse-gram.y" /* yacc.c:1667 */
2383 { current_class
= token_sym
; }
2384 #line 2384 "src/parse-gram.c" /* yacc.c:1667 */
2388 #line 460 "src/parse-gram.y" /* yacc.c:1667 */
2390 current_class
= unknown_sym
;
2391 current_type
= NULL
;
2393 #line 2393 "src/parse-gram.c" /* yacc.c:1667 */
2397 #line 465 "src/parse-gram.y" /* yacc.c:1667 */
2401 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2402 symbol_type_set (list
->content
.sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
2403 symbol_list_free ((yyvsp
[0].list
));
2405 #line 2405 "src/parse-gram.c" /* yacc.c:1667 */
2409 #line 476 "src/parse-gram.y" /* yacc.c:1667 */
2413 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2415 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[-1]));
2416 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
2418 symbol_list_free ((yyvsp
[0].list
));
2419 current_type
= NULL
;
2421 #line 2421 "src/parse-gram.c" /* yacc.c:1667 */
2425 #line 490 "src/parse-gram.y" /* yacc.c:1667 */
2426 { (yyval
.assoc
) = left_assoc
; }
2427 #line 2427 "src/parse-gram.c" /* yacc.c:1667 */
2431 #line 491 "src/parse-gram.y" /* yacc.c:1667 */
2432 { (yyval
.assoc
) = right_assoc
; }
2433 #line 2433 "src/parse-gram.c" /* yacc.c:1667 */
2437 #line 492 "src/parse-gram.y" /* yacc.c:1667 */
2438 { (yyval
.assoc
) = non_assoc
; }
2439 #line 2439 "src/parse-gram.c" /* yacc.c:1667 */
2443 #line 493 "src/parse-gram.y" /* yacc.c:1667 */
2444 { (yyval
.assoc
) = precedence_assoc
; }
2445 #line 2445 "src/parse-gram.c" /* yacc.c:1667 */
2449 #line 497 "src/parse-gram.y" /* yacc.c:1667 */
2450 { current_type
= NULL
; }
2451 #line 2451 "src/parse-gram.c" /* yacc.c:1667 */
2455 #line 498 "src/parse-gram.y" /* yacc.c:1667 */
2456 { current_type
= (yyvsp
[0].uniqstr
); tag_seen
= true; }
2457 #line 2457 "src/parse-gram.c" /* yacc.c:1667 */
2461 #line 504 "src/parse-gram.y" /* yacc.c:1667 */
2462 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2463 #line 2463 "src/parse-gram.c" /* yacc.c:1667 */
2467 #line 506 "src/parse-gram.y" /* yacc.c:1667 */
2468 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2469 #line 2469 "src/parse-gram.c" /* yacc.c:1667 */
2473 #line 510 "src/parse-gram.y" /* yacc.c:1667 */
2474 { (yyval
.symbol
) = (yyvsp
[0].symbol
); }
2475 #line 2475 "src/parse-gram.c" /* yacc.c:1667 */
2479 #line 511 "src/parse-gram.y" /* yacc.c:1667 */
2480 { (yyval
.symbol
) = (yyvsp
[-1].symbol
); symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0])); }
2481 #line 2481 "src/parse-gram.c" /* yacc.c:1667 */
2485 #line 517 "src/parse-gram.y" /* yacc.c:1667 */
2486 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2487 #line 2487 "src/parse-gram.c" /* yacc.c:1667 */
2491 #line 519 "src/parse-gram.y" /* yacc.c:1667 */
2492 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2493 #line 2493 "src/parse-gram.c" /* yacc.c:1667 */
2497 #line 523 "src/parse-gram.y" /* yacc.c:1667 */
2498 { (yyval
.list
) = (yyvsp
[0].list
); }
2499 #line 2499 "src/parse-gram.c" /* yacc.c:1667 */
2503 #line 524 "src/parse-gram.y" /* yacc.c:1667 */
2504 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[-1].list
), (yyvsp
[0].list
)); }
2505 #line 2505 "src/parse-gram.c" /* yacc.c:1667 */
2509 #line 528 "src/parse-gram.y" /* yacc.c:1667 */
2510 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2511 #line 2511 "src/parse-gram.c" /* yacc.c:1667 */
2515 #line 529 "src/parse-gram.y" /* yacc.c:1667 */
2516 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2517 #line 2517 "src/parse-gram.c" /* yacc.c:1667 */
2521 #line 534 "src/parse-gram.y" /* yacc.c:1667 */
2522 { (yyval
.uniqstr
) = uniqstr_new ("*"); }
2523 #line 2523 "src/parse-gram.c" /* yacc.c:1667 */
2527 #line 535 "src/parse-gram.y" /* yacc.c:1667 */
2528 { (yyval
.uniqstr
) = uniqstr_new (""); }
2529 #line 2529 "src/parse-gram.c" /* yacc.c:1667 */
2533 #line 541 "src/parse-gram.y" /* yacc.c:1667 */
2535 current_type
= (yyvsp
[0].uniqstr
);
2538 #line 2538 "src/parse-gram.c" /* yacc.c:1667 */
2542 #line 546 "src/parse-gram.y" /* yacc.c:1667 */
2544 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]), true);
2545 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
2547 #line 2547 "src/parse-gram.c" /* yacc.c:1667 */
2551 #line 551 "src/parse-gram.y" /* yacc.c:1667 */
2553 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2554 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2555 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2557 #line 2557 "src/parse-gram.c" /* yacc.c:1667 */
2561 #line 557 "src/parse-gram.y" /* yacc.c:1667 */
2563 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2564 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2565 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2567 #line 2567 "src/parse-gram.c" /* yacc.c:1667 */
2571 #line 563 "src/parse-gram.y" /* yacc.c:1667 */
2573 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]), true);
2574 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
2575 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
2576 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2578 #line 2578 "src/parse-gram.c" /* yacc.c:1667 */
2582 #line 593 "src/parse-gram.y" /* yacc.c:1667 */
2586 #line 2586 "src/parse-gram.c" /* yacc.c:1667 */
2590 #line 599 "src/parse-gram.y" /* yacc.c:1667 */
2591 { current_lhs ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2592 #line 2592 "src/parse-gram.c" /* yacc.c:1667 */
2596 #line 600 "src/parse-gram.y" /* yacc.c:1667 */
2598 /* Free the current lhs. */
2599 current_lhs (0, (yylsp
[-3]), 0);
2601 #line 2601 "src/parse-gram.c" /* yacc.c:1667 */
2605 #line 607 "src/parse-gram.y" /* yacc.c:1667 */
2606 { grammar_current_rule_end ((yylsp
[0])); }
2607 #line 2607 "src/parse-gram.c" /* yacc.c:1667 */
2611 #line 608 "src/parse-gram.y" /* yacc.c:1667 */
2612 { grammar_current_rule_end ((yylsp
[0])); }
2613 #line 2613 "src/parse-gram.c" /* yacc.c:1667 */
2617 #line 614 "src/parse-gram.y" /* yacc.c:1667 */
2618 { grammar_current_rule_begin (current_lhs_symbol
, current_lhs_location
,
2619 current_lhs_named_ref
); }
2620 #line 2620 "src/parse-gram.c" /* yacc.c:1667 */
2624 #line 617 "src/parse-gram.y" /* yacc.c:1667 */
2625 { grammar_current_rule_symbol_append ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2626 #line 2626 "src/parse-gram.c" /* yacc.c:1667 */
2630 #line 619 "src/parse-gram.y" /* yacc.c:1667 */
2631 { grammar_current_rule_action_append ((yyvsp
[-1].code
), (yylsp
[-1]), (yyvsp
[0].named_ref
), false); }
2632 #line 2632 "src/parse-gram.c" /* yacc.c:1667 */
2636 #line 621 "src/parse-gram.y" /* yacc.c:1667 */
2637 { grammar_current_rule_action_append ((yyvsp
[0].code
), (yylsp
[0]), NULL
, true); }
2638 #line 2638 "src/parse-gram.c" /* yacc.c:1667 */
2642 #line 623 "src/parse-gram.y" /* yacc.c:1667 */
2643 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2644 #line 2644 "src/parse-gram.c" /* yacc.c:1667 */
2648 #line 625 "src/parse-gram.y" /* yacc.c:1667 */
2649 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2650 #line 2650 "src/parse-gram.c" /* yacc.c:1667 */
2654 #line 627 "src/parse-gram.y" /* yacc.c:1667 */
2655 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2656 #line 2656 "src/parse-gram.c" /* yacc.c:1667 */
2660 #line 631 "src/parse-gram.y" /* yacc.c:1667 */
2661 { (yyval
.named_ref
) = 0; }
2662 #line 2662 "src/parse-gram.c" /* yacc.c:1667 */
2666 #line 633 "src/parse-gram.y" /* yacc.c:1667 */
2667 { (yyval
.named_ref
) = named_ref_new((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2668 #line 2668 "src/parse-gram.c" /* yacc.c:1667 */
2672 #line 644 "src/parse-gram.y" /* yacc.c:1667 */
2673 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[0].chars
)); }
2674 #line 2674 "src/parse-gram.c" /* yacc.c:1667 */
2678 #line 649 "src/parse-gram.y" /* yacc.c:1667 */
2679 { (yyval
.chars
) = ""; }
2680 #line 2680 "src/parse-gram.c" /* yacc.c:1667 */
2684 #line 650 "src/parse-gram.y" /* yacc.c:1667 */
2685 { (yyval
.chars
) = (yyvsp
[0].uniqstr
); }
2686 #line 2686 "src/parse-gram.c" /* yacc.c:1667 */
2690 #line 661 "src/parse-gram.y" /* yacc.c:1667 */
2692 code_props plain_code
;
2693 (yyvsp
[0].code
)[strlen ((yyvsp
[0].code
)) - 1] = '\n';
2694 code_props_plain_init (&plain_code
, (yyvsp
[0].code
)+1, (yylsp
[0]));
2695 code_props_translate_code (&plain_code
);
2696 gram_scanner_last_string_free ();
2697 (yyval
.chars
) = plain_code
.code
;
2699 #line 2699 "src/parse-gram.c" /* yacc.c:1667 */
2703 #line 681 "src/parse-gram.y" /* yacc.c:1667 */
2704 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2705 #line 2705 "src/parse-gram.c" /* yacc.c:1667 */
2709 #line 683 "src/parse-gram.y" /* yacc.c:1667 */
2711 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[0].character
)), (yylsp
[0]));
2712 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2713 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[0].character
), (yylsp
[0]));
2715 #line 2715 "src/parse-gram.c" /* yacc.c:1667 */
2719 #line 691 "src/parse-gram.y" /* yacc.c:1667 */
2720 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2721 #line 2721 "src/parse-gram.c" /* yacc.c:1667 */
2725 #line 703 "src/parse-gram.y" /* yacc.c:1667 */
2727 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].chars
)), (yylsp
[0]));
2728 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2730 #line 2730 "src/parse-gram.c" /* yacc.c:1667 */
2734 #line 712 "src/parse-gram.y" /* yacc.c:1667 */
2736 code_props plain_code
;
2737 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2738 code_props_translate_code (&plain_code
);
2739 gram_scanner_last_string_free ();
2740 muscle_code_grow ("epilogue", plain_code
.code
, (yylsp
[0]));
2741 code_scanner_last_string_free ();
2743 #line 2743 "src/parse-gram.c" /* yacc.c:1667 */
2747 #line 2747 "src/parse-gram.c" /* yacc.c:1667 */
2750 if (yychar_backup
!= yychar
)
2751 YY_LAC_DISCARD ("yychar change");
2753 /* User semantic actions sometimes alter yychar, and that requires
2754 that yytoken be updated with the new translation. We take the
2755 approach of translating immediately before every use of yytoken.
2756 One alternative is translating here after every semantic action,
2757 but that translation would be missed if the semantic action invokes
2758 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2759 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2760 incorrect destructor might then be invoked immediately. In the
2761 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2762 to an incorrect destructor call or verbose syntax error message
2763 before the lookahead is translated. */
2764 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2768 YY_STACK_PRINT (yyss
, yyssp
);
2773 /* Now `shift' the result of the reduction. Determine what state
2774 that goes to, based on the state we popped back to and the rule
2775 number reduced by. */
2779 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2780 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2781 yystate
= yytable
[yystate
];
2783 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2788 /*--------------------------------------.
2789 | yyerrlab -- here on detecting error. |
2790 `--------------------------------------*/
2792 /* Make sure we have latest lookahead translation. See comments at
2793 user semantic actions for why this is necessary. */
2794 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2796 /* If not already recovering from an error, report this error. */
2800 #if ! YYERROR_VERBOSE
2801 yyerror (YY_("syntax error"));
2803 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2804 yyesa, &yyes, &yyes_capacity, \
2807 char const *yymsgp
= YY_("syntax error");
2808 int yysyntax_error_status
;
2809 if (yychar
!= YYEMPTY
)
2811 yysyntax_error_status
= YYSYNTAX_ERROR
;
2812 if (yysyntax_error_status
== 0)
2814 else if (yysyntax_error_status
== 1)
2816 if (yymsg
!= yymsgbuf
)
2817 YYSTACK_FREE (yymsg
);
2818 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2822 yymsg_alloc
= sizeof yymsgbuf
;
2823 yysyntax_error_status
= 2;
2827 yysyntax_error_status
= YYSYNTAX_ERROR
;
2832 if (yysyntax_error_status
== 2)
2833 goto yyexhaustedlab
;
2835 # undef YYSYNTAX_ERROR
2839 yyerror_range
[1] = yylloc
;
2841 if (yyerrstatus
== 3)
2843 /* If just tried and failed to reuse lookahead token after an
2844 error, discard it. */
2846 if (yychar
<= YYEOF
)
2848 /* Return failure if at end of input. */
2849 if (yychar
== YYEOF
)
2854 yydestruct ("Error: discarding",
2855 yytoken
, &yylval
, &yylloc
);
2860 /* Else will try to reuse lookahead token after shifting the error
2865 /*---------------------------------------------------.
2866 | yyerrorlab -- error raised explicitly by YYERROR. |
2867 `---------------------------------------------------*/
2870 /* Pacify compilers like GCC when the user code never invokes
2871 YYERROR and the label yyerrorlab therefore never appears in user
2873 if (/*CONSTCOND*/ 0)
2876 yyerror_range
[1] = yylsp
[1-yylen
];
2877 /* Do not reclaim the symbols of the rule whose action triggered
2881 YY_STACK_PRINT (yyss
, yyssp
);
2886 /*-------------------------------------------------------------.
2887 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2888 `-------------------------------------------------------------*/
2890 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2894 yyn
= yypact
[yystate
];
2895 if (!yypact_value_is_default (yyn
))
2898 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2906 /* Pop the current state because it cannot handle the error token. */
2910 yyerror_range
[1] = *yylsp
;
2911 yydestruct ("Error: popping",
2912 yystos
[yystate
], yyvsp
, yylsp
);
2915 YY_STACK_PRINT (yyss
, yyssp
);
2918 /* If the stack popping above didn't lose the initial context for the
2919 current lookahead token, the shift below will for sure. */
2920 YY_LAC_DISCARD ("error recovery");
2922 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2924 YY_IGNORE_MAYBE_UNINITIALIZED_END
2926 yyerror_range
[2] = yylloc
;
2927 /* Using YYLLOC is tempting, but would change the location of
2928 the lookahead. YYLOC is available though. */
2929 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
2932 /* Shift the error token. */
2933 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2939 /*-------------------------------------.
2940 | yyacceptlab -- YYACCEPT comes here. |
2941 `-------------------------------------*/
2946 /*-----------------------------------.
2947 | yyabortlab -- YYABORT comes here. |
2948 `-----------------------------------*/
2954 /*-------------------------------------------------.
2955 | yyexhaustedlab -- memory exhaustion comes here. |
2956 `-------------------------------------------------*/
2958 yyerror (YY_("memory exhausted"));
2964 if (yychar
!= YYEMPTY
)
2966 /* Make sure we have latest lookahead translation. See comments at
2967 user semantic actions for why this is necessary. */
2968 yytoken
= YYTRANSLATE (yychar
);
2969 yydestruct ("Cleanup: discarding lookahead",
2970 yytoken
, &yylval
, &yylloc
);
2972 /* Do not reclaim the symbols of the rule whose action triggered
2973 this YYABORT or YYACCEPT. */
2975 YY_STACK_PRINT (yyss
, yyssp
);
2976 while (yyssp
!= yyss
)
2978 yydestruct ("Cleanup: popping",
2979 yystos
[*yyssp
], yyvsp
, yylsp
);
2984 YYSTACK_FREE (yyss
);
2987 YYSTACK_FREE (yyes
);
2989 if (yymsg
!= yymsgbuf
)
2990 YYSTACK_FREE (yymsg
);
2994 #line 722 "src/parse-gram.y" /* yacc.c:1927 */
2997 /* Return the location of the left-hand side of a rule whose
2998 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2999 the right-hand side, and return an empty location equal to the end
3000 boundary of RHS[0] if the right-hand side is empty. */
3003 lloc_default (YYLTYPE
const *rhs
, int n
)
3008 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
3009 The bug is fixed in 7.4.2m, but play it safe for now. */
3010 loc
.start
= rhs
[n
].end
;
3011 loc
.end
= rhs
[n
].end
;
3013 /* Ignore empty nonterminals the start of the right-hand side.
3014 Do not bother to ignore them at the end of the right-hand side,
3015 since empty nonterminals have the same end as their predecessors. */
3016 for (i
= 1; i
<= n
; i
++)
3017 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
3019 loc
.start
= rhs
[i
].start
;
3028 add_param (param_type type
, char *decl
, location loc
)
3030 static char const alphanum
[26 + 26 + 1 + 10] =
3031 "abcdefghijklmnopqrstuvwxyz"
3032 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3036 char const *name_start
= NULL
;
3039 /* Stop on last actual character. */
3040 for (p
= decl
; p
[1]; p
++)
3042 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
3043 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
3046 /* Strip the surrounding '{' and '}', and any blanks just inside
3049 while (c_isspace ((unsigned char) *p
))
3053 while (c_isspace ((unsigned char) *decl
))
3058 complain (&loc
, complaint
, _("missing identifier in parameter declaration"));
3061 char *name
= xmemdup0 (name_start
, strspn (name_start
, alphanum
));
3062 if (type
& param_lex
)
3063 muscle_pair_list_grow ("lex_param", decl
, name
);
3064 if (type
& param_parse
)
3065 muscle_pair_list_grow ("parse_param", decl
, name
);
3069 gram_scanner_last_string_free ();
3074 version_check (location
const *loc
, char const *version
)
3076 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
3078 complain (loc
, complaint
, "require bison %s, but have %s",
3079 version
, PACKAGE_VERSION
);
3085 gram_error (location
const *loc
, char const *msg
)
3087 complain (loc
, complaint
, "%s", msg
);
3091 token_name (int type
)
3093 return yytname
[YYTRANSLATE (type
)];
3104 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
3105 return quotearg_style (escape_quoting_style
, buf
);