]> git.saurik.com Git - bison.git/blame - src/parse-gram.c
* doc/Doxyfile.in: New.
[bison.git] / src / parse-gram.c
CommitLineData
d2a1a60a 1/* A Bison parser, made by GNU Bison 2.3+. */
e9955c83 2
04c12cb8
PE
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
1921f1d7
AD
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
0fb669f9
PE
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
1921f1d7 22
04c12cb8
PE
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
1921f1d7 35
66809587
PE
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
1921f1d7
AD
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
62ddaef6
PE
47#define YYBISON 1
48
f5109f5a 49/* Bison version. */
d2a1a60a 50#define YYBISON_VERSION "2.3+"
f5109f5a 51
62ddaef6
PE
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
1921f1d7
AD
54
55/* Pure parsers. */
62ddaef6 56#define YYPURE 1
1921f1d7
AD
57
58/* Using locations. */
59#define YYLSP_NEEDED 1
e96c9728 60
76dcf299 61/* Substitute the variable and function names. */
e9955c83 62#define yyparse gram_parse
1921f1d7 63#define yylex gram_lex
e9955c83 64#define yyerror gram_error
1921f1d7
AD
65#define yylval gram_lval
66#define yychar gram_char
e9955c83
AD
67#define yydebug gram_debug
68#define yynerrs gram_nerrs
366eea36 69#define yylloc gram_lloc
e9955c83 70
1921f1d7 71/* Copy the first part of user declarations. */
9bc0dd67 72#line 1 "parse-gram.y"
a76ca263
PE
73/* Bison Grammar Parser -*- C -*-
74
f52b276c 75 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
a76ca263
PE
76
77 This file is part of Bison, the GNU Compiler Compiler.
78
79 This program is free software; you can redistribute it and/or modify
80 it under the terms of the GNU General Public License as published by
81 the Free Software Foundation; either version 2 of the License, or
82 (at your option) any later version.
83
84 This program is distributed in the hope that it will be useful,
85 but WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87 GNU General Public License for more details.
88
89 You should have received a copy of the GNU General Public License
90 along with this program; if not, write to the Free Software
0fb669f9
PE
91 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
92 02110-1301 USA
a76ca263 93*/
e9955c83 94
72c4d336 95#include <config.h>
e9955c83 96#include "system.h"
05d18c24 97
b275314e 98#include "complain.h"
05d18c24 99#include "conflicts.h"
e9955c83
AD
100#include "files.h"
101#include "getargs.h"
e9955c83 102#include "gram.h"
05d18c24 103#include "muscle_tab.h"
2ce37586 104#include "quotearg.h"
e9955c83 105#include "reader.h"
05d18c24 106#include "symlist.h"
e9071366
AD
107#include "scan-gram.h"
108#include "scan-code.h"
b50d2359 109#include "strverscmp.h"
e9955c83 110
05d18c24
PE
111#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
112static YYLTYPE lloc_default (YYLTYPE const *, int);
e9955c83 113
8a8dc872 114#define YY_LOCATION_PRINT(File, Loc) \
bf8b3d98 115 location_print (File, Loc)
8a8dc872 116
b50d2359
AD
117static void version_check (location const *loc, char const *version);
118
f0616f0b 119/* Request detailed syntax error messages, and pass them to GRAM_ERROR.
05d18c24 120 FIXME: depends on the undocumented availability of YYLLOC. */
e9955c83
AD
121#undef yyerror
122#define yyerror(Msg) \
bf8b3d98 123 gram_error (&yylloc, Msg)
05d18c24 124static void gram_error (location const *, char const *);
e9955c83 125
d2a1a60a
PE
126static char const *char_name (char);
127
73521d9f 128static void add_param (char const *, char *, location);
e9955c83 129
5f3df396
PE
130static symbol_class current_class = unknown_sym;
131static uniqstr current_type = 0;
7029f892
PE
132static symbol *current_lhs;
133static location current_lhs_location;
5f3df396 134static int current_prec = 0;
e9955c83 135
bf8b3d98
PE
136#ifdef UINT_FAST8_MAX
137# define YYTYPE_UINT8 uint_fast8_t
138#endif
139#ifdef INT_FAST8_MAX
140# define YYTYPE_INT8 int_fast8_t
141#endif
142#ifdef UINT_FAST16_MAX
143# define YYTYPE_UINT16 uint_fast16_t
144#endif
145#ifdef INT_FAST16_MAX
146# define YYTYPE_INT16 int_fast16_t
147#endif
148
1921f1d7 149
1921f1d7
AD
150/* Enabling traces. */
151#ifndef YYDEBUG
152# define YYDEBUG 1
153#endif
154
155/* Enabling verbose error messages. */
156#ifdef YYERROR_VERBOSE
157# undef YYERROR_VERBOSE
158# define YYERROR_VERBOSE 1
159#else
cd3684cf 160# define YYERROR_VERBOSE 1
1921f1d7
AD
161#endif
162
5f3df396
PE
163/* Enabling the token table. */
164#ifndef YYTOKEN_TABLE
165# define YYTOKEN_TABLE 0
166#endif
167
9bc0dd67
JD
168
169/* Tokens. */
170#ifndef YYTOKENTYPE
171# define YYTOKENTYPE
172 /* Put the tokens into the symbol table, so that GDB and other debuggers
173 know about them. */
174 enum yytokentype {
175 GRAM_EOF = 0,
176 STRING = 258,
177 INT = 259,
178 PERCENT_TOKEN = 260,
179 PERCENT_NTERM = 261,
180 PERCENT_TYPE = 262,
181 PERCENT_DESTRUCTOR = 263,
182 PERCENT_PRINTER = 264,
183 PERCENT_LEFT = 265,
184 PERCENT_RIGHT = 266,
185 PERCENT_NONASSOC = 267,
186 PERCENT_PREC = 268,
187 PERCENT_DPREC = 269,
188 PERCENT_MERGE = 270,
34f98f46
JD
189 PERCENT_AFTER_HEADER = 271,
190 PERCENT_BEFORE_HEADER = 272,
9bc0dd67
JD
191 PERCENT_DEBUG = 273,
192 PERCENT_DEFAULT_PREC = 274,
193 PERCENT_DEFINE = 275,
194 PERCENT_DEFINES = 276,
34f98f46
JD
195 PERCENT_END_HEADER = 277,
196 PERCENT_ERROR_VERBOSE = 278,
197 PERCENT_EXPECT = 279,
198 PERCENT_EXPECT_RR = 280,
199 PERCENT_FILE_PREFIX = 281,
200 PERCENT_GLR_PARSER = 282,
201 PERCENT_INITIAL_ACTION = 283,
202 PERCENT_LEX_PARAM = 284,
203 PERCENT_LOCATIONS = 285,
204 PERCENT_NAME_PREFIX = 286,
205 PERCENT_NO_DEFAULT_PREC = 287,
206 PERCENT_NO_LINES = 288,
207 PERCENT_NONDETERMINISTIC_PARSER = 289,
208 PERCENT_OUTPUT = 290,
209 PERCENT_PARSE_PARAM = 291,
210 PERCENT_PURE_PARSER = 292,
211 PERCENT_REQUIRE = 293,
212 PERCENT_SKELETON = 294,
213 PERCENT_START = 295,
214 PERCENT_START_HEADER = 296,
215 PERCENT_TOKEN_TABLE = 297,
216 PERCENT_VERBOSE = 298,
217 PERCENT_YACC = 299,
218 BRACED_CODE = 300,
219 CHAR = 301,
220 EPILOGUE = 302,
221 EQUAL = 303,
222 ID = 304,
223 ID_COLON = 305,
224 PERCENT_PERCENT = 306,
225 PIPE = 307,
226 PROLOGUE = 308,
227 SEMICOLON = 309,
228 TYPE = 310,
229 PERCENT_UNION = 311
9bc0dd67
JD
230 };
231#endif
232/* Tokens. */
233#define GRAM_EOF 0
234#define STRING 258
235#define INT 259
236#define PERCENT_TOKEN 260
237#define PERCENT_NTERM 261
238#define PERCENT_TYPE 262
239#define PERCENT_DESTRUCTOR 263
240#define PERCENT_PRINTER 264
241#define PERCENT_LEFT 265
242#define PERCENT_RIGHT 266
243#define PERCENT_NONASSOC 267
244#define PERCENT_PREC 268
245#define PERCENT_DPREC 269
246#define PERCENT_MERGE 270
34f98f46
JD
247#define PERCENT_AFTER_HEADER 271
248#define PERCENT_BEFORE_HEADER 272
9bc0dd67
JD
249#define PERCENT_DEBUG 273
250#define PERCENT_DEFAULT_PREC 274
251#define PERCENT_DEFINE 275
252#define PERCENT_DEFINES 276
34f98f46
JD
253#define PERCENT_END_HEADER 277
254#define PERCENT_ERROR_VERBOSE 278
255#define PERCENT_EXPECT 279
256#define PERCENT_EXPECT_RR 280
257#define PERCENT_FILE_PREFIX 281
258#define PERCENT_GLR_PARSER 282
259#define PERCENT_INITIAL_ACTION 283
260#define PERCENT_LEX_PARAM 284
261#define PERCENT_LOCATIONS 285
262#define PERCENT_NAME_PREFIX 286
263#define PERCENT_NO_DEFAULT_PREC 287
264#define PERCENT_NO_LINES 288
265#define PERCENT_NONDETERMINISTIC_PARSER 289
266#define PERCENT_OUTPUT 290
267#define PERCENT_PARSE_PARAM 291
268#define PERCENT_PURE_PARSER 292
269#define PERCENT_REQUIRE 293
270#define PERCENT_SKELETON 294
271#define PERCENT_START 295
272#define PERCENT_START_HEADER 296
273#define PERCENT_TOKEN_TABLE 297
274#define PERCENT_VERBOSE 298
275#define PERCENT_YACC 299
276#define BRACED_CODE 300
277#define CHAR 301
278#define EPILOGUE 302
279#define EQUAL 303
280#define ID 304
281#define ID_COLON 305
282#define PERCENT_PERCENT 306
283#define PIPE 307
284#define PROLOGUE 308
285#define SEMICOLON 309
286#define TYPE 310
287#define PERCENT_UNION 311
9bc0dd67
JD
288
289
290
291
bf8b3d98
PE
292#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
293typedef union YYSTYPE
9bc0dd67 294#line 97 "parse-gram.y"
f52b276c 295{
05d18c24
PE
296 symbol *symbol;
297 symbol_list *list;
e9955c83 298 int integer;
05d18c24
PE
299 char *chars;
300 assoc assoc;
301 uniqstr uniqstr;
58d7a1a1 302 unsigned char character;
f52b276c 303}
9bc0dd67 304/* Line 197 of yacc.c. */
34f98f46 305#line 306 "parse-gram.c"
f52b276c 306 YYSTYPE;
73521d9f
PE
307# define yystype YYSTYPE /* obsolescent; will be withdrawn */
308# define YYSTYPE_IS_DECLARED 1
e9955c83
AD
309# define YYSTYPE_IS_TRIVIAL 1
310#endif
311
bf8b3d98 312#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
73521d9f 313typedef struct YYLTYPE
e9955c83
AD
314{
315 int first_line;
316 int first_column;
317 int last_line;
318 int last_column;
73521d9f
PE
319} YYLTYPE;
320# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
321# define YYLTYPE_IS_DECLARED 1
e9955c83
AD
322# define YYLTYPE_IS_TRIVIAL 1
323#endif
324
73521d9f 325
1921f1d7 326/* Copy the second part of user declarations. */
0c15323d 327
0c15323d 328
9bc0dd67 329/* Line __line__ of yacc.c. */
34f98f46 330#line 331 "parse-gram.c"
bf8b3d98
PE
331
332#ifdef short
333# undef short
334#endif
335
336#ifdef YYTYPE_UINT8
337typedef YYTYPE_UINT8 yytype_uint8;
338#else
339typedef unsigned char yytype_uint8;
340#endif
341
342#ifdef YYTYPE_INT8
343typedef YYTYPE_INT8 yytype_int8;
344#elif (defined __STDC__ || defined __C99__FUNC__ \
345 || defined __cplusplus || defined _MSC_VER)
346typedef signed char yytype_int8;
347#else
348typedef short int yytype_int8;
349#endif
350
351#ifdef YYTYPE_UINT16
352typedef YYTYPE_UINT16 yytype_uint16;
353#else
354typedef unsigned short int yytype_uint16;
355#endif
356
357#ifdef YYTYPE_INT16
358typedef YYTYPE_INT16 yytype_int16;
359#else
360typedef short int yytype_int16;
361#endif
2ed28444 362
ac243428 363#ifndef YYSIZE_T
bf8b3d98 364# ifdef __SIZE_TYPE__
ac243428 365# define YYSIZE_T __SIZE_TYPE__
bf8b3d98 366# elif defined size_t
ac243428 367# define YYSIZE_T size_t
bf8b3d98
PE
368# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
369 || defined __cplusplus || defined _MSC_VER)
ac243428
PE
370# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
371# define YYSIZE_T size_t
372# else
373# define YYSIZE_T unsigned int
374# endif
4b43d402 375#endif
e9955c83 376
2abdfeef
PE
377#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
378
6088a2a0
PE
379#ifndef YY_
380# if YYENABLE_NLS
381# if ENABLE_NLS
382# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
383# define YY_(msgid) dgettext ("bison-runtime", msgid)
384# endif
385# endif
386# ifndef YY_
387# define YY_(msgid) msgid
388# endif
389#endif
390
e764d4df 391/* Suppress unused-variable warnings by "using" E. */
bf8b3d98 392#if ! defined lint || defined __GNUC__
7029f892
PE
393# define YYUSE(e) ((void) (e))
394#else
395# define YYUSE(e) /* empty */
396#endif
397
398/* Identity function, used to suppress warnings about constant conditions. */
399#ifndef lint
400# define YYID(n) (n)
401#else
bf8b3d98
PE
402#if (defined __STDC__ || defined __C99__FUNC__ \
403 || defined __cplusplus || defined _MSC_VER)
7029f892
PE
404static int
405YYID (int i)
406#else
407static int
408YYID (i)
409 int i;
410#endif
411{
412 return i;
413}
414#endif
e764d4df 415
bf8b3d98 416#if ! defined yyoverflow || YYERROR_VERBOSE
cd3684cf 417
e9955c83
AD
418/* The parser invokes alloca or malloc; define the necessary symbols. */
419
eae34f44
PE
420# ifdef YYSTACK_USE_ALLOCA
421# if YYSTACK_USE_ALLOCA
eae34f44
PE
422# ifdef __GNUC__
423# define YYSTACK_ALLOC __builtin_alloca
bf8b3d98 424# elif defined __BUILTIN_VA_ARG_INCR
ac243428 425# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
bf8b3d98 426# elif defined _AIX
ac243428 427# define YYSTACK_ALLOC __alloca
bf8b3d98 428# elif defined _MSC_VER
ac243428
PE
429# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
430# define alloca _alloca
da436e43
PE
431# else
432# define YYSTACK_ALLOC alloca
bf8b3d98
PE
433# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
434 || defined __cplusplus || defined _MSC_VER)
4b43d402 435# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
ac243428
PE
436# ifndef _STDLIB_H
437# define _STDLIB_H 1
438# endif
4b43d402 439# endif
e9955c83
AD
440# endif
441# endif
442# endif
443
444# ifdef YYSTACK_ALLOC
3b0ffc7e 445 /* Pacify GCC's `empty if-body' warning. */
7029f892 446# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
2ce37586 447# ifndef YYSTACK_ALLOC_MAXIMUM
7768896a
PE
448 /* The OS might guarantee only one guard page at the bottom of the stack,
449 and a page size can be as small as 4096 bytes. So we cannot safely
450 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
451 to allow for a few compiler-allocated temporary stack slots. */
f52b276c 452# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
2ce37586 453# endif
e9955c83 454# else
cd3684cf
AD
455# define YYSTACK_ALLOC YYMALLOC
456# define YYSTACK_FREE YYFREE
2ce37586 457# ifndef YYSTACK_ALLOC_MAXIMUM
2abdfeef 458# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
2ce37586 459# endif
765f22f0
PE
460# if (defined __cplusplus && ! defined _STDLIB_H \
461 && ! ((defined YYMALLOC || defined malloc) \
462 && (defined YYFREE || defined free)))
463# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
464# ifndef _STDLIB_H
465# define _STDLIB_H 1
466# endif
0925ebb4 467# endif
4b43d402
PE
468# ifndef YYMALLOC
469# define YYMALLOC malloc
bf8b3d98
PE
470# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
471 || defined __cplusplus || defined _MSC_VER)
4b43d402
PE
472void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
473# endif
474# endif
475# ifndef YYFREE
476# define YYFREE free
bf8b3d98
PE
477# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
478 || defined __cplusplus || defined _MSC_VER)
4b43d402
PE
479void free (void *); /* INFRINGES ON USER NAME SPACE */
480# endif
481# endif
e9955c83 482# endif
bf8b3d98 483#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
e9955c83
AD
484
485
bf8b3d98
PE
486#if (! defined yyoverflow \
487 && (! defined __cplusplus \
488 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
489 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
e9955c83
AD
490
491/* A type that is properly aligned for any stack member. */
492union yyalloc
493{
bf8b3d98 494 yytype_int16 yyss;
e9955c83 495 YYSTYPE yyvs;
366eea36 496 YYLTYPE yyls;
e9955c83
AD
497};
498
499/* The size of the maximum gap between one aligned stack and the next. */
05d18c24 500# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
e9955c83
AD
501
502/* The size of an array large to enough to hold all stacks, each with
503 N elements. */
366eea36 504# define YYSTACK_BYTES(N) \
bf8b3d98 505 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
05d18c24 506 + 2 * YYSTACK_GAP_MAXIMUM)
e9955c83
AD
507
508/* Copy COUNT objects from FROM to TO. The source and destination do
509 not overlap. */
510# ifndef YYCOPY
bf8b3d98 511# if defined __GNUC__ && 1 < __GNUC__
e9955c83
AD
512# define YYCOPY(To, From, Count) \
513 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
514# else
515# define YYCOPY(To, From, Count) \
516 do \
517 { \
b4fb989f 518 YYSIZE_T yyi; \
e9955c83 519 for (yyi = 0; yyi < (Count); yyi++) \
f0616f0b 520 (To)[yyi] = (From)[yyi]; \
e9955c83 521 } \
7029f892 522 while (YYID (0))
e9955c83
AD
523# endif
524# endif
525
526/* Relocate STACK from its old location to the new one. The
527 local variables YYSIZE and YYSTACKSIZE give the old and new number of
528 elements in the stack, and YYPTR gives the new location of the
529 stack. Advance YYPTR to a properly aligned location for the next
530 stack. */
531# define YYSTACK_RELOCATE(Stack) \
532 do \
533 { \
534 YYSIZE_T yynewbytes; \
535 YYCOPY (&yyptr->Stack, Stack, yysize); \
536 Stack = &yyptr->Stack; \
05d18c24 537 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
e9955c83
AD
538 yyptr += yynewbytes / sizeof (*yyptr); \
539 } \
7029f892 540 while (YYID (0))
e9955c83
AD
541
542#endif
543
3b0ffc7e 544/* YYFINAL -- State number of the termination state. */
1921f1d7 545#define YYFINAL 3
d33cb3ae 546/* YYLAST -- Last index in YYTABLE. */
34f98f46 547#define YYLAST 192
1921f1d7 548
3b0ffc7e 549/* YYNTOKENS -- Number of terminals. */
34f98f46 550#define YYNTOKENS 57
3b0ffc7e 551/* YYNNTS -- Number of nonterminals. */
58d7a1a1 552#define YYNNTS 27
3b0ffc7e 553/* YYNRULES -- Number of rules. */
34f98f46 554#define YYNRULES 89
3b0ffc7e 555/* YYNRULES -- Number of states. */
34f98f46 556#define YYNSTATES 128
1921f1d7
AD
557
558/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
559#define YYUNDEFTOK 2
34f98f46 560#define YYMAXUTOK 311
1921f1d7 561
5f3df396 562#define YYTRANSLATE(YYX) \
73521d9f 563 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1921f1d7
AD
564
565/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
bf8b3d98 566static const yytype_uint8 yytranslate[] =
1921f1d7
AD
567{
568 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
594 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
595 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
596 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
ae7453f2 597 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
34f98f46
JD
598 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
599 55, 56
1921f1d7
AD
600};
601
602#if YYDEBUG
603/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
604 YYRHS. */
bf8b3d98 605static const yytype_uint8 yyprhs[] =
1921f1d7 606{
9bc0dd67 607 0, 0, 3, 8, 9, 12, 14, 16, 19, 22,
34f98f46
JD
608 24, 27, 31, 33, 36, 38, 41, 44, 48, 50,
609 53, 56, 58, 62, 64, 66, 70, 73, 75, 78,
610 81, 84, 86, 88, 90, 92, 94, 96, 99, 103,
611 107, 109, 111, 112, 114, 118, 119, 123, 124, 128,
612 132, 136, 138, 140, 142, 143, 145, 147, 150, 152,
613 154, 157, 160, 164, 166, 169, 171, 174, 176, 179,
614 182, 183, 187, 189, 193, 196, 197, 200, 203, 207,
615 211, 215, 217, 219, 221, 223, 225, 227, 229, 230
1921f1d7
AD
616};
617
3b0ffc7e 618/* YYRHS -- A `-1'-separated list of the rules' RHS. */
bf8b3d98 619static const yytype_int8 yyrhs[] =
1921f1d7 620{
34f98f46
JD
621 58, 0, -1, 59, 51, 72, 83, -1, -1, 59,
622 60, -1, 61, -1, 53, -1, 16, 45, -1, 17,
623 45, -1, 18, -1, 20, 82, -1, 20, 82, 82,
624 -1, 21, -1, 22, 45, -1, 23, -1, 24, 4,
625 -1, 25, 4, -1, 26, 48, 82, -1, 27, -1,
626 28, 45, -1, 29, 45, -1, 30, -1, 31, 48,
627 82, -1, 33, -1, 34, -1, 35, 48, 82, -1,
628 36, 45, -1, 37, -1, 38, 82, -1, 39, 82,
629 -1, 41, 45, -1, 42, -1, 43, -1, 44, -1,
630 54, -1, 66, -1, 63, -1, 40, 80, -1, 8,
631 45, 69, -1, 9, 45, 69, -1, 19, -1, 32,
632 -1, -1, 49, -1, 56, 62, 45, -1, -1, 6,
633 64, 71, -1, -1, 5, 65, 71, -1, 7, 55,
634 69, -1, 67, 68, 69, -1, 10, -1, 11, -1,
635 12, -1, -1, 55, -1, 80, -1, 69, 80, -1,
636 55, -1, 78, -1, 78, 4, -1, 78, 81, -1,
637 78, 4, 81, -1, 70, -1, 71, 70, -1, 73,
638 -1, 72, 73, -1, 74, -1, 61, 54, -1, 1,
639 54, -1, -1, 79, 75, 76, -1, 77, -1, 76,
640 52, 77, -1, 76, 54, -1, -1, 77, 80, -1,
641 77, 45, -1, 77, 13, 80, -1, 77, 14, 4,
642 -1, 77, 15, 55, -1, 49, -1, 46, -1, 50,
643 -1, 78, -1, 81, -1, 3, -1, 3, -1, -1,
644 51, 47, -1
1921f1d7
AD
645};
646
647/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
bf8b3d98 648static const yytype_uint16 yyrline[] =
1921f1d7 649{
34f98f46
JD
650 0, 202, 202, 210, 212, 216, 217, 221, 227, 233,
651 234, 239, 240, 241, 247, 248, 249, 250, 251, 256,
652 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
653 270, 276, 277, 278, 279, 283, 284, 285, 289, 297,
654 305, 309, 323, 324, 328, 350, 350, 355, 355, 360,
655 370, 385, 386, 387, 391, 392, 397, 398, 403, 407,
656 412, 418, 424, 435, 436, 445, 446, 452, 453, 454,
381ecb06
JD
657 461, 461, 465, 466, 467, 472, 473, 475, 477, 479,
658 481, 494, 496, 505, 510, 511, 516, 525, 530, 532
1921f1d7
AD
659};
660#endif
661
5f3df396 662#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
9cbfdc9e 663/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
3b0ffc7e 664 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1921f1d7
AD
665static const char *const yytname[] =
666{
9cbfdc9e 667 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
e9071366 668 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
58d7a1a1 669 "\"%printer\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"", "\"%prec\"",
34f98f46
JD
670 "\"%dprec\"", "\"%merge\"", "\"%after-header\"", "\"%before-header\"",
671 "\"%debug\"", "\"%default-prec\"", "\"%define\"", "\"%defines\"",
672 "\"%end-header\"", "\"%error-verbose\"", "\"%expect\"", "\"%expect-rr\"",
673 "\"%file-prefix\"", "\"%glr-parser\"", "\"%initial-action\"",
674 "\"%lex-param\"", "\"%locations\"", "\"%name-prefix\"",
675 "\"%no-default-prec\"", "\"%no-lines\"", "\"%nondeterministic-parser\"",
676 "\"%output\"", "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"",
677 "\"%skeleton\"", "\"%start\"", "\"%start-header\"", "\"%token-table\"",
678 "\"%verbose\"", "\"%yacc\"", "\"{...}\"", "\"char\"", "\"epilogue\"",
679 "\"=\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"|\"",
680 "\"%{...%}\"", "\";\"", "\"type\"", "\"%union\"", "$accept", "input",
681 "declarations", "declaration", "grammar_declaration", "union_name",
682 "symbol_declaration", "@1", "@2", "precedence_declaration",
b50d2359
AD
683 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
684 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
58d7a1a1
AD
685 "@3", "rhses.1", "rhs", "id", "id_colon", "symbol", "string_as_id",
686 "string_content", "epilogue.opt", 0
1921f1d7
AD
687};
688#endif
689
3d38c03a 690# ifdef YYPRINT
1921f1d7
AD
691/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
692 token YYLEX-NUM. */
bf8b3d98 693static const yytype_uint16 yytoknum[] =
1921f1d7
AD
694{
695 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
696 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
697 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
698 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
d6328241 699 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
34f98f46 700 305, 306, 307, 308, 309, 310, 311
1921f1d7 701};
3d38c03a 702# endif
1921f1d7
AD
703
704/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
bf8b3d98 705static const yytype_uint8 yyr1[] =
1921f1d7 706{
34f98f46
JD
707 0, 57, 58, 59, 59, 60, 60, 60, 60, 60,
708 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
709 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
710 60, 60, 60, 60, 60, 61, 61, 61, 61, 61,
711 61, 61, 62, 62, 61, 64, 63, 65, 63, 63,
712 66, 67, 67, 67, 68, 68, 69, 69, 70, 70,
713 70, 70, 70, 71, 71, 72, 72, 73, 73, 73,
714 75, 74, 76, 76, 76, 77, 77, 77, 77, 77,
715 77, 78, 78, 79, 80, 80, 81, 82, 83, 83
1921f1d7
AD
716};
717
718/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
bf8b3d98 719static const yytype_uint8 yyr2[] =
1921f1d7 720{
9bc0dd67 721 0, 2, 4, 0, 2, 1, 1, 2, 2, 1,
34f98f46
JD
722 2, 3, 1, 2, 1, 2, 2, 3, 1, 2,
723 2, 1, 3, 1, 1, 3, 2, 1, 2, 2,
724 2, 1, 1, 1, 1, 1, 1, 2, 3, 3,
725 1, 1, 0, 1, 3, 0, 3, 0, 3, 3,
726 3, 1, 1, 1, 0, 1, 1, 2, 1, 1,
727 2, 2, 3, 1, 2, 1, 2, 1, 2, 2,
728 0, 3, 1, 3, 2, 0, 2, 2, 3, 3,
729 3, 1, 1, 1, 1, 1, 1, 1, 0, 2
1921f1d7
AD
730};
731
732/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
733 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
734 means the default is an error. */
bf8b3d98 735static const yytype_uint8 yydefact[] =
1921f1d7 736{
34f98f46
JD
737 3, 0, 0, 1, 47, 45, 0, 0, 0, 51,
738 52, 53, 0, 0, 9, 40, 0, 12, 0, 14,
739 0, 0, 0, 18, 0, 0, 21, 0, 41, 23,
740 24, 0, 0, 27, 0, 0, 0, 0, 31, 32,
741 33, 0, 6, 34, 42, 4, 5, 36, 35, 54,
742 0, 0, 0, 0, 0, 7, 8, 87, 10, 13,
743 15, 16, 0, 19, 20, 0, 0, 26, 28, 29,
744 86, 82, 81, 84, 37, 85, 30, 0, 83, 0,
745 0, 65, 67, 70, 43, 0, 55, 0, 58, 63,
746 48, 59, 46, 49, 56, 38, 39, 11, 17, 22,
747 25, 69, 68, 0, 66, 2, 75, 44, 50, 64,
748 60, 61, 57, 89, 71, 72, 62, 75, 74, 0,
749 0, 0, 77, 76, 73, 78, 79, 80
1921f1d7
AD
750};
751
3b0ffc7e 752/* YYDEFGOTO[NTERM-NUM]. */
bf8b3d98 753static const yytype_int8 yydefgoto[] =
1921f1d7 754{
34f98f46
JD
755 -1, 1, 2, 45, 79, 85, 47, 51, 50, 48,
756 49, 87, 93, 89, 90, 80, 81, 82, 106, 114,
757 115, 73, 83, 94, 75, 58, 105
1921f1d7
AD
758};
759
760/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
761 STATE-NUM. */
34f98f46 762#define YYPACT_NINF -76
9bc0dd67 763static const yytype_int16 yypact[] =
1921f1d7 764{
34f98f46
JD
765 -76, 6, 136, -76, -76, -76, -40, -12, -9, -76,
766 -76, -76, -5, 1, -76, -76, 40, -76, 5, -76,
767 47, 50, 7, -76, 11, 18, -76, 19, -76, -76,
768 -76, 20, 25, -76, 40, 40, -2, 26, -76, -76,
769 -76, 84, -76, -76, 27, -76, -76, -76, -76, 14,
770 -23, -23, -2, -2, -2, -76, -76, -76, 40, -76,
771 -76, -76, 40, -76, -76, 40, 40, -76, -76, -76,
772 -76, -76, -76, -76, -76, -76, -76, 21, -76, 23,
773 2, -76, -76, -76, -76, 28, -76, -2, -76, -76,
774 -23, 24, -23, -2, -76, -2, -2, -76, -76, -76,
775 -76, -76, -76, 31, -76, -76, -76, -76, -2, -76,
776 71, -76, -76, -76, -32, 16, -76, -76, -76, -2,
777 76, 29, -76, -76, 16, -76, -76, -76
1921f1d7
AD
778};
779
780/* YYPGOTO[NTERM-NUM]. */
9bc0dd67 781static const yytype_int8 yypgoto[] =
1921f1d7 782{
34f98f46
JD
783 -76, -76, -76, -76, 79, -76, -76, -76, -76, -76,
784 -76, -76, -49, -53, 35, -76, 17, -76, -76, -76,
785 -35, -26, -76, -36, -75, -17, -76
1921f1d7
AD
786};
787
788/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
789 positive, shift that token. If negative, reduce the rule which
ae7453f2 790 number is the opposite. If zero, do what YYDEFACT says.
f0616f0b 791 If YYTABLE_NINF, syntax error. */
34f98f46 792#define YYTABLE_NINF -89
bf8b3d98 793static const yytype_int8 yytable[] =
1921f1d7 794{
34f98f46
JD
795 74, 70, -88, 77, 95, 96, 3, 4, 5, 6,
796 7, 8, 9, 10, 11, 52, 111, 68, 69, 70,
797 117, 15, 118, 71, 91, 91, 72, 70, 110, 119,
798 120, 121, 88, 53, 28, 116, 54, 109, 108, 109,
799 55, 97, 36, 57, 71, 98, 56, 72, 99, 100,
800 59, 60, 78, 103, 61, 62, 63, 112, 44, 112,
801 112, 122, 71, 64, 91, 72, 91, 65, 66, 86,
802 67, 76, 112, 107, 70, 101, 84, 102, 113, 123,
803 126, 46, 124, 125, 127, 77, 92, 0, 123, 4,
804 5, 6, 7, 8, 9, 10, 11, 104, 0, 0,
805 0, 0, 0, 15, 0, 0, 0, 0, 0, 0,
806 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
807 0, 0, 0, 0, 36, 0, 0, 0, 0, 0,
808 0, 0, 0, 0, 78, 0, 0, 0, 0, 0,
809 44, 4, 5, 6, 7, 8, 9, 10, 11, 0,
810 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
811 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
812 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
813 40, 0, 0, 0, 0, 0, 0, 41, 0, 42,
814 43, 0, 44
1921f1d7
AD
815};
816
9bc0dd67 817static const yytype_int8 yycheck[] =
1921f1d7 818{
34f98f46
JD
819 36, 3, 0, 1, 53, 54, 0, 5, 6, 7,
820 8, 9, 10, 11, 12, 55, 91, 34, 35, 3,
821 52, 19, 54, 46, 50, 51, 49, 3, 4, 13,
822 14, 15, 55, 45, 32, 110, 45, 90, 87, 92,
823 45, 58, 40, 3, 46, 62, 45, 49, 65, 66,
824 45, 4, 50, 51, 4, 48, 45, 93, 56, 95,
825 96, 45, 46, 45, 90, 49, 92, 48, 48, 55,
826 45, 45, 108, 45, 3, 54, 49, 54, 47, 115,
827 4, 2, 117, 119, 55, 1, 51, -1, 124, 5,
828 6, 7, 8, 9, 10, 11, 12, 80, -1, -1,
829 -1, -1, -1, 19, -1, -1, -1, -1, -1, -1,
830 -1, -1, -1, -1, -1, -1, 32, -1, -1, -1,
831 -1, -1, -1, -1, 40, -1, -1, -1, -1, -1,
832 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
833 56, 5, 6, 7, 8, 9, 10, 11, 12, -1,
834 -1, -1, 16, 17, 18, 19, 20, 21, 22, 23,
835 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
836 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
837 44, -1, -1, -1, -1, -1, -1, 51, -1, 53,
838 54, -1, 56
1921f1d7
AD
839};
840
1921f1d7
AD
841/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
842 symbol of state STATE-NUM. */
bf8b3d98 843static const yytype_uint8 yystos[] =
1921f1d7 844{
34f98f46 845 0, 58, 59, 0, 5, 6, 7, 8, 9, 10,
58d7a1a1 846 11, 12, 16, 17, 18, 19, 20, 21, 22, 23,
62ddaef6 847 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34f98f46
JD
848 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
849 44, 51, 53, 54, 56, 60, 61, 63, 66, 67,
850 65, 64, 55, 45, 45, 45, 45, 3, 82, 45,
851 4, 4, 48, 45, 45, 48, 48, 45, 82, 82,
852 3, 46, 49, 78, 80, 81, 45, 1, 50, 61,
853 72, 73, 74, 79, 49, 62, 55, 68, 55, 70,
854 71, 78, 71, 69, 80, 69, 69, 82, 82, 82,
855 82, 54, 54, 51, 73, 83, 75, 45, 69, 70,
856 4, 81, 80, 47, 76, 77, 81, 52, 54, 13,
857 14, 15, 45, 80, 77, 80, 4, 55
1921f1d7 858};
e9955c83 859
e9955c83 860#define yyerrok (yyerrstatus = 0)
73521d9f
PE
861#define yyclearin (yychar = YYEMPTY)
862#define YYEMPTY (-2)
e9955c83 863#define YYEOF 0
1921f1d7 864
e9955c83 865#define YYACCEPT goto yyacceptlab
1921f1d7 866#define YYABORT goto yyabortlab
465b4444 867#define YYERROR goto yyerrorlab
6d5aa694 868
1921f1d7 869
e9955c83
AD
870/* Like YYERROR except do call yyerror. This remains here temporarily
871 to ease the transition to the new meaning of YYERROR, for GCC.
872 Once GCC version 2 has supplanted version 1, this can go. */
1921f1d7 873
e9955c83 874#define YYFAIL goto yyerrlab
1921f1d7 875
e9955c83 876#define YYRECOVERING() (!!yyerrstatus)
1921f1d7 877
e9955c83
AD
878#define YYBACKUP(Token, Value) \
879do \
73521d9f 880 if (yychar == YYEMPTY && yylen == 1) \
e9955c83
AD
881 { \
882 yychar = (Token); \
883 yylval = (Value); \
886b69d1 884 yytoken = YYTRANSLATE (yychar); \
3b0ffc7e 885 YYPOPSTACK (1); \
e9955c83
AD
886 goto yybackup; \
887 } \
888 else \
5f3df396 889 { \
6088a2a0 890 yyerror (YY_("syntax error: cannot back up")); \
e9955c83
AD
891 YYERROR; \
892 } \
7029f892 893while (YYID (0))
e9955c83 894
8a8dc872 895
e9955c83
AD
896#define YYTERROR 1
897#define YYERRCODE 256
898
8a8dc872
AD
899
900/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
901 If N is 0, then set CURRENT to the empty location which ends
902 the previous symbol: RHS[0] (always defined). */
e9955c83 903
bbd3fa0c 904#define YYRHSLOC(Rhs, K) ((Rhs)[K])
e9955c83 905#ifndef YYLLOC_DEFAULT
bbd3fa0c
PE
906# define YYLLOC_DEFAULT(Current, Rhs, N) \
907 do \
3b0ffc7e 908 if (YYID (N)) \
bbd3fa0c 909 { \
da436e43
PE
910 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
911 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
912 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
913 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
bbd3fa0c
PE
914 } \
915 else \
916 { \
917 (Current).first_line = (Current).last_line = \
da436e43 918 YYRHSLOC (Rhs, 0).last_line; \
bbd3fa0c 919 (Current).first_column = (Current).last_column = \
da436e43 920 YYRHSLOC (Rhs, 0).last_column; \
bbd3fa0c 921 } \
7029f892 922 while (YYID (0))
8a8dc872
AD
923#endif
924
925
926/* YY_LOCATION_PRINT -- Print the location on the stream.
927 This macro was not mandated originally: define only if we know
928 we won't break user code: when these are the locations we know. */
929
930#ifndef YY_LOCATION_PRINT
931# if YYLTYPE_IS_TRIVIAL
932# define YY_LOCATION_PRINT(File, Loc) \
933 fprintf (File, "%d.%d-%d.%d", \
bf8b3d98
PE
934 (Loc).first_line, (Loc).first_column, \
935 (Loc).last_line, (Loc).last_column)
8a8dc872
AD
936# else
937# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
938# endif
e9955c83
AD
939#endif
940
8a8dc872 941
e9955c83
AD
942/* YYLEX -- calling `yylex' with the right arguments. */
943
366eea36 944#ifdef YYLEX_PARAM
d33cb3ae 945# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
366eea36 946#else
d33cb3ae 947# define YYLEX yylex (&yylval, &yylloc)
366eea36 948#endif
e9955c83
AD
949
950/* Enable debugging if requested. */
951#if YYDEBUG
952
74e543d2 953# ifndef YYFPRINTF
e9955c83
AD
954# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
955# define YYFPRINTF fprintf
956# endif
957
958# define YYDPRINTF(Args) \
959do { \
960 if (yydebug) \
961 YYFPRINTF Args; \
7029f892 962} while (YYID (0))
05d18c24 963
4b367315
AD
964# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
965do { \
966 if (yydebug) \
967 { \
968 YYFPRINTF (stderr, "%s ", Title); \
3b0ffc7e 969 yy_symbol_print (stderr, \
bf8b3d98 970 Type, Value, Location); \
4b367315
AD
971 YYFPRINTF (stderr, "\n"); \
972 } \
7029f892 973} while (YYID (0))
f0616f0b 974
3b0ffc7e 975
66809587
PE
976/*--------------------------------.
977| Print this symbol on YYOUTPUT. |
978`--------------------------------*/
979
7029f892 980/*ARGSUSED*/
bf8b3d98
PE
981#if (defined __STDC__ || defined __C99__FUNC__ \
982 || defined __cplusplus || defined _MSC_VER)
66809587 983static void
d2a1a60a 984yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
66809587
PE
985#else
986static void
3b0ffc7e 987yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
66809587
PE
988 FILE *yyoutput;
989 int yytype;
d2a1a60a
PE
990 YYSTYPE const * const yyvaluep;
991 YYLTYPE const * const yylocationp;
66809587
PE
992#endif
993{
bf8b3d98
PE
994 if (!yyvaluep)
995 return;
66809587 996 YYUSE (yylocationp);
66809587
PE
997# ifdef YYPRINT
998 if (yytype < YYNTOKENS)
999 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
bf8b3d98
PE
1000# else
1001 YYUSE (yyoutput);
66809587
PE
1002# endif
1003 switch (yytype)
1004 {
1005 case 3: /* "\"string\"" */
9bc0dd67 1006#line 181 "parse-gram.y"
d2a1a60a 1007 { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); };
34f98f46 1008#line 1009 "parse-gram.c"
bf8b3d98
PE
1009 break;
1010 case 4: /* "\"integer\"" */
9bc0dd67 1011#line 191 "parse-gram.y"
bf8b3d98 1012 { fprintf (stderr, "%d", (yyvaluep->integer)); };
34f98f46 1013#line 1014 "parse-gram.c"
bf8b3d98 1014 break;
34f98f46 1015 case 45: /* "\"{...}\"" */
9bc0dd67 1016#line 183 "parse-gram.y"
bf8b3d98 1017 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
34f98f46 1018#line 1019 "parse-gram.c"
bf8b3d98 1019 break;
34f98f46 1020 case 46: /* "\"char\"" */
9bc0dd67 1021#line 178 "parse-gram.y"
d2a1a60a 1022 { fputs (char_name ((yyvaluep->character)), stderr); };
34f98f46 1023#line 1024 "parse-gram.c"
bf8b3d98 1024 break;
34f98f46 1025 case 47: /* "\"epilogue\"" */
9bc0dd67 1026#line 183 "parse-gram.y"
58d7a1a1 1027 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
34f98f46 1028#line 1029 "parse-gram.c"
bf8b3d98 1029 break;
34f98f46 1030 case 49: /* "\"identifier\"" */
9bc0dd67 1031#line 187 "parse-gram.y"
d2a1a60a 1032 { fputs ((yyvaluep->uniqstr), stderr); };
34f98f46 1033#line 1034 "parse-gram.c"
58d7a1a1 1034 break;
34f98f46 1035 case 50: /* "\"identifier:\"" */
9bc0dd67 1036#line 188 "parse-gram.y"
58d7a1a1 1037 { fprintf (stderr, "%s:", (yyvaluep->uniqstr)); };
34f98f46 1038#line 1039 "parse-gram.c"
bf8b3d98 1039 break;
34f98f46 1040 case 53: /* "\"%{...%}\"" */
9bc0dd67 1041#line 183 "parse-gram.y"
bf8b3d98 1042 { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
34f98f46 1043#line 1044 "parse-gram.c"
bf8b3d98 1044 break;
34f98f46 1045 case 55: /* "\"type\"" */
9bc0dd67 1046#line 186 "parse-gram.y"
58d7a1a1 1047 { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); };
34f98f46 1048#line 1049 "parse-gram.c"
e9071366 1049 break;
34f98f46 1050 case 78: /* "id" */
9bc0dd67 1051#line 194 "parse-gram.y"
58d7a1a1 1052 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
34f98f46 1053#line 1054 "parse-gram.c"
bf8b3d98 1054 break;
34f98f46 1055 case 79: /* "id_colon" */
9bc0dd67 1056#line 195 "parse-gram.y"
58d7a1a1 1057 { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); };
34f98f46 1058#line 1059 "parse-gram.c"
58d7a1a1 1059 break;
34f98f46 1060 case 80: /* "symbol" */
9bc0dd67 1061#line 194 "parse-gram.y"
bf8b3d98 1062 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
34f98f46 1063#line 1064 "parse-gram.c"
bf8b3d98 1064 break;
34f98f46 1065 case 81: /* "string_as_id" */
9bc0dd67 1066#line 194 "parse-gram.y"
bf8b3d98 1067 { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
34f98f46 1068#line 1069 "parse-gram.c"
bf8b3d98 1069 break;
34f98f46 1070 case 82: /* "string_content" */
9bc0dd67 1071#line 181 "parse-gram.y"
d2a1a60a 1072 { fputs (quotearg_style (c_quoting_style, (yyvaluep->chars)), stderr); };
34f98f46 1073#line 1074 "parse-gram.c"
bf8b3d98 1074 break;
66809587 1075 default:
bf8b3d98 1076 break;
66809587 1077 }
3b0ffc7e
PE
1078}
1079
1080
1081/*--------------------------------.
1082| Print this symbol on YYOUTPUT. |
1083`--------------------------------*/
1084
bf8b3d98
PE
1085#if (defined __STDC__ || defined __C99__FUNC__ \
1086 || defined __cplusplus || defined _MSC_VER)
3b0ffc7e 1087static void
d2a1a60a 1088yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
3b0ffc7e
PE
1089#else
1090static void
1091yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1092 FILE *yyoutput;
1093 int yytype;
d2a1a60a
PE
1094 YYSTYPE const * const yyvaluep;
1095 YYLTYPE const * const yylocationp;
3b0ffc7e
PE
1096#endif
1097{
1098 if (yytype < YYNTOKENS)
1099 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1100 else
1101 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1102
1103 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1104 YYFPRINTF (yyoutput, ": ");
1105 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
66809587
PE
1106 YYFPRINTF (yyoutput, ")");
1107}
1108
05d18c24
PE
1109/*------------------------------------------------------------------.
1110| yy_stack_print -- Print the state stack from its BOTTOM up to its |
cd3684cf 1111| TOP (included). |
05d18c24
PE
1112`------------------------------------------------------------------*/
1113
bf8b3d98
PE
1114#if (defined __STDC__ || defined __C99__FUNC__ \
1115 || defined __cplusplus || defined _MSC_VER)
05d18c24 1116static void
bf8b3d98 1117yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
05d18c24
PE
1118#else
1119static void
1120yy_stack_print (bottom, top)
bf8b3d98
PE
1121 yytype_int16 *bottom;
1122 yytype_int16 *top;
05d18c24
PE
1123#endif
1124{
74e543d2 1125 YYFPRINTF (stderr, "Stack now");
3b0ffc7e 1126 for (; bottom <= top; ++bottom)
05d18c24 1127 YYFPRINTF (stderr, " %d", *bottom);
74e543d2 1128 YYFPRINTF (stderr, "\n");
05d18c24
PE
1129}
1130
1131# define YY_STACK_PRINT(Bottom, Top) \
1132do { \
1133 if (yydebug) \
1134 yy_stack_print ((Bottom), (Top)); \
7029f892 1135} while (YYID (0))
05d18c24
PE
1136
1137
1138/*------------------------------------------------.
1139| Report that the YYRULE is going to be reduced. |
1140`------------------------------------------------*/
1141
bf8b3d98
PE
1142#if (defined __STDC__ || defined __C99__FUNC__ \
1143 || defined __cplusplus || defined _MSC_VER)
05d18c24 1144static void
66809587 1145yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
05d18c24
PE
1146#else
1147static void
d2a1a60a 1148yy_reduce_print (yyvsp, yylsp, yyrule)
66809587
PE
1149 YYSTYPE *yyvsp;
1150 YYLTYPE *yylsp;
05d18c24
PE
1151 int yyrule;
1152#endif
1153{
66809587 1154 int yynrhs = yyr2[yyrule];
05d18c24 1155 int yyi;
6088a2a0 1156 unsigned long int yylno = yyrline[yyrule];
66809587 1157 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
bf8b3d98 1158 yyrule - 1, yylno);
66809587
PE
1159 /* The symbols being reduced. */
1160 for (yyi = 0; yyi < yynrhs; yyi++)
1161 {
1162 fprintf (stderr, " $%d = ", yyi + 1);
3b0ffc7e 1163 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
bf8b3d98
PE
1164 &(yyvsp[(yyi + 1) - (yynrhs)])
1165 , &(yylsp[(yyi + 1) - (yynrhs)]) );
66809587
PE
1166 fprintf (stderr, "\n");
1167 }
05d18c24
PE
1168}
1169
1170# define YY_REDUCE_PRINT(Rule) \
1171do { \
1172 if (yydebug) \
66809587 1173 yy_reduce_print (yyvsp, yylsp, Rule); \
7029f892 1174} while (YYID (0))
05d18c24 1175
e9955c83
AD
1176/* Nonzero means print parse trace. It is left uninitialized so that
1177 multiple parsers can coexist. */
1178int yydebug;
1179#else /* !YYDEBUG */
1180# define YYDPRINTF(Args)
8a8dc872 1181# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
05d18c24
PE
1182# define YY_STACK_PRINT(Bottom, Top)
1183# define YY_REDUCE_PRINT(Rule)
e9955c83
AD
1184#endif /* !YYDEBUG */
1185
05d18c24 1186
e9955c83
AD
1187/* YYINITDEPTH -- initial size of the parser's stacks. */
1188#ifndef YYINITDEPTH
1189# define YYINITDEPTH 200
1190#endif
1191
1192/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1193 if the built-in stack extension method is used).
1194
1195 Do not make this value too large; the results are undefined if
2ce37586 1196 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
e9955c83
AD
1197 evaluated with infinite-precision integer arithmetic. */
1198
e9955c83
AD
1199#ifndef YYMAXDEPTH
1200# define YYMAXDEPTH 10000
1201#endif
1921f1d7 1202
e9955c83 1203\f
1921f1d7
AD
1204
1205#if YYERROR_VERBOSE
e9955c83
AD
1206
1207# ifndef yystrlen
bf8b3d98 1208# if defined __GLIBC__ && defined _STRING_H
e9955c83
AD
1209# define yystrlen strlen
1210# else
1211/* Return the length of YYSTR. */
bf8b3d98
PE
1212#if (defined __STDC__ || defined __C99__FUNC__ \
1213 || defined __cplusplus || defined _MSC_VER)
e9955c83 1214static YYSIZE_T
e9955c83 1215yystrlen (const char *yystr)
2e4c30fa
PE
1216#else
1217static YYSIZE_T
e9955c83 1218yystrlen (yystr)
2e4c30fa
PE
1219 const char *yystr;
1220#endif
e9955c83 1221{
7029f892
PE
1222 YYSIZE_T yylen;
1223 for (yylen = 0; yystr[yylen]; yylen++)
e9955c83 1224 continue;
7029f892 1225 return yylen;
e9955c83
AD
1226}
1227# endif
1228# endif
1229
1230# ifndef yystpcpy
bf8b3d98 1231# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
e9955c83
AD
1232# define yystpcpy stpcpy
1233# else
1234/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1235 YYDEST. */
bf8b3d98
PE
1236#if (defined __STDC__ || defined __C99__FUNC__ \
1237 || defined __cplusplus || defined _MSC_VER)
e9955c83 1238static char *
e9955c83 1239yystpcpy (char *yydest, const char *yysrc)
2e4c30fa
PE
1240#else
1241static char *
e9955c83 1242yystpcpy (yydest, yysrc)
2e4c30fa
PE
1243 char *yydest;
1244 const char *yysrc;
1245#endif
e9955c83 1246{
b4fb989f
PE
1247 char *yyd = yydest;
1248 const char *yys = yysrc;
e9955c83
AD
1249
1250 while ((*yyd++ = *yys++) != '\0')
1251 continue;
1252
1253 return yyd - 1;
1254}
1255# endif
1256# endif
0c15323d 1257
9cbfdc9e
PE
1258# ifndef yytnamerr
1259/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1260 quotes and backslashes, so that it's suitable for yyerror. The
1261 heuristic is that double-quoting is unnecessary unless the string
1262 contains an apostrophe, a comma, or backslash (other than
1263 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1264 null, do not copy; instead, return the length of what the result
1265 would have been. */
1266static YYSIZE_T
1267yytnamerr (char *yyres, const char *yystr)
1268{
1269 if (*yystr == '"')
1270 {
d2a1a60a 1271 YYSIZE_T yyn = 0;
9cbfdc9e
PE
1272 char const *yyp = yystr;
1273
1274 for (;;)
1275 switch (*++yyp)
1276 {
1277 case '\'':
1278 case ',':
1279 goto do_not_strip_quotes;
1280
1281 case '\\':
1282 if (*++yyp != '\\')
1283 goto do_not_strip_quotes;
1284 /* Fall through. */
1285 default:
1286 if (yyres)
1287 yyres[yyn] = *yyp;
1288 yyn++;
1289 break;
1290
1291 case '"':
1292 if (yyres)
1293 yyres[yyn] = '\0';
1294 return yyn;
1295 }
1296 do_not_strip_quotes: ;
1297 }
1298
1299 if (! yyres)
1300 return yystrlen (yystr);
1301
1302 return yystpcpy (yyres, yystr) - yyres;
1303}
1304# endif
1305
2abdfeef
PE
1306/* Copy into YYRESULT an error message about the unexpected token
1307 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1308 including the terminating null byte. If YYRESULT is null, do not
1309 copy anything; just return the number of bytes that would be
1310 copied. As a special case, return 0 if an ordinary "syntax error"
1311 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1312 size calculation. */
1313static YYSIZE_T
1314yysyntax_error (char *yyresult, int yystate, int yychar)
1315{
1316 int yyn = yypact[yystate];
1921f1d7 1317
d2a1a60a 1318 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2abdfeef
PE
1319 return 0;
1320 else
1321 {
1322 int yytype = YYTRANSLATE (yychar);
1323 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1324 YYSIZE_T yysize = yysize0;
1325 YYSIZE_T yysize1;
1326 int yysize_overflow = 0;
1327 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1328 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1329 int yyx;
1330
1331# if 0
1332 /* This is so xgettext sees the translatable formats that are
bf8b3d98 1333 constructed on the fly. */
2abdfeef
PE
1334 YY_("syntax error, unexpected %s");
1335 YY_("syntax error, unexpected %s, expecting %s");
1336 YY_("syntax error, unexpected %s, expecting %s or %s");
1337 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1338 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1339# endif
1340 char *yyfmt;
1341 char const *yyf;
1342 static char const yyunexpected[] = "syntax error, unexpected %s";
1343 static char const yyexpecting[] = ", expecting %s";
1344 static char const yyor[] = " or %s";
1345 char yyformat[sizeof yyunexpected
bf8b3d98
PE
1346 + sizeof yyexpecting - 1
1347 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1348 * (sizeof yyor - 1))];
2abdfeef
PE
1349 char const *yyprefix = yyexpecting;
1350
1351 /* Start YYX at -YYN if negative to avoid negative indexes in
bf8b3d98 1352 YYCHECK. */
2abdfeef
PE
1353 int yyxbegin = yyn < 0 ? -yyn : 0;
1354
1355 /* Stay within bounds of both yycheck and yytname. */
d2a1a60a 1356 int yychecklim = YYLAST - yyn + 1;
2abdfeef
PE
1357 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1358 int yycount = 1;
1359
1360 yyarg[0] = yytname[yytype];
1361 yyfmt = yystpcpy (yyformat, yyunexpected);
1362
1363 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
bf8b3d98
PE
1364 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1365 {
1366 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1367 {
1368 yycount = 1;
1369 yysize = yysize0;
1370 yyformat[sizeof yyunexpected - 1] = '\0';
1371 break;
1372 }
1373 yyarg[yycount++] = yytname[yyx];
1374 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1375 yysize_overflow |= (yysize1 < yysize);
1376 yysize = yysize1;
1377 yyfmt = yystpcpy (yyfmt, yyprefix);
1378 yyprefix = yyor;
1379 }
2abdfeef
PE
1380
1381 yyf = YY_(yyformat);
1382 yysize1 = yysize + yystrlen (yyf);
7029f892 1383 yysize_overflow |= (yysize1 < yysize);
2abdfeef
PE
1384 yysize = yysize1;
1385
1386 if (yysize_overflow)
1387 return YYSIZE_MAXIMUM;
1388
1389 if (yyresult)
1390 {
bf8b3d98
PE
1391 /* Avoid sprintf, as that infringes on the user's name space.
1392 Don't have undefined behavior even if the translation
1393 produced a string with the wrong number of "%s"s. */
1394 char *yyp = yyresult;
1395 int yyi = 0;
1396 while ((*yyp = *yyf) != '\0')
1397 {
1398 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1399 {
1400 yyp += yytnamerr (yyp, yyarg[yyi++]);
1401 yyf += 2;
1402 }
1403 else
1404 {
1405 yyp++;
1406 yyf++;
1407 }
1408 }
1409 }
2abdfeef
PE
1410 return yysize;
1411 }
1412}
1413#endif /* YYERROR_VERBOSE */
1921f1d7 1414\f
e9955c83 1415
04b6e11e
PE
1416/*-----------------------------------------------.
1417| Release the memory associated to this symbol. |
1418`-----------------------------------------------*/
1419
7029f892 1420/*ARGSUSED*/
bf8b3d98
PE
1421#if (defined __STDC__ || defined __C99__FUNC__ \
1422 || defined __cplusplus || defined _MSC_VER)
d33cb3ae 1423static void
8a8dc872 1424yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
04b6e11e 1425#else
d33cb3ae 1426static void
8a8dc872
AD
1427yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1428 const char *yymsg;
04b6e11e 1429 int yytype;
886b69d1
AD
1430 YYSTYPE *yyvaluep;
1431 YYLTYPE *yylocationp;
04b6e11e
PE
1432#endif
1433{
e764d4df
PE
1434 YYUSE (yyvaluep);
1435 YYUSE (yylocationp);
04b6e11e 1436
8a8dc872
AD
1437 if (!yymsg)
1438 yymsg = "Deleting";
1439 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1440
04b6e11e
PE
1441 switch (yytype)
1442 {
886b69d1 1443
04b6e11e 1444 default:
bf8b3d98 1445 break;
04b6e11e
PE
1446 }
1447}
04b6e11e
PE
1448\f
1449
d33cb3ae 1450/* Prevent warnings from -Wmissing-prototypes. */
e9955c83
AD
1451
1452#ifdef YYPARSE_PARAM
bf8b3d98 1453#if defined __STDC__ || defined __cplusplus
d33cb3ae 1454int yyparse (void *YYPARSE_PARAM);
2e4c30fa 1455#else
d33cb3ae 1456int yyparse ();
2e4c30fa 1457#endif
d33cb3ae 1458#else /* ! YYPARSE_PARAM */
bf8b3d98 1459#if defined __STDC__ || defined __cplusplus
e9955c83 1460int yyparse (void);
d33cb3ae
PE
1461#else
1462int yyparse ();
1463#endif
05d18c24 1464#endif /* ! YYPARSE_PARAM */
e776192e 1465
e9955c83 1466
e9955c83 1467
e9955c83 1468
d33cb3ae
PE
1469
1470
1471/*----------.
1472| yyparse. |
1473`----------*/
1474
1475#ifdef YYPARSE_PARAM
bf8b3d98
PE
1476#if (defined __STDC__ || defined __C99__FUNC__ \
1477 || defined __cplusplus || defined _MSC_VER)
2e4c30fa
PE
1478int
1479yyparse (void *YYPARSE_PARAM)
1480#else
1481int
1482yyparse (YYPARSE_PARAM)
1483 void *YYPARSE_PARAM;
1484#endif
d33cb3ae 1485#else /* ! YYPARSE_PARAM */
bf8b3d98
PE
1486#if (defined __STDC__ || defined __C99__FUNC__ \
1487 || defined __cplusplus || defined _MSC_VER)
d33cb3ae
PE
1488int
1489yyparse (void)
1490#else
e9955c83 1491int
d33cb3ae 1492yyparse ()
74e543d2 1493
d33cb3ae
PE
1494#endif
1495#endif
e9955c83 1496{
9bc0dd67 1497 /* The lookahead symbol. */
366eea36
AD
1498int yychar;
1499
9bc0dd67 1500/* The semantic value of the lookahead symbol. */
366eea36
AD
1501YYSTYPE yylval;
1502
f0616f0b 1503/* Number of syntax errors so far. */
366eea36 1504int yynerrs;
9bc0dd67 1505/* Location data for the lookahead symbol. */
366eea36 1506YYLTYPE yylloc;
e9955c83 1507
b4fb989f
PE
1508 int yystate;
1509 int yyn;
e9955c83
AD
1510 int yyresult;
1511 /* Number of tokens to shift before error messages enabled. */
1512 int yyerrstatus;
9bc0dd67 1513 /* Lookahead token as an internal (translated) token number. */
886b69d1 1514 int yytoken = 0;
2abdfeef
PE
1515#if YYERROR_VERBOSE
1516 /* Buffer for error messages, and its allocated size. */
1517 char yymsgbuf[128];
1518 char *yymsg = yymsgbuf;
1519 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1520#endif
e9955c83
AD
1521
1522 /* Three stacks and their tools:
1523 `yyss': related to states,
1524 `yyvs': related to semantic values,
1525 `yyls': related to locations.
1526
1527 Refer to the stacks thru separate pointers, to allow yyoverflow
1528 to reallocate them elsewhere. */
1529
1921f1d7 1530 /* The state stack. */
bf8b3d98
PE
1531 yytype_int16 yyssa[YYINITDEPTH];
1532 yytype_int16 *yyss = yyssa;
1533 yytype_int16 *yyssp;
e9955c83
AD
1534
1535 /* The semantic value stack. */
1536 YYSTYPE yyvsa[YYINITDEPTH];
1537 YYSTYPE *yyvs = yyvsa;
b4fb989f 1538 YYSTYPE *yyvsp;
e9955c83 1539
e9955c83
AD
1540 /* The location stack. */
1541 YYLTYPE yylsa[YYINITDEPTH];
1542 YYLTYPE *yyls = yylsa;
1543 YYLTYPE *yylsp;
3b0ffc7e 1544 /* The locations where the error started and ended. */
8a8dc872 1545 YYLTYPE yyerror_range[2];
e9955c83 1546
3b0ffc7e 1547#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
e9955c83
AD
1548
1549 YYSIZE_T yystacksize = YYINITDEPTH;
1550
1551 /* The variables used to return semantic value and location from the
1552 action routines. */
1553 YYSTYPE yyval;
e9955c83 1554 YYLTYPE yyloc;
e9955c83 1555
3b0ffc7e
PE
1556 /* The number of symbols on the RHS of the reduced rule.
1557 Keep to zero when no symbol should be popped. */
1558 int yylen = 0;
e9955c83 1559
74e543d2 1560 YYDPRINTF ((stderr, "Starting parse\n"));
e9955c83
AD
1561
1562 yystate = 0;
1563 yyerrstatus = 0;
1564 yynerrs = 0;
73521d9f 1565 yychar = YYEMPTY; /* Cause a token to be read. */
e9955c83
AD
1566
1567 /* Initialize stack pointers.
1568 Waste one element of value and location stack
1569 so that they stay on the same level as the state stack.
1570 The wasted elements are never initialized. */
1571
1572 yyssp = yyss;
1573 yyvsp = yyvs;
e9955c83 1574 yylsp = yyls;
8a8dc872
AD
1575#if YYLTYPE_IS_TRIVIAL
1576 /* Initialize the default location before parsing starts. */
1577 yylloc.first_line = yylloc.last_line = 1;
1578 yylloc.first_column = yylloc.last_column = 0;
1579#endif
1580
cd3684cf 1581
3b0ffc7e 1582 /* User initialization code. */
9bc0dd67 1583#line 88 "parse-gram.y"
cd3684cf
AD
1584{
1585 /* Bison's grammar can initial empty locations, hence a default
1586 location is needed. */
e9071366
AD
1587 boundary_set (&yylloc.start, current_file, 1, 0);
1588 boundary_set (&yylloc.end, current_file, 1, 0);
cd3684cf 1589}
9bc0dd67 1590/* Line 1085 of yacc.c. */
34f98f46 1591#line 1592 "parse-gram.c"
5f6da1c0 1592 yylsp[0] = yylloc;
e9955c83
AD
1593 goto yysetstate;
1594
1595/*------------------------------------------------------------.
1596| yynewstate -- Push a new state, which is found in yystate. |
1597`------------------------------------------------------------*/
1598 yynewstate:
1599 /* In all cases, when you get here, the value and location stacks
3b0ffc7e 1600 have just been pushed. So pushing a state here evens the stacks. */
e9955c83
AD
1601 yyssp++;
1602
1603 yysetstate:
1604 *yyssp = yystate;
1605
d33cb3ae 1606 if (yyss + yystacksize - 1 <= yyssp)
e9955c83
AD
1607 {
1608 /* Get the current used size of the three stacks, in elements. */
1609 YYSIZE_T yysize = yyssp - yyss + 1;
1610
1611#ifdef yyoverflow
1612 {
3b0ffc7e 1613 /* Give user a chance to reallocate the stack. Use copies of
e9955c83
AD
1614 these so that the &'s don't force the real ones into
1615 memory. */
1616 YYSTYPE *yyvs1 = yyvs;
bf8b3d98 1617 yytype_int16 *yyss1 = yyss;
366eea36 1618 YYLTYPE *yyls1 = yyls;
e9955c83
AD
1619
1620 /* Each stack pointer address is followed by the size of the
366eea36
AD
1621 data in use in that stack, in bytes. This used to be a
1622 conditional around just the two extra args, but that might
1623 be undefined if yyoverflow is a macro. */
6088a2a0 1624 yyoverflow (YY_("memory exhausted"),
e9955c83
AD
1625 &yyss1, yysize * sizeof (*yyssp),
1626 &yyvs1, yysize * sizeof (*yyvsp),
1627 &yyls1, yysize * sizeof (*yylsp),
1628 &yystacksize);
1629 yyls = yyls1;
e9955c83
AD
1630 yyss = yyss1;
1631 yyvs = yyvs1;
1632 }
1633#else /* no yyoverflow */
1634# ifndef YYSTACK_RELOCATE
6088a2a0 1635 goto yyexhaustedlab;
e9955c83
AD
1636# else
1637 /* Extend the stack our own way. */
d33cb3ae 1638 if (YYMAXDEPTH <= yystacksize)
6088a2a0 1639 goto yyexhaustedlab;
e9955c83 1640 yystacksize *= 2;
d33cb3ae 1641 if (YYMAXDEPTH < yystacksize)
e9955c83
AD
1642 yystacksize = YYMAXDEPTH;
1643
1644 {
bf8b3d98 1645 yytype_int16 *yyss1 = yyss;
e9955c83
AD
1646 union yyalloc *yyptr =
1647 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1648 if (! yyptr)
6088a2a0 1649 goto yyexhaustedlab;
e9955c83
AD
1650 YYSTACK_RELOCATE (yyss);
1651 YYSTACK_RELOCATE (yyvs);
e9955c83 1652 YYSTACK_RELOCATE (yyls);
1921f1d7 1653# undef YYSTACK_RELOCATE
e9955c83
AD
1654 if (yyss1 != yyssa)
1655 YYSTACK_FREE (yyss1);
1656 }
1657# endif
1658#endif /* no yyoverflow */
1659
1660 yyssp = yyss + yysize - 1;
1661 yyvsp = yyvs + yysize - 1;
e9955c83 1662 yylsp = yyls + yysize - 1;
e9955c83 1663
6088a2a0 1664 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
e9955c83
AD
1665 (unsigned long int) yystacksize));
1666
d33cb3ae 1667 if (yyss + yystacksize - 1 <= yyssp)
e9955c83
AD
1668 YYABORT;
1669 }
1670
6088a2a0 1671 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
e9955c83
AD
1672
1673 goto yybackup;
1674
1675/*-----------.
1676| yybackup. |
1677`-----------*/
1678yybackup:
1679
3b0ffc7e 1680 /* Do appropriate processing given the current state. Read a
9bc0dd67 1681 lookahead token if we need one and don't already have one. */
e9955c83 1682
9bc0dd67 1683 /* First try to decide what to do without reference to lookahead token. */
e9955c83 1684 yyn = yypact[yystate];
04b6e11e 1685 if (yyn == YYPACT_NINF)
e9955c83
AD
1686 goto yydefault;
1687
9bc0dd67 1688 /* Not known => get a lookahead token if don't already have one. */
e9955c83 1689
9bc0dd67 1690 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
73521d9f 1691 if (yychar == YYEMPTY)
e9955c83 1692 {
74e543d2 1693 YYDPRINTF ((stderr, "Reading a token: "));
e9955c83
AD
1694 yychar = YYLEX;
1695 }
1696
73521d9f 1697 if (yychar <= YYEOF)
e9955c83 1698 {
73521d9f 1699 yychar = yytoken = YYEOF;
74e543d2 1700 YYDPRINTF ((stderr, "Now at end of input.\n"));
e9955c83
AD
1701 }
1702 else
1703 {
73521d9f 1704 yytoken = YYTRANSLATE (yychar);
6088a2a0 1705 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
e9955c83
AD
1706 }
1707
886b69d1 1708 /* If the proper action on seeing token YYTOKEN is to reduce or to
ae7453f2 1709 detect an error, take that action. */
886b69d1
AD
1710 yyn += yytoken;
1711 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
e9955c83 1712 goto yydefault;
e9955c83 1713 yyn = yytable[yyn];
ae7453f2 1714 if (yyn <= 0)
e9955c83 1715 {
ae7453f2 1716 if (yyn == 0 || yyn == YYTABLE_NINF)
e9955c83
AD
1717 goto yyerrlab;
1718 yyn = -yyn;
1719 goto yyreduce;
1720 }
e9955c83
AD
1721
1722 if (yyn == YYFINAL)
1723 YYACCEPT;
1724
3b0ffc7e
PE
1725 /* Count tokens shifted since error; after three, turn off error
1726 status. */
1727 if (yyerrstatus)
1728 yyerrstatus--;
1729
9bc0dd67 1730 /* Shift the lookahead token. */
6088a2a0 1731 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
e9955c83 1732
3b0ffc7e 1733 /* Discard the shifted token unless it is eof. */
73521d9f
PE
1734 if (yychar != YYEOF)
1735 yychar = YYEMPTY;
e9955c83 1736
3b0ffc7e 1737 yystate = yyn;
e9955c83 1738 *++yyvsp = yylval;
e9955c83 1739 *++yylsp = yylloc;
e9955c83
AD
1740 goto yynewstate;
1741
1742
1743/*-----------------------------------------------------------.
1744| yydefault -- do the default action for the current state. |
1745`-----------------------------------------------------------*/
1746yydefault:
1747 yyn = yydefact[yystate];
1748 if (yyn == 0)
1749 goto yyerrlab;
1750 goto yyreduce;
1751
1752
1753/*-----------------------------.
1754| yyreduce -- Do a reduction. |
1755`-----------------------------*/
1756yyreduce:
1757 /* yyn is the number of a rule to reduce with. */
1758 yylen = yyr2[yyn];
1759
1760 /* If YYLEN is nonzero, implement the default value of the action:
1761 `$$ = $1'.
1762
04b6e11e
PE
1763 Otherwise, the following line sets YYVAL to garbage.
1764 This behavior is undocumented and Bison
e9955c83
AD
1765 users should not rely upon it. Assigning to YYVAL
1766 unconditionally makes the parser a bit smaller, and it avoids a
1767 GCC warning that YYVAL may be used uninitialized. */
1768 yyval = yyvsp[1-yylen];
1769
3b0ffc7e 1770 /* Default location. */
bf8b3d98 1771 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
05d18c24 1772 YY_REDUCE_PRINT (yyn);
1921f1d7
AD
1773 switch (yyn)
1774 {
05d18c24 1775 case 6:
34f98f46
JD
1776#line 218 "parse-gram.y"
1777 {
1778 prologue_augment (translate_code ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])), (yylsp[(1) - (1)]), typed);
1779 }
1921f1d7
AD
1780 break;
1781
8efe435c 1782 case 7:
34f98f46 1783#line 222 "parse-gram.y"
9bc0dd67 1784 {
9bc0dd67
JD
1785 /* Remove the '{', and replace the '}' with '\n'. */
1786 (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
34f98f46 1787 prologue_augment (translate_code ((yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])), (yylsp[(2) - (2)]), true);
9bc0dd67 1788 }
1921f1d7
AD
1789 break;
1790
8efe435c 1791 case 8:
34f98f46 1792#line 228 "parse-gram.y"
9bc0dd67 1793 {
9bc0dd67
JD
1794 /* Remove the '{', and replace the '}' with '\n'. */
1795 (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
34f98f46 1796 prologue_augment (translate_code ((yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])), (yylsp[(2) - (2)]), false);
9bc0dd67
JD
1797 }
1798 break;
1799
1800 case 9:
1801#line 233 "parse-gram.y"
1802 { debug_flag = true; }
1803 break;
1804
1805 case 10:
1806#line 235 "parse-gram.y"
bf8b3d98
PE
1807 {
1808 static char one[] = "1";
1809 muscle_insert ((yyvsp[(2) - (2)].chars), one);
1810 }
1921f1d7
AD
1811 break;
1812
9bc0dd67
JD
1813 case 11:
1814#line 239 "parse-gram.y"
66809587 1815 { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); }
e9955c83 1816 break;
1921f1d7 1817
9bc0dd67
JD
1818 case 12:
1819#line 240 "parse-gram.y"
fb9712a9 1820 { defines_flag = true; }
e9955c83 1821 break;
1921f1d7 1822
9bc0dd67 1823 case 13:
34f98f46
JD
1824#line 242 "parse-gram.y"
1825 {
1826 /* Remove the '{', and replace the '}' with '\n'. */
1827 (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
1828 muscle_code_grow ("end_header", translate_code ((yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
1829 }
e9955c83 1830 break;
1921f1d7 1831
9bc0dd67 1832 case 14:
34f98f46
JD
1833#line 247 "parse-gram.y"
1834 { error_verbose = true; }
e9955c83 1835 break;
1921f1d7 1836
9bc0dd67 1837 case 15:
34f98f46
JD
1838#line 248 "parse-gram.y"
1839 { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
d6328241
PH
1840 break;
1841
9bc0dd67 1842 case 16:
34f98f46
JD
1843#line 249 "parse-gram.y"
1844 { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
fb9712a9
AD
1845 break;
1846
9bc0dd67 1847 case 17:
34f98f46
JD
1848#line 250 "parse-gram.y"
1849 { spec_file_prefix = (yyvsp[(3) - (3)].chars); }
1850 break;
1851
1852 case 18:
1853#line 252 "parse-gram.y"
cd3684cf 1854 {
bf8b3d98
PE
1855 nondeterministic_parser = true;
1856 glr_parser = true;
1857 }
e9955c83 1858 break;
1921f1d7 1859
34f98f46
JD
1860 case 19:
1861#line 257 "parse-gram.y"
cd3684cf 1862 {
e9071366 1863 muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
bf8b3d98 1864 }
e9955c83 1865 break;
1921f1d7 1866
34f98f46
JD
1867 case 20:
1868#line 260 "parse-gram.y"
e9071366 1869 { add_param ("lex_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); }
e9955c83 1870 break;
1921f1d7 1871
34f98f46
JD
1872 case 21:
1873#line 261 "parse-gram.y"
cd3684cf 1874 { locations_flag = true; }
e9955c83 1875 break;
1921f1d7 1876
34f98f46
JD
1877 case 22:
1878#line 262 "parse-gram.y"
66809587 1879 { spec_name_prefix = (yyvsp[(3) - (3)].chars); }
e9955c83 1880 break;
1921f1d7 1881
34f98f46
JD
1882 case 23:
1883#line 263 "parse-gram.y"
cd3684cf 1884 { no_lines_flag = true; }
4cdb01db 1885 break;
1921f1d7 1886
34f98f46
JD
1887 case 24:
1888#line 264 "parse-gram.y"
cd3684cf 1889 { nondeterministic_parser = true; }
4cdb01db 1890 break;
1921f1d7 1891
34f98f46
JD
1892 case 25:
1893#line 265 "parse-gram.y"
66809587 1894 { spec_outfile = (yyvsp[(3) - (3)].chars); }
4cdb01db 1895 break;
1921f1d7 1896
34f98f46
JD
1897 case 26:
1898#line 266 "parse-gram.y"
e9071366 1899 { add_param ("parse_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); }
676385e2
PH
1900 break;
1901
34f98f46
JD
1902 case 27:
1903#line 267 "parse-gram.y"
cd3684cf 1904 { pure_parser = true; }
ae7453f2
AD
1905 break;
1906
34f98f46
JD
1907 case 28:
1908#line 268 "parse-gram.y"
66809587 1909 { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
ae7453f2
AD
1910 break;
1911
34f98f46
JD
1912 case 29:
1913#line 269 "parse-gram.y"
66809587 1914 { skeleton = (yyvsp[(2) - (2)].chars); }
916708d5
AD
1915 break;
1916
34f98f46
JD
1917 case 30:
1918#line 271 "parse-gram.y"
1919 {
1920 /* Remove the '{', and replace the '}' with '\n'. */
1921 (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
1922 muscle_code_grow ("start_header", translate_code ((yyvsp[(2) - (2)].chars)+1, (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
1923 }
1924 break;
1925
1926 case 31:
1927#line 276 "parse-gram.y"
b50d2359 1928 { token_table_flag = true; }
cd3684cf
AD
1929 break;
1930
34f98f46
JD
1931 case 32:
1932#line 277 "parse-gram.y"
b50d2359
AD
1933 { report_flag = report_states; }
1934 break;
1935
34f98f46
JD
1936 case 33:
1937#line 278 "parse-gram.y"
83a457be 1938 { yacc_flag = true; }
4cdb01db 1939 break;
1921f1d7 1940
34f98f46
JD
1941 case 37:
1942#line 286 "parse-gram.y"
1921f1d7 1943 {
66809587 1944 grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
4cdb01db 1945 }
e9955c83 1946 break;
1921f1d7 1947
34f98f46
JD
1948 case 38:
1949#line 290 "parse-gram.y"
1921f1d7 1950 {
05d18c24 1951 symbol_list *list;
e9071366
AD
1952 const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), (yylsp[(2) - (3)]));
1953 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
1954 symbol_destructor_set (list->sym, action, (yylsp[(2) - (3)]));
1955 symbol_list_free ((yyvsp[(3) - (3)].list));
4cdb01db 1956 }
e9955c83 1957 break;
1921f1d7 1958
34f98f46
JD
1959 case 39:
1960#line 298 "parse-gram.y"
1921f1d7 1961 {
05d18c24 1962 symbol_list *list;
e9071366
AD
1963 const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), (yylsp[(2) - (3)]));
1964 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
1965 symbol_printer_set (list->sym, action, (yylsp[(2) - (3)]));
1966 symbol_list_free ((yyvsp[(3) - (3)].list));
4cdb01db 1967 }
e9955c83 1968 break;
1921f1d7 1969
34f98f46
JD
1970 case 40:
1971#line 306 "parse-gram.y"
92f5e991 1972 {
66ef8b9d 1973 default_prec = true;
92f5e991 1974 }
9280d3ef
AD
1975 break;
1976
34f98f46
JD
1977 case 41:
1978#line 310 "parse-gram.y"
66ef8b9d
PE
1979 {
1980 default_prec = false;
1981 }
92f5e991
AD
1982 break;
1983
34f98f46
JD
1984 case 42:
1985#line 323 "parse-gram.y"
58d7a1a1
AD
1986 {}
1987 break;
1988
34f98f46
JD
1989 case 43:
1990#line 324 "parse-gram.y"
58d7a1a1 1991 { muscle_code_grow ("union_name", (yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
66ef8b9d
PE
1992 break;
1993
34f98f46
JD
1994 case 44:
1995#line 329 "parse-gram.y"
9280d3ef 1996 {
58d7a1a1
AD
1997 char const *body = (yyvsp[(3) - (3)].chars);
1998
1999 if (typed)
2000 {
2001 /* Concatenate the union bodies, turning the first one's
2002 trailing '}' into '\n', and omitting the second one's '{'. */
2003 char *code = muscle_find ("stype");
2004 code[strlen (code) - 1] = '\n';
2005 body++;
2006 }
2007
2008 typed = true;
2009 muscle_code_grow ("stype", body, (yylsp[(3) - (3)]));
9280d3ef
AD
2010 }
2011 break;
2012
34f98f46
JD
2013 case 45:
2014#line 350 "parse-gram.y"
58d7a1a1 2015 { current_class = nterm_sym; }
366eea36
AD
2016 break;
2017
34f98f46
JD
2018 case 46:
2019#line 351 "parse-gram.y"
366eea36
AD
2020 {
2021 current_class = unknown_sym;
2022 current_type = NULL;
2023 }
2024 break;
2025
34f98f46
JD
2026 case 47:
2027#line 355 "parse-gram.y"
58d7a1a1
AD
2028 { current_class = token_sym; }
2029 break;
2030
34f98f46
JD
2031 case 48:
2032#line 356 "parse-gram.y"
58d7a1a1
AD
2033 {
2034 current_class = unknown_sym;
2035 current_type = NULL;
2036 }
2037 break;
2038
34f98f46
JD
2039 case 49:
2040#line 361 "parse-gram.y"
1e0bab92 2041 {
05d18c24 2042 symbol_list *list;
66809587
PE
2043 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
2044 symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)]));
2045 symbol_list_free ((yyvsp[(3) - (3)].list));
1e0bab92 2046 }
e9955c83 2047 break;
1921f1d7 2048
34f98f46
JD
2049 case 50:
2050#line 371 "parse-gram.y"
1921f1d7 2051 {
05d18c24 2052 symbol_list *list;
1e0bab92 2053 ++current_prec;
66809587 2054 for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
1e0bab92 2055 {
66809587
PE
2056 symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)]));
2057 symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)]));
1e0bab92 2058 }
66809587 2059 symbol_list_free ((yyvsp[(3) - (3)].list));
2c569025
AD
2060 current_type = NULL;
2061 }
e9955c83 2062 break;
1921f1d7 2063
34f98f46
JD
2064 case 51:
2065#line 385 "parse-gram.y"
76dcf299 2066 { (yyval.assoc) = left_assoc; }
e9955c83 2067 break;
1921f1d7 2068
34f98f46
JD
2069 case 52:
2070#line 386 "parse-gram.y"
76dcf299 2071 { (yyval.assoc) = right_assoc; }
e9955c83 2072 break;
1921f1d7 2073
34f98f46
JD
2074 case 53:
2075#line 387 "parse-gram.y"
76dcf299 2076 { (yyval.assoc) = non_assoc; }
4cdb01db 2077 break;
1921f1d7 2078
34f98f46
JD
2079 case 54:
2080#line 391 "parse-gram.y"
62ddaef6 2081 { current_type = NULL; }
e9955c83 2082 break;
1921f1d7 2083
34f98f46
JD
2084 case 55:
2085#line 392 "parse-gram.y"
66809587 2086 { current_type = (yyvsp[(1) - (1)].uniqstr); }
e9955c83 2087 break;
1921f1d7 2088
34f98f46
JD
2089 case 56:
2090#line 397 "parse-gram.y"
66809587 2091 { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); }
4cdb01db 2092 break;
1921f1d7 2093
34f98f46
JD
2094 case 57:
2095#line 398 "parse-gram.y"
66809587 2096 { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
4cdb01db 2097 break;
1921f1d7 2098
34f98f46
JD
2099 case 58:
2100#line 404 "parse-gram.y"
1921f1d7 2101 {
66809587 2102 current_type = (yyvsp[(1) - (1)].uniqstr);
4cdb01db 2103 }
e9955c83 2104 break;
1921f1d7 2105
34f98f46
JD
2106 case 59:
2107#line 408 "parse-gram.y"
1921f1d7 2108 {
f52b276c 2109 symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true);
66809587 2110 symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)]));
4cdb01db 2111 }
e9955c83 2112 break;
1921f1d7 2113
34f98f46
JD
2114 case 60:
2115#line 413 "parse-gram.y"
1921f1d7 2116 {
f52b276c 2117 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
66809587
PE
2118 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
2119 symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)]));
4cdb01db 2120 }
e9955c83 2121 break;
1921f1d7 2122
34f98f46
JD
2123 case 61:
2124#line 419 "parse-gram.y"
1921f1d7 2125 {
f52b276c 2126 symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true);
66809587
PE
2127 symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)]));
2128 symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc));
4cdb01db 2129 }
e9955c83 2130 break;
1921f1d7 2131
34f98f46
JD
2132 case 62:
2133#line 425 "parse-gram.y"
1921f1d7 2134 {
f52b276c 2135 symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true);
66809587
PE
2136 symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)]));
2137 symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)]));
2138 symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc));
4cdb01db 2139 }
e9955c83 2140 break;
1921f1d7 2141
34f98f46
JD
2142 case 69:
2143#line 455 "parse-gram.y"
b275314e
AD
2144 {
2145 yyerrok;
2146 }
e9955c83 2147 break;
1921f1d7 2148
34f98f46
JD
2149 case 70:
2150#line 461 "parse-gram.y"
66809587 2151 { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); }
e9955c83 2152 break;
1921f1d7 2153
34f98f46
JD
2154 case 72:
2155#line 465 "parse-gram.y"
8f3596a6 2156 { grammar_current_rule_end ((yylsp[(1) - (1)])); }
4cdb01db 2157 break;
1921f1d7 2158
34f98f46
JD
2159 case 73:
2160#line 466 "parse-gram.y"
8f3596a6 2161 { grammar_current_rule_end ((yylsp[(3) - (3)])); }
e9955c83 2162 break;
1921f1d7 2163
34f98f46
JD
2164 case 75:
2165#line 472 "parse-gram.y"
8f3596a6 2166 { grammar_current_rule_begin (current_lhs, current_lhs_location); }
4cdb01db 2167 break;
1921f1d7 2168
34f98f46
JD
2169 case 76:
2170#line 474 "parse-gram.y"
66809587 2171 { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); }
0c15323d 2172 break;
1921f1d7 2173
34f98f46
JD
2174 case 77:
2175#line 476 "parse-gram.y"
381ecb06 2176 { grammar_current_rule_action_append ((yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); }
e9071366
AD
2177 break;
2178
34f98f46 2179 case 78:
381ecb06 2180#line 478 "parse-gram.y"
66809587 2181 { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); }
676385e2
PH
2182 break;
2183
34f98f46 2184 case 79:
381ecb06 2185#line 480 "parse-gram.y"
66809587 2186 { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); }
676385e2
PH
2187 break;
2188
34f98f46 2189 case 80:
381ecb06 2190#line 482 "parse-gram.y"
66809587 2191 { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); }
b275314e
AD
2192 break;
2193
34f98f46 2194 case 81:
381ecb06 2195#line 495 "parse-gram.y"
203b9274 2196 { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
916708d5
AD
2197 break;
2198
34f98f46 2199 case 82:
381ecb06 2200#line 497 "parse-gram.y"
d2a1a60a
PE
2201 {
2202 (yyval.symbol) = symbol_get (char_name ((yyvsp[(1) - (1)].character)), (yylsp[(1) - (1)]));
2203 symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
2204 symbol_user_token_number_set ((yyval.symbol), (yyvsp[(1) - (1)].character), (yylsp[(1) - (1)]));
2205 }
66ef8b9d
PE
2206 break;
2207
34f98f46 2208 case 83:
381ecb06 2209#line 505 "parse-gram.y"
203b9274 2210 { (yyval.symbol) = symbol_from_uniqstr ((yyvsp[(1) - (1)].uniqstr), (yylsp[(1) - (1)])); }
58d7a1a1
AD
2211 break;
2212
34f98f46 2213 case 86:
381ecb06 2214#line 517 "parse-gram.y"
1921f1d7 2215 {
66809587 2216 (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)]));
f52b276c 2217 symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
4cdb01db 2218 }
e9955c83 2219 break;
1921f1d7 2220
34f98f46 2221 case 87:
381ecb06 2222#line 526 "parse-gram.y"
66809587 2223 { (yyval.chars) = (yyvsp[(1) - (1)].chars); }
e9955c83 2224 break;
1921f1d7 2225
34f98f46 2226 case 89:
381ecb06 2227#line 533 "parse-gram.y"
1921f1d7 2228 {
e9071366
AD
2229 muscle_code_grow ("epilogue", translate_code ((yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
2230 gram_scanner_last_string_free ();
4cdb01db 2231 }
e9955c83
AD
2232 break;
2233
2234
9bc0dd67 2235/* Line 1274 of yacc.c. */
381ecb06 2236#line 2237 "parse-gram.c"
e1054895 2237 default: break;
1921f1d7 2238 }
66809587 2239 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1921f1d7 2240
3b0ffc7e
PE
2241 YYPOPSTACK (yylen);
2242 yylen = 0;
05d18c24 2243 YY_STACK_PRINT (yyss, yyssp);
e9955c83
AD
2244
2245 *++yyvsp = yyval;
e9955c83 2246 *++yylsp = yyloc;
e9955c83
AD
2247
2248 /* Now `shift' the result of the reduction. Determine what state
2249 that goes to, based on the state we popped back to and the rule
2250 number reduced by. */
2251
2252 yyn = yyr1[yyn];
2253
1921f1d7 2254 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
04b6e11e 2255 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
e9955c83
AD
2256 yystate = yytable[yystate];
2257 else
1921f1d7 2258 yystate = yydefgoto[yyn - YYNTOKENS];
e9955c83
AD
2259
2260 goto yynewstate;
2261
2262
2263/*------------------------------------.
2264| yyerrlab -- here on detecting error |
2265`------------------------------------*/
2266yyerrlab:
2267 /* If not already recovering from an error, report this error. */
2268 if (!yyerrstatus)
2269 {
2270 ++yynerrs;
2abdfeef
PE
2271#if ! YYERROR_VERBOSE
2272 yyerror (YY_("syntax error"));
2273#else
2274 {
2275 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2276 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2277 {
2278 YYSIZE_T yyalloc = 2 * yysize;
2279 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2280 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2281 if (yymsg != yymsgbuf)
2282 YYSTACK_FREE (yymsg);
2283 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2284 if (yymsg)
2285 yymsg_alloc = yyalloc;
2286 else
6d5aa694 2287 {
2abdfeef
PE
2288 yymsg = yymsgbuf;
2289 yymsg_alloc = sizeof yymsgbuf;
6d5aa694 2290 }
2abdfeef 2291 }
ae7453f2 2292
2abdfeef
PE
2293 if (0 < yysize && yysize <= yymsg_alloc)
2294 {
2295 (void) yysyntax_error (yymsg, yystate, yychar);
2296 yyerror (yymsg);
2297 }
2298 else
2299 {
2300 yyerror (YY_("syntax error"));
2301 if (yysize != 0)
6088a2a0 2302 goto yyexhaustedlab;
2abdfeef
PE
2303 }
2304 }
2305#endif
e9955c83 2306 }
e9955c83 2307
8a8dc872 2308 yyerror_range[0] = yylloc;
78a00b7d 2309
e9955c83
AD
2310 if (yyerrstatus == 3)
2311 {
9bc0dd67 2312 /* If just tried and failed to reuse lookahead token after an
e9955c83
AD
2313 error, discard it. */
2314
465b4444 2315 if (yychar <= YYEOF)
bf8b3d98 2316 {
d11e0cfa 2317 /* Return failure if at end of input. */
465b4444 2318 if (yychar == YYEOF)
7768896a 2319 YYABORT;
bf8b3d98 2320 }
465b4444
PE
2321 else
2322 {
4b367315 2323 yydestruct ("Error: discarding",
bf8b3d98 2324 yytoken, &yylval, &yylloc);
465b4444 2325 yychar = YYEMPTY;
465b4444 2326 }
e9955c83
AD
2327 }
2328
9bc0dd67 2329 /* Else will try to reuse lookahead token after shifting the error
e9955c83 2330 token. */
6d5aa694 2331 goto yyerrlab1;
e9955c83 2332
05d18c24 2333
465b4444
PE
2334/*---------------------------------------------------.
2335| yyerrorlab -- error raised explicitly by YYERROR. |
2336`---------------------------------------------------*/
2337yyerrorlab:
2338
e1054895
PE
2339 /* Pacify compilers like GCC when the user code never invokes
2340 YYERROR and the label yyerrorlab therefore never appears in user
2341 code. */
e764d4df 2342 if (/*CONSTCOND*/ 0)
465b4444 2343 goto yyerrorlab;
465b4444 2344
8a8dc872 2345 yyerror_range[0] = yylsp[1-yylen];
3b0ffc7e
PE
2346 /* Do not reclaim the symbols of the rule which action triggered
2347 this YYERROR. */
2348 YYPOPSTACK (yylen);
2349 yylen = 0;
2350 YY_STACK_PRINT (yyss, yyssp);
465b4444 2351 yystate = *yyssp;
465b4444
PE
2352 goto yyerrlab1;
2353
2354
2355/*-------------------------------------------------------------.
2356| yyerrlab1 -- common code for both syntax error and YYERROR. |
2357`-------------------------------------------------------------*/
05d18c24 2358yyerrlab1:
1921f1d7 2359 yyerrstatus = 3; /* Each real token shifted decrements this. */
e9955c83 2360
1921f1d7
AD
2361 for (;;)
2362 {
2363 yyn = yypact[yystate];
04b6e11e 2364 if (yyn != YYPACT_NINF)
1921f1d7
AD
2365 {
2366 yyn += YYTERROR;
2367 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2368 {
2369 yyn = yytable[yyn];
2370 if (0 < yyn)
2371 break;
2372 }
2373 }
4cdb01db 2374
1921f1d7
AD
2375 /* Pop the current state because it cannot handle the error token. */
2376 if (yyssp == yyss)
2377 YYABORT;
0c15323d 2378
8a8dc872 2379 yyerror_range[0] = *yylsp;
4b367315 2380 yydestruct ("Error: popping",
bf8b3d98 2381 yystos[yystate], yyvsp, yylsp);
3b0ffc7e 2382 YYPOPSTACK (1);
465b4444 2383 yystate = *yyssp;
05d18c24 2384 YY_STACK_PRINT (yyss, yyssp);
e9955c83
AD
2385 }
2386
2387 if (yyn == YYFINAL)
2388 YYACCEPT;
2389
e9955c83 2390 *++yyvsp = yylval;
8a8dc872
AD
2391
2392 yyerror_range[1] = yylloc;
2393 /* Using YYLLOC is tempting, but would change the location of
9bc0dd67 2394 the lookahead. YYLOC is available though. */
bf8b3d98 2395 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
78a00b7d 2396 *++yylsp = yyloc;
e9955c83 2397
3b0ffc7e 2398 /* Shift the error token. */
6088a2a0 2399 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
8a8dc872 2400
e9955c83
AD
2401 yystate = yyn;
2402 goto yynewstate;
2403
2404
2405/*-------------------------------------.
2406| yyacceptlab -- YYACCEPT comes here. |
2407`-------------------------------------*/
2408yyacceptlab:
2409 yyresult = 0;
2410 goto yyreturn;
2411
2412/*-----------------------------------.
2413| yyabortlab -- YYABORT comes here. |
2414`-----------------------------------*/
2415yyabortlab:
2416 yyresult = 1;
2417 goto yyreturn;
2418
366eea36 2419#ifndef yyoverflow
6088a2a0
PE
2420/*-------------------------------------------------.
2421| yyexhaustedlab -- memory exhaustion comes here. |
2422`-------------------------------------------------*/
2423yyexhaustedlab:
2424 yyerror (YY_("memory exhausted"));
e9955c83
AD
2425 yyresult = 2;
2426 /* Fall through. */
366eea36 2427#endif
e9955c83
AD
2428
2429yyreturn:
bd134904 2430 if (yychar != YYEOF && yychar != YYEMPTY)
ec5d1a8a 2431 yydestruct ("Cleanup: discarding lookahead",
bd134904 2432 yytoken, &yylval, &yylloc);
3b0ffc7e
PE
2433 /* Do not reclaim the symbols of the rule which action triggered
2434 this YYABORT or YYACCEPT. */
2435 YYPOPSTACK (yylen);
2436 YY_STACK_PRINT (yyss, yyssp);
d11e0cfa
PE
2437 while (yyssp != yyss)
2438 {
ec5d1a8a 2439 yydestruct ("Cleanup: popping",
d11e0cfa 2440 yystos[*yyssp], yyvsp, yylsp);
3b0ffc7e 2441 YYPOPSTACK (1);
d11e0cfa 2442 }
e9955c83
AD
2443#ifndef yyoverflow
2444 if (yyss != yyssa)
2445 YYSTACK_FREE (yyss);
2abdfeef
PE
2446#endif
2447#if YYERROR_VERBOSE
2448 if (yymsg != yymsgbuf)
2449 YYSTACK_FREE (yymsg);
e9955c83 2450#endif
d2a1a60a
PE
2451 /* Make sure YYID is used. */
2452 return YYID (yyresult);
e9955c83 2453}
1921f1d7 2454
366eea36 2455
381ecb06 2456#line 539 "parse-gram.y"
05d18c24
PE
2457
2458
2459
2460/* Return the location of the left-hand side of a rule whose
2461 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2462 the right-hand side, and return an empty location equal to the end
2463 boundary of RHS[0] if the right-hand side is empty. */
2464
2465static YYLTYPE
2466lloc_default (YYLTYPE const *rhs, int n)
2467{
2468 int i;
1d64f0ba 2469 YYLTYPE loc;
329d23c5
PE
2470
2471 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2472 The bug is fixed in 7.4.2m, but play it safe for now. */
2473 loc.start = rhs[n].end;
2474 loc.end = rhs[n].end;
05d18c24 2475
73521d9f
PE
2476 /* Ignore empty nonterminals the start of the the right-hand side.
2477 Do not bother to ignore them at the end of the right-hand side,
2478 since empty nonterminals have the same end as their predecessors. */
05d18c24
PE
2479 for (i = 1; i <= n; i++)
2480 if (! equal_boundaries (rhs[i].start, rhs[i].end))
2481 {
1d64f0ba 2482 loc.start = rhs[i].start;
05d18c24
PE
2483 break;
2484 }
2485
1d64f0ba 2486 return loc;
05d18c24
PE
2487}
2488
2489
2490/* Add a lex-param or a parse-param (depending on TYPE) with
2491 declaration DECL and location LOC. */
2492
2493static void
73521d9f 2494add_param (char const *type, char *decl, location loc)
05d18c24 2495{
8a8dc872 2496 static char const alphanum[26 + 26 + 1 + 10] =
05d18c24
PE
2497 "abcdefghijklmnopqrstuvwxyz"
2498 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
8a8dc872
AD
2499 "_"
2500 "0123456789";
05d18c24 2501 char const *name_start = NULL;
73521d9f 2502 char *p;
05d18c24 2503
2ed24dd8 2504 /* Stop on last actual character. */
e503aa60 2505 for (p = decl; p[1]; p++)
8a8dc872
AD
2506 if ((p == decl
2507 || ! memchr (alphanum, p[-1], sizeof alphanum))
2508 && memchr (alphanum, p[0], sizeof alphanum - 10))
05d18c24 2509 name_start = p;
2ed24dd8 2510
8a8dc872
AD
2511 /* Strip the surrounding '{' and '}', and any blanks just inside
2512 the braces. */
2513 while (*--p == ' ' || *p == '\t')
2514 continue;
e503aa60 2515 p[1] = '\0';
8a8dc872
AD
2516 while (*++decl == ' ' || *decl == '\t')
2517 continue;
73521d9f 2518
05d18c24
PE
2519 if (! name_start)
2520 complain_at (loc, _("missing identifier in parameter declaration"));
2521 else
2522 {
2523 char *name;
2524 size_t name_len;
2525
2526 for (name_len = 1;
8a8dc872 2527 memchr (alphanum, name_start[name_len], sizeof alphanum);
05d18c24
PE
2528 name_len++)
2529 continue;
2530
2531 name = xmalloc (name_len + 1);
2532 memcpy (name, name_start, name_len);
2533 name[name_len] = '\0';
2534 muscle_pair_list_grow (type, decl, name);
2535 free (name);
2536 }
2537
e9071366 2538 gram_scanner_last_string_free ();
05d18c24 2539}
e9955c83 2540
b50d2359
AD
2541static void
2542version_check (location const *loc, char const *version)
2543{
2544 if (strverscmp (version, PACKAGE_VERSION) > 0)
9b8a5ce0
AD
2545 {
2546 complain_at (*loc, "require bison %s, but have %s",
2547 version, PACKAGE_VERSION);
2548 exit (63);
2549 }
b50d2359
AD
2550}
2551
05d18c24
PE
2552static void
2553gram_error (location const *loc, char const *msg)
e9955c83 2554{
05d18c24 2555 complain_at (*loc, "%s", msg);
e9955c83 2556}
1921f1d7 2557
73521d9f
PE
2558char const *
2559token_name (int type)
2560{
e0045d49 2561 return yytname[YYTRANSLATE (type)];
73521d9f
PE
2562}
2563
d2a1a60a
PE
2564static char const *
2565char_name (char c)
2566{
2567 if (c == '\'')
2568 return "'\\''";
2569 else
2570 {
2571 char buf[4];
2572 buf[0] = '\''; buf[1] = c; buf[2] = '\''; buf[3] = '\0';
2573 return quotearg_style (escape_quoting_style, buf);
2574 }
2575}
2576