]> git.saurik.com Git - bison.git/blob - src/parse-gram.c
827947e2ac46e34f6c23ca98dbb189f23d48d29f
[bison.git] / src / parse-gram.c
1 /* A Bison parser, made from parse-gram.y
2 by GNU bison 1.49b. */
3
4 /* Skeleton output parser for Bison,
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
6 Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 /* As a special exception, when this file is copied by Bison into a
24 Bison output file, you may use that output file without restriction.
25 This special exception was added by the Free Software Foundation
26 in version 1.24 of Bison. */
27
28 /* This is the parser code that is written into each bison parser when
29 the %semantic_parser declaration is not specified in the grammar.
30 It was written by Richard Stallman by simplifying the original so
31 called ``semantic'' parser. */
32
33 /* All symbols defined below should begin with yy or YY, to avoid
34 infringing on user name space. This should be done even for local
35 variables, as they might otherwise be expanded by user macros.
36 There are some unavoidable exceptions within include files to
37 define necessary library symbols; they are noted "INFRINGES ON
38 USER NAME SPACE" below. */
39
40 /* Identify Bison output. */
41 #define YYBISON 1
42
43 /* Pure parsers. */
44 #define YYPURE 1
45
46 /* Using locations. */
47 #define YYLSP_NEEDED 1
48
49 /* If NAME_PREFIX is specified substitute the variables and functions
50 names. */
51 #define yyparse gram_parse
52 #define yylex gram_lex
53 #define yyerror gram_error
54 #define yylval gram_lval
55 #define yychar gram_char
56 #define yydebug gram_debug
57 #define yynerrs gram_nerrs
58 #if YYLSP_NEEDED
59 # define yylloc gram_lloc
60 #endif
61
62
63 /* Copy the first part of user declarations. */
64 #line 31 "parse-gram.y"
65
66 #include "system.h"
67 #include "muscle_tab.h"
68 #include "files.h"
69 #include "getargs.h"
70 #include "output.h"
71 #include "gram.h"
72 #include "reader.h"
73 #include "conflicts.h"
74
75 /* Produce verbose parse errors. */
76 #define YYERROR_VERBOSE 1
77 #define YYLLOC_DEFAULT(Current, Rhs, N) \
78 do { \
79 if (N) \
80 { \
81 Current.first_column = Rhs[1].first_column; \
82 Current.first_line = Rhs[1].first_line; \
83 Current.last_column = Rhs[N].last_column; \
84 Current.last_line = Rhs[N].last_line; \
85 } \
86 else \
87 { \
88 Current = Rhs[0]; \
89 } \
90 } while (0)
91
92 /* Pass the control structure to YYPARSE and YYLEX. */
93 #define YYPARSE_PARAM gram_control
94 #define YYLEX_PARAM gram_control
95 /* YYPARSE receives GRAM_CONTROL as a void *. Provide a
96 correctly typed access to it. */
97 #define yycontrol ((gram_control_t *) gram_control)
98
99 /* Request detailed parse error messages, and pass them to
100 GRAM_ERROR. */
101 #undef yyerror
102 #define yyerror(Msg) \
103 gram_error (yycontrol, &yylloc, Msg)
104
105 /* When debugging our pure parser, we want to see values and locations
106 of the tokens. */
107 #define YYPRINT(File, Type, Value) \
108 yyprint (File, &yylloc, Type, &Value)
109 static void yyprint (FILE *file, const location_t *loc,
110 int type, const yystype *value);
111
112 symbol_class current_class = unknown_sym;
113 char *current_type = 0;
114 symbol_t *current_lhs;
115 location_t current_lhs_location;
116 associativity current_assoc;
117 int current_prec = 0;
118
119
120 /* Tokens. */
121 #ifndef YYTOKENTYPE
122 # if defined (__STDC__) || defined (__cplusplus)
123 /* Put the tokens into the symbol table, so that GDB and other debuggers
124 know about them. */
125 enum yytokentype {
126 GRAM_EOF = 0,
127 STRING = 258,
128 CHARACTER = 259,
129 INT = 260,
130 PERCENT_TOKEN = 261,
131 PERCENT_NTERM = 262,
132 PERCENT_TYPE = 263,
133 PERCENT_UNION = 264,
134 PERCENT_LEFT = 265,
135 PERCENT_RIGHT = 266,
136 PERCENT_NONASSOC = 267,
137 PERCENT_EXPECT = 268,
138 PERCENT_START = 269,
139 PERCENT_PREC = 270,
140 PERCENT_VERBOSE = 271,
141 PERCENT_ERROR_VERBOSE = 272,
142 PERCENT_OUTPUT = 273,
143 PERCENT_FILE_PREFIX = 274,
144 PERCENT_NAME_PREFIX = 275,
145 PERCENT_DEFINE = 276,
146 PERCENT_PURE_PARSER = 277,
147 PERCENT_DEFINES = 278,
148 PERCENT_YACC = 279,
149 PERCENT_DEBUG = 280,
150 PERCENT_LOCATIONS = 281,
151 PERCENT_NO_LINES = 282,
152 PERCENT_SKELETON = 283,
153 PERCENT_TOKEN_TABLE = 284,
154 TYPE = 285,
155 EQUAL = 286,
156 SEMICOLON = 287,
157 COLON = 288,
158 PIPE = 289,
159 ID = 290,
160 PERCENT_PERCENT = 291,
161 PROLOGUE = 292,
162 EPILOGUE = 293,
163 BRACED_CODE = 294
164 };
165 # endif
166 /* POSIX requires `int' for tokens in interfaces. */
167 # define YYTOKENTYPE int
168 #endif /* !YYTOKENTYPE */
169 #define GRAM_EOF 0
170 #define STRING 258
171 #define CHARACTER 259
172 #define INT 260
173 #define PERCENT_TOKEN 261
174 #define PERCENT_NTERM 262
175 #define PERCENT_TYPE 263
176 #define PERCENT_UNION 264
177 #define PERCENT_LEFT 265
178 #define PERCENT_RIGHT 266
179 #define PERCENT_NONASSOC 267
180 #define PERCENT_EXPECT 268
181 #define PERCENT_START 269
182 #define PERCENT_PREC 270
183 #define PERCENT_VERBOSE 271
184 #define PERCENT_ERROR_VERBOSE 272
185 #define PERCENT_OUTPUT 273
186 #define PERCENT_FILE_PREFIX 274
187 #define PERCENT_NAME_PREFIX 275
188 #define PERCENT_DEFINE 276
189 #define PERCENT_PURE_PARSER 277
190 #define PERCENT_DEFINES 278
191 #define PERCENT_YACC 279
192 #define PERCENT_DEBUG 280
193 #define PERCENT_LOCATIONS 281
194 #define PERCENT_NO_LINES 282
195 #define PERCENT_SKELETON 283
196 #define PERCENT_TOKEN_TABLE 284
197 #define TYPE 285
198 #define EQUAL 286
199 #define SEMICOLON 287
200 #define COLON 288
201 #define PIPE 289
202 #define ID 290
203 #define PERCENT_PERCENT 291
204 #define PROLOGUE 292
205 #define EPILOGUE 293
206 #define BRACED_CODE 294
207
208
209
210
211 /* Enabling traces. */
212 #ifndef YYDEBUG
213 # define YYDEBUG 1
214 #endif
215
216 /* Enabling verbose error messages. */
217 #ifdef YYERROR_VERBOSE
218 # undef YYERROR_VERBOSE
219 # define YYERROR_VERBOSE 1
220 #else
221 # define YYERROR_VERBOSE 0
222 #endif
223
224 #ifndef YYSTYPE
225 #line 89 "parse-gram.y"
226 typedef union {
227 symbol_t *symbol;
228 int integer;
229 char *string;
230 associativity assoc;
231 } yystype;
232 /* Line 199 of /usr/local/share/bison/bison.simple. */
233 #line 234 "parse-gram.c"
234 # define YYSTYPE yystype
235 # define YYSTYPE_IS_TRIVIAL 1
236 #endif
237
238 #ifndef YYLTYPE
239 typedef struct yyltype
240 {
241 int first_line;
242 int first_column;
243 int last_line;
244 int last_column;
245 } yyltype;
246 # define YYLTYPE yyltype
247 # define YYLTYPE_IS_TRIVIAL 1
248 #endif
249
250 /* Copy the second part of user declarations. */
251
252
253 /* Line 219 of /usr/local/share/bison/bison.simple. */
254 #line 255 "parse-gram.c"
255
256 #if ! defined (yyoverflow) || YYERROR_VERBOSE
257
258 /* The parser invokes alloca or malloc; define the necessary symbols. */
259
260 # if YYSTACK_USE_ALLOCA
261 # define YYSTACK_ALLOC alloca
262 # else
263 # ifndef YYSTACK_USE_ALLOCA
264 # if defined (alloca) || defined (_ALLOCA_H)
265 # define YYSTACK_ALLOC alloca
266 # else
267 # ifdef __GNUC__
268 # define YYSTACK_ALLOC __builtin_alloca
269 # endif
270 # endif
271 # endif
272 # endif
273
274 # ifdef YYSTACK_ALLOC
275 /* Pacify GCC's `empty if-body' warning. */
276 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
277 # else
278 # if defined (__STDC__) || defined (__cplusplus)
279 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
280 # define YYSIZE_T size_t
281 # endif
282 # define YYSTACK_ALLOC malloc
283 # define YYSTACK_FREE free
284 # endif
285 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
286
287
288 #if (! defined (yyoverflow) \
289 && (! defined (__cplusplus) \
290 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
291
292 /* A type that is properly aligned for any stack member. */
293 union yyalloc
294 {
295 short yyss;
296 YYSTYPE yyvs;
297 # if YYLSP_NEEDED
298 YYLTYPE yyls;
299 # endif
300 };
301
302 /* The size of the maximum gap between one aligned stack and the next. */
303 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
304
305 /* The size of an array large to enough to hold all stacks, each with
306 N elements. */
307 # if YYLSP_NEEDED
308 # define YYSTACK_BYTES(N) \
309 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
310 + 2 * YYSTACK_GAP_MAX)
311 # else
312 # define YYSTACK_BYTES(N) \
313 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
314 + YYSTACK_GAP_MAX)
315 # endif
316
317 /* Copy COUNT objects from FROM to TO. The source and destination do
318 not overlap. */
319 # ifndef YYCOPY
320 # if 1 < __GNUC__
321 # define YYCOPY(To, From, Count) \
322 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
323 # else
324 # define YYCOPY(To, From, Count) \
325 do \
326 { \
327 register YYSIZE_T yyi; \
328 for (yyi = 0; yyi < (Count); yyi++) \
329 (To)[yyi] = (From)[yyi]; \
330 } \
331 while (0)
332 # endif
333 # endif
334
335 /* Relocate STACK from its old location to the new one. The
336 local variables YYSIZE and YYSTACKSIZE give the old and new number of
337 elements in the stack, and YYPTR gives the new location of the
338 stack. Advance YYPTR to a properly aligned location for the next
339 stack. */
340 # define YYSTACK_RELOCATE(Stack) \
341 do \
342 { \
343 YYSIZE_T yynewbytes; \
344 YYCOPY (&yyptr->Stack, Stack, yysize); \
345 Stack = &yyptr->Stack; \
346 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
347 yyptr += yynewbytes / sizeof (*yyptr); \
348 } \
349 while (0)
350
351 #endif
352
353 /* YYFINAL -- State number of the termination state. */
354 #define YYFINAL 3
355 #define YYFLAG -32768
356 #define YYLAST 102
357
358 /* YYNTOKENS -- Number of terminals. */
359 #define YYNTOKENS 40
360 /* YYNNTS -- Number of nonterminals. */
361 #define YYNNTS 29
362 /* YYNRULES -- Number of rules. */
363 #define YYNRULES 71
364 /* YYNRULES -- Number of states. */
365 #define YYNSTATES 97
366
367 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
368 #define YYUNDEFTOK 2
369 #define YYMAXUTOK 294
370
371 #define YYTRANSLATE(X) \
372 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
373
374 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
375 static const unsigned char yytranslate[] =
376 {
377 0, 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, 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, 1, 2, 3, 4,
403 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
404 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
405 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
406 35, 36, 37, 38, 39
407 };
408
409 #if YYDEBUG
410 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
411 YYRHS. */
412 static const unsigned char yyprhs[] =
413 {
414 0, 0, 3, 8, 9, 13, 15, 17, 19, 23,
415 25, 27, 30, 34, 36, 40, 42, 46, 48, 51,
416 53, 55, 57, 59, 61, 64, 67, 68, 72, 73,
417 77, 78, 83, 84, 89, 91, 93, 95, 96, 98,
418 100, 103, 105, 108, 110, 112, 115, 118, 122, 124,
419 127, 129, 132, 134, 137, 138, 144, 146, 150, 151,
420 154, 157, 161, 163, 165, 167, 169, 171, 173, 174,
421 177, 178
422 };
423
424 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
425 static const signed char yyrhs[] =
426 {
427 41, 0, -1, 42, 36, 57, 67, -1, -1, 42,
428 43, 68, -1, 44, -1, 37, -1, 25, -1, 21,
429 66, 66, -1, 23, -1, 17, -1, 13, 5, -1,
430 19, 31, 66, -1, 26, -1, 20, 31, 66, -1,
431 27, -1, 18, 31, 66, -1, 22, -1, 28, 66,
432 -1, 29, -1, 16, -1, 24, -1, 49, -1, 45,
433 -1, 14, 63, -1, 9, 39, -1, -1, 7, 46,
434 56, -1, -1, 6, 47, 56, -1, -1, 8, 30,
435 48, 53, -1, -1, 51, 52, 50, 54, -1, 10,
436 -1, 11, -1, 12, -1, -1, 30, -1, 35, -1,
437 53, 35, -1, 63, -1, 54, 63, -1, 30, -1,
438 35, -1, 35, 5, -1, 35, 65, -1, 35, 5,
439 65, -1, 55, -1, 56, 55, -1, 58, -1, 57,
440 58, -1, 59, -1, 44, 32, -1, -1, 35, 33,
441 60, 61, 32, -1, 62, -1, 61, 34, 62, -1,
442 -1, 62, 63, -1, 62, 64, -1, 62, 15, 63,
443 -1, 35, -1, 65, -1, 4, -1, 39, -1, 3,
444 -1, 3, -1, -1, 36, 38, -1, -1, 32, -1
445 };
446
447 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
448 static const unsigned short yyrline[] =
449 {
450 0, 150, 150, 163, 165, 168, 170, 171, 172, 173,
451 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
452 184, 185, 188, 190, 191, 195, 203, 203, 209, 209,
453 214, 214, 220, 220, 227, 229, 230, 233, 235, 239,
454 241, 245, 251, 259, 264, 269, 275, 281, 291, 294,
455 303, 305, 311, 313, 316, 316, 321, 323, 326, 329,
456 331, 333, 337, 339, 340, 343, 349, 358, 366, 371,
457 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", "@3",
476 "precedence_declaration", "@4", "precedence_declarator", "type.opt",
477 "nterms_to_type.1", "terms_to_prec.1", "symbol_def", "symbol_defs.1",
478 "grammar", "rules_or_grammar_declaration", "rules", "@5", "rhses.1",
479 "rhs", "symbol", "action", "string_as_id", "string_content",
480 "epilogue.opt", "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 48, 45, 50, 49, 51, 51, 51, 52, 52, 53,
502 53, 54, 54, 55, 55, 55, 55, 55, 56, 56,
503 57, 57, 58, 58, 60, 59, 61, 61, 62, 62,
504 62, 62, 63, 63, 63, 64, 65, 66, 67, 67,
505 68, 68
506 };
507
508 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
509 static const unsigned char yyr2[] =
510 {
511 0, 2, 4, 0, 3, 1, 1, 1, 3, 1,
512 1, 2, 3, 1, 3, 1, 3, 1, 2, 1,
513 1, 1, 1, 1, 2, 2, 0, 3, 0, 3,
514 0, 4, 0, 4, 1, 1, 1, 0, 1, 1,
515 2, 1, 2, 1, 1, 2, 2, 3, 1, 2,
516 1, 2, 1, 2, 0, 5, 1, 3, 0, 2,
517 2, 3, 1, 1, 1, 1, 1, 1, 0, 2,
518 0, 1
519 };
520
521 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
522 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
523 means the default is an error. */
524 static const short yydefact[] =
525 {
526 3, 0, 0, 0, 28, 26, 0, 0, 34, 35,
527 36, 0, 0, 20, 10, 0, 0, 0, 0, 17,
528 9, 21, 7, 13, 15, 0, 19, 0, 6, 70,
529 5, 23, 22, 37, 0, 0, 30, 25, 11, 66,
530 64, 62, 24, 63, 0, 0, 0, 67, 0, 18,
531 0, 0, 68, 50, 52, 71, 4, 38, 32, 43,
532 44, 48, 29, 27, 0, 16, 12, 14, 8, 54,
533 53, 0, 51, 2, 0, 45, 46, 49, 39, 31,
534 58, 69, 33, 41, 47, 40, 0, 56, 42, 55,
535 58, 0, 65, 59, 60, 57, 61
536 };
537
538 /* YYPGOTO[NTERM-NUM]. */
539 static const short yydefgoto[] =
540 {
541 -1, 1, 2, 29, 51, 31, 35, 34, 64, 32,
542 74, 33, 58, 79, 82, 61, 62, 52, 53, 54,
543 80, 86, 87, 93, 94, 43, 48, 73, 56
544 };
545
546 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
547 STATE-NUM. */
548 static const short yypact[] =
549 {
550 -32768, 9, 32,-32768,-32768,-32768, -13, -9,-32768,-32768,
551 -32768, 27, 0,-32768,-32768, 3, 5, 33, 60,-32768,
552 -32768,-32768,-32768,-32768,-32768, 60,-32768, 12,-32768, 34,
553 -32768,-32768,-32768, 35, -24, -24,-32768,-32768,-32768,-32768,
554 -32768,-32768,-32768,-32768, 60, 60, 60,-32768, 60,-32768,
555 38, 49, 66,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
556 2,-32768, -24, -24, 47,-32768,-32768,-32768,-32768,-32768,
557 -32768, 29,-32768,-32768, 0, 80,-32768,-32768,-32768, 50,
558 -32768,-32768, 0,-32768,-32768,-32768, -20, -2,-32768,-32768,
559 -32768, 0,-32768,-32768,-32768, -2,-32768
560 };
561
562 /* YYPGOTO[NTERM-NUM]. */
563 static const short yypgoto[] =
564 {
565 -32768,-32768,-32768,-32768, 82,-32768,-32768,-32768,-32768,-32768,
566 -32768,-32768,-32768,-32768,-32768, -47, 51,-32768, 36,-32768,
567 -32768,-32768, -3, -12,-32768, -50, -17,-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 42, 39, 40, 39, 40, 39, 59, 75, 49, 3,
576 76, 60, 89, 91, 90, 77, 77, 36, 4, 5,
577 6, 7, 8, 9, 10, 84, 12, 65, 66, 67,
578 37, 68, 38, 41, 44, 41, 45, 92, 4, 5,
579 6, 7, 8, 9, 10, 11, 12, 50, 13, 14,
580 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
581 25, 26, 83, 47, 46, 57, 55, 81, 27, 28,
582 88, 69, 4, 5, 6, 7, 8, 9, 10, 96,
583 12, 70, 78, 39, 30, 85, 63, 95, 72, 0,
584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
585 0, 50, 71
586 };
587
588 static const short yycheck[] =
589 {
590 12, 3, 4, 3, 4, 3, 30, 5, 25, 0,
591 60, 35, 32, 15, 34, 62, 63, 30, 6, 7,
592 8, 9, 10, 11, 12, 75, 14, 44, 45, 46,
593 39, 48, 5, 35, 31, 35, 31, 39, 6, 7,
594 8, 9, 10, 11, 12, 13, 14, 35, 16, 17,
595 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
596 28, 29, 74, 3, 31, 30, 32, 38, 36, 37,
597 82, 33, 6, 7, 8, 9, 10, 11, 12, 91,
598 14, 32, 35, 3, 2, 35, 35, 90, 52, -1,
599 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
600 -1, 35, 36
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, 49, 51, 47, 46, 30, 39, 5, 3,
612 4, 35, 63, 65, 31, 31, 31, 3, 66, 66,
613 35, 44, 57, 58, 59, 32, 68, 30, 52, 30,
614 35, 55, 56, 56, 48, 66, 66, 66, 66, 33,
615 32, 36, 58, 67, 50, 5, 65, 55, 35, 53,
616 60, 38, 54, 63, 65, 35, 61, 62, 63, 32,
617 34, 15, 39, 63, 64, 62, 63
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 152 "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 170 "parse-gram.y"
1196 { prologue_augment (yyvsp[0].string, yylsp[0]); }
1197 break;
1198
1199 case 7:
1200 #line 171 "parse-gram.y"
1201 { debug_flag = 1; }
1202 break;
1203
1204 case 8:
1205 #line 172 "parse-gram.y"
1206 { muscle_insert (yyvsp[-1].string, yyvsp[0].string); }
1207 break;
1208
1209 case 9:
1210 #line 173 "parse-gram.y"
1211 { defines_flag = 1; }
1212 break;
1213
1214 case 10:
1215 #line 174 "parse-gram.y"
1216 { error_verbose = 1; }
1217 break;
1218
1219 case 11:
1220 #line 175 "parse-gram.y"
1221 { expected_conflicts = yyvsp[0].integer; }
1222 break;
1223
1224 case 12:
1225 #line 176 "parse-gram.y"
1226 { spec_file_prefix = yyvsp[0].string; }
1227 break;
1228
1229 case 13:
1230 #line 177 "parse-gram.y"
1231 { locations_flag = 1; }
1232 break;
1233
1234 case 14:
1235 #line 178 "parse-gram.y"
1236 { spec_name_prefix = yyvsp[0].string; }
1237 break;
1238
1239 case 15:
1240 #line 179 "parse-gram.y"
1241 { no_lines_flag = 1; }
1242 break;
1243
1244 case 16:
1245 #line 180 "parse-gram.y"
1246 { spec_outfile = yyvsp[0].string; }
1247 break;
1248
1249 case 17:
1250 #line 181 "parse-gram.y"
1251 { pure_parser = 1; }
1252 break;
1253
1254 case 18:
1255 #line 182 "parse-gram.y"
1256 { skeleton = yyvsp[0].string; }
1257 break;
1258
1259 case 19:
1260 #line 183 "parse-gram.y"
1261 { token_table_flag = 1; }
1262 break;
1263
1264 case 20:
1265 #line 184 "parse-gram.y"
1266 { report_flag = 1; }
1267 break;
1268
1269 case 21:
1270 #line 185 "parse-gram.y"
1271 { yacc_flag = 1; }
1272 break;
1273
1274 case 24:
1275 #line 192 "parse-gram.y"
1276 {
1277 grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]);
1278 }
1279 break;
1280
1281 case 25:
1282 #line 196 "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 204 "parse-gram.y"
1292 { current_class = nterm_sym; }
1293 break;
1294
1295 case 27:
1296 #line 205 "parse-gram.y"
1297 {
1298 current_class = unknown_sym;
1299 current_type = NULL;
1300 }
1301 break;
1302
1303 case 28:
1304 #line 209 "parse-gram.y"
1305 { current_class = token_sym; }
1306 break;
1307
1308 case 29:
1309 #line 210 "parse-gram.y"
1310 {
1311 current_class = unknown_sym;
1312 current_type = NULL;
1313 }
1314 break;
1315
1316 case 30:
1317 #line 214 "parse-gram.y"
1318 {current_type = yyvsp[0].string; }
1319 break;
1320
1321 case 31:
1322 #line 215 "parse-gram.y"
1323 {
1324 current_type = NULL;
1325 }
1326 break;
1327
1328 case 32:
1329 #line 222 "parse-gram.y"
1330 { current_assoc = yyvsp[-1].assoc; ++current_prec; }
1331 break;
1332
1333 case 33:
1334 #line 224 "parse-gram.y"
1335 { current_assoc = non_assoc; current_type = NULL; }
1336 break;
1337
1338 case 34:
1339 #line 228 "parse-gram.y"
1340 { yyval.assoc = left_assoc; }
1341 break;
1342
1343 case 35:
1344 #line 229 "parse-gram.y"
1345 { yyval.assoc = right_assoc; }
1346 break;
1347
1348 case 36:
1349 #line 230 "parse-gram.y"
1350 { yyval.assoc = non_assoc; }
1351 break;
1352
1353 case 37:
1354 #line 234 "parse-gram.y"
1355 { current_type = NULL;}
1356 break;
1357
1358 case 38:
1359 #line 235 "parse-gram.y"
1360 { current_type = yyvsp[0].string; }
1361 break;
1362
1363 case 39:
1364 #line 240 "parse-gram.y"
1365 { symbol_type_set (yyvsp[0].symbol, current_type); }
1366 break;
1367
1368 case 40:
1369 #line 241 "parse-gram.y"
1370 { symbol_type_set (yyvsp[0].symbol, current_type); }
1371 break;
1372
1373 case 41:
1374 #line 247 "parse-gram.y"
1375 {
1376 symbol_type_set (yyvsp[0].symbol, current_type);
1377 symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
1378 }
1379 break;
1380
1381 case 42:
1382 #line 252 "parse-gram.y"
1383 {
1384 symbol_type_set (yyvsp[0].symbol, current_type);
1385 symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
1386 }
1387 break;
1388
1389 case 43:
1390 #line 261 "parse-gram.y"
1391 {
1392 current_type = yyvsp[0].string;
1393 }
1394 break;
1395
1396 case 44:
1397 #line 265 "parse-gram.y"
1398 {
1399 symbol_class_set (yyvsp[0].symbol, current_class);
1400 symbol_type_set (yyvsp[0].symbol, current_type);
1401 }
1402 break;
1403
1404 case 45:
1405 #line 270 "parse-gram.y"
1406 {
1407 symbol_class_set (yyvsp[-1].symbol, current_class);
1408 symbol_type_set (yyvsp[-1].symbol, current_type);
1409 symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer);
1410 }
1411 break;
1412
1413 case 46:
1414 #line 276 "parse-gram.y"
1415 {
1416 symbol_class_set (yyvsp[-1].symbol, current_class);
1417 symbol_type_set (yyvsp[-1].symbol, current_type);
1418 symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol);
1419 }
1420 break;
1421
1422 case 47:
1423 #line 282 "parse-gram.y"
1424 {
1425 symbol_class_set (yyvsp[-2].symbol, current_class);
1426 symbol_type_set (yyvsp[-2].symbol, current_type);
1427 symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer);
1428 symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol);
1429 }
1430 break;
1431
1432 case 48:
1433 #line 293 "parse-gram.y"
1434 {;}
1435 break;
1436
1437 case 49:
1438 #line 295 "parse-gram.y"
1439 {;}
1440 break;
1441
1442 case 54:
1443 #line 317 "parse-gram.y"
1444 { current_lhs = yyvsp[-1].symbol; current_lhs_location = yylsp[-1]; }
1445 break;
1446
1447 case 55:
1448 #line 318 "parse-gram.y"
1449 {;}
1450 break;
1451
1452 case 56:
1453 #line 322 "parse-gram.y"
1454 { grammar_rule_end (yylsp[0]); }
1455 break;
1456
1457 case 57:
1458 #line 323 "parse-gram.y"
1459 { grammar_rule_end (yylsp[0]); }
1460 break;
1461
1462 case 58:
1463 #line 328 "parse-gram.y"
1464 { grammar_rule_begin (current_lhs, current_lhs_location); }
1465 break;
1466
1467 case 59:
1468 #line 330 "parse-gram.y"
1469 { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); }
1470 break;
1471
1472 case 60:
1473 #line 332 "parse-gram.y"
1474 { grammar_current_rule_action_append (yyvsp[0].string, yylsp[0]); }
1475 break;
1476
1477 case 61:
1478 #line 334 "parse-gram.y"
1479 { grammar_current_rule_prec_set (yyvsp[0].symbol); }
1480 break;
1481
1482 case 62:
1483 #line 338 "parse-gram.y"
1484 { yyval.symbol = yyvsp[0].symbol; }
1485 break;
1486
1487 case 63:
1488 #line 339 "parse-gram.y"
1489 { yyval.symbol = yyvsp[0].symbol; }
1490 break;
1491
1492 case 64:
1493 #line 340 "parse-gram.y"
1494 { yyval.symbol = getsym (yyvsp[0].string, yylsp[0]); }
1495 break;
1496
1497 case 65:
1498 #line 345 "parse-gram.y"
1499 { yyval.string = yyvsp[0].string; }
1500 break;
1501
1502 case 66:
1503 #line 351 "parse-gram.y"
1504 {
1505 yyval.symbol = getsym (yyvsp[0].string, yylsp[0]);
1506 symbol_class_set (yyval.symbol, token_sym);
1507 }
1508 break;
1509
1510 case 67:
1511 #line 360 "parse-gram.y"
1512 {
1513 yyval.string = yyvsp[0].string + 1;
1514 yyval.string[strlen (yyval.string) - 1] = '\0';
1515 }
1516 break;
1517
1518 case 68:
1519 #line 368 "parse-gram.y"
1520 {
1521 yyval.string = xstrdup ("");
1522 }
1523 break;
1524
1525 case 69:
1526 #line 372 "parse-gram.y"
1527 {
1528 yyval.string = yyvsp[0].string;
1529 }
1530 break;
1531
1532
1533 }
1534
1535 /* Line 1012 of /usr/local/share/bison/bison.simple. */
1536 #line 1537 "parse-gram.c"
1537 \f
1538 yyvsp -= yylen;
1539 yyssp -= yylen;
1540 #if YYLSP_NEEDED
1541 yylsp -= yylen;
1542 #endif
1543
1544 #if YYDEBUG
1545 if (yydebug)
1546 {
1547 short *yyssp1 = yyss - 1;
1548 YYFPRINTF (stderr, "state stack now");
1549 while (yyssp1 != yyssp)
1550 YYFPRINTF (stderr, " %d", *++yyssp1);
1551 YYFPRINTF (stderr, "\n");
1552 }
1553 #endif
1554
1555 *++yyvsp = yyval;
1556 #if YYLSP_NEEDED
1557 *++yylsp = yyloc;
1558 #endif
1559
1560 /* Now `shift' the result of the reduction. Determine what state
1561 that goes to, based on the state we popped back to and the rule
1562 number reduced by. */
1563
1564 yyn = yyr1[yyn];
1565
1566 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1567 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1568 yystate = yytable[yystate];
1569 else
1570 yystate = yydefgoto[yyn - YYNTOKENS];
1571
1572 goto yynewstate;
1573
1574
1575 /*------------------------------------.
1576 | yyerrlab -- here on detecting error |
1577 `------------------------------------*/
1578 yyerrlab:
1579 /* If not already recovering from an error, report this error. */
1580 if (!yyerrstatus)
1581 {
1582 ++yynerrs;
1583
1584 #if YYERROR_VERBOSE
1585 yyn = yypact[yystate];
1586
1587 if (yyn > YYFLAG && yyn < YYLAST)
1588 {
1589 YYSIZE_T yysize = 0;
1590 char *yymsg;
1591 int yyx, yycount;
1592
1593 yycount = 0;
1594 /* Start YYX at -YYN if negative to avoid negative indexes in
1595 YYCHECK. */
1596 for (yyx = yyn < 0 ? -yyn : 0;
1597 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1598 if (yycheck[yyx + yyn] == yyx)
1599 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1600 yysize += yystrlen ("parse error, unexpected ") + 1;
1601 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1602 yymsg = (char *) YYSTACK_ALLOC (yysize);
1603 if (yymsg != 0)
1604 {
1605 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1606 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1607
1608 if (yycount < 5)
1609 {
1610 yycount = 0;
1611 for (yyx = yyn < 0 ? -yyn : 0;
1612 yyx < (int) (sizeof (yytname) / sizeof (char *));
1613 yyx++)
1614 if (yycheck[yyx + yyn] == yyx)
1615 {
1616 const char *yyq = ! yycount ? ", expecting " : " or ";
1617 yyp = yystpcpy (yyp, yyq);
1618 yyp = yystpcpy (yyp, yytname[yyx]);
1619 yycount++;
1620 }
1621 }
1622 yyerror (yymsg);
1623 YYSTACK_FREE (yymsg);
1624 }
1625 else
1626 yyerror ("parse error; also virtual memory exhausted");
1627 }
1628 else
1629 #endif /* YYERROR_VERBOSE */
1630 yyerror ("parse error");
1631 }
1632 goto yyerrlab1;
1633
1634
1635 /*----------------------------------------------------.
1636 | yyerrlab1 -- error raised explicitly by an action. |
1637 `----------------------------------------------------*/
1638 yyerrlab1:
1639 if (yyerrstatus == 3)
1640 {
1641 /* If just tried and failed to reuse lookahead token after an
1642 error, discard it. */
1643
1644 /* Return failure if at end of input. */
1645 if (yychar == YYEOF)
1646 YYABORT;
1647 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1648 yychar, yytname[yychar1]));
1649 yychar = YYEMPTY;
1650 }
1651
1652 /* Else will try to reuse lookahead token after shifting the error
1653 token. */
1654
1655 yyerrstatus = 3; /* Each real token shifted decrements this. */
1656
1657 for (;;)
1658 {
1659 yyn = yypact[yystate];
1660 if (yyn != YYFLAG)
1661 {
1662 yyn += YYTERROR;
1663 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1664 {
1665 yyn = yytable[yyn];
1666 if (0 < yyn)
1667 break;
1668 }
1669 }
1670
1671 /* Pop the current state because it cannot handle the error token. */
1672 if (yyssp == yyss)
1673 YYABORT;
1674
1675 #if YYDEBUG
1676 if (yydebug)
1677 {
1678 if (yystos[yystate] < YYNTOKENS)
1679 {
1680 YYFPRINTF (stderr, "Error: popping token %d (%s",
1681 yytoknum[yystos[yystate]], yytname[yystos[yystate]]);
1682 # ifdef YYPRINT
1683 YYPRINT (stderr, yytoknum[yystos[yystate]], *yyvsp);
1684 # endif
1685 YYFPRINTF (stderr, ")\n");
1686 }
1687 else
1688 {
1689 YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n",
1690 yytname[yystos[yystate]]);
1691 }
1692 }
1693 #endif
1694
1695 yyvsp--;
1696 yystate = *--yyssp;
1697 #if YYLSP_NEEDED
1698 yylsp--;
1699 #endif
1700
1701 #if YYDEBUG
1702 if (yydebug)
1703 {
1704 short *yyssp1 = yyss - 1;
1705 YYFPRINTF (stderr, "Error: state stack now");
1706 while (yyssp1 != yyssp)
1707 YYFPRINTF (stderr, " %d", *++yyssp1);
1708 YYFPRINTF (stderr, "\n");
1709 }
1710 #endif
1711 }
1712
1713 if (yyn == YYFINAL)
1714 YYACCEPT;
1715
1716 YYDPRINTF ((stderr, "Shifting error token, "));
1717
1718 *++yyvsp = yylval;
1719 #if YYLSP_NEEDED
1720 *++yylsp = yylloc;
1721 #endif
1722
1723 yystate = yyn;
1724 goto yynewstate;
1725
1726
1727 /*-------------------------------------.
1728 | yyacceptlab -- YYACCEPT comes here. |
1729 `-------------------------------------*/
1730 yyacceptlab:
1731 yyresult = 0;
1732 goto yyreturn;
1733
1734 /*-----------------------------------.
1735 | yyabortlab -- YYABORT comes here. |
1736 `-----------------------------------*/
1737 yyabortlab:
1738 yyresult = 1;
1739 goto yyreturn;
1740
1741 /*---------------------------------------------.
1742 | yyoverflowab -- parser overflow comes here. |
1743 `---------------------------------------------*/
1744 yyoverflowlab:
1745 yyerror ("parser stack overflow");
1746 yyresult = 2;
1747 /* Fall through. */
1748
1749 yyreturn:
1750 #ifndef yyoverflow
1751 if (yyss != yyssa)
1752 YYSTACK_FREE (yyss);
1753 #endif
1754 return yyresult;
1755 }
1756
1757 #line 381 "parse-gram.y"
1758
1759 /*------------------------------------------------------------------.
1760 | When debugging the parser, display tokens' locations and values. |
1761 `------------------------------------------------------------------*/
1762
1763 static void
1764 yyprint (FILE *file,
1765 const location_t *loc, int type, const yystype *value)
1766 {
1767 fputs (" (", file);
1768 LOCATION_PRINT (file, *loc);
1769 fputs (")", file);
1770 switch (type)
1771 {
1772 case CHARACTER:
1773 fprintf (file, " = '%s'", value->string);
1774 break;
1775
1776 case ID:
1777 fprintf (file, " = %s", value->symbol->tag);
1778 break;
1779
1780 case INT:
1781 fprintf (file, " = %d", value->integer);
1782 break;
1783
1784 case STRING:
1785 fprintf (file, " = \"%s\"", value->string);
1786 break;
1787
1788 case TYPE:
1789 fprintf (file, " = <%s>", value->string);
1790 break;
1791
1792 case BRACED_CODE:
1793 case PROLOGUE:
1794 case EPILOGUE:
1795 fprintf (file, " = {{ %s }}", value->string);
1796 break;
1797 }
1798 }
1799
1800 void
1801 gram_error (gram_control_t *control ATTRIBUTE_UNUSED,
1802 location_t *yylloc, const char *msg)
1803 {
1804 LOCATION_PRINT (stderr, *yylloc);
1805 fprintf (stderr, ": %s\n", msg);
1806 }
1807