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