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