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