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