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 "muscle-tab.h"
103 #include "named-ref.h"
104 #include "quotearg.h"
108 #include "scan-gram.h"
109 #include "scan-code.h"
110 #include "xmemdup0.h"
112 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
113 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
115 #define YY_LOCATION_PRINT(File, Loc) \
116 location_print (Loc, File)
118 static void version_check (location
const *loc
, char const *version
);
120 static void gram_error (location
const *, char const *);
122 /* A string that describes a char (e.g., 'a' -> "'a'"). */
123 static char const *char_name (char);
125 #line 126 "src/parse-gram.c" /* yacc.c:356 */
128 # if defined __cplusplus && 201103L <= __cplusplus
129 # define YY_NULL nullptr
135 /* Enabling verbose error messages. */
136 #ifdef YYERROR_VERBOSE
137 # undef YYERROR_VERBOSE
138 # define YYERROR_VERBOSE 1
140 # define YYERROR_VERBOSE 1
143 /* In a future release of Bison, this section will be replaced
144 by #include "src/parse-gram.h". */
145 #ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
146 # define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
151 # define GRAM_DEBUG 1
153 # define GRAM_DEBUG 0
155 # else /* ! defined YYDEBUG */
156 # define GRAM_DEBUG 1
157 # endif /* ! defined YYDEBUG */
158 #endif /* ! defined GRAM_DEBUG */
160 extern int gram_debug
;
162 /* "%code requires" blocks. */
163 #line 219 "src/parse-gram.y" /* yacc.c:372 */
169 param_parse
= 1 << 1,
170 param_both
= param_lex
| param_parse
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 171 "src/parse-gram.y" /* yacc.c:372 */
246 unsigned char character
;
247 #line 178 "src/parse-gram.y" /* yacc.c:372 */
252 #line 189 "src/parse-gram.y" /* yacc.c:372 */
254 #line 197 "src/parse-gram.y" /* yacc.c:372 */
256 #line 201 "src/parse-gram.y" /* yacc.c:372 */
258 #line 206 "src/parse-gram.y" /* yacc.c:372 */
260 #line 209 "src/parse-gram.y" /* yacc.c:372 */
262 #line 212 "src/parse-gram.y" /* yacc.c:372 */
263 named_ref
*named_ref
;
264 #line 239 "src/parse-gram.y" /* yacc.c:372 */
266 #line 413 "src/parse-gram.y" /* yacc.c:372 */
267 code_props_type code_type
;
269 #line 270 "src/parse-gram.c" /* yacc.c:372 */
271 # define GRAM_STYPE_IS_TRIVIAL 1
272 # define GRAM_STYPE_IS_DECLARED 1
276 #if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
277 typedef struct GRAM_LTYPE GRAM_LTYPE
;
285 # define GRAM_LTYPE_IS_DECLARED 1
286 # define GRAM_LTYPE_IS_TRIVIAL 1
291 int gram_parse (void);
293 #endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
295 /* Copy the second part of user declarations. */
297 #line 298 "src/parse-gram.c" /* yacc.c:375 */
298 /* Unqualified %code blocks. */
299 #line 54 "src/parse-gram.y" /* yacc.c:376 */
301 static int current_prec
= 0;
302 static location current_lhs_location
;
303 static named_ref
*current_lhs_named_ref
;
304 static symbol
*current_lhs_symbol
;
305 static symbol_class current_class
= unknown_sym
;
306 static uniqstr current_type
= NULL
;
308 /** Set the new current left-hand side symbol, possibly common
309 * to several right-hand side parts of rule.
313 current_lhs (symbol
*sym
, location loc
, named_ref
*ref
)
315 current_lhs_symbol
= sym
;
316 current_lhs_location
= loc
;
317 /* In order to simplify memory management, named references for lhs
318 are always assigned by deep copy into the current symbol_list
319 node. This is because a single named-ref in the grammar may
320 result in several uses when the user factors lhs between several
321 rules using "|". Therefore free the parser's original copy. */
322 free (current_lhs_named_ref
);
323 current_lhs_named_ref
= ref
;
326 #define YYTYPE_INT16 int_fast16_t
327 #define YYTYPE_INT8 int_fast8_t
328 #define YYTYPE_UINT16 uint_fast16_t
329 #define YYTYPE_UINT8 uint_fast8_t
331 #line 229 "src/parse-gram.y" /* yacc.c:376 */
333 /** Add a lex-param and/or a parse-param.
335 * \param type where to push this formal argument.
336 * \param decl the formal argument. Destroyed.
337 * \param loc the location in the source.
339 static void add_param (param_type type
, char *decl
, location loc
);
340 static param_type current_param
= param_none
;
343 #line 344 "src/parse-gram.c" /* yacc.c:376 */
350 typedef YYTYPE_UINT8 yytype_uint8
;
352 typedef unsigned char yytype_uint8
;
356 typedef YYTYPE_INT8 yytype_int8
;
358 typedef signed char yytype_int8
;
362 typedef YYTYPE_UINT16 yytype_uint16
;
364 typedef unsigned short int yytype_uint16
;
368 typedef YYTYPE_INT16 yytype_int16
;
370 typedef short int yytype_int16
;
374 # ifdef __SIZE_TYPE__
375 # define YYSIZE_T __SIZE_TYPE__
376 # elif defined size_t
377 # define YYSIZE_T size_t
378 # elif ! defined YYSIZE_T
379 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
380 # define YYSIZE_T size_t
382 # define YYSIZE_T unsigned int
386 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
389 # if defined YYENABLE_NLS && YYENABLE_NLS
391 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
392 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
396 # define YY_(Msgid) Msgid
400 /* Suppress unused-variable warnings by "using" E. */
402 # define YYUSE(E) ((void) (E))
404 # define YYUSE(E) /* empty */
409 /* The parser invokes alloca or malloc; define the necessary symbols. */
411 # ifdef YYSTACK_ALLOC
412 /* Pacify GCC's 'empty if-body' warning. */
413 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
414 # ifndef YYSTACK_ALLOC_MAXIMUM
415 /* The OS might guarantee only one guard page at the bottom of the stack,
416 and a page size can be as small as 4096 bytes. So we cannot safely
417 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
418 to allow for a few compiler-allocated temporary stack slots. */
419 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
422 # define YYSTACK_ALLOC YYMALLOC
423 # define YYSTACK_FREE YYFREE
424 # ifndef YYSTACK_ALLOC_MAXIMUM
425 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
427 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
428 && ! ((defined YYMALLOC || defined malloc) \
429 && (defined YYFREE || defined free)))
430 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
431 # ifndef EXIT_SUCCESS
432 # define EXIT_SUCCESS 0
436 # define YYMALLOC malloc
437 # if ! defined malloc && ! defined EXIT_SUCCESS
438 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
443 # if ! defined free && ! defined EXIT_SUCCESS
444 void free (void *); /* INFRINGES ON USER NAME SPACE */
448 # define YYCOPY_NEEDED 1
452 #if (! defined yyoverflow \
453 && (! defined __cplusplus \
454 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
455 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
457 /* A type that is properly aligned for any stack member. */
460 yytype_int16 yyss_alloc
;
465 /* The size of the maximum gap between one aligned stack and the next. */
466 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
468 /* The size of an array large to enough to hold all stacks, each with
470 # define YYSTACK_BYTES(N) \
471 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
472 + 2 * YYSTACK_GAP_MAXIMUM)
474 # define YYCOPY_NEEDED 1
476 /* Relocate STACK from its old location to the new one. The
477 local variables YYSIZE and YYSTACKSIZE give the old and new number of
478 elements in the stack, and YYPTR gives the new location of the
479 stack. Advance YYPTR to a properly aligned location for the next
481 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
484 YYSIZE_T yynewbytes; \
485 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
486 Stack = &yyptr->Stack_alloc; \
487 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
488 yyptr += yynewbytes / sizeof (*yyptr); \
494 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
495 /* Copy COUNT objects from SRC to DST. The source and destination do
498 # if defined __GNUC__ && 1 < __GNUC__
499 # define YYCOPY(Dst, Src, Count) \
500 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
502 # define YYCOPY(Dst, Src, Count) \
506 for (yyi = 0; yyi < (Count); yyi++) \
507 (Dst)[yyi] = (Src)[yyi]; \
512 #endif /* !YYCOPY_NEEDED */
514 /* YYFINAL -- State number of the termination state. */
516 /* YYLAST -- Last index in YYTABLE. */
519 /* YYNTOKENS -- Number of terminals. */
521 /* YYNNTS -- Number of nonterminals. */
523 /* YYNRULES -- Number of rules. */
525 /* YYNSTATES -- Number of states. */
526 #define YYNSTATES 144
528 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
529 by yylex, with out-of-bounds checking. */
531 #define YYMAXUTOK 312
533 #define YYTRANSLATE(YYX) \
534 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
536 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
537 as returned by yylex, without out-of-bounds checking. */
538 static const yytype_uint8 yytranslate
[] =
540 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 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, 1, 2, 3, 4,
566 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
567 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
568 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
569 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
570 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
575 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
576 static const yytype_uint16 yyrline
[] =
578 0, 262, 262, 271, 272, 276, 277, 287, 291, 296,
579 297, 302, 307, 308, 309, 310, 315, 324, 325, 326,
580 327, 328, 329, 329, 330, 331, 355, 356, 357, 358,
581 362, 363, 372, 373, 374, 378, 390, 394, 398, 405,
582 416, 417, 427, 428, 432, 444, 444, 449, 449, 454,
583 465, 480, 481, 482, 483, 487, 488, 493, 495, 500,
584 505, 515, 517, 522, 523, 527, 528, 532, 533, 534,
585 539, 544, 549, 555, 561, 572, 573, 582, 583, 589,
586 590, 591, 598, 598, 606, 607, 608, 613, 616, 618,
587 620, 622, 624, 626, 628, 633, 634, 644, 645, 650,
588 651, 652, 661, 681, 683, 692, 697, 698, 703, 711,
593 #if GRAM_DEBUG || YYERROR_VERBOSE || 1
594 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
595 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
596 static const char *const yytname
[] =
598 "\"end of file\"", "error", "$undefined", "\"string\"", "\"%token\"",
599 "\"%nterm\"", "\"%type\"", "\"%destructor\"", "\"%printer\"",
600 "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%precedence\"",
601 "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
602 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
603 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
604 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
605 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
606 "\"%nondeterministic-parser\"", "\"%output\"", "\"%require\"",
607 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
608 "\"%yacc\"", "\"{...}\"", "\"%?{...}\"", "\"[identifier]\"", "\"char\"",
609 "\"epilogue\"", "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
610 "\"|\"", "\"%{...%}\"", "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"",
611 "\"integer\"", "\"%param\"", "\"%union\"", "\"%empty\"", "$accept",
612 "input", "prologue_declarations", "prologue_declaration", "$@1",
613 "params", "grammar_declaration", "code_props_type", "union_name",
614 "symbol_declaration", "$@2", "$@3", "precedence_declaration",
615 "precedence_declarator", "tag.opt", "symbols.prec", "symbol.prec",
616 "symbols.1", "generic_symlist", "generic_symlist_item", "tag",
617 "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
618 "rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable",
619 "content.opt", "braceless", "id", "id_colon", "symbol", "string_as_id",
620 "epilogue.opt", YY_NULL
625 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
626 (internal) symbol number NUM (which must be that of a token). */
627 static const yytype_uint16 yytoknum
[] =
629 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
630 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
631 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
632 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
633 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
634 305, 306, 307, 308, 309, 310, 311, 312
638 #define YYPACT_NINF -104
640 #define yypact_value_is_default(Yystate) \
641 (!!((Yystate) == (-104)))
643 #define YYTABLE_NINF -110
645 #define yytable_value_is_error(Yytable_value) \
648 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
650 static const yytype_int8 yypact
[] =
652 -104, 18, 116, -104, -104, -104, -26, -104, -104, -104,
653 -104, -104, -104, -16, -104, 24, 23, -104, -18, -13,
654 -104, 39, -104, 9, 51, 52, -104, -104, -104, 53,
655 68, 71, -2, -104, -104, -104, 56, -104, -104, -104,
656 30, -104, -104, 37, -104, -104, 27, -21, -21, -2,
657 -104, 40, -104, -104, -104, 25, -104, -104, -104, -104,
658 -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
659 -104, -104, 32, -104, 34, 3, -104, -104, 49, 58,
660 -104, 40, 41, -104, -2, -104, -104, -21, -1, -21,
661 -2, -104, -104, -104, -104, -104, -104, -104, 55, -104,
662 -104, -104, -104, -104, 61, -104, -104, -104, -104, 41,
663 -104, -104, -104, -2, -104, 26, -104, 92, -104, -104,
664 -104, -104, -104, -104, -104, -104, -104, -15, 74, -104,
665 -104, -2, 47, 54, 49, -104, -104, 49, 74, -104,
666 -104, -104, -104, -104
669 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
670 Performed when YYTABLE does not specify something else to do. Zero
671 means the default is an error. */
672 static const yytype_uint8 yydefact
[] =
674 3, 0, 0, 1, 47, 45, 0, 40, 41, 51,
675 52, 53, 54, 0, 36, 0, 9, 11, 0, 0,
676 7, 0, 15, 0, 0, 0, 37, 19, 20, 0,
677 0, 0, 0, 26, 27, 28, 0, 6, 29, 22,
678 42, 4, 5, 0, 33, 32, 55, 0, 0, 0,
679 102, 0, 38, 98, 97, 99, 10, 12, 13, 14,
680 16, 17, 18, 21, 24, 25, 108, 104, 103, 106,
681 34, 107, 0, 105, 0, 0, 77, 79, 95, 0,
682 43, 0, 0, 56, 0, 70, 75, 48, 71, 46,
683 49, 61, 39, 101, 100, 8, 81, 80, 0, 78,
684 2, 96, 82, 31, 23, 44, 67, 68, 69, 35,
685 63, 66, 65, 50, 57, 59, 76, 72, 73, 62,
686 110, 87, 30, 64, 58, 60, 74, 83, 84, 87,
687 86, 0, 0, 0, 95, 90, 91, 95, 85, 92,
691 /* YYPGOTO[NTERM-NUM]. */
692 static const yytype_int8 yypgoto
[] =
694 -104, -104, -104, -104, -104, -104, 101, -104, -104, -104,
695 -104, -104, -104, -104, -104, -104, -9, -104, -104, 0,
696 -104, -50, 59, -104, 33, -104, -104, -104, -19, -103,
697 -104, -104, -35, -42, -104, -32, -66, -104
700 /* YYDEFGOTO[NTERM-NUM]. */
701 static const yytype_int16 yydefgoto
[] =
703 -1, 1, 2, 41, 79, 104, 74, 43, 81, 44,
704 48, 47, 45, 46, 84, 113, 114, 90, 109, 110,
705 111, 86, 87, 75, 76, 77, 121, 127, 128, 102,
706 55, 95, 52, 69, 78, 112, 71, 100
709 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
710 positive, shift that token. If negative, reduce the rule whose
711 number is the opposite. If YYTABLE_NINF, syntax error. */
712 static const yytype_int16 yytable
[] =
714 70, 66, 66, -109, 72, 88, 88, 4, 5, 6,
715 7, 8, 9, 10, 11, 12, 92, 91, 3, 13,
716 14, 67, 118, 50, 68, 49, 56, 53, 93, 51,
717 85, 142, 26, 129, 143, 130, 57, 116, 32, 116,
718 67, 58, 59, 68, 66, 88, 105, 88, 60, 73,
719 98, 126, 115, 117, 61, 62, 63, 72, 119, 40,
720 4, 5, 6, 7, 8, 9, 10, 11, 12, 54,
721 94, 64, 13, 14, 65, 80, 82, 66, 83, 50,
722 125, 115, 96, 67, 97, 26, 68, 131, 132, 133,
723 101, 32, 106, 107, 108, 66, 137, 103, 120, 139,
724 122, 140, 73, 42, 124, 141, 137, 89, 99, 123,
725 138, 0, 40, 134, 135, 0, 67, 0, 0, 68,
726 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,
727 0, 136, 13, 14, 15, 16, 17, 18, 19, 20,
728 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
729 31, 32, 33, 34, 35, 0, 0, 0, 0, 0,
730 0, 0, 0, 36, 0, 37, 38, 0, 0, 0,
734 static const yytype_int16 yycheck
[] =
736 32, 3, 3, 0, 1, 47, 48, 4, 5, 6,
737 7, 8, 9, 10, 11, 12, 51, 49, 0, 16,
738 17, 42, 88, 39, 45, 51, 3, 3, 3, 45,
739 51, 134, 29, 48, 137, 50, 54, 87, 35, 89,
740 42, 54, 3, 45, 3, 87, 81, 89, 39, 46,
741 47, 117, 84, 54, 3, 3, 3, 1, 90, 56,
742 4, 5, 6, 7, 8, 9, 10, 11, 12, 45,
743 45, 3, 16, 17, 3, 45, 39, 3, 51, 39,
744 54, 113, 50, 42, 50, 29, 45, 13, 14, 15,
745 41, 35, 51, 52, 53, 3, 128, 39, 43, 131,
746 39, 54, 46, 2, 113, 51, 138, 48, 75, 109,
747 129, -1, 56, 39, 40, -1, 42, -1, -1, 45,
748 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
749 -1, 57, 16, 17, 18, 19, 20, 21, 22, 23,
750 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
751 34, 35, 36, 37, 38, -1, -1, -1, -1, -1,
752 -1, -1, -1, 47, -1, 49, 50, -1, -1, -1,
756 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
757 symbol of state STATE-NUM. */
758 static const yytype_uint8 yystos
[] =
760 0, 59, 60, 0, 4, 5, 6, 7, 8, 9,
761 10, 11, 12, 16, 17, 18, 19, 20, 21, 22,
762 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
763 33, 34, 35, 36, 37, 38, 47, 49, 50, 55,
764 56, 61, 64, 65, 67, 70, 71, 69, 68, 51,
765 39, 45, 90, 3, 45, 88, 3, 54, 54, 3,
766 39, 3, 3, 3, 3, 3, 3, 42, 45, 91,
767 93, 94, 1, 46, 64, 81, 82, 83, 92, 62,
768 45, 66, 39, 51, 72, 51, 79, 80, 91, 80,
769 75, 93, 90, 3, 45, 89, 50, 50, 47, 82,
770 95, 41, 87, 39, 63, 90, 51, 52, 53, 76,
771 77, 78, 93, 73, 74, 93, 79, 54, 94, 93,
772 43, 84, 39, 77, 74, 54, 94, 85, 86, 48,
773 50, 13, 14, 15, 39, 40, 57, 93, 86, 93,
777 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
778 static const yytype_uint8 yyr1
[] =
780 0, 58, 59, 60, 60, 61, 61, 61, 61, 61,
781 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
782 61, 61, 62, 61, 61, 61, 61, 61, 61, 61,
783 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
784 65, 65, 66, 66, 64, 68, 67, 69, 67, 67,
785 70, 71, 71, 71, 71, 72, 72, 73, 73, 74,
786 74, 75, 75, 76, 76, 77, 77, 78, 78, 78,
787 79, 79, 79, 79, 79, 80, 80, 81, 81, 82,
788 82, 82, 84, 83, 85, 85, 85, 86, 86, 86,
789 86, 86, 86, 86, 86, 87, 87, 88, 88, 89,
790 89, 89, 90, 91, 91, 92, 93, 93, 94, 95,
794 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
795 static const yytype_uint8 yyr2
[] =
797 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
798 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
799 1, 2, 0, 3, 2, 2, 1, 1, 1, 1,
800 2, 1, 1, 1, 2, 3, 1, 1, 2, 3,
801 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
802 3, 1, 1, 1, 1, 0, 1, 1, 2, 1,
803 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
804 1, 1, 2, 2, 3, 1, 2, 1, 2, 1,
805 2, 2, 0, 4, 1, 3, 2, 0, 3, 3,
806 2, 2, 3, 3, 3, 0, 1, 1, 1, 0,
807 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
812 #define yyerrok (yyerrstatus = 0)
813 #define yyclearin (yychar = YYEMPTY)
817 #define YYACCEPT goto yyacceptlab
818 #define YYABORT goto yyabortlab
819 #define YYERROR goto yyerrorlab
822 #define YYRECOVERING() (!!yyerrstatus)
824 #define YYBACKUP(Token, Value) \
826 if (yychar == YYEMPTY) \
830 YYPOPSTACK (yylen); \
832 YY_LAC_DISCARD ("YYBACKUP"); \
837 yyerror (&yylloc, YY_("syntax error: cannot back up")); \
842 /* Error token number */
844 #define YYERRCODE 256
847 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
848 If N is 0, then set CURRENT to the empty location which ends
849 the previous symbol: RHS[0] (always defined). */
851 #ifndef YYLLOC_DEFAULT
852 # define YYLLOC_DEFAULT(Current, Rhs, N) \
856 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
857 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
858 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
859 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
863 (Current).first_line = (Current).last_line = \
864 YYRHSLOC (Rhs, 0).last_line; \
865 (Current).first_column = (Current).last_column = \
866 YYRHSLOC (Rhs, 0).last_column; \
871 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
874 /* Enable debugging if requested. */
878 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
879 # define YYFPRINTF fprintf
882 # define YYDPRINTF(Args) \
889 /* YY_LOCATION_PRINT -- Print the location on the stream.
890 This macro was not mandated originally: define only if we know
891 we won't break user code: when these are the locations we know. */
893 #ifndef YY_LOCATION_PRINT
894 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
896 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
898 __attribute__((__unused__
))
900 yy_location_print_ (FILE *yyo
, YYLTYPE
const * const yylocp
)
903 int end_col
= 0 != yylocp
->last_column
? yylocp
->last_column
- 1 : 0;
904 if (0 <= yylocp
->first_line
)
906 res
+= YYFPRINTF (yyo
, "%d", yylocp
->first_line
);
907 if (0 <= yylocp
->first_column
)
908 res
+= YYFPRINTF (yyo
, ".%d", yylocp
->first_column
);
910 if (0 <= yylocp
->last_line
)
912 if (yylocp
->first_line
< yylocp
->last_line
)
914 res
+= YYFPRINTF (yyo
, "-%d", yylocp
->last_line
);
916 res
+= YYFPRINTF (yyo
, ".%d", end_col
);
918 else if (0 <= end_col
&& yylocp
->first_column
< end_col
)
919 res
+= YYFPRINTF (yyo
, "-%d", end_col
);
924 # define YY_LOCATION_PRINT(File, Loc) \
925 yy_location_print_ (File, &(Loc))
928 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
933 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
937 YYFPRINTF (stderr, "%s ", Title); \
938 yy_symbol_print (stderr, \
939 Type, Value, Location); \
940 YYFPRINTF (stderr, "\n"); \
945 /*--------------------------------.
946 | Print this symbol on YYOUTPUT. |
947 `--------------------------------*/
950 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
952 FILE *yyo
= yyoutput
;
958 if (yytype
< YYNTOKENS
)
959 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
963 case 3: /* "string" */
964 #line 184 "src/parse-gram.y" /* yacc.c:706 */
965 { fputs (quotearg_style (c_quoting_style
, ((*yyvaluep
).chars
)), yyo
); }
966 #line 967 "src/parse-gram.c" /* yacc.c:706 */
969 case 23: /* "%<flag>" */
970 #line 194 "src/parse-gram.y" /* yacc.c:706 */
971 { fprintf (yyo
, "%%%s", ((*yyvaluep
).uniqstr
)); }
972 #line 973 "src/parse-gram.c" /* yacc.c:706 */
975 case 39: /* "{...}" */
976 #line 186 "src/parse-gram.y" /* yacc.c:706 */
977 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).code
)); }
978 #line 979 "src/parse-gram.c" /* yacc.c:706 */
981 case 41: /* "[identifier]" */
982 #line 192 "src/parse-gram.y" /* yacc.c:706 */
983 { fprintf (yyo
, "[%s]", ((*yyvaluep
).uniqstr
)); }
984 #line 985 "src/parse-gram.c" /* yacc.c:706 */
987 case 42: /* "char" */
988 #line 173 "src/parse-gram.y" /* yacc.c:706 */
989 { fputs (char_name (((*yyvaluep
).character
)), yyo
); }
990 #line 991 "src/parse-gram.c" /* yacc.c:706 */
993 case 43: /* "epilogue" */
994 #line 186 "src/parse-gram.y" /* yacc.c:706 */
995 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
996 #line 997 "src/parse-gram.c" /* yacc.c:706 */
999 case 45: /* "identifier" */
1000 #line 191 "src/parse-gram.y" /* yacc.c:706 */
1001 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1002 #line 1003 "src/parse-gram.c" /* yacc.c:706 */
1005 case 46: /* "identifier:" */
1006 #line 193 "src/parse-gram.y" /* yacc.c:706 */
1007 { fprintf (yyo
, "%s:", ((*yyvaluep
).uniqstr
)); }
1008 #line 1009 "src/parse-gram.c" /* yacc.c:706 */
1011 case 49: /* "%{...%}" */
1012 #line 186 "src/parse-gram.y" /* yacc.c:706 */
1013 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1014 #line 1015 "src/parse-gram.c" /* yacc.c:706 */
1017 case 51: /* "<tag>" */
1018 #line 195 "src/parse-gram.y" /* yacc.c:706 */
1019 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1020 #line 1021 "src/parse-gram.c" /* yacc.c:706 */
1023 case 54: /* "integer" */
1024 #line 199 "src/parse-gram.y" /* yacc.c:706 */
1025 { fprintf (yyo
, "%d", ((*yyvaluep
).integer
)); }
1026 #line 1027 "src/parse-gram.c" /* yacc.c:706 */
1029 case 55: /* "%param" */
1030 #line 242 "src/parse-gram.y" /* yacc.c:706 */
1032 switch (((*yyvaluep
).param
))
1034 #define CASE(In, Out) \
1035 case param_ ## In: fputs ("%" #Out, yyo); break
1036 CASE (lex
, lex
-param
);
1037 CASE (parse
, parse
-param
);
1040 case param_none
: aver (false); break;
1043 #line 1044 "src/parse-gram.c" /* yacc.c:706 */
1046 case 65: /* code_props_type */
1047 #line 414 "src/parse-gram.y" /* yacc.c:706 */
1048 { fprintf (yyo
, "%s", code_props_type_string (((*yyvaluep
).code_type
))); }
1049 #line 1050 "src/parse-gram.c" /* yacc.c:706 */
1052 case 74: /* symbol.prec */
1053 #line 203 "src/parse-gram.y" /* yacc.c:706 */
1054 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1055 #line 1056 "src/parse-gram.c" /* yacc.c:706 */
1059 #line 195 "src/parse-gram.y" /* yacc.c:706 */
1060 { fprintf (yyo
, "<%s>", ((*yyvaluep
).uniqstr
)); }
1061 #line 1062 "src/parse-gram.c" /* yacc.c:706 */
1064 case 88: /* variable */
1065 #line 191 "src/parse-gram.y" /* yacc.c:706 */
1066 { fputs (((*yyvaluep
).uniqstr
), yyo
); }
1067 #line 1068 "src/parse-gram.c" /* yacc.c:706 */
1070 case 89: /* content.opt */
1071 #line 186 "src/parse-gram.y" /* yacc.c:706 */
1072 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1073 #line 1074 "src/parse-gram.c" /* yacc.c:706 */
1076 case 90: /* braceless */
1077 #line 186 "src/parse-gram.y" /* yacc.c:706 */
1078 { fprintf (yyo
, "{\n%s\n}", ((*yyvaluep
).chars
)); }
1079 #line 1080 "src/parse-gram.c" /* yacc.c:706 */
1083 #line 203 "src/parse-gram.y" /* yacc.c:706 */
1084 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1085 #line 1086 "src/parse-gram.c" /* yacc.c:706 */
1088 case 92: /* id_colon */
1089 #line 204 "src/parse-gram.y" /* yacc.c:706 */
1090 { fprintf (yyo
, "%s:", ((*yyvaluep
).symbol
)->tag
); }
1091 #line 1092 "src/parse-gram.c" /* yacc.c:706 */
1094 case 93: /* symbol */
1095 #line 203 "src/parse-gram.y" /* yacc.c:706 */
1096 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1097 #line 1098 "src/parse-gram.c" /* yacc.c:706 */
1100 case 94: /* string_as_id */
1101 #line 203 "src/parse-gram.y" /* yacc.c:706 */
1102 { fprintf (yyo
, "%s", ((*yyvaluep
).symbol
)->tag
); }
1103 #line 1104 "src/parse-gram.c" /* yacc.c:706 */
1112 /*--------------------------------.
1113 | Print this symbol on YYOUTPUT. |
1114 `--------------------------------*/
1117 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, YYLTYPE
const * const yylocationp
)
1119 YYFPRINTF (yyoutput
, "%s %s (",
1120 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
1122 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1123 YYFPRINTF (yyoutput
, ": ");
1124 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, yylocationp
);
1125 YYFPRINTF (yyoutput
, ")");
1128 /*------------------------------------------------------------------.
1129 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1131 `------------------------------------------------------------------*/
1134 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
1136 YYFPRINTF (stderr
, "Stack now");
1137 for (; yybottom
<= yytop
; yybottom
++)
1139 int yybot
= *yybottom
;
1140 YYFPRINTF (stderr
, " %d", yybot
);
1142 YYFPRINTF (stderr
, "\n");
1145 # define YY_STACK_PRINT(Bottom, Top) \
1148 yy_stack_print ((Bottom), (Top)); \
1152 /*------------------------------------------------.
1153 | Report that the YYRULE is going to be reduced. |
1154 `------------------------------------------------*/
1157 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, YYLTYPE
*yylsp
, int yyrule
)
1159 unsigned long int yylno
= yyrline
[yyrule
];
1160 int yynrhs
= yyr2
[yyrule
];
1162 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1164 /* The symbols being reduced. */
1165 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1167 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
1168 yy_symbol_print (stderr
,
1169 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
1170 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1171 , &(yylsp
[(yyi
+ 1) - (yynrhs
)]) );
1172 YYFPRINTF (stderr
, "\n");
1176 # define YY_REDUCE_PRINT(Rule) \
1179 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1182 /* Nonzero means print parse trace. It is left uninitialized so that
1183 multiple parsers can coexist. */
1185 #else /* !GRAM_DEBUG */
1186 # define YYDPRINTF(Args)
1187 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1188 # define YY_STACK_PRINT(Bottom, Top)
1189 # define YY_REDUCE_PRINT(Rule)
1190 #endif /* !GRAM_DEBUG */
1193 /* YYINITDEPTH -- initial size of the parser's stacks. */
1195 # define YYINITDEPTH 200
1198 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1199 if the built-in stack extension method is used).
1201 Do not make this value too large; the results are undefined if
1202 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1203 evaluated with infinite-precision integer arithmetic. */
1206 # define YYMAXDEPTH 10000
1209 /* Given a state stack such that *YYBOTTOM is its bottom, such that
1210 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1211 stack, and such that *YYCAPACITY is the maximum number of elements it
1212 can hold without a reallocation, make sure there is enough room to
1213 store YYADD more elements. If not, allocate a new stack using
1214 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1215 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1216 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1217 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1218 required. Return 1 if memory is exhausted. */
1220 yy_lac_stack_realloc (YYSIZE_T
*yycapacity
, YYSIZE_T yyadd
,
1222 char const *yydebug_prefix
,
1223 char const *yydebug_suffix
,
1225 yytype_int16
**yybottom
,
1226 yytype_int16
*yybottom_no_free
,
1227 yytype_int16
**yytop
, yytype_int16
*yytop_empty
)
1229 YYSIZE_T yysize_old
=
1230 *yytop
== yytop_empty
? 0 : *yytop
- *yybottom
+ 1;
1231 YYSIZE_T yysize_new
= yysize_old
+ yyadd
;
1232 if (*yycapacity
< yysize_new
)
1234 YYSIZE_T yyalloc
= 2 * yysize_new
;
1235 yytype_int16
*yybottom_new
;
1236 /* Use YYMAXDEPTH for maximum stack size given that the stack
1237 should never need to grow larger than the main state stack
1238 needs to grow without LAC. */
1239 if (YYMAXDEPTH
< yysize_new
)
1241 YYDPRINTF ((stderr
, "%smax size exceeded%s", yydebug_prefix
,
1245 if (YYMAXDEPTH
< yyalloc
)
1246 yyalloc
= YYMAXDEPTH
;
1248 (yytype_int16
*) YYSTACK_ALLOC (yyalloc
* sizeof *yybottom_new
);
1251 YYDPRINTF ((stderr
, "%srealloc failed%s", yydebug_prefix
,
1255 if (*yytop
!= yytop_empty
)
1257 YYCOPY (yybottom_new
, *yybottom
, yysize_old
);
1258 *yytop
= yybottom_new
+ (yysize_old
- 1);
1260 if (*yybottom
!= yybottom_no_free
)
1261 YYSTACK_FREE (*yybottom
);
1262 *yybottom
= yybottom_new
;
1263 *yycapacity
= yyalloc
;
1268 /* Establish the initial context for the current lookahead if no initial
1269 context is currently established.
1271 We define a context as a snapshot of the parser stacks. We define
1272 the initial context for a lookahead as the context in which the
1273 parser initially examines that lookahead in order to select a
1274 syntactic action. Thus, if the lookahead eventually proves
1275 syntactically unacceptable (possibly in a later context reached via a
1276 series of reductions), the initial context can be used to determine
1277 the exact set of tokens that would be syntactically acceptable in the
1278 lookahead's place. Moreover, it is the context after which any
1279 further semantic actions would be erroneous because they would be
1280 determined by a syntactically unacceptable token.
1282 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1283 performed in an inconsistent state (which, for the purposes of LAC,
1284 includes consistent states that don't know they're consistent because
1285 their default reductions have been disabled). Iff there is a
1286 lookahead token, it should also be invoked before reporting a syntax
1287 error. This latter case is for the sake of the debugging output.
1289 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1290 follows. If no initial context is currently established for the
1291 current lookahead, then check if that lookahead can eventually be
1292 shifted if syntactic actions continue from the current context.
1293 Report a syntax error if it cannot. */
1294 #define YY_LAC_ESTABLISH \
1296 if (!yy_lac_established) \
1298 YYDPRINTF ((stderr, \
1299 "LAC: initial context established for %s\n", \
1300 yytname[yytoken])); \
1301 yy_lac_established = 1; \
1303 int yy_lac_status = \
1304 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1305 if (yy_lac_status == 2) \
1306 goto yyexhaustedlab; \
1307 if (yy_lac_status == 1) \
1313 /* Discard any previous initial lookahead context because of Event,
1314 which may be a lookahead change or an invalidation of the currently
1315 established initial context for the current lookahead.
1317 The most common example of a lookahead change is a shift. An example
1318 of both cases is syntax error recovery. That is, a syntax error
1319 occurs when the lookahead is syntactically erroneous for the
1320 currently established initial context, so error recovery manipulates
1321 the parser stacks to try to find a new initial context in which the
1322 current lookahead is syntactically acceptable. If it fails to find
1323 such a context, it discards the lookahead. */
1325 # define YY_LAC_DISCARD(Event) \
1327 if (yy_lac_established) \
1330 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1332 yy_lac_established = 0; \
1336 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1339 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1340 eventually (after perhaps some reductions) be shifted, return 1 if
1341 not, or return 2 if memory is exhausted. As preconditions and
1342 postconditions: *YYES_CAPACITY is the allocated size of the array to
1343 which *YYES points, and either *YYES = YYESA or *YYES points to an
1344 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1345 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1346 any old *YYES other than YYESA. */
1348 yy_lac (yytype_int16
*yyesa
, yytype_int16
**yyes
,
1349 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1351 yytype_int16
*yyes_prev
= yyssp
;
1352 yytype_int16
*yyesp
= yyes_prev
;
1353 YYDPRINTF ((stderr
, "LAC: checking lookahead %s:", yytname
[yytoken
]));
1354 if (yytoken
== YYUNDEFTOK
)
1356 YYDPRINTF ((stderr
, " Always Err\n"));
1361 int yyrule
= yypact
[*yyesp
];
1362 if (yypact_value_is_default (yyrule
)
1363 || (yyrule
+= yytoken
) < 0 || YYLAST
< yyrule
1364 || yycheck
[yyrule
] != yytoken
)
1366 yyrule
= yydefact
[*yyesp
];
1369 YYDPRINTF ((stderr
, " Err\n"));
1375 yyrule
= yytable
[yyrule
];
1376 if (yytable_value_is_error (yyrule
))
1378 YYDPRINTF ((stderr
, " Err\n"));
1383 YYDPRINTF ((stderr
, " S%d\n", yyrule
));
1389 YYSIZE_T yylen
= yyr2
[yyrule
];
1390 YYDPRINTF ((stderr
, " R%d", yyrule
- 1));
1391 if (yyesp
!= yyes_prev
)
1393 YYSIZE_T yysize
= yyesp
- *yyes
+ 1;
1406 yyesp
= yyes_prev
-= yylen
;
1411 int yylhs
= yyr1
[yyrule
] - YYNTOKENS
;
1412 yystate
= yypgoto
[yylhs
] + *yyesp
;
1413 if (yystate
< 0 || YYLAST
< yystate
1414 || yycheck
[yystate
] != *yyesp
)
1415 yystate
= yydefgoto
[yylhs
];
1417 yystate
= yytable
[yystate
];
1419 if (yyesp
== yyes_prev
)
1426 if (yy_lac_stack_realloc (yyes_capacity
, 1,
1430 yyes
, yyesa
, &yyesp
, yyes_prev
))
1432 YYDPRINTF ((stderr
, "\n"));
1437 YYDPRINTF ((stderr
, " G%d", yystate
));
1446 # if defined __GLIBC__ && defined _STRING_H
1447 # define yystrlen strlen
1449 /* Return the length of YYSTR. */
1451 yystrlen (const char *yystr
)
1454 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1462 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1463 # define yystpcpy stpcpy
1465 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1468 yystpcpy (char *yydest
, const char *yysrc
)
1471 const char *yys
= yysrc
;
1473 while ((*yyd
++ = *yys
++) != '\0')
1482 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1483 quotes and backslashes, so that it's suitable for yyerror. The
1484 heuristic is that double-quoting is unnecessary unless the string
1485 contains an apostrophe, a comma, or backslash (other than
1486 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1487 null, do not copy; instead, return the length of what the result
1490 yytnamerr (char *yyres
, const char *yystr
)
1495 char const *yyp
= yystr
;
1502 goto do_not_strip_quotes
;
1506 goto do_not_strip_quotes
;
1519 do_not_strip_quotes
: ;
1523 return yystrlen (yystr
);
1525 return yystpcpy (yyres
, yystr
) - yyres
;
1529 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1530 about the unexpected token YYTOKEN for the state stack whose top is
1531 YYSSP. In order to see if a particular token T is a
1532 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1534 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1535 not large enough to hold the message. In that case, also set
1536 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1537 required number of bytes is too large to store or if
1538 yy_lac returned 2. */
1540 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1541 yytype_int16
*yyesa
, yytype_int16
**yyes
,
1542 YYSIZE_T
*yyes_capacity
, yytype_int16
*yyssp
, int yytoken
)
1544 YYSIZE_T yysize0
= yytnamerr (YY_NULL
, yytname
[yytoken
]);
1545 YYSIZE_T yysize
= yysize0
;
1546 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1547 /* Internationalized format string. */
1548 const char *yyformat
= YY_NULL
;
1549 /* Arguments of yyformat. */
1550 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1551 /* Number of reported tokens (one for the "unexpected", one per
1555 /* There are many possibilities here to consider:
1556 - If this state is a consistent state with a default action, then
1557 the only way this function was invoked is if the default action
1558 is an error action. In that case, don't check for expected
1559 tokens because there are none.
1560 - The only way there can be no lookahead present (in yychar) is if
1561 this state is a consistent state with a default action. Thus,
1562 detecting the absence of a lookahead is sufficient to determine
1563 that there is no unexpected or expected token to report. In that
1564 case, just report a simple "syntax error".
1565 - Don't assume there isn't a lookahead just because this state is a
1566 consistent state with a default action. There might have been a
1567 previous inconsistent state, consistent state with a non-default
1568 action, or user semantic action that manipulated yychar.
1569 In the first two cases, it might appear that the current syntax
1570 error should have been detected in the previous state when yy_lac
1571 was invoked. However, at that time, there might have been a
1572 different syntax error that discarded a different initial context
1573 during error recovery, leaving behind the current lookahead.
1575 if (yytoken
!= YYEMPTY
)
1577 int yyn
= yypact
[*yyssp
];
1578 YYDPRINTF ((stderr
, "Constructing syntax error message\n"));
1579 yyarg
[yycount
++] = yytname
[yytoken
];
1580 if (!yypact_value_is_default (yyn
))
1584 for (yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1585 if (yyx
!= YYTERROR
&& yyx
!= YYUNDEFTOK
)
1588 int yy_lac_status
= yy_lac (yyesa
, yyes
, yyes_capacity
,
1590 if (yy_lac_status
== 2)
1592 if (yy_lac_status
== 1)
1595 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1601 yyarg
[yycount
++] = yytname
[yyx
];
1603 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULL
, yytname
[yyx
]);
1604 if (! (yysize
<= yysize1
1605 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1613 YYFPRINTF (stderr
, "No expected tokens.\n");
1619 # define YYCASE_(N, S) \
1623 YYCASE_(0, YY_("syntax error"));
1624 YYCASE_(1, YY_("syntax error, unexpected %s"));
1625 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1626 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1627 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1628 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1633 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1634 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1639 if (*yymsg_alloc
< yysize
)
1641 *yymsg_alloc
= 2 * yysize
;
1642 if (! (yysize
<= *yymsg_alloc
1643 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1644 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1648 /* Avoid sprintf, as that infringes on the user's name space.
1649 Don't have undefined behavior even if the translation
1650 produced a string with the wrong number of "%s"s. */
1654 while ((*yyp
= *yyformat
) != '\0')
1655 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1657 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1668 #endif /* YYERROR_VERBOSE */
1670 /*-----------------------------------------------.
1671 | Release the memory associated to this symbol. |
1672 `-----------------------------------------------*/
1675 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1678 YYUSE (yylocationp
);
1681 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1700 /* The lookahead symbol. */
1704 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1705 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1706 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1707 _Pragma ("GCC diagnostic push") \
1708 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1709 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1710 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1711 _Pragma ("GCC diagnostic pop")
1713 /* Default value used for initialization, for pacifying older GCCs
1714 or non-GCC compilers. */
1715 static YYSTYPE yyval_default
;
1716 # define YY_INITIAL_VALUE(Value) = Value
1718 static YYLTYPE yyloc_default
1719 # if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1723 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1724 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1725 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1727 #ifndef YY_INITIAL_VALUE
1728 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1731 /* The semantic value of the lookahead symbol. */
1732 YYSTYPE yylval
YY_INITIAL_VALUE(yyval_default
);
1734 /* Location data for the lookahead symbol. */
1735 YYLTYPE yylloc
= yyloc_default
;
1738 /* Number of syntax errors so far. */
1742 /* Number of tokens to shift before error messages enabled. */
1745 /* The stacks and their tools:
1746 'yyss': related to states.
1747 'yyvs': related to semantic values.
1748 'yyls': related to locations.
1750 Refer to the stacks through separate pointers, to allow yyoverflow
1751 to reallocate them elsewhere. */
1753 /* The state stack. */
1754 yytype_int16 yyssa
[YYINITDEPTH
];
1756 yytype_int16
*yyssp
;
1758 /* The semantic value stack. */
1759 YYSTYPE yyvsa
[YYINITDEPTH
];
1763 /* The location stack. */
1764 YYLTYPE yylsa
[YYINITDEPTH
];
1768 /* The locations where the error started and ended. */
1769 YYLTYPE yyerror_range
[3];
1771 YYSIZE_T yystacksize
;
1773 yytype_int16 yyesa
[20];
1775 YYSIZE_T yyes_capacity
;
1777 int yy_lac_established
= 0;
1780 /* Lookahead token as an internal (translated) token number. */
1782 /* The variables used to return semantic value and location from the
1788 /* Buffer for error messages, and its allocated size. */
1790 char *yymsg
= yymsgbuf
;
1791 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1794 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1796 /* The number of symbols on the RHS of the reduced rule.
1797 Keep to zero when no symbol should be popped. */
1800 yyssp
= yyss
= yyssa
;
1801 yyvsp
= yyvs
= yyvsa
;
1802 yylsp
= yyls
= yylsa
;
1803 yystacksize
= YYINITDEPTH
;
1806 yyes_capacity
= sizeof yyesa
/ sizeof *yyes
;
1807 if (YYMAXDEPTH
< yyes_capacity
)
1808 yyes_capacity
= YYMAXDEPTH
;
1810 YYDPRINTF ((stderr
, "Starting parse\n"));
1815 yychar
= YYEMPTY
; /* Cause a token to be read. */
1817 /* User initialization code. */
1818 #line 97 "src/parse-gram.y" /* yacc.c:1451 */
1820 /* Bison's grammar can initial empty locations, hence a default
1821 location is needed. */
1822 boundary_set (&yylloc
.start
, current_file
, 1, 1);
1823 boundary_set (&yylloc
.end
, current_file
, 1, 1);
1825 #line 1826 "src/parse-gram.c" /* yacc.c:1451 */
1829 /*------------------------------------------------------------.
1830 | yynewstate -- Push a new state, which is found in yystate. |
1831 `------------------------------------------------------------*/
1833 /* In all cases, when you get here, the value and location stacks
1834 have just been pushed. So pushing a state here evens the stacks. */
1840 if (yyss
+ yystacksize
- 1 <= yyssp
)
1842 /* Get the current used size of the three stacks, in elements. */
1843 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1847 /* Give user a chance to reallocate the stack. Use copies of
1848 these so that the &'s don't force the real ones into
1850 YYSTYPE
*yyvs1
= yyvs
;
1851 yytype_int16
*yyss1
= yyss
;
1852 YYLTYPE
*yyls1
= yyls
;
1854 /* Each stack pointer address is followed by the size of the
1855 data in use in that stack, in bytes. This used to be a
1856 conditional around just the two extra args, but that might
1857 be undefined if yyoverflow is a macro. */
1858 yyoverflow (YY_("memory exhausted"),
1859 &yyss1
, yysize
* sizeof (*yyssp
),
1860 &yyvs1
, yysize
* sizeof (*yyvsp
),
1861 &yyls1
, yysize
* sizeof (*yylsp
),
1868 #else /* no yyoverflow */
1869 # ifndef YYSTACK_RELOCATE
1870 goto yyexhaustedlab
;
1872 /* Extend the stack our own way. */
1873 if (YYMAXDEPTH
<= yystacksize
)
1874 goto yyexhaustedlab
;
1876 if (YYMAXDEPTH
< yystacksize
)
1877 yystacksize
= YYMAXDEPTH
;
1880 yytype_int16
*yyss1
= yyss
;
1881 union yyalloc
*yyptr
=
1882 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1884 goto yyexhaustedlab
;
1885 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1886 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1887 YYSTACK_RELOCATE (yyls_alloc
, yyls
);
1888 # undef YYSTACK_RELOCATE
1890 YYSTACK_FREE (yyss1
);
1893 #endif /* no yyoverflow */
1895 yyssp
= yyss
+ yysize
- 1;
1896 yyvsp
= yyvs
+ yysize
- 1;
1897 yylsp
= yyls
+ yysize
- 1;
1899 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1900 (unsigned long int) yystacksize
));
1902 if (yyss
+ yystacksize
- 1 <= yyssp
)
1906 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1908 if (yystate
== YYFINAL
)
1918 /* Do appropriate processing given the current state. Read a
1919 lookahead token if we need one and don't already have one. */
1921 /* First try to decide what to do without reference to lookahead token. */
1922 yyn
= yypact
[yystate
];
1923 if (yypact_value_is_default (yyn
))
1926 /* Not known => get a lookahead token if don't already have one. */
1928 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1929 if (yychar
== YYEMPTY
)
1931 YYDPRINTF ((stderr
, "Reading a token: "));
1932 yychar
= yylex (&yylval
, &yylloc
);
1935 if (yychar
<= YYEOF
)
1937 yychar
= yytoken
= YYEOF
;
1938 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1942 yytoken
= YYTRANSLATE (yychar
);
1943 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1946 /* If the proper action on seeing token YYTOKEN is to reduce or to
1947 detect an error, take that action. */
1949 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1957 if (yytable_value_is_error (yyn
))
1964 /* Count tokens shifted since error; after three, turn off error
1969 /* Shift the lookahead token. */
1970 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1972 /* Discard the shifted token. */
1974 YY_LAC_DISCARD ("shift");
1977 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1979 YY_IGNORE_MAYBE_UNINITIALIZED_END
1984 /*-----------------------------------------------------------.
1985 | yydefault -- do the default action for the current state. |
1986 `-----------------------------------------------------------*/
1988 yyn
= yydefact
[yystate
];
1994 /*-----------------------------.
1995 | yyreduce -- Do a reduction. |
1996 `-----------------------------*/
1998 /* yyn is the number of a rule to reduce with. */
2001 /* If YYLEN is nonzero, implement the default value of the action:
2004 Otherwise, the following line sets YYVAL to garbage.
2005 This behavior is undocumented and Bison
2006 users should not rely upon it. Assigning to YYVAL
2007 unconditionally makes the parser a bit smaller, and it avoids a
2008 GCC warning that YYVAL may be used uninitialized. */
2009 yyval
= yyvsp
[1-yylen
];
2011 /* Default location. */
2012 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
2013 YY_REDUCE_PRINT (yyn
);
2015 int yychar_backup
= yychar
;
2019 #line 278 "src/parse-gram.y" /* yacc.c:1668 */
2021 code_props plain_code
;
2022 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2023 code_props_translate_code (&plain_code
);
2024 gram_scanner_last_string_free ();
2025 muscle_code_grow (union_seen
? "post_prologue" : "pre_prologue",
2026 plain_code
.code
, (yylsp
[0]));
2027 code_scanner_last_string_free ();
2029 #line 2030 "src/parse-gram.c" /* yacc.c:1668 */
2033 #line 288 "src/parse-gram.y" /* yacc.c:1668 */
2035 muscle_percent_define_ensure ((yyvsp
[0].uniqstr
), (yylsp
[0]), true);
2037 #line 2038 "src/parse-gram.c" /* yacc.c:1668 */
2041 #line 292 "src/parse-gram.y" /* yacc.c:1668 */
2043 muscle_percent_define_insert ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
),
2044 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2046 #line 2047 "src/parse-gram.c" /* yacc.c:1668 */
2050 #line 296 "src/parse-gram.y" /* yacc.c:1668 */
2051 { defines_flag
= true; }
2052 #line 2053 "src/parse-gram.c" /* yacc.c:1668 */
2056 #line 298 "src/parse-gram.y" /* yacc.c:1668 */
2058 defines_flag
= true;
2059 spec_defines_file
= xstrdup ((yyvsp
[0].chars
));
2061 #line 2062 "src/parse-gram.c" /* yacc.c:1668 */
2065 #line 303 "src/parse-gram.y" /* yacc.c:1668 */
2067 muscle_percent_define_insert ("parse.error", (yylsp
[0]), "verbose",
2068 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
);
2070 #line 2071 "src/parse-gram.c" /* yacc.c:1668 */
2074 #line 307 "src/parse-gram.y" /* yacc.c:1668 */
2075 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
2076 #line 2077 "src/parse-gram.c" /* yacc.c:1668 */
2080 #line 308 "src/parse-gram.y" /* yacc.c:1668 */
2081 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
2082 #line 2083 "src/parse-gram.c" /* yacc.c:1668 */
2086 #line 309 "src/parse-gram.y" /* yacc.c:1668 */
2087 { spec_file_prefix
= (yyvsp
[0].chars
); }
2088 #line 2089 "src/parse-gram.c" /* yacc.c:1668 */
2092 #line 311 "src/parse-gram.y" /* yacc.c:1668 */
2094 nondeterministic_parser
= true;
2097 #line 2098 "src/parse-gram.c" /* yacc.c:1668 */
2101 #line 316 "src/parse-gram.y" /* yacc.c:1668 */
2104 code_props_symbol_action_init (&action
, (yyvsp
[0].code
), (yylsp
[0]));
2105 code_props_translate_code (&action
);
2106 gram_scanner_last_string_free ();
2107 muscle_code_grow ("initial_action", action
.code
, (yylsp
[0]));
2108 code_scanner_last_string_free ();
2110 #line 2111 "src/parse-gram.c" /* yacc.c:1668 */
2114 #line 324 "src/parse-gram.y" /* yacc.c:1668 */
2115 { language_argmatch ((yyvsp
[0].chars
), grammar_prio
, (yylsp
[-1])); }
2116 #line 2117 "src/parse-gram.c" /* yacc.c:1668 */
2120 #line 325 "src/parse-gram.y" /* yacc.c:1668 */
2121 { spec_name_prefix
= (yyvsp
[0].chars
); }
2122 #line 2123 "src/parse-gram.c" /* yacc.c:1668 */
2126 #line 326 "src/parse-gram.y" /* yacc.c:1668 */
2127 { no_lines_flag
= true; }
2128 #line 2129 "src/parse-gram.c" /* yacc.c:1668 */
2132 #line 327 "src/parse-gram.y" /* yacc.c:1668 */
2133 { nondeterministic_parser
= true; }
2134 #line 2135 "src/parse-gram.c" /* yacc.c:1668 */
2138 #line 328 "src/parse-gram.y" /* yacc.c:1668 */
2139 { spec_outfile
= (yyvsp
[0].chars
); }
2140 #line 2141 "src/parse-gram.c" /* yacc.c:1668 */
2144 #line 329 "src/parse-gram.y" /* yacc.c:1668 */
2145 { current_param
= (yyvsp
[0].param
); }
2146 #line 2147 "src/parse-gram.c" /* yacc.c:1668 */
2150 #line 329 "src/parse-gram.y" /* yacc.c:1668 */
2151 { current_param
= param_none
; }
2152 #line 2153 "src/parse-gram.c" /* yacc.c:1668 */
2156 #line 330 "src/parse-gram.y" /* yacc.c:1668 */
2157 { version_check (&(yylsp
[0]), (yyvsp
[0].chars
)); }
2158 #line 2159 "src/parse-gram.c" /* yacc.c:1668 */
2162 #line 332 "src/parse-gram.y" /* yacc.c:1668 */
2164 char const *skeleton_user
= (yyvsp
[0].chars
);
2165 if (strchr (skeleton_user
, '/'))
2167 size_t dir_length
= strlen (current_file
);
2168 char *skeleton_build
;
2169 while (dir_length
&& current_file
[dir_length
- 1] != '/')
2171 while (dir_length
&& current_file
[dir_length
- 1] == '/')
2174 xmalloc (dir_length
+ 1 + strlen (skeleton_user
) + 1);
2177 memcpy (skeleton_build
, current_file
, dir_length
);
2178 skeleton_build
[dir_length
++] = '/';
2180 strcpy (skeleton_build
+ dir_length
, skeleton_user
);
2181 skeleton_user
= uniqstr_new (skeleton_build
);
2182 free (skeleton_build
);
2184 skeleton_arg (skeleton_user
, grammar_prio
, (yylsp
[-1]));
2186 #line 2187 "src/parse-gram.c" /* yacc.c:1668 */
2190 #line 355 "src/parse-gram.y" /* yacc.c:1668 */
2191 { token_table_flag
= true; }
2192 #line 2193 "src/parse-gram.c" /* yacc.c:1668 */
2196 #line 356 "src/parse-gram.y" /* yacc.c:1668 */
2197 { report_flag
|= report_states
; }
2198 #line 2199 "src/parse-gram.c" /* yacc.c:1668 */
2202 #line 357 "src/parse-gram.y" /* yacc.c:1668 */
2203 { yacc_flag
= true; }
2204 #line 2205 "src/parse-gram.c" /* yacc.c:1668 */
2208 #line 362 "src/parse-gram.y" /* yacc.c:1668 */
2209 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2210 #line 2211 "src/parse-gram.c" /* yacc.c:1668 */
2214 #line 363 "src/parse-gram.y" /* yacc.c:1668 */
2215 { add_param (current_param
, (yyvsp
[0].code
), (yylsp
[0])); }
2216 #line 2217 "src/parse-gram.c" /* yacc.c:1668 */
2220 #line 375 "src/parse-gram.y" /* yacc.c:1668 */
2222 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
2224 #line 2225 "src/parse-gram.c" /* yacc.c:1668 */
2228 #line 379 "src/parse-gram.y" /* yacc.c:1668 */
2231 code_props_symbol_action_init (&code
, (yyvsp
[-1].code
), (yylsp
[-1]));
2232 code_props_translate_code (&code
);
2235 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2236 symbol_list_code_props_set (list
, (yyvsp
[-2].code_type
), &code
);
2237 symbol_list_free ((yyvsp
[0].list
));
2240 #line 2241 "src/parse-gram.c" /* yacc.c:1668 */
2244 #line 391 "src/parse-gram.y" /* yacc.c:1668 */
2246 default_prec
= true;
2248 #line 2249 "src/parse-gram.c" /* yacc.c:1668 */
2252 #line 395 "src/parse-gram.y" /* yacc.c:1668 */
2254 default_prec
= false;
2256 #line 2257 "src/parse-gram.c" /* yacc.c:1668 */
2260 #line 399 "src/parse-gram.y" /* yacc.c:1668 */
2262 /* Do not invoke muscle_percent_code_grow here since it invokes
2263 muscle_user_name_list_grow. */
2264 muscle_code_grow ("percent_code()", (yyvsp
[0].chars
), (yylsp
[0]));
2265 code_scanner_last_string_free ();
2267 #line 2268 "src/parse-gram.c" /* yacc.c:1668 */
2271 #line 406 "src/parse-gram.y" /* yacc.c:1668 */
2273 muscle_percent_code_grow ((yyvsp
[-1].uniqstr
), (yylsp
[-1]), (yyvsp
[0].chars
), (yylsp
[0]));
2274 code_scanner_last_string_free ();
2276 #line 2277 "src/parse-gram.c" /* yacc.c:1668 */
2280 #line 416 "src/parse-gram.y" /* yacc.c:1668 */
2281 { (yyval
.code_type
) = destructor
; }
2282 #line 2283 "src/parse-gram.c" /* yacc.c:1668 */
2286 #line 417 "src/parse-gram.y" /* yacc.c:1668 */
2287 { (yyval
.code_type
) = printer
; }
2288 #line 2289 "src/parse-gram.c" /* yacc.c:1668 */
2292 #line 427 "src/parse-gram.y" /* yacc.c:1668 */
2294 #line 2295 "src/parse-gram.c" /* yacc.c:1668 */
2298 #line 428 "src/parse-gram.y" /* yacc.c:1668 */
2299 { muscle_code_grow ("union_name", (yyvsp
[0].uniqstr
), (yylsp
[0])); }
2300 #line 2301 "src/parse-gram.c" /* yacc.c:1668 */
2304 #line 433 "src/parse-gram.y" /* yacc.c:1668 */
2307 muscle_code_grow ("union_members", (yyvsp
[0].chars
), (yylsp
[0]));
2308 code_scanner_last_string_free ();
2310 #line 2311 "src/parse-gram.c" /* yacc.c:1668 */
2314 #line 444 "src/parse-gram.y" /* yacc.c:1668 */
2315 { current_class
= nterm_sym
; }
2316 #line 2317 "src/parse-gram.c" /* yacc.c:1668 */
2320 #line 445 "src/parse-gram.y" /* yacc.c:1668 */
2322 current_class
= unknown_sym
;
2323 current_type
= NULL
;
2325 #line 2326 "src/parse-gram.c" /* yacc.c:1668 */
2329 #line 449 "src/parse-gram.y" /* yacc.c:1668 */
2330 { current_class
= token_sym
; }
2331 #line 2332 "src/parse-gram.c" /* yacc.c:1668 */
2335 #line 450 "src/parse-gram.y" /* yacc.c:1668 */
2337 current_class
= unknown_sym
;
2338 current_type
= NULL
;
2340 #line 2341 "src/parse-gram.c" /* yacc.c:1668 */
2344 #line 455 "src/parse-gram.y" /* yacc.c:1668 */
2348 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2349 symbol_type_set (list
->content
.sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
2350 symbol_list_free ((yyvsp
[0].list
));
2352 #line 2353 "src/parse-gram.c" /* yacc.c:1668 */
2356 #line 466 "src/parse-gram.y" /* yacc.c:1668 */
2360 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
2362 symbol_type_set (list
->content
.sym
, current_type
, (yylsp
[-1]));
2363 symbol_precedence_set (list
->content
.sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
2365 symbol_list_free ((yyvsp
[0].list
));
2366 current_type
= NULL
;
2368 #line 2369 "src/parse-gram.c" /* yacc.c:1668 */
2372 #line 480 "src/parse-gram.y" /* yacc.c:1668 */
2373 { (yyval
.assoc
) = left_assoc
; }
2374 #line 2375 "src/parse-gram.c" /* yacc.c:1668 */
2378 #line 481 "src/parse-gram.y" /* yacc.c:1668 */
2379 { (yyval
.assoc
) = right_assoc
; }
2380 #line 2381 "src/parse-gram.c" /* yacc.c:1668 */
2384 #line 482 "src/parse-gram.y" /* yacc.c:1668 */
2385 { (yyval
.assoc
) = non_assoc
; }
2386 #line 2387 "src/parse-gram.c" /* yacc.c:1668 */
2390 #line 483 "src/parse-gram.y" /* yacc.c:1668 */
2391 { (yyval
.assoc
) = precedence_assoc
; }
2392 #line 2393 "src/parse-gram.c" /* yacc.c:1668 */
2396 #line 487 "src/parse-gram.y" /* yacc.c:1668 */
2397 { current_type
= NULL
; }
2398 #line 2399 "src/parse-gram.c" /* yacc.c:1668 */
2402 #line 488 "src/parse-gram.y" /* yacc.c:1668 */
2403 { current_type
= (yyvsp
[0].uniqstr
); tag_seen
= true; }
2404 #line 2405 "src/parse-gram.c" /* yacc.c:1668 */
2408 #line 494 "src/parse-gram.y" /* yacc.c:1668 */
2409 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2410 #line 2411 "src/parse-gram.c" /* yacc.c:1668 */
2414 #line 496 "src/parse-gram.y" /* yacc.c:1668 */
2415 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2416 #line 2417 "src/parse-gram.c" /* yacc.c:1668 */
2420 #line 501 "src/parse-gram.y" /* yacc.c:1668 */
2422 (yyval
.symbol
) = (yyvsp
[0].symbol
);
2423 symbol_class_set ((yyvsp
[0].symbol
), token_sym
, (yylsp
[0]), false);
2425 #line 2426 "src/parse-gram.c" /* yacc.c:1668 */
2429 #line 506 "src/parse-gram.y" /* yacc.c:1668 */
2431 (yyval
.symbol
) = (yyvsp
[-1].symbol
);
2432 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2433 symbol_class_set ((yyvsp
[-1].symbol
), token_sym
, (yylsp
[-1]), false);
2435 #line 2436 "src/parse-gram.c" /* yacc.c:1668 */
2439 #line 516 "src/parse-gram.y" /* yacc.c:1668 */
2440 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2441 #line 2442 "src/parse-gram.c" /* yacc.c:1668 */
2445 #line 518 "src/parse-gram.y" /* yacc.c:1668 */
2446 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0]))); }
2447 #line 2448 "src/parse-gram.c" /* yacc.c:1668 */
2451 #line 522 "src/parse-gram.y" /* yacc.c:1668 */
2452 { (yyval
.list
) = (yyvsp
[0].list
); }
2453 #line 2454 "src/parse-gram.c" /* yacc.c:1668 */
2457 #line 523 "src/parse-gram.y" /* yacc.c:1668 */
2458 { (yyval
.list
) = symbol_list_append ((yyvsp
[-1].list
), (yyvsp
[0].list
)); }
2459 #line 2460 "src/parse-gram.c" /* yacc.c:1668 */
2463 #line 527 "src/parse-gram.y" /* yacc.c:1668 */
2464 { (yyval
.list
) = symbol_list_sym_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
2465 #line 2466 "src/parse-gram.c" /* yacc.c:1668 */
2469 #line 528 "src/parse-gram.y" /* yacc.c:1668 */
2470 { (yyval
.list
) = symbol_list_type_new ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2471 #line 2472 "src/parse-gram.c" /* yacc.c:1668 */
2475 #line 533 "src/parse-gram.y" /* yacc.c:1668 */
2476 { (yyval
.uniqstr
) = uniqstr_new ("*"); }
2477 #line 2478 "src/parse-gram.c" /* yacc.c:1668 */
2481 #line 534 "src/parse-gram.y" /* yacc.c:1668 */
2482 { (yyval
.uniqstr
) = uniqstr_new (""); }
2483 #line 2484 "src/parse-gram.c" /* yacc.c:1668 */
2487 #line 540 "src/parse-gram.y" /* yacc.c:1668 */
2489 current_type
= (yyvsp
[0].uniqstr
);
2492 #line 2493 "src/parse-gram.c" /* yacc.c:1668 */
2496 #line 545 "src/parse-gram.y" /* yacc.c:1668 */
2498 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]), true);
2499 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
2501 #line 2502 "src/parse-gram.c" /* yacc.c:1668 */
2505 #line 550 "src/parse-gram.y" /* yacc.c:1668 */
2507 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2508 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2509 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
2511 #line 2512 "src/parse-gram.c" /* yacc.c:1668 */
2515 #line 556 "src/parse-gram.y" /* yacc.c:1668 */
2517 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]), true);
2518 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
2519 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2521 #line 2522 "src/parse-gram.c" /* yacc.c:1668 */
2525 #line 562 "src/parse-gram.y" /* yacc.c:1668 */
2527 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]), true);
2528 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
2529 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
2530 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
2532 #line 2533 "src/parse-gram.c" /* yacc.c:1668 */
2536 #line 592 "src/parse-gram.y" /* yacc.c:1668 */
2540 #line 2541 "src/parse-gram.c" /* yacc.c:1668 */
2544 #line 598 "src/parse-gram.y" /* yacc.c:1668 */
2545 { current_lhs ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2546 #line 2547 "src/parse-gram.c" /* yacc.c:1668 */
2550 #line 599 "src/parse-gram.y" /* yacc.c:1668 */
2552 /* Free the current lhs. */
2553 current_lhs (0, (yylsp
[-3]), 0);
2555 #line 2556 "src/parse-gram.c" /* yacc.c:1668 */
2559 #line 606 "src/parse-gram.y" /* yacc.c:1668 */
2560 { grammar_current_rule_end ((yylsp
[0])); }
2561 #line 2562 "src/parse-gram.c" /* yacc.c:1668 */
2565 #line 607 "src/parse-gram.y" /* yacc.c:1668 */
2566 { grammar_current_rule_end ((yylsp
[0])); }
2567 #line 2568 "src/parse-gram.c" /* yacc.c:1668 */
2571 #line 614 "src/parse-gram.y" /* yacc.c:1668 */
2572 { grammar_current_rule_begin (current_lhs_symbol
, current_lhs_location
,
2573 current_lhs_named_ref
); }
2574 #line 2575 "src/parse-gram.c" /* yacc.c:1668 */
2578 #line 617 "src/parse-gram.y" /* yacc.c:1668 */
2579 { grammar_current_rule_symbol_append ((yyvsp
[-1].symbol
), (yylsp
[-1]), (yyvsp
[0].named_ref
)); }
2580 #line 2581 "src/parse-gram.c" /* yacc.c:1668 */
2584 #line 619 "src/parse-gram.y" /* yacc.c:1668 */
2585 { grammar_current_rule_action_append ((yyvsp
[-1].code
), (yylsp
[-1]), (yyvsp
[0].named_ref
), false); }
2586 #line 2587 "src/parse-gram.c" /* yacc.c:1668 */
2590 #line 621 "src/parse-gram.y" /* yacc.c:1668 */
2591 { grammar_current_rule_action_append ((yyvsp
[0].code
), (yylsp
[0]), NULL
, true); }
2592 #line 2593 "src/parse-gram.c" /* yacc.c:1668 */
2596 #line 623 "src/parse-gram.y" /* yacc.c:1668 */
2597 { grammar_current_rule_empty_set ((yylsp
[0])); }
2598 #line 2599 "src/parse-gram.c" /* yacc.c:1668 */
2602 #line 625 "src/parse-gram.y" /* yacc.c:1668 */
2603 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2604 #line 2605 "src/parse-gram.c" /* yacc.c:1668 */
2608 #line 627 "src/parse-gram.y" /* yacc.c:1668 */
2609 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2610 #line 2611 "src/parse-gram.c" /* yacc.c:1668 */
2614 #line 629 "src/parse-gram.y" /* yacc.c:1668 */
2615 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2616 #line 2617 "src/parse-gram.c" /* yacc.c:1668 */
2620 #line 633 "src/parse-gram.y" /* yacc.c:1668 */
2621 { (yyval
.named_ref
) = 0; }
2622 #line 2623 "src/parse-gram.c" /* yacc.c:1668 */
2626 #line 634 "src/parse-gram.y" /* yacc.c:1668 */
2627 { (yyval
.named_ref
) = named_ref_new((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2628 #line 2629 "src/parse-gram.c" /* yacc.c:1668 */
2632 #line 645 "src/parse-gram.y" /* yacc.c:1668 */
2633 { (yyval
.uniqstr
) = uniqstr_new ((yyvsp
[0].chars
)); }
2634 #line 2635 "src/parse-gram.c" /* yacc.c:1668 */
2638 #line 650 "src/parse-gram.y" /* yacc.c:1668 */
2639 { (yyval
.chars
) = ""; }
2640 #line 2641 "src/parse-gram.c" /* yacc.c:1668 */
2644 #line 651 "src/parse-gram.y" /* yacc.c:1668 */
2645 { (yyval
.chars
) = (yyvsp
[0].uniqstr
); }
2646 #line 2647 "src/parse-gram.c" /* yacc.c:1668 */
2650 #line 652 "src/parse-gram.y" /* yacc.c:1668 */
2651 { (yyval
.chars
) = (yyvsp
[0].chars
); }
2652 #line 2653 "src/parse-gram.c" /* yacc.c:1668 */
2656 #line 662 "src/parse-gram.y" /* yacc.c:1668 */
2658 code_props plain_code
;
2659 (yyvsp
[0].code
)[strlen ((yyvsp
[0].code
)) - 1] = '\n';
2660 code_props_plain_init (&plain_code
, (yyvsp
[0].code
)+1, (yylsp
[0]));
2661 code_props_translate_code (&plain_code
);
2662 gram_scanner_last_string_free ();
2663 (yyval
.chars
) = plain_code
.code
;
2665 #line 2666 "src/parse-gram.c" /* yacc.c:1668 */
2669 #line 682 "src/parse-gram.y" /* yacc.c:1668 */
2670 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2671 #line 2672 "src/parse-gram.c" /* yacc.c:1668 */
2675 #line 684 "src/parse-gram.y" /* yacc.c:1668 */
2677 (yyval
.symbol
) = symbol_get (char_name ((yyvsp
[0].character
)), (yylsp
[0]));
2678 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2679 symbol_user_token_number_set ((yyval
.symbol
), (yyvsp
[0].character
), (yylsp
[0]));
2681 #line 2682 "src/parse-gram.c" /* yacc.c:1668 */
2685 #line 692 "src/parse-gram.y" /* yacc.c:1668 */
2686 { (yyval
.symbol
) = symbol_from_uniqstr ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2687 #line 2688 "src/parse-gram.c" /* yacc.c:1668 */
2691 #line 704 "src/parse-gram.y" /* yacc.c:1668 */
2693 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].chars
)), (yylsp
[0]));
2694 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]), false);
2696 #line 2697 "src/parse-gram.c" /* yacc.c:1668 */
2700 #line 713 "src/parse-gram.y" /* yacc.c:1668 */
2702 code_props plain_code
;
2703 code_props_plain_init (&plain_code
, (yyvsp
[0].chars
), (yylsp
[0]));
2704 code_props_translate_code (&plain_code
);
2705 gram_scanner_last_string_free ();
2706 muscle_code_grow ("epilogue", plain_code
.code
, (yylsp
[0]));
2707 code_scanner_last_string_free ();
2709 #line 2710 "src/parse-gram.c" /* yacc.c:1668 */
2713 #line 2714 "src/parse-gram.c" /* yacc.c:1668 */
2716 if (yychar_backup
!= yychar
)
2717 YY_LAC_DISCARD ("yychar change");
2719 /* User semantic actions sometimes alter yychar, and that requires
2720 that yytoken be updated with the new translation. We take the
2721 approach of translating immediately before every use of yytoken.
2722 One alternative is translating here after every semantic action,
2723 but that translation would be missed if the semantic action invokes
2724 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2725 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2726 incorrect destructor might then be invoked immediately. In the
2727 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2728 to an incorrect destructor call or verbose syntax error message
2729 before the lookahead is translated. */
2730 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2734 YY_STACK_PRINT (yyss
, yyssp
);
2739 /* Now 'shift' the result of the reduction. Determine what state
2740 that goes to, based on the state we popped back to and the rule
2741 number reduced by. */
2745 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2746 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2747 yystate
= yytable
[yystate
];
2749 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2754 /*--------------------------------------.
2755 | yyerrlab -- here on detecting error. |
2756 `--------------------------------------*/
2758 /* Make sure we have latest lookahead translation. See comments at
2759 user semantic actions for why this is necessary. */
2760 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2762 /* If not already recovering from an error, report this error. */
2766 #if ! YYERROR_VERBOSE
2767 yyerror (&yylloc
, YY_("syntax error"));
2769 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2770 yyesa, &yyes, &yyes_capacity, \
2773 char const *yymsgp
= YY_("syntax error");
2774 int yysyntax_error_status
;
2775 if (yychar
!= YYEMPTY
)
2777 yysyntax_error_status
= YYSYNTAX_ERROR
;
2778 if (yysyntax_error_status
== 0)
2780 else if (yysyntax_error_status
== 1)
2782 if (yymsg
!= yymsgbuf
)
2783 YYSTACK_FREE (yymsg
);
2784 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2788 yymsg_alloc
= sizeof yymsgbuf
;
2789 yysyntax_error_status
= 2;
2793 yysyntax_error_status
= YYSYNTAX_ERROR
;
2797 yyerror (&yylloc
, yymsgp
);
2798 if (yysyntax_error_status
== 2)
2799 goto yyexhaustedlab
;
2801 # undef YYSYNTAX_ERROR
2805 yyerror_range
[1] = yylloc
;
2807 if (yyerrstatus
== 3)
2809 /* If just tried and failed to reuse lookahead token after an
2810 error, discard it. */
2812 if (yychar
<= YYEOF
)
2814 /* Return failure if at end of input. */
2815 if (yychar
== YYEOF
)
2820 yydestruct ("Error: discarding",
2821 yytoken
, &yylval
, &yylloc
);
2826 /* Else will try to reuse lookahead token after shifting the error
2831 /*---------------------------------------------------.
2832 | yyerrorlab -- error raised explicitly by YYERROR. |
2833 `---------------------------------------------------*/
2836 /* Pacify compilers like GCC when the user code never invokes
2837 YYERROR and the label yyerrorlab therefore never appears in user
2839 if (/*CONSTCOND*/ 0)
2842 yyerror_range
[1] = yylsp
[1-yylen
];
2843 /* Do not reclaim the symbols of the rule whose action triggered
2847 YY_STACK_PRINT (yyss
, yyssp
);
2852 /*-------------------------------------------------------------.
2853 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2854 `-------------------------------------------------------------*/
2856 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2860 yyn
= yypact
[yystate
];
2861 if (!yypact_value_is_default (yyn
))
2864 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2872 /* Pop the current state because it cannot handle the error token. */
2876 yyerror_range
[1] = *yylsp
;
2877 yydestruct ("Error: popping",
2878 yystos
[yystate
], yyvsp
, yylsp
);
2881 YY_STACK_PRINT (yyss
, yyssp
);
2884 /* If the stack popping above didn't lose the initial context for the
2885 current lookahead token, the shift below will for sure. */
2886 YY_LAC_DISCARD ("error recovery");
2888 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2890 YY_IGNORE_MAYBE_UNINITIALIZED_END
2892 yyerror_range
[2] = yylloc
;
2893 /* Using YYLLOC is tempting, but would change the location of
2894 the lookahead. YYLOC is available though. */
2895 YYLLOC_DEFAULT (yyloc
, yyerror_range
, 2);
2898 /* Shift the error token. */
2899 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2905 /*-------------------------------------.
2906 | yyacceptlab -- YYACCEPT comes here. |
2907 `-------------------------------------*/
2912 /*-----------------------------------.
2913 | yyabortlab -- YYABORT comes here. |
2914 `-----------------------------------*/
2920 /*-------------------------------------------------.
2921 | yyexhaustedlab -- memory exhaustion comes here. |
2922 `-------------------------------------------------*/
2924 yyerror (&yylloc
, YY_("memory exhausted"));
2930 if (yychar
!= YYEMPTY
)
2932 /* Make sure we have latest lookahead translation. See comments at
2933 user semantic actions for why this is necessary. */
2934 yytoken
= YYTRANSLATE (yychar
);
2935 yydestruct ("Cleanup: discarding lookahead",
2936 yytoken
, &yylval
, &yylloc
);
2938 /* Do not reclaim the symbols of the rule whose action triggered
2939 this YYABORT or YYACCEPT. */
2941 YY_STACK_PRINT (yyss
, yyssp
);
2942 while (yyssp
!= yyss
)
2944 yydestruct ("Cleanup: popping",
2945 yystos
[*yyssp
], yyvsp
, yylsp
);
2950 YYSTACK_FREE (yyss
);
2953 YYSTACK_FREE (yyes
);
2955 if (yymsg
!= yymsgbuf
)
2956 YYSTACK_FREE (yymsg
);
2960 #line 723 "src/parse-gram.y" /* yacc.c:1928 */
2963 /* Return the location of the left-hand side of a rule whose
2964 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2965 the right-hand side, and return an empty location equal to the end
2966 boundary of RHS[0] if the right-hand side is empty. */
2969 lloc_default (YYLTYPE
const *rhs
, int n
)
2974 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2975 The bug is fixed in 7.4.2m, but play it safe for now. */
2976 loc
.start
= rhs
[n
].end
;
2977 loc
.end
= rhs
[n
].end
;
2979 /* Ignore empty nonterminals the start of the right-hand side.
2980 Do not bother to ignore them at the end of the right-hand side,
2981 since empty nonterminals have the same end as their predecessors. */
2982 for (i
= 1; i
<= n
; i
++)
2983 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2985 loc
.start
= rhs
[i
].start
;
2994 add_param (param_type type
, char *decl
, location loc
)
2996 static char const alphanum
[26 + 26 + 1 + 10] =
2997 "abcdefghijklmnopqrstuvwxyz"
2998 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3002 char const *name_start
= NULL
;
3005 /* Stop on last actual character. */
3006 for (p
= decl
; p
[1]; p
++)
3008 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
3009 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
3012 /* Strip the surrounding '{' and '}', and any blanks just inside
3015 while (c_isspace ((unsigned char) *p
))
3019 while (c_isspace ((unsigned char) *decl
))
3024 complain (&loc
, complaint
, _("missing identifier in parameter declaration"));
3027 char *name
= xmemdup0 (name_start
, strspn (name_start
, alphanum
));
3028 if (type
& param_lex
)
3029 muscle_pair_list_grow ("lex_param", decl
, name
);
3030 if (type
& param_parse
)
3031 muscle_pair_list_grow ("parse_param", decl
, name
);
3035 gram_scanner_last_string_free ();
3040 version_check (location
const *loc
, char const *version
)
3042 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
3044 complain (loc
, complaint
, "require bison %s, but have %s",
3045 version
, PACKAGE_VERSION
);
3051 gram_error (location
const *loc
, char const *msg
)
3053 complain (loc
, complaint
, "%s", msg
);
3057 token_name (int type
)
3059 return yytname
[YYTRANSLATE (type
)];
3070 buf
[0] = '\''; buf
[1] = c
; buf
[2] = '\''; buf
[3] = '\0';
3071 return quotearg_style (escape_quoting_style
, buf
);