1 /* A Bison parser, made by GNU Bison 2.7.1164-a174b-dirty. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "2.7.1164-a174b-dirty"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Substitute the type names. */
62 #define YYSTYPE GRAM_STYPE
63 #define YYLTYPE GRAM_LTYPE
64 /* Substitute the variable and function names. */
65 #define yyparse gram_parse
66 #define yylex gram_lex
67 #define yyerror gram_error
68 #define yydebug gram_debug
69 #define yynerrs gram_nerrs
72 /* Copy the first part of user declarations. */
73 #line 1 "src/parse-gram.y" /* yacc.c:356 */
74 /* Bison Grammar Parser -*- C -*-
76 Copyright (C) 2002-2013 Free Software Foundation, Inc.
78 This file is part of Bison, the GNU Compiler Compiler.
80 This program is free software: you can redistribute it and/or modify
81 it under the terms of the GNU General Public License as published by
82 the Free Software Foundation, either version 3 of the License, or
83 (at your option) any later version.
85 This program is distributed in the hope that it will be useful,
86 but WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
90 You should have received a copy of the GNU General Public License
91 along with this program. If not, see <http://www.gnu.org/licenses/>. */
98 #include "conflicts.h"
102 #include "named-ref.h"
103 #include "quotearg.h"
107 #include "scan-gram.h"
108 #include "scan-code.h"
109 #include "xmemdup0.h"
111 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
112 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
114 #define YY_LOCATION_PRINT(File, Loc) \
115 location_print (Loc, File)
117 static void version_check (location
const *loc
, char const *version
);
119 static void gram_error (location
const *, char const *);
121 /* A string that describes a char (e.g., 'a' -> "'a'"). */
122 static char const *char_name (char);
124 #line 125 "src/parse-gram.c" /* yacc.c:356 */
127 # if defined __cplusplus && 201103L <= __cplusplus
128 # define YY_NULL nullptr
134 /* Enabling verbose error messages. */
135 #ifdef YYERROR_VERBOSE
136 # undef YYERROR_VERBOSE
137 # define YYERROR_VERBOSE 1
139 # define YYERROR_VERBOSE 1
142 /* In a future release of Bison, this section will be replaced
143 by #include "src/parse-gram.h". */
144 #ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
145 # define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
150 # define GRAM_DEBUG 1
152 # define GRAM_DEBUG 0
154 # else /* ! defined YYDEBUG */
155 # define GRAM_DEBUG 1
156 # endif /* ! defined YYDEBUG */
157 #endif /* ! defined GRAM_DEBUG */
159 extern int gram_debug
;
161 /* "%code requires" blocks. */
162 #line 218 "src/parse-gram.y" /* yacc.c:372 */
168 param_parse
= 1 << 1,
169 param_both
= param_lex
| param_parse
171 #line 649 "src/parse-gram.y" /* yacc.c:372 */
172 #include "muscle-tab.h"
174 #line 175 "src/parse-gram.c" /* yacc.c:372 */
177 #ifndef GRAM_TOKENTYPE
178 # define GRAM_TOKENTYPE
186 PERCENT_DESTRUCTOR
= 262,
187 PERCENT_PRINTER
= 263,
190 PERCENT_NONASSOC
= 266,
191 PERCENT_PRECEDENCE
= 267,
196 PERCENT_DEFAULT_PREC
= 272,
197 PERCENT_DEFINE
= 273,
198 PERCENT_DEFINES
= 274,
199 PERCENT_ERROR_VERBOSE
= 275,
200 PERCENT_EXPECT
= 276,
201 PERCENT_EXPECT_RR
= 277,
203 PERCENT_FILE_PREFIX
= 279,
204 PERCENT_GLR_PARSER
= 280,
205 PERCENT_INITIAL_ACTION
= 281,
206 PERCENT_LANGUAGE
= 282,
207 PERCENT_NAME_PREFIX
= 283,
208 PERCENT_NO_DEFAULT_PREC
= 284,
209 PERCENT_NO_LINES
= 285,
210 PERCENT_NONDETERMINISTIC_PARSER
= 286,
211 PERCENT_OUTPUT
= 287,
212 PERCENT_REQUIRE
= 288,
213 PERCENT_SKELETON
= 289,
215 PERCENT_TOKEN_TABLE
= 291,
216 PERCENT_VERBOSE
= 292,
219 BRACED_PREDICATE
= 295,
226 PERCENT_PERCENT
= 302,
241 #if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
242 typedef union GRAM_STYPE GRAM_STYPE
;
245 #line 170 "src/parse-gram.y" /* yacc.c:372 */
246 unsigned char character
;
247 #line 177 "src/parse-gram.y" /* yacc.c:372 */
251 #line 188 "src/parse-gram.y" /* yacc.c:372 */
253 #line 196 "src/parse-gram.y" /* yacc.c:372 */
255 #line 200 "src/parse-gram.y" /* yacc.c:372 */
257 #line 205 "src/parse-gram.y" /* yacc.c:372 */
259 #line 208 "src/parse-gram.y" /* yacc.c:372 */
261 #line 211 "src/parse-gram.y" /* yacc.c:372 */
262 named_ref
*named_ref
;
263 #line 238 "src/parse-gram.y" /* yacc.c:372 */
265 #line 413 "src/parse-gram.y" /* yacc.c:372 */
266 code_props_type code_type
;
267 #line 651 "src/parse-gram.y" /* yacc.c:372 */
275 #line 276 "src/parse-gram.c" /* yacc.c:372 */
277 # define GRAM_STYPE_IS_TRIVIAL 1
278 # define GRAM_STYPE_IS_DECLARED 1
282 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
283 typedef struct GRAM_LTYPE GRAM_LTYPE
;
291 # define GRAM_LTYPE_IS_DECLARED 1
292 # define GRAM_LTYPE_IS_TRIVIAL 1
297 int gram_parse (void);
299 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
301 /* Copy the second part of user declarations. */
303 #line 304 "src/parse-gram.c" /* yacc.c:375 */
304 /* Unqualified %code blocks. */
305 #line 53 "src/parse-gram.y" /* yacc.c:376 */
307 static int current_prec
= 0;
308 static location current_lhs_location
;
309 static named_ref
*current_lhs_named_ref
;
310 static symbol
*current_lhs_symbol
;
311 static symbol_class current_class
= unknown_sym
;
312 static uniqstr current_type
= NULL
;
314 /** Set the new current left-hand side symbol, possibly common
315 * to several right-hand side parts of rule.
319 current_lhs (symbol
*sym
, location loc
, named_ref
*ref
)
321 current_lhs_symbol
= sym
;
322 current_lhs_location
= loc
;
323 /* In order to simplify memory management, named references for lhs
324 are always assigned by deep copy into the current symbol_list
325 node. This is because a single named-ref in the grammar may
326 result in several uses when the user factors lhs between several
327 rules using "|". Therefore free the parser's original copy. */
328 free (current_lhs_named_ref
);
329 current_lhs_named_ref
= ref
;
332 #define YYTYPE_INT16 int_fast16_t
333 #define YYTYPE_INT8 int_fast8_t
334 #define YYTYPE_UINT16 uint_fast16_t
335 #define YYTYPE_UINT8 uint_fast8_t
336 #line 228 "src/parse-gram.y" /* yacc.c:376 */
338 /** Add a lex-param and/or a parse-param.
340 * \param type where to push this formal argument.
341 * \param decl the formal argument. Destroyed.
342 * \param loc the location in the source.
344 static void add_param (param_type type
, char *decl
, location loc
);
345 static param_type current_param
= param_none
;
347 #line 348 "src/parse-gram.c" /* yacc.c:376 */
354 typedef YYTYPE_UINT8 yytype_uint8
;
356 typedef unsigned char yytype_uint8
;
360 typedef YYTYPE_INT8 yytype_int8
;
362 typedef signed char yytype_int8
;
366 typedef YYTYPE_UINT16 yytype_uint16
;
368 typedef unsigned short int yytype_uint16
;
372 typedef YYTYPE_INT16 yytype_int16
;
374 typedef short int yytype_int16
;
378 # ifdef __SIZE_TYPE__
379 # define YYSIZE_T __SIZE_TYPE__
380 # elif defined size_t
381 # define YYSIZE_T size_t
382 # elif ! defined YYSIZE_T
383 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
384 # define YYSIZE_T size_t
386 # define YYSIZE_T unsigned int
390 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
393 # if defined YYENABLE_NLS && YYENABLE_NLS
395 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
396 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
400 # define YY_(Msgid) Msgid
404 #ifndef __attribute__
405 /* This feature is available in gcc versions 2.5 and later. */
406 # if (! defined __GNUC__ || __GNUC__ < 2 \
407 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
408 # define __attribute__(Spec) /* empty */
412 /* Suppress unused-variable warnings by "using" E. */
413 #if ! defined lint || defined __GNUC__
414 # define YYUSE(E) ((void) (E))
416 # define YYUSE(E) /* empty */
422 /* The parser invokes alloca or malloc; define the necessary symbols. */
424 # ifdef YYSTACK_ALLOC
425 /* Pacify GCC's 'empty if-body' warning. */
426 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
427 # ifndef YYSTACK_ALLOC_MAXIMUM
428 /* The OS might guarantee only one guard page at the bottom of the stack,
429 and a page size can be as small as 4096 bytes. So we cannot safely
430 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
431 to allow for a few compiler-allocated temporary stack slots. */
432 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
435 # define YYSTACK_ALLOC YYMALLOC
436 # define YYSTACK_FREE YYFREE
437 # ifndef YYSTACK_ALLOC_MAXIMUM
438 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
440 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
441 && ! ((defined YYMALLOC || defined malloc) \
442 && (defined YYFREE || defined free)))
443 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
444 # ifndef EXIT_SUCCESS
445 # define EXIT_SUCCESS 0
449 # define YYMALLOC malloc
450 # if ! defined malloc && ! defined EXIT_SUCCESS
451 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
456 # if ! defined free && ! defined EXIT_SUCCESS
457 void free (void *); /* INFRINGES ON USER NAME SPACE */
461 # define YYCOPY_NEEDED 1
465 #if (! defined yyoverflow \
466 && (! defined __cplusplus \
467 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
468 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
470 /* A type that is properly aligned for any stack member. */
473 yytype_int16 yyss_alloc
;
478 /* The size of the maximum gap between one aligned stack and the next. */
479 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
481 /* The size of an array large to enough to hold all stacks, each with
483 # define YYSTACK_BYTES(N) \
484 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
485 + 2 * YYSTACK_GAP_MAXIMUM)
487 # define YYCOPY_NEEDED 1
489 /* Relocate STACK from its old location to the new one. The
490 local variables YYSIZE and YYSTACKSIZE give the old and new number of
491 elements in the stack, and YYPTR gives the new location of the
492 stack. Advance YYPTR to a properly aligned location for the next
494 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
497 YYSIZE_T yynewbytes; \
498 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
499 Stack = &yyptr->Stack_alloc; \
500 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
501 yyptr += yynewbytes / sizeof (*yyptr); \
507 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
508 /* Copy COUNT objects from SRC to DST. The source and destination do
511 # if defined __GNUC__ && 1 < __GNUC__
512 # define YYCOPY(Dst, Src, Count) \
513 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
515 # define YYCOPY(Dst, Src, Count) \
519 for (yyi = 0; yyi < (Count); yyi++) \
520 (Dst)[yyi] = (Src)[yyi]; \
525 #endif /* !YYCOPY_NEEDED */
527 /* YYFINAL -- State number of the termination state. */
529 /* YYLAST -- Last index in YYTABLE. */
532 /* YYNTOKENS -- Number of terminals. */
534 /* YYNNTS -- Number of nonterminals. */
536 /* YYNRULES -- Number of rules. */
538 /* YYNSTATES -- Number of states. */
539 #define YYNSTATES 145
541 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
542 by yylex, with out-of-bounds checking. */
544 #define YYMAXUTOK 312
546 #define YYTRANSLATE(YYX) \
547 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
549 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
550 as returned by yylex, without out-of-bounds checking. */
551 static const yytype_uint8 yytranslate
[] =
553 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
579 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
580 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
581 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
582 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
583 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
588 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
589 static const yytype_uint16 yyrline
[] =
591 0, 261, 261, 270, 271, 275, 276, 286, 290, 295,
592 296, 301, 307, 308, 309, 310, 315, 324, 325, 326,
593 327, 328, 329, 329, 330, 331, 355, 356, 357, 358,
594 362, 363, 372, 373, 374, 378, 390, 394, 398, 405,
595 416, 417, 427, 428, 432, 444, 444, 449, 449, 454,
596 465, 480, 481, 482, 483, 487, 488, 493, 495, 500,
597 505, 515, 517, 522, 523, 527, 528, 532, 533, 534,
598 539, 544, 549, 555, 561, 572, 573, 582, 583, 589,
599 590, 591, 598, 598, 606, 607, 608, 613, 616, 618,
600 620, 622, 624, 626, 628, 633, 634, 644, 645, 670,
601 671, 672, 673, 682, 702, 704, 713, 718, 719, 724,
606 #if GRAM_DEBUG || YYERROR_VERBOSE || 1
607 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
608 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
609 static const char *const yytname
[] =
611 "\"end of file\"", "error", "$undefined", "\"string\"", "\"%token\"",
612 "\"%nterm\"", "\"%type\"", "\"%destructor\"", "\"%printer\"",
613 "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%precedence\"",
614 "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
615 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
616 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
617 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
618 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
619 "\"%nondeterministic-parser\"", "\"%output\"", "\"%require\"",
620 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
621 "\"%yacc\"", "\"{...}\"", "\"%?{...}\"", "\"[identifier]\"", "\"char\"",
622 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
623 "\"|\"", "\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"",
624 "\"integer\"", "\"%param\"", "\"%union\"", "\"%empty\"", "$accept",
625 "input", "prologue_declarations", "prologue_declaration", "$@1",
626 "params", "grammar_declaration", "code_props_type", "union_name",
627 "symbol_declaration", "$@2", "$@3", "precedence_declaration",
628 "precedence_declarator", "tag.opt", "symbols.prec", "symbol.prec",
629 "symbols.1", "generic_symlist", "generic_symlist_item", "tag",
630 "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
631 "rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
632 "braceless", "id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
637 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
638 (internal) symbol number NUM (which must be that of a token). */
639 static const yytype_uint16 yytoknum
[] =
641 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
642 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
643 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
644 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
645 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
646 305, 306, 307, 308, 309, 310, 311, 312
650 #define YYPACT_NINF -115
652 #define yypact_value_is_default(Yystate) \
653 (!!((Yystate) == (-115)))
655 #define YYTABLE_NINF -111
657 #define yytable_value_is_error(Yytable_value) \
660 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
662 static const yytype_int8 yypact
[] =
664 -115, 16, 109, -115, -115, -115, -28, -115, -115, -115,
665 -115, -115, -115, -14, -115, 25, 23, -115, -27, -20,
666 -115, 39, -115, 7, 48, 71, -115, -115, -115, 72,
667 73, 74, -2, -115, -115, -115, 56, -115, -115, -115,
668 33, -115, -115, 40, -115, -115, 37, 54, 54, -2,
669 -115, 50, -115, -115, -115, 2, -115, -115, -115, -115,
670 -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
671 -115, -115, 51, -115, 53, 3, -115, -115, 49, 65,
672 -115, 50, 42, -115, -2, -115, -115, 54, -1, 54,
673 -2, -115, -115, -115, -115, -115, -115, -115, -115, 63,
674 -115, -115, -115, -115, -115, 69, -115, -115, -115, -115,
675 42, -115, -115, -115, -2, -115, 38, -115, 106, -115,
676 -115, -115, -115, -115, -115, -115, -115, -115, -15, 41,
677 -115, -115, -2, 57, 59, 49, -115, -115, 49, 41,
678 -115, -115, -115, -115, -115
681 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
682 Performed when YYTABLE does not specify something else to do. Zero
683 means the default is an error. */
684 static const yytype_uint8 yydefact
[] =
686 3, 0, 0, 1, 47, 45, 0, 40, 41, 51,
687 52, 53, 54, 0, 36, 0, 9, 11, 0, 0,
688 7, 0, 15, 0, 0, 0, 37, 19, 20, 0,
689 0, 0, 0, 26, 27, 28, 0, 6, 29, 22,
690 42, 4, 5, 0, 33, 32, 55, 0, 0, 0,
691 103, 0, 38, 98, 97, 99, 10, 12, 13, 14,
692 16, 17, 18, 21, 24, 25, 109, 105, 104, 107,
693 34, 108, 0, 106, 0, 0, 77, 79, 95, 0,
694 43, 0, 0, 56, 0, 70, 75, 48, 71, 46,
695 49, 61, 39, 101, 100, 8, 102, 81, 80, 0,
696 78, 2, 96, 82, 31, 23, 44, 67, 68, 69,
697 35, 63, 66, 65, 50, 57, 59, 76, 72, 73,
698 62, 111, 87, 30, 64, 58, 60, 74, 83, 84,
699 87, 86, 0, 0, 0, 95, 90, 91, 95, 85,
703 /* YYPGOTO[NTERM-NUM]. */
704 static const yytype_int8 yypgoto
[] =
706 -115, -115, -115, -115, -115, -115, 120, -115, -115, -115,
707 -115, -115, -115, -115, -115, -115, 9, -115, -115, 14,
708 -115, -50, 100, -115, 75, -115, -115, -115, 19, -114,
709 -115, -115, -33, -18, -115, -32, -82, -115
712 /* YYDEFGOTO[NTERM-NUM]. */
713 static const yytype_int16 yydefgoto
[] =
715 -1, 1, 2, 41, 79, 105, 74, 43, 81, 44,
716 48, 47, 45, 46, 84, 114, 115, 90, 110, 111,
717 112, 86, 87, 75, 76, 77, 122, 128, 129, 103,
718 55, 95, 52, 69, 78, 113, 71, 101
721 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
722 positive, shift that token. If negative, reduce the rule whose
723 number is the opposite. If YYTABLE_NINF, syntax error. */
724 static const yytype_int16 yytable
[] =
726 70, 66, 66, -110, 72, 93, 119, 4, 5, 6,
727 7, 8, 9, 10, 11, 12, 3, 91, 92, 13,
728 14, 143, 96, 49, 144, 50, 56, 57, 53, 88,
729 88, 51, 26, 130, 58, 131, 127, 117, 32, 117,
730 67, 50, 59, 68, 66, 66, 60, 94, 106, 73,
731 99, 61, 116, 118, 132, 133, 134, 72, 120, 40,
732 4, 5, 6, 7, 8, 9, 10, 11, 12, 88,
733 54, 88, 13, 14, 62, 63, 64, 65, 80, 82,
734 135, 136, 116, 67, 67, 26, 68, 68, 83, 50,
735 102, 32, 126, 107, 108, 109, 67, 138, 137, 68,
736 140, 97, 73, 98, 104, 85, 121, 138, 123, 66,
737 142, 141, 40, 4, 5, 6, 7, 8, 9, 10,
738 11, 12, 42, 125, 124, 13, 14, 15, 16, 17,
739 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
740 28, 29, 30, 31, 32, 33, 34, 35, 89, 139,
741 100, 0, 0, 0, 0, 0, 36, 0, 37, 38,
745 static const yytype_int16 yycheck
[] =
747 32, 3, 3, 0, 1, 3, 88, 4, 5, 6,
748 7, 8, 9, 10, 11, 12, 0, 49, 51, 16,
749 17, 135, 55, 51, 138, 39, 3, 54, 3, 47,
750 48, 45, 29, 48, 54, 50, 118, 87, 35, 89,
751 42, 39, 3, 45, 3, 3, 39, 45, 81, 46,
752 47, 3, 84, 54, 13, 14, 15, 1, 90, 56,
753 4, 5, 6, 7, 8, 9, 10, 11, 12, 87,
754 45, 89, 16, 17, 3, 3, 3, 3, 45, 39,
755 39, 40, 114, 42, 42, 29, 45, 45, 51, 39,
756 41, 35, 54, 51, 52, 53, 42, 129, 57, 45,
757 132, 50, 46, 50, 39, 51, 43, 139, 39, 3,
758 51, 54, 56, 4, 5, 6, 7, 8, 9, 10,
759 11, 12, 2, 114, 110, 16, 17, 18, 19, 20,
760 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
761 31, 32, 33, 34, 35, 36, 37, 38, 48, 130,
762 75, -1, -1, -1, -1, -1, 47, -1, 49, 50,
763 -1, -1, -1, -1, 55, 56
766 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
767 symbol of state STATE-NUM. */
768 static const yytype_uint8 yystos
[] =
770 0, 59, 60, 0, 4, 5, 6, 7, 8, 9,
771 10, 11, 12, 16, 17, 18, 19, 20, 21, 22,
772 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
773 33, 34, 35, 36, 37, 38, 47, 49, 50, 55,
774 56, 61, 64, 65, 67, 70, 71, 69, 68, 51,
775 39, 45, 90, 3, 45, 88, 3, 54, 54, 3,
776 39, 3, 3, 3, 3, 3, 3, 42, 45, 91,
777 93, 94, 1, 46, 64, 81, 82, 83, 92, 62,
778 45, 66, 39, 51, 72, 51, 79, 80, 91, 80,
779 75, 93, 90, 3, 45, 89, 90, 50, 50, 47,
780 82, 95, 41, 87, 39, 63, 90, 51, 52, 53,
781 76, 77, 78, 93, 73, 74, 93, 79, 54, 94,
782 93, 43, 84, 39, 77, 74, 54, 94, 85, 86,
783 48, 50, 13, 14, 15, 39, 40, 57, 93, 86,
787 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
788 static const yytype_uint8 yyr1
[] =
790 0, 58, 59, 60, 60, 61, 61, 61, 61, 61,
791 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
792 61, 61, 62, 61, 61, 61, 61, 61, 61, 61,
793 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
794 65, 65, 66, 66, 64, 68, 67, 69, 67, 67,
795 70, 71, 71, 71, 71, 72, 72, 73, 73, 74,
796 74, 75, 75, 76, 76, 77, 77, 78, 78, 78,
797 79, 79, 79, 79, 79, 80, 80, 81, 81, 82,
798 82, 82, 84, 83, 85, 85, 85, 86, 86, 86,
799 86, 86, 86, 86, 86, 87, 87, 88, 88, 89,
800 89, 89, 89, 90, 91, 91, 92, 93, 93, 94,
804 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
805 static const yytype_uint8 yyr2
[] =
807 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
808 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
809 1, 2, 0, 3, 2, 2, 1, 1, 1, 1,
810 2, 1, 1, 1, 2, 3, 1, 1, 2, 3,
811 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
812 3, 1, 1, 1, 1, 0, 1, 1, 2, 1,
813 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
814 1, 1, 2, 2, 3, 1, 2, 1, 2, 1,
815 2, 2, 0, 4, 1, 3, 2, 0, 3, 3,
816 2, 2, 3, 3, 3, 0, 1, 1, 1, 0,
817 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
822 #define yyerrok (yyerrstatus = 0)
823 #define yyclearin (yychar = YYEMPTY)
827 #define YYACCEPT goto yyacceptlab
828 #define YYABORT goto yyabortlab
829 #define YYERROR goto yyerrorlab
832 #define YYRECOVERING() (!!yyerrstatus)
834 #define YYBACKUP(Token, Value) \
836 if (yychar == YYEMPTY) \
840 YYPOPSTACK (yylen); \
842 YY_LAC_DISCARD ("YYBACKUP"); \
847 yyerror (&yylloc, YY_("syntax error: cannot back up")); \
852 /* Error token number */
854 #define YYERRCODE 256
857 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
858 If N is 0, then set CURRENT to the empty location which ends
859 the previous symbol: RHS[0] (always defined). */
861 #ifndef YYLLOC_DEFAULT
862 # define YYLLOC_DEFAULT(Current, Rhs, N) \
866 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
867 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
868 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
869 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
873 (Current).first_line = (Current).last_line = \
874 YYRHSLOC (Rhs, 0).last_line; \
875 (Current).first_column = (Current).last_column = \
876 YYRHSLOC (Rhs, 0).last_column; \
881 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
884 /* Enable debugging if requested. */
888 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
889 # define YYFPRINTF fprintf
892 # define YYDPRINTF(Args) \
899 /* YY_LOCATION_PRINT -- Print the location on the stream.
900 This macro was not mandated originally: define only if we know
901 we won't break user code: when these are the locations we know. */
903 #ifndef YY_LOCATION_PRINT
904 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
906 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
908 __attribute__((__unused__
))
910 yy_location_print_ (FILE *yyo
, YYLTYPE
const * const yylocp
)
913 int end_col
= 0 != yylocp
->last_column
? yylocp
->last_column
- 1 : 0;
914 if (0 <= yylocp
->first_line
)
916 res
+= YYFPRINTF (yyo
, "%d", yylocp
->first_line
);
917 if (0 <= yylocp
->first_column
)
918 res
+= YYFPRINTF (yyo
, ".%d", yylocp
->first_column
);
920 if (0 <= yylocp
->last_line
)
922 if (yylocp
->first_line
< yylocp
->last_line
)
924 res
+= YYFPRINTF (yyo
, "-%d", yylocp
->last_line
);
926 res
+= YYFPRINTF (yyo
, ".%d", end_col
);
928 else if (0 <= end_col
&& yylocp
->first_column
< end_col
)
929 res
+= YYFPRINTF (yyo
, "-%d", end_col
);
934 # define YY_LOCATION_PRINT(File, Loc) \
935 yy_location_print_ (File, &(Loc))
938 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
943 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
947 YYFPRINTF (stderr, "%s ", Title); \
948 yy_symbol_print (stderr, \
949 Type, Value, Location); \
950 YYFPRINTF (stderr, "\n"); \
955 /*--------------------------------.
956 | Print this symbol on YYOUTPUT. |
957 `--------------------------------*/
960 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
962 FILE *yyo
= yyoutput
;
968 if (yytype
< YYNTOKENS
)
969 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
973 case 3: /* "string" */
974 #line 183 "src/parse-gram.y" /* yacc.c:701 */
975 { fputs (quotearg_style (c_quoting_style
, ((*yyvaluep
).chars
)), yyo
); }
976 #line 977 "src/parse-gram.c" /* yacc.c:701 */
979 case 23: /* "%<flag>" */
980 #line 193 "src/parse-gram.y" /* yacc.c:701 */
981 { fprintf (yyo
, "%%%s", ((*yyvaluep
).uniqstr
)); }
982 #line 983 "src/parse-gram.c" /* yacc.c:701 */
985 case 39: /* "{...}" */
986 #line 185 "src/parse-gram.y" /* yacc.c:701 */
987 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
988 #line 989 "src/parse-gram.c" /* yacc.c:701 */
991 case 41: /* "[identifier]" */
992 #line 191 "src/parse-gram.y" /* yacc.c:701 */
993 { fprintf (yyo
, "[%s]", ((*yyvaluep
).uniqstr
)); }
994 #line 995 "src/parse-gram.c" /* yacc.c:701 */
997 case 42: /* "char" */
998 #line 172 "src/parse-gram.y" /* yacc.c:701 */
999 { fputs (char_name (((*yyvaluep
).character
)), yyo
); }
1000 #line 1001 "src/parse-gram.c" /* yacc.c:701 */
1003 case 43: /* "epilogue" */
1004 #line 185 "src/parse-gram.y" /* yacc.c:701 */
1005 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1006 #line 1007 "src/parse-gram.c" /* yacc.c:701 */
1009 case 45: /* "identifier" */
1010 #line 190 "src/parse-gram.y" /* yacc.c:701 */
1011 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1012 #line 1013 "src/parse-gram.c" /* yacc.c:701 */
1015 case 46: /* "identifier:" */
1016 #line 192 "src/parse-gram.y" /* yacc.c:701 */
1017 { fprintf (yyo
, "%s:", ((*yyvaluep
).uniqstr
)); }
1018 #line 1019 "src/parse-gram.c" /* yacc.c:701 */
1021 case 49: /* "%{...%}" */
1022 #line 185 "src/parse-gram.y" /* yacc.c:701 */
1023 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1024 #line 1025 "src/parse-gram.c" /* yacc.c:701 */
1027 case 51: /* "<tag>" */
1028 #line 194 "src/parse-gram.y" /* yacc.c:701 */
1029 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1030 #line 1031 "src/parse-gram.c" /* yacc.c:701 */
1033 case 54: /* "integer" */
1034 #line 198 "src/parse-gram.y" /* yacc.c:701 */
1035 { fprintf (yyo
, "%d", ((*yyvaluep
).integer
)); }
1036 #line 1037 "src/parse-gram.c" /* yacc.c:701 */
1039 case 55: /* "%param" */
1040 #line 241 "src/parse-gram.y" /* yacc.c:701 */
1042 switch (((*yyvaluep
).param
))
1044 #define CASE(In, Out) \
1045 case param_ ## In: fputs ("%" #Out, yyo); break
1046 CASE (lex
, lex
-param
);
1047 CASE (parse
, parse
-param
);
1050 case param_none
: aver (false); break;
1053 #line 1054 "src/parse-gram.c" /* yacc.c:701 */
1056 case 65: /* code_props_type */
1057 #line 414 "src/parse-gram.y" /* yacc.c:701 */
1058 { fprintf (yyo
, "%s", code_props_type_string (((*yyvaluep
).code_type
))); }
1059 #line 1060 "src/parse-gram.c" /* yacc.c:701 */
1062 case 74: /* symbol.prec */
1063 #line 202 "src/parse-gram.y" /* yacc.c:701 */
1064 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1065 #line 1066 "src/parse-gram.c" /* yacc.c:701 */
1069 #line 194 "src/parse-gram.y" /* yacc.c:701 */
1070 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1071 #line 1072 "src/parse-gram.c" /* yacc.c:701 */
1074 case 88: /* variable */
1075 #line 190 "src/parse-gram.y" /* yacc.c:701 */
1076 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1077 #line 1078 "src/parse-gram.c" /* yacc.c:701 */
1080 case 89: /* value */
1081 #line 660 "src/parse-gram.y" /* yacc.c:701 */
1083 switch (((*yyvaluep
).value
).kind
)
1085 case muscle_code
: fprintf (yyo
, "{%s}", ((*yyvaluep
).value
).chars
); break;
1086 case muscle_keyword
: fprintf (yyo
, "%s", ((*yyvaluep
).value
).chars
); break;
1087 case muscle_string
: fprintf (yyo
, "\"%s\"", ((*yyvaluep
).value
).chars
); break;
1090 #line 1091 "src/parse-gram.c" /* yacc.c:701 */
1093 case 90: /* braceless */
1094 #line 185 "src/parse-gram.y" /* yacc.c:701 */
1095 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1096 #line 1097 "src/parse-gram.c" /* yacc.c:701 */
1100 #line 202 "src/parse-gram.y" /* yacc.c:701 */
1101 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1102 #line 1103 "src/parse-gram.c" /* yacc.c:701 */
1105 case 92: /* id_colon */
1106 #line 203 "src/parse-gram.y" /* yacc.c:701 */
1107 { fprintf (yyo
, "%s:", ((*yyvaluep
).symbol
)->tag
); }
1108 #line 1109 "src/parse-gram.c" /* yacc.c:701 */
1111 case 93: /* symbol */
1112 #line 202 "src/parse-gram.y" /* yacc.c:701 */
1113 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1114 #line 1115 "src/parse-gram.c" /* yacc.c:701 */
1117 case 94: /* string_as_id */
1118 #line 202 "src/parse-gram.y" /* yacc.c:701 */
1119 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1120 #line 1121 "src/parse-gram.c" /* yacc.c:701 */
1130 /*--------------------------------.
1131 | Print this symbol on YYOUTPUT. |
1132 `--------------------------------*/
1135 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1137 YYFPRINTF (yyoutput
, "%s %s (",
1138 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1140 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1141 YYFPRINTF (yyoutput
, ": ");
1142 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1143 YYFPRINTF (yyoutput
, ")");
1146 /*------------------------------------------------------------------.
1147 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1149 `------------------------------------------------------------------*/
1152 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1154 YYFPRINTF (stderr
, "Stack now");
1155 for (; yybottom
<= yytop
; yybottom
++)
1157 int yybot
= *yybottom
;
1158 YYFPRINTF (stderr
, " %d", yybot
);
1160 YYFPRINTF (stderr
, "\n");
1163 # define YY_STACK_PRINT(Bottom, Top) \
1166 yy_stack_print ((Bottom), (Top)); \
1170 /*------------------------------------------------.
1171 | Report that the YYRULE is going to be reduced. |
1172 `------------------------------------------------*/
1175 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1177 unsigned long int yylno
= yyrline
[yyrule
];
1178 int yynrhs
= yyr2
[yyrule
];
1180 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1182 /* The symbols being reduced. */
1183 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1185 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1186 yy_symbol_print (stderr
,
1187 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1188 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1189 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1190 YYFPRINTF (stderr
, "\n");
1194 # define YY_REDUCE_PRINT(Rule) \
1197 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1200 /* Nonzero means print parse trace. It is left uninitialized so that
1201 multiple parsers can coexist. */
1203 #else /* !GRAM_DEBUG */
1204 # define YYDPRINTF(Args)
1205 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1206 # define YY_STACK_PRINT(Bottom, Top)
1207 # define YY_REDUCE_PRINT(Rule)
1208 #endif /* !GRAM_DEBUG */
1211 /* YYINITDEPTH -- initial size of the parser's stacks. */
1213 # define YYINITDEPTH 200
1216 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1217 if the built-in stack extension method is used).
1219 Do not make this value too large; the results are undefined if
1220 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1221 evaluated with infinite-precision integer arithmetic. */
1224 # define YYMAXDEPTH 10000
1227 /* Given a state stack such that *YYBOTTOM is its bottom, such that
1228 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1229 stack, and such that *YYCAPACITY is the maximum number of elements it
1230 can hold without a reallocation, make sure there is enough room to
1231 store YYADD more elements. If not, allocate a new stack using
1232 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1233 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1234 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1235 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1236 required. Return 1 if memory is exhausted. */
1238 yy_lac_stack_realloc (YYSIZE_T
*yycapacity
, YYSIZE_T yyadd
,
1240 char const *yydebug_prefix
,
1241 char const *yydebug_suffix
,
1243 yytype_int16
**yybottom
,
1244 yytype_int16
*yybottom_no_free
,
1245 yytype_int16
**yytop
, yytype_int16
*yytop_empty
)
1247 YYSIZE_T yysize_old
=
1248 *yytop
== yytop_empty
? 0 : *yytop
- *yybottom
+ 1;
1249 YYSIZE_T yysize_new
= yysize_old
+ yyadd
;
1250 if (*yycapacity
< yysize_new
)
1252 YYSIZE_T yyalloc
= 2 * yysize_new
;
1253 yytype_int16
*yybottom_new
;
1254 /* Use YYMAXDEPTH for maximum stack size given that the stack
1255 should never need to grow larger than the main state stack
1256 needs to grow without LAC. */
1257 if (YYMAXDEPTH
< yysize_new
)
1259 YYDPRINTF ((stderr
, "%smax size exceeded%s", yydebug_prefix
,
1263 if (YYMAXDEPTH
< yyalloc
)
1264 yyalloc
= YYMAXDEPTH
;
1266 (yytype_int16
*) YYSTACK_ALLOC (yyalloc
* sizeof *yybottom_new
);
1269 YYDPRINTF ((stderr
, "%srealloc failed%s", yydebug_prefix
,
1273 if (*yytop
!= yytop_empty
)
1275 YYCOPY (yybottom_new
, *yybottom
, yysize_old
);
1276 *yytop
= yybottom_new
+ (yysize_old
- 1);
1278 if (*yybottom
!= yybottom_no_free
)
1279 YYSTACK_FREE (*yybottom
);
1280 *yybottom
= yybottom_new
;
1281 *yycapacity
= yyalloc
;
1286 /* Establish the initial context for the current lookahead if no initial
1287 context is currently established.
1289 We define a context as a snapshot of the parser stacks. We define
1290 the initial context for a lookahead as the context in which the
1291 parser initially examines that lookahead in order to select a
1292 syntactic action. Thus, if the lookahead eventually proves
1293 syntactically unacceptable (possibly in a later context reached via a
1294 series of reductions), the initial context can be used to determine
1295 the exact set of tokens that would be syntactically acceptable in the
1296 lookahead's place. Moreover, it is the context after which any
1297 further semantic actions would be erroneous because they would be
1298 determined by a syntactically unacceptable token.
1300 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1301 performed in an inconsistent state (which, for the purposes of LAC,
1302 includes consistent states that don't know they're consistent because
1303 their default reductions have been disabled). Iff there is a
1304 lookahead token, it should also be invoked before reporting a syntax
1305 error. This latter case is for the sake of the debugging output.
1307 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1308 follows. If no initial context is currently established for the
1309 current lookahead, then check if that lookahead can eventually be
1310 shifted if syntactic actions continue from the current context.
1311 Report a syntax error if it cannot. */
1312 #define YY_LAC_ESTABLISH \
1314 if (!yy_lac_established) \
1316 YYDPRINTF ((stderr, \
1317 "LAC: initial context established for %s\n", \
1318 yytname[yytoken])); \
1319 yy_lac_established = 1; \
1321 int yy_lac_status = \
1322 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1323 if (yy_lac_status == 2) \
1324 goto yyexhaustedlab; \
1325 if (yy_lac_status == 1) \
1331 /* Discard any previous initial lookahead context because of Event,
1332 which may be a lookahead change or an invalidation of the currently
1333 established initial context for the current lookahead.
1335 The most common example of a lookahead change is a shift. An example
1336 of both cases is syntax error recovery. That is, a syntax error
1337 occurs when the lookahead is syntactically erroneous for the
1338 currently established initial context, so error recovery manipulates
1339 the parser stacks to try to find a new initial context in which the
1340 current lookahead is syntactically acceptable. If it fails to find
1341 such a context, it discards the lookahead. */
1343 # define YY_LAC_DISCARD(Event) \
1345 if (yy_lac_established) \
1348 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1350 yy_lac_established = 0; \
1354 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1357 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1358 eventually (after perhaps some reductions) be shifted, return 1 if
1359 not, or return 2 if memory is exhausted. As preconditions and
1360 postconditions: *YYES_CAPACITY is the allocated size of the array to
1361 which *YYES points, and either *YYES = YYESA or *YYES points to an
1362 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1363 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1364 any old *YYES other than YYESA. */
1366 yy_lac (yytype_int16
*yyesa
, yytype_int16
**yyes
,
1367 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1369 yytype_int16
*yyes_prev
= yyssp
;
1370 yytype_int16
*yyesp
= yyes_prev
;
1371 YYDPRINTF ((stderr
, "LAC: checking lookahead %s:", yytname
[yytoken
]));
1372 if (yytoken
== YYUNDEFTOK
)
1374 YYDPRINTF ((stderr
, " Always Err\n"));
1379 int yyrule
= yypact
[*yyesp
];
1380 if (yypact_value_is_default (yyrule
)
1381 || (yyrule
+= yytoken
) < 0 || YYLAST
< yyrule
1382 || yycheck
[yyrule
] != yytoken
)
1384 yyrule
= yydefact
[*yyesp
];
1387 YYDPRINTF ((stderr
, " Err\n"));
1393 yyrule
= yytable
[yyrule
];
1394 if (yytable_value_is_error (yyrule
))
1396 YYDPRINTF ((stderr
, " Err\n"));
1401 YYDPRINTF ((stderr
, " S%d\n", yyrule
));
1407 YYSIZE_T yylen
= yyr2
[yyrule
];
1408 YYDPRINTF ((stderr
, " R%d", yyrule
- 1));
1409 if (yyesp
!= yyes_prev
)
1411 YYSIZE_T yysize
= yyesp
- *yyes
+ 1;
1424 yyesp
= yyes_prev
-= yylen
;
1429 int yylhs
= yyr1
[yyrule
] - YYNTOKENS
;
1430 yystate
= yypgoto
[yylhs
] + *yyesp
;
1431 if (yystate
< 0 || YYLAST
< yystate
1432 || yycheck
[yystate
] != *yyesp
)
1433 yystate
= yydefgoto
[yylhs
];
1435 yystate
= yytable
[yystate
];
1437 if (yyesp
== yyes_prev
)
1444 if (yy_lac_stack_realloc (yyes_capacity
, 1,
1448 yyes
, yyesa
, &yyesp
, yyes_prev
))
1450 YYDPRINTF ((stderr
, "\n"));
1455 YYDPRINTF ((stderr
, " G%d", yystate
));
1464 # if defined __GLIBC__ && defined _STRING_H
1465 # define yystrlen strlen
1467 /* Return the length of YYSTR. */
1469 yystrlen (const char *yystr
)
1472 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1480 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1481 # define yystpcpy stpcpy
1483 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1486 yystpcpy (char *yydest
, const char *yysrc
)
1489 const char *yys
= yysrc
;
1491 while ((*yyd
++ = *yys
++) != '\0')
1500 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1501 quotes and backslashes, so that it's suitable for yyerror. The
1502 heuristic is that double-quoting is unnecessary unless the string
1503 contains an apostrophe, a comma, or backslash (other than
1504 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1505 null, do not copy; instead, return the length of what the result
1508 yytnamerr (char *yyres
, const char *yystr
)
1513 char const *yyp
= yystr
;
1520 goto do_not_strip_quotes
;
1524 goto do_not_strip_quotes
;
1537 do_not_strip_quotes
: ;
1541 return yystrlen (yystr
);
1543 return yystpcpy (yyres
, yystr
) - yyres
;
1547 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1548 about the unexpected token YYTOKEN for the state stack whose top is
1549 YYSSP. In order to see if a particular token T is a
1550 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1552 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1553 not large enough to hold the message. In that case, also set
1554 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1555 required number of bytes is too large to store or if
1556 yy_lac returned 2. */
1558 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1559 yytype_int16
*yyesa
, yytype_int16
**yyes
,
1560 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1562 YYSIZE_T yysize0
= yytnamerr (YY_NULL
, yytname
[yytoken
]);
1563 YYSIZE_T yysize
= yysize0
;
1564 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1565 /* Internationalized format string. */
1566 const char *yyformat
= YY_NULL
;
1567 /* Arguments of yyformat. */
1568 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1569 /* Number of reported tokens (one for the "unexpected", one per
1573 /* There are many possibilities here to consider:
1574 - If this state is a consistent state with a default action, then
1575 the only way this function was invoked is if the default action
1576 is an error action. In that case, don't check for expected
1577 tokens because there are none.
1578 - The only way there can be no lookahead present (in yychar) is if
1579 this state is a consistent state with a default action. Thus,
1580 detecting the absence of a lookahead is sufficient to determine
1581 that there is no unexpected or expected token to report. In that
1582 case, just report a simple "syntax error".
1583 - Don't assume there isn't a lookahead just because this state is a
1584 consistent state with a default action. There might have been a
1585 previous inconsistent state, consistent state with a non-default
1586 action, or user semantic action that manipulated yychar.
1587 In the first two cases, it might appear that the current syntax
1588 error should have been detected in the previous state when yy_lac
1589 was invoked. However, at that time, there might have been a
1590 different syntax error that discarded a different initial context
1591 during error recovery, leaving behind the current lookahead.
1593 if (yytoken
!= YYEMPTY
)
1595 int yyn
= yypact
[*yyssp
];
1596 YYDPRINTF ((stderr
, "Constructing syntax error message\n"));
1597 yyarg
[yycount
++] = yytname
[yytoken
];
1598 if (!yypact_value_is_default (yyn
))
1602 for (yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1603 if (yyx
!= YYTERROR
&& yyx
!= YYUNDEFTOK
)
1606 int yy_lac_status
= yy_lac (yyesa
, yyes
, yyes_capacity
,
1608 if (yy_lac_status
== 2)
1610 if (yy_lac_status
== 1)
1613 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1619 yyarg
[yycount
++] = yytname
[yyx
];
1621 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULL
, yytname
[yyx
]);
1622 if (! (yysize
<= yysize1
1623 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1631 YYFPRINTF (stderr
, "No expected tokens.\n");
1637 # define YYCASE_(N, S) \
1641 YYCASE_(0, YY_("syntax error"));
1642 YYCASE_(1, YY_("syntax error, unexpected %s"));
1643 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1644 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1645 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1646 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1651 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1652 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1657 if (*yymsg_alloc
< yysize
)
1659 *yymsg_alloc
= 2 * yysize
;
1660 if (! (yysize
<= *yymsg_alloc
1661 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1662 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1666 /* Avoid sprintf, as that infringes on the user's name space.
1667 Don't have undefined behavior even if the translation
1668 produced a string with the wrong number of "%s"s. */
1672 while ((*yyp
= *yyformat
) != '\0')
1673 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1675 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1686 #endif /* YYERROR_VERBOSE */
1688 /*-----------------------------------------------.
1689 | Release the memory associated to this symbol. |
1690 `-----------------------------------------------*/
1693 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1696 YYUSE (yylocationp
);
1699 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1714 /* The lookahead symbol. */
1718 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1719 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1720 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1721 _Pragma ("GCC diagnostic push") \
1722 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1723 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1724 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1725 _Pragma ("GCC diagnostic pop")
1727 /* Default value used for initialization, for pacifying older GCCs
1728 or non-GCC compilers. */
1729 static YYSTYPE yyval_default
;
1730 # define YY_INITIAL_VALUE(Value) = Value
1732 static YYLTYPE yyloc_default
1733 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1737 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1738 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1739 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1741 #ifndef YY_INITIAL_VALUE
1742 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1745 /* The semantic value of the lookahead symbol. */
1746 YYSTYPE yylval
YY_INITIAL_VALUE(yyval_default
);
1748 /* Location data for the lookahead symbol. */
1749 YYLTYPE yylloc
= yyloc_default
;
1752 /* Number of syntax errors so far. */
1756 /* Number of tokens to shift before error messages enabled. */
1759 /* The stacks and their tools:
1760 'yyss': related to states.
1761 'yyvs': related to semantic values.
1762 'yyls': related to locations.
1764 Refer to the stacks through separate pointers, to allow yyoverflow
1765 to reallocate them elsewhere. */
1767 /* The state stack. */
1768 yytype_int16 yyssa
[YYINITDEPTH
];
1770 yytype_int16
*yyssp
;
1772 /* The semantic value stack. */
1773 YYSTYPE yyvsa
[YYINITDEPTH
];
1777 /* The location stack. */
1778 YYLTYPE yylsa
[YYINITDEPTH
];
1782 /* The locations where the error started and ended. */
1783 YYLTYPE yyerror_range
[3];
1785 YYSIZE_T yystacksize
;
1787 yytype_int16 yyesa
[20];
1789 YYSIZE_T yyes_capacity
;
1791 int yy_lac_established
= 0;
1794 /* Lookahead token as an internal (translated) token number. */
1796 /* The variables used to return semantic value and location from the
1802 /* Buffer for error messages, and its allocated size. */
1804 char *yymsg
= yymsgbuf
;
1805 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1808 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1810 /* The number of symbols on the RHS of the reduced rule.
1811 Keep to zero when no symbol should be popped. */
1814 yyssp
= yyss
= yyssa
;
1815 yyvsp
= yyvs
= yyvsa
;
1816 yylsp
= yyls
= yylsa
;
1817 yystacksize
= YYINITDEPTH
;
1820 yyes_capacity
= sizeof yyesa
/ sizeof *yyes
;
1821 if (YYMAXDEPTH
< yyes_capacity
)
1822 yyes_capacity
= YYMAXDEPTH
;
1824 YYDPRINTF ((stderr
, "Starting parse\n"));
1829 yychar
= YYEMPTY
; /* Cause a token to be read. */
1831 /* User initialization code. */
1832 #line 96 "src/parse-gram.y" /* yacc.c:1446 */
1834 /* Bison's grammar can initial empty locations, hence a default
1835 location is needed. */
1836 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1837 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1840 #line 1841 "src/parse-gram.c" /* yacc.c:1446 */
1844 /*------------------------------------------------------------.
1845 | yynewstate -- Push a new state, which is found in yystate. |
1846 `------------------------------------------------------------*/
1848 /* In all cases, when you get here, the value and location stacks
1849 have just been pushed. So pushing a state here evens the stacks. */
1855 if (yyss
+ yystacksize
- 1 <= yyssp
)
1857 /* Get the current used size of the three stacks, in elements. */
1858 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1862 /* Give user a chance to reallocate the stack. Use copies of
1863 these so that the &'s don't force the real ones into
1865 YYSTYPE
*yyvs1
= yyvs
;
1866 yytype_int16
*yyss1
= yyss
;
1867 YYLTYPE
*yyls1
= yyls
;
1869 /* Each stack pointer address is followed by the size of the
1870 data in use in that stack, in bytes. This used to be a
1871 conditional around just the two extra args, but that might
1872 be undefined if yyoverflow is a macro. */
1873 yyoverflow (YY_("memory exhausted"),
1874 &yyss1
, yysize
* sizeof (*yyssp
),
1875 &yyvs1
, yysize
* sizeof (*yyvsp
),
1876 &yyls1
, yysize
* sizeof (*yylsp
),
1883 #else /* no yyoverflow */
1884 # ifndef YYSTACK_RELOCATE
1885 goto yyexhaustedlab
;
1887 /* Extend the stack our own way. */
1888 if (YYMAXDEPTH
<= yystacksize
)
1889 goto yyexhaustedlab
;
1891 if (YYMAXDEPTH
< yystacksize
)
1892 yystacksize
= YYMAXDEPTH
;
1895 yytype_int16
*yyss1
= yyss
;
1896 union yyalloc
*yyptr
=
1897 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1899 goto yyexhaustedlab
;
1900 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1901 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1902 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1903 # undef YYSTACK_RELOCATE
1905 YYSTACK_FREE (yyss1
);
1908 #endif /* no yyoverflow */
1910 yyssp
= yyss
+ yysize
- 1;
1911 yyvsp
= yyvs
+ yysize
- 1;
1912 yylsp
= yyls
+ yysize
- 1;
1914 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1915 (unsigned long int) yystacksize
));
1917 if (yyss
+ yystacksize
- 1 <= yyssp
)
1921 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1923 if (yystate
== YYFINAL
)
1933 /* Do appropriate processing given the current state. Read a
1934 lookahead token if we need one and don't already have one. */
1936 /* First try to decide what to do without reference to lookahead token. */
1937 yyn
= yypact
[yystate
];
1938 if (yypact_value_is_default (yyn
))
1941 /* Not known => get a lookahead token if don't already have one. */
1943 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1944 if (yychar
== YYEMPTY
)
1946 YYDPRINTF ((stderr
, "Reading a token: "));
1947 yychar
= yylex (&yylval
, &yylloc
);
1950 if (yychar
<= YYEOF
)
1952 yychar
= yytoken
= YYEOF
;
1953 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1957 yytoken
= YYTRANSLATE (yychar
);
1958 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1961 /* If the proper action on seeing token YYTOKEN is to reduce or to
1962 detect an error, take that action. */
1964 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1972 if (yytable_value_is_error (yyn
))
1979 /* Count tokens shifted since error; after three, turn off error
1984 /* Shift the lookahead token. */
1985 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1987 /* Discard the shifted token. */
1989 YY_LAC_DISCARD ("shift");
1992 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1994 YY_IGNORE_MAYBE_UNINITIALIZED_END
1999 /*-----------------------------------------------------------.
2000 | yydefault -- do the default action for the current state. |
2001 `-----------------------------------------------------------*/
2003 yyn
= yydefact
[yystate
];
2009 /*-----------------------------.
2010 | yyreduce -- Do a reduction. |
2011 `-----------------------------*/
2013 /* yyn is the number of a rule to reduce with. */
2016 /* If YYLEN is nonzero, implement the default value of the action:
2019 Otherwise, the following line sets YYVAL to garbage.
2020 This behavior is undocumented and Bison
2021 users should not rely upon it. Assigning to YYVAL
2022 unconditionally makes the parser a bit smaller, and it avoids a
2023 GCC warning that YYVAL may be used uninitialized. */
2024 yyval
= yyvsp
[1-yylen
];
2026 /* Default location. */
2027 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2028 YY_REDUCE_PRINT (yyn
);
2030 int yychar_backup
= yychar
;
2034 #line 277 "src/parse-gram.y" /* yacc.c:1663 */
2036 code_props plain_code
;
2037 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2038 code_props_translate_code (&plain_code
);
2039 gram_scanner_last_string_free ();
2040 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
2041 plain_code
.code
, (yylsp
[0]));
2042 code_scanner_last_string_free ();
2044 #line 2045 "src/parse-gram.c" /* yacc.c:1663 */
2048 #line 287 "src/parse-gram.y" /* yacc.c:1663 */
2050 muscle_percent_define_ensure ((yyvsp
[0].uniqstr
), (yylsp
[0]), true);
2052 #line 2053 "src/parse-gram.c" /* yacc.c:1663 */
2056 #line 291 "src/parse-gram.y" /* yacc.c:1663 */
2058 muscle_percent_define_insert ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].value
).kind
, (yyvsp
[0].value
).chars
,
2059 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2061 #line 2062 "src/parse-gram.c" /* yacc.c:1663 */
2065 #line 295 "src/parse-gram.y" /* yacc.c:1663 */
2066 { defines_flag
= true; }
2067 #line 2068 "src/parse-gram.c" /* yacc.c:1663 */
2071 #line 297 "src/parse-gram.y" /* yacc.c:1663 */
2073 defines_flag
= true;
2074 spec_defines_file
= xstrdup ((yyvsp
[0].chars
));
2076 #line 2077 "src/parse-gram.c" /* yacc.c:1663 */
2080 #line 302 "src/parse-gram.y" /* yacc.c:1663 */
2082 muscle_percent_define_insert ("parse.error", (yylsp
[0]), muscle_keyword
,
2084 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2086 #line 2087 "src/parse-gram.c" /* yacc.c:1663 */
2090 #line 307 "src/parse-gram.y" /* yacc.c:1663 */
2091 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
2092 #line 2093 "src/parse-gram.c" /* yacc.c:1663 */
2096 #line 308 "src/parse-gram.y" /* yacc.c:1663 */
2097 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
2098 #line 2099 "src/parse-gram.c" /* yacc.c:1663 */
2102 #line 309 "src/parse-gram.y" /* yacc.c:1663 */
2103 { spec_file_prefix
= (yyvsp
[0].chars
); }
2104 #line 2105 "src/parse-gram.c" /* yacc.c:1663 */
2108 #line 311 "src/parse-gram.y" /* yacc.c:1663 */
2110 nondeterministic_parser
= true;
2113 #line 2114 "src/parse-gram.c" /* yacc.c:1663 */
2117 #line 316 "src/parse-gram.y" /* yacc.c:1663 */
2120 code_props_symbol_action_init (&action
, (yyvsp
[0].code
), (yylsp
[0]));
2121 code_props_translate_code (&action
);
2122 gram_scanner_last_string_free ();
2123 muscle_code_grow ("initial_action", action
.code
, (yylsp
[0]));
2124 code_scanner_last_string_free ();
2126 #line 2127 "src/parse-gram.c" /* yacc.c:1663 */
2130 #line 324 "src/parse-gram.y" /* yacc.c:1663 */
2131 { language_argmatch ((yyvsp
[0].chars
), grammar_prio
, (yylsp
[-1])); }
2132 #line 2133 "src/parse-gram.c" /* yacc.c:1663 */
2136 #line 325 "src/parse-gram.y" /* yacc.c:1663 */
2137 { spec_name_prefix
= (yyvsp
[0].chars
); }
2138 #line 2139 "src/parse-gram.c" /* yacc.c:1663 */
2142 #line 326 "src/parse-gram.y" /* yacc.c:1663 */
2143 { no_lines_flag
= true; }
2144 #line 2145 "src/parse-gram.c" /* yacc.c:1663 */
2148 #line 327 "src/parse-gram.y" /* yacc.c:1663 */
2149 { nondeterministic_parser
= true; }
2150 #line 2151 "src/parse-gram.c" /* yacc.c:1663 */
2154 #line 328 "src/parse-gram.y" /* yacc.c:1663 */
2155 { spec_outfile
= (yyvsp
[0].chars
); }
2156 #line 2157 "src/parse-gram.c" /* yacc.c:1663 */
2160 #line 329 "src/parse-gram.y" /* yacc.c:1663 */
2161 { current_param
= (yyvsp
[0].param
); }
2162 #line 2163 "src/parse-gram.c" /* yacc.c:1663 */
2166 #line 329 "src/parse-gram.y" /* yacc.c:1663 */
2167 { current_param
= param_none
; }
2168 #line 2169 "src/parse-gram.c" /* yacc.c:1663 */
2172 #line 330 "src/parse-gram.y" /* yacc.c:1663 */
2173 { version_check (&(yylsp
[0]), (yyvsp
[0].chars
)); }
2174 #line 2175 "src/parse-gram.c" /* yacc.c:1663 */
2178 #line 332 "src/parse-gram.y" /* yacc.c:1663 */
2180 char const *skeleton_user
= (yyvsp
[0].chars
);
2181 if (strchr (skeleton_user
, '/'))
2183 size_t dir_length
= strlen (current_file
);
2184 char *skeleton_build
;
2185 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2187 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2190 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2193 memcpy (skeleton_build
, current_file
, dir_length
);
2194 skeleton_build
[dir_length
++] = '/';
2196 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2197 skeleton_user
= uniqstr_new (skeleton_build
);
2198 free (skeleton_build
);
2200 skeleton_arg (skeleton_user
, grammar_prio
, (yylsp
[-1]));
2202 #line 2203 "src/parse-gram.c" /* yacc.c:1663 */
2206 #line 355 "src/parse-gram.y" /* yacc.c:1663 */
2207 { token_table_flag
= true; }
2208 #line 2209 "src/parse-gram.c" /* yacc.c:1663 */
2212 #line 356 "src/parse-gram.y" /* yacc.c:1663 */
2213 { report_flag
|= report_states
; }
2214 #line 2215 "src/parse-gram.c" /* yacc.c:1663 */
2218 #line 357 "src/parse-gram.y" /* yacc.c:1663 */
2219 { yacc_flag
= true; }
2220 #line 2221 "src/parse-gram.c" /* yacc.c:1663 */
2224 #line 362 "src/parse-gram.y" /* yacc.c:1663 */
2225 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2226 #line 2227 "src/parse-gram.c" /* yacc.c:1663 */
2230 #line 363 "src/parse-gram.y" /* yacc.c:1663 */
2231 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2232 #line 2233 "src/parse-gram.c" /* yacc.c:1663 */
2236 #line 375 "src/parse-gram.y" /* yacc.c:1663 */
2238 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
2240 #line 2241 "src/parse-gram.c" /* yacc.c:1663 */
2244 #line 379 "src/parse-gram.y" /* yacc.c:1663 */
2247 code_props_symbol_action_init (&code
, (yyvsp
[-1].code
), (yylsp
[-1]));
2248 code_props_translate_code (&code
);
2251 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2252 symbol_list_code_props_set (list
, (yyvsp
[-2].code_type
), &code
);
2253 symbol_list_free ((yyvsp
[0].list
));
2256 #line 2257 "src/parse-gram.c" /* yacc.c:1663 */
2260 #line 391 "src/parse-gram.y" /* yacc.c:1663 */
2262 default_prec
= true;
2264 #line 2265 "src/parse-gram.c" /* yacc.c:1663 */
2268 #line 395 "src/parse-gram.y" /* yacc.c:1663 */
2270 default_prec
= false;
2272 #line 2273 "src/parse-gram.c" /* yacc.c:1663 */
2276 #line 399 "src/parse-gram.y" /* yacc.c:1663 */
2278 /* Do not invoke muscle_percent_code_grow here since it invokes
2279 muscle_user_name_list_grow. */
2280 muscle_code_grow ("percent_code()", (yyvsp
[0].chars
), (yylsp
[0]));
2281 code_scanner_last_string_free ();
2283 #line 2284 "src/parse-gram.c" /* yacc.c:1663 */
2287 #line 406 "src/parse-gram.y" /* yacc.c:1663 */
2289 muscle_percent_code_grow ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
), (yylsp
[0]));
2290 code_scanner_last_string_free ();
2292 #line 2293 "src/parse-gram.c" /* yacc.c:1663 */
2296 #line 416 "src/parse-gram.y" /* yacc.c:1663 */
2297 { (yyval
.code_type
) = destructor
; }
2298 #line 2299 "src/parse-gram.c" /* yacc.c:1663 */
2302 #line 417 "src/parse-gram.y" /* yacc.c:1663 */
2303 { (yyval
.code_type
) = printer
; }
2304 #line 2305 "src/parse-gram.c" /* yacc.c:1663 */
2308 #line 427 "src/parse-gram.y" /* yacc.c:1663 */
2310 #line 2311 "src/parse-gram.c" /* yacc.c:1663 */
2314 #line 428 "src/parse-gram.y" /* yacc.c:1663 */
2315 { muscle_code_grow ("union_name", (yyvsp
[0].uniqstr
), (yylsp
[0])); }
2316 #line 2317 "src/parse-gram.c" /* yacc.c:1663 */
2320 #line 433 "src/parse-gram.y" /* yacc.c:1663 */
2323 muscle_code_grow ("union_members", (yyvsp
[0].chars
), (yylsp
[0]));
2324 code_scanner_last_string_free ();
2326 #line 2327 "src/parse-gram.c" /* yacc.c:1663 */
2330 #line 444 "src/parse-gram.y" /* yacc.c:1663 */
2331 { current_class
= nterm_sym
; }
2332 #line 2333 "src/parse-gram.c" /* yacc.c:1663 */
2336 #line 445 "src/parse-gram.y" /* yacc.c:1663 */
2338 current_class
= unknown_sym
;
2339 current_type
= NULL
;
2341 #line 2342 "src/parse-gram.c" /* yacc.c:1663 */
2345 #line 449 "src/parse-gram.y" /* yacc.c:1663 */
2346 { current_class
= token_sym
; }
2347 #line 2348 "src/parse-gram.c" /* yacc.c:1663 */
2351 #line 450 "src/parse-gram.y" /* yacc.c:1663 */
2353 current_class
= unknown_sym
;
2354 current_type
= NULL
;
2356 #line 2357 "src/parse-gram.c" /* yacc.c:1663 */
2360 #line 455 "src/parse-gram.y" /* yacc.c:1663 */
2364 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2365 symbol_type_set (list
->content
.sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
2366 symbol_list_free ((yyvsp
[0].list
));
2368 #line 2369 "src/parse-gram.c" /* yacc.c:1663 */
2372 #line 466 "src/parse-gram.y" /* yacc.c:1663 */
2376 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2378 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[-1]));
2379 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
2381 symbol_list_free ((yyvsp
[0].list
));
2382 current_type
= NULL
;
2384 #line 2385 "src/parse-gram.c" /* yacc.c:1663 */
2388 #line 480 "src/parse-gram.y" /* yacc.c:1663 */
2389 { (yyval
.assoc
) = left_assoc
; }
2390 #line 2391 "src/parse-gram.c" /* yacc.c:1663 */
2394 #line 481 "src/parse-gram.y" /* yacc.c:1663 */
2395 { (yyval
.assoc
) = right_assoc
; }
2396 #line 2397 "src/parse-gram.c" /* yacc.c:1663 */
2400 #line 482 "src/parse-gram.y" /* yacc.c:1663 */
2401 { (yyval
.assoc
) = non_assoc
; }
2402 #line 2403 "src/parse-gram.c" /* yacc.c:1663 */
2406 #line 483 "src/parse-gram.y" /* yacc.c:1663 */
2407 { (yyval
.assoc
) = precedence_assoc
; }
2408 #line 2409 "src/parse-gram.c" /* yacc.c:1663 */
2412 #line 487 "src/parse-gram.y" /* yacc.c:1663 */
2413 { current_type
= NULL
; }
2414 #line 2415 "src/parse-gram.c" /* yacc.c:1663 */
2418 #line 488 "src/parse-gram.y" /* yacc.c:1663 */
2419 { current_type
= (yyvsp
[0].uniqstr
); tag_seen
= true; }
2420 #line 2421 "src/parse-gram.c" /* yacc.c:1663 */
2424 #line 494 "src/parse-gram.y" /* yacc.c:1663 */
2425 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2426 #line 2427 "src/parse-gram.c" /* yacc.c:1663 */
2430 #line 496 "src/parse-gram.y" /* yacc.c:1663 */
2431 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2432 #line 2433 "src/parse-gram.c" /* yacc.c:1663 */
2436 #line 501 "src/parse-gram.y" /* yacc.c:1663 */
2438 (yyval
.symbol
) = (yyvsp
[0].symbol
);
2439 symbol_class_set ((yyvsp
[0].symbol
), token_sym
, (yylsp
[0]), false);
2441 #line 2442 "src/parse-gram.c" /* yacc.c:1663 */
2445 #line 506 "src/parse-gram.y" /* yacc.c:1663 */
2447 (yyval
.symbol
) = (yyvsp
[-1].symbol
);
2448 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2449 symbol_class_set ((yyvsp
[-1].symbol
), token_sym
, (yylsp
[-1]), false);
2451 #line 2452 "src/parse-gram.c" /* yacc.c:1663 */
2455 #line 516 "src/parse-gram.y" /* yacc.c:1663 */
2456 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2457 #line 2458 "src/parse-gram.c" /* yacc.c:1663 */
2461 #line 518 "src/parse-gram.y" /* yacc.c:1663 */
2462 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2463 #line 2464 "src/parse-gram.c" /* yacc.c:1663 */
2467 #line 522 "src/parse-gram.y" /* yacc.c:1663 */
2468 { (yyval
.list
) = (yyvsp
[0].list
); }
2469 #line 2470 "src/parse-gram.c" /* yacc.c:1663 */
2473 #line 523 "src/parse-gram.y" /* yacc.c:1663 */
2474 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), (yyvsp
[0].list
)); }
2475 #line 2476 "src/parse-gram.c" /* yacc.c:1663 */
2479 #line 527 "src/parse-gram.y" /* yacc.c:1663 */
2480 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2481 #line 2482 "src/parse-gram.c" /* yacc.c:1663 */
2485 #line 528 "src/parse-gram.y" /* yacc.c:1663 */
2486 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2487 #line 2488 "src/parse-gram.c" /* yacc.c:1663 */
2491 #line 533 "src/parse-gram.y" /* yacc.c:1663 */
2492 { (yyval
.uniqstr
) = uniqstr_new ("*"); }
2493 #line 2494 "src/parse-gram.c" /* yacc.c:1663 */
2497 #line 534 "src/parse-gram.y" /* yacc.c:1663 */
2498 { (yyval
.uniqstr
) = uniqstr_new (""); }
2499 #line 2500 "src/parse-gram.c" /* yacc.c:1663 */
2503 #line 540 "src/parse-gram.y" /* yacc.c:1663 */
2505 current_type
= (yyvsp
[0].uniqstr
);
2508 #line 2509 "src/parse-gram.c" /* yacc.c:1663 */
2512 #line 545 "src/parse-gram.y" /* yacc.c:1663 */
2514 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]), true);
2515 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
2517 #line 2518 "src/parse-gram.c" /* yacc.c:1663 */
2521 #line 550 "src/parse-gram.y" /* yacc.c:1663 */
2523 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2524 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2525 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2527 #line 2528 "src/parse-gram.c" /* yacc.c:1663 */
2531 #line 556 "src/parse-gram.y" /* yacc.c:1663 */
2533 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2534 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2535 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2537 #line 2538 "src/parse-gram.c" /* yacc.c:1663 */
2541 #line 562 "src/parse-gram.y" /* yacc.c:1663 */
2543 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]), true);
2544 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
2545 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
2546 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2548 #line 2549 "src/parse-gram.c" /* yacc.c:1663 */
2552 #line 592 "src/parse-gram.y" /* yacc.c:1663 */
2556 #line 2557 "src/parse-gram.c" /* yacc.c:1663 */
2560 #line 598 "src/parse-gram.y" /* yacc.c:1663 */
2561 { current_lhs ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2562 #line 2563 "src/parse-gram.c" /* yacc.c:1663 */
2566 #line 599 "src/parse-gram.y" /* yacc.c:1663 */
2568 /* Free the current lhs. */
2569 current_lhs (0, (yylsp
[-3]), 0);
2571 #line 2572 "src/parse-gram.c" /* yacc.c:1663 */
2575 #line 606 "src/parse-gram.y" /* yacc.c:1663 */
2576 { grammar_current_rule_end ((yylsp
[0])); }
2577 #line 2578 "src/parse-gram.c" /* yacc.c:1663 */
2581 #line 607 "src/parse-gram.y" /* yacc.c:1663 */
2582 { grammar_current_rule_end ((yylsp
[0])); }
2583 #line 2584 "src/parse-gram.c" /* yacc.c:1663 */
2587 #line 614 "src/parse-gram.y" /* yacc.c:1663 */
2588 { grammar_current_rule_begin (current_lhs_symbol
, current_lhs_location
,
2589 current_lhs_named_ref
); }
2590 #line 2591 "src/parse-gram.c" /* yacc.c:1663 */
2594 #line 617 "src/parse-gram.y" /* yacc.c:1663 */
2595 { grammar_current_rule_symbol_append ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2596 #line 2597 "src/parse-gram.c" /* yacc.c:1663 */
2600 #line 619 "src/parse-gram.y" /* yacc.c:1663 */
2601 { grammar_current_rule_action_append ((yyvsp
[-1].code
), (yylsp
[-1]), (yyvsp
[0].named_ref
), false); }
2602 #line 2603 "src/parse-gram.c" /* yacc.c:1663 */
2606 #line 621 "src/parse-gram.y" /* yacc.c:1663 */
2607 { grammar_current_rule_action_append ((yyvsp
[0].code
), (yylsp
[0]), NULL
, true); }
2608 #line 2609 "src/parse-gram.c" /* yacc.c:1663 */
2612 #line 623 "src/parse-gram.y" /* yacc.c:1663 */
2613 { grammar_current_rule_empty_set ((yylsp
[0])); }
2614 #line 2615 "src/parse-gram.c" /* yacc.c:1663 */
2618 #line 625 "src/parse-gram.y" /* yacc.c:1663 */
2619 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2620 #line 2621 "src/parse-gram.c" /* yacc.c:1663 */
2624 #line 627 "src/parse-gram.y" /* yacc.c:1663 */
2625 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2626 #line 2627 "src/parse-gram.c" /* yacc.c:1663 */
2630 #line 629 "src/parse-gram.y" /* yacc.c:1663 */
2631 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2632 #line 2633 "src/parse-gram.c" /* yacc.c:1663 */
2636 #line 633 "src/parse-gram.y" /* yacc.c:1663 */
2637 { (yyval
.named_ref
) = 0; }
2638 #line 2639 "src/parse-gram.c" /* yacc.c:1663 */
2642 #line 634 "src/parse-gram.y" /* yacc.c:1663 */
2643 { (yyval
.named_ref
) = named_ref_new((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2644 #line 2645 "src/parse-gram.c" /* yacc.c:1663 */
2648 #line 645 "src/parse-gram.y" /* yacc.c:1663 */
2649 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[0].chars
)); }
2650 #line 2651 "src/parse-gram.c" /* yacc.c:1663 */
2654 #line 670 "src/parse-gram.y" /* yacc.c:1663 */
2655 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= ""; }
2656 #line 2657 "src/parse-gram.c" /* yacc.c:1663 */
2660 #line 671 "src/parse-gram.y" /* yacc.c:1663 */
2661 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= (yyvsp
[0].uniqstr
); }
2662 #line 2663 "src/parse-gram.c" /* yacc.c:1663 */
2666 #line 672 "src/parse-gram.y" /* yacc.c:1663 */
2667 { (yyval
.value
).kind
= muscle_string
; (yyval
.value
).chars
= (yyvsp
[0].chars
); }
2668 #line 2669 "src/parse-gram.c" /* yacc.c:1663 */
2672 #line 673 "src/parse-gram.y" /* yacc.c:1663 */
2673 { (yyval
.value
).kind
= muscle_code
; (yyval
.value
).chars
= (yyvsp
[0].chars
); }
2674 #line 2675 "src/parse-gram.c" /* yacc.c:1663 */
2678 #line 683 "src/parse-gram.y" /* yacc.c:1663 */
2680 code_props plain_code
;
2681 (yyvsp
[0].code
)[strlen ((yyvsp
[0].code
)) - 1] = '\0';
2682 code_props_plain_init (&plain_code
, (yyvsp
[0].code
)+1, (yylsp
[0]));
2683 code_props_translate_code (&plain_code
);
2684 gram_scanner_last_string_free ();
2685 (yyval
.chars
) = plain_code
.code
;
2687 #line 2688 "src/parse-gram.c" /* yacc.c:1663 */
2691 #line 703 "src/parse-gram.y" /* yacc.c:1663 */
2692 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2693 #line 2694 "src/parse-gram.c" /* yacc.c:1663 */
2697 #line 705 "src/parse-gram.y" /* yacc.c:1663 */
2699 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[0].character
)), (yylsp
[0]));
2700 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2701 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[0].character
), (yylsp
[0]));
2703 #line 2704 "src/parse-gram.c" /* yacc.c:1663 */
2707 #line 713 "src/parse-gram.y" /* yacc.c:1663 */
2708 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2709 #line 2710 "src/parse-gram.c" /* yacc.c:1663 */
2713 #line 725 "src/parse-gram.y" /* yacc.c:1663 */
2715 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].chars
)), (yylsp
[0]));
2716 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2718 #line 2719 "src/parse-gram.c" /* yacc.c:1663 */
2722 #line 734 "src/parse-gram.y" /* yacc.c:1663 */
2724 code_props plain_code
;
2725 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2726 code_props_translate_code (&plain_code
);
2727 gram_scanner_last_string_free ();
2728 muscle_code_grow ("epilogue", plain_code
.code
, (yylsp
[0]));
2729 code_scanner_last_string_free ();
2731 #line 2732 "src/parse-gram.c" /* yacc.c:1663 */
2735 #line 2736 "src/parse-gram.c" /* yacc.c:1663 */
2738 if (yychar_backup
!= yychar
)
2739 YY_LAC_DISCARD ("yychar change");
2741 /* User semantic actions sometimes alter yychar, and that requires
2742 that yytoken be updated with the new translation. We take the
2743 approach of translating immediately before every use of yytoken.
2744 One alternative is translating here after every semantic action,
2745 but that translation would be missed if the semantic action invokes
2746 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2747 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2748 incorrect destructor might then be invoked immediately. In the
2749 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2750 to an incorrect destructor call or verbose syntax error message
2751 before the lookahead is translated. */
2752 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2756 YY_STACK_PRINT (yyss
, yyssp
);
2761 /* Now 'shift' the result of the reduction. Determine what state
2762 that goes to, based on the state we popped back to and the rule
2763 number reduced by. */
2767 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2768 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2769 yystate
= yytable
[yystate
];
2771 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2776 /*--------------------------------------.
2777 | yyerrlab -- here on detecting error. |
2778 `--------------------------------------*/
2780 /* Make sure we have latest lookahead translation. See comments at
2781 user semantic actions for why this is necessary. */
2782 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2784 /* If not already recovering from an error, report this error. */
2788 #if ! YYERROR_VERBOSE
2789 yyerror (&yylloc
, YY_("syntax error"));
2791 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2792 yyesa, &yyes, &yyes_capacity, \
2795 char const *yymsgp
= YY_("syntax error");
2796 int yysyntax_error_status
;
2797 if (yychar
!= YYEMPTY
)
2799 yysyntax_error_status
= YYSYNTAX_ERROR
;
2800 if (yysyntax_error_status
== 0)
2802 else if (yysyntax_error_status
== 1)
2804 if (yymsg
!= yymsgbuf
)
2805 YYSTACK_FREE (yymsg
);
2806 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2810 yymsg_alloc
= sizeof yymsgbuf
;
2811 yysyntax_error_status
= 2;
2815 yysyntax_error_status
= YYSYNTAX_ERROR
;
2819 yyerror (&yylloc
, yymsgp
);
2820 if (yysyntax_error_status
== 2)
2821 goto yyexhaustedlab
;
2823 # undef YYSYNTAX_ERROR
2827 yyerror_range
[1] = yylloc
;
2829 if (yyerrstatus
== 3)
2831 /* If just tried and failed to reuse lookahead token after an
2832 error, discard it. */
2834 if (yychar
<= YYEOF
)
2836 /* Return failure if at end of input. */
2837 if (yychar
== YYEOF
)
2842 yydestruct ("Error: discarding",
2843 yytoken
, &yylval
, &yylloc
);
2848 /* Else will try to reuse lookahead token after shifting the error
2853 /*---------------------------------------------------.
2854 | yyerrorlab -- error raised explicitly by YYERROR. |
2855 `---------------------------------------------------*/
2858 /* Pacify compilers like GCC when the user code never invokes
2859 YYERROR and the label yyerrorlab therefore never appears in user
2861 if (/*CONSTCOND*/ 0)
2864 yyerror_range
[1] = yylsp
[1-yylen
];
2865 /* Do not reclaim the symbols of the rule whose action triggered
2869 YY_STACK_PRINT (yyss
, yyssp
);
2874 /*-------------------------------------------------------------.
2875 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2876 `-------------------------------------------------------------*/
2878 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2882 yyn
= yypact
[yystate
];
2883 if (!yypact_value_is_default (yyn
))
2886 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2894 /* Pop the current state because it cannot handle the error token. */
2898 yyerror_range
[1] = *yylsp
;
2899 yydestruct ("Error: popping",
2900 yystos
[yystate
], yyvsp
, yylsp
);
2903 YY_STACK_PRINT (yyss
, yyssp
);
2906 /* If the stack popping above didn't lose the initial context for the
2907 current lookahead token, the shift below will for sure. */
2908 YY_LAC_DISCARD ("error recovery");
2910 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2912 YY_IGNORE_MAYBE_UNINITIALIZED_END
2914 yyerror_range
[2] = yylloc
;
2915 /* Using YYLLOC is tempting, but would change the location of
2916 the lookahead. YYLOC is available though. */
2917 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
2920 /* Shift the error token. */
2921 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2927 /*-------------------------------------.
2928 | yyacceptlab -- YYACCEPT comes here. |
2929 `-------------------------------------*/
2934 /*-----------------------------------.
2935 | yyabortlab -- YYABORT comes here. |
2936 `-----------------------------------*/
2942 /*-------------------------------------------------.
2943 | yyexhaustedlab -- memory exhaustion comes here. |
2944 `-------------------------------------------------*/
2946 yyerror (&yylloc
, YY_("memory exhausted"));
2952 if (yychar
!= YYEMPTY
)
2954 /* Make sure we have latest lookahead translation. See comments at
2955 user semantic actions for why this is necessary. */
2956 yytoken
= YYTRANSLATE (yychar
);
2957 yydestruct ("Cleanup: discarding lookahead",
2958 yytoken
, &yylval
, &yylloc
);
2960 /* Do not reclaim the symbols of the rule whose action triggered
2961 this YYABORT or YYACCEPT. */
2963 YY_STACK_PRINT (yyss
, yyssp
);
2964 while (yyssp
!= yyss
)
2966 yydestruct ("Cleanup: popping",
2967 yystos
[*yyssp
], yyvsp
, yylsp
);
2972 YYSTACK_FREE (yyss
);
2975 YYSTACK_FREE (yyes
);
2977 if (yymsg
!= yymsgbuf
)
2978 YYSTACK_FREE (yymsg
);
2982 #line 744 "src/parse-gram.y" /* yacc.c:1923 */
2985 /* Return the location of the left-hand side of a rule whose
2986 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2987 the right-hand side, and return an empty location equal to the end
2988 boundary of RHS[0] if the right-hand side is empty. */
2991 lloc_default (YYLTYPE
const *rhs
, int n
)
2996 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2997 The bug is fixed in 7.4.2m, but play it safe for now. */
2998 loc
.start
= rhs
[n
].end
;
2999 loc
.end
= rhs
[n
].end
;
3001 /* Ignore empty nonterminals the start of the right-hand side.
3002 Do not bother to ignore them at the end of the right-hand side,
3003 since empty nonterminals have the same end as their predecessors. */
3004 for (i
= 1; i
<= n
; i
++)
3005 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
3007 loc
.start
= rhs
[i
].start
;
3016 add_param (param_type type
, char *decl
, location loc
)
3018 static char const alphanum
[26 + 26 + 1 + 10] =
3019 "abcdefghijklmnopqrstuvwxyz"
3020 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3024 char const *name_start
= NULL
;
3027 /* Stop on last actual character. */
3028 for (p
= decl
; p
[1]; p
++)
3030 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
3031 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
3034 /* Strip the surrounding '{' and '}', and any blanks just inside
3037 while (c_isspace ((unsigned char) *p
))
3041 while (c_isspace ((unsigned char) *decl
))
3046 complain (&loc
, complaint
, _("missing identifier in parameter declaration"));
3049 char *name
= xmemdup0 (name_start
, strspn (name_start
, alphanum
));
3050 if (type
& param_lex
)
3051 muscle_pair_list_grow ("lex_param", decl
, name
);
3052 if (type
& param_parse
)
3053 muscle_pair_list_grow ("parse_param", decl
, name
);
3057 gram_scanner_last_string_free ();
3062 version_check (location
const *loc
, char const *version
)
3064 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
3066 complain (loc
, complaint
, "require bison %s, but have %s",
3067 version
, PACKAGE_VERSION
);
3073 gram_error (location
const *loc
, char const *msg
)
3075 complain (loc
, complaint
, "%s", msg
);
3079 token_name (int type
)
3081 return yytname
[YYTRANSLATE (type
)];
3092 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
3093 return quotearg_style (escape_quoting_style
, buf
);