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