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