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