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