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