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