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