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