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