]> git.saurik.com Git - bison.git/blame - src/parse-gram.c
* src/parse-gram.y (directives, directive, gram)
[bison.git] / src / parse-gram.c
CommitLineData
e9955c83 1/* A Bison parser, made from parse-gram.y
0c15323d 2 by GNU bison 1.35. */
e9955c83 3
0c15323d 4#define YYBISON 1 /* Identify Bison output. */
e96c9728 5
e9955c83 6#define yyparse gram_parse
0c15323d 7#define yylex gram_lex
e9955c83 8#define yyerror gram_error
0c15323d
AD
9#define yylval gram_lval
10#define yychar gram_char
e9955c83
AD
11#define yydebug gram_debug
12#define yynerrs gram_nerrs
0c15323d 13#define YYLSP_NEEDED 1
e9955c83 14
0c15323d
AD
15# define GRAM_EOF 0
16# define STRING 257
17# define CHARACTER 258
18# define INT 259
19# define PERCENT_TOKEN 260
20# define PERCENT_NTERM 261
21# define PERCENT_TYPE 262
22# define PERCENT_UNION 263
23# define PERCENT_EXPECT 264
24# define PERCENT_START 265
25# define PERCENT_LEFT 266
26# define PERCENT_RIGHT 267
27# define PERCENT_NONASSOC 268
28# define PERCENT_PREC 269
29# define PERCENT_VERBOSE 270
30# define PERCENT_ERROR_VERBOSE 271
31# define PERCENT_OUTPUT 272
32# define PERCENT_FILE_PREFIX 273
33# define PERCENT_NAME_PREFIX 274
34# define PERCENT_DEFINE 275
35# define PERCENT_PURE_PARSER 276
36# define PERCENT_DEFINES 277
37# define PERCENT_YACC 278
38# define PERCENT_DEBUG 279
39# define PERCENT_LOCATIONS 280
40# define PERCENT_NO_LINES 281
41# define PERCENT_SKELETON 282
42# define PERCENT_TOKEN_TABLE 283
43# define TYPE 284
44# define EQUAL 285
45# define SEMICOLON 286
46# define COLON 287
47# define PIPE 288
48# define ID 289
49# define PERCENT_PERCENT 290
50# define PROLOGUE 291
51# define EPILOGUE 292
52# define BRACED_CODE 293
e9955c83 53
e9955c83
AD
54#line 31 "parse-gram.y"
55
56#include "system.h"
57#include "muscle_tab.h"
58#include "files.h"
59#include "getargs.h"
60#include "output.h"
61#include "gram.h"
62#include "reader.h"
63#include "conflicts.h"
64
0c15323d 65/* Produce verbose parse errors. */
4cdb01db
AD
66#define YYERROR_VERBOSE 1
67
e9955c83
AD
68/* Pass the control structure to YYPARSE and YYLEX. */
69#define YYPARSE_PARAM gram_control
70#define YYLEX_PARAM gram_control
71/* YYPARSE receives GRAM_CONTROL as a void *. Provide a
72 correctly typed access to it. */
73#define yycontrol ((gram_control_t *) gram_control)
74
75/* Request detailed parse error messages, and pass them to
76 GRAM_ERROR. */
77#undef yyerror
78#define yyerror(Msg) \
79 gram_error (yycontrol, &yylloc, Msg)
80
81/* When debugging our pure parser, we want to see values and locations
82 of the tokens. */
83#define YYPRINT(File, Type, Value) \
84 yyprint (File, &yylloc, Type, &Value)
0c15323d 85static void yyprint (FILE *file, const location_t *loc,
e9955c83
AD
86 int type, const yystype *value);
87
88symbol_class current_class = unknown_sym;
89char *current_type = 0;
90symbol_t *current_lhs;
91associativity current_assoc;
92int current_prec = 0;
93
e96c9728 94#line 73 "parse-gram.y"
0c15323d
AD
95#ifndef YYSTYPE
96typedef union
97{
e9955c83
AD
98 symbol_t *symbol;
99 int integer;
100 char *string;
101 associativity assoc;
102} yystype;
103# define YYSTYPE yystype
104# define YYSTYPE_IS_TRIVIAL 1
105#endif
106
107#ifndef YYLTYPE
108typedef struct yyltype
109{
110 int first_line;
111 int first_column;
0c15323d 112
e9955c83
AD
113 int last_line;
114 int last_column;
115} yyltype;
0c15323d 116
e9955c83
AD
117# define YYLTYPE yyltype
118# define YYLTYPE_IS_TRIVIAL 1
119#endif
120
0c15323d
AD
121#ifndef YYDEBUG
122# define YYDEBUG 1
123#endif
124
125
126
2c569025 127#define YYFINAL 95
0c15323d
AD
128#define YYFLAG -32768
129#define YYNTBASE 41
130
131/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
2c569025 132#define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 69)
0c15323d
AD
133
134/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
135static const char yytranslate[] =
136{
137 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
154 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
155 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
156 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
157 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
158 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
159 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
162 2, 2, 2, 2, 2, 2, 1, 4, 5, 6,
163 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
164 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
165 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
166 37, 38, 39, 40
167};
168
169#if YYDEBUG
170static const short yyprhs[] =
171{
172 0, 0, 1, 7, 8, 11, 13, 15, 17, 21,
173 23, 25, 28, 32, 34, 38, 40, 44, 46, 49,
2c569025
AD
174 51, 53, 55, 57, 59, 62, 66, 67, 71, 72,
175 76, 77, 82, 83, 88, 90, 92, 94, 95, 97,
176 99, 102, 104, 107, 109, 111, 114, 117, 121, 123,
177 126, 128, 131, 132, 138, 140, 144, 145, 148, 151,
178 155, 157, 159, 161, 163, 165, 167, 168, 171, 172
0c15323d
AD
179};
180static const short yyrhs[] =
181{
2c569025
AD
182 -1, 42, 43, 37, 58, 67, 0, 0, 43, 44,
183 0, 45, 0, 38, 0, 26, 0, 22, 66, 66,
0c15323d 184 0, 24, 0, 18, 0, 11, 6, 0, 20, 32,
2c569025
AD
185 66, 0, 27, 0, 21, 32, 66, 0, 28, 0,
186 19, 32, 66, 0, 23, 0, 29, 66, 0, 30,
187 0, 17, 0, 25, 0, 50, 0, 46, 0, 12,
188 63, 0, 10, 40, 68, 0, 0, 8, 47, 57,
189 0, 0, 7, 48, 57, 0, 0, 9, 31, 49,
190 54, 0, 0, 52, 53, 51, 55, 0, 13, 0,
191 14, 0, 15, 0, 0, 31, 0, 36, 0, 54,
192 36, 0, 63, 0, 55, 63, 0, 31, 0, 36,
193 0, 36, 6, 0, 36, 65, 0, 36, 6, 65,
194 0, 56, 0, 57, 56, 0, 59, 0, 58, 59,
195 0, 0, 36, 34, 60, 61, 33, 0, 62, 0,
196 61, 35, 62, 0, 0, 62, 63, 0, 62, 64,
197 0, 62, 16, 63, 0, 36, 0, 65, 0, 5,
198 0, 40, 0, 4, 0, 4, 0, 0, 37, 39,
199 0, 0, 33, 0
0c15323d
AD
200};
201
202#endif
4cdb01db 203
0c15323d
AD
204#if YYDEBUG
205/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
206static const short yyrline[] =
207{
2c569025
AD
208 0, 134, 134, 147, 149, 152, 154, 155, 156, 157,
209 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
210 168, 169, 172, 174, 175, 179, 187, 187, 193, 193,
211 198, 198, 204, 204, 211, 213, 214, 217, 219, 223,
212 225, 229, 235, 243, 248, 253, 259, 265, 275, 278,
213 287, 289, 292, 292, 297, 299, 302, 305, 307, 309,
214 313, 315, 316, 319, 325, 334, 342, 347, 353, 355
0c15323d
AD
215};
216#endif
4cdb01db 217
4cdb01db 218
0c15323d
AD
219#if (YYDEBUG) || defined YYERROR_VERBOSE
220
221/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
222static const char *const yytname[] =
223{
224 "$", "error", "$undefined.", "\"end of string\"", "STRING", "CHARACTER",
225 "INT", "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%union\"",
226 "\"%expect\"", "\"%start\"", "\"%left\"", "\"%right\"", "\"%nonassoc\"",
227 "\"%prec\"", "\"%verbose\"", "\"%error-verbose\"", "\"%output\"",
228 "\"%file-prefix\"", "\"%name-prefix\"", "\"%define\"",
229 "\"%pure-parser\"", "\"%defines\"", "\"%yacc\"", "\"%debug\"",
230 "\"%locations\"", "\"%no-lines\"", "\"%skeleton\"", "\"%token-table\"",
231 "TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"", "\"identifier\"", "\"%%\"",
2c569025
AD
232 "PROLOGUE", "EPILOGUE", "BRACED_CODE", "input", "@1", "declarations",
233 "declaration", "grammar_declaration", "symbol_declaration", "@2", "@3",
234 "@4", "precedence_declaration", "@5", "precedence_declarator",
235 "type.opt", "nterms_to_type.1", "terms_to_prec.1", "symbol_def",
236 "symbol_defs.1", "grammar", "rules", "@6", "rhses.1", "rhs", "symbol",
237 "action", "string_as_id", "string_content", "epilogue.opt",
238 "semi_colon_opt", 0
0c15323d
AD
239};
240#endif
241
242/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
243static const short yyr1[] =
244{
245 0, 42, 41, 43, 43, 44, 44, 44, 44, 44,
246 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
2c569025
AD
247 44, 44, 45, 45, 45, 45, 47, 46, 48, 46,
248 49, 46, 51, 50, 52, 52, 52, 53, 53, 54,
249 54, 55, 55, 56, 56, 56, 56, 56, 57, 57,
250 58, 58, 60, 59, 61, 61, 62, 62, 62, 62,
251 63, 63, 63, 64, 65, 66, 67, 67, 68, 68
0c15323d
AD
252};
253
254/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
255static const short yyr2[] =
256{
257 0, 0, 5, 0, 2, 1, 1, 1, 3, 1,
258 1, 2, 3, 1, 3, 1, 3, 1, 2, 1,
2c569025
AD
259 1, 1, 1, 1, 2, 3, 0, 3, 0, 3,
260 0, 4, 0, 4, 1, 1, 1, 0, 1, 1,
261 2, 1, 2, 1, 1, 2, 2, 3, 1, 2,
262 1, 2, 0, 5, 1, 3, 0, 2, 2, 3,
263 1, 1, 1, 1, 1, 1, 0, 2, 0, 1
0c15323d
AD
264};
265
266/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
267 doesn't specify something else to do. Zero means the default is an
268 error. */
269static const short yydefact[] =
270{
2c569025
AD
271 1, 3, 0, 28, 26, 0, 0, 0, 0, 34,
272 35, 36, 20, 10, 0, 0, 0, 0, 17, 9,
0c15323d 273 21, 7, 13, 15, 0, 19, 0, 6, 4, 5,
2c569025
AD
274 23, 22, 37, 0, 0, 30, 68, 11, 64, 62,
275 60, 24, 61, 0, 0, 0, 65, 0, 18, 0,
276 66, 50, 38, 32, 43, 44, 48, 29, 27, 0,
277 69, 25, 16, 12, 14, 8, 52, 0, 51, 2,
278 0, 45, 46, 49, 39, 31, 56, 67, 33, 41,
279 47, 40, 0, 54, 42, 53, 56, 0, 63, 57,
280 58, 55, 59, 0, 0, 0
0c15323d
AD
281};
282
283static const short yydefgoto[] =
284{
2c569025
AD
285 93, 1, 2, 28, 29, 30, 34, 33, 59, 31,
286 70, 32, 53, 75, 78, 56, 57, 50, 51, 76,
287 82, 83, 89, 90, 42, 47, 69, 61
0c15323d
AD
288};
289
290static const short yypact[] =
291{
2c569025
AD
292 -32768,-32768, 31,-32768,-32768, -22, -29, 8, -1,-32768,
293 -32768,-32768,-32768,-32768, -16, -14, -11, 19,-32768,-32768,
294 -32768,-32768,-32768,-32768, 19,-32768, -9,-32768,-32768,-32768,
295 -32768,-32768, 0, -24, -24,-32768, 1,-32768,-32768,-32768,
296 -32768,-32768,-32768, 19, 19, 19,-32768, 19,-32768, -2,
297 -17,-32768,-32768,-32768,-32768, 4,-32768, -24, -24, 11,
298 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 24,-32768,-32768,
299 -1, 32,-32768,-32768,-32768, 28,-32768,-32768, -1,-32768,
300 -32768,-32768, -18, -3,-32768,-32768,-32768, -1,-32768,-32768,
301 -32768, -3,-32768, 65, 66,-32768
0c15323d
AD
302};
303
304static const short yypgoto[] =
305{
306 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
2c569025
AD
307 -32768,-32768,-32768,-32768,-32768, -28, 33,-32768, 21,-32768,
308 -32768, -13, -8,-32768, -49, -19,-32768,-32768
0c15323d
AD
309};
310
311
2c569025 312#define YYLAST 79
0c15323d
AD
313
314
315static const short yytable[] =
316{
2c569025
AD
317 41, 38, 39, 38, 39, 48, 72, 54, 38, 35,
318 71, 36, 55, 87, 37, 85, 43, 86, 44, 49,
319 67, 45, 80, 46, 62, 63, 64, 49, 65, 73,
320 73, 52, 66, 40, 60, 40, 38, 88, 3, 4,
321 5, 6, 7, 8, 9, 10, 11, 74, 12, 13,
322 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
323 24, 25, 79, 77, 81, 94, 95, 58, 26, 27,
324 84, 68, 0, 91, 0, 0, 0, 0, 0, 92
0c15323d
AD
325};
326
327static const short yycheck[] =
328{
2c569025 329 8, 4, 5, 4, 5, 24, 55, 31, 4, 31,
0c15323d 330 6, 40, 36, 16, 6, 33, 32, 35, 32, 36,
2c569025
AD
331 37, 32, 71, 4, 43, 44, 45, 36, 47, 57,
332 58, 31, 34, 36, 33, 36, 4, 40, 7, 8,
333 9, 10, 11, 12, 13, 14, 15, 36, 17, 18,
334 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
335 29, 30, 70, 39, 36, 0, 0, 34, 37, 38,
336 78, 50, -1, 86, -1, -1, -1, -1, -1, 87
0c15323d
AD
337};
338#define YYPURE 1
339
340/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
341#line 3 "/usr/share/bison/bison.simple"
342
343/* Skeleton output parser for bison,
344
345 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
346 Foundation, Inc.
347
348 This program is free software; you can redistribute it and/or modify
349 it under the terms of the GNU General Public License as published by
350 the Free Software Foundation; either version 2, or (at your option)
351 any later version.
352
353 This program is distributed in the hope that it will be useful,
354 but WITHOUT ANY WARRANTY; without even the implied warranty of
355 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
356 GNU General Public License for more details.
357
358 You should have received a copy of the GNU General Public License
359 along with this program; if not, write to the Free Software
360 Foundation, Inc., 59 Temple Place - Suite 330,
361 Boston, MA 02111-1307, USA. */
362
363/* As a special exception, when this file is copied by Bison into a
364 Bison output file, you may use that output file without restriction.
365 This special exception was added by the Free Software Foundation
366 in version 1.24 of Bison. */
367
368/* This is the parser code that is written into each bison parser when
369 the %semantic_parser declaration is not specified in the grammar.
370 It was written by Richard Stallman by simplifying the hairy parser
371 used when %semantic_parser is specified. */
372
373/* All symbols defined below should begin with yy or YY, to avoid
374 infringing on user name space. This should be done even for local
375 variables, as they might otherwise be expanded by user macros.
376 There are some unavoidable exceptions within include files to
377 define necessary library symbols; they are noted "INFRINGES ON
378 USER NAME SPACE" below. */
379
380#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
e9955c83
AD
381
382/* The parser invokes alloca or malloc; define the necessary symbols. */
383
384# if YYSTACK_USE_ALLOCA
385# define YYSTACK_ALLOC alloca
386# else
387# ifndef YYSTACK_USE_ALLOCA
388# if defined (alloca) || defined (_ALLOCA_H)
389# define YYSTACK_ALLOC alloca
390# else
391# ifdef __GNUC__
392# define YYSTACK_ALLOC __builtin_alloca
393# endif
394# endif
395# endif
396# endif
397
398# ifdef YYSTACK_ALLOC
399 /* Pacify GCC's `empty if-body' warning. */
400# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
401# else
402# if defined (__STDC__) || defined (__cplusplus)
403# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
404# define YYSIZE_T size_t
405# endif
406# define YYSTACK_ALLOC malloc
407# define YYSTACK_FREE free
408# endif
0c15323d 409#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
e9955c83
AD
410
411
412#if (! defined (yyoverflow) \
413 && (! defined (__cplusplus) \
414 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
415
416/* A type that is properly aligned for any stack member. */
417union yyalloc
418{
419 short yyss;
420 YYSTYPE yyvs;
421# if YYLSP_NEEDED
422 YYLTYPE yyls;
423# endif
424};
425
426/* The size of the maximum gap between one aligned stack and the next. */
427# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
428
429/* The size of an array large to enough to hold all stacks, each with
430 N elements. */
431# if YYLSP_NEEDED
432# define YYSTACK_BYTES(N) \
433 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
434 + 2 * YYSTACK_GAP_MAX)
435# else
436# define YYSTACK_BYTES(N) \
437 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
438 + YYSTACK_GAP_MAX)
439# endif
440
441/* Copy COUNT objects from FROM to TO. The source and destination do
442 not overlap. */
443# ifndef YYCOPY
444# if 1 < __GNUC__
445# define YYCOPY(To, From, Count) \
446 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
447# else
448# define YYCOPY(To, From, Count) \
449 do \
450 { \
451 register YYSIZE_T yyi; \
452 for (yyi = 0; yyi < (Count); yyi++) \
0c15323d 453 (To)[yyi] = (From)[yyi]; \
e9955c83
AD
454 } \
455 while (0)
456# endif
457# endif
458
459/* Relocate STACK from its old location to the new one. The
460 local variables YYSIZE and YYSTACKSIZE give the old and new number of
461 elements in the stack, and YYPTR gives the new location of the
462 stack. Advance YYPTR to a properly aligned location for the next
463 stack. */
464# define YYSTACK_RELOCATE(Stack) \
465 do \
466 { \
467 YYSIZE_T yynewbytes; \
468 YYCOPY (&yyptr->Stack, Stack, yysize); \
469 Stack = &yyptr->Stack; \
470 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
471 yyptr += yynewbytes / sizeof (*yyptr); \
472 } \
473 while (0)
474
475#endif
476
e9955c83
AD
477
478#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
479# define YYSIZE_T __SIZE_TYPE__
480#endif
481#if ! defined (YYSIZE_T) && defined (size_t)
482# define YYSIZE_T size_t
483#endif
484#if ! defined (YYSIZE_T)
485# if defined (__STDC__) || defined (__cplusplus)
486# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
487# define YYSIZE_T size_t
488# endif
489#endif
490#if ! defined (YYSIZE_T)
491# define YYSIZE_T unsigned int
492#endif
493
494#define yyerrok (yyerrstatus = 0)
495#define yyclearin (yychar = YYEMPTY)
496#define YYEMPTY -2
497#define YYEOF 0
e9955c83 498#define YYACCEPT goto yyacceptlab
0c15323d 499#define YYABORT goto yyabortlab
e9955c83 500#define YYERROR goto yyerrlab1
e9955c83
AD
501/* Like YYERROR except do call yyerror. This remains here temporarily
502 to ease the transition to the new meaning of YYERROR, for GCC.
503 Once GCC version 2 has supplanted version 1, this can go. */
e9955c83 504#define YYFAIL goto yyerrlab
e9955c83 505#define YYRECOVERING() (!!yyerrstatus)
e9955c83
AD
506#define YYBACKUP(Token, Value) \
507do \
508 if (yychar == YYEMPTY && yylen == 1) \
509 { \
510 yychar = (Token); \
511 yylval = (Value); \
512 yychar1 = YYTRANSLATE (yychar); \
513 YYPOPSTACK; \
514 goto yybackup; \
515 } \
516 else \
517 { \
518 yyerror ("syntax error: cannot back up"); \
519 YYERROR; \
520 } \
521while (0)
522
523#define YYTERROR 1
524#define YYERRCODE 256
525
0c15323d 526
e9955c83 527/* YYLLOC_DEFAULT -- Compute the default location (before the actions
0c15323d
AD
528 are run).
529
530 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
531 first token. By default, to implement support for ranges, extend
532 its range to the last symbol. */
e9955c83
AD
533
534#ifndef YYLLOC_DEFAULT
0c15323d
AD
535# define YYLLOC_DEFAULT(Current, Rhs, N) \
536 Current.last_line = Rhs[N].last_line; \
537 Current.last_column = Rhs[N].last_column;
e9955c83
AD
538#endif
539
0c15323d 540
e9955c83
AD
541/* YYLEX -- calling `yylex' with the right arguments. */
542
543#if YYPURE
544# if YYLSP_NEEDED
545# ifdef YYLEX_PARAM
546# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
547# else
548# define YYLEX yylex (&yylval, &yylloc)
549# endif
550# else /* !YYLSP_NEEDED */
551# ifdef YYLEX_PARAM
552# define YYLEX yylex (&yylval, YYLEX_PARAM)
553# else
554# define YYLEX yylex (&yylval)
555# endif
556# endif /* !YYLSP_NEEDED */
557#else /* !YYPURE */
558# define YYLEX yylex ()
559#endif /* !YYPURE */
560
0c15323d 561
e9955c83
AD
562/* Enable debugging if requested. */
563#if YYDEBUG
564
565# ifndef YYFPRINTF
566# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
567# define YYFPRINTF fprintf
568# endif
569
570# define YYDPRINTF(Args) \
571do { \
572 if (yydebug) \
573 YYFPRINTF Args; \
574} while (0)
575/* Nonzero means print parse trace. It is left uninitialized so that
576 multiple parsers can coexist. */
577int yydebug;
578#else /* !YYDEBUG */
579# define YYDPRINTF(Args)
580#endif /* !YYDEBUG */
581
582/* YYINITDEPTH -- initial size of the parser's stacks. */
583#ifndef YYINITDEPTH
584# define YYINITDEPTH 200
585#endif
586
587/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
588 if the built-in stack extension method is used).
589
590 Do not make this value too large; the results are undefined if
591 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
592 evaluated with infinite-precision integer arithmetic. */
593
594#if YYMAXDEPTH == 0
595# undef YYMAXDEPTH
596#endif
597
598#ifndef YYMAXDEPTH
599# define YYMAXDEPTH 10000
600#endif
e9955c83 601\f
0c15323d 602#ifdef YYERROR_VERBOSE
e9955c83
AD
603
604# ifndef yystrlen
605# if defined (__GLIBC__) && defined (_STRING_H)
606# define yystrlen strlen
607# else
608/* Return the length of YYSTR. */
609static YYSIZE_T
610# if defined (__STDC__) || defined (__cplusplus)
611yystrlen (const char *yystr)
612# else
613yystrlen (yystr)
614 const char *yystr;
615# endif
616{
617 register const char *yys = yystr;
618
619 while (*yys++ != '\0')
620 continue;
621
622 return yys - yystr - 1;
623}
624# endif
625# endif
626
627# ifndef yystpcpy
628# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
629# define yystpcpy stpcpy
630# else
631/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
632 YYDEST. */
633static char *
634# if defined (__STDC__) || defined (__cplusplus)
635yystpcpy (char *yydest, const char *yysrc)
636# else
637yystpcpy (yydest, yysrc)
638 char *yydest;
639 const char *yysrc;
640# endif
641{
642 register char *yyd = yydest;
643 register const char *yys = yysrc;
644
645 while ((*yyd++ = *yys++) != '\0')
646 continue;
647
648 return yyd - 1;
649}
650# endif
651# endif
0c15323d 652#endif
e96c9728 653\f
0c15323d
AD
654#line 315 "/usr/share/bison/bison.simple"
655
e9955c83
AD
656
657/* The user can define YYPARSE_PARAM as the name of an argument to be passed
658 into yyparse. The argument should have type void *.
659 It should actually point to an object.
660 Grammar actions can access the variable by casting it
661 to the proper pointer type. */
662
663#ifdef YYPARSE_PARAM
664# if defined (__STDC__) || defined (__cplusplus)
665# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
666# define YYPARSE_PARAM_DECL
667# else
668# define YYPARSE_PARAM_ARG YYPARSE_PARAM
669# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
670# endif
671#else /* !YYPARSE_PARAM */
672# define YYPARSE_PARAM_ARG
673# define YYPARSE_PARAM_DECL
674#endif /* !YYPARSE_PARAM */
675
676/* Prevent warning if -Wstrict-prototypes. */
677#ifdef __GNUC__
678# ifdef YYPARSE_PARAM
679int yyparse (void *);
680# else
681int yyparse (void);
682# endif
683#endif
684
685/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
686 variables are global, or local to YYPARSE. */
687
688#define YY_DECL_NON_LSP_VARIABLES \
689/* The lookahead symbol. */ \
690int yychar; \
691 \
0c15323d 692/* The semantic value of the lookahead symbol. */ \
e9955c83
AD
693YYSTYPE yylval; \
694 \
695/* Number of parse errors so far. */ \
696int yynerrs;
697
698#if YYLSP_NEEDED
699# define YY_DECL_VARIABLES \
700YY_DECL_NON_LSP_VARIABLES \
701 \
702/* Location data for the lookahead symbol. */ \
703YYLTYPE yylloc;
704#else
705# define YY_DECL_VARIABLES \
706YY_DECL_NON_LSP_VARIABLES
707#endif
708
0c15323d
AD
709
710/* If nonreentrant, generate the variables here. */
e9955c83
AD
711
712#if !YYPURE
713YY_DECL_VARIABLES
714#endif /* !YYPURE */
715
716int
717yyparse (YYPARSE_PARAM_ARG)
718 YYPARSE_PARAM_DECL
719{
0c15323d 720 /* If reentrant, generate the variables here. */
e9955c83
AD
721#if YYPURE
722 YY_DECL_VARIABLES
723#endif /* !YYPURE */
724
725 register int yystate;
726 register int yyn;
727 int yyresult;
728 /* Number of tokens to shift before error messages enabled. */
729 int yyerrstatus;
730 /* Lookahead token as an internal (translated) token number. */
731 int yychar1 = 0;
732
733 /* Three stacks and their tools:
734 `yyss': related to states,
735 `yyvs': related to semantic values,
736 `yyls': related to locations.
737
738 Refer to the stacks thru separate pointers, to allow yyoverflow
739 to reallocate them elsewhere. */
740
0c15323d 741 /* The state stack. */
e9955c83
AD
742 short yyssa[YYINITDEPTH];
743 short *yyss = yyssa;
744 register short *yyssp;
745
746 /* The semantic value stack. */
747 YYSTYPE yyvsa[YYINITDEPTH];
748 YYSTYPE *yyvs = yyvsa;
749 register YYSTYPE *yyvsp;
750
751#if YYLSP_NEEDED
752 /* The location stack. */
753 YYLTYPE yylsa[YYINITDEPTH];
754 YYLTYPE *yyls = yylsa;
755 YYLTYPE *yylsp;
756#endif
757
758#if YYLSP_NEEDED
759# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
760#else
761# define YYPOPSTACK (yyvsp--, yyssp--)
762#endif
763
764 YYSIZE_T yystacksize = YYINITDEPTH;
765
0c15323d 766
e9955c83
AD
767 /* The variables used to return semantic value and location from the
768 action routines. */
769 YYSTYPE yyval;
770#if YYLSP_NEEDED
771 YYLTYPE yyloc;
772#endif
773
774 /* When reducing, the number of symbols on the RHS of the reduced
0c15323d 775 rule. */
e9955c83
AD
776 int yylen;
777
778 YYDPRINTF ((stderr, "Starting parse\n"));
779
780 yystate = 0;
781 yyerrstatus = 0;
782 yynerrs = 0;
783 yychar = YYEMPTY; /* Cause a token to be read. */
784
785 /* Initialize stack pointers.
786 Waste one element of value and location stack
787 so that they stay on the same level as the state stack.
788 The wasted elements are never initialized. */
789
790 yyssp = yyss;
791 yyvsp = yyvs;
792#if YYLSP_NEEDED
793 yylsp = yyls;
794#endif
795 goto yysetstate;
796
797/*------------------------------------------------------------.
798| yynewstate -- Push a new state, which is found in yystate. |
799`------------------------------------------------------------*/
800 yynewstate:
801 /* In all cases, when you get here, the value and location stacks
802 have just been pushed. so pushing a state here evens the stacks.
803 */
804 yyssp++;
805
806 yysetstate:
807 *yyssp = yystate;
808
809 if (yyssp >= yyss + yystacksize - 1)
810 {
811 /* Get the current used size of the three stacks, in elements. */
812 YYSIZE_T yysize = yyssp - yyss + 1;
813
814#ifdef yyoverflow
815 {
816 /* Give user a chance to reallocate the stack. Use copies of
817 these so that the &'s don't force the real ones into
818 memory. */
819 YYSTYPE *yyvs1 = yyvs;
820 short *yyss1 = yyss;
821
822 /* Each stack pointer address is followed by the size of the
823 data in use in that stack, in bytes. */
824# if YYLSP_NEEDED
825 YYLTYPE *yyls1 = yyls;
826 /* This used to be a conditional around just the two extra args,
827 but that might be undefined if yyoverflow is a macro. */
828 yyoverflow ("parser stack overflow",
829 &yyss1, yysize * sizeof (*yyssp),
830 &yyvs1, yysize * sizeof (*yyvsp),
831 &yyls1, yysize * sizeof (*yylsp),
832 &yystacksize);
833 yyls = yyls1;
834# else
835 yyoverflow ("parser stack overflow",
836 &yyss1, yysize * sizeof (*yyssp),
837 &yyvs1, yysize * sizeof (*yyvsp),
838 &yystacksize);
839# endif
840 yyss = yyss1;
841 yyvs = yyvs1;
842 }
843#else /* no yyoverflow */
844# ifndef YYSTACK_RELOCATE
845 goto yyoverflowlab;
846# else
847 /* Extend the stack our own way. */
848 if (yystacksize >= YYMAXDEPTH)
849 goto yyoverflowlab;
850 yystacksize *= 2;
851 if (yystacksize > YYMAXDEPTH)
852 yystacksize = YYMAXDEPTH;
853
854 {
855 short *yyss1 = yyss;
856 union yyalloc *yyptr =
857 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
858 if (! yyptr)
859 goto yyoverflowlab;
860 YYSTACK_RELOCATE (yyss);
861 YYSTACK_RELOCATE (yyvs);
0c15323d 862# if YYLSP_NEEDED
e9955c83 863 YYSTACK_RELOCATE (yyls);
0c15323d
AD
864# endif
865# undef YYSTACK_RELOCATE
e9955c83
AD
866 if (yyss1 != yyssa)
867 YYSTACK_FREE (yyss1);
868 }
869# endif
870#endif /* no yyoverflow */
871
872 yyssp = yyss + yysize - 1;
873 yyvsp = yyvs + yysize - 1;
874#if YYLSP_NEEDED
875 yylsp = yyls + yysize - 1;
876#endif
877
878 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
879 (unsigned long int) yystacksize));
880
881 if (yyssp >= yyss + yystacksize - 1)
882 YYABORT;
883 }
884
885 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
886
887 goto yybackup;
888
0c15323d 889
e9955c83
AD
890/*-----------.
891| yybackup. |
892`-----------*/
893yybackup:
894
895/* Do appropriate processing given the current state. */
896/* Read a lookahead token if we need one and don't already have one. */
897/* yyresume: */
898
899 /* First try to decide what to do without reference to lookahead token. */
900
901 yyn = yypact[yystate];
902 if (yyn == YYFLAG)
903 goto yydefault;
904
905 /* Not known => get a lookahead token if don't already have one. */
906
907 /* yychar is either YYEMPTY or YYEOF
908 or a valid token in external form. */
909
910 if (yychar == YYEMPTY)
911 {
912 YYDPRINTF ((stderr, "Reading a token: "));
913 yychar = YYLEX;
914 }
915
0c15323d 916 /* Convert token to internal form (in yychar1) for indexing tables with */
e9955c83 917
0c15323d 918 if (yychar <= 0) /* This means end of input. */
e9955c83
AD
919 {
920 yychar1 = 0;
0c15323d 921 yychar = YYEOF; /* Don't call YYLEX any more */
e9955c83
AD
922
923 YYDPRINTF ((stderr, "Now at end of input.\n"));
924 }
925 else
926 {
927 yychar1 = YYTRANSLATE (yychar);
928
929#if YYDEBUG
930 /* We have to keep this `#if YYDEBUG', since we use variables
931 which are defined only if `YYDEBUG' is set. */
932 if (yydebug)
933 {
934 YYFPRINTF (stderr, "Next token is %d (%s",
935 yychar, yytname[yychar1]);
936 /* Give the individual parser a way to print the precise
937 meaning of a token, for further debugging info. */
938# ifdef YYPRINT
939 YYPRINT (stderr, yychar, yylval);
940# endif
941 YYFPRINTF (stderr, ")\n");
942 }
943#endif
944 }
945
946 yyn += yychar1;
947 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
948 goto yydefault;
949
950 yyn = yytable[yyn];
951
952 /* yyn is what to do for this token type in this state.
953 Negative => reduce, -yyn is rule number.
954 Positive => shift, yyn is new state.
955 New state is final state => don't bother to shift,
956 just return success.
957 0, or most negative number => error. */
958
959 if (yyn < 0)
960 {
961 if (yyn == YYFLAG)
962 goto yyerrlab;
963 yyn = -yyn;
964 goto yyreduce;
965 }
966 else if (yyn == 0)
967 goto yyerrlab;
968
969 if (yyn == YYFINAL)
970 YYACCEPT;
971
972 /* Shift the lookahead token. */
973 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
974 yychar, yytname[yychar1]));
975
976 /* Discard the token being shifted unless it is eof. */
977 if (yychar != YYEOF)
978 yychar = YYEMPTY;
979
980 *++yyvsp = yylval;
981#if YYLSP_NEEDED
982 *++yylsp = yylloc;
983#endif
984
985 /* Count tokens shifted since error; after three, turn off error
986 status. */
987 if (yyerrstatus)
988 yyerrstatus--;
989
990 yystate = yyn;
991 goto yynewstate;
992
993
994/*-----------------------------------------------------------.
995| yydefault -- do the default action for the current state. |
996`-----------------------------------------------------------*/
997yydefault:
998 yyn = yydefact[yystate];
999 if (yyn == 0)
1000 goto yyerrlab;
1001 goto yyreduce;
1002
1003
1004/*-----------------------------.
1005| yyreduce -- Do a reduction. |
1006`-----------------------------*/
1007yyreduce:
1008 /* yyn is the number of a rule to reduce with. */
1009 yylen = yyr2[yyn];
1010
1011 /* If YYLEN is nonzero, implement the default value of the action:
1012 `$$ = $1'.
1013
1014 Otherwise, the following line sets YYVAL to the semantic value of
1015 the lookahead token. This behavior is undocumented and Bison
1016 users should not rely upon it. Assigning to YYVAL
1017 unconditionally makes the parser a bit smaller, and it avoids a
1018 GCC warning that YYVAL may be used uninitialized. */
1019 yyval = yyvsp[1-yylen];
1020
1021#if YYLSP_NEEDED
0c15323d
AD
1022 /* Similarly for the default location. Let the user run additional
1023 commands if for instance locations are ranges. */
1024 yyloc = yylsp[1-yylen];
e9955c83
AD
1025 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1026#endif
1027
1028#if YYDEBUG
1029 /* We have to keep this `#if YYDEBUG', since we use variables which
1030 are defined only if `YYDEBUG' is set. */
1031 if (yydebug)
1032 {
1033 int yyi;
1034
1035 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
0c15323d 1036 yyn, yyrline[yyn]);
e9955c83
AD
1037
1038 /* Print the symbols being reduced, and their result. */
0c15323d 1039 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
e9955c83
AD
1040 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1041 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1042 }
1043#endif
e96c9728 1044
0c15323d
AD
1045 switch (yyn) {
1046
1047case 1:
2c569025 1048#line 134 "parse-gram.y"
0c15323d
AD
1049{ LOCATION_RESET (yylloc); }
1050 break;
1051case 2:
2c569025 1052#line 136 "parse-gram.y"
0c15323d 1053{
4cdb01db 1054 yycontrol->errcode = 0;
0c15323d 1055 epilogue_set (yyvsp[0].string, yylsp[0]);
4cdb01db 1056 }
e9955c83 1057 break;
0c15323d 1058case 6:
2c569025
AD
1059#line 154 "parse-gram.y"
1060{ prologue_augment (yyvsp[0].string, yylsp[0]); }
e9955c83 1061 break;
0c15323d 1062case 7:
2c569025 1063#line 155 "parse-gram.y"
0c15323d 1064{ debug_flag = 1; }
e9955c83 1065 break;
0c15323d 1066case 8:
2c569025 1067#line 156 "parse-gram.y"
0c15323d 1068{ muscle_insert (yyvsp[-1].string, yyvsp[0].string); }
e9955c83 1069 break;
0c15323d 1070case 9:
2c569025 1071#line 157 "parse-gram.y"
0c15323d 1072{ defines_flag = 1; }
e9955c83 1073 break;
0c15323d 1074case 10:
2c569025 1075#line 158 "parse-gram.y"
0c15323d 1076{ error_verbose = 1; }
e9955c83 1077 break;
0c15323d 1078case 11:
2c569025 1079#line 159 "parse-gram.y"
0c15323d 1080{ expected_conflicts = yyvsp[0].integer; }
e9955c83 1081 break;
0c15323d 1082case 12:
2c569025 1083#line 160 "parse-gram.y"
0c15323d 1084{ spec_file_prefix = yyvsp[0].string; }
e9955c83 1085 break;
0c15323d 1086case 13:
2c569025 1087#line 161 "parse-gram.y"
0c15323d 1088{ locations_flag = 1; }
e9955c83 1089 break;
0c15323d 1090case 14:
2c569025 1091#line 162 "parse-gram.y"
0c15323d 1092{ spec_name_prefix = yyvsp[0].string; }
e9955c83 1093 break;
0c15323d 1094case 15:
2c569025 1095#line 163 "parse-gram.y"
0c15323d 1096{ no_lines_flag = 1; }
4cdb01db 1097 break;
0c15323d 1098case 16:
2c569025 1099#line 164 "parse-gram.y"
0c15323d 1100{ spec_outfile = yyvsp[0].string; }
4cdb01db 1101 break;
0c15323d 1102case 17:
2c569025 1103#line 165 "parse-gram.y"
0c15323d 1104{ pure_parser = 1; }
4cdb01db 1105 break;
0c15323d 1106case 18:
2c569025 1107#line 166 "parse-gram.y"
0c15323d 1108{ skeleton = yyvsp[0].string; }
4cdb01db 1109 break;
0c15323d 1110case 19:
2c569025 1111#line 167 "parse-gram.y"
0c15323d 1112{ token_table_flag = 1; }
e9955c83 1113 break;
0c15323d 1114case 20:
2c569025 1115#line 168 "parse-gram.y"
0c15323d 1116{ report_flag = 1; }
4cdb01db 1117 break;
0c15323d 1118case 21:
2c569025 1119#line 169 "parse-gram.y"
0c15323d 1120{ yacc_flag = 1; }
4cdb01db 1121 break;
0c15323d 1122case 24:
2c569025 1123#line 176 "parse-gram.y"
0c15323d 1124{
2c569025 1125 grammar_start_symbol_set (yyvsp[0].symbol);
4cdb01db 1126 }
e9955c83 1127 break;
0c15323d 1128case 25:
2c569025 1129#line 180 "parse-gram.y"
0c15323d 1130{
2c569025
AD
1131 typed = 1;
1132 MUSCLE_INSERT_INT ("stype_line", yylsp[-1].first_line);
1133 muscle_insert ("stype", yyvsp[-1].string);
4cdb01db 1134 }
e9955c83 1135 break;
0c15323d 1136case 26:
2c569025
AD
1137#line 188 "parse-gram.y"
1138{ current_class = nterm_sym; }
0c15323d
AD
1139 break;
1140case 27:
2c569025 1141#line 189 "parse-gram.y"
0c15323d 1142{
e9955c83
AD
1143 current_class = unknown_sym;
1144 current_type = NULL;
4cdb01db 1145 }
e9955c83 1146 break;
0c15323d 1147case 28:
2c569025
AD
1148#line 193 "parse-gram.y"
1149{ current_class = token_sym; }
0c15323d
AD
1150 break;
1151case 29:
2c569025 1152#line 194 "parse-gram.y"
0c15323d 1153{
2c569025 1154 current_class = unknown_sym;
e9955c83 1155 current_type = NULL;
4cdb01db 1156 }
e9955c83 1157 break;
0c15323d 1158case 30:
2c569025
AD
1159#line 198 "parse-gram.y"
1160{current_type = yyvsp[0].string; }
e9955c83 1161 break;
0c15323d 1162case 31:
2c569025
AD
1163#line 199 "parse-gram.y"
1164{
1165 current_type = NULL;
1166 }
e9955c83 1167 break;
0c15323d 1168case 32:
2c569025
AD
1169#line 206 "parse-gram.y"
1170{ current_assoc = yyvsp[-1].assoc; ++current_prec; }
e9955c83 1171 break;
0c15323d 1172case 33:
2c569025
AD
1173#line 208 "parse-gram.y"
1174{ current_assoc = non_assoc; current_type = NULL; }
e9955c83 1175 break;
0c15323d 1176case 34:
2c569025
AD
1177#line 212 "parse-gram.y"
1178{ yyval.assoc = left_assoc; }
4cdb01db 1179 break;
0c15323d 1180case 35:
2c569025
AD
1181#line 213 "parse-gram.y"
1182{ yyval.assoc = right_assoc; }
e9955c83 1183 break;
0c15323d 1184case 36:
2c569025
AD
1185#line 214 "parse-gram.y"
1186{ yyval.assoc = non_assoc; }
e9955c83 1187 break;
0c15323d 1188case 37:
2c569025
AD
1189#line 218 "parse-gram.y"
1190{ current_type = NULL;}
4cdb01db 1191 break;
0c15323d 1192case 38:
2c569025
AD
1193#line 219 "parse-gram.y"
1194{ current_type = yyvsp[0].string; }
4cdb01db 1195 break;
0c15323d 1196case 39:
2c569025 1197#line 224 "parse-gram.y"
0c15323d
AD
1198{ symbol_type_set (yyvsp[0].symbol, current_type); }
1199 break;
1200case 40:
2c569025
AD
1201#line 225 "parse-gram.y"
1202{ symbol_type_set (yyvsp[0].symbol, current_type); }
1203 break;
1204case 41:
1205#line 231 "parse-gram.y"
0c15323d 1206{
e9955c83
AD
1207 symbol_type_set (yyvsp[0].symbol, current_type);
1208 symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
4cdb01db 1209 }
e9955c83 1210 break;
2c569025
AD
1211case 42:
1212#line 236 "parse-gram.y"
0c15323d 1213{
e9955c83
AD
1214 symbol_type_set (yyvsp[0].symbol, current_type);
1215 symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
4cdb01db 1216 }
e9955c83 1217 break;
2c569025
AD
1218case 43:
1219#line 245 "parse-gram.y"
0c15323d 1220{
e9955c83 1221 current_type = yyvsp[0].string;
4cdb01db 1222 }
e9955c83 1223 break;
2c569025
AD
1224case 44:
1225#line 249 "parse-gram.y"
0c15323d 1226{
e9955c83
AD
1227 symbol_class_set (yyvsp[0].symbol, current_class);
1228 symbol_type_set (yyvsp[0].symbol, current_type);
4cdb01db 1229 }
e9955c83 1230 break;
2c569025
AD
1231case 45:
1232#line 254 "parse-gram.y"
0c15323d 1233{
e9955c83
AD
1234 symbol_class_set (yyvsp[-1].symbol, current_class);
1235 symbol_type_set (yyvsp[-1].symbol, current_type);
1236 symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer);
4cdb01db 1237 }
e9955c83 1238 break;
2c569025
AD
1239case 46:
1240#line 260 "parse-gram.y"
0c15323d 1241{
e9955c83
AD
1242 symbol_class_set (yyvsp[-1].symbol, current_class);
1243 symbol_type_set (yyvsp[-1].symbol, current_type);
1244 symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol);
4cdb01db 1245 }
e9955c83 1246 break;
2c569025
AD
1247case 47:
1248#line 266 "parse-gram.y"
0c15323d 1249{
e9955c83
AD
1250 symbol_class_set (yyvsp[-2].symbol, current_class);
1251 symbol_type_set (yyvsp[-2].symbol, current_type);
1252 symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer);
1253 symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol);
4cdb01db 1254 }
e9955c83 1255 break;
0c15323d 1256case 48:
2c569025 1257#line 277 "parse-gram.y"
0c15323d 1258{;}
e9955c83 1259 break;
2c569025
AD
1260case 49:
1261#line 279 "parse-gram.y"
1262{;}
e9955c83 1263 break;
0c15323d 1264case 52:
2c569025
AD
1265#line 293 "parse-gram.y"
1266{ current_lhs = yyvsp[-1].symbol; }
e9955c83 1267 break;
0c15323d 1268case 53:
2c569025
AD
1269#line 294 "parse-gram.y"
1270{;}
e9955c83 1271 break;
0c15323d 1272case 54:
2c569025 1273#line 298 "parse-gram.y"
0c15323d 1274{ grammar_rule_end (); }
e9955c83 1275 break;
0c15323d 1276case 55:
2c569025
AD
1277#line 299 "parse-gram.y"
1278{ grammar_rule_end (); }
e9955c83 1279 break;
0c15323d 1280case 56:
2c569025
AD
1281#line 304 "parse-gram.y"
1282{ grammar_rule_begin (current_lhs); }
e9955c83 1283 break;
0c15323d 1284case 57:
2c569025
AD
1285#line 306 "parse-gram.y"
1286{ grammar_current_rule_symbol_append (yyvsp[0].symbol); }
e9955c83 1287 break;
0c15323d 1288case 58:
2c569025
AD
1289#line 308 "parse-gram.y"
1290{ grammar_current_rule_action_append (yyvsp[0].string, yylsp[0].first_line); }
4cdb01db 1291 break;
0c15323d 1292case 59:
2c569025
AD
1293#line 310 "parse-gram.y"
1294{ grammar_current_rule_prec_set (yyvsp[0].symbol); }
e9955c83 1295 break;
0c15323d 1296case 60:
2c569025 1297#line 314 "parse-gram.y"
0c15323d 1298{ yyval.symbol = yyvsp[0].symbol; }
4cdb01db 1299 break;
0c15323d 1300case 61:
2c569025
AD
1301#line 315 "parse-gram.y"
1302{ yyval.symbol = yyvsp[0].symbol; }
4cdb01db 1303 break;
0c15323d 1304case 62:
2c569025
AD
1305#line 316 "parse-gram.y"
1306{ yyval.symbol = getsym (yyvsp[0].string); }
0c15323d
AD
1307 break;
1308case 63:
2c569025
AD
1309#line 321 "parse-gram.y"
1310{ yyval.string = yyvsp[0].string; }
1311 break;
1312case 64:
1313#line 327 "parse-gram.y"
0c15323d 1314{
e9955c83
AD
1315 yyval.symbol = getsym (yyvsp[0].string);
1316 symbol_class_set (yyval.symbol, token_sym);
4cdb01db 1317 }
e9955c83 1318 break;
2c569025
AD
1319case 65:
1320#line 336 "parse-gram.y"
0c15323d 1321{
e9955c83
AD
1322 yyval.string = yyvsp[0].string + 1;
1323 yyval.string[strlen (yyval.string) - 1] = '\0';
4cdb01db 1324 }
e9955c83 1325 break;
2c569025
AD
1326case 66:
1327#line 344 "parse-gram.y"
0c15323d 1328{
e9955c83 1329 yyval.string = xstrdup ("");
4cdb01db 1330 }
e9955c83 1331 break;
2c569025
AD
1332case 67:
1333#line 348 "parse-gram.y"
0c15323d 1334{
e9955c83 1335 yyval.string = yyvsp[0].string;
4cdb01db 1336 }
e9955c83 1337 break;
0c15323d 1338}
e9955c83 1339
0c15323d 1340#line 705 "/usr/share/bison/bison.simple"
e9955c83 1341
e9955c83
AD
1342\f
1343 yyvsp -= yylen;
1344 yyssp -= yylen;
1345#if YYLSP_NEEDED
1346 yylsp -= yylen;
1347#endif
1348
1349#if YYDEBUG
1350 if (yydebug)
1351 {
1352 short *yyssp1 = yyss - 1;
1353 YYFPRINTF (stderr, "state stack now");
1354 while (yyssp1 != yyssp)
1355 YYFPRINTF (stderr, " %d", *++yyssp1);
1356 YYFPRINTF (stderr, "\n");
1357 }
1358#endif
1359
1360 *++yyvsp = yyval;
1361#if YYLSP_NEEDED
1362 *++yylsp = yyloc;
1363#endif
1364
1365 /* Now `shift' the result of the reduction. Determine what state
1366 that goes to, based on the state we popped back to and the rule
1367 number reduced by. */
1368
1369 yyn = yyr1[yyn];
1370
0c15323d 1371 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
e9955c83
AD
1372 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1373 yystate = yytable[yystate];
1374 else
0c15323d 1375 yystate = yydefgoto[yyn - YYNTBASE];
e9955c83
AD
1376
1377 goto yynewstate;
1378
1379
1380/*------------------------------------.
1381| yyerrlab -- here on detecting error |
1382`------------------------------------*/
1383yyerrlab:
1384 /* If not already recovering from an error, report this error. */
1385 if (!yyerrstatus)
1386 {
1387 ++yynerrs;
1388
0c15323d 1389#ifdef YYERROR_VERBOSE
e9955c83
AD
1390 yyn = yypact[yystate];
1391
1392 if (yyn > YYFLAG && yyn < YYLAST)
1393 {
1394 YYSIZE_T yysize = 0;
1395 char *yymsg;
1396 int yyx, yycount;
1397
1398 yycount = 0;
1399 /* Start YYX at -YYN if negative to avoid negative indexes in
1400 YYCHECK. */
1401 for (yyx = yyn < 0 ? -yyn : 0;
1402 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1403 if (yycheck[yyx + yyn] == yyx)
1404 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1405 yysize += yystrlen ("parse error, unexpected ") + 1;
1406 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1407 yymsg = (char *) YYSTACK_ALLOC (yysize);
1408 if (yymsg != 0)
1409 {
1410 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1411 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1412
1413 if (yycount < 5)
1414 {
1415 yycount = 0;
1416 for (yyx = yyn < 0 ? -yyn : 0;
1417 yyx < (int) (sizeof (yytname) / sizeof (char *));
1418 yyx++)
1419 if (yycheck[yyx + yyn] == yyx)
1420 {
1421 const char *yyq = ! yycount ? ", expecting " : " or ";
1422 yyp = yystpcpy (yyp, yyq);
1423 yyp = yystpcpy (yyp, yytname[yyx]);
1424 yycount++;
1425 }
1426 }
1427 yyerror (yymsg);
1428 YYSTACK_FREE (yymsg);
0c15323d
AD
1429 }
1430 else
1431 yyerror ("parse error; also virtual memory exhausted");
1432 }
e9955c83 1433 else
0c15323d
AD
1434#endif /* defined (YYERROR_VERBOSE) */
1435 yyerror ("parse error");
e9955c83
AD
1436 }
1437 goto yyerrlab1;
1438
1439
0c15323d
AD
1440/*--------------------------------------------------.
1441| yyerrlab1 -- error raised explicitly by an action |
1442`--------------------------------------------------*/
e9955c83
AD
1443yyerrlab1:
1444 if (yyerrstatus == 3)
1445 {
1446 /* If just tried and failed to reuse lookahead token after an
1447 error, discard it. */
1448
0c15323d 1449 /* return failure if at end of input */
e9955c83
AD
1450 if (yychar == YYEOF)
1451 YYABORT;
1452 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1453 yychar, yytname[yychar1]));
1454 yychar = YYEMPTY;
1455 }
1456
1457 /* Else will try to reuse lookahead token after shifting the error
1458 token. */
1459
0c15323d 1460 yyerrstatus = 3; /* Each real token shifted decrements this */
e9955c83 1461
0c15323d 1462 goto yyerrhandle;
e9955c83 1463
4cdb01db 1464
0c15323d
AD
1465/*-------------------------------------------------------------------.
1466| yyerrdefault -- current state does not do anything special for the |
1467| error token. |
1468`-------------------------------------------------------------------*/
1469yyerrdefault:
1470#if 0
1471 /* This is wrong; only states that explicitly want error tokens
1472 should shift them. */
1473
1474 /* If its default is to accept any token, ok. Otherwise pop it. */
1475 yyn = yydefact[yystate];
1476 if (yyn)
1477 goto yydefault;
e9955c83
AD
1478#endif
1479
0c15323d
AD
1480
1481/*---------------------------------------------------------------.
1482| yyerrpop -- pop the current state because it cannot handle the |
1483| error token |
1484`---------------------------------------------------------------*/
1485yyerrpop:
1486 if (yyssp == yyss)
1487 YYABORT;
1488 yyvsp--;
1489 yystate = *--yyssp;
e9955c83 1490#if YYLSP_NEEDED
0c15323d 1491 yylsp--;
e9955c83
AD
1492#endif
1493
1494#if YYDEBUG
0c15323d
AD
1495 if (yydebug)
1496 {
1497 short *yyssp1 = yyss - 1;
1498 YYFPRINTF (stderr, "Error: state stack now");
1499 while (yyssp1 != yyssp)
1500 YYFPRINTF (stderr, " %d", *++yyssp1);
1501 YYFPRINTF (stderr, "\n");
1502 }
e9955c83 1503#endif
0c15323d
AD
1504
1505/*--------------.
1506| yyerrhandle. |
1507`--------------*/
1508yyerrhandle:
1509 yyn = yypact[yystate];
1510 if (yyn == YYFLAG)
1511 goto yyerrdefault;
1512
1513 yyn += YYTERROR;
1514 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1515 goto yyerrdefault;
1516
1517 yyn = yytable[yyn];
1518 if (yyn < 0)
1519 {
1520 if (yyn == YYFLAG)
1521 goto yyerrpop;
1522 yyn = -yyn;
1523 goto yyreduce;
e9955c83 1524 }
0c15323d
AD
1525 else if (yyn == 0)
1526 goto yyerrpop;
e9955c83
AD
1527
1528 if (yyn == YYFINAL)
1529 YYACCEPT;
1530
1531 YYDPRINTF ((stderr, "Shifting error token, "));
1532
1533 *++yyvsp = yylval;
1534#if YYLSP_NEEDED
1535 *++yylsp = yylloc;
1536#endif
1537
1538 yystate = yyn;
1539 goto yynewstate;
1540
1541
1542/*-------------------------------------.
1543| yyacceptlab -- YYACCEPT comes here. |
1544`-------------------------------------*/
1545yyacceptlab:
1546 yyresult = 0;
1547 goto yyreturn;
1548
1549/*-----------------------------------.
1550| yyabortlab -- YYABORT comes here. |
1551`-----------------------------------*/
1552yyabortlab:
1553 yyresult = 1;
1554 goto yyreturn;
1555
1556/*---------------------------------------------.
1557| yyoverflowab -- parser overflow comes here. |
1558`---------------------------------------------*/
1559yyoverflowlab:
1560 yyerror ("parser stack overflow");
1561 yyresult = 2;
1562 /* Fall through. */
1563
1564yyreturn:
1565#ifndef yyoverflow
1566 if (yyss != yyssa)
1567 YYSTACK_FREE (yyss);
1568#endif
1569 return yyresult;
1570}
2c569025 1571#line 357 "parse-gram.y"
e9955c83
AD
1572
1573/*------------------------------------------------------------------.
1574| When debugging the parser, display tokens' locations and values. |
1575`------------------------------------------------------------------*/
1576
1577static void
1578yyprint (FILE *file,
0c15323d 1579 const location_t *loc, int type, const yystype *value)
e9955c83
AD
1580{
1581 fputs (" (", file);
1582 LOCATION_PRINT (file, *loc);
1583 fputs (")", file);
1584 switch (type)
1585 {
1586 case CHARACTER:
1587 fprintf (file, " = '%s'", value->string);
1588 break;
1589
1590 case ID:
1591 fprintf (file, " = %s", value->symbol->tag);
1592 break;
1593
1594 case INT:
1595 fprintf (file, " = %d", value->integer);
1596 break;
1597
1598 case STRING:
1599 fprintf (file, " = \"%s\"", value->string);
1600 break;
1601
1602 case TYPE:
1603 fprintf (file, " = <%s>", value->string);
1604 break;
1605
1606 case BRACED_CODE:
1607 case PROLOGUE:
1608 case EPILOGUE:
1609 fprintf (file, " = {{ %s }}", value->string);
1610 break;
1611 }
1612}
1613
1614void
1615gram_error (gram_control_t *control ATTRIBUTE_UNUSED,
0c15323d 1616 location_t *yylloc, const char *msg)
e9955c83
AD
1617{
1618 LOCATION_PRINT (stderr, *yylloc);
1619 fprintf (stderr, ": %s\n", msg);
1620}