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