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