1/* A Bison parser, made by GNU Bison 3.4.2. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47/* Identify Bison output. */
48#define YYBISON 1
49
50/* Bison version. */
51#define YYBISON_VERSION "3.4.2"
52
53/* Skeleton name. */
54#define YYSKELETON_NAME "yacc.c"
55
56/* Pure parsers. */
57#define YYPURE 2
58
59/* Push parsers. */
60#define YYPUSH 0
61
62/* Pull parsers. */
63#define YYPULL 1
64
65/* "%code top" blocks. */
66#line 27 "src/parse-gram.y"
67
68 /* On column 0 to please syntax-check. */
69#include <config.h>
70
71#line 72 "src/parse-gram.c"
72/* Substitute the type names. */
73#define YYSTYPE GRAM_STYPE
74#define YYLTYPE GRAM_LTYPE
75/* Substitute the variable and function names. */
76#define yyparse gram_parse
77#define yylex gram_lex
78#define yyerror gram_error
79#define yydebug gram_debug
80#define yynerrs gram_nerrs
81
82
83
84# ifndef YY_NULLPTR
85# if defined __cplusplus
86# if 201103L <= __cplusplus
87# define YY_NULLPTR nullptr
88# else
89# define YY_NULLPTR 0
90# endif
91# else
92# define YY_NULLPTR ((void*)0)
93# endif
94# endif
95
96/* Enabling verbose error messages. */
97#ifdef YYERROR_VERBOSE
98# undef YYERROR_VERBOSE
99# define YYERROR_VERBOSE 1
100#else
101# define YYERROR_VERBOSE 1
102#endif
103
104#include "parse-gram.h"
105
106
107/* Unqualified %code blocks. */
108#line 33 "src/parse-gram.y"
109
110 #include "system.h"
111 #include <errno.h>
112
113 #include "c-ctype.h"
114 #include "complain.h"
115 #include "conflicts.h"
116 #include "files.h"
117 #include "getargs.h"
118 #include "gram.h"
119 #include "named-ref.h"
120 #include "quotearg.h"
121 #include "reader.h"
122 #include "scan-code.h"
123 #include "scan-gram.h"
124 #include "vasnprintf.h"
125 #include "xmemdup0.h"
126
127 static int current_prec = 0;
128 static location current_lhs_loc;
129 static named_ref *current_lhs_named_ref;
130 static symbol *current_lhs_symbol;
131 static symbol_class current_class = unknown_sym;
132
133 /** Set the new current left-hand side symbol, possibly common
134 * to several right-hand side parts of rule.
135 */
136 static void current_lhs (symbol *sym, location loc, named_ref *ref);
137
138 #define YYLLOC_DEFAULT(Current, Rhs, N) \
139 (Current) = lloc_default (Rhs, N)
140 static YYLTYPE lloc_default (YYLTYPE const *, int);
141
142 #define YY_LOCATION_PRINT(File, Loc) \
143 location_print (Loc, File)
144
145 /* Strip initial '{' and final '}' (must be first and last characters).
146 Return the result. */
147 static char *strip_braces (char *code);
148
149 /* Convert CODE by calling code_props_plain_init if PLAIN, otherwise
150 code_props_symbol_action_init. Call
151 gram_scanner_last_string_free to release the latest string from
152 the scanner (should be CODE). */
153 static char const *translate_code (char *code, location loc, bool plain);
154
155 /* Convert CODE by calling code_props_plain_init after having
156 stripped the first and last characters (expected to be '{', and
157 '}'). Call gram_scanner_last_string_free to release the latest
158 string from the scanner (should be CODE). */
159 static char const *translate_code_braceless (char *code, location loc);
160
161 /* Handle a %error-verbose directive. */
162 static void handle_error_verbose (location const *loc, char const *directive);
163
164 /* Handle a %file-prefix directive. */
165 static void handle_file_prefix (location const *loc,
166 location const *dir_loc,
167 char const *directive, char const *value);
168
169 /* Handle a %name-prefix directive. */
170 static void handle_name_prefix (location const *loc,
171 char const *directive, char const *value);
172
173 /* Handle a %pure-parser directive. */
174 static void handle_pure_parser (location const *loc, char const *directive);
175
176 /* Handle a %require directive. */
177 static void handle_require (location const *loc, char const *version);
178
179 /* Handle a %skeleton directive. */
180 static void handle_skeleton (location const *loc, char const *skel);
181
182 /* Handle a %yacc directive. */
183 static void handle_yacc (location const *loc, char const *directive);
184
185 static void gram_error (location const *, char const *);
186
187 /* A string that describes a char (e.g., 'a' -> "'a'"). */
188 static char const *char_name (char);
189
190 #define YYTYPE_INT16 int_fast16_t
191 #define YYTYPE_INT8 int_fast8_t
192 #define YYTYPE_UINT16 uint_fast16_t
193 #define YYTYPE_UINT8 uint_fast8_t
194
195 /* Add style to semantic values in traces. */
196 static void tron (FILE *yyo);
197 static void troff (FILE *yyo);
198#line 262 "src/parse-gram.y"
199
200 /** Add a lex-param and/or a parse-param.
201 *
202 * \param type where to push this formal argument.
203 * \param decl the formal argument. Destroyed.
204 * \param loc the location in the source.
205 */
206 static void add_param (param_type type, char *decl, location loc);
207 static param_type current_param = param_none;
208
209#line 210 "src/parse-gram.c"
210
211#ifdef short
212# undef short
213#endif
214
215#ifdef YYTYPE_UINT8
216typedef YYTYPE_UINT8 yytype_uint8;
217#else
218typedef unsigned char yytype_uint8;
219#endif
220
221#ifdef YYTYPE_INT8
222typedef YYTYPE_INT8 yytype_int8;
223#else
224typedef signed char yytype_int8;
225#endif
226
227#ifdef YYTYPE_UINT16
228typedef YYTYPE_UINT16 yytype_uint16;
229#else
230typedef unsigned short yytype_uint16;
231#endif
232
233#ifdef YYTYPE_INT16
234typedef YYTYPE_INT16 yytype_int16;
235#else
236typedef short yytype_int16;
237#endif
238
239#ifndef YYSIZE_T
240# ifdef __SIZE_TYPE__
241# define YYSIZE_T __SIZE_TYPE__
242# elif defined size_t
243# define YYSIZE_T size_t
244# elif ! defined YYSIZE_T
245# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
246# define YYSIZE_T size_t
247# else
248# define YYSIZE_T unsigned
249# endif
250#endif
251
252#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
253
254#ifndef YY_
255# if defined YYENABLE_NLS && YYENABLE_NLS
256# if ENABLE_NLS
257# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
258# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
259# endif
260# endif
261# ifndef YY_
262# define YY_(Msgid) Msgid
263# endif
264#endif
265
266#ifndef YY_ATTRIBUTE
267# if (defined __GNUC__ \
268 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
269 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
270# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
271# else
272# define YY_ATTRIBUTE(Spec) /* empty */
273# endif
274#endif
275
276#ifndef YY_ATTRIBUTE_PURE
277# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
278#endif
279
280#ifndef YY_ATTRIBUTE_UNUSED
281# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
282#endif
283
284/* Suppress unused-variable warnings by "using" E. */
285#if ! defined lint || defined __GNUC__
286# define YYUSE(E) ((void) (E))
287#else
288# define YYUSE(E) /* empty */
289#endif
290
291#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
292/* Suppress an incorrect diagnostic about yylval being uninitialized. */
293# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
294 _Pragma ("GCC diagnostic push") \
295 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
296 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
297# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
298 _Pragma ("GCC diagnostic pop")
299#else
300# define YY_INITIAL_VALUE(Value) Value
301#endif
302#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
303# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
304# define YY_IGNORE_MAYBE_UNINITIALIZED_END
305#endif
306#ifndef YY_INITIAL_VALUE
307# define YY_INITIAL_VALUE(Value) /* Nothing. */
308#endif
309
310
311#define YY_ASSERT(E) ((void) (0 && (E)))
312
313#if 1
314
315/* The parser invokes alloca or malloc; define the necessary symbols. */
316
317# ifdef YYSTACK_ALLOC
318 /* Pacify GCC's 'empty if-body' warning. */
319# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
320# ifndef YYSTACK_ALLOC_MAXIMUM
321 /* The OS might guarantee only one guard page at the bottom of the stack,
322 and a page size can be as small as 4096 bytes. So we cannot safely
323 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
324 to allow for a few compiler-allocated temporary stack slots. */
325# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
326# endif
327# else
328# define YYSTACK_ALLOC YYMALLOC
329# define YYSTACK_FREE YYFREE
330# ifndef YYSTACK_ALLOC_MAXIMUM
331# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
332# endif
333# if (defined __cplusplus && ! defined EXIT_SUCCESS \
334 && ! ((defined YYMALLOC || defined malloc) \
335 && (defined YYFREE || defined free)))
336# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
337# ifndef EXIT_SUCCESS
338# define EXIT_SUCCESS 0
339# endif
340# endif
341# ifndef YYMALLOC
342# define YYMALLOC malloc
343# if ! defined malloc && ! defined EXIT_SUCCESS
344void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
345# endif
346# endif
347# ifndef YYFREE
348# define YYFREE free
349# if ! defined free && ! defined EXIT_SUCCESS
350void free (void *); /* INFRINGES ON USER NAME SPACE */
351# endif
352# endif
353# endif
354# define YYCOPY_NEEDED 1
355#endif
356
357
358#if (! defined yyoverflow \
359 && (! defined __cplusplus \
360 || (defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL \
361 && defined GRAM_STYPE_IS_TRIVIAL && GRAM_STYPE_IS_TRIVIAL)))
362
363/* A type that is properly aligned for any stack member. */
364union yyalloc
365{
366 yytype_int16 yyss_alloc;
367 YYSTYPE yyvs_alloc;
368 YYLTYPE yyls_alloc;
369};
370
371/* The size of the maximum gap between one aligned stack and the next. */
372# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
373
374/* The size of an array large to enough to hold all stacks, each with
375 N elements. */
376# define YYSTACK_BYTES(N) \
377 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
378 + 2 * YYSTACK_GAP_MAXIMUM)
379
380# define YYCOPY_NEEDED 1
381
382/* Relocate STACK from its old location to the new one. The
383 local variables YYSIZE and YYSTACKSIZE give the old and new number of
384 elements in the stack, and YYPTR gives the new location of the
385 stack. Advance YYPTR to a properly aligned location for the next
386 stack. */
387# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
388 do \
389 { \
390 YYSIZE_T yynewbytes; \
391 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
392 Stack = &yyptr->Stack_alloc; \
393 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
394 yyptr += yynewbytes / sizeof (*yyptr); \
395 } \
396 while (0)
397
398#endif
399
400#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
401/* Copy COUNT objects from SRC to DST. The source and destination do
402 not overlap. */
403# ifndef YYCOPY
404# if defined __GNUC__ && 1 < __GNUC__
405# define YYCOPY(Dst, Src, Count) \
406 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
407# else
408# define YYCOPY(Dst, Src, Count) \
409 do \
410 { \
411 YYSIZE_T yyi; \
412 for (yyi = 0; yyi < (Count); yyi++) \
413 (Dst)[yyi] = (Src)[yyi]; \
414 } \
415 while (0)
416# endif
417# endif
418#endif /* !YYCOPY_NEEDED */
419
420/* YYFINAL -- State number of the termination state. */
421#define YYFINAL 3
422/* YYLAST -- Last index in YYTABLE. */
423#define YYLAST 234
424
425/* YYNTOKENS -- Number of terminals. */
426#define YYNTOKENS 60
427/* YYNNTS -- Number of nonterminals. */
428#define YYNNTS 42
429/* YYNRULES -- Number of rules. */
430#define YYNRULES 122
431/* YYNSTATES -- Number of states. */
432#define YYNSTATES 166
433
434#define YYUNDEFTOK 2
435#define YYMAXUTOK 314
436
437/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
438 as returned by yylex, with out-of-bounds checking. */
439#define YYTRANSLATE(YYX) \
440 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
441
442/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
443 as returned by yylex. */
444static const yytype_uint8 yytranslate[] =
445{
446 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
472 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
473 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
474 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
475 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
476 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
477 55, 56, 57, 58, 59
478};
479
480#if GRAM_DEBUG
481 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
482static const yytype_uint16 yyrline[] =
483{
484 0, 294, 294, 303, 304, 308, 309, 315, 319, 324,
485 325, 330, 331, 332, 333, 334, 339, 344, 345, 346,
486 347, 348, 349, 349, 350, 351, 352, 353, 354, 355,
487 356, 357, 361, 362, 371, 372, 376, 387, 391, 395,
488 403, 413, 414, 424, 425, 431, 444, 444, 449, 449,
489 454, 458, 468, 469, 470, 471, 475, 476, 481, 482,
490 486, 487, 491, 492, 493, 506, 515, 519, 523, 531,
491 532, 536, 549, 550, 562, 566, 570, 578, 580, 585,
492 592, 602, 606, 610, 618, 619, 627, 628, 634, 635,
493 636, 643, 643, 651, 652, 653, 658, 661, 663, 665,
494 667, 669, 671, 673, 675, 677, 682, 683, 692, 716,
495 717, 718, 719, 731, 733, 748, 753, 754, 759, 768,
496 769, 773, 774
497};
498#endif
499
500#if GRAM_DEBUG || YYERROR_VERBOSE || 1
501/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
502 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
503static const char *const yytname[] =
504{
505 "\"end of file\"", "error", "$undefined", "\"string\"", "\"%token\"",
506 "\"%nterm\"", "\"%type\"", "\"%destructor\"", "\"%printer\"",
507 "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%precedence\"",
508 "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%code\"",
509 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
510 "\"%expect\"", "\"%expect-rr\"", "\"%<flag>\"", "\"%file-prefix\"",
511 "\"%glr-parser\"", "\"%initial-action\"", "\"%language\"",
512 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
513 "\"%nondeterministic-parser\"", "\"%output\"", "\"%pure-parser\"",
514 "\"%require\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"",
515 "\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"%?{...}\"",
516 "\"[identifier]\"", "\"char\"", "\":\"", "\"epilogue\"", "\"=\"",
517 "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"", "\"%{...%}\"",
518 "\";\"", "\"<tag>\"", "\"<*>\"", "\"<>\"", "\"integer\"", "\"%param\"",
519 "\"%union\"", "\"%empty\"", "$accept", "input", "prologue_declarations",
520 "prologue_declaration", "$@1", "params", "grammar_declaration",
521 "code_props_type", "union_name", "symbol_declaration", "$@2", "$@3",
522 "precedence_declarator", "tag.opt", "generic_symlist",
523 "generic_symlist_item", "tag", "nterm_decls", "token_decls",
524 "token_decl.1", "token_decl", "int.opt", "token_decls_for_prec",
525 "token_decl_for_prec.1", "token_decl_for_prec", "symbol_decls",
526 "symbol_decl.1", "grammar", "rules_or_grammar_declaration", "rules",
527 "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value", "id",
528 "id_colon", "symbol", "string_as_id", "string_as_id.opt", "epilogue.opt", YY_NULLPTR
529};
530#endif
531
532# ifdef YYPRINT
533/* YYTOKNUM[NUM] -- (External) token number corresponding to the
534 (internal) symbol number NUM (which must be that of a token). */
535static const yytype_uint16 yytoknum[] =
536{
537 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
538 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
539 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
540 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
541 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
542 305, 306, 307, 308, 309, 310, 311, 312, 313, 314
543};
544# endif
545
546#define YYPACT_NINF -130
547
548#define yypact_value_is_default(Yystate) \
549 (!!((Yystate) == (-130)))
550
551#define YYTABLE_NINF -122
552
553#define yytable_value_is_error(Yytable_value) \
554 0
555
556 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
557 STATE-NUM. */
558static const yytype_int16 yypact[] =
559{
560 -130, 36, 110, -130, -22, -130, -130, 2, -130, -130,
561 -130, -130, -130, -130, -19, -130, -9, 40, -130, -17,
562 -2, -130, 57, -130, 21, 66, 77, -130, -130, -130,
563 78, -130, 87, 92, 44, -130, -130, -130, 165, -130,
564 -130, -130, 50, -130, -130, 58, -130, 29, -130, 15,
565 15, -130, -130, -130, 44, 47, 44, -130, -130, -130,
566 -130, 61, -130, 30, -130, -130, -130, -130, -130, -130,
567 -130, -130, -130, -130, -130, 51, -130, 53, 8, -130,
568 -130, 64, 67, -130, 68, 20, 44, 56, 44, -130,
569 69, -130, -37, 59, -37, -130, 69, -130, 59, 44,
570 44, -130, -130, -130, -130, -130, -130, -130, -130, 79,
571 -130, -130, -130, -130, -130, 111, -130, -130, -130, -130,
572 20, -130, -130, -130, 44, 44, -130, -130, -130, -37,
573 -37, -130, 147, 44, -130, 108, -130, -130, 44, -37,
574 -130, -130, -130, -21, 175, -130, -130, 44, 97, 101,
575 99, 100, -130, -130, -130, 117, 64, 175, -130, -130,
576 -130, -130, -130, 64, -130, -130
577};
578
579 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
580 Performed when YYTABLE does not specify something else to do. Zero
581 means the default is an error. */
582static const yytype_uint8 yydefact[] =
583{
584 3, 0, 0, 1, 0, 48, 46, 0, 41, 42,
585 52, 53, 54, 55, 0, 37, 0, 9, 11, 0,
586 0, 7, 0, 15, 0, 0, 0, 38, 19, 20,
587 0, 24, 0, 0, 0, 27, 28, 29, 0, 6,
588 31, 22, 43, 4, 5, 0, 34, 0, 30, 0,
589 0, 118, 114, 113, 0, 50, 81, 116, 84, 117,
590 39, 0, 108, 109, 10, 12, 13, 14, 16, 17,
591 18, 21, 25, 26, 35, 0, 115, 0, 0, 86,
592 88, 106, 0, 44, 0, 0, 0, 51, 74, 77,
593 72, 80, 0, 49, 66, 69, 72, 47, 65, 82,
594 0, 85, 40, 111, 112, 110, 8, 90, 89, 0,
595 87, 2, 107, 91, 33, 23, 45, 62, 63, 64,
596 36, 58, 61, 60, 75, 0, 78, 73, 79, 67,
597 0, 70, 119, 83, 122, 0, 32, 59, 76, 68,
598 120, 71, 96, 92, 93, 96, 95, 0, 0, 0,
599 0, 0, 99, 57, 100, 0, 106, 94, 101, 102,
600 103, 104, 105, 106, 97, 98
601};
602
603 /* YYPGOTO[NTERM-NUM]. */
604static const yytype_int16 yypgoto[] =
605{
606 -130, -130, -130, -130, -130, -130, 156, -130, -130, -130,
607 -130, -130, -130, -130, -130, 43, -130, -130, 114, -66,
608 -35, 83, -130, -84, -53, -130, -47, -130, 82, -130,
609 -130, -130, 35, -129, -130, -130, -46, -130, -34, -36,
610 -130, -130
611};
612
613 /* YYDEFGOTO[NTERM-NUM]. */
614static const yytype_int16 yydefgoto[] =
615{
616 -1, 1, 2, 43, 82, 115, 77, 45, 84, 46,
617 50, 49, 47, 155, 120, 121, 122, 97, 93, 94,
618 95, 128, 87, 88, 89, 55, 56, 78, 79, 80,
619 135, 143, 144, 113, 63, 106, 57, 81, 58, 59,
620 141, 111
621};
622
623 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
624 positive, shift that token. If negative, reduce the rule whose
625 number is the opposite. If YYTABLE_NINF, syntax error. */
626static const yytype_int16 yytable[] =
627{
628 74, 90, 124, 96, 96, 51, 52, 99, -121, 75,
629 53, 91, 5, 6, 7, 8, 9, 10, 11, 12,
630 13, 60, 101, 51, 14, 15, 129, 164, 61, 145,
631 48, 146, 51, 103, 165, 126, 3, 27, 62, 65,
632 90, 138, 90, 64, 34, 52, 96, 51, 96, 53,
633 91, 123, 91, 133, 66, 54, 76, 109, 52, 131,
634 67, 68, 53, 52, 139, 101, 42, 53, 92, 69,
635 104, 126, 52, 117, 118, 119, 53, 105, 90, 90,
636 70, 71, 86, 96, 96, 126, 123, 52, 91, 91,
637 72, 53, 90, 96, 131, 73, 140, 83, 85, 101,
638 100, 102, 91, 107, 131, 108, 112, 114, 116, 125,
639 156, 4, 130, 158, 5, 6, 7, 8, 9, 10,
640 11, 12, 13, 156, 134, 127, 14, 15, 16, 17,
641 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
642 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
643 51, 136, 142, 159, 160, 161, 162, 163, 44, 38,
644 110, 39, 40, 137, 98, 0, 75, 41, 42, 5,
645 6, 7, 8, 9, 10, 11, 12, 13, 51, 132,
646 157, 14, 15, 0, 0, 0, 0, 0, 147, 148,
647 149, 0, 0, 0, 27, 0, 150, 151, 0, 0,
648 0, 34, 0, 0, 0, 0, 0, 0, 0, 0,
649 0, 0, 0, 76, 0, -56, 152, 0, 52, 0,
650 0, 0, 53, 42, 0, 0, 0, 0, 153, 0,
651 0, 0, 0, 0, 154
652};
653
654static const yytype_int16 yycheck[] =
655{
656 34, 47, 86, 49, 50, 3, 43, 54, 0, 1,
657 47, 47, 4, 5, 6, 7, 8, 9, 10, 11,
658 12, 40, 56, 3, 16, 17, 92, 156, 47, 50,
659 52, 52, 3, 3, 163, 88, 0, 29, 47, 56,
660 86, 125, 88, 3, 36, 43, 92, 3, 94, 47,
661 86, 85, 88, 100, 56, 53, 48, 49, 43, 94,
662 3, 40, 47, 43, 130, 99, 58, 47, 53, 3,
663 40, 124, 43, 53, 54, 55, 47, 47, 124, 125,
664 3, 3, 53, 129, 130, 138, 120, 43, 124, 125,
665 3, 47, 138, 139, 129, 3, 132, 47, 40, 133,
666 53, 40, 138, 52, 139, 52, 42, 40, 40, 53,
667 144, 1, 53, 147, 4, 5, 6, 7, 8, 9,
668 10, 11, 12, 157, 45, 56, 16, 17, 18, 19,
669 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
670 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
671 3, 40, 44, 56, 53, 56, 56, 40, 2, 49,
672 78, 51, 52, 120, 50, -1, 1, 57, 58, 4,
673 5, 6, 7, 8, 9, 10, 11, 12, 3, 96,
674 145, 16, 17, -1, -1, -1, -1, -1, 13, 14,
675 15, -1, -1, -1, 29, -1, 21, 22, -1, -1,
676 -1, 36, -1, -1, -1, -1, -1, -1, -1, -1,
677 -1, -1, -1, 48, -1, 40, 41, -1, 43, -1,
678 -1, -1, 47, 58, -1, -1, -1, -1, 53, -1,
679 -1, -1, -1, -1, 59
680};
681
682 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
683 symbol of state STATE-NUM. */
684static const yytype_uint8 yystos[] =
685{
686 0, 61, 62, 0, 1, 4, 5, 6, 7, 8,
687 9, 10, 11, 12, 16, 17, 18, 19, 20, 21,
688 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
689 32, 33, 34, 35, 36, 37, 38, 39, 49, 51,
690 52, 57, 58, 63, 66, 67, 69, 72, 52, 71,
691 70, 3, 43, 47, 53, 85, 86, 96, 98, 99,
692 40, 47, 47, 94, 3, 56, 56, 3, 40, 3,
693 3, 3, 3, 3, 98, 1, 48, 66, 87, 88,
694 89, 97, 64, 47, 68, 40, 53, 82, 83, 84,
695 96, 99, 53, 78, 79, 80, 96, 77, 78, 86,
696 53, 98, 40, 3, 40, 47, 95, 52, 52, 49,
697 88, 101, 42, 93, 40, 65, 40, 53, 54, 55,
698 74, 75, 76, 98, 83, 53, 84, 56, 81, 79,
699 53, 80, 81, 86, 45, 90, 40, 75, 83, 79,
700 99, 100, 44, 91, 92, 50, 52, 13, 14, 15,
701 21, 22, 41, 53, 59, 73, 98, 92, 98, 56,
702 53, 56, 56, 40, 93, 93
703};
704
705 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
706static const yytype_uint8 yyr1[] =
707{
708 0, 60, 61, 62, 62, 63, 63, 63, 63, 63,
709 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
710 63, 63, 64, 63, 63, 63, 63, 63, 63, 63,
711 63, 63, 65, 65, 66, 66, 66, 66, 66, 66,
712 66, 67, 67, 68, 68, 66, 70, 69, 71, 69,
713 69, 69, 72, 72, 72, 72, 73, 73, 74, 74,
714 75, 75, 76, 76, 76, 77, 78, 78, 78, 79,
715 79, 80, 81, 81, 82, 82, 82, 83, 83, 84,
716 84, 85, 85, 85, 86, 86, 87, 87, 88, 88,
717 88, 90, 89, 91, 91, 91, 92, 92, 92, 92,
718 92, 92, 92, 92, 92, 92, 93, 93, 94, 95,
719 95, 95, 95, 96, 96, 97, 98, 98, 99, 100,
720 100, 101, 101
721};
722
723 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
724static const yytype_uint8 yyr2[] =
725{
726 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
727 2, 1, 2, 2, 2, 1, 2, 2, 2, 1,
728 1, 2, 0, 3, 1, 2, 2, 1, 1, 1,
729 2, 1, 2, 1, 1, 2, 3, 1, 1, 2,
730 3, 1, 1, 0, 1, 3, 0, 3, 0, 3,
731 2, 2, 1, 1, 1, 1, 0, 1, 1, 2,
732 1, 1, 1, 1, 1, 1, 1, 2, 3, 1,
733 2, 3, 0, 1, 1, 2, 3, 1, 2, 2,
734 1, 1, 2, 3, 1, 2, 1, 2, 1, 2,
735 2, 0, 5, 1, 3, 2, 0, 3, 4, 2,
736 2, 3, 3, 3, 3, 3, 0, 1, 1, 0,
737 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
738 1, 0, 2
739};
740
741
742#define yyerrok (yyerrstatus = 0)
743#define yyclearin (yychar = YYEMPTY)
744#define YYEMPTY (-2)
745#define YYEOF 0
746
747#define YYACCEPT goto yyacceptlab
748#define YYABORT goto yyabortlab
749#define YYERROR goto yyerrorlab
750
751
752#define YYRECOVERING() (!!yyerrstatus)
753
754#define YYBACKUP(Token, Value) \
755 do \
756 if (yychar == YYEMPTY) \
757 { \
758 yychar = (Token); \
759 yylval = (Value); \
760 YYPOPSTACK (yylen); \
761 yystate = *yyssp; \
762 YY_LAC_DISCARD ("YYBACKUP"); \
763 goto yybackup; \
764 } \
765 else \
766 { \
767 yyerror (&yylloc, YY_("syntax error: cannot back up")); \
768 YYERROR; \
769 } \
770 while (0)
771
772/* Error token number */
773#define YYTERROR 1
774#define YYERRCODE 256
775
776
777/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
778 If N is 0, then set CURRENT to the empty location which ends
779 the previous symbol: RHS[0] (always defined). */
780
781#ifndef YYLLOC_DEFAULT
782# define YYLLOC_DEFAULT(Current, Rhs, N) \
783 do \
784 if (N) \
785 { \
786 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
787 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
788 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
789 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
790 } \
791 else \
792 { \
793 (Current).first_line = (Current).last_line = \
794 YYRHSLOC (Rhs, 0).last_line; \
795 (Current).first_column = (Current).last_column = \
796 YYRHSLOC (Rhs, 0).last_column; \
797 } \
798 while (0)
799#endif
800
801#define YYRHSLOC(Rhs, K) ((Rhs)[K])
802
803
804/* Enable debugging if requested. */
805#if GRAM_DEBUG
806
807# ifndef YYFPRINTF
808# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
809# define YYFPRINTF fprintf
810# endif
811
812# define YYDPRINTF(Args) \
813do { \
814 if (yydebug) \
815 YYFPRINTF Args; \
816} while (0)
817
818
819/* YY_LOCATION_PRINT -- Print the location on the stream.
820 This macro was not mandated originally: define only if we know
821 we won't break user code: when these are the locations we know. */
822
823#ifndef YY_LOCATION_PRINT
824# if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
825
826/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
827
828YY_ATTRIBUTE_UNUSED
829static int
830yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
831{
832 int res = 0;
833 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
834 if (0 <= yylocp->first_line)
835 {
836 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
837 if (0 <= yylocp->first_column)
838 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
839 }
840 if (0 <= yylocp->last_line)
841 {
842 if (yylocp->first_line < yylocp->last_line)
843 {
844 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
845 if (0 <= end_col)
846 res += YYFPRINTF (yyo, ".%d", end_col);
847 }
848 else if (0 <= end_col && yylocp->first_column < end_col)
849 res += YYFPRINTF (yyo, "-%d", end_col);
850 }
851 return res;
852 }
853
854# define YY_LOCATION_PRINT(File, Loc) \
855 yy_location_print_ (File, &(Loc))
856
857# else
858# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
859# endif
860#endif
861
862
863# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
864do { \
865 if (yydebug) \
866 { \
867 YYFPRINTF (stderr, "%s ", Title); \
868 yy_symbol_print (stderr, \
869 Type, Value, Location); \
870 YYFPRINTF (stderr, "\n"); \
871 } \
872} while (0)
873
874
875/*-----------------------------------.
876| Print this symbol's value on YYO. |
877`-----------------------------------*/
878
879static void
880yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
881{
882 FILE *yyoutput = yyo;
883 YYUSE (yyoutput);
884 YYUSE (yylocationp);
885 if (!yyvaluep)
886 return;
887# ifdef YYPRINT
888 if (yytype < YYNTOKENS)
889 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
890# endif
891/* "%code pre-printer" blocks. */
892#line 214 "src/parse-gram.y"
893tron (yyo);
894
895#line 896 "src/parse-gram.c"
896 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
897 switch (yytype)
898 {
899 case 3: /* "string" */
900#line 221 "src/parse-gram.y"
901 { fputs (((*yyvaluep).STRING), yyo); }
902#line 903 "src/parse-gram.c"
903 break;
904
905 case 20: /* "%error-verbose" */
906#line 228 "src/parse-gram.y"
907 { fputs (((*yyvaluep).PERCENT_ERROR_VERBOSE), yyo); }
908#line 909 "src/parse-gram.c"
909 break;
910
911 case 23: /* "%<flag>" */
912#line 231 "src/parse-gram.y"
913 { fprintf (yyo, "%%%s", ((*yyvaluep).PERCENT_FLAG)); }
914#line 915 "src/parse-gram.c"
915 break;
916
917 case 24: /* "%file-prefix" */
918#line 228 "src/parse-gram.y"
919 { fputs (((*yyvaluep).PERCENT_FILE_PREFIX), yyo); }
920#line 921 "src/parse-gram.c"
921 break;
922
923 case 28: /* "%name-prefix" */
924#line 228 "src/parse-gram.y"
925 { fputs (((*yyvaluep).PERCENT_NAME_PREFIX), yyo); }
926#line 927 "src/parse-gram.c"
927 break;
928
929 case 33: /* "%pure-parser" */
930#line 228 "src/parse-gram.y"
931 { fputs (((*yyvaluep).PERCENT_PURE_PARSER), yyo); }
932#line 933 "src/parse-gram.c"
933 break;
934
935 case 39: /* "%yacc" */
936#line 228 "src/parse-gram.y"
937 { fputs (((*yyvaluep).PERCENT_YACC), yyo); }
938#line 939 "src/parse-gram.c"
939 break;
940
941 case 40: /* "{...}" */
942#line 221 "src/parse-gram.y"
943 { fputs (((*yyvaluep).BRACED_CODE), yyo); }
944#line 945 "src/parse-gram.c"
945 break;
946
947 case 41: /* "%?{...}" */
948#line 221 "src/parse-gram.y"
949 { fputs (((*yyvaluep).BRACED_PREDICATE), yyo); }
950#line 951 "src/parse-gram.c"
951 break;
952
953 case 42: /* "[identifier]" */
954#line 229 "src/parse-gram.y"
955 { fprintf (yyo, "[%s]", ((*yyvaluep).BRACKETED_ID)); }
956#line 957 "src/parse-gram.c"
957 break;
958
959 case 43: /* "char" */
960#line 218 "src/parse-gram.y"
961 { fputs (char_name (((*yyvaluep).CHAR)), yyo); }
962#line 963 "src/parse-gram.c"
963 break;
964
965 case 45: /* "epilogue" */
966#line 221 "src/parse-gram.y"
967 { fputs (((*yyvaluep).EPILOGUE), yyo); }
968#line 969 "src/parse-gram.c"
969 break;
970
971 case 47: /* "identifier" */
972#line 228 "src/parse-gram.y"
973 { fputs (((*yyvaluep).ID), yyo); }
974#line 975 "src/parse-gram.c"
975 break;
976
977 case 48: /* "identifier:" */
978#line 230 "src/parse-gram.y"
979 { fprintf (yyo, "%s:", ((*yyvaluep).ID_COLON)); }
980#line 981 "src/parse-gram.c"
981 break;
982
983 case 51: /* "%{...%}" */
984#line 221 "src/parse-gram.y"
985 { fputs (((*yyvaluep).PROLOGUE), yyo); }
986#line 987 "src/parse-gram.c"
987 break;
988
989 case 53: /* "<tag>" */
990#line 232 "src/parse-gram.y"
991 { fprintf (yyo, "<%s>", ((*yyvaluep).TAG)); }
992#line 993 "src/parse-gram.c"
993 break;
994
995 case 56: /* "integer" */
996#line 235 "src/parse-gram.y"
997 { fprintf (yyo, "%d", ((*yyvaluep).INT)); }
998#line 999 "src/parse-gram.c"
999 break;
1000
1001 case 57: /* "%param" */
1002#line 274 "src/parse-gram.y"
1003 {
1004 switch (((*yyvaluep).PERCENT_PARAM))
1005 {
1006#define CASE(In, Out) \
1007 case param_ ## In: fputs ("%" #Out, yyo); break
1008 CASE (lex, lex-param);
1009 CASE (parse, parse-param);
1010 CASE (both, param);
1011#undef CASE
1012 case param_none: aver (false); break;
1013 }
1014}
1015#line 1016 "src/parse-gram.c"
1016 break;
1017
1018 case 67: /* code_props_type */
1019#line 411 "src/parse-gram.y"
1020 { fprintf (yyo, "%s", code_props_type_string (((*yyvaluep).code_props_type))); }
1021#line 1022 "src/parse-gram.c"
1022 break;
1023
1024 case 73: /* tag.opt */
1025#line 228 "src/parse-gram.y"
1026 { fputs (((*yyvaluep).yytype_73), yyo); }
1027#line 1028 "src/parse-gram.c"
1028 break;
1029
1030 case 74: /* generic_symlist */
1031#line 244 "src/parse-gram.y"
1032 { symbol_list_syms_print (((*yyvaluep).generic_symlist), yyo); }
1033#line 1034 "src/parse-gram.c"
1034 break;
1035
1036 case 75: /* generic_symlist_item */
1037#line 244 "src/parse-gram.y"
1038 { symbol_list_syms_print (((*yyvaluep).generic_symlist_item), yyo); }
1039#line 1040 "src/parse-gram.c"
1040 break;
1041
1042 case 76: /* tag */
1043#line 232 "src/parse-gram.y"
1044 { fprintf (yyo, "<%s>", ((*yyvaluep).tag)); }
1045#line 1046 "src/parse-gram.c"
1046 break;
1047
1048 case 77: /* nterm_decls */
1049#line 244 "src/parse-gram.y"
1050 { symbol_list_syms_print (((*yyvaluep).nterm_decls), yyo); }
1051#line 1052 "src/parse-gram.c"
1052 break;
1053
1054 case 78: /* token_decls */
1055#line 244 "src/parse-gram.y"
1056 { symbol_list_syms_print (((*yyvaluep).token_decls), yyo); }
1057#line 1058 "src/parse-gram.c"
1058 break;
1059
1060 case 79: /* token_decl.1 */
1061#line 244 "src/parse-gram.y"
1062 { symbol_list_syms_print (((*yyvaluep).yytype_79), yyo); }
1063#line 1064 "src/parse-gram.c"
1064 break;
1065
1066 case 80: /* token_decl */
1067#line 238 "src/parse-gram.y"
1068 { fprintf (yyo, "%s", ((*yyvaluep).token_decl) ? ((*yyvaluep).token_decl)->tag : "<NULL>"); }
1069#line 1070 "src/parse-gram.c"
1070 break;
1071
1072 case 81: /* int.opt */
1073#line 235 "src/parse-gram.y"
1074 { fprintf (yyo, "%d", ((*yyvaluep).yytype_81)); }
1075#line 1076 "src/parse-gram.c"
1076 break;
1077
1078 case 82: /* token_decls_for_prec */
1079#line 244 "src/parse-gram.y"
1080 { symbol_list_syms_print (((*yyvaluep).token_decls_for_prec), yyo); }
1081#line 1082 "src/parse-gram.c"
1082 break;
1083
1084 case 83: /* token_decl_for_prec.1 */
1085#line 244 "src/parse-gram.y"
1086 { symbol_list_syms_print (((*yyvaluep).yytype_83), yyo); }
1087#line 1088 "src/parse-gram.c"
1088 break;
1089
1090 case 84: /* token_decl_for_prec */
1091#line 238 "src/parse-gram.y"
1092 { fprintf (yyo, "%s", ((*yyvaluep).token_decl_for_prec) ? ((*yyvaluep).token_decl_for_prec)->tag : "<NULL>"); }
1093#line 1094 "src/parse-gram.c"
1094 break;
1095
1096 case 85: /* symbol_decls */
1097#line 244 "src/parse-gram.y"
1098 { symbol_list_syms_print (((*yyvaluep).symbol_decls), yyo); }
1099#line 1100 "src/parse-gram.c"
1100 break;
1101
1102 case 86: /* symbol_decl.1 */
1103#line 244 "src/parse-gram.y"
1104 { symbol_list_syms_print (((*yyvaluep).yytype_86), yyo); }
1105#line 1106 "src/parse-gram.c"
1106 break;
1107
1108 case 94: /* variable */
1109#line 228 "src/parse-gram.y"
1110 { fputs (((*yyvaluep).variable), yyo); }
1111#line 1112 "src/parse-gram.c"
1112 break;
1113
1114 case 95: /* value */
1115#line 706 "src/parse-gram.y"
1116 {
1117 switch (((*yyvaluep).value).kind)
1118 {
1119 case muscle_code: fprintf (yyo, "{%s}", ((*yyvaluep).value).chars); break;
1120 case muscle_keyword: fprintf (yyo, "%s", ((*yyvaluep).value).chars); break;
1121 case muscle_string: fprintf (yyo, "\"%s\"", ((*yyvaluep).value).chars); break;
1122 }
1123}
1124#line 1125 "src/parse-gram.c"
1125 break;
1126
1127 case 96: /* id */
1128#line 238 "src/parse-gram.y"
1129 { fprintf (yyo, "%s", ((*yyvaluep).id) ? ((*yyvaluep).id)->tag : "<NULL>"); }
1130#line 1131 "src/parse-gram.c"
1131 break;
1132
1133 case 97: /* id_colon */
1134#line 239 "src/parse-gram.y"
1135 { fprintf (yyo, "%s:", ((*yyvaluep).id_colon)->tag); }
1136#line 1137 "src/parse-gram.c"
1137 break;
1138
1139 case 98: /* symbol */
1140#line 238 "src/parse-gram.y"
1141 { fprintf (yyo, "%s", ((*yyvaluep).symbol) ? ((*yyvaluep).symbol)->tag : "<NULL>"); }
1142#line 1143 "src/parse-gram.c"
1143 break;
1144
1145 case 99: /* string_as_id */
1146#line 238 "src/parse-gram.y"
1147 { fprintf (yyo, "%s", ((*yyvaluep).string_as_id) ? ((*yyvaluep).string_as_id)->tag : "<NULL>"); }
1148#line 1149 "src/parse-gram.c"
1149 break;
1150
1151 case 100: /* string_as_id.opt */
1152#line 238 "src/parse-gram.y"
1153 { fprintf (yyo, "%s", ((*yyvaluep).yytype_100) ? ((*yyvaluep).yytype_100)->tag : "<NULL>"); }
1154#line 1155 "src/parse-gram.c"
1155 break;
1156
1157 default:
1158 break;
1159 }
1160 YY_IGNORE_MAYBE_UNINITIALIZED_END
1161/* "%code post-printer" blocks. */
1162#line 215 "src/parse-gram.y"
1163troff (yyo);
1164
1165#line 1166 "src/parse-gram.c"
1166}
1167
1168
1169/*---------------------------.
1170| Print this symbol on YYO. |
1171`---------------------------*/
1172
1173static void
1174yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1175{
1176 YYFPRINTF (yyo, "%s %s (",
1177 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1178
1179 YY_LOCATION_PRINT (yyo, *yylocationp);
1180 YYFPRINTF (yyo, ": ");
1181 yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp);
1182 YYFPRINTF (yyo, ")");
1183}
1184
1185/*------------------------------------------------------------------.
1186| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1187| TOP (included). |
1188`------------------------------------------------------------------*/
1189
1190static void
1191yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1192{
1193 YYFPRINTF (stderr, "Stack now");
1194 for (; yybottom <= yytop; yybottom++)
1195 {
1196 int yybot = *yybottom;
1197 YYFPRINTF (stderr, " %d", yybot);
1198 }
1199 YYFPRINTF (stderr, "\n");
1200}
1201
1202# define YY_STACK_PRINT(Bottom, Top) \
1203do { \
1204 if (yydebug) \
1205 yy_stack_print ((Bottom), (Top)); \
1206} while (0)
1207
1208
1209/*------------------------------------------------.
1210| Report that the YYRULE is going to be reduced. |
1211`------------------------------------------------*/
1212
1213static void
1214yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1215{
1216 unsigned long yylno = yyrline[yyrule];
1217 int yynrhs = yyr2[yyrule];
1218 int yyi;
1219 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1220 yyrule - 1, yylno);
1221 /* The symbols being reduced. */
1222 for (yyi = 0; yyi < yynrhs; yyi++)
1223 {
1224 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1225 yy_symbol_print (stderr,
1226 yystos[yyssp[yyi + 1 - yynrhs]],
1227 &yyvsp[(yyi + 1) - (yynrhs)]
1228 , &(yylsp[(yyi + 1) - (yynrhs)]) );
1229 YYFPRINTF (stderr, "\n");
1230 }
1231}
1232
1233# define YY_REDUCE_PRINT(Rule) \
1234do { \
1235 if (yydebug) \
1236 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1237} while (0)
1238
1239/* Nonzero means print parse trace. It is left uninitialized so that
1240 multiple parsers can coexist. */
1241int yydebug;
1242#else /* !GRAM_DEBUG */
1243# define YYDPRINTF(Args)
1244# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1245# define YY_STACK_PRINT(Bottom, Top)
1246# define YY_REDUCE_PRINT(Rule)
1247#endif /* !GRAM_DEBUG */
1248
1249
1250/* YYINITDEPTH -- initial size of the parser's stacks. */
1251#ifndef YYINITDEPTH
1252# define YYINITDEPTH 200
1253#endif
1254
1255/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1256 if the built-in stack extension method is used).
1257
1258 Do not make this value too large; the results are undefined if
1259 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1260 evaluated with infinite-precision integer arithmetic. */
1261
1262#ifndef YYMAXDEPTH
1263# define YYMAXDEPTH 10000
1264#endif
1265
1266/* Given a state stack such that *YYBOTTOM is its bottom, such that
1267 *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
1268 stack, and such that *YYCAPACITY is the maximum number of elements it
1269 can hold without a reallocation, make sure there is enough room to
1270 store YYADD more elements. If not, allocate a new stack using
1271 YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
1272 *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
1273 location. If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
1274 using YYSTACK_FREE. Return 0 if successful or if no reallocation is
1275 required. Return 1 if memory is exhausted. */
1276static int
1277yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
1278#if GRAM_DEBUG
1279 char const *yydebug_prefix,
1280 char const *yydebug_suffix,
1281#endif
1282 yytype_int16 **yybottom,
1283 yytype_int16 *yybottom_no_free,
1284 yytype_int16 **yytop, yytype_int16 *yytop_empty)
1285{
1286 YYSIZE_T yysize_old =
1287 (YYSIZE_T) (*yytop == yytop_empty ? 0 : *yytop - *yybottom + 1);
1288 YYSIZE_T yysize_new = yysize_old + yyadd;
1289 if (*yycapacity < yysize_new)
1290 {
1291 YYSIZE_T yyalloc = 2 * yysize_new;
1292 yytype_int16 *yybottom_new;
1293 /* Use YYMAXDEPTH for maximum stack size given that the stack
1294 should never need to grow larger than the main state stack
1295 needs to grow without LAC. */
1296 if (YYMAXDEPTH < yysize_new)
1297 {
1298 YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix,
1299 yydebug_suffix));
1300 return 1;
1301 }
1302 if (YYMAXDEPTH < yyalloc)
1303 yyalloc = YYMAXDEPTH;
1304 yybottom_new =
1305 (yytype_int16*) YYSTACK_ALLOC (yyalloc * sizeof *yybottom_new);
1306 if (!yybottom_new)
1307 {
1308 YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
1309 yydebug_suffix));
1310 return 1;
1311 }
1312 if (*yytop != yytop_empty)
1313 {
1314 YYCOPY (yybottom_new, *yybottom, yysize_old);
1315 *yytop = yybottom_new + (yysize_old - 1);
1316 }
1317 if (*yybottom != yybottom_no_free)
1318 YYSTACK_FREE (*yybottom);
1319 *yybottom = yybottom_new;
1320 *yycapacity = yyalloc;
1321 }
1322 return 0;
1323}
1324
1325/* Establish the initial context for the current lookahead if no initial
1326 context is currently established.
1327
1328 We define a context as a snapshot of the parser stacks. We define
1329 the initial context for a lookahead as the context in which the
1330 parser initially examines that lookahead in order to select a
1331 syntactic action. Thus, if the lookahead eventually proves
1332 syntactically unacceptable (possibly in a later context reached via a
1333 series of reductions), the initial context can be used to determine
1334 the exact set of tokens that would be syntactically acceptable in the
1335 lookahead's place. Moreover, it is the context after which any
1336 further semantic actions would be erroneous because they would be
1337 determined by a syntactically unacceptable token.
1338
1339 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
1340 performed in an inconsistent state (which, for the purposes of LAC,
1341 includes consistent states that don't know they're consistent because
1342 their default reductions have been disabled). Iff there is a
1343 lookahead token, it should also be invoked before reporting a syntax
1344 error. This latter case is for the sake of the debugging output.
1345
1346 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
1347 follows. If no initial context is currently established for the
1348 current lookahead, then check if that lookahead can eventually be
1349 shifted if syntactic actions continue from the current context.
1350 Report a syntax error if it cannot. */
1351#define YY_LAC_ESTABLISH \
1352do { \
1353 if (!yy_lac_established) \
1354 { \
1355 YYDPRINTF ((stderr, \
1356 "LAC: initial context established for %s\n", \
1357 yytname[yytoken])); \
1358 yy_lac_established = 1; \
1359 { \
1360 int yy_lac_status = \
1361 yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken); \
1362 if (yy_lac_status == 2) \
1363 goto yyexhaustedlab; \
1364 if (yy_lac_status == 1) \
1365 goto yyerrlab; \
1366 } \
1367 } \
1368} while (0)
1369
1370/* Discard any previous initial lookahead context because of Event,
1371 which may be a lookahead change or an invalidation of the currently
1372 established initial context for the current lookahead.
1373
1374 The most common example of a lookahead change is a shift. An example
1375 of both cases is syntax error recovery. That is, a syntax error
1376 occurs when the lookahead is syntactically erroneous for the
1377 currently established initial context, so error recovery manipulates
1378 the parser stacks to try to find a new initial context in which the
1379 current lookahead is syntactically acceptable. If it fails to find
1380 such a context, it discards the lookahead. */
1381#if GRAM_DEBUG
1382# define YY_LAC_DISCARD(Event) \
1383do { \
1384 if (yy_lac_established) \
1385 { \
1386 if (yydebug) \
1387 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
1388 Event "\n"); \
1389 yy_lac_established = 0; \
1390 } \
1391} while (0)
1392#else
1393# define YY_LAC_DISCARD(Event) yy_lac_established = 0
1394#endif
1395
1396/* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1397 eventually (after perhaps some reductions) be shifted, return 1 if
1398 not, or return 2 if memory is exhausted. As preconditions and
1399 postconditions: *YYES_CAPACITY is the allocated size of the array to
1400 which *YYES points, and either *YYES = YYESA or *YYES points to an
1401 array allocated with YYSTACK_ALLOC. yy_lac may overwrite the
1402 contents of either array, alter *YYES and *YYES_CAPACITY, and free
1403 any old *YYES other than YYESA. */
1404static int
1405yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
1406 YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
1407{
1408 yytype_int16 *yyes_prev = yyssp;
1409 yytype_int16 *yyesp = yyes_prev;
1410 YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yytname[yytoken]));
1411 if (yytoken == YYUNDEFTOK)
1412 {
1413 YYDPRINTF ((stderr, " Always Err\n"));
1414 return 1;
1415 }
1416 while (1)
1417 {
1418 int yyrule = yypact[*yyesp];
1419 if (yypact_value_is_default (yyrule)
1420 || (yyrule += yytoken) < 0 || YYLAST < yyrule
1421 || yycheck[yyrule] != yytoken)
1422 {
1423 yyrule = yydefact[*yyesp];
1424 if (yyrule == 0)
1425 {
1426 YYDPRINTF ((stderr, " Err\n"));
1427 return 1;
1428 }
1429 }
1430 else
1431 {
1432 yyrule = yytable[yyrule];
1433 if (yytable_value_is_error (yyrule))
1434 {
1435 YYDPRINTF ((stderr, " Err\n"));
1436 return 1;
1437 }
1438 if (0 < yyrule)
1439 {
1440 YYDPRINTF ((stderr, " S%d\n", yyrule));
1441 return 0;
1442 }
1443 yyrule = -yyrule;
1444 }
1445 {
1446 YYSIZE_T yylen = yyr2[yyrule];
1447 YYDPRINTF ((stderr, " R%d", yyrule - 1));
1448 if (yyesp != yyes_prev)
1449 {
1450 YYSIZE_T yysize = (YYSIZE_T) (yyesp - *yyes + 1);
1451 if (yylen < yysize)
1452 {
1453 yyesp -= yylen;
1454 yylen = 0;
1455 }
1456 else
1457 {
1458 yylen -= yysize;
1459 yyesp = yyes_prev;
1460 }
1461 }
1462 if (yylen)
1463 yyesp = yyes_prev -= yylen;
1464 }
1465 {
1466 yytype_int16 yystate;
1467 {
1468 const int yylhs = yyr1[yyrule] - YYNTOKENS;
1469 const int yyi = yypgoto[yylhs] + *yyesp;
1470 yystate = ((yytype_int16)
1471 (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
1472 ? yytable[yyi]
1473 : yydefgoto[yylhs]));
1474 }
1475 if (yyesp == yyes_prev)
1476 {
1477 yyesp = *yyes;
1478 *yyesp = yystate;
1479 }
1480 else
1481 {
1482 if (yy_lac_stack_realloc (yyes_capacity, 1,
1483#if GRAM_DEBUG
1484 " (", ")",
1485#endif
1486 yyes, yyesa, &yyesp, yyes_prev))
1487 {
1488 YYDPRINTF ((stderr, "\n"));
1489 return 2;
1490 }
1491 *++yyesp = yystate;
1492 }
1493 YYDPRINTF ((stderr, " G%d", (int) yystate));
1494 }
1495 }
1496}
1497
1498
1499#if YYERROR_VERBOSE
1500
1501# ifndef yystrlen
1502# if defined __GLIBC__ && defined _STRING_H
1503# define yystrlen strlen
1504# else
1505/* Return the length of YYSTR. */
1506static YYSIZE_T
1507yystrlen (const char *yystr)
1508{
1509 YYSIZE_T yylen;
1510 for (yylen = 0; yystr[yylen]; yylen++)
1511 continue;
1512 return yylen;
1513}
1514# endif
1515# endif
1516
1517# ifndef yystpcpy
1518# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1519# define yystpcpy stpcpy
1520# else
1521/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1522 YYDEST. */
1523static char *
1524yystpcpy (char *yydest, const char *yysrc)
1525{
1526 char *yyd = yydest;
1527 const char *yys = yysrc;
1528
1529 while ((*yyd++ = *yys++) != '\0')
1530 continue;
1531
1532 return yyd - 1;
1533}
1534# endif
1535# endif
1536
1537# ifndef yytnamerr
1538/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1539 quotes and backslashes, so that it's suitable for yyerror. The
1540 heuristic is that double-quoting is unnecessary unless the string
1541 contains an apostrophe, a comma, or backslash (other than
1542 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1543 null, do not copy; instead, return the length of what the result
1544 would have been. */
1545static YYSIZE_T
1546yytnamerr (char *yyres, const char *yystr)
1547{
1548 if (*yystr == '"')
1549 {
1550 YYSIZE_T yyn = 0;
1551 char const *yyp = yystr;
1552
1553 for (;;)
1554 switch (*++yyp)
1555 {
1556 case '\'':
1557 case ',':
1558 goto do_not_strip_quotes;
1559
1560 case '\\':
1561 if (*++yyp != '\\')
1562 goto do_not_strip_quotes;
1563 else
1564 goto append;
1565
1566 append:
1567 default:
1568 if (yyres)
1569 yyres[yyn] = *yyp;
1570 yyn++;
1571 break;
1572
1573 case '"':
1574 if (yyres)
1575 yyres[yyn] = '\0';
1576 return yyn;
1577 }
1578 do_not_strip_quotes: ;
1579 }
1580
1581 if (! yyres)
1582 return yystrlen (yystr);
1583
1584 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1585}
1586# endif
1587
1588/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1589 about the unexpected token YYTOKEN for the state stack whose top is
1590 YYSSP. In order to see if a particular token T is a
1591 valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).
1592
1593 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1594 not large enough to hold the message. In that case, also set
1595 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1596 required number of bytes is too large to store or if
1597 yy_lac returned 2. */
1598static int
1599yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1600 yytype_int16 *yyesa, yytype_int16 **yyes,
1601 YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
1602{
1603 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1604 YYSIZE_T yysize = yysize0;
1605 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1606 /* Internationalized format string. */
1607 const char *yyformat = YY_NULLPTR;
1608 /* Arguments of yyformat. */
1609 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1610 /* Number of reported tokens (one for the "unexpected", one per
1611 "expected"). */
1612 int yycount = 0;
1613
1614 /* There are many possibilities here to consider:
1615 - If this state is a consistent state with a default action, then
1616 the only way this function was invoked is if the default action
1617 is an error action. In that case, don't check for expected
1618 tokens because there are none.
1619 - The only way there can be no lookahead present (in yychar) is if
1620 this state is a consistent state with a default action. Thus,
1621 detecting the absence of a lookahead is sufficient to determine
1622 that there is no unexpected or expected token to report. In that
1623 case, just report a simple "syntax error".
1624 - Don't assume there isn't a lookahead just because this state is a
1625 consistent state with a default action. There might have been a
1626 previous inconsistent state, consistent state with a non-default
1627 action, or user semantic action that manipulated yychar.
1628 In the first two cases, it might appear that the current syntax
1629 error should have been detected in the previous state when yy_lac
1630 was invoked. However, at that time, there might have been a
1631 different syntax error that discarded a different initial context
1632 during error recovery, leaving behind the current lookahead.
1633 */
1634 if (yytoken != YYEMPTY)
1635 {
1636 int yyn = yypact[*yyssp];
1637 YYDPRINTF ((stderr, "Constructing syntax error message\n"));
1638 yyarg[yycount++] = yytname[yytoken];
1639 if (!yypact_value_is_default (yyn))
1640 {
1641 int yyx;
1642
1643 for (yyx = 0; yyx < YYNTOKENS; ++yyx)
1644 if (yyx != YYTERROR && yyx != YYUNDEFTOK)
1645 {
1646 {
1647 int yy_lac_status = yy_lac (yyesa, yyes, yyes_capacity,
1648 yyssp, yyx);
1649 if (yy_lac_status == 2)
1650 return 2;
1651 if (yy_lac_status == 1)
1652 continue;
1653 }
1654 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1655 {
1656 yycount = 1;
1657 yysize = yysize0;
1658 break;
1659 }
1660 yyarg[yycount++] = yytname[yyx];
1661 {
1662 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1663 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1664 yysize = yysize1;
1665 else
1666 return 2;
1667 }
1668 }
1669 }
1670# if GRAM_DEBUG
1671 else if (yydebug)
1672 YYFPRINTF (stderr, "No expected tokens.\n");
1673# endif
1674 }
1675
1676 switch (yycount)
1677 {
1678# define YYCASE_(N, S) \
1679 case N: \
1680 yyformat = S; \
1681 break
1682 default: /* Avoid compiler warnings. */
1683 YYCASE_(0, YY_("syntax error"));
1684 YYCASE_(1, YY_("syntax error, unexpected %s"));
1685 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1686 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1687 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1688 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1689# undef YYCASE_
1690 }
1691
1692 {
1693 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1694 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1695 yysize = yysize1;
1696 else
1697 return 2;
1698 }
1699
1700 if (*yymsg_alloc < yysize)
1701 {
1702 *yymsg_alloc = 2 * yysize;
1703 if (! (yysize <= *yymsg_alloc
1704 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1705 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1706 return 1;
1707 }
1708
1709 /* Avoid sprintf, as that infringes on the user's name space.
1710 Don't have undefined behavior even if the translation
1711 produced a string with the wrong number of "%s"s. */
1712 {
1713 char *yyp = *yymsg;
1714 int yyi = 0;
1715 while ((*yyp = *yyformat) != '\0')
1716 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1717 {
1718 yyp += yytnamerr (yyp, yyarg[yyi++]);
1719 yyformat += 2;
1720 }
1721 else
1722 {
1723 yyp++;
1724 yyformat++;
1725 }
1726 }
1727 return 0;
1728}
1729#endif /* YYERROR_VERBOSE */
1730
1731/*-----------------------------------------------.
1732| Release the memory associated to this symbol. |
1733`-----------------------------------------------*/
1734
1735static void
1736yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1737{
1738 YYUSE (yyvaluep);
1739 YYUSE (yylocationp);
1740 if (!yymsg)
1741 yymsg = "Deleting";
1742 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1743
1744 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1745 switch (yytype)
1746 {
1747 case 74: /* generic_symlist */
1748#line 243 "src/parse-gram.y"
1749 { symbol_list_free (((*yyvaluep).generic_symlist)); }
1750#line 1751 "src/parse-gram.c"
1751 break;
1752
1753 case 75: /* generic_symlist_item */
1754#line 243 "src/parse-gram.y"
1755 { symbol_list_free (((*yyvaluep).generic_symlist_item)); }
1756#line 1757 "src/parse-gram.c"
1757 break;
1758
1759 case 77: /* nterm_decls */
1760#line 243 "src/parse-gram.y"
1761 { symbol_list_free (((*yyvaluep).nterm_decls)); }
1762#line 1763 "src/parse-gram.c"
1763 break;
1764
1765 case 78: /* token_decls */
1766#line 243 "src/parse-gram.y"
1767 { symbol_list_free (((*yyvaluep).token_decls)); }
1768#line 1769 "src/parse-gram.c"
1769 break;
1770
1771 case 79: /* token_decl.1 */
1772#line 243 "src/parse-gram.y"
1773 { symbol_list_free (((*yyvaluep).yytype_79)); }
1774#line 1775 "src/parse-gram.c"
1775 break;
1776
1777 case 82: /* token_decls_for_prec */
1778#line 243 "src/parse-gram.y"
1779 { symbol_list_free (((*yyvaluep).token_decls_for_prec)); }
1780#line 1781 "src/parse-gram.c"
1781 break;
1782
1783 case 83: /* token_decl_for_prec.1 */
1784#line 243 "src/parse-gram.y"
1785 { symbol_list_free (((*yyvaluep).yytype_83)); }
1786#line 1787 "src/parse-gram.c"
1787 break;
1788
1789 case 85: /* symbol_decls */
1790#line 243 "src/parse-gram.y"
1791 { symbol_list_free (((*yyvaluep).symbol_decls)); }
1792#line 1793 "src/parse-gram.c"
1793 break;
1794
1795 case 86: /* symbol_decl.1 */
1796#line 243 "src/parse-gram.y"
1797 { symbol_list_free (((*yyvaluep).yytype_86)); }
1798#line 1799 "src/parse-gram.c"
1799 break;
1800
1801 default:
1802 break;
1803 }
1804 YY_IGNORE_MAYBE_UNINITIALIZED_END
1805}
1806
1807
1808
1809
1810/*----------.
1811| yyparse. |
1812`----------*/
1813
1814int
1815yyparse (void)
1816{
1817/* The lookahead symbol. */
1818int yychar;
1819
1820
1821/* The semantic value of the lookahead symbol. */
1822/* Default value used for initialization, for pacifying older GCCs
1823 or non-GCC compilers. */
1824YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1825YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1826
1827/* Location data for the lookahead symbol. */
1828static YYLTYPE yyloc_default
1829# if defined GRAM_LTYPE_IS_TRIVIAL && GRAM_LTYPE_IS_TRIVIAL
1830 = { 1, 1, 1, 1 }
1831# endif
1832;
1833YYLTYPE yylloc = yyloc_default;
1834
1835 /* Number of syntax errors so far. */
1836 int yynerrs;
1837
1838 int yystate;
1839 /* Number of tokens to shift before error messages enabled. */
1840 int yyerrstatus;
1841
1842 /* The stacks and their tools:
1843 'yyss': related to states.
1844 'yyvs': related to semantic values.
1845 'yyls': related to locations.
1846
1847 Refer to the stacks through separate pointers, to allow yyoverflow
1848 to reallocate them elsewhere. */
1849
1850 /* The state stack. */
1851 yytype_int16 yyssa[YYINITDEPTH];
1852 yytype_int16 *yyss;
1853 yytype_int16 *yyssp;
1854
1855 /* The semantic value stack. */
1856 YYSTYPE yyvsa[YYINITDEPTH];
1857 YYSTYPE *yyvs;
1858 YYSTYPE *yyvsp;
1859
1860 /* The location stack. */
1861 YYLTYPE yylsa[YYINITDEPTH];
1862 YYLTYPE *yyls;
1863 YYLTYPE *yylsp;
1864
1865 /* The locations where the error started and ended. */
1866 YYLTYPE yyerror_range[3];
1867
1868 YYSIZE_T yystacksize;
1869
1870 yytype_int16 yyesa[20];
1871 yytype_int16 *yyes;
1872 YYSIZE_T yyes_capacity;
1873
1874 int yy_lac_established = 0;
1875 int yyn;
1876 int yyresult;
1877 /* Lookahead token as an internal (translated) token number. */
1878 int yytoken = 0;
1879 /* The variables used to return semantic value and location from the
1880 action routines. */
1881 YYSTYPE yyval;
1882 YYLTYPE yyloc;
1883
1884#if YYERROR_VERBOSE
1885 /* Buffer for error messages, and its allocated size. */
1886 char yymsgbuf[128];
1887 char *yymsg = yymsgbuf;
1888 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1889#endif
1890
1891#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1892
1893 /* The number of symbols on the RHS of the reduced rule.
1894 Keep to zero when no symbol should be popped. */
1895 int yylen = 0;
1896
1897 yyssp = yyss = yyssa;
1898 yyvsp = yyvs = yyvsa;
1899 yylsp = yyls = yylsa;
1900 yystacksize = YYINITDEPTH;
1901
1902 yyes = yyesa;
1903 yyes_capacity = sizeof yyesa / sizeof *yyes;
1904 if (YYMAXDEPTH < yyes_capacity)
1905 yyes_capacity = YYMAXDEPTH;
1906
1907 YYDPRINTF ((stderr, "Starting parse\n"));
1908
1909 yystate = 0;
1910 yyerrstatus = 0;
1911 yynerrs = 0;
1912 yychar = YYEMPTY; /* Cause a token to be read. */
1913
1914/* User initialization code. */
1915#line 137 "src/parse-gram.y"
1916{
1917 /* Bison's grammar can initial empty locations, hence a default
1918 location is needed. */
1919 boundary_set (&yylloc.start, current_file, 1, 1, 1);
1920 boundary_set (&yylloc.end, current_file, 1, 1, 1);
1921}
1922
1923#line 1924 "src/parse-gram.c"
1924
1925 yylsp[0] = yylloc;
1926 goto yysetstate;
1927
1928
1929/*------------------------------------------------------------.
1930| yynewstate -- push a new state, which is found in yystate. |
1931`------------------------------------------------------------*/
1932yynewstate:
1933 /* In all cases, when you get here, the value and location stacks
1934 have just been pushed. So pushing a state here evens the stacks. */
1935 yyssp++;
1936
1937
1938/*--------------------------------------------------------------------.
1939| yynewstate -- set current state (the top of the stack) to yystate. |
1940`--------------------------------------------------------------------*/
1941yysetstate:
1942 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1943 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1944 *yyssp = (yytype_int16) yystate;
1945
1946 if (yyss + yystacksize - 1 <= yyssp)
1947#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1948 goto yyexhaustedlab;
1949#else
1950 {
1951 /* Get the current used size of the three stacks, in elements. */
1952 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1953
1954# if defined yyoverflow
1955 {
1956 /* Give user a chance to reallocate the stack. Use copies of
1957 these so that the &'s don't force the real ones into
1958 memory. */
1959 YYSTYPE *yyvs1 = yyvs;
1960 yytype_int16 *yyss1 = yyss;
1961 YYLTYPE *yyls1 = yyls;
1962
1963 /* Each stack pointer address is followed by the size of the
1964 data in use in that stack, in bytes. This used to be a
1965 conditional around just the two extra args, but that might
1966 be undefined if yyoverflow is a macro. */
1967 yyoverflow (YY_("memory exhausted"),
1968 &yyss1, yysize * sizeof (*yyssp),
1969 &yyvs1, yysize * sizeof (*yyvsp),
1970 &yyls1, yysize * sizeof (*yylsp),
1971 &yystacksize);
1972 yyss = yyss1;
1973 yyvs = yyvs1;
1974 yyls = yyls1;
1975 }
1976# else /* defined YYSTACK_RELOCATE */
1977 /* Extend the stack our own way. */
1978 if (YYMAXDEPTH <= yystacksize)
1979 goto yyexhaustedlab;
1980 yystacksize *= 2;
1981 if (YYMAXDEPTH < yystacksize)
1982 yystacksize = YYMAXDEPTH;
1983
1984 {
1985 yytype_int16 *yyss1 = yyss;
1986 union yyalloc *yyptr =
1987 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1988 if (! yyptr)
1989 goto yyexhaustedlab;
1990 YYSTACK_RELOCATE (yyss_alloc, yyss);
1991 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1992 YYSTACK_RELOCATE (yyls_alloc, yyls);
1993# undef YYSTACK_RELOCATE
1994 if (yyss1 != yyssa)
1995 YYSTACK_FREE (yyss1);
1996 }
1997# endif
1998
1999 yyssp = yyss + yysize - 1;
2000 yyvsp = yyvs + yysize - 1;
2001 yylsp = yyls + yysize - 1;
2002
2003 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2004 (unsigned long) yystacksize));
2005
2006 if (yyss + yystacksize - 1 <= yyssp)
2007 YYABORT;
2008 }
2009#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
2010
2011 if (yystate == YYFINAL)
2012 YYACCEPT;
2013
2014 goto yybackup;
2015
2016
2017/*-----------.
2018| yybackup. |
2019`-----------*/
2020yybackup:
2021 /* Do appropriate processing given the current state. Read a
2022 lookahead token if we need one and don't already have one. */
2023
2024 /* First try to decide what to do without reference to lookahead token. */
2025 yyn = yypact[yystate];
2026 if (yypact_value_is_default (yyn))
2027 goto yydefault;
2028
2029 /* Not known => get a lookahead token if don't already have one. */
2030
2031 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2032 if (yychar == YYEMPTY)
2033 {
2034 YYDPRINTF ((stderr, "Reading a token: "));
2035 yychar = yylex (&yylval, &yylloc);
2036 }
2037
2038 if (yychar <= YYEOF)
2039 {
2040 yychar = yytoken = YYEOF;
2041 YYDPRINTF ((stderr, "Now at end of input.\n"));
2042 }
2043 else
2044 {
2045 yytoken = YYTRANSLATE (yychar);
2046 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2047 }
2048
2049 /* If the proper action on seeing token YYTOKEN is to reduce or to
2050 detect an error, take that action. */
2051 yyn += yytoken;
2052 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2053 {
2054 YY_LAC_ESTABLISH;
2055 goto yydefault;
2056 }
2057 yyn = yytable[yyn];
2058 if (yyn <= 0)
2059 {
2060 if (yytable_value_is_error (yyn))
2061 goto yyerrlab;
2062 YY_LAC_ESTABLISH;
2063 yyn = -yyn;
2064 goto yyreduce;
2065 }
2066
2067 /* Count tokens shifted since error; after three, turn off error
2068 status. */
2069 if (yyerrstatus)
2070 yyerrstatus--;
2071
2072 /* Shift the lookahead token. */
2073 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2074
2075 /* Discard the shifted token. */
2076 yychar = YYEMPTY;
2077 YY_LAC_DISCARD ("shift");
2078
2079 yystate = yyn;
2080 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2081 *++yyvsp = yylval;
2082 YY_IGNORE_MAYBE_UNINITIALIZED_END
2083 *++yylsp = yylloc;
2084 goto yynewstate;
2085
2086
2087/*-----------------------------------------------------------.
2088| yydefault -- do the default action for the current state. |
2089`-----------------------------------------------------------*/
2090yydefault:
2091 yyn = yydefact[yystate];
2092 if (yyn == 0)
2093 goto yyerrlab;
2094 goto yyreduce;
2095
2096
2097/*-----------------------------.
2098| yyreduce -- do a reduction. |
2099`-----------------------------*/
2100yyreduce:
2101 /* yyn is the number of a rule to reduce with. */
2102 yylen = yyr2[yyn];
2103
2104 /* If YYLEN is nonzero, implement the default value of the action:
2105 '$$ = $1'.
2106
2107 Otherwise, the following line sets YYVAL to garbage.
2108 This behavior is undocumented and Bison
2109 users should not rely upon it. Assigning to YYVAL
2110 unconditionally makes the parser a bit smaller, and it avoids a
2111 GCC warning that YYVAL may be used uninitialized. */
2112 yyval = yyvsp[1-yylen];
2113
2114 /* Default location. */
2115 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2116 yyerror_range[1] = yyloc;
2117 YY_REDUCE_PRINT (yyn);
2118 {
2119 int yychar_backup = yychar;
2120 switch (yyn)
2121 {
2122 case 6:
2123#line 310 "src/parse-gram.y"
2124 {
2125 muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue",
2126 translate_code ((yyvsp[0].PROLOGUE), (yylsp[0]), true), (yylsp[0]));
2127 code_scanner_last_string_free ();
2128 }
2129#line 2130 "src/parse-gram.c"
2130 break;
2131
2132 case 7:
2133#line 316 "src/parse-gram.y"
2134 {
2135 muscle_percent_define_ensure ((yyvsp[0].PERCENT_FLAG), (yylsp[0]), true);
2136 }
2137#line 2138 "src/parse-gram.c"
2138 break;
2139
2140 case 8:
2141#line 320 "src/parse-gram.y"
2142 {
2143 muscle_percent_define_insert ((yyvsp[-1].variable), (yyloc), (yyvsp[0].value).kind, (yyvsp[0].value).chars,
2144 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
2145 }
2146#line 2147 "src/parse-gram.c"
2147 break;
2148
2149 case 9:
2150#line 324 "src/parse-gram.y"
2151 { defines_flag = true; }
2152#line 2153 "src/parse-gram.c"
2153 break;
2154
2155 case 10:
2156#line 326 "src/parse-gram.y"
2157 {
2158 defines_flag = true;
2159 spec_header_file = xstrdup ((yyvsp[0].STRING));
2160 }
2161#line 2162 "src/parse-gram.c"
2162 break;
2163
2164 case 11:
2165#line 330 "src/parse-gram.y"
2166 { handle_error_verbose (&(yyloc), (yyvsp[0].PERCENT_ERROR_VERBOSE)); }
2167#line 2168 "src/parse-gram.c"
2168 break;
2169
2170 case 12:
2171#line 331 "src/parse-gram.y"
2172 { expected_sr_conflicts = (yyvsp[0].INT); }
2173#line 2174 "src/parse-gram.c"
2174 break;
2175
2176 case 13:
2177#line 332 "src/parse-gram.y"
2178 { expected_rr_conflicts = (yyvsp[0].INT); }
2179#line 2180 "src/parse-gram.c"
2180 break;
2181
2182 case 14:
2183#line 333 "src/parse-gram.y"
2184 { handle_file_prefix (&(yyloc), &(yylsp[-1]), (yyvsp[-1].PERCENT_FILE_PREFIX), (yyvsp[0].STRING)); }
2185#line 2186 "src/parse-gram.c"
2186 break;
2187
2188 case 15:
2189#line 335 "src/parse-gram.y"
2190 {
2191 nondeterministic_parser = true;
2192 glr_parser = true;
2193 }
2194#line 2195 "src/parse-gram.c"
2195 break;
2196
2197 case 16:
2198#line 340 "src/parse-gram.y"
2199 {
2200 muscle_code_grow ("initial_action", translate_code ((yyvsp[0].BRACED_CODE), (yylsp[0]), false), (yylsp[0]));
2201 code_scanner_last_string_free ();
2202 }
2203#line 2204 "src/parse-gram.c"
2204 break;
2205
2206 case 17:
2207#line 344 "src/parse-gram.y"
2208 { language_argmatch ((yyvsp[0].STRING), grammar_prio, (yylsp[-1])); }
2209#line 2210 "src/parse-gram.c"
2210 break;
2211
2212 case 18:
2213#line 345 "src/parse-gram.y"
2214 { handle_name_prefix (&(yyloc), (yyvsp[-1].PERCENT_NAME_PREFIX), (yyvsp[0].STRING)); }
2215#line 2216 "src/parse-gram.c"
2216 break;
2217
2218 case 19:
2219#line 346 "src/parse-gram.y"
2220 { no_lines_flag = true; }
2221#line 2222 "src/parse-gram.c"
2222 break;
2223
2224 case 20:
2225#line 347 "src/parse-gram.y"
2226 { nondeterministic_parser = true; }
2227#line 2228 "src/parse-gram.c"
2228 break;
2229
2230 case 21:
2231#line 348 "src/parse-gram.y"
2232 { spec_outfile = (yyvsp[0].STRING); }
2233#line 2234 "src/parse-gram.c"
2234 break;
2235
2236 case 22:
2237#line 349 "src/parse-gram.y"
2238 { current_param = (yyvsp[0].PERCENT_PARAM); }
2239#line 2240 "src/parse-gram.c"
2240 break;
2241
2242 case 23:
2243#line 349 "src/parse-gram.y"
2244 { current_param = param_none; }
2245#line 2246 "src/parse-gram.c"
2246 break;
2247
2248 case 24:
2249#line 350 "src/parse-gram.y"
2250 { handle_pure_parser (&(yyloc), (yyvsp[0].PERCENT_PURE_PARSER)); }
2251#line 2252 "src/parse-gram.c"
2252 break;
2253
2254 case 25:
2255#line 351 "src/parse-gram.y"
2256 { handle_require (&(yylsp[0]), (yyvsp[0].STRING)); }
2257#line 2258 "src/parse-gram.c"
2258 break;
2259
2260 case 26:
2261#line 352 "src/parse-gram.y"
2262 { handle_skeleton (&(yylsp[0]), (yyvsp[0].STRING)); }
2263#line 2264 "src/parse-gram.c"
2264 break;
2265
2266 case 27:
2267#line 353 "src/parse-gram.y"
2268 { token_table_flag = true; }
2269#line 2270 "src/parse-gram.c"
2270 break;
2271
2272 case 28:
2273#line 354 "src/parse-gram.y"
2274 { report_flag |= report_states; }
2275#line 2276 "src/parse-gram.c"
2276 break;
2277
2278 case 29:
2279#line 355 "src/parse-gram.y"
2280 { handle_yacc (&(yyloc), (yyvsp[0].PERCENT_YACC)); }
2281#line 2282 "src/parse-gram.c"
2282 break;
2283
2284 case 30:
2285#line 356 "src/parse-gram.y"
2286 { current_class = unknown_sym; yyerrok; }
2287#line 2288 "src/parse-gram.c"
2288 break;
2289
2290 case 32:
2291#line 361 "src/parse-gram.y"
2292 { add_param (current_param, (yyvsp[0].BRACED_CODE), (yylsp[0])); }
2293#line 2294 "src/parse-gram.c"
2294 break;
2295
2296 case 33:
2297#line 362 "src/parse-gram.y"
2298 { add_param (current_param, (yyvsp[0].BRACED_CODE), (yylsp[0])); }
2299#line 2300 "src/parse-gram.c"
2300 break;
2301
2302 case 35:
2303#line 373 "src/parse-gram.y"
2304 {
2305 grammar_start_symbol_set ((yyvsp[0].symbol), (yylsp[0]));
2306 }
2307#line 2308 "src/parse-gram.c"
2308 break;
2309
2310 case 36:
2311#line 377 "src/parse-gram.y"
2312 {
2313 code_props code;
2314 code_props_symbol_action_init (&code, (yyvsp[-1].BRACED_CODE), (yylsp[-1]));
2315 code_props_translate_code (&code);
2316 {
2317 for (symbol_list *list = (yyvsp[0].generic_symlist); list; list = list->next)
2318 symbol_list_code_props_set (list, (yyvsp[-2].code_props_type), &code);
2319 symbol_list_free ((yyvsp[0].generic_symlist));
2320 }
2321 }
2322#line 2323 "src/parse-gram.c"
2323 break;
2324
2325 case 37:
2326#line 388 "src/parse-gram.y"
2327 {
2328 default_prec = true;
2329 }
2330#line 2331 "src/parse-gram.c"
2331 break;
2332
2333 case 38:
2334#line 392 "src/parse-gram.y"
2335 {
2336 default_prec = false;
2337 }
2338#line 2339 "src/parse-gram.c"
2339 break;
2340
2341 case 39:
2342#line 396 "src/parse-gram.y"
2343 {
2344 /* Do not invoke muscle_percent_code_grow here since it invokes
2345 muscle_user_name_list_grow. */
2346 muscle_code_grow ("percent_code()",
2347 translate_code_braceless ((yyvsp[0].BRACED_CODE), (yylsp[0])), (yylsp[0]));
2348 code_scanner_last_string_free ();
2349 }
2350#line 2351 "src/parse-gram.c"
2351 break;
2352
2353 case 40:
2354#line 404 "src/parse-gram.y"
2355 {
2356 muscle_percent_code_grow ((yyvsp[-1].ID), (yylsp[-1]), translate_code_braceless ((yyvsp[0].BRACED_CODE), (yylsp[0])), (yylsp[0]));
2357 code_scanner_last_string_free ();
2358 }
2359#line 2360 "src/parse-gram.c"
2360 break;
2361
2362 case 41:
2363#line 413 "src/parse-gram.y"
2364 { (yyval.code_props_type) = destructor; }
2365#line 2366 "src/parse-gram.c"
2366 break;
2367
2368 case 42:
2369#line 414 "src/parse-gram.y"
2370 { (yyval.code_props_type) = printer; }
2371#line 2372 "src/parse-gram.c"
2372 break;
2373
2374 case 43:
2375#line 424 "src/parse-gram.y"
2376 {}
2377#line 2378 "src/parse-gram.c"
2378 break;
2379
2380 case 44:
2381#line 425 "src/parse-gram.y"
2382 { muscle_percent_define_insert ("api.value.union.name",
2383 (yylsp[0]), muscle_keyword, (yyvsp[0].ID),
2384 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE); }
2385#line 2386 "src/parse-gram.c"
2386 break;
2387
2388 case 45:
2389#line 432 "src/parse-gram.y"
2390 {
2391 union_seen = true;
2392 muscle_code_grow ("union_members", translate_code_braceless ((yyvsp[0].BRACED_CODE), (yylsp[0])), (yylsp[0]));
2393 code_scanner_last_string_free ();
2394 }
2395#line 2396 "src/parse-gram.c"
2396 break;
2397
2398 case 46:
2399#line 444 "src/parse-gram.y"
2400 { current_class = nterm_sym; }
2401#line 2402 "src/parse-gram.c"
2402 break;
2403
2404 case 47:
2405#line 445 "src/parse-gram.y"
2406 {
2407 current_class = unknown_sym;
2408 symbol_list_free ((yyvsp[0].nterm_decls));
2409 }
2410#line 2411 "src/parse-gram.c"
2411 break;
2412
2413 case 48:
2414#line 449 "src/parse-gram.y"
2415 { current_class = token_sym; }
2416#line 2417 "src/parse-gram.c"
2417 break;
2418
2419 case 49:
2420#line 450 "src/parse-gram.y"
2421 {
2422 current_class = unknown_sym;
2423 symbol_list_free ((yyvsp[0].token_decls));
2424 }
2425#line 2426 "src/parse-gram.c"
2426 break;
2427
2428 case 50:
2429#line 455 "src/parse-gram.y"
2430 {
2431 symbol_list_free ((yyvsp[0].symbol_decls));
2432 }
2433#line 2434 "src/parse-gram.c"
2434 break;
2435
2436 case 51:
2437#line 459 "src/parse-gram.y"
2438 {
2439 ++current_prec;
2440 for (symbol_list *list = (yyvsp[0].token_decls_for_prec); list; list = list->next)
2441 symbol_precedence_set (list->content.sym, current_prec, (yyvsp[-1].precedence_declarator), (yylsp[-1]));
2442 symbol_list_free ((yyvsp[0].token_decls_for_prec));
2443 }
2444#line 2445 "src/parse-gram.c"
2445 break;
2446
2447 case 52:
2448#line 468 "src/parse-gram.y"
2449 { (yyval.precedence_declarator) = left_assoc; }
2450#line 2451 "src/parse-gram.c"
2451 break;
2452
2453 case 53:
2454#line 469 "src/parse-gram.y"
2455 { (yyval.precedence_declarator) = right_assoc; }
2456#line 2457 "src/parse-gram.c"
2457 break;
2458
2459 case 54:
2460#line 470 "src/parse-gram.y"
2461 { (yyval.precedence_declarator) = non_assoc; }
2462#line 2463 "src/parse-gram.c"
2463 break;
2464
2465 case 55:
2466#line 471 "src/parse-gram.y"
2467 { (yyval.precedence_declarator) = precedence_assoc; }
2468#line 2469 "src/parse-gram.c"
2469 break;
2470
2471 case 56:
2472#line 475 "src/parse-gram.y"
2473 { (yyval.yytype_73) = NULL; }
2474#line 2475 "src/parse-gram.c"
2475 break;
2476
2477 case 57:
2478#line 476 "src/parse-gram.y"
2479 { (yyval.yytype_73) = (yyvsp[0].TAG); }
2480#line 2481 "src/parse-gram.c"
2481 break;
2482
2483 case 59:
2484#line 482 "src/parse-gram.y"
2485 { (yyval.generic_symlist) = symbol_list_append ((yyvsp[-1].generic_symlist), (yyvsp[0].generic_symlist_item)); }
2486#line 2487 "src/parse-gram.c"
2487 break;
2488
2489 case 60:
2490#line 486 "src/parse-gram.y"
2491 { (yyval.generic_symlist_item) = symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0])); }
2492#line 2493 "src/parse-gram.c"
2493 break;
2494
2495 case 61:
2496#line 487 "src/parse-gram.y"
2497 { (yyval.generic_symlist_item) = symbol_list_type_new ((yyvsp[0].tag), (yylsp[0])); }
2498#line 2499 "src/parse-gram.c"
2499 break;
2500
2501 case 63:
2502#line 492 "src/parse-gram.y"
2503 { (yyval.tag) = uniqstr_new ("*"); }
2504#line 2505 "src/parse-gram.c"
2505 break;
2506
2507 case 64:
2508#line 493 "src/parse-gram.y"
2509 { (yyval.tag) = uniqstr_new (""); }
2510#line 2511 "src/parse-gram.c"
2511 break;
2512
2513 case 66:
2514#line 516 "src/parse-gram.y"
2515 {
2516 (yyval.token_decls) = (yyvsp[0].yytype_79);
2517 }
2518#line 2519 "src/parse-gram.c"
2519 break;
2520
2521 case 67:
2522#line 520 "src/parse-gram.y"
2523 {
2524 (yyval.token_decls) = symbol_list_type_set ((yyvsp[0].yytype_79), (yyvsp[-1].TAG), (yylsp[-1]));
2525 }
2526#line 2527 "src/parse-gram.c"
2527 break;
2528
2529 case 68:
2530#line 524 "src/parse-gram.y"
2531 {
2532 (yyval.token_decls) = symbol_list_append ((yyvsp[-2].token_decls), symbol_list_type_set ((yyvsp[0].yytype_79), (yyvsp[-1].TAG), (yylsp[-1])));
2533 }
2534#line 2535 "src/parse-gram.c"
2535 break;
2536
2537 case 69:
2538#line 531 "src/parse-gram.y"
2539 { (yyval.yytype_79) = symbol_list_sym_new ((yyvsp[0].token_decl), (yylsp[0])); }
2540#line 2541 "src/parse-gram.c"
2541 break;
2542
2543 case 70:
2544#line 532 "src/parse-gram.y"
2545 { (yyval.yytype_79) = symbol_list_append ((yyvsp[-1].yytype_79), symbol_list_sym_new ((yyvsp[0].token_decl), (yylsp[0]))); }
2546#line 2547 "src/parse-gram.c"
2547 break;
2548
2549 case 71:
2550#line 537 "src/parse-gram.y"
2551 {
2552 (yyval.token_decl) = (yyvsp[-2].id);
2553 symbol_class_set ((yyvsp[-2].id), current_class, (yylsp[-2]), true);
2554 if (0 <= (yyvsp[-1].yytype_81))
2555 symbol_user_token_number_set ((yyvsp[-2].id), (yyvsp[-1].yytype_81), (yylsp[-1]));
2556 if ((yyvsp[0].yytype_100))
2557 symbol_make_alias ((yyvsp[-2].id), (yyvsp[0].yytype_100), (yylsp[0]));
2558 }
2559#line 2560 "src/parse-gram.c"
2560 break;
2561
2562 case 72:
2563#line 549 "src/parse-gram.y"
2564 { (yyval.yytype_81) = -1; }
2565#line 2566 "src/parse-gram.c"
2566 break;
2567
2568 case 74:
2569#line 563 "src/parse-gram.y"
2570 {
2571 (yyval.token_decls_for_prec) = (yyvsp[0].yytype_83);
2572 }
2573#line 2574 "src/parse-gram.c"
2574 break;
2575
2576 case 75:
2577#line 567 "src/parse-gram.y"
2578 {
2579 (yyval.token_decls_for_prec) = symbol_list_type_set ((yyvsp[0].yytype_83), (yyvsp[-1].TAG), (yylsp[-1]));
2580 }
2581#line 2582 "src/parse-gram.c"
2582 break;
2583
2584 case 76:
2585#line 571 "src/parse-gram.y"
2586 {
2587 (yyval.token_decls_for_prec) = symbol_list_append ((yyvsp[-2].token_decls_for_prec), symbol_list_type_set ((yyvsp[0].yytype_83), (yyvsp[-1].TAG), (yylsp[-1])));
2588 }
2589#line 2590 "src/parse-gram.c"
2590 break;
2591
2592 case 77:
2593#line 579 "src/parse-gram.y"
2594 { (yyval.yytype_83) = symbol_list_sym_new ((yyvsp[0].token_decl_for_prec), (yylsp[0])); }
2595#line 2596 "src/parse-gram.c"
2596 break;
2597
2598 case 78:
2599#line 581 "src/parse-gram.y"
2600 { (yyval.yytype_83) = symbol_list_append ((yyvsp[-1].yytype_83), symbol_list_sym_new ((yyvsp[0].token_decl_for_prec), (yylsp[0]))); }
2601#line 2602 "src/parse-gram.c"
2602 break;
2603
2604 case 79:
2605#line 586 "src/parse-gram.y"
2606 {
2607 (yyval.token_decl_for_prec) = (yyvsp[-1].id);
2608 symbol_class_set ((yyvsp[-1].id), token_sym, (yylsp[-1]), false);
2609 if (0 <= (yyvsp[0].yytype_81))
2610 symbol_user_token_number_set ((yyvsp[-1].id), (yyvsp[0].yytype_81), (yylsp[0]));
2611 }
2612#line 2613 "src/parse-gram.c"
2613 break;
2614
2615 case 81:
2616#line 603 "src/parse-gram.y"
2617 {
2618 (yyval.symbol_decls) = (yyvsp[0].yytype_86);
2619 }
2620#line 2621 "src/parse-gram.c"
2621 break;
2622
2623 case 82:
2624#line 607 "src/parse-gram.y"
2625 {
2626 (yyval.symbol_decls) = symbol_list_type_set ((yyvsp[0].yytype_86), (yyvsp[-1].TAG), (yylsp[-1]));
2627 }
2628#line 2629 "src/parse-gram.c"
2629 break;
2630
2631 case 83:
2632#line 611 "src/parse-gram.y"
2633 {
2634 (yyval.symbol_decls) = symbol_list_append ((yyvsp[-2].symbol_decls), symbol_list_type_set ((yyvsp[0].yytype_86), (yyvsp[-1].TAG), (yylsp[-1])));
2635 }
2636#line 2637 "src/parse-gram.c"
2637 break;
2638
2639 case 84:
2640#line 618 "src/parse-gram.y"
2641 { (yyval.yytype_86) = symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0])); }
2642#line 2643 "src/parse-gram.c"
2643 break;
2644
2645 case 85:
2646#line 619 "src/parse-gram.y"
2647 { (yyval.yytype_86) = symbol_list_append ((yyvsp[-1].yytype_86), symbol_list_sym_new ((yyvsp[0].symbol), (yylsp[0]))); }
2648#line 2649 "src/parse-gram.c"
2649 break;
2650
2651 case 90:
2652#line 637 "src/parse-gram.y"
2653 {
2654 yyerrok;
2655 }
2656#line 2657 "src/parse-gram.c"
2657 break;
2658
2659 case 91:
2660#line 643 "src/parse-gram.y"
2661 { current_lhs ((yyvsp[-1].id_colon), (yylsp[-1]), (yyvsp[0].yytype_93)); }
2662#line 2663 "src/parse-gram.c"
2663 break;
2664
2665 case 92:
2666#line 644 "src/parse-gram.y"
2667 {
2668 /* Free the current lhs. */
2669 current_lhs (0, (yylsp[-4]), 0);
2670 }
2671#line 2672 "src/parse-gram.c"
2672 break;
2673
2674 case 93:
2675#line 651 "src/parse-gram.y"
2676 { grammar_current_rule_end ((yylsp[0])); }
2677#line 2678 "src/parse-gram.c"
2678 break;
2679
2680 case 94:
2681#line 652 "src/parse-gram.y"
2682 { grammar_current_rule_end ((yylsp[0])); }
2683#line 2684 "src/parse-gram.c"
2684 break;
2685
2686 case 96:
2687#line 659 "src/parse-gram.y"
2688 { grammar_current_rule_begin (current_lhs_symbol, current_lhs_loc,
2689 current_lhs_named_ref); }
2690#line 2691 "src/parse-gram.c"
2691 break;
2692
2693 case 97:
2694#line 662 "src/parse-gram.y"
2695 { grammar_current_rule_symbol_append ((yyvsp[-1].symbol), (yylsp[-1]), (yyvsp[0].yytype_93)); }
2696#line 2697 "src/parse-gram.c"
2697 break;
2698
2699 case 98:
2700#line 664 "src/parse-gram.y"
2701 { grammar_current_rule_action_append ((yyvsp[-1].BRACED_CODE), (yylsp[-1]), (yyvsp[0].yytype_93), (yyvsp[-2].yytype_73)); }
2702#line 2703 "src/parse-gram.c"
2703 break;
2704
2705 case 99:
2706#line 666 "src/parse-gram.y"
2707 { grammar_current_rule_predicate_append ((yyvsp[0].BRACED_PREDICATE), (yylsp[0])); }
2708#line 2709 "src/parse-gram.c"
2709 break;
2710
2711 case 100:
2712#line 668 "src/parse-gram.y"
2713 { grammar_current_rule_empty_set ((yylsp[0])); }
2714#line 2715 "src/parse-gram.c"
2715 break;
2716
2717 case 101:
2718#line 670 "src/parse-gram.y"
2719 { grammar_current_rule_prec_set ((yyvsp[0].symbol), (yylsp[0])); }
2720#line 2721 "src/parse-gram.c"
2721 break;
2722
2723 case 102:
2724#line 672 "src/parse-gram.y"
2725 { grammar_current_rule_dprec_set ((yyvsp[0].INT), (yylsp[0])); }
2726#line 2727 "src/parse-gram.c"
2727 break;
2728
2729 case 103:
2730#line 674 "src/parse-gram.y"
2731 { grammar_current_rule_merge_set ((yyvsp[0].TAG), (yylsp[0])); }
2732#line 2733 "src/parse-gram.c"
2733 break;
2734
2735 case 104:
2736#line 676 "src/parse-gram.y"
2737 { grammar_current_rule_expect_sr ((yyvsp[0].INT), (yylsp[0])); }
2738#line 2739 "src/parse-gram.c"
2739 break;
2740
2741 case 105:
2742#line 678 "src/parse-gram.y"
2743 { grammar_current_rule_expect_rr ((yyvsp[0].INT), (yylsp[0])); }
2744#line 2745 "src/parse-gram.c"
2745 break;
2746
2747 case 106:
2748#line 682 "src/parse-gram.y"
2749 { (yyval.yytype_93) = NULL; }
2750#line 2751 "src/parse-gram.c"
2751 break;
2752
2753 case 107:
2754#line 683 "src/parse-gram.y"
2755 { (yyval.yytype_93) = named_ref_new ((yyvsp[0].BRACKETED_ID), (yylsp[0])); }
2756#line 2757 "src/parse-gram.c"
2757 break;
2758
2759 case 109:
2760#line 716 "src/parse-gram.y"
2761 { (yyval.value).kind = muscle_keyword; (yyval.value).chars = ""; }
2762#line 2763 "src/parse-gram.c"
2763 break;
2764
2765 case 110:
2766#line 717 "src/parse-gram.y"
2767 { (yyval.value).kind = muscle_keyword; (yyval.value).chars = (yyvsp[0].ID); }
2768#line 2769 "src/parse-gram.c"
2769 break;
2770
2771 case 111:
2772#line 718 "src/parse-gram.y"
2773 { (yyval.value).kind = muscle_string; (yyval.value).chars = (yyvsp[0].STRING); }
2774#line 2775 "src/parse-gram.c"
2775 break;
2776
2777 case 112:
2778#line 719 "src/parse-gram.y"
2779 { (yyval.value).kind = muscle_code; (yyval.value).chars = strip_braces ((yyvsp[0].BRACED_CODE)); }
2780#line 2781 "src/parse-gram.c"
2781 break;
2782
2783 case 113:
2784#line 732 "src/parse-gram.y"
2785 { (yyval.id) = symbol_from_uniqstr ((yyvsp[0].ID), (yylsp[0])); }
2786#line 2787 "src/parse-gram.c"
2787 break;
2788
2789 case 114:
2790#line 734 "src/parse-gram.y"
2791 {
2792 if (current_class == nterm_sym)
2793 {
2794 gram_error (&(yylsp[0]),
2795 _("character literals cannot be nonterminals"));
2796 YYERROR;
2797 }
2798 (yyval.id) = symbol_get (char_name ((yyvsp[0].CHAR)), (yylsp[0]));
2799 symbol_class_set ((yyval.id), token_sym, (yylsp[0]), false);
2800 symbol_user_token_number_set ((yyval.id), (yyvsp[0].CHAR), (yylsp[0]));
2801 }
2802#line 2803 "src/parse-gram.c"
2803 break;
2804
2805 case 115:
2806#line 748 "src/parse-gram.y"
2807 { (yyval.id_colon) = symbol_from_uniqstr ((yyvsp[0].ID_COLON), (yylsp[0])); }
2808#line 2809 "src/parse-gram.c"
2809 break;
2810
2811 case 118:
2812#line 760 "src/parse-gram.y"
2813 {
2814 (yyval.string_as_id) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[0].STRING)), (yylsp[0]));
2815 symbol_class_set ((yyval.string_as_id), token_sym, (yylsp[0]), false);
2816 }
2817#line 2818 "src/parse-gram.c"
2818 break;
2819
2820 case 119:
2821#line 768 "src/parse-gram.y"
2822 { (yyval.yytype_100) = NULL; }
2823#line 2824 "src/parse-gram.c"
2824 break;
2825
2826 case 122:
2827#line 775 "src/parse-gram.y"
2828 {
2829 muscle_code_grow ("epilogue", translate_code ((yyvsp[0].EPILOGUE), (yylsp[0]), true), (yylsp[0]));
2830 code_scanner_last_string_free ();
2831 }
2832#line 2833 "src/parse-gram.c"
2833 break;
2834
2835
2836#line 2837 "src/parse-gram.c"
2837
2838 default: break;
2839 }
2840 if (yychar_backup != yychar)
2841 YY_LAC_DISCARD ("yychar change");
2842 }
2843 /* User semantic actions sometimes alter yychar, and that requires
2844 that yytoken be updated with the new translation. We take the
2845 approach of translating immediately before every use of yytoken.
2846 One alternative is translating here after every semantic action,
2847 but that translation would be missed if the semantic action invokes
2848 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2849 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2850 incorrect destructor might then be invoked immediately. In the
2851 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2852 to an incorrect destructor call or verbose syntax error message
2853 before the lookahead is translated. */
2854 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2855
2856 YYPOPSTACK (yylen);
2857 yylen = 0;
2858 YY_STACK_PRINT (yyss, yyssp);
2859
2860 *++yyvsp = yyval;
2861 *++yylsp = yyloc;
2862
2863 /* Now 'shift' the result of the reduction. Determine what state
2864 that goes to, based on the state we popped back to and the rule
2865 number reduced by. */
2866 {
2867 const int yylhs = yyr1[yyn] - YYNTOKENS;
2868 const int yyi = yypgoto[yylhs] + *yyssp;
2869 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2870 ? yytable[yyi]
2871 : yydefgoto[yylhs]);
2872 }
2873
2874 goto yynewstate;
2875
2876
2877/*--------------------------------------.
2878| yyerrlab -- here on detecting error. |
2879`--------------------------------------*/
2880yyerrlab:
2881 /* Make sure we have latest lookahead translation. See comments at
2882 user semantic actions for why this is necessary. */
2883 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2884
2885 /* If not already recovering from an error, report this error. */
2886 if (!yyerrstatus)
2887 {
2888 ++yynerrs;
2889#if ! YYERROR_VERBOSE
2890 yyerror (&yylloc, YY_("syntax error"));
2891#else
2892# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2893 yyesa, &yyes, &yyes_capacity, \
2894 yyssp, yytoken)
2895 {
2896 char const *yymsgp = YY_("syntax error");
2897 int yysyntax_error_status;
2898 if (yychar != YYEMPTY)
2899 YY_LAC_ESTABLISH;
2900 yysyntax_error_status = YYSYNTAX_ERROR;
2901 if (yysyntax_error_status == 0)
2902 yymsgp = yymsg;
2903 else if (yysyntax_error_status == 1)
2904 {
2905 if (yymsg != yymsgbuf)
2906 YYSTACK_FREE (yymsg);
2907 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2908 if (!yymsg)
2909 {
2910 yymsg = yymsgbuf;
2911 yymsg_alloc = sizeof yymsgbuf;
2912 yysyntax_error_status = 2;
2913 }
2914 else
2915 {
2916 yysyntax_error_status = YYSYNTAX_ERROR;
2917 yymsgp = yymsg;
2918 }
2919 }
2920 yyerror (&yylloc, yymsgp);
2921 if (yysyntax_error_status == 2)
2922 goto yyexhaustedlab;
2923 }
2924# undef YYSYNTAX_ERROR
2925#endif
2926 }
2927
2928 yyerror_range[1] = yylloc;
2929
2930 if (yyerrstatus == 3)
2931 {
2932 /* If just tried and failed to reuse lookahead token after an
2933 error, discard it. */
2934
2935 if (yychar <= YYEOF)
2936 {
2937 /* Return failure if at end of input. */
2938 if (yychar == YYEOF)
2939 YYABORT;
2940 }
2941 else
2942 {
2943 yydestruct ("Error: discarding",
2944 yytoken, &yylval, &yylloc);
2945 yychar = YYEMPTY;
2946 }
2947 }
2948
2949 /* Else will try to reuse lookahead token after shifting the error
2950 token. */
2951 goto yyerrlab1;
2952
2953
2954/*---------------------------------------------------.
2955| yyerrorlab -- error raised explicitly by YYERROR. |
2956`---------------------------------------------------*/
2957yyerrorlab:
2958 /* Pacify compilers when the user code never invokes YYERROR and the
2959 label yyerrorlab therefore never appears in user code. */
2960 if (0)
2961 YYERROR;
2962
2963 /* Do not reclaim the symbols of the rule whose action triggered
2964 this YYERROR. */
2965 YYPOPSTACK (yylen);
2966 yylen = 0;
2967 YY_STACK_PRINT (yyss, yyssp);
2968 yystate = *yyssp;
2969 goto yyerrlab1;
2970
2971
2972/*-------------------------------------------------------------.
2973| yyerrlab1 -- common code for both syntax error and YYERROR. |
2974`-------------------------------------------------------------*/
2975yyerrlab1:
2976 yyerrstatus = 3; /* Each real token shifted decrements this. */
2977
2978 for (;;)
2979 {
2980 yyn = yypact[yystate];
2981 if (!yypact_value_is_default (yyn))
2982 {
2983 yyn += YYTERROR;
2984 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2985 {
2986 yyn = yytable[yyn];
2987 if (0 < yyn)
2988 break;
2989 }
2990 }
2991
2992 /* Pop the current state because it cannot handle the error token. */
2993 if (yyssp == yyss)
2994 YYABORT;
2995
2996 yyerror_range[1] = *yylsp;
2997 yydestruct ("Error: popping",
2998 yystos[yystate], yyvsp, yylsp);
2999 YYPOPSTACK (1);
3000 yystate = *yyssp;
3001 YY_STACK_PRINT (yyss, yyssp);
3002 }
3003
3004 /* If the stack popping above didn't lose the initial context for the
3005 current lookahead token, the shift below will for sure. */
3006 YY_LAC_DISCARD ("error recovery");
3007
3008 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3009 *++yyvsp = yylval;
3010 YY_IGNORE_MAYBE_UNINITIALIZED_END
3011
3012 yyerror_range[2] = yylloc;
3013 /* Using YYLLOC is tempting, but would change the location of
3014 the lookahead. YYLOC is available though. */
3015 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
3016 *++yylsp = yyloc;
3017
3018 /* Shift the error token. */
3019 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3020
3021 yystate = yyn;
3022 goto yynewstate;
3023
3024
3025/*-------------------------------------.
3026| yyacceptlab -- YYACCEPT comes here. |
3027`-------------------------------------*/
3028yyacceptlab:
3029 yyresult = 0;
3030 goto yyreturn;
3031
3032
3033/*-----------------------------------.
3034| yyabortlab -- YYABORT comes here. |
3035`-----------------------------------*/
3036yyabortlab:
3037 yyresult = 1;
3038 goto yyreturn;
3039
3040
3041#if 1
3042/*-------------------------------------------------.
3043| yyexhaustedlab -- memory exhaustion comes here. |
3044`-------------------------------------------------*/
3045yyexhaustedlab:
3046 yyerror (&yylloc, YY_("memory exhausted"));
3047 yyresult = 2;
3048 /* Fall through. */
3049#endif
3050
3051
3052/*-----------------------------------------------------.
3053| yyreturn -- parsing is finished, return the result. |
3054`-----------------------------------------------------*/
3055yyreturn:
3056 if (yychar != YYEMPTY)
3057 {
3058 /* Make sure we have latest lookahead translation. See comments at
3059 user semantic actions for why this is necessary. */
3060 yytoken = YYTRANSLATE (yychar);
3061 yydestruct ("Cleanup: discarding lookahead",
3062 yytoken, &yylval, &yylloc);
3063 }
3064 /* Do not reclaim the symbols of the rule whose action triggered
3065 this YYABORT or YYACCEPT. */
3066 YYPOPSTACK (yylen);
3067 YY_STACK_PRINT (yyss, yyssp);
3068 while (yyssp != yyss)
3069 {
3070 yydestruct ("Cleanup: popping",
3071 yystos[*yyssp], yyvsp, yylsp);
3072 YYPOPSTACK (1);
3073 }
3074#ifndef yyoverflow
3075 if (yyss != yyssa)
3076 YYSTACK_FREE (yyss);
3077#endif
3078 if (yyes != yyesa)
3079 YYSTACK_FREE (yyes);
3080#if YYERROR_VERBOSE
3081 if (yymsg != yymsgbuf)
3082 YYSTACK_FREE (yymsg);
3083#endif
3084 return yyresult;
3085}
3086#line 781 "src/parse-gram.y"
3087
3088
3089/* Return the location of the left-hand side of a rule whose
3090 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
3091 the right-hand side, and return an empty location equal to the end
3092 boundary of RHS[0] if the right-hand side is empty. */
3093
3094static YYLTYPE
3095lloc_default (YYLTYPE const *rhs, int n)
3096{
3097 YYLTYPE loc;
3098
3099 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
3100 The bug is fixed in 7.4.2m, but play it safe for now. */
3101 loc.start = rhs[n].end;
3102 loc.end = rhs[n].end;
3103
3104 /* Ignore empty nonterminals the start of the right-hand side.
3105 Do not bother to ignore them at the end of the right-hand side,
3106 since empty nonterminals have the same end as their predecessors. */
3107 for (int i = 1; i <= n; i++)
3108 if (! equal_boundaries (rhs[i].start, rhs[i].end))
3109 {
3110 loc.start = rhs[i].start;
3111 break;
3112 }
3113
3114 return loc;
3115}
3116
3117static
3118char *strip_braces (char *code)
3119{
3120 code[strlen (code) - 1] = 0;
3121 return code + 1;
3122}
3123
3124static
3125char const *
3126translate_code (char *code, location loc, bool plain)
3127{
3128 code_props plain_code;
3129 if (plain)
3130 code_props_plain_init (&plain_code, code, loc);
3131 else
3132 code_props_symbol_action_init (&plain_code, code, loc);
3133 code_props_translate_code (&plain_code);
3134 gram_scanner_last_string_free ();
3135 return plain_code.code;
3136}
3137
3138static
3139char const *
3140translate_code_braceless (char *code, location loc)
3141{
3142 return translate_code (strip_braces (code), loc, true);
3143}
3144
3145static void
3146add_param (param_type type, char *decl, location loc)
3147{
3148 static char const alphanum[26 + 26 + 1 + 10 + 1] =
3149 "abcdefghijklmnopqrstuvwxyz"
3150 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
3151 "_"
3152 "0123456789";
3153
3154 char const *name_start = NULL;
3155 {
3156 char *p;
3157 /* Stop on last actual character. */
3158 for (p = decl; p[1]; p++)
3159 if ((p == decl
3160 || ! memchr (alphanum, p[-1], sizeof alphanum - 1))
3161 && memchr (alphanum, p[0], sizeof alphanum - 10 - 1))
3162 name_start = p;
3163
3164 /* Strip the surrounding '{' and '}', and any blanks just inside
3165 the braces. */
3166 --p;
3167 while (c_isspace ((unsigned char) *p))
3168 --p;
3169 p[1] = '\0';
3170 ++decl;
3171 while (c_isspace ((unsigned char) *decl))
3172 ++decl;
3173 }
3174
3175 if (! name_start)
3176 complain (&loc, complaint, _("missing identifier in parameter declaration"));
3177 else
3178 {
3179 char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
3180 if (type & param_lex)
3181 muscle_pair_list_grow ("lex_param", decl, name);
3182 if (type & param_parse)
3183 muscle_pair_list_grow ("parse_param", decl, name);
3184 free (name);
3185 }
3186
3187 gram_scanner_last_string_free ();
3188}
3189
3190
3191static void
3192handle_error_verbose (location const *loc, char const *directive)
3193{
3194 bison_directive (loc, directive);
3195 muscle_percent_define_insert (directive, *loc, muscle_keyword, "",
3196 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
3197}
3198
3199
3200static void
3201handle_file_prefix (location const *loc,
3202 location const *dir_loc,
3203 char const *directive, char const *value)
3204{
3205 bison_directive (loc, directive);
3206 bool warned = false;
3207
3208 if (location_empty (spec_file_prefix_loc))
3209 {
3210 spec_file_prefix_loc = *loc;
3211 spec_file_prefix = value;
3212 }
3213 else
3214 {
3215 duplicate_directive (directive, spec_file_prefix_loc, *loc);
3216 warned = true;
3217 }
3218
3219 if (!warned
3220 && STRNEQ (directive, "%file-prefix"))
3221 deprecated_directive (dir_loc, directive, "%file-prefix");
3222}
3223
3224
3225static void
3226handle_name_prefix (location const *loc,
3227 char const *directive, char const *value)
3228{
3229 bison_directive (loc, directive);
3230
3231 char buf1[1024];
3232 size_t len1 = sizeof (buf1);
3233 char *old = asnprintf (buf1, &len1, "%s\"%s\"", directive, value);
3234 if (!old)
3235 xalloc_die ();
3236
3237 if (location_empty (spec_name_prefix_loc))
3238 {
3239 spec_name_prefix = value;
3240 spec_name_prefix_loc = *loc;
3241
3242 char buf2[1024];
3243 size_t len2 = sizeof (buf2);
3244 char *new = asnprintf (buf2, &len2, "%%define api.prefix {%s}", value);
3245 if (!new)
3246 xalloc_die ();
3247 deprecated_directive (loc, old, new);
3248 if (new != buf2)
3249 free (new);
3250 }
3251 else
3252 duplicate_directive (old, spec_file_prefix_loc, *loc);
3253
3254 if (old != buf1)
3255 free (old);
3256}
3257
3258
3259static void
3260handle_pure_parser (location const *loc, char const *directive)
3261{
3262 bison_directive (loc, directive);
3263 deprecated_directive (loc, directive, "%define api.pure");
3264 muscle_percent_define_insert ("api.pure", *loc, muscle_keyword, "",
3265 MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
3266}
3267
3268
3269static void
3270handle_require (location const *loc, char const *version)
3271{
3272 /* Changes of behavior are only on minor version changes, so "3.0.5"
3273 is the same as "3.0". */
3274 errno = 0;
3275 char* cp = NULL;
3276 unsigned long major = strtoul (version, &cp, 10);
3277 if (errno || *cp != '.')
3278 {
3279 complain (loc, complaint, _("invalid version requirement: %s"),
3280 version);
3281 return;
3282 }
3283 ++cp;
3284 unsigned long minor = strtoul (cp, NULL, 10);
3285 if (errno)
3286 {
3287 complain (loc, complaint, _("invalid version requirement: %s"),
3288 version);
3289 return;
3290 }
3291 required_version = major * 100 + minor;
3292 /* Pretend to be at least 3.4, to check features published in 3.4
3293 while developping it. */
3294 const char* api_version = "3.4";
3295 const char* package_version =
3296 strverscmp (api_version, PACKAGE_VERSION) > 0
3297 ? api_version : PACKAGE_VERSION;
3298 if (strverscmp (version, package_version) > 0)
3299 {
3300 complain (loc, complaint, _("require bison %s, but have %s"),
3301 version, package_version);
3302 exit (EX_MISMATCH);
3303 }
3304}
3305
3306static void
3307handle_skeleton (location const *loc, char const *skel)
3308{
3309 char const *skeleton_user = skel;
3310 if (strchr (skeleton_user, '/'))
3311 {
3312 size_t dir_length = strlen (current_file);
3313 while (dir_length && current_file[dir_length - 1] != '/')
3314 --dir_length;
3315 while (dir_length && current_file[dir_length - 1] == '/')
3316 --dir_length;
3317 char *skeleton_build =
3318 xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
3319 if (dir_length > 0)
3320 {
3321 memcpy (skeleton_build, current_file, dir_length);
3322 skeleton_build[dir_length++] = '/';
3323 }
3324 strcpy (skeleton_build + dir_length, skeleton_user);
3325 skeleton_user = uniqstr_new (skeleton_build);
3326 free (skeleton_build);
3327 }
3328 skeleton_arg (skeleton_user, grammar_prio, *loc);
3329}
3330
3331
3332static void
3333handle_yacc (location const *loc, char const *directive)
3334{
3335 bison_directive (loc, directive);
3336 bool warned = false;
3337
3338 if (location_empty (yacc_loc))
3339 yacc_loc = *loc;
3340 else
3341 {
3342 duplicate_directive (directive, yacc_loc, *loc);
3343 warned = true;
3344 }
3345
3346 if (!warned
3347 && STRNEQ (directive, "%fixed-output-files")
3348 && STRNEQ (directive, "%yacc"))
3349 deprecated_directive (loc, directive, "%fixed-output-files");
3350}
3351
3352
3353static void
3354gram_error (location const *loc, char const *msg)
3355{
3356 complain (loc, complaint, "%s", msg);
3357}
3358
3359static char const *
3360char_name (char c)
3361{
3362 if (c == '\'')
3363 return "'\\''";
3364 else
3365 {
3366 char buf[4];
3367 buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0';
3368 return quotearg_style (escape_quoting_style, buf);
3369 }
3370}
3371
3372static
3373void
3374current_lhs (symbol *sym, location loc, named_ref *ref)
3375{
3376 current_lhs_symbol = sym;
3377 current_lhs_loc = loc;
3378 if (sym)
3379 symbol_location_as_lhs_set (sym, loc);
3380 /* In order to simplify memory management, named references for lhs
3381 are always assigned by deep copy into the current symbol_list
3382 node. This is because a single named-ref in the grammar may
3383 result in several uses when the user factors lhs between several
3384 rules using "|". Therefore free the parser's original copy. */
3385 free (current_lhs_named_ref);
3386 current_lhs_named_ref = ref;
3387}
3388
3389static void tron (FILE *yyo)
3390{
3391 begin_use_class ("value", yyo);
3392}
3393
3394static void troff (FILE *yyo)
3395{
3396 end_use_class ("value", yyo);
3397}
3398