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