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