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