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