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