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