1 /* A Bison parser, made by GNU Bison 2.7.1127-02879-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.1127-02879-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
172 #line 649 "src/parse-gram.y" /* yacc.c:372 */
173 #include "muscle-tab.h"
175 #line 176 "src/parse-gram.c" /* yacc.c:372 */
178 #ifndef GRAM_TOKENTYPE
179 # define GRAM_TOKENTYPE
187 PERCENT_DESTRUCTOR
= 262,
188 PERCENT_PRINTER
= 263,
191 PERCENT_NONASSOC
= 266,
192 PERCENT_PRECEDENCE
= 267,
197 PERCENT_DEFAULT_PREC
= 272,
198 PERCENT_DEFINE
= 273,
199 PERCENT_DEFINES
= 274,
200 PERCENT_ERROR_VERBOSE
= 275,
201 PERCENT_EXPECT
= 276,
202 PERCENT_EXPECT_RR
= 277,
204 PERCENT_FILE_PREFIX
= 279,
205 PERCENT_GLR_PARSER
= 280,
206 PERCENT_INITIAL_ACTION
= 281,
207 PERCENT_LANGUAGE
= 282,
208 PERCENT_NAME_PREFIX
= 283,
209 PERCENT_NO_DEFAULT_PREC
= 284,
210 PERCENT_NO_LINES
= 285,
211 PERCENT_NONDETERMINISTIC_PARSER
= 286,
212 PERCENT_OUTPUT
= 287,
213 PERCENT_REQUIRE
= 288,
214 PERCENT_SKELETON
= 289,
216 PERCENT_TOKEN_TABLE
= 291,
217 PERCENT_VERBOSE
= 292,
220 BRACED_PREDICATE
= 295,
227 PERCENT_PERCENT
= 302,
242 #if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
243 typedef union GRAM_STYPE GRAM_STYPE
;
246 #line 170 "src/parse-gram.y" /* yacc.c:372 */
247 unsigned char character
;
248 #line 177 "src/parse-gram.y" /* yacc.c:372 */
253 #line 188 "src/parse-gram.y" /* yacc.c:372 */
255 #line 196 "src/parse-gram.y" /* yacc.c:372 */
257 #line 200 "src/parse-gram.y" /* yacc.c:372 */
259 #line 205 "src/parse-gram.y" /* yacc.c:372 */
261 #line 208 "src/parse-gram.y" /* yacc.c:372 */
263 #line 211 "src/parse-gram.y" /* yacc.c:372 */
264 named_ref
*named_ref
;
265 #line 238 "src/parse-gram.y" /* yacc.c:372 */
267 #line 413 "src/parse-gram.y" /* yacc.c:372 */
268 code_props_type code_type
;
269 #line 651 "src/parse-gram.y" /* yacc.c:372 */
278 #line 279 "src/parse-gram.c" /* yacc.c:372 */
280 # define GRAM_STYPE_IS_TRIVIAL 1
281 # define GRAM_STYPE_IS_DECLARED 1
285 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
286 typedef struct GRAM_LTYPE GRAM_LTYPE
;
294 # define GRAM_LTYPE_IS_DECLARED 1
295 # define GRAM_LTYPE_IS_TRIVIAL 1
300 int gram_parse (void);
302 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
304 /* Copy the second part of user declarations. */
306 #line 307 "src/parse-gram.c" /* yacc.c:375 */
307 /* Unqualified %code blocks. */
308 #line 53 "src/parse-gram.y" /* yacc.c:376 */
310 static int current_prec
= 0;
311 static location current_lhs_location
;
312 static named_ref
*current_lhs_named_ref
;
313 static symbol
*current_lhs_symbol
;
314 static symbol_class current_class
= unknown_sym
;
315 static uniqstr current_type
= NULL
;
317 /** Set the new current left-hand side symbol, possibly common
318 * to several right-hand side parts of rule.
322 current_lhs (symbol
*sym
, location loc
, named_ref
*ref
)
324 current_lhs_symbol
= sym
;
325 current_lhs_location
= loc
;
326 /* In order to simplify memory management, named references for lhs
327 are always assigned by deep copy into the current symbol_list
328 node. This is because a single named-ref in the grammar may
329 result in several uses when the user factors lhs between several
330 rules using "|". Therefore free the parser's original copy. */
331 free (current_lhs_named_ref
);
332 current_lhs_named_ref
= ref
;
335 #define YYTYPE_INT16 int_fast16_t
336 #define YYTYPE_INT8 int_fast8_t
337 #define YYTYPE_UINT16 uint_fast16_t
338 #define YYTYPE_UINT8 uint_fast8_t
340 #line 228 "src/parse-gram.y" /* yacc.c:376 */
342 /** Add a lex-param and/or a parse-param.
344 * \param type where to push this formal argument.
345 * \param decl the formal argument. Destroyed.
346 * \param loc the location in the source.
348 static void add_param (param_type type
, char *decl
, location loc
);
349 static param_type current_param
= param_none
;
352 #line 353 "src/parse-gram.c" /* yacc.c:376 */
359 typedef YYTYPE_UINT8 yytype_uint8
;
361 typedef unsigned char yytype_uint8
;
365 typedef YYTYPE_INT8 yytype_int8
;
367 typedef signed char yytype_int8
;
371 typedef YYTYPE_UINT16 yytype_uint16
;
373 typedef unsigned short int yytype_uint16
;
377 typedef YYTYPE_INT16 yytype_int16
;
379 typedef short int yytype_int16
;
383 # ifdef __SIZE_TYPE__
384 # define YYSIZE_T __SIZE_TYPE__
385 # elif defined size_t
386 # define YYSIZE_T size_t
387 # elif ! defined YYSIZE_T
388 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
389 # define YYSIZE_T size_t
391 # define YYSIZE_T unsigned int
395 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
398 # if defined YYENABLE_NLS && YYENABLE_NLS
400 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
401 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
405 # define YY_(Msgid) Msgid
409 /* Suppress unused-variable warnings by "using" E. */
411 # define YYUSE(E) ((void) (E))
413 # define YYUSE(E) /* empty */
418 /* The parser invokes alloca or malloc; define the necessary symbols. */
420 # ifdef YYSTACK_ALLOC
421 /* Pacify GCC's 'empty if-body' warning. */
422 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
423 # ifndef YYSTACK_ALLOC_MAXIMUM
424 /* The OS might guarantee only one guard page at the bottom of the stack,
425 and a page size can be as small as 4096 bytes. So we cannot safely
426 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
427 to allow for a few compiler-allocated temporary stack slots. */
428 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
431 # define YYSTACK_ALLOC YYMALLOC
432 # define YYSTACK_FREE YYFREE
433 # ifndef YYSTACK_ALLOC_MAXIMUM
434 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
436 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
437 && ! ((defined YYMALLOC || defined malloc) \
438 && (defined YYFREE || defined free)))
439 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
440 # ifndef EXIT_SUCCESS
441 # define EXIT_SUCCESS 0
445 # define YYMALLOC malloc
446 # if ! defined malloc && ! defined EXIT_SUCCESS
447 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
452 # if ! defined free && ! defined EXIT_SUCCESS
453 void free (void *); /* INFRINGES ON USER NAME SPACE */
457 # define YYCOPY_NEEDED 1
461 #if (! defined yyoverflow \
462 && (! defined __cplusplus \
463 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
464 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
466 /* A type that is properly aligned for any stack member. */
469 yytype_int16 yyss_alloc
;
474 /* The size of the maximum gap between one aligned stack and the next. */
475 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
477 /* The size of an array large to enough to hold all stacks, each with
479 # define YYSTACK_BYTES(N) \
480 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
481 + 2 * YYSTACK_GAP_MAXIMUM)
483 # define YYCOPY_NEEDED 1
485 /* Relocate STACK from its old location to the new one. The
486 local variables YYSIZE and YYSTACKSIZE give the old and new number of
487 elements in the stack, and YYPTR gives the new location of the
488 stack. Advance YYPTR to a properly aligned location for the next
490 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
493 YYSIZE_T yynewbytes; \
494 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
495 Stack = &yyptr->Stack_alloc; \
496 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
497 yyptr += yynewbytes / sizeof (*yyptr); \
503 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
504 /* Copy COUNT objects from SRC to DST. The source and destination do
507 # if defined __GNUC__ && 1 < __GNUC__
508 # define YYCOPY(Dst, Src, Count) \
509 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
511 # define YYCOPY(Dst, Src, Count) \
515 for (yyi = 0; yyi < (Count); yyi++) \
516 (Dst)[yyi] = (Src)[yyi]; \
521 #endif /* !YYCOPY_NEEDED */
523 /* YYFINAL -- State number of the termination state. */
525 /* YYLAST -- Last index in YYTABLE. */
528 /* YYNTOKENS -- Number of terminals. */
530 /* YYNNTS -- Number of nonterminals. */
532 /* YYNRULES -- Number of rules. */
534 /* YYNSTATES -- Number of states. */
535 #define YYNSTATES 145
537 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
538 by yylex, with out-of-bounds checking. */
540 #define YYMAXUTOK 312
542 #define YYTRANSLATE(YYX) \
543 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
545 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
546 as returned by yylex, without out-of-bounds checking. */
547 static const yytype_uint8 yytranslate
[] =
549 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
575 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
576 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
577 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
578 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
579 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
584 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
585 static const yytype_uint16 yyrline
[] =
587 0, 261, 261, 270, 271, 275, 276, 286, 290, 295,
588 296, 301, 307, 308, 309, 310, 315, 324, 325, 326,
589 327, 328, 329, 329, 330, 331, 355, 356, 357, 358,
590 362, 363, 372, 373, 374, 378, 390, 394, 398, 405,
591 416, 417, 427, 428, 432, 444, 444, 449, 449, 454,
592 465, 480, 481, 482, 483, 487, 488, 493, 495, 500,
593 505, 515, 517, 522, 523, 527, 528, 532, 533, 534,
594 539, 544, 549, 555, 561, 572, 573, 582, 583, 589,
595 590, 591, 598, 598, 606, 607, 608, 613, 616, 618,
596 620, 622, 624, 626, 628, 633, 634, 644, 645, 670,
597 671, 672, 673, 682, 702, 704, 713, 718, 719, 724,
602 #if GRAM_DEBUG || YYERROR_VERBOSE || 1
603 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
604 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
605 static const char *const yytname
[] =
607 "\"end of file\"", "error", "$undefined", "\"string\"", "\"%token\"",
608 "\"%nterm\"", "\"%type\"", "\"%destructor\"", "\"%printer\"",
609 "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%precedence\"",
610 "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
611 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
612 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
613 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
614 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
615 "\"%nondeterministic-parser\"", "\"%output\"", "\"%require\"",
616 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
617 "\"%yacc\"", "\"{...}\"", "\"%?{...}\"", "\"[identifier]\"", "\"char\"",
618 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
619 "\"|\"", "\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"",
620 "\"integer\"", "\"%param\"", "\"%union\"", "\"%empty\"", "$accept",
621 "input", "prologue_declarations", "prologue_declaration", "$@1",
622 "params", "grammar_declaration", "code_props_type", "union_name",
623 "symbol_declaration", "$@2", "$@3", "precedence_declaration",
624 "precedence_declarator", "tag.opt", "symbols.prec", "symbol.prec",
625 "symbols.1", "generic_symlist", "generic_symlist_item", "tag",
626 "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
627 "rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
628 "braceless", "id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
633 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
634 (internal) symbol number NUM (which must be that of a token). */
635 static const yytype_uint16 yytoknum
[] =
637 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
638 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
639 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
640 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
641 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
642 305, 306, 307, 308, 309, 310, 311, 312
646 #define YYPACT_NINF -115
648 #define yypact_value_is_default(Yystate) \
649 (!!((Yystate) == (-115)))
651 #define YYTABLE_NINF -111
653 #define yytable_value_is_error(Yytable_value) \
656 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
658 static const yytype_int8 yypact
[] =
660 -115, 16, 109, -115, -115, -115, -28, -115, -115, -115,
661 -115, -115, -115, -14, -115, 25, 23, -115, -27, -20,
662 -115, 39, -115, 7, 48, 71, -115, -115, -115, 72,
663 73, 74, -2, -115, -115, -115, 56, -115, -115, -115,
664 33, -115, -115, 40, -115, -115, 37, 54, 54, -2,
665 -115, 50, -115, -115, -115, 2, -115, -115, -115, -115,
666 -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
667 -115, -115, 51, -115, 53, 3, -115, -115, 49, 65,
668 -115, 50, 42, -115, -2, -115, -115, 54, -1, 54,
669 -2, -115, -115, -115, -115, -115, -115, -115, -115, 63,
670 -115, -115, -115, -115, -115, 69, -115, -115, -115, -115,
671 42, -115, -115, -115, -2, -115, 38, -115, 106, -115,
672 -115, -115, -115, -115, -115, -115, -115, -115, -15, 41,
673 -115, -115, -2, 57, 59, 49, -115, -115, 49, 41,
674 -115, -115, -115, -115, -115
677 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
678 Performed when YYTABLE does not specify something else to do. Zero
679 means the default is an error. */
680 static const yytype_uint8 yydefact
[] =
682 3, 0, 0, 1, 47, 45, 0, 40, 41, 51,
683 52, 53, 54, 0, 36, 0, 9, 11, 0, 0,
684 7, 0, 15, 0, 0, 0, 37, 19, 20, 0,
685 0, 0, 0, 26, 27, 28, 0, 6, 29, 22,
686 42, 4, 5, 0, 33, 32, 55, 0, 0, 0,
687 103, 0, 38, 98, 97, 99, 10, 12, 13, 14,
688 16, 17, 18, 21, 24, 25, 109, 105, 104, 107,
689 34, 108, 0, 106, 0, 0, 77, 79, 95, 0,
690 43, 0, 0, 56, 0, 70, 75, 48, 71, 46,
691 49, 61, 39, 101, 100, 8, 102, 81, 80, 0,
692 78, 2, 96, 82, 31, 23, 44, 67, 68, 69,
693 35, 63, 66, 65, 50, 57, 59, 76, 72, 73,
694 62, 111, 87, 30, 64, 58, 60, 74, 83, 84,
695 87, 86, 0, 0, 0, 95, 90, 91, 95, 85,
699 /* YYPGOTO[NTERM-NUM]. */
700 static const yytype_int8 yypgoto
[] =
702 -115, -115, -115, -115, -115, -115, 120, -115, -115, -115,
703 -115, -115, -115, -115, -115, -115, 9, -115, -115, 14,
704 -115, -50, 100, -115, 75, -115, -115, -115, 19, -114,
705 -115, -115, -33, -18, -115, -32, -82, -115
708 /* YYDEFGOTO[NTERM-NUM]. */
709 static const yytype_int16 yydefgoto
[] =
711 -1, 1, 2, 41, 79, 105, 74, 43, 81, 44,
712 48, 47, 45, 46, 84, 114, 115, 90, 110, 111,
713 112, 86, 87, 75, 76, 77, 122, 128, 129, 103,
714 55, 95, 52, 69, 78, 113, 71, 101
717 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
718 positive, shift that token. If negative, reduce the rule whose
719 number is the opposite. If YYTABLE_NINF, syntax error. */
720 static const yytype_int16 yytable
[] =
722 70, 66, 66, -110, 72, 93, 119, 4, 5, 6,
723 7, 8, 9, 10, 11, 12, 3, 91, 92, 13,
724 14, 143, 96, 49, 144, 50, 56, 57, 53, 88,
725 88, 51, 26, 130, 58, 131, 127, 117, 32, 117,
726 67, 50, 59, 68, 66, 66, 60, 94, 106, 73,
727 99, 61, 116, 118, 132, 133, 134, 72, 120, 40,
728 4, 5, 6, 7, 8, 9, 10, 11, 12, 88,
729 54, 88, 13, 14, 62, 63, 64, 65, 80, 82,
730 135, 136, 116, 67, 67, 26, 68, 68, 83, 50,
731 102, 32, 126, 107, 108, 109, 67, 138, 137, 68,
732 140, 97, 73, 98, 104, 85, 121, 138, 123, 66,
733 142, 141, 40, 4, 5, 6, 7, 8, 9, 10,
734 11, 12, 42, 125, 124, 13, 14, 15, 16, 17,
735 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
736 28, 29, 30, 31, 32, 33, 34, 35, 89, 139,
737 100, 0, 0, 0, 0, 0, 36, 0, 37, 38,
741 static const yytype_int16 yycheck
[] =
743 32, 3, 3, 0, 1, 3, 88, 4, 5, 6,
744 7, 8, 9, 10, 11, 12, 0, 49, 51, 16,
745 17, 135, 55, 51, 138, 39, 3, 54, 3, 47,
746 48, 45, 29, 48, 54, 50, 118, 87, 35, 89,
747 42, 39, 3, 45, 3, 3, 39, 45, 81, 46,
748 47, 3, 84, 54, 13, 14, 15, 1, 90, 56,
749 4, 5, 6, 7, 8, 9, 10, 11, 12, 87,
750 45, 89, 16, 17, 3, 3, 3, 3, 45, 39,
751 39, 40, 114, 42, 42, 29, 45, 45, 51, 39,
752 41, 35, 54, 51, 52, 53, 42, 129, 57, 45,
753 132, 50, 46, 50, 39, 51, 43, 139, 39, 3,
754 51, 54, 56, 4, 5, 6, 7, 8, 9, 10,
755 11, 12, 2, 114, 110, 16, 17, 18, 19, 20,
756 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
757 31, 32, 33, 34, 35, 36, 37, 38, 48, 130,
758 75, -1, -1, -1, -1, -1, 47, -1, 49, 50,
759 -1, -1, -1, -1, 55, 56
762 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
763 symbol of state STATE-NUM. */
764 static const yytype_uint8 yystos
[] =
766 0, 59, 60, 0, 4, 5, 6, 7, 8, 9,
767 10, 11, 12, 16, 17, 18, 19, 20, 21, 22,
768 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
769 33, 34, 35, 36, 37, 38, 47, 49, 50, 55,
770 56, 61, 64, 65, 67, 70, 71, 69, 68, 51,
771 39, 45, 90, 3, 45, 88, 3, 54, 54, 3,
772 39, 3, 3, 3, 3, 3, 3, 42, 45, 91,
773 93, 94, 1, 46, 64, 81, 82, 83, 92, 62,
774 45, 66, 39, 51, 72, 51, 79, 80, 91, 80,
775 75, 93, 90, 3, 45, 89, 90, 50, 50, 47,
776 82, 95, 41, 87, 39, 63, 90, 51, 52, 53,
777 76, 77, 78, 93, 73, 74, 93, 79, 54, 94,
778 93, 43, 84, 39, 77, 74, 54, 94, 85, 86,
779 48, 50, 13, 14, 15, 39, 40, 57, 93, 86,
783 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
784 static const yytype_uint8 yyr1
[] =
786 0, 58, 59, 60, 60, 61, 61, 61, 61, 61,
787 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
788 61, 61, 62, 61, 61, 61, 61, 61, 61, 61,
789 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
790 65, 65, 66, 66, 64, 68, 67, 69, 67, 67,
791 70, 71, 71, 71, 71, 72, 72, 73, 73, 74,
792 74, 75, 75, 76, 76, 77, 77, 78, 78, 78,
793 79, 79, 79, 79, 79, 80, 80, 81, 81, 82,
794 82, 82, 84, 83, 85, 85, 85, 86, 86, 86,
795 86, 86, 86, 86, 86, 87, 87, 88, 88, 89,
796 89, 89, 89, 90, 91, 91, 92, 93, 93, 94,
800 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
801 static const yytype_uint8 yyr2
[] =
803 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
804 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
805 1, 2, 0, 3, 2, 2, 1, 1, 1, 1,
806 2, 1, 1, 1, 2, 3, 1, 1, 2, 3,
807 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
808 3, 1, 1, 1, 1, 0, 1, 1, 2, 1,
809 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
810 1, 1, 2, 2, 3, 1, 2, 1, 2, 1,
811 2, 2, 0, 4, 1, 3, 2, 0, 3, 3,
812 2, 2, 3, 3, 3, 0, 1, 1, 1, 0,
813 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
818 #define yyerrok (yyerrstatus = 0)
819 #define yyclearin (yychar = YYEMPTY)
823 #define YYACCEPT goto yyacceptlab
824 #define YYABORT goto yyabortlab
825 #define YYERROR goto yyerrorlab
828 #define YYRECOVERING() (!!yyerrstatus)
830 #define YYBACKUP(Token, Value) \
832 if (yychar == YYEMPTY) \
836 YYPOPSTACK (yylen); \
838 YY_LAC_DISCARD ("YYBACKUP"); \
843 yyerror (&yylloc, YY_("syntax error: cannot back up")); \
848 /* Error token number */
850 #define YYERRCODE 256
853 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
854 If N is 0, then set CURRENT to the empty location which ends
855 the previous symbol: RHS[0] (always defined). */
857 #ifndef YYLLOC_DEFAULT
858 # define YYLLOC_DEFAULT(Current, Rhs, N) \
862 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
863 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
864 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
865 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
869 (Current).first_line = (Current).last_line = \
870 YYRHSLOC (Rhs, 0).last_line; \
871 (Current).first_column = (Current).last_column = \
872 YYRHSLOC (Rhs, 0).last_column; \
877 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
880 /* Enable debugging if requested. */
884 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
885 # define YYFPRINTF fprintf
888 # define YYDPRINTF(Args) \
895 /* YY_LOCATION_PRINT -- Print the location on the stream.
896 This macro was not mandated originally: define only if we know
897 we won't break user code: when these are the locations we know. */
899 #ifndef YY_LOCATION_PRINT
900 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
902 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
904 __attribute__((__unused__
))
906 yy_location_print_ (FILE *yyo
, YYLTYPE
const * const yylocp
)
909 int end_col
= 0 != yylocp
->last_column
? yylocp
->last_column
- 1 : 0;
910 if (0 <= yylocp
->first_line
)
912 res
+= YYFPRINTF (yyo
, "%d", yylocp
->first_line
);
913 if (0 <= yylocp
->first_column
)
914 res
+= YYFPRINTF (yyo
, ".%d", yylocp
->first_column
);
916 if (0 <= yylocp
->last_line
)
918 if (yylocp
->first_line
< yylocp
->last_line
)
920 res
+= YYFPRINTF (yyo
, "-%d", yylocp
->last_line
);
922 res
+= YYFPRINTF (yyo
, ".%d", end_col
);
924 else if (0 <= end_col
&& yylocp
->first_column
< end_col
)
925 res
+= YYFPRINTF (yyo
, "-%d", end_col
);
930 # define YY_LOCATION_PRINT(File, Loc) \
931 yy_location_print_ (File, &(Loc))
934 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
939 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
943 YYFPRINTF (stderr, "%s ", Title); \
944 yy_symbol_print (stderr, \
945 Type, Value, Location); \
946 YYFPRINTF (stderr, "\n"); \
951 /*--------------------------------.
952 | Print this symbol on YYOUTPUT. |
953 `--------------------------------*/
956 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
958 FILE *yyo
= yyoutput
;
964 if (yytype
< YYNTOKENS
)
965 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
969 case 3: /* "string" */
970 #line 183 "src/parse-gram.y" /* yacc.c:706 */
971 { fputs (quotearg_style (c_quoting_style
, ((*yyvaluep
).chars
)), yyo
); }
972 #line 973 "src/parse-gram.c" /* yacc.c:706 */
975 case 23: /* "%<flag>" */
976 #line 193 "src/parse-gram.y" /* yacc.c:706 */
977 { fprintf (yyo
, "%%%s", ((*yyvaluep
).uniqstr
)); }
978 #line 979 "src/parse-gram.c" /* yacc.c:706 */
981 case 39: /* "{...}" */
982 #line 185 "src/parse-gram.y" /* yacc.c:706 */
983 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
984 #line 985 "src/parse-gram.c" /* yacc.c:706 */
987 case 41: /* "[identifier]" */
988 #line 191 "src/parse-gram.y" /* yacc.c:706 */
989 { fprintf (yyo
, "[%s]", ((*yyvaluep
).uniqstr
)); }
990 #line 991 "src/parse-gram.c" /* yacc.c:706 */
993 case 42: /* "char" */
994 #line 172 "src/parse-gram.y" /* yacc.c:706 */
995 { fputs (char_name (((*yyvaluep
).character
)), yyo
); }
996 #line 997 "src/parse-gram.c" /* yacc.c:706 */
999 case 43: /* "epilogue" */
1000 #line 185 "src/parse-gram.y" /* yacc.c:706 */
1001 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1002 #line 1003 "src/parse-gram.c" /* yacc.c:706 */
1005 case 45: /* "identifier" */
1006 #line 190 "src/parse-gram.y" /* yacc.c:706 */
1007 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1008 #line 1009 "src/parse-gram.c" /* yacc.c:706 */
1011 case 46: /* "identifier:" */
1012 #line 192 "src/parse-gram.y" /* yacc.c:706 */
1013 { fprintf (yyo
, "%s:", ((*yyvaluep
).uniqstr
)); }
1014 #line 1015 "src/parse-gram.c" /* yacc.c:706 */
1017 case 49: /* "%{...%}" */
1018 #line 185 "src/parse-gram.y" /* yacc.c:706 */
1019 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1020 #line 1021 "src/parse-gram.c" /* yacc.c:706 */
1023 case 51: /* "<tag>" */
1024 #line 194 "src/parse-gram.y" /* yacc.c:706 */
1025 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1026 #line 1027 "src/parse-gram.c" /* yacc.c:706 */
1029 case 54: /* "integer" */
1030 #line 198 "src/parse-gram.y" /* yacc.c:706 */
1031 { fprintf (yyo
, "%d", ((*yyvaluep
).integer
)); }
1032 #line 1033 "src/parse-gram.c" /* yacc.c:706 */
1035 case 55: /* "%param" */
1036 #line 241 "src/parse-gram.y" /* yacc.c:706 */
1038 switch (((*yyvaluep
).param
))
1040 #define CASE(In, Out) \
1041 case param_ ## In: fputs ("%" #Out, yyo); break
1042 CASE (lex
, lex
-param
);
1043 CASE (parse
, parse
-param
);
1046 case param_none
: aver (false); break;
1049 #line 1050 "src/parse-gram.c" /* yacc.c:706 */
1052 case 65: /* code_props_type */
1053 #line 414 "src/parse-gram.y" /* yacc.c:706 */
1054 { fprintf (yyo
, "%s", code_props_type_string (((*yyvaluep
).code_type
))); }
1055 #line 1056 "src/parse-gram.c" /* yacc.c:706 */
1058 case 74: /* symbol.prec */
1059 #line 202 "src/parse-gram.y" /* yacc.c:706 */
1060 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1061 #line 1062 "src/parse-gram.c" /* yacc.c:706 */
1065 #line 194 "src/parse-gram.y" /* yacc.c:706 */
1066 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1067 #line 1068 "src/parse-gram.c" /* yacc.c:706 */
1070 case 88: /* variable */
1071 #line 190 "src/parse-gram.y" /* yacc.c:706 */
1072 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1073 #line 1074 "src/parse-gram.c" /* yacc.c:706 */
1076 case 89: /* value */
1077 #line 660 "src/parse-gram.y" /* yacc.c:706 */
1079 switch (((*yyvaluep
).value
).kind
)
1081 case muscle_code
: fprintf (yyo
, "{%s}", ((*yyvaluep
).value
).chars
); break;
1082 case muscle_keyword
: fprintf (yyo
, "%s", ((*yyvaluep
).value
).chars
); break;
1083 case muscle_string
: fprintf (yyo
, "\"%s\"", ((*yyvaluep
).value
).chars
); break;
1086 #line 1087 "src/parse-gram.c" /* yacc.c:706 */
1089 case 90: /* braceless */
1090 #line 185 "src/parse-gram.y" /* yacc.c:706 */
1091 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1092 #line 1093 "src/parse-gram.c" /* yacc.c:706 */
1096 #line 202 "src/parse-gram.y" /* yacc.c:706 */
1097 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1098 #line 1099 "src/parse-gram.c" /* yacc.c:706 */
1101 case 92: /* id_colon */
1102 #line 203 "src/parse-gram.y" /* yacc.c:706 */
1103 { fprintf (yyo
, "%s:", ((*yyvaluep
).symbol
)->tag
); }
1104 #line 1105 "src/parse-gram.c" /* yacc.c:706 */
1107 case 93: /* symbol */
1108 #line 202 "src/parse-gram.y" /* yacc.c:706 */
1109 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1110 #line 1111 "src/parse-gram.c" /* yacc.c:706 */
1113 case 94: /* string_as_id */
1114 #line 202 "src/parse-gram.y" /* yacc.c:706 */
1115 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1116 #line 1117 "src/parse-gram.c" /* yacc.c:706 */
1125 /*--------------------------------.
1126 | Print this symbol on YYOUTPUT. |
1127 `--------------------------------*/
1130 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1132 YYFPRINTF (yyoutput
, "%s %s (",
1133 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1135 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1136 YYFPRINTF (yyoutput
, ": ");
1137 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1138 YYFPRINTF (yyoutput
, ")");
1141 /*------------------------------------------------------------------.
1142 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1144 `------------------------------------------------------------------*/
1147 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1149 YYFPRINTF (stderr
, "Stack now");
1150 for (; yybottom
<= yytop
; yybottom
++)
1152 int yybot
= *yybottom
;
1153 YYFPRINTF (stderr
, " %d", yybot
);
1155 YYFPRINTF (stderr
, "\n");
1158 # define YY_STACK_PRINT(Bottom, Top) \
1161 yy_stack_print ((Bottom), (Top)); \
1165 /*------------------------------------------------.
1166 | Report that the YYRULE is going to be reduced. |
1167 `------------------------------------------------*/
1170 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1172 unsigned long int yylno
= yyrline
[yyrule
];
1173 int yynrhs
= yyr2
[yyrule
];
1175 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1177 /* The symbols being reduced. */
1178 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1180 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1181 yy_symbol_print (stderr
,
1182 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1183 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1184 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1185 YYFPRINTF (stderr
, "\n");
1189 # define YY_REDUCE_PRINT(Rule) \
1192 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1195 /* Nonzero means print parse trace. It is left uninitialized so that
1196 multiple parsers can coexist. */
1198 #else /* !GRAM_DEBUG */
1199 # define YYDPRINTF(Args)
1200 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1201 # define YY_STACK_PRINT(Bottom, Top)
1202 # define YY_REDUCE_PRINT(Rule)
1203 #endif /* !GRAM_DEBUG */
1206 /* YYINITDEPTH -- initial size of the parser's stacks. */
1208 # define YYINITDEPTH 200
1211 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1212 if the built-in stack extension method is used).
1214 Do not make this value too large; the results are undefined if
1215 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1216 evaluated with infinite-precision integer arithmetic. */
1219 # define YYMAXDEPTH 10000
1222 /* Given a state stack such that *YYBOTTOM is its bottom, such that
1223 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1224 stack, and such that *YYCAPACITY is the maximum number of elements it
1225 can hold without a reallocation, make sure there is enough room to
1226 store YYADD more elements. If not, allocate a new stack using
1227 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1228 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1229 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1230 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1231 required. Return 1 if memory is exhausted. */
1233 yy_lac_stack_realloc (YYSIZE_T
*yycapacity
, YYSIZE_T yyadd
,
1235 char const *yydebug_prefix
,
1236 char const *yydebug_suffix
,
1238 yytype_int16
**yybottom
,
1239 yytype_int16
*yybottom_no_free
,
1240 yytype_int16
**yytop
, yytype_int16
*yytop_empty
)
1242 YYSIZE_T yysize_old
=
1243 *yytop
== yytop_empty
? 0 : *yytop
- *yybottom
+ 1;
1244 YYSIZE_T yysize_new
= yysize_old
+ yyadd
;
1245 if (*yycapacity
< yysize_new
)
1247 YYSIZE_T yyalloc
= 2 * yysize_new
;
1248 yytype_int16
*yybottom_new
;
1249 /* Use YYMAXDEPTH for maximum stack size given that the stack
1250 should never need to grow larger than the main state stack
1251 needs to grow without LAC. */
1252 if (YYMAXDEPTH
< yysize_new
)
1254 YYDPRINTF ((stderr
, "%smax size exceeded%s", yydebug_prefix
,
1258 if (YYMAXDEPTH
< yyalloc
)
1259 yyalloc
= YYMAXDEPTH
;
1261 (yytype_int16
*) YYSTACK_ALLOC (yyalloc
* sizeof *yybottom_new
);
1264 YYDPRINTF ((stderr
, "%srealloc failed%s", yydebug_prefix
,
1268 if (*yytop
!= yytop_empty
)
1270 YYCOPY (yybottom_new
, *yybottom
, yysize_old
);
1271 *yytop
= yybottom_new
+ (yysize_old
- 1);
1273 if (*yybottom
!= yybottom_no_free
)
1274 YYSTACK_FREE (*yybottom
);
1275 *yybottom
= yybottom_new
;
1276 *yycapacity
= yyalloc
;
1281 /* Establish the initial context for the current lookahead if no initial
1282 context is currently established.
1284 We define a context as a snapshot of the parser stacks. We define
1285 the initial context for a lookahead as the context in which the
1286 parser initially examines that lookahead in order to select a
1287 syntactic action. Thus, if the lookahead eventually proves
1288 syntactically unacceptable (possibly in a later context reached via a
1289 series of reductions), the initial context can be used to determine
1290 the exact set of tokens that would be syntactically acceptable in the
1291 lookahead's place. Moreover, it is the context after which any
1292 further semantic actions would be erroneous because they would be
1293 determined by a syntactically unacceptable token.
1295 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1296 performed in an inconsistent state (which, for the purposes of LAC,
1297 includes consistent states that don't know they're consistent because
1298 their default reductions have been disabled). Iff there is a
1299 lookahead token, it should also be invoked before reporting a syntax
1300 error. This latter case is for the sake of the debugging output.
1302 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1303 follows. If no initial context is currently established for the
1304 current lookahead, then check if that lookahead can eventually be
1305 shifted if syntactic actions continue from the current context.
1306 Report a syntax error if it cannot. */
1307 #define YY_LAC_ESTABLISH \
1309 if (!yy_lac_established) \
1311 YYDPRINTF ((stderr, \
1312 "LAC: initial context established for %s\n", \
1313 yytname[yytoken])); \
1314 yy_lac_established = 1; \
1316 int yy_lac_status = \
1317 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1318 if (yy_lac_status == 2) \
1319 goto yyexhaustedlab; \
1320 if (yy_lac_status == 1) \
1326 /* Discard any previous initial lookahead context because of Event,
1327 which may be a lookahead change or an invalidation of the currently
1328 established initial context for the current lookahead.
1330 The most common example of a lookahead change is a shift. An example
1331 of both cases is syntax error recovery. That is, a syntax error
1332 occurs when the lookahead is syntactically erroneous for the
1333 currently established initial context, so error recovery manipulates
1334 the parser stacks to try to find a new initial context in which the
1335 current lookahead is syntactically acceptable. If it fails to find
1336 such a context, it discards the lookahead. */
1338 # define YY_LAC_DISCARD(Event) \
1340 if (yy_lac_established) \
1343 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1345 yy_lac_established = 0; \
1349 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1352 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1353 eventually (after perhaps some reductions) be shifted, return 1 if
1354 not, or return 2 if memory is exhausted. As preconditions and
1355 postconditions: *YYES_CAPACITY is the allocated size of the array to
1356 which *YYES points, and either *YYES = YYESA or *YYES points to an
1357 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1358 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1359 any old *YYES other than YYESA. */
1361 yy_lac (yytype_int16
*yyesa
, yytype_int16
**yyes
,
1362 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1364 yytype_int16
*yyes_prev
= yyssp
;
1365 yytype_int16
*yyesp
= yyes_prev
;
1366 YYDPRINTF ((stderr
, "LAC: checking lookahead %s:", yytname
[yytoken
]));
1367 if (yytoken
== YYUNDEFTOK
)
1369 YYDPRINTF ((stderr
, " Always Err\n"));
1374 int yyrule
= yypact
[*yyesp
];
1375 if (yypact_value_is_default (yyrule
)
1376 || (yyrule
+= yytoken
) < 0 || YYLAST
< yyrule
1377 || yycheck
[yyrule
] != yytoken
)
1379 yyrule
= yydefact
[*yyesp
];
1382 YYDPRINTF ((stderr
, " Err\n"));
1388 yyrule
= yytable
[yyrule
];
1389 if (yytable_value_is_error (yyrule
))
1391 YYDPRINTF ((stderr
, " Err\n"));
1396 YYDPRINTF ((stderr
, " S%d\n", yyrule
));
1402 YYSIZE_T yylen
= yyr2
[yyrule
];
1403 YYDPRINTF ((stderr
, " R%d", yyrule
- 1));
1404 if (yyesp
!= yyes_prev
)
1406 YYSIZE_T yysize
= yyesp
- *yyes
+ 1;
1419 yyesp
= yyes_prev
-= yylen
;
1424 int yylhs
= yyr1
[yyrule
] - YYNTOKENS
;
1425 yystate
= yypgoto
[yylhs
] + *yyesp
;
1426 if (yystate
< 0 || YYLAST
< yystate
1427 || yycheck
[yystate
] != *yyesp
)
1428 yystate
= yydefgoto
[yylhs
];
1430 yystate
= yytable
[yystate
];
1432 if (yyesp
== yyes_prev
)
1439 if (yy_lac_stack_realloc (yyes_capacity
, 1,
1443 yyes
, yyesa
, &yyesp
, yyes_prev
))
1445 YYDPRINTF ((stderr
, "\n"));
1450 YYDPRINTF ((stderr
, " G%d", yystate
));
1459 # if defined __GLIBC__ && defined _STRING_H
1460 # define yystrlen strlen
1462 /* Return the length of YYSTR. */
1464 yystrlen (const char *yystr
)
1467 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1475 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1476 # define yystpcpy stpcpy
1478 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1481 yystpcpy (char *yydest
, const char *yysrc
)
1484 const char *yys
= yysrc
;
1486 while ((*yyd
++ = *yys
++) != '\0')
1495 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1496 quotes and backslashes, so that it's suitable for yyerror. The
1497 heuristic is that double-quoting is unnecessary unless the string
1498 contains an apostrophe, a comma, or backslash (other than
1499 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1500 null, do not copy; instead, return the length of what the result
1503 yytnamerr (char *yyres
, const char *yystr
)
1508 char const *yyp
= yystr
;
1515 goto do_not_strip_quotes
;
1519 goto do_not_strip_quotes
;
1532 do_not_strip_quotes
: ;
1536 return yystrlen (yystr
);
1538 return yystpcpy (yyres
, yystr
) - yyres
;
1542 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1543 about the unexpected token YYTOKEN for the state stack whose top is
1544 YYSSP. In order to see if a particular token T is a
1545 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1547 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1548 not large enough to hold the message. In that case, also set
1549 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1550 required number of bytes is too large to store or if
1551 yy_lac returned 2. */
1553 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1554 yytype_int16
*yyesa
, yytype_int16
**yyes
,
1555 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1557 YYSIZE_T yysize0
= yytnamerr (YY_NULL
, yytname
[yytoken
]);
1558 YYSIZE_T yysize
= yysize0
;
1559 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1560 /* Internationalized format string. */
1561 const char *yyformat
= YY_NULL
;
1562 /* Arguments of yyformat. */
1563 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1564 /* Number of reported tokens (one for the "unexpected", one per
1568 /* There are many possibilities here to consider:
1569 - If this state is a consistent state with a default action, then
1570 the only way this function was invoked is if the default action
1571 is an error action. In that case, don't check for expected
1572 tokens because there are none.
1573 - The only way there can be no lookahead present (in yychar) is if
1574 this state is a consistent state with a default action. Thus,
1575 detecting the absence of a lookahead is sufficient to determine
1576 that there is no unexpected or expected token to report. In that
1577 case, just report a simple "syntax error".
1578 - Don't assume there isn't a lookahead just because this state is a
1579 consistent state with a default action. There might have been a
1580 previous inconsistent state, consistent state with a non-default
1581 action, or user semantic action that manipulated yychar.
1582 In the first two cases, it might appear that the current syntax
1583 error should have been detected in the previous state when yy_lac
1584 was invoked. However, at that time, there might have been a
1585 different syntax error that discarded a different initial context
1586 during error recovery, leaving behind the current lookahead.
1588 if (yytoken
!= YYEMPTY
)
1590 int yyn
= yypact
[*yyssp
];
1591 YYDPRINTF ((stderr
, "Constructing syntax error message\n"));
1592 yyarg
[yycount
++] = yytname
[yytoken
];
1593 if (!yypact_value_is_default (yyn
))
1597 for (yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1598 if (yyx
!= YYTERROR
&& yyx
!= YYUNDEFTOK
)
1601 int yy_lac_status
= yy_lac (yyesa
, yyes
, yyes_capacity
,
1603 if (yy_lac_status
== 2)
1605 if (yy_lac_status
== 1)
1608 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1614 yyarg
[yycount
++] = yytname
[yyx
];
1616 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULL
, yytname
[yyx
]);
1617 if (! (yysize
<= yysize1
1618 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1626 YYFPRINTF (stderr
, "No expected tokens.\n");
1632 # define YYCASE_(N, S) \
1636 YYCASE_(0, YY_("syntax error"));
1637 YYCASE_(1, YY_("syntax error, unexpected %s"));
1638 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1639 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1640 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1641 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1646 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1647 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1652 if (*yymsg_alloc
< yysize
)
1654 *yymsg_alloc
= 2 * yysize
;
1655 if (! (yysize
<= *yymsg_alloc
1656 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1657 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1661 /* Avoid sprintf, as that infringes on the user's name space.
1662 Don't have undefined behavior even if the translation
1663 produced a string with the wrong number of "%s"s. */
1667 while ((*yyp
= *yyformat
) != '\0')
1668 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1670 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1681 #endif /* YYERROR_VERBOSE */
1683 /*-----------------------------------------------.
1684 | Release the memory associated to this symbol. |
1685 `-----------------------------------------------*/
1688 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1691 YYUSE (yylocationp
);
1694 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1713 /* The lookahead symbol. */
1717 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1718 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1719 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1720 _Pragma ("GCC diagnostic push") \
1721 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1722 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1723 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1724 _Pragma ("GCC diagnostic pop")
1726 /* Default value used for initialization, for pacifying older GCCs
1727 or non-GCC compilers. */
1728 static YYSTYPE yyval_default
;
1729 # define YY_INITIAL_VALUE(Value) = Value
1731 static YYLTYPE yyloc_default
1732 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1736 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1737 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1738 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1740 #ifndef YY_INITIAL_VALUE
1741 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1744 /* The semantic value of the lookahead symbol. */
1745 YYSTYPE yylval
YY_INITIAL_VALUE(yyval_default
);
1747 /* Location data for the lookahead symbol. */
1748 YYLTYPE yylloc
= yyloc_default
;
1751 /* Number of syntax errors so far. */
1755 /* Number of tokens to shift before error messages enabled. */
1758 /* The stacks and their tools:
1759 'yyss': related to states.
1760 'yyvs': related to semantic values.
1761 'yyls': related to locations.
1763 Refer to the stacks through separate pointers, to allow yyoverflow
1764 to reallocate them elsewhere. */
1766 /* The state stack. */
1767 yytype_int16 yyssa
[YYINITDEPTH
];
1769 yytype_int16
*yyssp
;
1771 /* The semantic value stack. */
1772 YYSTYPE yyvsa
[YYINITDEPTH
];
1776 /* The location stack. */
1777 YYLTYPE yylsa
[YYINITDEPTH
];
1781 /* The locations where the error started and ended. */
1782 YYLTYPE yyerror_range
[3];
1784 YYSIZE_T yystacksize
;
1786 yytype_int16 yyesa
[20];
1788 YYSIZE_T yyes_capacity
;
1790 int yy_lac_established
= 0;
1793 /* Lookahead token as an internal (translated) token number. */
1795 /* The variables used to return semantic value and location from the
1801 /* Buffer for error messages, and its allocated size. */
1803 char *yymsg
= yymsgbuf
;
1804 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1807 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1809 /* The number of symbols on the RHS of the reduced rule.
1810 Keep to zero when no symbol should be popped. */
1813 yyssp
= yyss
= yyssa
;
1814 yyvsp
= yyvs
= yyvsa
;
1815 yylsp
= yyls
= yylsa
;
1816 yystacksize
= YYINITDEPTH
;
1819 yyes_capacity
= sizeof yyesa
/ sizeof *yyes
;
1820 if (YYMAXDEPTH
< yyes_capacity
)
1821 yyes_capacity
= YYMAXDEPTH
;
1823 YYDPRINTF ((stderr
, "Starting parse\n"));
1828 yychar
= YYEMPTY
; /* Cause a token to be read. */
1830 /* User initialization code. */
1831 #line 96 "src/parse-gram.y" /* yacc.c:1451 */
1833 /* Bison's grammar can initial empty locations, hence a default
1834 location is needed. */
1835 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1836 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1838 #line 1839 "src/parse-gram.c" /* yacc.c:1451 */
1842 /*------------------------------------------------------------.
1843 | yynewstate -- Push a new state, which is found in yystate. |
1844 `------------------------------------------------------------*/
1846 /* In all cases, when you get here, the value and location stacks
1847 have just been pushed. So pushing a state here evens the stacks. */
1853 if (yyss
+ yystacksize
- 1 <= yyssp
)
1855 /* Get the current used size of the three stacks, in elements. */
1856 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1860 /* Give user a chance to reallocate the stack. Use copies of
1861 these so that the &'s don't force the real ones into
1863 YYSTYPE
*yyvs1
= yyvs
;
1864 yytype_int16
*yyss1
= yyss
;
1865 YYLTYPE
*yyls1
= yyls
;
1867 /* Each stack pointer address is followed by the size of the
1868 data in use in that stack, in bytes. This used to be a
1869 conditional around just the two extra args, but that might
1870 be undefined if yyoverflow is a macro. */
1871 yyoverflow (YY_("memory exhausted"),
1872 &yyss1
, yysize
* sizeof (*yyssp
),
1873 &yyvs1
, yysize
* sizeof (*yyvsp
),
1874 &yyls1
, yysize
* sizeof (*yylsp
),
1881 #else /* no yyoverflow */
1882 # ifndef YYSTACK_RELOCATE
1883 goto yyexhaustedlab
;
1885 /* Extend the stack our own way. */
1886 if (YYMAXDEPTH
<= yystacksize
)
1887 goto yyexhaustedlab
;
1889 if (YYMAXDEPTH
< yystacksize
)
1890 yystacksize
= YYMAXDEPTH
;
1893 yytype_int16
*yyss1
= yyss
;
1894 union yyalloc
*yyptr
=
1895 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1897 goto yyexhaustedlab
;
1898 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1899 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1900 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1901 # undef YYSTACK_RELOCATE
1903 YYSTACK_FREE (yyss1
);
1906 #endif /* no yyoverflow */
1908 yyssp
= yyss
+ yysize
- 1;
1909 yyvsp
= yyvs
+ yysize
- 1;
1910 yylsp
= yyls
+ yysize
- 1;
1912 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1913 (unsigned long int) yystacksize
));
1915 if (yyss
+ yystacksize
- 1 <= yyssp
)
1919 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1921 if (yystate
== YYFINAL
)
1931 /* Do appropriate processing given the current state. Read a
1932 lookahead token if we need one and don't already have one. */
1934 /* First try to decide what to do without reference to lookahead token. */
1935 yyn
= yypact
[yystate
];
1936 if (yypact_value_is_default (yyn
))
1939 /* Not known => get a lookahead token if don't already have one. */
1941 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1942 if (yychar
== YYEMPTY
)
1944 YYDPRINTF ((stderr
, "Reading a token: "));
1945 yychar
= yylex (&yylval
, &yylloc
);
1948 if (yychar
<= YYEOF
)
1950 yychar
= yytoken
= YYEOF
;
1951 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1955 yytoken
= YYTRANSLATE (yychar
);
1956 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1959 /* If the proper action on seeing token YYTOKEN is to reduce or to
1960 detect an error, take that action. */
1962 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1970 if (yytable_value_is_error (yyn
))
1977 /* Count tokens shifted since error; after three, turn off error
1982 /* Shift the lookahead token. */
1983 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1985 /* Discard the shifted token. */
1987 YY_LAC_DISCARD ("shift");
1990 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1992 YY_IGNORE_MAYBE_UNINITIALIZED_END
1997 /*-----------------------------------------------------------.
1998 | yydefault -- do the default action for the current state. |
1999 `-----------------------------------------------------------*/
2001 yyn
= yydefact
[yystate
];
2007 /*-----------------------------.
2008 | yyreduce -- Do a reduction. |
2009 `-----------------------------*/
2011 /* yyn is the number of a rule to reduce with. */
2014 /* If YYLEN is nonzero, implement the default value of the action:
2017 Otherwise, the following line sets YYVAL to garbage.
2018 This behavior is undocumented and Bison
2019 users should not rely upon it. Assigning to YYVAL
2020 unconditionally makes the parser a bit smaller, and it avoids a
2021 GCC warning that YYVAL may be used uninitialized. */
2022 yyval
= yyvsp
[1-yylen
];
2024 /* Default location. */
2025 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2026 YY_REDUCE_PRINT (yyn
);
2028 int yychar_backup
= yychar
;
2032 #line 277 "src/parse-gram.y" /* yacc.c:1668 */
2034 code_props plain_code
;
2035 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2036 code_props_translate_code (&plain_code
);
2037 gram_scanner_last_string_free ();
2038 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
2039 plain_code
.code
, (yylsp
[0]));
2040 code_scanner_last_string_free ();
2042 #line 2043 "src/parse-gram.c" /* yacc.c:1668 */
2046 #line 287 "src/parse-gram.y" /* yacc.c:1668 */
2048 muscle_percent_define_ensure ((yyvsp
[0].uniqstr
), (yylsp
[0]), true);
2050 #line 2051 "src/parse-gram.c" /* yacc.c:1668 */
2054 #line 291 "src/parse-gram.y" /* yacc.c:1668 */
2056 muscle_percent_define_insert ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].value
).kind
, (yyvsp
[0].value
).chars
,
2057 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2059 #line 2060 "src/parse-gram.c" /* yacc.c:1668 */
2063 #line 295 "src/parse-gram.y" /* yacc.c:1668 */
2064 { defines_flag
= true; }
2065 #line 2066 "src/parse-gram.c" /* yacc.c:1668 */
2069 #line 297 "src/parse-gram.y" /* yacc.c:1668 */
2071 defines_flag
= true;
2072 spec_defines_file
= xstrdup ((yyvsp
[0].chars
));
2074 #line 2075 "src/parse-gram.c" /* yacc.c:1668 */
2078 #line 302 "src/parse-gram.y" /* yacc.c:1668 */
2080 muscle_percent_define_insert ("parse.error", (yylsp
[0]), muscle_keyword
,
2082 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2084 #line 2085 "src/parse-gram.c" /* yacc.c:1668 */
2088 #line 307 "src/parse-gram.y" /* yacc.c:1668 */
2089 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
2090 #line 2091 "src/parse-gram.c" /* yacc.c:1668 */
2094 #line 308 "src/parse-gram.y" /* yacc.c:1668 */
2095 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
2096 #line 2097 "src/parse-gram.c" /* yacc.c:1668 */
2100 #line 309 "src/parse-gram.y" /* yacc.c:1668 */
2101 { spec_file_prefix
= (yyvsp
[0].chars
); }
2102 #line 2103 "src/parse-gram.c" /* yacc.c:1668 */
2106 #line 311 "src/parse-gram.y" /* yacc.c:1668 */
2108 nondeterministic_parser
= true;
2111 #line 2112 "src/parse-gram.c" /* yacc.c:1668 */
2115 #line 316 "src/parse-gram.y" /* yacc.c:1668 */
2118 code_props_symbol_action_init (&action
, (yyvsp
[0].code
), (yylsp
[0]));
2119 code_props_translate_code (&action
);
2120 gram_scanner_last_string_free ();
2121 muscle_code_grow ("initial_action", action
.code
, (yylsp
[0]));
2122 code_scanner_last_string_free ();
2124 #line 2125 "src/parse-gram.c" /* yacc.c:1668 */
2128 #line 324 "src/parse-gram.y" /* yacc.c:1668 */
2129 { language_argmatch ((yyvsp
[0].chars
), grammar_prio
, (yylsp
[-1])); }
2130 #line 2131 "src/parse-gram.c" /* yacc.c:1668 */
2134 #line 325 "src/parse-gram.y" /* yacc.c:1668 */
2135 { spec_name_prefix
= (yyvsp
[0].chars
); }
2136 #line 2137 "src/parse-gram.c" /* yacc.c:1668 */
2140 #line 326 "src/parse-gram.y" /* yacc.c:1668 */
2141 { no_lines_flag
= true; }
2142 #line 2143 "src/parse-gram.c" /* yacc.c:1668 */
2146 #line 327 "src/parse-gram.y" /* yacc.c:1668 */
2147 { nondeterministic_parser
= true; }
2148 #line 2149 "src/parse-gram.c" /* yacc.c:1668 */
2152 #line 328 "src/parse-gram.y" /* yacc.c:1668 */
2153 { spec_outfile
= (yyvsp
[0].chars
); }
2154 #line 2155 "src/parse-gram.c" /* yacc.c:1668 */
2158 #line 329 "src/parse-gram.y" /* yacc.c:1668 */
2159 { current_param
= (yyvsp
[0].param
); }
2160 #line 2161 "src/parse-gram.c" /* yacc.c:1668 */
2164 #line 329 "src/parse-gram.y" /* yacc.c:1668 */
2165 { current_param
= param_none
; }
2166 #line 2167 "src/parse-gram.c" /* yacc.c:1668 */
2170 #line 330 "src/parse-gram.y" /* yacc.c:1668 */
2171 { version_check (&(yylsp
[0]), (yyvsp
[0].chars
)); }
2172 #line 2173 "src/parse-gram.c" /* yacc.c:1668 */
2176 #line 332 "src/parse-gram.y" /* yacc.c:1668 */
2178 char const *skeleton_user
= (yyvsp
[0].chars
);
2179 if (strchr (skeleton_user
, '/'))
2181 size_t dir_length
= strlen (current_file
);
2182 char *skeleton_build
;
2183 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2185 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2188 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2191 memcpy (skeleton_build
, current_file
, dir_length
);
2192 skeleton_build
[dir_length
++] = '/';
2194 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2195 skeleton_user
= uniqstr_new (skeleton_build
);
2196 free (skeleton_build
);
2198 skeleton_arg (skeleton_user
, grammar_prio
, (yylsp
[-1]));
2200 #line 2201 "src/parse-gram.c" /* yacc.c:1668 */
2204 #line 355 "src/parse-gram.y" /* yacc.c:1668 */
2205 { token_table_flag
= true; }
2206 #line 2207 "src/parse-gram.c" /* yacc.c:1668 */
2210 #line 356 "src/parse-gram.y" /* yacc.c:1668 */
2211 { report_flag
|= report_states
; }
2212 #line 2213 "src/parse-gram.c" /* yacc.c:1668 */
2216 #line 357 "src/parse-gram.y" /* yacc.c:1668 */
2217 { yacc_flag
= true; }
2218 #line 2219 "src/parse-gram.c" /* yacc.c:1668 */
2222 #line 362 "src/parse-gram.y" /* yacc.c:1668 */
2223 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2224 #line 2225 "src/parse-gram.c" /* yacc.c:1668 */
2228 #line 363 "src/parse-gram.y" /* yacc.c:1668 */
2229 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2230 #line 2231 "src/parse-gram.c" /* yacc.c:1668 */
2234 #line 375 "src/parse-gram.y" /* yacc.c:1668 */
2236 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
2238 #line 2239 "src/parse-gram.c" /* yacc.c:1668 */
2242 #line 379 "src/parse-gram.y" /* yacc.c:1668 */
2245 code_props_symbol_action_init (&code
, (yyvsp
[-1].code
), (yylsp
[-1]));
2246 code_props_translate_code (&code
);
2249 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2250 symbol_list_code_props_set (list
, (yyvsp
[-2].code_type
), &code
);
2251 symbol_list_free ((yyvsp
[0].list
));
2254 #line 2255 "src/parse-gram.c" /* yacc.c:1668 */
2258 #line 391 "src/parse-gram.y" /* yacc.c:1668 */
2260 default_prec
= true;
2262 #line 2263 "src/parse-gram.c" /* yacc.c:1668 */
2266 #line 395 "src/parse-gram.y" /* yacc.c:1668 */
2268 default_prec
= false;
2270 #line 2271 "src/parse-gram.c" /* yacc.c:1668 */
2274 #line 399 "src/parse-gram.y" /* yacc.c:1668 */
2276 /* Do not invoke muscle_percent_code_grow here since it invokes
2277 muscle_user_name_list_grow. */
2278 muscle_code_grow ("percent_code()", (yyvsp
[0].chars
), (yylsp
[0]));
2279 code_scanner_last_string_free ();
2281 #line 2282 "src/parse-gram.c" /* yacc.c:1668 */
2285 #line 406 "src/parse-gram.y" /* yacc.c:1668 */
2287 muscle_percent_code_grow ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
), (yylsp
[0]));
2288 code_scanner_last_string_free ();
2290 #line 2291 "src/parse-gram.c" /* yacc.c:1668 */
2294 #line 416 "src/parse-gram.y" /* yacc.c:1668 */
2295 { (yyval
.code_type
) = destructor
; }
2296 #line 2297 "src/parse-gram.c" /* yacc.c:1668 */
2300 #line 417 "src/parse-gram.y" /* yacc.c:1668 */
2301 { (yyval
.code_type
) = printer
; }
2302 #line 2303 "src/parse-gram.c" /* yacc.c:1668 */
2306 #line 427 "src/parse-gram.y" /* yacc.c:1668 */
2308 #line 2309 "src/parse-gram.c" /* yacc.c:1668 */
2312 #line 428 "src/parse-gram.y" /* yacc.c:1668 */
2313 { muscle_code_grow ("union_name", (yyvsp
[0].uniqstr
), (yylsp
[0])); }
2314 #line 2315 "src/parse-gram.c" /* yacc.c:1668 */
2318 #line 433 "src/parse-gram.y" /* yacc.c:1668 */
2321 muscle_code_grow ("union_members", (yyvsp
[0].chars
), (yylsp
[0]));
2322 code_scanner_last_string_free ();
2324 #line 2325 "src/parse-gram.c" /* yacc.c:1668 */
2328 #line 444 "src/parse-gram.y" /* yacc.c:1668 */
2329 { current_class
= nterm_sym
; }
2330 #line 2331 "src/parse-gram.c" /* yacc.c:1668 */
2334 #line 445 "src/parse-gram.y" /* yacc.c:1668 */
2336 current_class
= unknown_sym
;
2337 current_type
= NULL
;
2339 #line 2340 "src/parse-gram.c" /* yacc.c:1668 */
2343 #line 449 "src/parse-gram.y" /* yacc.c:1668 */
2344 { current_class
= token_sym
; }
2345 #line 2346 "src/parse-gram.c" /* yacc.c:1668 */
2349 #line 450 "src/parse-gram.y" /* yacc.c:1668 */
2351 current_class
= unknown_sym
;
2352 current_type
= NULL
;
2354 #line 2355 "src/parse-gram.c" /* yacc.c:1668 */
2358 #line 455 "src/parse-gram.y" /* yacc.c:1668 */
2362 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2363 symbol_type_set (list
->content
.sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
2364 symbol_list_free ((yyvsp
[0].list
));
2366 #line 2367 "src/parse-gram.c" /* yacc.c:1668 */
2370 #line 466 "src/parse-gram.y" /* yacc.c:1668 */
2374 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2376 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[-1]));
2377 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
2379 symbol_list_free ((yyvsp
[0].list
));
2380 current_type
= NULL
;
2382 #line 2383 "src/parse-gram.c" /* yacc.c:1668 */
2386 #line 480 "src/parse-gram.y" /* yacc.c:1668 */
2387 { (yyval
.assoc
) = left_assoc
; }
2388 #line 2389 "src/parse-gram.c" /* yacc.c:1668 */
2392 #line 481 "src/parse-gram.y" /* yacc.c:1668 */
2393 { (yyval
.assoc
) = right_assoc
; }
2394 #line 2395 "src/parse-gram.c" /* yacc.c:1668 */
2398 #line 482 "src/parse-gram.y" /* yacc.c:1668 */
2399 { (yyval
.assoc
) = non_assoc
; }
2400 #line 2401 "src/parse-gram.c" /* yacc.c:1668 */
2404 #line 483 "src/parse-gram.y" /* yacc.c:1668 */
2405 { (yyval
.assoc
) = precedence_assoc
; }
2406 #line 2407 "src/parse-gram.c" /* yacc.c:1668 */
2410 #line 487 "src/parse-gram.y" /* yacc.c:1668 */
2411 { current_type
= NULL
; }
2412 #line 2413 "src/parse-gram.c" /* yacc.c:1668 */
2416 #line 488 "src/parse-gram.y" /* yacc.c:1668 */
2417 { current_type
= (yyvsp
[0].uniqstr
); tag_seen
= true; }
2418 #line 2419 "src/parse-gram.c" /* yacc.c:1668 */
2422 #line 494 "src/parse-gram.y" /* yacc.c:1668 */
2423 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2424 #line 2425 "src/parse-gram.c" /* yacc.c:1668 */
2428 #line 496 "src/parse-gram.y" /* yacc.c:1668 */
2429 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2430 #line 2431 "src/parse-gram.c" /* yacc.c:1668 */
2434 #line 501 "src/parse-gram.y" /* yacc.c:1668 */
2436 (yyval
.symbol
) = (yyvsp
[0].symbol
);
2437 symbol_class_set ((yyvsp
[0].symbol
), token_sym
, (yylsp
[0]), false);
2439 #line 2440 "src/parse-gram.c" /* yacc.c:1668 */
2443 #line 506 "src/parse-gram.y" /* yacc.c:1668 */
2445 (yyval
.symbol
) = (yyvsp
[-1].symbol
);
2446 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2447 symbol_class_set ((yyvsp
[-1].symbol
), token_sym
, (yylsp
[-1]), false);
2449 #line 2450 "src/parse-gram.c" /* yacc.c:1668 */
2453 #line 516 "src/parse-gram.y" /* yacc.c:1668 */
2454 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2455 #line 2456 "src/parse-gram.c" /* yacc.c:1668 */
2459 #line 518 "src/parse-gram.y" /* yacc.c:1668 */
2460 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2461 #line 2462 "src/parse-gram.c" /* yacc.c:1668 */
2465 #line 522 "src/parse-gram.y" /* yacc.c:1668 */
2466 { (yyval
.list
) = (yyvsp
[0].list
); }
2467 #line 2468 "src/parse-gram.c" /* yacc.c:1668 */
2471 #line 523 "src/parse-gram.y" /* yacc.c:1668 */
2472 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), (yyvsp
[0].list
)); }
2473 #line 2474 "src/parse-gram.c" /* yacc.c:1668 */
2477 #line 527 "src/parse-gram.y" /* yacc.c:1668 */
2478 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2479 #line 2480 "src/parse-gram.c" /* yacc.c:1668 */
2483 #line 528 "src/parse-gram.y" /* yacc.c:1668 */
2484 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2485 #line 2486 "src/parse-gram.c" /* yacc.c:1668 */
2489 #line 533 "src/parse-gram.y" /* yacc.c:1668 */
2490 { (yyval
.uniqstr
) = uniqstr_new ("*"); }
2491 #line 2492 "src/parse-gram.c" /* yacc.c:1668 */
2495 #line 534 "src/parse-gram.y" /* yacc.c:1668 */
2496 { (yyval
.uniqstr
) = uniqstr_new (""); }
2497 #line 2498 "src/parse-gram.c" /* yacc.c:1668 */
2501 #line 540 "src/parse-gram.y" /* yacc.c:1668 */
2503 current_type
= (yyvsp
[0].uniqstr
);
2506 #line 2507 "src/parse-gram.c" /* yacc.c:1668 */
2510 #line 545 "src/parse-gram.y" /* yacc.c:1668 */
2512 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]), true);
2513 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
2515 #line 2516 "src/parse-gram.c" /* yacc.c:1668 */
2519 #line 550 "src/parse-gram.y" /* yacc.c:1668 */
2521 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2522 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2523 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2525 #line 2526 "src/parse-gram.c" /* yacc.c:1668 */
2529 #line 556 "src/parse-gram.y" /* yacc.c:1668 */
2531 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2532 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2533 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2535 #line 2536 "src/parse-gram.c" /* yacc.c:1668 */
2539 #line 562 "src/parse-gram.y" /* yacc.c:1668 */
2541 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]), true);
2542 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
2543 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
2544 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2546 #line 2547 "src/parse-gram.c" /* yacc.c:1668 */
2550 #line 592 "src/parse-gram.y" /* yacc.c:1668 */
2554 #line 2555 "src/parse-gram.c" /* yacc.c:1668 */
2558 #line 598 "src/parse-gram.y" /* yacc.c:1668 */
2559 { current_lhs ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2560 #line 2561 "src/parse-gram.c" /* yacc.c:1668 */
2564 #line 599 "src/parse-gram.y" /* yacc.c:1668 */
2566 /* Free the current lhs. */
2567 current_lhs (0, (yylsp
[-3]), 0);
2569 #line 2570 "src/parse-gram.c" /* yacc.c:1668 */
2573 #line 606 "src/parse-gram.y" /* yacc.c:1668 */
2574 { grammar_current_rule_end ((yylsp
[0])); }
2575 #line 2576 "src/parse-gram.c" /* yacc.c:1668 */
2579 #line 607 "src/parse-gram.y" /* yacc.c:1668 */
2580 { grammar_current_rule_end ((yylsp
[0])); }
2581 #line 2582 "src/parse-gram.c" /* yacc.c:1668 */
2585 #line 614 "src/parse-gram.y" /* yacc.c:1668 */
2586 { grammar_current_rule_begin (current_lhs_symbol
, current_lhs_location
,
2587 current_lhs_named_ref
); }
2588 #line 2589 "src/parse-gram.c" /* yacc.c:1668 */
2592 #line 617 "src/parse-gram.y" /* yacc.c:1668 */
2593 { grammar_current_rule_symbol_append ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2594 #line 2595 "src/parse-gram.c" /* yacc.c:1668 */
2598 #line 619 "src/parse-gram.y" /* yacc.c:1668 */
2599 { grammar_current_rule_action_append ((yyvsp
[-1].code
), (yylsp
[-1]), (yyvsp
[0].named_ref
), false); }
2600 #line 2601 "src/parse-gram.c" /* yacc.c:1668 */
2604 #line 621 "src/parse-gram.y" /* yacc.c:1668 */
2605 { grammar_current_rule_action_append ((yyvsp
[0].code
), (yylsp
[0]), NULL
, true); }
2606 #line 2607 "src/parse-gram.c" /* yacc.c:1668 */
2610 #line 623 "src/parse-gram.y" /* yacc.c:1668 */
2611 { grammar_current_rule_empty_set ((yylsp
[0])); }
2612 #line 2613 "src/parse-gram.c" /* yacc.c:1668 */
2616 #line 625 "src/parse-gram.y" /* yacc.c:1668 */
2617 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2618 #line 2619 "src/parse-gram.c" /* yacc.c:1668 */
2622 #line 627 "src/parse-gram.y" /* yacc.c:1668 */
2623 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2624 #line 2625 "src/parse-gram.c" /* yacc.c:1668 */
2628 #line 629 "src/parse-gram.y" /* yacc.c:1668 */
2629 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2630 #line 2631 "src/parse-gram.c" /* yacc.c:1668 */
2634 #line 633 "src/parse-gram.y" /* yacc.c:1668 */
2635 { (yyval
.named_ref
) = 0; }
2636 #line 2637 "src/parse-gram.c" /* yacc.c:1668 */
2640 #line 634 "src/parse-gram.y" /* yacc.c:1668 */
2641 { (yyval
.named_ref
) = named_ref_new((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2642 #line 2643 "src/parse-gram.c" /* yacc.c:1668 */
2646 #line 645 "src/parse-gram.y" /* yacc.c:1668 */
2647 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[0].chars
)); }
2648 #line 2649 "src/parse-gram.c" /* yacc.c:1668 */
2652 #line 670 "src/parse-gram.y" /* yacc.c:1668 */
2653 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= ""; }
2654 #line 2655 "src/parse-gram.c" /* yacc.c:1668 */
2658 #line 671 "src/parse-gram.y" /* yacc.c:1668 */
2659 { (yyval
.value
).kind
= muscle_keyword
; (yyval
.value
).chars
= (yyvsp
[0].uniqstr
); }
2660 #line 2661 "src/parse-gram.c" /* yacc.c:1668 */
2664 #line 672 "src/parse-gram.y" /* yacc.c:1668 */
2665 { (yyval
.value
).kind
= muscle_string
; (yyval
.value
).chars
= (yyvsp
[0].chars
); }
2666 #line 2667 "src/parse-gram.c" /* yacc.c:1668 */
2670 #line 673 "src/parse-gram.y" /* yacc.c:1668 */
2671 { (yyval
.value
).kind
= muscle_code
; (yyval
.value
).chars
= (yyvsp
[0].chars
); }
2672 #line 2673 "src/parse-gram.c" /* yacc.c:1668 */
2676 #line 683 "src/parse-gram.y" /* yacc.c:1668 */
2678 code_props plain_code
;
2679 (yyvsp
[0].code
)[strlen ((yyvsp
[0].code
)) - 1] = '\0';
2680 code_props_plain_init (&plain_code
, (yyvsp
[0].code
)+1, (yylsp
[0]));
2681 code_props_translate_code (&plain_code
);
2682 gram_scanner_last_string_free ();
2683 (yyval
.chars
) = plain_code
.code
;
2685 #line 2686 "src/parse-gram.c" /* yacc.c:1668 */
2689 #line 703 "src/parse-gram.y" /* yacc.c:1668 */
2690 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2691 #line 2692 "src/parse-gram.c" /* yacc.c:1668 */
2695 #line 705 "src/parse-gram.y" /* yacc.c:1668 */
2697 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[0].character
)), (yylsp
[0]));
2698 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2699 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[0].character
), (yylsp
[0]));
2701 #line 2702 "src/parse-gram.c" /* yacc.c:1668 */
2705 #line 713 "src/parse-gram.y" /* yacc.c:1668 */
2706 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2707 #line 2708 "src/parse-gram.c" /* yacc.c:1668 */
2711 #line 725 "src/parse-gram.y" /* yacc.c:1668 */
2713 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].chars
)), (yylsp
[0]));
2714 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2716 #line 2717 "src/parse-gram.c" /* yacc.c:1668 */
2720 #line 734 "src/parse-gram.y" /* yacc.c:1668 */
2722 code_props plain_code
;
2723 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2724 code_props_translate_code (&plain_code
);
2725 gram_scanner_last_string_free ();
2726 muscle_code_grow ("epilogue", plain_code
.code
, (yylsp
[0]));
2727 code_scanner_last_string_free ();
2729 #line 2730 "src/parse-gram.c" /* yacc.c:1668 */
2733 #line 2734 "src/parse-gram.c" /* yacc.c:1668 */
2736 if (yychar_backup
!= yychar
)
2737 YY_LAC_DISCARD ("yychar change");
2739 /* User semantic actions sometimes alter yychar, and that requires
2740 that yytoken be updated with the new translation. We take the
2741 approach of translating immediately before every use of yytoken.
2742 One alternative is translating here after every semantic action,
2743 but that translation would be missed if the semantic action invokes
2744 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2745 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2746 incorrect destructor might then be invoked immediately. In the
2747 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2748 to an incorrect destructor call or verbose syntax error message
2749 before the lookahead is translated. */
2750 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2754 YY_STACK_PRINT (yyss
, yyssp
);
2759 /* Now 'shift' the result of the reduction. Determine what state
2760 that goes to, based on the state we popped back to and the rule
2761 number reduced by. */
2765 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2766 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2767 yystate
= yytable
[yystate
];
2769 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2774 /*--------------------------------------.
2775 | yyerrlab -- here on detecting error. |
2776 `--------------------------------------*/
2778 /* Make sure we have latest lookahead translation. See comments at
2779 user semantic actions for why this is necessary. */
2780 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2782 /* If not already recovering from an error, report this error. */
2786 #if ! YYERROR_VERBOSE
2787 yyerror (&yylloc
, YY_("syntax error"));
2789 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2790 yyesa, &yyes, &yyes_capacity, \
2793 char const *yymsgp
= YY_("syntax error");
2794 int yysyntax_error_status
;
2795 if (yychar
!= YYEMPTY
)
2797 yysyntax_error_status
= YYSYNTAX_ERROR
;
2798 if (yysyntax_error_status
== 0)
2800 else if (yysyntax_error_status
== 1)
2802 if (yymsg
!= yymsgbuf
)
2803 YYSTACK_FREE (yymsg
);
2804 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2808 yymsg_alloc
= sizeof yymsgbuf
;
2809 yysyntax_error_status
= 2;
2813 yysyntax_error_status
= YYSYNTAX_ERROR
;
2817 yyerror (&yylloc
, yymsgp
);
2818 if (yysyntax_error_status
== 2)
2819 goto yyexhaustedlab
;
2821 # undef YYSYNTAX_ERROR
2825 yyerror_range
[1] = yylloc
;
2827 if (yyerrstatus
== 3)
2829 /* If just tried and failed to reuse lookahead token after an
2830 error, discard it. */
2832 if (yychar
<= YYEOF
)
2834 /* Return failure if at end of input. */
2835 if (yychar
== YYEOF
)
2840 yydestruct ("Error: discarding",
2841 yytoken
, &yylval
, &yylloc
);
2846 /* Else will try to reuse lookahead token after shifting the error
2851 /*---------------------------------------------------.
2852 | yyerrorlab -- error raised explicitly by YYERROR. |
2853 `---------------------------------------------------*/
2856 /* Pacify compilers like GCC when the user code never invokes
2857 YYERROR and the label yyerrorlab therefore never appears in user
2859 if (/*CONSTCOND*/ 0)
2862 yyerror_range
[1] = yylsp
[1-yylen
];
2863 /* Do not reclaim the symbols of the rule whose action triggered
2867 YY_STACK_PRINT (yyss
, yyssp
);
2872 /*-------------------------------------------------------------.
2873 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2874 `-------------------------------------------------------------*/
2876 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2880 yyn
= yypact
[yystate
];
2881 if (!yypact_value_is_default (yyn
))
2884 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2892 /* Pop the current state because it cannot handle the error token. */
2896 yyerror_range
[1] = *yylsp
;
2897 yydestruct ("Error: popping",
2898 yystos
[yystate
], yyvsp
, yylsp
);
2901 YY_STACK_PRINT (yyss
, yyssp
);
2904 /* If the stack popping above didn't lose the initial context for the
2905 current lookahead token, the shift below will for sure. */
2906 YY_LAC_DISCARD ("error recovery");
2908 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2910 YY_IGNORE_MAYBE_UNINITIALIZED_END
2912 yyerror_range
[2] = yylloc
;
2913 /* Using YYLLOC is tempting, but would change the location of
2914 the lookahead. YYLOC is available though. */
2915 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
2918 /* Shift the error token. */
2919 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2925 /*-------------------------------------.
2926 | yyacceptlab -- YYACCEPT comes here. |
2927 `-------------------------------------*/
2932 /*-----------------------------------.
2933 | yyabortlab -- YYABORT comes here. |
2934 `-----------------------------------*/
2940 /*-------------------------------------------------.
2941 | yyexhaustedlab -- memory exhaustion comes here. |
2942 `-------------------------------------------------*/
2944 yyerror (&yylloc
, YY_("memory exhausted"));
2950 if (yychar
!= YYEMPTY
)
2952 /* Make sure we have latest lookahead translation. See comments at
2953 user semantic actions for why this is necessary. */
2954 yytoken
= YYTRANSLATE (yychar
);
2955 yydestruct ("Cleanup: discarding lookahead",
2956 yytoken
, &yylval
, &yylloc
);
2958 /* Do not reclaim the symbols of the rule whose action triggered
2959 this YYABORT or YYACCEPT. */
2961 YY_STACK_PRINT (yyss
, yyssp
);
2962 while (yyssp
!= yyss
)
2964 yydestruct ("Cleanup: popping",
2965 yystos
[*yyssp
], yyvsp
, yylsp
);
2970 YYSTACK_FREE (yyss
);
2973 YYSTACK_FREE (yyes
);
2975 if (yymsg
!= yymsgbuf
)
2976 YYSTACK_FREE (yymsg
);
2980 #line 744 "src/parse-gram.y" /* yacc.c:1928 */
2983 /* Return the location of the left-hand side of a rule whose
2984 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2985 the right-hand side, and return an empty location equal to the end
2986 boundary of RHS[0] if the right-hand side is empty. */
2989 lloc_default (YYLTYPE
const *rhs
, int n
)
2994 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2995 The bug is fixed in 7.4.2m, but play it safe for now. */
2996 loc
.start
= rhs
[n
].end
;
2997 loc
.end
= rhs
[n
].end
;
2999 /* Ignore empty nonterminals the start of the right-hand side.
3000 Do not bother to ignore them at the end of the right-hand side,
3001 since empty nonterminals have the same end as their predecessors. */
3002 for (i
= 1; i
<= n
; i
++)
3003 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
3005 loc
.start
= rhs
[i
].start
;
3014 add_param (param_type type
, char *decl
, location loc
)
3016 static char const alphanum
[26 + 26 + 1 + 10] =
3017 "abcdefghijklmnopqrstuvwxyz"
3018 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3022 char const *name_start
= NULL
;
3025 /* Stop on last actual character. */
3026 for (p
= decl
; p
[1]; p
++)
3028 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
3029 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
3032 /* Strip the surrounding '{' and '}', and any blanks just inside
3035 while (c_isspace ((unsigned char) *p
))
3039 while (c_isspace ((unsigned char) *decl
))
3044 complain (&loc
, complaint
, _("missing identifier in parameter declaration"));
3047 char *name
= xmemdup0 (name_start
, strspn (name_start
, alphanum
));
3048 if (type
& param_lex
)
3049 muscle_pair_list_grow ("lex_param", decl
, name
);
3050 if (type
& param_parse
)
3051 muscle_pair_list_grow ("parse_param", decl
, name
);
3055 gram_scanner_last_string_free ();
3060 version_check (location
const *loc
, char const *version
)
3062 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
3064 complain (loc
, complaint
, "require bison %s, but have %s",
3065 version
, PACKAGE_VERSION
);
3071 gram_error (location
const *loc
, char const *msg
)
3073 complain (loc
, complaint
, "%s", msg
);
3077 token_name (int type
)
3079 return yytname
[YYTRANSLATE (type
)];
3090 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
3091 return quotearg_style (escape_quoting_style
, buf
);