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