1 /* A Bison parser, made by GNU Bison 3.0. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2014 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 "3.0"
51 #define YYSKELETON_NAME "yacc.c"
62 /* "%code top" blocks. */
63 #line 27 "src/parse-gram.y" /* yacc.c:316 */
65 /* On column 0 to please syntax-check. */
68 #line 68 "src/parse-gram.c" /* yacc.c:316 */
69 /* Substitute the type names. */
70 #define YYSTYPE GRAM_STYPE
71 #define YYLTYPE GRAM_LTYPE
72 /* Substitute the variable and function names. */
73 #define yyparse gram_parse
74 #define yylex gram_lex
75 #define yyerror gram_error
76 #define yydebug gram_debug
77 #define yynerrs gram_nerrs
80 /* Copy the first part of user declarations. */
82 #line 82 "src/parse-gram.c" /* yacc.c:339 */
85 # if defined __cplusplus && 201103L <= __cplusplus
86 # define YY_NULLPTR nullptr
92 /* Enabling verbose error messages. */
93 #ifdef YYERROR_VERBOSE
94 # undef YYERROR_VERBOSE
95 # define YYERROR_VERBOSE 1
97 # define YYERROR_VERBOSE 1
100 /* In a future release of Bison, this section will be replaced
101 by #include "src/parse-gram.h". */
102 #ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
103 # define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
108 # define GRAM_DEBUG 1
110 # define GRAM_DEBUG 0
112 # else /* ! defined YYDEBUG */
113 # define GRAM_DEBUG 1
114 # endif /* ! defined YYDEBUG */
115 #endif /* ! defined GRAM_DEBUG */
117 extern int gram_debug
;
119 /* "%code requires" blocks. */
120 #line 21 "src/parse-gram.y" /* yacc.c:355 */
124 #line 221 "src/parse-gram.y" /* yacc.c:355 */
130 param_parse
= 1 << 1,
131 param_both
= param_lex
| param_parse
133 #line 645 "src/parse-gram.y" /* yacc.c:355 */
134 #include "muscle-tab.h"
136 #line 136 "src/parse-gram.c" /* yacc.c:355 */
139 #ifndef GRAM_TOKENTYPE
140 # define GRAM_TOKENTYPE
148 PERCENT_DESTRUCTOR
= 262,
149 PERCENT_PRINTER
= 263,
152 PERCENT_NONASSOC
= 266,
153 PERCENT_PRECEDENCE
= 267,
158 PERCENT_DEFAULT_PREC
= 272,
159 PERCENT_DEFINE
= 273,
160 PERCENT_DEFINES
= 274,
161 PERCENT_ERROR_VERBOSE
= 275,
162 PERCENT_EXPECT
= 276,
163 PERCENT_EXPECT_RR
= 277,
165 PERCENT_FILE_PREFIX
= 279,
166 PERCENT_GLR_PARSER
= 280,
167 PERCENT_INITIAL_ACTION
= 281,
168 PERCENT_LANGUAGE
= 282,
169 PERCENT_NAME_PREFIX
= 283,
170 PERCENT_NO_DEFAULT_PREC
= 284,
171 PERCENT_NO_LINES
= 285,
172 PERCENT_NONDETERMINISTIC_PARSER
= 286,
173 PERCENT_OUTPUT
= 287,
174 PERCENT_REQUIRE
= 288,
175 PERCENT_SKELETON
= 289,
177 PERCENT_TOKEN_TABLE
= 291,
178 PERCENT_VERBOSE
= 292,
181 BRACED_PREDICATE
= 295,
188 PERCENT_PERCENT
= 302,
203 #if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
204 typedef union GRAM_STYPE GRAM_STYPE
;
207 #line 182 "src/parse-gram.y" /* yacc.c:355 */
208 unsigned char character
;
209 #line 186 "src/parse-gram.y" /* yacc.c:355 */
211 #line 191 "src/parse-gram.y" /* yacc.c:355 */
213 #line 199 "src/parse-gram.y" /* yacc.c:355 */
215 #line 203 "src/parse-gram.y" /* yacc.c:355 */
217 #line 208 "src/parse-gram.y" /* yacc.c:355 */
219 #line 211 "src/parse-gram.y" /* yacc.c:355 */
221 #line 214 "src/parse-gram.y" /* yacc.c:355 */
222 named_ref
*named_ref
;
223 #line 241 "src/parse-gram.y" /* yacc.c:355 */
225 #line 409 "src/parse-gram.y" /* yacc.c:355 */
226 code_props_type code_type
;
227 #line 647 "src/parse-gram.y" /* yacc.c:355 */
235 #line 235 "src/parse-gram.c" /* yacc.c:355 */
237 # define GRAM_STYPE_IS_TRIVIAL 1
238 # define GRAM_STYPE_IS_DECLARED 1
242 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
243 typedef struct GRAM_LTYPE GRAM_LTYPE
;
251 # define GRAM_LTYPE_IS_DECLARED 1
252 # define GRAM_LTYPE_IS_TRIVIAL 1
257 int gram_parse (void);
259 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
261 /* Copy the second part of user declarations. */
263 #line 263 "src/parse-gram.c" /* yacc.c:358 */
264 /* Unqualified %code blocks. */
265 #line 33 "src/parse-gram.y" /* yacc.c:359 */
270 #include "complain.h"
271 #include "conflicts.h"
275 #include "named-ref.h"
276 #include "quotearg.h"
278 #include "scan-gram.h"
279 #include "scan-code.h"
280 #include "xmemdup0.h"
282 static int current_prec
= 0;
283 static location current_lhs_location
;
284 static named_ref
*current_lhs_named_ref
;
285 static symbol
*current_lhs_symbol
;
286 static symbol_class current_class
= unknown_sym
;
287 static uniqstr current_type
= NULL
;
289 /** Set the new current left-hand side symbol, possibly common
290 * to several right-hand side parts of rule.
292 static void current_lhs (symbol
*sym
, location loc
, named_ref
*ref
);
294 #define YYLLOC_DEFAULT(Current, Rhs, N) \
295 (Current) = lloc_default (Rhs, N)
296 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
298 #define YY_LOCATION_PRINT(File, Loc) \
299 location_print (Loc, File)
301 /* Strip initial '{' and final '}' (must be first and last characters).
302 Return the result. */
303 static char *strip_braces (char *code
);
305 /* Convert CODE by calling code_props_plain_init if PLAIN, otherwise
306 code_props_symbol_action_init. Call
307 gram_scanner_last_string_free to release the latest string from
308 the scanner (should be CODE). */
309 static char const *translate_code (char *code
, location loc
, bool plain
);
311 /* Convert CODE by calling code_props_plain_init after having
312 stripped the first and last characters (expected to be '{', and
313 '}'). Call gram_scanner_last_string_free to release the latest
314 string from the scanner (should be CODE). */
315 static char const *translate_code_braceless (char *code
, location loc
);
317 static void version_check (location
const *loc
, char const *version
);
319 static void gram_error (location
const *, char const *);
321 /* A string that describes a char (e.g., 'a' -> "'a'"). */
322 static char const *char_name (char);
324 #define YYTYPE_INT16 int_fast16_t
325 #define YYTYPE_INT8 int_fast8_t
326 #define YYTYPE_UINT16 uint_fast16_t
327 #define YYTYPE_UINT8 uint_fast8_t
328 #line 231 "src/parse-gram.y" /* yacc.c:359 */
330 /** Add a lex-param and/or a parse-param.
332 * \param type where to push this formal argument.
333 * \param decl the formal argument. Destroyed.
334 * \param loc the location in the source.
336 static void add_param (param_type type
, char *decl
, location loc
);
337 static param_type current_param
= param_none
;
339 #line 339 "src/parse-gram.c" /* yacc.c:359 */
346 typedef YYTYPE_UINT8 yytype_uint8
;
348 typedef unsigned char yytype_uint8
;
352 typedef YYTYPE_INT8 yytype_int8
;
354 typedef signed char yytype_int8
;
358 typedef YYTYPE_UINT16 yytype_uint16
;
360 typedef unsigned short int yytype_uint16
;
364 typedef YYTYPE_INT16 yytype_int16
;
366 typedef short int yytype_int16
;
370 # ifdef __SIZE_TYPE__
371 # define YYSIZE_T __SIZE_TYPE__
372 # elif defined size_t
373 # define YYSIZE_T size_t
374 # elif ! defined YYSIZE_T
375 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
376 # define YYSIZE_T size_t
378 # define YYSIZE_T unsigned int
382 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
385 # if defined YYENABLE_NLS && YYENABLE_NLS
387 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
388 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
392 # define YY_(Msgid) Msgid
396 #ifndef __attribute__
397 /* This feature is available in gcc versions 2.5 and later. */
398 # if (! defined __GNUC__ || __GNUC__ < 2 \
399 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
400 # define __attribute__(Spec) /* empty */
404 /* Suppress unused-variable warnings by "using" E. */
405 #if ! defined lint || defined __GNUC__
406 # define YYUSE(E) ((void) (E))
408 # define YYUSE(E) /* empty */
411 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
412 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
413 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
414 _Pragma ("GCC diagnostic push") \
415 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
416 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
417 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
418 _Pragma ("GCC diagnostic pop")
420 # define YY_INITIAL_VALUE(Value) Value
422 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
423 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
424 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
426 #ifndef YY_INITIAL_VALUE
427 # define YY_INITIAL_VALUE(Value) /* Nothing. */
433 /* The parser invokes alloca or malloc; define the necessary symbols. */
435 # ifdef YYSTACK_ALLOC
436 /* Pacify GCC's 'empty if-body' warning. */
437 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
438 # ifndef YYSTACK_ALLOC_MAXIMUM
439 /* The OS might guarantee only one guard page at the bottom of the stack,
440 and a page size can be as small as 4096 bytes. So we cannot safely
441 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
442 to allow for a few compiler-allocated temporary stack slots. */
443 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
446 # define YYSTACK_ALLOC YYMALLOC
447 # define YYSTACK_FREE YYFREE
448 # ifndef YYSTACK_ALLOC_MAXIMUM
449 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
451 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
452 && ! ((defined YYMALLOC || defined malloc) \
453 && (defined YYFREE || defined free)))
454 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
455 # ifndef EXIT_SUCCESS
456 # define EXIT_SUCCESS 0
460 # define YYMALLOC malloc
461 # if ! defined malloc && ! defined EXIT_SUCCESS
462 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
467 # if ! defined free && ! defined EXIT_SUCCESS
468 void free (void *); /* INFRINGES ON USER NAME SPACE */
472 # define YYCOPY_NEEDED 1
476 #if (! defined yyoverflow \
477 && (! defined __cplusplus \
478 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
479 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
481 /* A type that is properly aligned for any stack member. */
484 yytype_int16 yyss_alloc
;
489 /* The size of the maximum gap between one aligned stack and the next. */
490 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
492 /* The size of an array large to enough to hold all stacks, each with
494 # define YYSTACK_BYTES(N) \
495 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
496 + 2 * YYSTACK_GAP_MAXIMUM)
498 # define YYCOPY_NEEDED 1
500 /* Relocate STACK from its old location to the new one. The
501 local variables YYSIZE and YYSTACKSIZE give the old and new number of
502 elements in the stack, and YYPTR gives the new location of the
503 stack. Advance YYPTR to a properly aligned location for the next
505 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
508 YYSIZE_T yynewbytes; \
509 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
510 Stack = &yyptr->Stack_alloc; \
511 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
512 yyptr += yynewbytes / sizeof (*yyptr); \
518 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
519 /* Copy COUNT objects from SRC to DST. The source and destination do
522 # if defined __GNUC__ && 1 < __GNUC__
523 # define YYCOPY(Dst, Src, Count) \
524 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
526 # define YYCOPY(Dst, Src, Count) \
530 for (yyi = 0; yyi < (Count); yyi++) \
531 (Dst)[yyi] = (Src)[yyi]; \
536 #endif /* !YYCOPY_NEEDED */
538 /* YYFINAL -- State number of the termination state. */
540 /* YYLAST -- Last index in YYTABLE. */
543 /* YYNTOKENS -- Number of terminals. */
545 /* YYNNTS -- Number of nonterminals. */
547 /* YYNRULES -- Number of rules. */
549 /* YYNSTATES -- Number of states. */
550 #define YYNSTATES 144
552 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
553 by yylex, with out-of-bounds checking. */
555 #define YYMAXUTOK 312
557 #define YYTRANSLATE(YYX) \
558 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
560 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
561 as returned by yylex, without out-of-bounds checking. */
562 static const yytype_uint8 yytranslate
[] =
564 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
590 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
591 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
592 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
593 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
594 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
599 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
600 static const yytype_uint16 yyrline
[] =
602 0, 264, 264, 273, 274, 278, 279, 285, 289, 294,
603 295, 300, 306, 307, 308, 309, 314, 319, 320, 321,
604 322, 323, 324, 324, 325, 326, 350, 351, 352, 353,
605 357, 358, 367, 368, 369, 373, 385, 389, 393, 401,
606 412, 413, 423, 424, 428, 440, 440, 445, 445, 450,
607 461, 476, 477, 478, 479, 483, 484, 489, 491, 496,
608 501, 511, 513, 518, 519, 523, 524, 528, 529, 530,
609 535, 540, 545, 551, 557, 568, 569, 578, 579, 585,
610 586, 587, 594, 594, 602, 603, 604, 609, 612, 614,
611 616, 618, 620, 622, 624, 629, 630, 640, 641, 666,
612 667, 668, 669, 681, 683, 692, 697, 698, 703, 711,
617 #if GRAM_DEBUG || YYERROR_VERBOSE || 1
618 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
619 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
620 static const char *const yytname
[] =
622 "\"end of file\"", "error", "$undefined", "\"string\"", "\"%token\"",
623 "\"%nterm\"", "\"%type\"", "\"%destructor\"", "\"%printer\"",
624 "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%precedence\"",
625 "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
626 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
627 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
628 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
629 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
630 "\"%nondeterministic-parser\"", "\"%output\"", "\"%require\"",
631 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
632 "\"%yacc\"", "\"{...}\"", "\"%?{...}\"", "\"[identifier]\"", "\"char\"",
633 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
634 "\"|\"", "\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"",
635 "\"integer\"", "\"%param\"", "\"%union\"", "\"%empty\"", "$accept",
636 "input", "prologue_declarations", "prologue_declaration", "$@1",
637 "params", "grammar_declaration", "code_props_type", "union_name",
638 "symbol_declaration", "$@2", "$@3", "precedence_declaration",
639 "precedence_declarator", "tag.opt", "symbols.prec", "symbol.prec",
640 "symbols.1", "generic_symlist", "generic_symlist_item", "tag",
641 "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
642 "rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
643 "id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULLPTR
648 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
649 (internal) symbol number NUM (which must be that of a token). */
650 static const yytype_uint16 yytoknum
[] =
652 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
653 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
654 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
655 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
656 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
657 305, 306, 307, 308, 309, 310, 311, 312
661 #define YYPACT_NINF -113
663 #define yypact_value_is_default(Yystate) \
664 (!!((Yystate) == (-113)))
666 #define YYTABLE_NINF -110
668 #define yytable_value_is_error(Yytable_value) \
671 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
673 static const yytype_int8 yypact
[] =
675 -113, 16, 108, -113, -113, -113, -27, -113, -113, -113,
676 -113, -113, -113, -24, -113, 23, 24, -113, -21, -15,
677 -113, 29, -113, 3, 38, 42, -113, -113, -113, 44,
678 47, 71, 31, -113, -113, -113, 55, -113, -113, -113,
679 30, -113, -113, 39, -113, -113, 26, -22, -22, 31,
680 -113, 48, -113, -113, 1, -113, -113, -113, -113, -113,
681 -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
682 -113, 45, -113, 50, 2, -113, -113, 57, 49, -113,
683 52, 41, -113, 31, -113, -113, -22, -2, -22, 31,
684 -113, -113, -113, -113, -113, -113, -113, -113, 46, -113,
685 -113, -113, -113, -113, 63, -113, -113, -113, -113, 41,
686 -113, -113, -113, 31, -113, 51, -113, 100, -113, -113,
687 -113, -113, -113, -113, -113, -113, -113, -20, 40, -113,
688 -113, 31, 53, 58, 57, -113, -113, 57, 40, -113,
689 -113, -113, -113, -113
692 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
693 Performed when YYTABLE does not specify something else to do. Zero
694 means the default is an error. */
695 static const yytype_uint8 yydefact
[] =
697 3, 0, 0, 1, 47, 45, 0, 40, 41, 51,
698 52, 53, 54, 0, 36, 0, 9, 11, 0, 0,
699 7, 0, 15, 0, 0, 0, 37, 19, 20, 0,
700 0, 0, 0, 26, 27, 28, 0, 6, 29, 22,
701 42, 4, 5, 0, 33, 32, 55, 0, 0, 0,
702 38, 0, 98, 97, 99, 10, 12, 13, 14, 16,
703 17, 18, 21, 24, 25, 108, 104, 103, 106, 34,
704 107, 0, 105, 0, 0, 77, 79, 95, 0, 43,
705 0, 0, 56, 0, 70, 75, 48, 71, 46, 49,
706 61, 39, 101, 102, 100, 8, 81, 80, 0, 78,
707 2, 96, 82, 31, 23, 44, 67, 68, 69, 35,
708 63, 66, 65, 50, 57, 59, 76, 72, 73, 62,
709 110, 87, 30, 64, 58, 60, 74, 83, 84, 87,
710 86, 0, 0, 0, 95, 90, 91, 95, 85, 92,
714 /* YYPGOTO[NTERM-NUM]. */
715 static const yytype_int8 yypgoto
[] =
717 -113, -113, -113, -113, -113, -113, 102, -113, -113, -113,
718 -113, -113, -113, -113, -113, -113, 8, -113, -113, 13,
719 -113, -50, 75, -113, 73, -113, -113, -113, 19, -112,
720 -113, -113, 22, -113, -32, -82, -113
723 /* YYDEFGOTO[NTERM-NUM]. */
724 static const yytype_int16 yydefgoto
[] =
726 -1, 1, 2, 41, 78, 104, 73, 43, 80, 44,
727 48, 47, 45, 46, 83, 113, 114, 89, 109, 110,
728 111, 85, 86, 74, 75, 76, 121, 127, 128, 102,
729 54, 95, 68, 77, 112, 70, 100
732 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
733 positive, shift that token. If negative, reduce the rule whose
734 number is the opposite. If YYTABLE_NINF, syntax error. */
735 static const yytype_int16 yytable
[] =
737 69, 65, -109, 71, 92, 118, 4, 5, 6, 7,
738 8, 9, 10, 11, 12, 50, 3, 90, 13, 14,
739 66, 51, 142, 67, 49, 143, 52, 55, 129, 84,
740 130, 26, 58, 56, 65, 126, 116, 32, 116, 57,
741 93, 60, 59, 65, 65, 61, 94, 62, 72, 98,
742 63, 115, 117, 131, 132, 133, 71, 119, 40, 4,
743 5, 6, 7, 8, 9, 10, 11, 12, 53, 87,
744 87, 13, 14, 66, 64, 79, 67, 82, 81, 134,
745 135, 115, 66, 66, 26, 67, 67, 91, 103, 120,
746 32, 105, 106, 107, 108, 96, 137, 136, 101, 139,
747 97, 72, 122, 65, 42, 125, 137, 140, 87, 141,
748 87, 40, 4, 5, 6, 7, 8, 9, 10, 11,
749 12, 124, 123, 88, 13, 14, 15, 16, 17, 18,
750 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
751 29, 30, 31, 32, 33, 34, 35, 99, 138, 0,
752 0, 0, 0, 0, 0, 36, 0, 37, 38, 0,
756 static const yytype_int16 yycheck
[] =
758 32, 3, 0, 1, 3, 87, 4, 5, 6, 7,
759 8, 9, 10, 11, 12, 39, 0, 49, 16, 17,
760 42, 45, 134, 45, 51, 137, 3, 3, 48, 51,
761 50, 29, 3, 54, 3, 117, 86, 35, 88, 54,
762 39, 3, 39, 3, 3, 3, 45, 3, 46, 47,
763 3, 83, 54, 13, 14, 15, 1, 89, 56, 4,
764 5, 6, 7, 8, 9, 10, 11, 12, 45, 47,
765 48, 16, 17, 42, 3, 45, 45, 51, 39, 39,
766 40, 113, 42, 42, 29, 45, 45, 39, 39, 43,
767 35, 39, 51, 52, 53, 50, 128, 57, 41, 131,
768 50, 46, 39, 3, 2, 54, 138, 54, 86, 51,
769 88, 56, 4, 5, 6, 7, 8, 9, 10, 11,
770 12, 113, 109, 48, 16, 17, 18, 19, 20, 21,
771 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
772 32, 33, 34, 35, 36, 37, 38, 74, 129, -1,
773 -1, -1, -1, -1, -1, 47, -1, 49, 50, -1,
777 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
778 symbol of state STATE-NUM. */
779 static const yytype_uint8 yystos
[] =
781 0, 59, 60, 0, 4, 5, 6, 7, 8, 9,
782 10, 11, 12, 16, 17, 18, 19, 20, 21, 22,
783 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
784 33, 34, 35, 36, 37, 38, 47, 49, 50, 55,
785 56, 61, 64, 65, 67, 70, 71, 69, 68, 51,
786 39, 45, 3, 45, 88, 3, 54, 54, 3, 39,
787 3, 3, 3, 3, 3, 3, 42, 45, 90, 92,
788 93, 1, 46, 64, 81, 82, 83, 91, 62, 45,
789 66, 39, 51, 72, 51, 79, 80, 90, 80, 75,
790 92, 39, 3, 39, 45, 89, 50, 50, 47, 82,
791 94, 41, 87, 39, 63, 39, 51, 52, 53, 76,
792 77, 78, 92, 73, 74, 92, 79, 54, 93, 92,
793 43, 84, 39, 77, 74, 54, 93, 85, 86, 48,
794 50, 13, 14, 15, 39, 40, 57, 92, 86, 92,
798 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
799 static const yytype_uint8 yyr1
[] =
801 0, 58, 59, 60, 60, 61, 61, 61, 61, 61,
802 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
803 61, 61, 62, 61, 61, 61, 61, 61, 61, 61,
804 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
805 65, 65, 66, 66, 64, 68, 67, 69, 67, 67,
806 70, 71, 71, 71, 71, 72, 72, 73, 73, 74,
807 74, 75, 75, 76, 76, 77, 77, 78, 78, 78,
808 79, 79, 79, 79, 79, 80, 80, 81, 81, 82,
809 82, 82, 84, 83, 85, 85, 85, 86, 86, 86,
810 86, 86, 86, 86, 86, 87, 87, 88, 88, 89,
811 89, 89, 89, 90, 90, 91, 92, 92, 93, 94,
815 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
816 static const yytype_uint8 yyr2
[] =
818 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
819 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
820 1, 2, 0, 3, 2, 2, 1, 1, 1, 1,
821 2, 1, 1, 1, 2, 3, 1, 1, 2, 3,
822 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
823 3, 1, 1, 1, 1, 0, 1, 1, 2, 1,
824 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
825 1, 1, 2, 2, 3, 1, 2, 1, 2, 1,
826 2, 2, 0, 4, 1, 3, 2, 0, 3, 3,
827 2, 2, 3, 3, 3, 0, 1, 1, 1, 0,
828 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
833 #define yyerrok (yyerrstatus = 0)
834 #define yyclearin (yychar = YYEMPTY)
838 #define YYACCEPT goto yyacceptlab
839 #define YYABORT goto yyabortlab
840 #define YYERROR goto yyerrorlab
843 #define YYRECOVERING() (!!yyerrstatus)
845 #define YYBACKUP(Token, Value) \
847 if (yychar == YYEMPTY) \
851 YYPOPSTACK (yylen); \
853 YY_LAC_DISCARD ("YYBACKUP"); \
858 yyerror (&yylloc, YY_("syntax error: cannot back up")); \
863 /* Error token number */
865 #define YYERRCODE 256
868 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
869 If N is 0, then set CURRENT to the empty location which ends
870 the previous symbol: RHS[0] (always defined). */
872 #ifndef YYLLOC_DEFAULT
873 # define YYLLOC_DEFAULT(Current, Rhs, N) \
877 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
878 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
879 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
880 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
884 (Current).first_line = (Current).last_line = \
885 YYRHSLOC (Rhs, 0).last_line; \
886 (Current).first_column = (Current).last_column = \
887 YYRHSLOC (Rhs, 0).last_column; \
892 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
895 /* Enable debugging if requested. */
899 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
900 # define YYFPRINTF fprintf
903 # define YYDPRINTF(Args) \
910 /* YY_LOCATION_PRINT -- Print the location on the stream.
911 This macro was not mandated originally: define only if we know
912 we won't break user code: when these are the locations we know. */
914 #ifndef YY_LOCATION_PRINT
915 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
917 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
919 __attribute__((__unused__
))
921 yy_location_print_ (FILE *yyo
, YYLTYPE
const * const yylocp
)
924 int end_col
= 0 != yylocp
->last_column
? yylocp
->last_column
- 1 : 0;
925 if (0 <= yylocp
->first_line
)
927 res
+= YYFPRINTF (yyo
, "%d", yylocp
->first_line
);
928 if (0 <= yylocp
->first_column
)
929 res
+= YYFPRINTF (yyo
, ".%d", yylocp
->first_column
);
931 if (0 <= yylocp
->last_line
)
933 if (yylocp
->first_line
< yylocp
->last_line
)
935 res
+= YYFPRINTF (yyo
, "-%d", yylocp
->last_line
);
937 res
+= YYFPRINTF (yyo
, ".%d", end_col
);
939 else if (0 <= end_col
&& yylocp
->first_column
< end_col
)
940 res
+= YYFPRINTF (yyo
, "-%d", end_col
);
945 # define YY_LOCATION_PRINT(File, Loc) \
946 yy_location_print_ (File, &(Loc))
949 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
954 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
958 YYFPRINTF (stderr, "%s ", Title); \
959 yy_symbol_print (stderr, \
960 Type, Value, Location); \
961 YYFPRINTF (stderr, "\n"); \
966 /*----------------------------------------.
967 | Print this symbol's value on YYOUTPUT. |
968 `----------------------------------------*/
971 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
973 FILE *yyo
= yyoutput
;
979 if (yytype
< YYNTOKENS
)
980 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
984 case 3: /* "string" */
985 #line 188 "src/parse-gram.y" /* yacc.c:684 */
986 { fputs (quotearg_style (c_quoting_style
, ((*yyvaluep
).code
)), yyo
); }
987 #line 987 "src/parse-gram.c" /* yacc.c:684 */
990 case 23: /* "%<flag>" */
991 #line 196 "src/parse-gram.y" /* yacc.c:684 */
992 { fprintf (yyo
, "%%%s", ((*yyvaluep
).uniqstr
)); }
993 #line 993 "src/parse-gram.c" /* yacc.c:684 */
996 case 39: /* "{...}" */
997 #line 189 "src/parse-gram.y" /* yacc.c:684 */
998 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
999 #line 999 "src/parse-gram.c" /* yacc.c:684 */
1002 case 40: /* "%?{...}" */
1003 #line 189 "src/parse-gram.y" /* yacc.c:684 */
1004 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
1005 #line 1005 "src/parse-gram.c" /* yacc.c:684 */
1008 case 41: /* "[identifier]" */
1009 #line 194 "src/parse-gram.y" /* yacc.c:684 */
1010 { fprintf (yyo
, "[%s]", ((*yyvaluep
).uniqstr
)); }
1011 #line 1011 "src/parse-gram.c" /* yacc.c:684 */
1014 case 42: /* "char" */
1015 #line 184 "src/parse-gram.y" /* yacc.c:684 */
1016 { fputs (char_name (((*yyvaluep
).character
)), yyo
); }
1017 #line 1017 "src/parse-gram.c" /* yacc.c:684 */
1020 case 43: /* "epilogue" */
1021 #line 189 "src/parse-gram.y" /* yacc.c:684 */
1022 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
1023 #line 1023 "src/parse-gram.c" /* yacc.c:684 */
1026 case 45: /* "identifier" */
1027 #line 193 "src/parse-gram.y" /* yacc.c:684 */
1028 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1029 #line 1029 "src/parse-gram.c" /* yacc.c:684 */
1032 case 46: /* "identifier:" */
1033 #line 195 "src/parse-gram.y" /* yacc.c:684 */
1034 { fprintf (yyo
, "%s:", ((*yyvaluep
).uniqstr
)); }
1035 #line 1035 "src/parse-gram.c" /* yacc.c:684 */
1038 case 49: /* "%{...%}" */
1039 #line 189 "src/parse-gram.y" /* yacc.c:684 */
1040 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
1041 #line 1041 "src/parse-gram.c" /* yacc.c:684 */
1044 case 51: /* "<tag>" */
1045 #line 197 "src/parse-gram.y" /* yacc.c:684 */
1046 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1047 #line 1047 "src/parse-gram.c" /* yacc.c:684 */
1050 case 54: /* "integer" */
1051 #line 201 "src/parse-gram.y" /* yacc.c:684 */
1052 { fprintf (yyo
, "%d", ((*yyvaluep
).integer
)); }
1053 #line 1053 "src/parse-gram.c" /* yacc.c:684 */
1056 case 55: /* "%param" */
1057 #line 244 "src/parse-gram.y" /* yacc.c:684 */
1059 switch (((*yyvaluep
).param
))
1061 #define CASE(In, Out) \
1062 case param_ ## In: fputs ("%" #Out, yyo); break
1063 CASE (lex
, lex
-param
);
1064 CASE (parse
, parse
-param
);
1067 case param_none
: aver (false); break;
1070 #line 1070 "src/parse-gram.c" /* yacc.c:684 */
1073 case 65: /* code_props_type */
1074 #line 410 "src/parse-gram.y" /* yacc.c:684 */
1075 { fprintf (yyo
, "%s", code_props_type_string (((*yyvaluep
).code_type
))); }
1076 #line 1076 "src/parse-gram.c" /* yacc.c:684 */
1079 case 74: /* symbol.prec */
1080 #line 205 "src/parse-gram.y" /* yacc.c:684 */
1081 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1082 #line 1082 "src/parse-gram.c" /* yacc.c:684 */
1086 #line 197 "src/parse-gram.y" /* yacc.c:684 */
1087 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1088 #line 1088 "src/parse-gram.c" /* yacc.c:684 */
1091 case 88: /* variable */
1092 #line 193 "src/parse-gram.y" /* yacc.c:684 */
1093 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1094 #line 1094 "src/parse-gram.c" /* yacc.c:684 */
1097 case 89: /* value */
1098 #line 656 "src/parse-gram.y" /* yacc.c:684 */
1100 switch (((*yyvaluep
).value
).kind
)
1102 case muscle_code
: fprintf (yyo
, "{%s}", ((*yyvaluep
).value
).chars
); break;
1103 case muscle_keyword
: fprintf (yyo
, "%s", ((*yyvaluep
).value
).chars
); break;
1104 case muscle_string
: fprintf (yyo
, "\"%s\"", ((*yyvaluep
).value
).chars
); break;
1107 #line 1107 "src/parse-gram.c" /* yacc.c:684 */
1111 #line 205 "src/parse-gram.y" /* yacc.c:684 */
1112 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1113 #line 1113 "src/parse-gram.c" /* yacc.c:684 */
1116 case 91: /* id_colon */
1117 #line 206 "src/parse-gram.y" /* yacc.c:684 */
1118 { fprintf (yyo
, "%s:", ((*yyvaluep
).symbol
)->tag
); }
1119 #line 1119 "src/parse-gram.c" /* yacc.c:684 */
1122 case 92: /* symbol */
1123 #line 205 "src/parse-gram.y" /* yacc.c:684 */
1124 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1125 #line 1125 "src/parse-gram.c" /* yacc.c:684 */
1128 case 93: /* string_as_id */
1129 #line 205 "src/parse-gram.y" /* yacc.c:684 */
1130 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1131 #line 1131 "src/parse-gram.c" /* yacc.c:684 */
1141 /*--------------------------------.
1142 | Print this symbol on YYOUTPUT. |
1143 `--------------------------------*/
1146 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1148 YYFPRINTF (yyoutput
, "%s %s (",
1149 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1151 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1152 YYFPRINTF (yyoutput
, ": ");
1153 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1154 YYFPRINTF (yyoutput
, ")");
1157 /*------------------------------------------------------------------.
1158 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1160 `------------------------------------------------------------------*/
1163 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1165 YYFPRINTF (stderr
, "Stack now");
1166 for (; yybottom
<= yytop
; yybottom
++)
1168 int yybot
= *yybottom
;
1169 YYFPRINTF (stderr
, " %d", yybot
);
1171 YYFPRINTF (stderr
, "\n");
1174 # define YY_STACK_PRINT(Bottom, Top) \
1177 yy_stack_print ((Bottom), (Top)); \
1181 /*------------------------------------------------.
1182 | Report that the YYRULE is going to be reduced. |
1183 `------------------------------------------------*/
1186 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1188 unsigned long int yylno
= yyrline
[yyrule
];
1189 int yynrhs
= yyr2
[yyrule
];
1191 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1193 /* The symbols being reduced. */
1194 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1196 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1197 yy_symbol_print (stderr
,
1198 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1199 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1200 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1201 YYFPRINTF (stderr
, "\n");
1205 # define YY_REDUCE_PRINT(Rule) \
1208 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1211 /* Nonzero means print parse trace. It is left uninitialized so that
1212 multiple parsers can coexist. */
1214 #else /* !GRAM_DEBUG */
1215 # define YYDPRINTF(Args)
1216 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1217 # define YY_STACK_PRINT(Bottom, Top)
1218 # define YY_REDUCE_PRINT(Rule)
1219 #endif /* !GRAM_DEBUG */
1222 /* YYINITDEPTH -- initial size of the parser's stacks. */
1224 # define YYINITDEPTH 200
1227 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1228 if the built-in stack extension method is used).
1230 Do not make this value too large; the results are undefined if
1231 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1232 evaluated with infinite-precision integer arithmetic. */
1235 # define YYMAXDEPTH 10000
1238 /* Given a state stack such that *YYBOTTOM is its bottom, such that
1239 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1240 stack, and such that *YYCAPACITY is the maximum number of elements it
1241 can hold without a reallocation, make sure there is enough room to
1242 store YYADD more elements. If not, allocate a new stack using
1243 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1244 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1245 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1246 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1247 required. Return 1 if memory is exhausted. */
1249 yy_lac_stack_realloc (YYSIZE_T
*yycapacity
, YYSIZE_T yyadd
,
1251 char const *yydebug_prefix
,
1252 char const *yydebug_suffix
,
1254 yytype_int16
**yybottom
,
1255 yytype_int16
*yybottom_no_free
,
1256 yytype_int16
**yytop
, yytype_int16
*yytop_empty
)
1258 YYSIZE_T yysize_old
=
1259 *yytop
== yytop_empty
? 0 : *yytop
- *yybottom
+ 1;
1260 YYSIZE_T yysize_new
= yysize_old
+ yyadd
;
1261 if (*yycapacity
< yysize_new
)
1263 YYSIZE_T yyalloc
= 2 * yysize_new
;
1264 yytype_int16
*yybottom_new
;
1265 /* Use YYMAXDEPTH for maximum stack size given that the stack
1266 should never need to grow larger than the main state stack
1267 needs to grow without LAC. */
1268 if (YYMAXDEPTH
< yysize_new
)
1270 YYDPRINTF ((stderr
, "%smax size exceeded%s", yydebug_prefix
,
1274 if (YYMAXDEPTH
< yyalloc
)
1275 yyalloc
= YYMAXDEPTH
;
1277 (yytype_int16
*) YYSTACK_ALLOC (yyalloc
* sizeof *yybottom_new
);
1280 YYDPRINTF ((stderr
, "%srealloc failed%s", yydebug_prefix
,
1284 if (*yytop
!= yytop_empty
)
1286 YYCOPY (yybottom_new
, *yybottom
, yysize_old
);
1287 *yytop
= yybottom_new
+ (yysize_old
- 1);
1289 if (*yybottom
!= yybottom_no_free
)
1290 YYSTACK_FREE (*yybottom
);
1291 *yybottom
= yybottom_new
;
1292 *yycapacity
= yyalloc
;
1297 /* Establish the initial context for the current lookahead if no initial
1298 context is currently established.
1300 We define a context as a snapshot of the parser stacks. We define
1301 the initial context for a lookahead as the context in which the
1302 parser initially examines that lookahead in order to select a
1303 syntactic action. Thus, if the lookahead eventually proves
1304 syntactically unacceptable (possibly in a later context reached via a
1305 series of reductions), the initial context can be used to determine
1306 the exact set of tokens that would be syntactically acceptable in the
1307 lookahead's place. Moreover, it is the context after which any
1308 further semantic actions would be erroneous because they would be
1309 determined by a syntactically unacceptable token.
1311 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1312 performed in an inconsistent state (which, for the purposes of LAC,
1313 includes consistent states that don't know they're consistent because
1314 their default reductions have been disabled). Iff there is a
1315 lookahead token, it should also be invoked before reporting a syntax
1316 error. This latter case is for the sake of the debugging output.
1318 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1319 follows. If no initial context is currently established for the
1320 current lookahead, then check if that lookahead can eventually be
1321 shifted if syntactic actions continue from the current context.
1322 Report a syntax error if it cannot. */
1323 #define YY_LAC_ESTABLISH \
1325 if (!yy_lac_established) \
1327 YYDPRINTF ((stderr, \
1328 "LAC: initial context established for %s\n", \
1329 yytname[yytoken])); \
1330 yy_lac_established = 1; \
1332 int yy_lac_status = \
1333 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1334 if (yy_lac_status == 2) \
1335 goto yyexhaustedlab; \
1336 if (yy_lac_status == 1) \
1342 /* Discard any previous initial lookahead context because of Event,
1343 which may be a lookahead change or an invalidation of the currently
1344 established initial context for the current lookahead.
1346 The most common example of a lookahead change is a shift. An example
1347 of both cases is syntax error recovery. That is, a syntax error
1348 occurs when the lookahead is syntactically erroneous for the
1349 currently established initial context, so error recovery manipulates
1350 the parser stacks to try to find a new initial context in which the
1351 current lookahead is syntactically acceptable. If it fails to find
1352 such a context, it discards the lookahead. */
1354 # define YY_LAC_DISCARD(Event) \
1356 if (yy_lac_established) \
1359 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1361 yy_lac_established = 0; \
1365 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1368 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1369 eventually (after perhaps some reductions) be shifted, return 1 if
1370 not, or return 2 if memory is exhausted. As preconditions and
1371 postconditions: *YYES_CAPACITY is the allocated size of the array to
1372 which *YYES points, and either *YYES = YYESA or *YYES points to an
1373 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1374 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1375 any old *YYES other than YYESA. */
1377 yy_lac (yytype_int16
*yyesa
, yytype_int16
**yyes
,
1378 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1380 yytype_int16
*yyes_prev
= yyssp
;
1381 yytype_int16
*yyesp
= yyes_prev
;
1382 YYDPRINTF ((stderr
, "LAC: checking lookahead %s:", yytname
[yytoken
]));
1383 if (yytoken
== YYUNDEFTOK
)
1385 YYDPRINTF ((stderr
, " Always Err\n"));
1390 int yyrule
= yypact
[*yyesp
];
1391 if (yypact_value_is_default (yyrule
)
1392 || (yyrule
+= yytoken
) < 0 || YYLAST
< yyrule
1393 || yycheck
[yyrule
] != yytoken
)
1395 yyrule
= yydefact
[*yyesp
];
1398 YYDPRINTF ((stderr
, " Err\n"));
1404 yyrule
= yytable
[yyrule
];
1405 if (yytable_value_is_error (yyrule
))
1407 YYDPRINTF ((stderr
, " Err\n"));
1412 YYDPRINTF ((stderr
, " S%d\n", yyrule
));
1418 YYSIZE_T yylen
= yyr2
[yyrule
];
1419 YYDPRINTF ((stderr
, " R%d", yyrule
- 1));
1420 if (yyesp
!= yyes_prev
)
1422 YYSIZE_T yysize
= yyesp
- *yyes
+ 1;
1435 yyesp
= yyes_prev
-= yylen
;
1440 int yylhs
= yyr1
[yyrule
] - YYNTOKENS
;
1441 yystate
= yypgoto
[yylhs
] + *yyesp
;
1442 if (yystate
< 0 || YYLAST
< yystate
1443 || yycheck
[yystate
] != *yyesp
)
1444 yystate
= yydefgoto
[yylhs
];
1446 yystate
= yytable
[yystate
];
1448 if (yyesp
== yyes_prev
)
1455 if (yy_lac_stack_realloc (yyes_capacity
, 1,
1459 yyes
, yyesa
, &yyesp
, yyes_prev
))
1461 YYDPRINTF ((stderr
, "\n"));
1466 YYDPRINTF ((stderr
, " G%d", yystate
));
1475 # if defined __GLIBC__ && defined _STRING_H
1476 # define yystrlen strlen
1478 /* Return the length of YYSTR. */
1480 yystrlen (const char *yystr
)
1483 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1491 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1492 # define yystpcpy stpcpy
1494 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1497 yystpcpy (char *yydest
, const char *yysrc
)
1500 const char *yys
= yysrc
;
1502 while ((*yyd
++ = *yys
++) != '\0')
1511 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1512 quotes and backslashes, so that it's suitable for yyerror. The
1513 heuristic is that double-quoting is unnecessary unless the string
1514 contains an apostrophe, a comma, or backslash (other than
1515 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1516 null, do not copy; instead, return the length of what the result
1519 yytnamerr (char *yyres
, const char *yystr
)
1524 char const *yyp
= yystr
;
1531 goto do_not_strip_quotes
;
1535 goto do_not_strip_quotes
;
1548 do_not_strip_quotes
: ;
1552 return yystrlen (yystr
);
1554 return yystpcpy (yyres
, yystr
) - yyres
;
1558 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1559 about the unexpected token YYTOKEN for the state stack whose top is
1560 YYSSP. In order to see if a particular token T is a
1561 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1563 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1564 not large enough to hold the message. In that case, also set
1565 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1566 required number of bytes is too large to store or if
1567 yy_lac returned 2. */
1569 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1570 yytype_int16
*yyesa
, yytype_int16
**yyes
,
1571 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1573 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1574 YYSIZE_T yysize
= yysize0
;
1575 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1576 /* Internationalized format string. */
1577 const char *yyformat
= YY_NULLPTR
;
1578 /* Arguments of yyformat. */
1579 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1580 /* Number of reported tokens (one for the "unexpected", one per
1584 /* There are many possibilities here to consider:
1585 - If this state is a consistent state with a default action, then
1586 the only way this function was invoked is if the default action
1587 is an error action. In that case, don't check for expected
1588 tokens because there are none.
1589 - The only way there can be no lookahead present (in yychar) is if
1590 this state is a consistent state with a default action. Thus,
1591 detecting the absence of a lookahead is sufficient to determine
1592 that there is no unexpected or expected token to report. In that
1593 case, just report a simple "syntax error".
1594 - Don't assume there isn't a lookahead just because this state is a
1595 consistent state with a default action. There might have been a
1596 previous inconsistent state, consistent state with a non-default
1597 action, or user semantic action that manipulated yychar.
1598 In the first two cases, it might appear that the current syntax
1599 error should have been detected in the previous state when yy_lac
1600 was invoked. However, at that time, there might have been a
1601 different syntax error that discarded a different initial context
1602 during error recovery, leaving behind the current lookahead.
1604 if (yytoken
!= YYEMPTY
)
1606 int yyn
= yypact
[*yyssp
];
1607 YYDPRINTF ((stderr
, "Constructing syntax error message\n"));
1608 yyarg
[yycount
++] = yytname
[yytoken
];
1609 if (!yypact_value_is_default (yyn
))
1613 for (yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1614 if (yyx
!= YYTERROR
&& yyx
!= YYUNDEFTOK
)
1617 int yy_lac_status
= yy_lac (yyesa
, yyes
, yyes_capacity
,
1619 if (yy_lac_status
== 2)
1621 if (yy_lac_status
== 1)
1624 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1630 yyarg
[yycount
++] = yytname
[yyx
];
1632 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1633 if (! (yysize
<= yysize1
1634 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1642 YYFPRINTF (stderr
, "No expected tokens.\n");
1648 # define YYCASE_(N, S) \
1652 YYCASE_(0, YY_("syntax error"));
1653 YYCASE_(1, YY_("syntax error, unexpected %s"));
1654 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1655 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1656 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1657 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1662 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1663 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1668 if (*yymsg_alloc
< yysize
)
1670 *yymsg_alloc
= 2 * yysize
;
1671 if (! (yysize
<= *yymsg_alloc
1672 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1673 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1677 /* Avoid sprintf, as that infringes on the user's name space.
1678 Don't have undefined behavior even if the translation
1679 produced a string with the wrong number of "%s"s. */
1683 while ((*yyp
= *yyformat
) != '\0')
1684 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1686 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1697 #endif /* YYERROR_VERBOSE */
1699 /*-----------------------------------------------.
1700 | Release the memory associated to this symbol. |
1701 `-----------------------------------------------*/
1704 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1707 YYUSE (yylocationp
);
1710 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1712 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1714 YY_IGNORE_MAYBE_UNINITIALIZED_END
1727 /* The lookahead symbol. */
1731 /* The semantic value of the lookahead symbol. */
1732 /* Default value used for initialization, for pacifying older GCCs
1733 or non-GCC compilers. */
1734 YY_INITIAL_VALUE (static YYSTYPE yyval_default
;)
1735 YYSTYPE yylval
YY_INITIAL_VALUE (= yyval_default
);
1737 /* Location data for the lookahead symbol. */
1738 static YYLTYPE yyloc_default
1739 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1743 YYLTYPE yylloc
= yyloc_default
;
1745 /* Number of syntax errors so far. */
1749 /* Number of tokens to shift before error messages enabled. */
1752 /* The stacks and their tools:
1753 'yyss': related to states.
1754 'yyvs': related to semantic values.
1755 'yyls': related to locations.
1757 Refer to the stacks through separate pointers, to allow yyoverflow
1758 to reallocate them elsewhere. */
1760 /* The state stack. */
1761 yytype_int16 yyssa
[YYINITDEPTH
];
1763 yytype_int16
*yyssp
;
1765 /* The semantic value stack. */
1766 YYSTYPE yyvsa
[YYINITDEPTH
];
1770 /* The location stack. */
1771 YYLTYPE yylsa
[YYINITDEPTH
];
1775 /* The locations where the error started and ended. */
1776 YYLTYPE yyerror_range
[3];
1778 YYSIZE_T yystacksize
;
1780 yytype_int16 yyesa
[20];
1782 YYSIZE_T yyes_capacity
;
1784 int yy_lac_established
= 0;
1787 /* Lookahead token as an internal (translated) token number. */
1789 /* The variables used to return semantic value and location from the
1795 /* Buffer for error messages, and its allocated size. */
1797 char *yymsg
= yymsgbuf
;
1798 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1801 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1803 /* The number of symbols on the RHS of the reduced rule.
1804 Keep to zero when no symbol should be popped. */
1807 yyssp
= yyss
= yyssa
;
1808 yyvsp
= yyvs
= yyvsa
;
1809 yylsp
= yyls
= yylsa
;
1810 yystacksize
= YYINITDEPTH
;
1813 yyes_capacity
= sizeof yyesa
/ sizeof *yyes
;
1814 if (YYMAXDEPTH
< yyes_capacity
)
1815 yyes_capacity
= YYMAXDEPTH
;
1817 YYDPRINTF ((stderr
, "Starting parse\n"));
1822 yychar
= YYEMPTY
; /* Cause a token to be read. */
1824 /* User initialization code. */
1825 #line 108 "src/parse-gram.y" /* yacc.c:1429 */
1827 /* Bison's grammar can initial empty locations, hence a default
1828 location is needed. */
1829 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1830 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1833 #line 1833 "src/parse-gram.c" /* yacc.c:1429 */
1837 /*------------------------------------------------------------.
1838 | yynewstate -- Push a new state, which is found in yystate. |
1839 `------------------------------------------------------------*/
1841 /* In all cases, when you get here, the value and location stacks
1842 have just been pushed. So pushing a state here evens the stacks. */
1848 if (yyss
+ yystacksize
- 1 <= yyssp
)
1850 /* Get the current used size of the three stacks, in elements. */
1851 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1855 /* Give user a chance to reallocate the stack. Use copies of
1856 these so that the &'s don't force the real ones into
1858 YYSTYPE
*yyvs1
= yyvs
;
1859 yytype_int16
*yyss1
= yyss
;
1860 YYLTYPE
*yyls1
= yyls
;
1862 /* Each stack pointer address is followed by the size of the
1863 data in use in that stack, in bytes. This used to be a
1864 conditional around just the two extra args, but that might
1865 be undefined if yyoverflow is a macro. */
1866 yyoverflow (YY_("memory exhausted"),
1867 &yyss1
, yysize
* sizeof (*yyssp
),
1868 &yyvs1
, yysize
* sizeof (*yyvsp
),
1869 &yyls1
, yysize
* sizeof (*yylsp
),
1876 #else /* no yyoverflow */
1877 # ifndef YYSTACK_RELOCATE
1878 goto yyexhaustedlab
;
1880 /* Extend the stack our own way. */
1881 if (YYMAXDEPTH
<= yystacksize
)
1882 goto yyexhaustedlab
;
1884 if (YYMAXDEPTH
< yystacksize
)
1885 yystacksize
= YYMAXDEPTH
;
1888 yytype_int16
*yyss1
= yyss
;
1889 union yyalloc
*yyptr
=
1890 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1892 goto yyexhaustedlab
;
1893 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1894 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1895 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1896 # undef YYSTACK_RELOCATE
1898 YYSTACK_FREE (yyss1
);
1901 #endif /* no yyoverflow */
1903 yyssp
= yyss
+ yysize
- 1;
1904 yyvsp
= yyvs
+ yysize
- 1;
1905 yylsp
= yyls
+ yysize
- 1;
1907 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1908 (unsigned long int) yystacksize
));
1910 if (yyss
+ yystacksize
- 1 <= yyssp
)
1914 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1916 if (yystate
== YYFINAL
)
1926 /* Do appropriate processing given the current state. Read a
1927 lookahead token if we need one and don't already have one. */
1929 /* First try to decide what to do without reference to lookahead token. */
1930 yyn
= yypact
[yystate
];
1931 if (yypact_value_is_default (yyn
))
1934 /* Not known => get a lookahead token if don't already have one. */
1936 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1937 if (yychar
== YYEMPTY
)
1939 YYDPRINTF ((stderr
, "Reading a token: "));
1940 yychar
= yylex (&yylval
, &yylloc
);
1943 if (yychar
<= YYEOF
)
1945 yychar
= yytoken
= YYEOF
;
1946 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1950 yytoken
= YYTRANSLATE (yychar
);
1951 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1954 /* If the proper action on seeing token YYTOKEN is to reduce or to
1955 detect an error, take that action. */
1957 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1965 if (yytable_value_is_error (yyn
))
1972 /* Count tokens shifted since error; after three, turn off error
1977 /* Shift the lookahead token. */
1978 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1980 /* Discard the shifted token. */
1982 YY_LAC_DISCARD ("shift");
1985 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1987 YY_IGNORE_MAYBE_UNINITIALIZED_END
1992 /*-----------------------------------------------------------.
1993 | yydefault -- do the default action for the current state. |
1994 `-----------------------------------------------------------*/
1996 yyn
= yydefact
[yystate
];
2002 /*-----------------------------.
2003 | yyreduce -- Do a reduction. |
2004 `-----------------------------*/
2006 /* yyn is the number of a rule to reduce with. */
2009 /* If YYLEN is nonzero, implement the default value of the action:
2012 Otherwise, the following line sets YYVAL to garbage.
2013 This behavior is undocumented and Bison
2014 users should not rely upon it. Assigning to YYVAL
2015 unconditionally makes the parser a bit smaller, and it avoids a
2016 GCC warning that YYVAL may be used uninitialized. */
2017 yyval
= yyvsp
[1-yylen
];
2019 /* Default location. */
2020 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2021 YY_REDUCE_PRINT (yyn
);
2023 int yychar_backup
= yychar
;
2027 #line 280 "src/parse-gram.y" /* yacc.c:1646 */
2029 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
2030 translate_code ((yyvsp
[0].code
), (yylsp
[0]), true), (yylsp
[0]));
2031 code_scanner_last_string_free ();
2033 #line 2033 "src/parse-gram.c" /* yacc.c:1646 */
2037 #line 286 "src/parse-gram.y" /* yacc.c:1646 */
2039 muscle_percent_define_ensure ((yyvsp
[0].uniqstr
), (yylsp
[0]), true);
2041 #line 2041 "src/parse-gram.c" /* yacc.c:1646 */
2045 #line 290 "src/parse-gram.y" /* yacc.c:1646 */
2047 muscle_percent_define_insert ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].value
).kind
, (yyvsp
[0].value
).chars
,
2048 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2050 #line 2050 "src/parse-gram.c" /* yacc.c:1646 */
2054 #line 294 "src/parse-gram.y" /* yacc.c:1646 */
2055 { defines_flag
= true; }
2056 #line 2056 "src/parse-gram.c" /* yacc.c:1646 */
2060 #line 296 "src/parse-gram.y" /* yacc.c:1646 */
2062 defines_flag
= true;
2063 spec_defines_file
= xstrdup ((yyvsp
[0].code
));
2065 #line 2065 "src/parse-gram.c" /* yacc.c:1646 */
2069 #line 301 "src/parse-gram.y" /* yacc.c:1646 */
2071 muscle_percent_define_insert ("parse.error", (yylsp
[0]), muscle_keyword
,
2073 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2075 #line 2075 "src/parse-gram.c" /* yacc.c:1646 */
2079 #line 306 "src/parse-gram.y" /* yacc.c:1646 */
2080 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
2081 #line 2081 "src/parse-gram.c" /* yacc.c:1646 */
2085 #line 307 "src/parse-gram.y" /* yacc.c:1646 */
2086 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
2087 #line 2087 "src/parse-gram.c" /* yacc.c:1646 */
2091 #line 308 "src/parse-gram.y" /* yacc.c:1646 */
2092 { spec_file_prefix
= (yyvsp
[0].code
); }
2093 #line 2093 "src/parse-gram.c" /* yacc.c:1646 */
2097 #line 310 "src/parse-gram.y" /* yacc.c:1646 */
2099 nondeterministic_parser
= true;
2102 #line 2102 "src/parse-gram.c" /* yacc.c:1646 */
2106 #line 315 "src/parse-gram.y" /* yacc.c:1646 */
2108 muscle_code_grow ("initial_action", translate_code ((yyvsp
[0].code
), (yylsp
[0]), false), (yylsp
[0]));
2109 code_scanner_last_string_free ();
2111 #line 2111 "src/parse-gram.c" /* yacc.c:1646 */
2115 #line 319 "src/parse-gram.y" /* yacc.c:1646 */
2116 { language_argmatch ((yyvsp
[0].code
), grammar_prio
, (yylsp
[-1])); }
2117 #line 2117 "src/parse-gram.c" /* yacc.c:1646 */
2121 #line 320 "src/parse-gram.y" /* yacc.c:1646 */
2122 { spec_name_prefix
= (yyvsp
[0].code
); }
2123 #line 2123 "src/parse-gram.c" /* yacc.c:1646 */
2127 #line 321 "src/parse-gram.y" /* yacc.c:1646 */
2128 { no_lines_flag
= true; }
2129 #line 2129 "src/parse-gram.c" /* yacc.c:1646 */
2133 #line 322 "src/parse-gram.y" /* yacc.c:1646 */
2134 { nondeterministic_parser
= true; }
2135 #line 2135 "src/parse-gram.c" /* yacc.c:1646 */
2139 #line 323 "src/parse-gram.y" /* yacc.c:1646 */
2140 { spec_outfile
= (yyvsp
[0].code
); }
2141 #line 2141 "src/parse-gram.c" /* yacc.c:1646 */
2145 #line 324 "src/parse-gram.y" /* yacc.c:1646 */
2146 { current_param
= (yyvsp
[0].param
); }
2147 #line 2147 "src/parse-gram.c" /* yacc.c:1646 */
2151 #line 324 "src/parse-gram.y" /* yacc.c:1646 */
2152 { current_param
= param_none
; }
2153 #line 2153 "src/parse-gram.c" /* yacc.c:1646 */
2157 #line 325 "src/parse-gram.y" /* yacc.c:1646 */
2158 { version_check (&(yylsp
[0]), (yyvsp
[0].code
)); }
2159 #line 2159 "src/parse-gram.c" /* yacc.c:1646 */
2163 #line 327 "src/parse-gram.y" /* yacc.c:1646 */
2165 char const *skeleton_user
= (yyvsp
[0].code
);
2166 if (strchr (skeleton_user
, '/'))
2168 size_t dir_length
= strlen (current_file
);
2169 char *skeleton_build
;
2170 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2172 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2175 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2178 memcpy (skeleton_build
, current_file
, dir_length
);
2179 skeleton_build
[dir_length
++] = '/';
2181 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2182 skeleton_user
= uniqstr_new (skeleton_build
);
2183 free (skeleton_build
);
2185 skeleton_arg (skeleton_user
, grammar_prio
, (yylsp
[-1]));
2187 #line 2187 "src/parse-gram.c" /* yacc.c:1646 */
2191 #line 350 "src/parse-gram.y" /* yacc.c:1646 */
2192 { token_table_flag
= true; }
2193 #line 2193 "src/parse-gram.c" /* yacc.c:1646 */
2197 #line 351 "src/parse-gram.y" /* yacc.c:1646 */
2198 { report_flag
|= report_states
; }
2199 #line 2199 "src/parse-gram.c" /* yacc.c:1646 */
2203 #line 352 "src/parse-gram.y" /* yacc.c:1646 */
2204 { yacc_flag
= true; }
2205 #line 2205 "src/parse-gram.c" /* yacc.c:1646 */
2209 #line 357 "src/parse-gram.y" /* yacc.c:1646 */
2210 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2211 #line 2211 "src/parse-gram.c" /* yacc.c:1646 */
2215 #line 358 "src/parse-gram.y" /* yacc.c:1646 */
2216 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2217 #line 2217 "src/parse-gram.c" /* yacc.c:1646 */
2221 #line 370 "src/parse-gram.y" /* yacc.c:1646 */
2223 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
2225 #line 2225 "src/parse-gram.c" /* yacc.c:1646 */
2229 #line 374 "src/parse-gram.y" /* yacc.c:1646 */
2232 code_props_symbol_action_init (&code
, (yyvsp
[-1].code
), (yylsp
[-1]));
2233 code_props_translate_code (&code
);
2236 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2237 symbol_list_code_props_set (list
, (yyvsp
[-2].code_type
), &code
);
2238 symbol_list_free ((yyvsp
[0].list
));
2241 #line 2241 "src/parse-gram.c" /* yacc.c:1646 */
2245 #line 386 "src/parse-gram.y" /* yacc.c:1646 */
2247 default_prec
= true;
2249 #line 2249 "src/parse-gram.c" /* yacc.c:1646 */
2253 #line 390 "src/parse-gram.y" /* yacc.c:1646 */
2255 default_prec
= false;
2257 #line 2257 "src/parse-gram.c" /* yacc.c:1646 */
2261 #line 394 "src/parse-gram.y" /* yacc.c:1646 */
2263 /* Do not invoke muscle_percent_code_grow here since it invokes
2264 muscle_user_name_list_grow. */
2265 muscle_code_grow ("percent_code()",
2266 translate_code_braceless ((yyvsp
[0].code
), (yylsp
[0])), (yylsp
[0]));
2267 code_scanner_last_string_free ();
2269 #line 2269 "src/parse-gram.c" /* yacc.c:1646 */
2273 #line 402 "src/parse-gram.y" /* yacc.c:1646 */
2275 muscle_percent_code_grow ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), translate_code_braceless ((yyvsp
[0].code
), (yylsp
[0])), (yylsp
[0]));
2276 code_scanner_last_string_free ();
2278 #line 2278 "src/parse-gram.c" /* yacc.c:1646 */
2282 #line 412 "src/parse-gram.y" /* yacc.c:1646 */
2283 { (yyval
.code_type
) = destructor
; }
2284 #line 2284 "src/parse-gram.c" /* yacc.c:1646 */
2288 #line 413 "src/parse-gram.y" /* yacc.c:1646 */
2289 { (yyval
.code_type
) = printer
; }
2290 #line 2290 "src/parse-gram.c" /* yacc.c:1646 */
2294 #line 423 "src/parse-gram.y" /* yacc.c:1646 */
2296 #line 2296 "src/parse-gram.c" /* yacc.c:1646 */
2300 #line 424 "src/parse-gram.y" /* yacc.c:1646 */
2301 { muscle_code_grow ("union_name", (yyvsp
[0].uniqstr
), (yylsp
[0])); }
2302 #line 2302 "src/parse-gram.c" /* yacc.c:1646 */
2306 #line 429 "src/parse-gram.y" /* yacc.c:1646 */
2309 muscle_code_grow ("union_members", translate_code_braceless ((yyvsp
[0].code
), (yylsp
[0])), (yylsp
[0]));
2310 code_scanner_last_string_free ();
2312 #line 2312 "src/parse-gram.c" /* yacc.c:1646 */
2316 #line 440 "src/parse-gram.y" /* yacc.c:1646 */
2317 { current_class
= nterm_sym
; }
2318 #line 2318 "src/parse-gram.c" /* yacc.c:1646 */
2322 #line 441 "src/parse-gram.y" /* yacc.c:1646 */
2324 current_class
= unknown_sym
;
2325 current_type
= NULL
;
2327 #line 2327 "src/parse-gram.c" /* yacc.c:1646 */
2331 #line 445 "src/parse-gram.y" /* yacc.c:1646 */
2332 { current_class
= token_sym
; }
2333 #line 2333 "src/parse-gram.c" /* yacc.c:1646 */
2337 #line 446 "src/parse-gram.y" /* yacc.c:1646 */
2339 current_class
= unknown_sym
;
2340 current_type
= NULL
;
2342 #line 2342 "src/parse-gram.c" /* yacc.c:1646 */
2346 #line 451 "src/parse-gram.y" /* yacc.c:1646 */
2350 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2351 symbol_type_set (list
->content
.sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
2352 symbol_list_free ((yyvsp
[0].list
));
2354 #line 2354 "src/parse-gram.c" /* yacc.c:1646 */
2358 #line 462 "src/parse-gram.y" /* yacc.c:1646 */
2362 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2364 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[-1]));
2365 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
2367 symbol_list_free ((yyvsp
[0].list
));
2368 current_type
= NULL
;
2370 #line 2370 "src/parse-gram.c" /* yacc.c:1646 */
2374 #line 476 "src/parse-gram.y" /* yacc.c:1646 */
2375 { (yyval
.assoc
) = left_assoc
; }
2376 #line 2376 "src/parse-gram.c" /* yacc.c:1646 */
2380 #line 477 "src/parse-gram.y" /* yacc.c:1646 */
2381 { (yyval
.assoc
) = right_assoc
; }
2382 #line 2382 "src/parse-gram.c" /* yacc.c:1646 */
2386 #line 478 "src/parse-gram.y" /* yacc.c:1646 */
2387 { (yyval
.assoc
) = non_assoc
; }
2388 #line 2388 "src/parse-gram.c" /* yacc.c:1646 */
2392 #line 479 "src/parse-gram.y" /* yacc.c:1646 */
2393 { (yyval
.assoc
) = precedence_assoc
; }
2394 #line 2394 "src/parse-gram.c" /* yacc.c:1646 */
2398 #line 483 "src/parse-gram.y" /* yacc.c:1646 */
2399 { current_type
= NULL
; }
2400 #line 2400 "src/parse-gram.c" /* yacc.c:1646 */
2404 #line 484 "src/parse-gram.y" /* yacc.c:1646 */
2405 { current_type
= (yyvsp
[0].uniqstr
); tag_seen
= true; }
2406 #line 2406 "src/parse-gram.c" /* yacc.c:1646 */
2410 #line 490 "src/parse-gram.y" /* yacc.c:1646 */
2411 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2412 #line 2412 "src/parse-gram.c" /* yacc.c:1646 */
2416 #line 492 "src/parse-gram.y" /* yacc.c:1646 */
2417 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2418 #line 2418 "src/parse-gram.c" /* yacc.c:1646 */
2422 #line 497 "src/parse-gram.y" /* yacc.c:1646 */
2424 (yyval
.symbol
) = (yyvsp
[0].symbol
);
2425 symbol_class_set ((yyvsp
[0].symbol
), token_sym
, (yylsp
[0]), false);
2427 #line 2427 "src/parse-gram.c" /* yacc.c:1646 */
2431 #line 502 "src/parse-gram.y" /* yacc.c:1646 */
2433 (yyval
.symbol
) = (yyvsp
[-1].symbol
);
2434 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2435 symbol_class_set ((yyvsp
[-1].symbol
), token_sym
, (yylsp
[-1]), false);
2437 #line 2437 "src/parse-gram.c" /* yacc.c:1646 */
2441 #line 512 "src/parse-gram.y" /* yacc.c:1646 */
2442 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2443 #line 2443 "src/parse-gram.c" /* yacc.c:1646 */
2447 #line 514 "src/parse-gram.y" /* yacc.c:1646 */
2448 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2449 #line 2449 "src/parse-gram.c" /* yacc.c:1646 */
2453 #line 518 "src/parse-gram.y" /* yacc.c:1646 */
2454 { (yyval
.list
) = (yyvsp
[0].list
); }
2455 #line 2455 "src/parse-gram.c" /* yacc.c:1646 */
2459 #line 519 "src/parse-gram.y" /* yacc.c:1646 */
2460 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), (yyvsp
[0].list
)); }
2461 #line 2461 "src/parse-gram.c" /* yacc.c:1646 */
2465 #line 523 "src/parse-gram.y" /* yacc.c:1646 */
2466 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2467 #line 2467 "src/parse-gram.c" /* yacc.c:1646 */
2471 #line 524 "src/parse-gram.y" /* yacc.c:1646 */
2472 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2473 #line 2473 "src/parse-gram.c" /* yacc.c:1646 */
2477 #line 529 "src/parse-gram.y" /* yacc.c:1646 */
2478 { (yyval
.uniqstr
) = uniqstr_new ("*"); }
2479 #line 2479 "src/parse-gram.c" /* yacc.c:1646 */
2483 #line 530 "src/parse-gram.y" /* yacc.c:1646 */
2484 { (yyval
.uniqstr
) = uniqstr_new (""); }
2485 #line 2485 "src/parse-gram.c" /* yacc.c:1646 */
2489 #line 536 "src/parse-gram.y" /* yacc.c:1646 */
2491 current_type
= (yyvsp
[0].uniqstr
);
2494 #line 2494 "src/parse-gram.c" /* yacc.c:1646 */
2498 #line 541 "src/parse-gram.y" /* yacc.c:1646 */
2500 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]), true);
2501 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
2503 #line 2503 "src/parse-gram.c" /* yacc.c:1646 */
2507 #line 546 "src/parse-gram.y" /* yacc.c:1646 */
2509 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2510 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2511 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2513 #line 2513 "src/parse-gram.c" /* yacc.c:1646 */
2517 #line 552 "src/parse-gram.y" /* yacc.c:1646 */
2519 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2520 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2521 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2523 #line 2523 "src/parse-gram.c" /* yacc.c:1646 */
2527 #line 558 "src/parse-gram.y" /* yacc.c:1646 */
2529 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]), true);
2530 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
2531 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
2532 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2534 #line 2534 "src/parse-gram.c" /* yacc.c:1646 */
2538 #line 588 "src/parse-gram.y" /* yacc.c:1646 */
2542 #line 2542 "src/parse-gram.c" /* yacc.c:1646 */
2546 #line 594 "src/parse-gram.y" /* yacc.c:1646 */
2547 { current_lhs ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2548 #line 2548 "src/parse-gram.c" /* yacc.c:1646 */
2552 #line 595 "src/parse-gram.y" /* yacc.c:1646 */
2554 /* Free the current lhs. */
2555 current_lhs (0, (yylsp
[-3]), 0);
2557 #line 2557 "src/parse-gram.c" /* yacc.c:1646 */
2561 #line 602 "src/parse-gram.y" /* yacc.c:1646 */
2562 { grammar_current_rule_end ((yylsp
[0])); }
2563 #line 2563 "src/parse-gram.c" /* yacc.c:1646 */
2567 #line 603 "src/parse-gram.y" /* yacc.c:1646 */
2568 { grammar_current_rule_end ((yylsp
[0])); }
2569 #line 2569 "src/parse-gram.c" /* yacc.c:1646 */
2573 #line 610 "src/parse-gram.y" /* yacc.c:1646 */
2574 { grammar_current_rule_begin (current_lhs_symbol
, current_lhs_location
,
2575 current_lhs_named_ref
); }
2576 #line 2576 "src/parse-gram.c" /* yacc.c:1646 */
2580 #line 613 "src/parse-gram.y" /* yacc.c:1646 */
2581 { grammar_current_rule_symbol_append ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2582 #line 2582 "src/parse-gram.c" /* yacc.c:1646 */
2586 #line 615 "src/parse-gram.y" /* yacc.c:1646 */
2587 { grammar_current_rule_action_append ((yyvsp
[-1].code
), (yylsp
[-1]), (yyvsp
[0].named_ref
), false); }
2588 #line 2588 "src/parse-gram.c" /* yacc.c:1646 */
2592 #line 617 "src/parse-gram.y" /* yacc.c:1646 */
2593 { grammar_current_rule_action_append ((yyvsp
[0].code
), (yylsp
[0]), NULL
, true); }
2594 #line 2594 "src/parse-gram.c" /* yacc.c:1646 */
2598 #line 619 "src/parse-gram.y" /* yacc.c:1646 */
2599 { grammar_current_rule_empty_set ((yylsp
[0])); }
2600 #line 2600 "src/parse-gram.c" /* yacc.c:1646 */
2604 #line 621 "src/parse-gram.y" /* yacc.c:1646 */
2605 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2606 #line 2606 "src/parse-gram.c" /* yacc.c:1646 */
2610 #line 623 "src/parse-gram.y" /* yacc.c:1646 */
2611 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2612 #line 2612 "src/parse-gram.c" /* yacc.c:1646 */
2616 #line 625 "src/parse-gram.y" /* yacc.c:1646 */
2617 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2618 #line 2618 "src/parse-gram.c" /* yacc.c:1646 */
2622 #line 629 "src/parse-gram.y" /* yacc.c:1646 */
2623 { (yyval
.named_ref
) = 0; }
2624 #line 2624 "src/parse-gram.c" /* yacc.c:1646 */
2628 #line 630 "src/parse-gram.y" /* yacc.c:1646 */
2629 { (yyval
.named_ref
) = named_ref_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2630 #line 2630 "src/parse-gram.c" /* yacc.c:1646 */
2634 #line 641 "src/parse-gram.y" /* yacc.c:1646 */
2635 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[0].code
)); }
2636 #line 2636 "src/parse-gram.c" /* yacc.c:1646 */
2640 #line 666 "src/parse-gram.y" /* yacc.c:1646 */
2641 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= ""; }
2642 #line 2642 "src/parse-gram.c" /* yacc.c:1646 */
2646 #line 667 "src/parse-gram.y" /* yacc.c:1646 */
2647 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= (yyvsp
[0].uniqstr
); }
2648 #line 2648 "src/parse-gram.c" /* yacc.c:1646 */
2652 #line 668 "src/parse-gram.y" /* yacc.c:1646 */
2653 { (yyval
.value
).kind
= muscle_string
; (yyval
.value
).chars
= (yyvsp
[0].code
); }
2654 #line 2654 "src/parse-gram.c" /* yacc.c:1646 */
2658 #line 669 "src/parse-gram.y" /* yacc.c:1646 */
2659 { (yyval
.value
).kind
= muscle_code
; (yyval
.value
).chars
= strip_braces ((yyvsp
[0].code
)); }
2660 #line 2660 "src/parse-gram.c" /* yacc.c:1646 */
2664 #line 682 "src/parse-gram.y" /* yacc.c:1646 */
2665 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2666 #line 2666 "src/parse-gram.c" /* yacc.c:1646 */
2670 #line 684 "src/parse-gram.y" /* yacc.c:1646 */
2672 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[0].character
)), (yylsp
[0]));
2673 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2674 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[0].character
), (yylsp
[0]));
2676 #line 2676 "src/parse-gram.c" /* yacc.c:1646 */
2680 #line 692 "src/parse-gram.y" /* yacc.c:1646 */
2681 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2682 #line 2682 "src/parse-gram.c" /* yacc.c:1646 */
2686 #line 704 "src/parse-gram.y" /* yacc.c:1646 */
2688 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].code
)), (yylsp
[0]));
2689 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2691 #line 2691 "src/parse-gram.c" /* yacc.c:1646 */
2695 #line 713 "src/parse-gram.y" /* yacc.c:1646 */
2697 muscle_code_grow ("epilogue", translate_code ((yyvsp
[0].code
), (yylsp
[0]), true), (yylsp
[0]));
2698 code_scanner_last_string_free ();
2700 #line 2700 "src/parse-gram.c" /* yacc.c:1646 */
2704 #line 2704 "src/parse-gram.c" /* yacc.c:1646 */
2707 if (yychar_backup
!= yychar
)
2708 YY_LAC_DISCARD ("yychar change");
2710 /* User semantic actions sometimes alter yychar, and that requires
2711 that yytoken be updated with the new translation. We take the
2712 approach of translating immediately before every use of yytoken.
2713 One alternative is translating here after every semantic action,
2714 but that translation would be missed if the semantic action invokes
2715 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2716 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2717 incorrect destructor might then be invoked immediately. In the
2718 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2719 to an incorrect destructor call or verbose syntax error message
2720 before the lookahead is translated. */
2721 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2725 YY_STACK_PRINT (yyss
, yyssp
);
2730 /* Now 'shift' the result of the reduction. Determine what state
2731 that goes to, based on the state we popped back to and the rule
2732 number reduced by. */
2736 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2737 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2738 yystate
= yytable
[yystate
];
2740 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2745 /*--------------------------------------.
2746 | yyerrlab -- here on detecting error. |
2747 `--------------------------------------*/
2749 /* Make sure we have latest lookahead translation. See comments at
2750 user semantic actions for why this is necessary. */
2751 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2753 /* If not already recovering from an error, report this error. */
2757 #if ! YYERROR_VERBOSE
2758 yyerror (&yylloc
, YY_("syntax error"));
2760 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2761 yyesa, &yyes, &yyes_capacity, \
2764 char const *yymsgp
= YY_("syntax error");
2765 int yysyntax_error_status
;
2766 if (yychar
!= YYEMPTY
)
2768 yysyntax_error_status
= YYSYNTAX_ERROR
;
2769 if (yysyntax_error_status
== 0)
2771 else if (yysyntax_error_status
== 1)
2773 if (yymsg
!= yymsgbuf
)
2774 YYSTACK_FREE (yymsg
);
2775 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2779 yymsg_alloc
= sizeof yymsgbuf
;
2780 yysyntax_error_status
= 2;
2784 yysyntax_error_status
= YYSYNTAX_ERROR
;
2788 yyerror (&yylloc
, yymsgp
);
2789 if (yysyntax_error_status
== 2)
2790 goto yyexhaustedlab
;
2792 # undef YYSYNTAX_ERROR
2796 yyerror_range
[1] = yylloc
;
2798 if (yyerrstatus
== 3)
2800 /* If just tried and failed to reuse lookahead token after an
2801 error, discard it. */
2803 if (yychar
<= YYEOF
)
2805 /* Return failure if at end of input. */
2806 if (yychar
== YYEOF
)
2811 yydestruct ("Error: discarding",
2812 yytoken
, &yylval
, &yylloc
);
2817 /* Else will try to reuse lookahead token after shifting the error
2822 /*---------------------------------------------------.
2823 | yyerrorlab -- error raised explicitly by YYERROR. |
2824 `---------------------------------------------------*/
2827 /* Pacify compilers like GCC when the user code never invokes
2828 YYERROR and the label yyerrorlab therefore never appears in user
2830 if (/*CONSTCOND*/ 0)
2833 yyerror_range
[1] = yylsp
[1-yylen
];
2834 /* Do not reclaim the symbols of the rule whose action triggered
2838 YY_STACK_PRINT (yyss
, yyssp
);
2843 /*-------------------------------------------------------------.
2844 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2845 `-------------------------------------------------------------*/
2847 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2851 yyn
= yypact
[yystate
];
2852 if (!yypact_value_is_default (yyn
))
2855 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2863 /* Pop the current state because it cannot handle the error token. */
2867 yyerror_range
[1] = *yylsp
;
2868 yydestruct ("Error: popping",
2869 yystos
[yystate
], yyvsp
, yylsp
);
2872 YY_STACK_PRINT (yyss
, yyssp
);
2875 /* If the stack popping above didn't lose the initial context for the
2876 current lookahead token, the shift below will for sure. */
2877 YY_LAC_DISCARD ("error recovery");
2879 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2881 YY_IGNORE_MAYBE_UNINITIALIZED_END
2883 yyerror_range
[2] = yylloc
;
2884 /* Using YYLLOC is tempting, but would change the location of
2885 the lookahead. YYLOC is available though. */
2886 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
2889 /* Shift the error token. */
2890 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2896 /*-------------------------------------.
2897 | yyacceptlab -- YYACCEPT comes here. |
2898 `-------------------------------------*/
2903 /*-----------------------------------.
2904 | yyabortlab -- YYABORT comes here. |
2905 `-----------------------------------*/
2911 /*-------------------------------------------------.
2912 | yyexhaustedlab -- memory exhaustion comes here. |
2913 `-------------------------------------------------*/
2915 yyerror (&yylloc
, YY_("memory exhausted"));
2921 if (yychar
!= YYEMPTY
)
2923 /* Make sure we have latest lookahead translation. See comments at
2924 user semantic actions for why this is necessary. */
2925 yytoken
= YYTRANSLATE (yychar
);
2926 yydestruct ("Cleanup: discarding lookahead",
2927 yytoken
, &yylval
, &yylloc
);
2929 /* Do not reclaim the symbols of the rule whose action triggered
2930 this YYABORT or YYACCEPT. */
2932 YY_STACK_PRINT (yyss
, yyssp
);
2933 while (yyssp
!= yyss
)
2935 yydestruct ("Cleanup: popping",
2936 yystos
[*yyssp
], yyvsp
, yylsp
);
2941 YYSTACK_FREE (yyss
);
2944 YYSTACK_FREE (yyes
);
2946 if (yymsg
!= yymsgbuf
)
2947 YYSTACK_FREE (yymsg
);
2951 #line 719 "src/parse-gram.y" /* yacc.c:1906 */
2954 /* Return the location of the left-hand side of a rule whose
2955 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2956 the right-hand side, and return an empty location equal to the end
2957 boundary of RHS[0] if the right-hand side is empty. */
2960 lloc_default (YYLTYPE
const *rhs
, int n
)
2965 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2966 The bug is fixed in 7.4.2m, but play it safe for now. */
2967 loc
.start
= rhs
[n
].end
;
2968 loc
.end
= rhs
[n
].end
;
2970 /* Ignore empty nonterminals the start of the right-hand side.
2971 Do not bother to ignore them at the end of the right-hand side,
2972 since empty nonterminals have the same end as their predecessors. */
2973 for (i
= 1; i
<= n
; i
++)
2974 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2976 loc
.start
= rhs
[i
].start
;
2984 char *strip_braces (char *code
)
2986 code
[strlen (code
) - 1] = 0;
2992 translate_code (char *code
, location loc
, bool plain
)
2994 code_props plain_code
;
2996 code_props_plain_init (&plain_code
, code
, loc
);
2998 code_props_symbol_action_init (&plain_code
, code
, loc
);
2999 code_props_translate_code (&plain_code
);
3000 gram_scanner_last_string_free ();
3001 return plain_code
.code
;
3006 translate_code_braceless (char *code
, location loc
)
3008 return translate_code (strip_braces (code
), loc
, true);
3012 add_param (param_type type
, char *decl
, location loc
)
3014 static char const alphanum
[26 + 26 + 1 + 10] =
3015 "abcdefghijklmnopqrstuvwxyz"
3016 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3020 char const *name_start
= NULL
;
3023 /* Stop on last actual character. */
3024 for (p
= decl
; p
[1]; p
++)
3026 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
3027 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
3030 /* Strip the surrounding '{' and '}', and any blanks just inside
3033 while (c_isspace ((unsigned char) *p
))
3037 while (c_isspace ((unsigned char) *decl
))
3042 complain (&loc
, complaint
, _("missing identifier in parameter declaration"));
3045 char *name
= xmemdup0 (name_start
, strspn (name_start
, alphanum
));
3046 if (type
& param_lex
)
3047 muscle_pair_list_grow ("lex_param", decl
, name
);
3048 if (type
& param_parse
)
3049 muscle_pair_list_grow ("parse_param", decl
, name
);
3053 gram_scanner_last_string_free ();
3058 version_check (location
const *loc
, char const *version
)
3060 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
3062 complain (loc
, complaint
, "require bison %s, but have %s",
3063 version
, PACKAGE_VERSION
);
3069 gram_error (location
const *loc
, char const *msg
)
3071 complain (loc
, complaint
, "%s", msg
);
3075 token_name (int type
)
3077 return yytname
[YYTRANSLATE (type
)];
3088 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
3089 return quotearg_style (escape_quoting_style
, buf
);
3095 current_lhs (symbol
*sym
, location loc
, named_ref
*ref
)
3097 current_lhs_symbol
= sym
;
3098 current_lhs_location
= loc
;
3099 /* In order to simplify memory management, named references for lhs
3100 are always assigned by deep copy into the current symbol_list
3101 node. This is because a single named-ref in the grammar may
3102 result in several uses when the user factors lhs between several
3103 rules using "|". Therefore free the parser's original copy. */
3104 free (current_lhs_named_ref
);
3105 current_lhs_named_ref
= ref
;