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