1 /* A Bison parser, made from parse-gram.y
4 /* Skeleton output parser for Bison,
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
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)
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.
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. */
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. */
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. */
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. */
40 /* Identify Bison output. */
46 /* Using locations. */
47 #define YYLSP_NEEDED 1
49 /* If NAME_PREFIX is specified substitute the variables and functions
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
60 /* Copy the first part of user declarations. */
61 #line 31 "parse-gram.y"
64 #include "muscle_tab.h"
71 #include "conflicts.h"
73 /* Produce verbose parse errors. */
74 #define YYERROR_VERBOSE 1
75 #define YYLLOC_DEFAULT(Current, Rhs, N) \
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; \
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)
97 /* Request detailed parse error messages, and pass them to
100 #define yyerror(Msg) \
101 gram_error (yycontrol, &yylloc, Msg)
103 #define YYPRINT(File, Type, Value) \
104 yyprint (File, Type, &Value)
105 static void yyprint (FILE *file
, int type
, const yystype
*value
);
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
;
118 # if defined (__STDC__) || defined (__cplusplus)
119 /* Put the tokens into the symbol table, so that GDB and other debuggers
129 PERCENT_DESTRUCTOR
= 264,
130 PERCENT_PRINTER
= 265,
134 PERCENT_NONASSOC
= 269,
135 PERCENT_EXPECT
= 270,
140 PERCENT_VERBOSE
= 275,
141 PERCENT_ERROR_VERBOSE
= 276,
142 PERCENT_OUTPUT
= 277,
143 PERCENT_FILE_PREFIX
= 278,
144 PERCENT_NAME_PREFIX
= 279,
145 PERCENT_DEFINE
= 280,
146 PERCENT_PURE_PARSER
= 281,
147 PERCENT_GLR_PARSER
= 282,
148 PERCENT_DEFINES
= 283,
151 PERCENT_LOCATIONS
= 286,
152 PERCENT_NO_LINES
= 287,
153 PERCENT_SKELETON
= 288,
154 PERCENT_TOKEN_TABLE
= 289,
161 PERCENT_PERCENT
= 296,
167 /* POSIX requires `int' for tokens in interfaces. */
168 # define YYTOKENTYPE int
169 #endif /* !YYTOKENTYPE */
172 #define CHARACTER 259
174 #define PERCENT_TOKEN 261
175 #define PERCENT_NTERM 262
176 #define PERCENT_TYPE 263
177 #define PERCENT_DESTRUCTOR 264
178 #define PERCENT_PRINTER 265
179 #define PERCENT_UNION 266
180 #define PERCENT_LEFT 267
181 #define PERCENT_RIGHT 268
182 #define PERCENT_NONASSOC 269
183 #define PERCENT_EXPECT 270
184 #define PERCENT_START 271
185 #define PERCENT_PREC 272
186 #define PERCENT_DPREC 273
187 #define PERCENT_MERGE 274
188 #define PERCENT_VERBOSE 275
189 #define PERCENT_ERROR_VERBOSE 276
190 #define PERCENT_OUTPUT 277
191 #define PERCENT_FILE_PREFIX 278
192 #define PERCENT_NAME_PREFIX 279
193 #define PERCENT_DEFINE 280
194 #define PERCENT_PURE_PARSER 281
195 #define PERCENT_GLR_PARSER 282
196 #define PERCENT_DEFINES 283
197 #define PERCENT_YACC 284
198 #define PERCENT_DEBUG 285
199 #define PERCENT_LOCATIONS 286
200 #define PERCENT_NO_LINES 287
201 #define PERCENT_SKELETON 288
202 #define PERCENT_TOKEN_TABLE 289
205 #define SEMICOLON 292
209 #define PERCENT_PERCENT 296
212 #define BRACED_CODE 299
217 /* Enabling traces. */
222 /* Enabling verbose error messages. */
223 #ifdef YYERROR_VERBOSE
224 # undef YYERROR_VERBOSE
225 # define YYERROR_VERBOSE 1
227 # define YYERROR_VERBOSE 0
231 #line 88 "parse-gram.y"
239 /* Line 272 of /home/cs/hilfingr/work/grammars/glr2/install/share/bison/yacc.c. */
240 #line 241 "parse-gram.c"
241 # define YYSTYPE yystype
242 # define YYSTYPE_IS_TRIVIAL 1
246 typedef struct yyltype
253 # define YYLTYPE yyltype
254 # define YYLTYPE_IS_TRIVIAL 1
257 /* Copy the second part of user declarations. */
260 /* Line 292 of /home/cs/hilfingr/work/grammars/glr2/install/share/bison/yacc.c. */
261 #line 262 "parse-gram.c"
263 #if ! defined (yyoverflow) || YYERROR_VERBOSE
265 /* The parser invokes alloca or malloc; define the necessary symbols. */
267 # if YYSTACK_USE_ALLOCA
268 # define YYSTACK_ALLOC alloca
270 # ifndef YYSTACK_USE_ALLOCA
271 # if defined (alloca) || defined (_ALLOCA_H)
272 # define YYSTACK_ALLOC alloca
275 # define YYSTACK_ALLOC __builtin_alloca
281 # ifdef YYSTACK_ALLOC
282 /* Pacify GCC's `empty if-body' warning. */
283 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
285 # if defined (__STDC__) || defined (__cplusplus)
286 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
287 # define YYSIZE_T size_t
289 # define YYSTACK_ALLOC malloc
290 # define YYSTACK_FREE free
292 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
295 #if (! defined (yyoverflow) \
296 && (! defined (__cplusplus) \
297 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
299 /* A type that is properly aligned for any stack member. */
307 /* The size of the maximum gap between one aligned stack and the next. */
308 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
310 /* The size of an array large to enough to hold all stacks, each with
312 # define YYSTACK_BYTES(N) \
313 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
314 + 2 * YYSTACK_GAP_MAX)
316 /* Copy COUNT objects from FROM to TO. The source and destination do
320 # define YYCOPY(To, From, Count) \
321 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
323 # define YYCOPY(To, From, Count) \
326 register YYSIZE_T yyi; \
327 for (yyi = 0; yyi < (Count); yyi++) \
328 (To)[yyi] = (From)[yyi]; \
334 /* Relocate STACK from its old location to the new one. The
335 local variables YYSIZE and YYSTACKSIZE give the old and new number of
336 elements in the stack, and YYPTR gives the new location of the
337 stack. Advance YYPTR to a properly aligned location for the next
339 # define YYSTACK_RELOCATE(Stack) \
342 YYSIZE_T yynewbytes; \
343 YYCOPY (&yyptr->Stack, Stack, yysize); \
344 Stack = &yyptr->Stack; \
345 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
346 yyptr += yynewbytes / sizeof (*yyptr); \
352 /* YYFINAL -- State number of the termination state. */
354 #define YYFLAG -32768
357 /* YYNTOKENS -- Number of terminals. */
359 /* YYNNTS -- Number of nonterminals. */
361 /* YYNRULES -- Number of rules. */
363 /* YYNRULES -- Number of states. */
364 #define YYNSTATES 106
366 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
368 #define YYMAXUTOK 299
370 #define YYTRANSLATE(X) \
371 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
373 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
374 static const unsigned char yytranslate
[] =
376 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
402 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
403 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
404 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
405 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
409 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
411 static const unsigned char yyprhs
[] =
413 0, 0, 3, 8, 9, 13, 15, 17, 19, 23,
414 25, 27, 30, 34, 36, 40, 42, 46, 48, 50,
415 53, 55, 57, 59, 61, 63, 66, 69, 70, 75,
416 76, 81, 82, 86, 87, 91, 95, 99, 101, 103,
417 105, 106, 108, 110, 113, 115, 117, 120, 123, 127,
418 129, 132, 134, 137, 139, 142, 143, 149, 151, 155,
419 156, 159, 162, 166, 170, 174, 176, 178, 180, 182,
420 184, 186, 187, 190, 191
423 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
424 static const signed char yyrhs
[] =
426 46, 0, -1, 47, 41, 61, 71, -1, -1, 47,
427 48, 72, -1, 49, -1, 42, -1, 30, -1, 25,
428 70, 70, -1, 28, -1, 21, -1, 15, 5, -1,
429 23, 36, 70, -1, 31, -1, 24, 36, 70, -1,
430 32, -1, 22, 36, 70, -1, 26, -1, 27, -1,
431 33, 70, -1, 34, -1, 20, -1, 29, -1, 55,
432 -1, 52, -1, 16, 67, -1, 11, 44, -1, -1,
433 9, 50, 44, 58, -1, -1, 10, 51, 44, 58,
434 -1, -1, 7, 53, 60, -1, -1, 6, 54, 60,
435 -1, 8, 35, 58, -1, 56, 57, 58, -1, 12,
436 -1, 13, -1, 14, -1, -1, 35, -1, 67, -1,
437 58, 67, -1, 35, -1, 40, -1, 40, 5, -1,
438 40, 69, -1, 40, 5, 69, -1, 59, -1, 60,
439 59, -1, 62, -1, 61, 62, -1, 63, -1, 49,
440 37, -1, -1, 40, 38, 64, 65, 37, -1, 66,
441 -1, 65, 39, 66, -1, -1, 66, 67, -1, 66,
442 68, -1, 66, 17, 67, -1, 66, 18, 5, -1,
443 66, 19, 35, -1, 40, -1, 69, -1, 4, -1,
444 44, -1, 3, -1, 3, -1, -1, 41, 43, -1,
448 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
449 static const unsigned short yyrline
[] =
451 0, 158, 158, 171, 173, 176, 178, 179, 180, 181,
452 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
453 192, 193, 194, 197, 199, 200, 204, 211, 210, 221,
454 220, 233, 232, 238, 238, 243, 252, 267, 269, 270,
455 273, 275, 280, 282, 286, 291, 296, 302, 308, 318,
456 321, 330, 332, 338, 340, 344, 343, 348, 350, 353,
457 356, 358, 360, 362, 364, 368, 370, 371, 374, 380,
458 389, 397, 402, 408, 410
462 #if YYDEBUG || YYERROR_VERBOSE
463 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
464 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
465 static const char *const yytname
[] =
467 "\"end of string\"", "error", "$undefined.", "STRING", "CHARACTER", "INT",
468 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor\"",
469 "\"%printer\"", "\"%union\"", "\"%left\"", "\"%right\"",
470 "\"%nonassoc\"", "\"%expect\"", "\"%start\"", "\"%prec\"", "\"%dprec\"",
471 "\"%merge\"", "\"%verbose\"", "\"%error-verbose\"", "\"%output\"",
472 "\"%file-prefix\"", "\"%name-prefix\"", "\"%define\"",
473 "\"%pure-parser\"", "\"%glr-parser\"", "\"%defines\"", "\"%yacc\"",
474 "\"%debug\"", "\"%locations\"", "\"%no-lines\"", "\"%skeleton\"",
475 "\"%token-table\"", "TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"",
476 "\"identifier\"", "\"%%\"", "PROLOGUE", "EPILOGUE", "BRACED_CODE",
477 "$axiom", "input", "declarations", "declaration", "grammar_declaration",
478 "@1", "@2", "symbol_declaration", "@3", "@4", "precedence_declaration",
479 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
480 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
481 "@5", "rhses.1", "rhs", "symbol", "action", "string_as_id",
482 "string_content", "epilogue.opt", "semi_colon.opt", 0
486 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
488 static const short yytoknum
[] =
490 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
491 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
492 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
493 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
494 295, 296, 297, 298, 299, -1
497 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
498 static const unsigned char yyr1
[] =
500 0, 45, 46, 47, 47, 48, 48, 48, 48, 48,
501 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
502 48, 48, 48, 49, 49, 49, 49, 50, 49, 51,
503 49, 53, 52, 54, 52, 52, 55, 56, 56, 56,
504 57, 57, 58, 58, 59, 59, 59, 59, 59, 60,
505 60, 61, 61, 62, 62, 64, 63, 65, 65, 66,
506 66, 66, 66, 66, 66, 67, 67, 67, 68, 69,
510 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
511 static const unsigned char yyr2
[] =
513 0, 2, 4, 0, 3, 1, 1, 1, 3, 1,
514 1, 2, 3, 1, 3, 1, 3, 1, 1, 2,
515 1, 1, 1, 1, 1, 2, 2, 0, 4, 0,
516 4, 0, 3, 0, 3, 3, 3, 1, 1, 1,
517 0, 1, 1, 2, 1, 1, 2, 2, 3, 1,
518 2, 1, 2, 1, 2, 0, 5, 1, 3, 0,
519 2, 2, 3, 3, 3, 1, 1, 1, 1, 1,
523 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
524 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
525 means the default is an error. */
526 static const short yydefact
[] =
528 3, 0, 0, 0, 33, 31, 0, 27, 29, 0,
529 37, 38, 39, 0, 0, 21, 10, 0, 0, 0,
530 0, 17, 18, 9, 22, 7, 13, 15, 0, 20,
531 0, 6, 73, 5, 24, 23, 40, 0, 0, 0,
532 0, 0, 26, 11, 69, 67, 65, 25, 66, 0,
533 0, 0, 70, 0, 19, 0, 0, 71, 51, 53,
534 74, 4, 41, 0, 44, 45, 49, 34, 32, 35,
535 42, 0, 0, 16, 12, 14, 8, 55, 54, 0,
536 52, 2, 36, 46, 47, 50, 43, 28, 30, 59,
537 72, 48, 0, 57, 56, 59, 0, 0, 0, 68,
538 60, 61, 58, 62, 63, 64
541 /* YYPGOTO[NTERM-NUM]. */
542 static const short yydefgoto
[] =
544 -1, 1, 2, 32, 56, 40, 41, 34, 38, 37,
545 35, 36, 63, 69, 66, 67, 57, 58, 59, 89,
546 92, 93, 70, 101, 48, 53, 81, 61
549 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
551 static const short yypact
[] =
553 -32768, 7, 83,-32768,-32768,-32768, -23,-32768,-32768, 3,
554 -32768,-32768,-32768, 43, 0,-32768,-32768, 13, 14, 15,
555 51,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 51,-32768,
556 23,-32768, 19,-32768,-32768,-32768, 22, -29, -29, 0,
557 17, 18,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 51,
558 51, 51,-32768, 51,-32768, 20, 27, 12,-32768,-32768,
559 -32768,-32768,-32768, 0,-32768, 5,-32768, -29, -29, 0,
560 -32768, 0, 0,-32768,-32768,-32768,-32768,-32768,-32768, 28,
561 -32768,-32768, 0, 56,-32768,-32768,-32768, 0, 0,-32768,
562 -32768,-32768, 4, -2,-32768,-32768, 0, 55, 35,-32768,
563 -32768,-32768, -2,-32768,-32768,-32768
566 /* YYPGOTO[NTERM-NUM]. */
567 static const short yypgoto
[] =
569 -32768,-32768,-32768,-32768, 70,-32768,-32768,-32768,-32768,-32768,
570 -32768,-32768,-32768, -58, -22, 37,-32768, 21,-32768,-32768,
571 -32768, -19, -14,-32768, -56, 16,-32768,-32768
574 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
575 positive, shift that token. If negative, reduce the rule which
576 number is the opposite. If zero, do what YYDEFACT says. */
577 static const short yytable
[] =
579 47, 44, 45, 44, 45, 82, 64, 3, 44, 84,
580 83, 65, 39, 87, 88, 96, 97, 98, 4, 5,
581 6, 7, 8, 9, 10, 11, 12, 91, 14, 4,
582 5, 6, 7, 8, 9, 10, 11, 12, 46, 14,
583 46, 94, 99, 95, 54, 85, 85, 42, 43, 49,
584 50, 51, 55, 79, 52, 86, 60, 62, 77, 44,
585 104, 71, 72, 55, 78, 73, 74, 75, 86, 76,
586 105, 90, 33, 86, 86, 68, 102, 0, 80, 100,
587 0, 0, 103, 0, 0, 0, 0, 0, 100, 4,
588 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
589 0, 0, 0, 15, 16, 17, 18, 19, 20, 21,
590 22, 23, 24, 25, 26, 27, 28, 29, 0, 0,
594 static const short yycheck
[] =
596 14, 3, 4, 3, 4, 63, 35, 0, 3, 65,
597 5, 40, 35, 71, 72, 17, 18, 19, 6, 7,
598 8, 9, 10, 11, 12, 13, 14, 83, 16, 6,
599 7, 8, 9, 10, 11, 12, 13, 14, 40, 16,
600 40, 37, 44, 39, 28, 67, 68, 44, 5, 36,
601 36, 36, 40, 41, 3, 69, 37, 35, 38, 3,
602 5, 44, 44, 40, 37, 49, 50, 51, 82, 53,
603 35, 43, 2, 87, 88, 38, 95, -1, 57, 93,
604 -1, -1, 96, -1, -1, -1, -1, -1, 102, 6,
605 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
606 -1, -1, -1, 20, 21, 22, 23, 24, 25, 26,
607 27, 28, 29, 30, 31, 32, 33, 34, -1, -1,
608 -1, -1, -1, -1, 41, 42
611 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
612 symbol of state STATE-NUM. */
613 static const unsigned char yystos
[] =
615 0, 46, 47, 0, 6, 7, 8, 9, 10, 11,
616 12, 13, 14, 15, 16, 20, 21, 22, 23, 24,
617 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
618 41, 42, 48, 49, 52, 55, 56, 54, 53, 35,
619 50, 51, 44, 5, 3, 4, 40, 67, 69, 36,
620 36, 36, 3, 70, 70, 40, 49, 61, 62, 63,
621 37, 72, 35, 57, 35, 40, 59, 60, 60, 58,
622 67, 44, 44, 70, 70, 70, 70, 38, 37, 41,
623 62, 71, 58, 5, 69, 59, 67, 58, 58, 64,
624 43, 69, 65, 66, 37, 39, 17, 18, 19, 44,
625 67, 68, 66, 67, 5, 35
628 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
629 # define YYSIZE_T __SIZE_TYPE__
631 #if ! defined (YYSIZE_T) && defined (size_t)
632 # define YYSIZE_T size_t
634 #if ! defined (YYSIZE_T)
635 # if defined (__STDC__) || defined (__cplusplus)
636 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
637 # define YYSIZE_T size_t
640 #if ! defined (YYSIZE_T)
641 # define YYSIZE_T unsigned int
644 #define yyerrok (yyerrstatus = 0)
645 #define yyclearin (yychar = YYEMPTY)
649 #define YYACCEPT goto yyacceptlab
650 #define YYABORT goto yyabortlab
651 #define YYERROR goto yyerrlab1
653 /* Like YYERROR except do call yyerror. This remains here temporarily
654 to ease the transition to the new meaning of YYERROR, for GCC.
655 Once GCC version 2 has supplanted version 1, this can go. */
657 #define YYFAIL goto yyerrlab
659 #define YYRECOVERING() (!!yyerrstatus)
661 #define YYBACKUP(Token, Value) \
663 if (yychar == YYEMPTY && yylen == 1) \
667 yychar1 = YYTRANSLATE (yychar); \
673 yyerror ("syntax error: cannot back up"); \
679 #define YYERRCODE 256
681 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
684 #ifndef YYLLOC_DEFAULT
685 # define YYLLOC_DEFAULT(Current, Rhs, N) \
686 Current.first_line = Rhs[1].first_line; \
687 Current.first_column = Rhs[1].first_column; \
688 Current.last_line = Rhs[N].last_line; \
689 Current.last_column = Rhs[N].last_column;
692 /* YYLEX -- calling `yylex' with the right arguments. */
695 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
697 # define YYLEX yylex (&yylval, &yylloc)
700 /* Enable debugging if requested. */
704 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
705 # define YYFPRINTF fprintf
708 # define YYDPRINTF(Args) \
713 # define YYDSYMPRINT(Args) \
718 /* Nonzero means print parse trace. It is left uninitialized so that
719 multiple parsers can coexist. */
722 # define YYDPRINTF(Args)
723 # define YYDSYMPRINT(Args)
724 #endif /* !YYDEBUG */
726 /* YYINITDEPTH -- initial size of the parser's stacks. */
728 # define YYINITDEPTH 200
731 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
732 if the built-in stack extension method is used).
734 Do not make this value too large; the results are undefined if
735 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
736 evaluated with infinite-precision integer arithmetic. */
743 # define YYMAXDEPTH 10000
751 # if defined (__GLIBC__) && defined (_STRING_H)
752 # define yystrlen strlen
754 /* Return the length of YYSTR. */
756 # if defined (__STDC__) || defined (__cplusplus)
757 yystrlen (const char *yystr
)
763 register const char *yys
= yystr
;
765 while (*yys
++ != '\0')
768 return yys
- yystr
- 1;
774 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
775 # define yystpcpy stpcpy
777 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
780 # if defined (__STDC__) || defined (__cplusplus)
781 yystpcpy (char *yydest
, const char *yysrc
)
783 yystpcpy (yydest
, yysrc
)
788 register char *yyd
= yydest
;
789 register const char *yys
= yysrc
;
791 while ((*yyd
++ = *yys
++) != '\0')
799 #endif /* !YYERROR_VERBOSE */
803 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
804 into yyparse. The argument should have type void *.
805 It should actually point to an object.
806 Grammar actions can access the variable by casting it
807 to the proper pointer type. */
810 # if defined (__STDC__) || defined (__cplusplus)
811 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
812 # define YYPARSE_PARAM_DECL
814 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
815 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
817 #else /* !YYPARSE_PARAM */
818 # define YYPARSE_PARAM_ARG
819 # define YYPARSE_PARAM_DECL
820 #endif /* !YYPARSE_PARAM */
822 /* Prevent warning if -Wstrict-prototypes. */
824 # ifdef YYPARSE_PARAM
825 int yyparse (void *);
831 #if defined (__STDC__) || defined (__cplusplus)
832 static void yydestruct (int yytype
,
833 YYSTYPE yyvalue
, YYLTYPE yylocation
);
835 static void yysymprint (FILE* out
, int yytype
,
836 YYSTYPE yyvalue
, YYLTYPE yylocation
);
844 yyparse (YYPARSE_PARAM_ARG
)
847 /* The lookahead symbol. */
850 /* The semantic value of the lookahead symbol. */
853 /* Number of parse errors so far. */
855 /* Location data for the lookahead symbol. */
858 register int yystate
;
861 /* Number of tokens to shift before error messages enabled. */
863 /* Lookahead token as an internal (translated) token number. */
866 /* Three stacks and their tools:
867 `yyss': related to states,
868 `yyvs': related to semantic values,
869 `yyls': related to locations.
871 Refer to the stacks thru separate pointers, to allow yyoverflow
872 to reallocate them elsewhere. */
874 /* The state stack. */
875 short yyssa
[YYINITDEPTH
];
877 register short *yyssp
;
879 /* The semantic value stack. */
880 YYSTYPE yyvsa
[YYINITDEPTH
];
881 YYSTYPE
*yyvs
= yyvsa
;
882 register YYSTYPE
*yyvsp
;
884 /* The location stack. */
885 YYLTYPE yylsa
[YYINITDEPTH
];
886 YYLTYPE
*yyls
= yylsa
;
889 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
891 YYSIZE_T yystacksize
= YYINITDEPTH
;
893 /* The variables used to return semantic value and location from the
898 /* When reducing, the number of symbols on the RHS of the reduced
902 YYDPRINTF ((stderr
, "Starting parse\n"));
907 yychar
= YYEMPTY
; /* Cause a token to be read. */
909 /* Initialize stack pointers.
910 Waste one element of value and location stack
911 so that they stay on the same level as the state stack.
912 The wasted elements are never initialized. */
919 /*------------------------------------------------------------.
920 | yynewstate -- Push a new state, which is found in yystate. |
921 `------------------------------------------------------------*/
923 /* In all cases, when you get here, the value and location stacks
924 have just been pushed. so pushing a state here evens the stacks.
931 if (yyssp
>= yyss
+ yystacksize
- 1)
933 /* Get the current used size of the three stacks, in elements. */
934 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
938 /* Give user a chance to reallocate the stack. Use copies of
939 these so that the &'s don't force the real ones into
941 YYSTYPE
*yyvs1
= yyvs
;
943 YYLTYPE
*yyls1
= yyls
;
945 /* Each stack pointer address is followed by the size of the
946 data in use in that stack, in bytes. This used to be a
947 conditional around just the two extra args, but that might
948 be undefined if yyoverflow is a macro. */
949 yyoverflow ("parser stack overflow",
950 &yyss1
, yysize
* sizeof (*yyssp
),
951 &yyvs1
, yysize
* sizeof (*yyvsp
),
952 &yyls1
, yysize
* sizeof (*yylsp
),
958 #else /* no yyoverflow */
959 # ifndef YYSTACK_RELOCATE
962 /* Extend the stack our own way. */
963 if (yystacksize
>= YYMAXDEPTH
)
966 if (yystacksize
> YYMAXDEPTH
)
967 yystacksize
= YYMAXDEPTH
;
971 union yyalloc
*yyptr
=
972 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
975 YYSTACK_RELOCATE (yyss
);
976 YYSTACK_RELOCATE (yyvs
);
977 YYSTACK_RELOCATE (yyls
);
978 # undef YYSTACK_RELOCATE
980 YYSTACK_FREE (yyss1
);
983 #endif /* no yyoverflow */
985 yyssp
= yyss
+ yysize
- 1;
986 yyvsp
= yyvs
+ yysize
- 1;
987 yylsp
= yyls
+ yysize
- 1;
989 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
990 (unsigned long int) yystacksize
));
992 if (yyssp
>= yyss
+ yystacksize
- 1)
996 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1005 /* Do appropriate processing given the current state. */
1006 /* Read a lookahead token if we need one and don't already have one. */
1009 /* First try to decide what to do without reference to lookahead token. */
1011 yyn
= yypact
[yystate
];
1015 /* Not known => get a lookahead token if don't already have one. */
1017 /* yychar is either YYEMPTY or YYEOF
1018 or a valid token in external form. */
1020 if (yychar
== YYEMPTY
)
1022 YYDPRINTF ((stderr
, "Reading a token: "));
1026 /* Convert token to internal form (in yychar1) for indexing tables with. */
1028 if (yychar
<= 0) /* This means end of input. */
1031 yychar
= YYEOF
; /* Don't call YYLEX any more. */
1033 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1037 yychar1
= YYTRANSLATE (yychar
);
1039 /* We have to keep this `#if YYDEBUG', since we use variables
1040 which are defined only if `YYDEBUG' is set. */
1041 YYDPRINTF ((stderr
, "Next token is "));
1042 YYDSYMPRINT ((stderr
, yychar1
, yylval
, yyloc
));
1043 YYDPRINTF ((stderr
, "\n"));
1047 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
1052 /* yyn is what to do for this token type in this state.
1053 Negative => reduce, -yyn is rule number.
1054 Positive => shift, yyn is new state.
1055 New state is final state => don't bother to shift,
1056 just return success.
1057 0, or most negative number => error. */
1072 /* Shift the lookahead token. */
1073 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
1074 yychar
, yytname
[yychar1
]));
1076 /* Discard the token being shifted unless it is eof. */
1077 if (yychar
!= YYEOF
)
1083 /* Count tokens shifted since error; after three, turn off error
1092 /*-----------------------------------------------------------.
1093 | yydefault -- do the default action for the current state. |
1094 `-----------------------------------------------------------*/
1096 yyn
= yydefact
[yystate
];
1102 /*-----------------------------.
1103 | yyreduce -- Do a reduction. |
1104 `-----------------------------*/
1106 /* yyn is the number of a rule to reduce with. */
1109 /* If YYLEN is nonzero, implement the default value of the action:
1112 Otherwise, the following line sets YYVAL to the semantic value of
1113 the lookahead token. This behavior is undocumented and Bison
1114 users should not rely upon it. Assigning to YYVAL
1115 unconditionally makes the parser a bit smaller, and it avoids a
1116 GCC warning that YYVAL may be used uninitialized. */
1117 yyval
= yyvsp
[1-yylen
];
1119 /* Default location. */
1120 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1123 /* We have to keep this `#if YYDEBUG', since we use variables which
1124 are defined only if `YYDEBUG' is set. */
1129 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1130 yyn
- 1, yyrline
[yyn
]);
1132 /* Print the symbols being reduced, and their result. */
1133 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1134 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1135 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1141 #line 160 "parse-gram.y"
1143 yycontrol
->errcode
= 0;
1144 epilogue_set (yyvsp
[0].string
, yylsp
[0]);
1149 #line 178 "parse-gram.y"
1150 { prologue_augment (yyvsp
[0].string
, yylsp
[0]); }
1154 #line 179 "parse-gram.y"
1159 #line 180 "parse-gram.y"
1160 { muscle_insert (yyvsp
[-1].string
, yyvsp
[0].string
); }
1164 #line 181 "parse-gram.y"
1165 { defines_flag
= 1; }
1169 #line 182 "parse-gram.y"
1170 { error_verbose
= 1; }
1174 #line 183 "parse-gram.y"
1175 { expected_conflicts
= yyvsp
[0].integer
; }
1179 #line 184 "parse-gram.y"
1180 { spec_file_prefix
= yyvsp
[0].string
; }
1184 #line 185 "parse-gram.y"
1185 { locations_flag
= 1; }
1189 #line 186 "parse-gram.y"
1190 { spec_name_prefix
= yyvsp
[0].string
; }
1194 #line 187 "parse-gram.y"
1195 { no_lines_flag
= 1; }
1199 #line 188 "parse-gram.y"
1200 { spec_outfile
= yyvsp
[0].string
; }
1204 #line 189 "parse-gram.y"
1205 { pure_parser
= 1; }
1209 #line 190 "parse-gram.y"
1214 #line 191 "parse-gram.y"
1215 { skeleton
= yyvsp
[0].string
; }
1219 #line 192 "parse-gram.y"
1220 { token_table_flag
= 1; }
1224 #line 193 "parse-gram.y"
1225 { report_flag
= 1; }
1229 #line 194 "parse-gram.y"
1234 #line 201 "parse-gram.y"
1236 grammar_start_symbol_set (yyvsp
[0].symbol
, yylsp
[0]);
1241 #line 205 "parse-gram.y"
1244 MUSCLE_INSERT_INT ("stype_line", yylsp
[0].first_line
);
1245 muscle_insert ("stype", yyvsp
[0].string
);
1250 #line 211 "parse-gram.y"
1251 { current_braced_code
= destructor_braced_code
; }
1255 #line 213 "parse-gram.y"
1257 symbol_list_t
*list
;
1258 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1259 symbol_destructor_set (list
->sym
, yyvsp
[-1].string
, yylsp
[-1]);
1260 symbol_list_free (yyvsp
[0].list
);
1261 current_braced_code
= action_braced_code
;
1266 #line 221 "parse-gram.y"
1267 { current_braced_code
= printer_braced_code
; }
1271 #line 223 "parse-gram.y"
1273 symbol_list_t
*list
;
1274 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1275 symbol_printer_set (list
->sym
, yyvsp
[-1].string
, list
->location
);
1276 symbol_list_free (yyvsp
[0].list
);
1277 current_braced_code
= action_braced_code
;
1282 #line 233 "parse-gram.y"
1283 { current_class
= nterm_sym
; }
1287 #line 234 "parse-gram.y"
1289 current_class
= unknown_sym
;
1290 current_type
= NULL
;
1295 #line 238 "parse-gram.y"
1296 { current_class
= token_sym
; }
1300 #line 239 "parse-gram.y"
1302 current_class
= unknown_sym
;
1303 current_type
= NULL
;
1308 #line 244 "parse-gram.y"
1310 symbol_list_t
*list
;
1311 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1312 symbol_type_set (list
->sym
, yyvsp
[-1].string
, yylsp
[-1]);
1313 symbol_list_free (yyvsp
[0].list
);
1318 #line 254 "parse-gram.y"
1320 symbol_list_t
*list
;
1322 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1324 symbol_type_set (list
->sym
, current_type
, yylsp
[-1]);
1325 symbol_precedence_set (list
->sym
, current_prec
, yyvsp
[-2].assoc
, yylsp
[-2]);
1327 symbol_list_free (yyvsp
[0].list
);
1328 current_type
= NULL
;
1333 #line 268 "parse-gram.y"
1334 { yyval
.assoc
= left_assoc
; }
1338 #line 269 "parse-gram.y"
1339 { yyval
.assoc
= right_assoc
; }
1343 #line 270 "parse-gram.y"
1344 { yyval
.assoc
= non_assoc
; }
1348 #line 274 "parse-gram.y"
1349 { current_type
= NULL
;}
1353 #line 275 "parse-gram.y"
1354 { current_type
= yyvsp
[0].string
; }
1358 #line 281 "parse-gram.y"
1359 { yyval
.list
= symbol_list_new (yyvsp
[0].symbol
, yylsp
[0]); }
1363 #line 282 "parse-gram.y"
1364 { yyval
.list
= symbol_list_prepend (yyvsp
[-1].list
, yyvsp
[0].symbol
, yylsp
[0]); }
1368 #line 288 "parse-gram.y"
1370 current_type
= yyvsp
[0].string
;
1375 #line 292 "parse-gram.y"
1377 symbol_class_set (yyvsp
[0].symbol
, current_class
, yylsp
[0]);
1378 symbol_type_set (yyvsp
[0].symbol
, current_type
, yylsp
[0]);
1383 #line 297 "parse-gram.y"
1385 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1386 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1387 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
, yylsp
[0]);
1392 #line 303 "parse-gram.y"
1394 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1395 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1396 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
);
1401 #line 309 "parse-gram.y"
1403 symbol_class_set (yyvsp
[-2].symbol
, current_class
, yylsp
[-2]);
1404 symbol_type_set (yyvsp
[-2].symbol
, current_type
, yylsp
[-2]);
1405 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
, yylsp
[-1]);
1406 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
);
1411 #line 320 "parse-gram.y"
1416 #line 322 "parse-gram.y"
1421 #line 344 "parse-gram.y"
1422 { current_lhs
= yyvsp
[-1].symbol
; current_lhs_location
= yylsp
[-1]; }
1426 #line 345 "parse-gram.y"
1431 #line 349 "parse-gram.y"
1432 { grammar_rule_end (yylsp
[0]); }
1436 #line 350 "parse-gram.y"
1437 { grammar_rule_end (yylsp
[0]); }
1441 #line 355 "parse-gram.y"
1442 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
1446 #line 357 "parse-gram.y"
1447 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
, yylsp
[0]); }
1451 #line 359 "parse-gram.y"
1452 { grammar_current_rule_action_append (yyvsp
[0].string
, yylsp
[0]); }
1456 #line 361 "parse-gram.y"
1457 { grammar_current_rule_prec_set (yyvsp
[0].symbol
, yylsp
[0]); }
1461 #line 363 "parse-gram.y"
1462 { grammar_current_rule_dprec_set (yyvsp
[0].integer
, yylsp
[0]); }
1466 #line 365 "parse-gram.y"
1467 { grammar_current_rule_merge_set (yyvsp
[0].string
, yylsp
[0]); }
1471 #line 369 "parse-gram.y"
1472 { yyval
.symbol
= yyvsp
[0].symbol
; }
1476 #line 370 "parse-gram.y"
1477 { yyval
.symbol
= yyvsp
[0].symbol
; }
1481 #line 371 "parse-gram.y"
1482 { yyval
.symbol
= getsym (yyvsp
[0].string
, yylsp
[0]); }
1486 #line 376 "parse-gram.y"
1487 { yyval
.string
= yyvsp
[0].string
; }
1491 #line 382 "parse-gram.y"
1493 yyval
.symbol
= getsym (yyvsp
[0].string
, yylsp
[0]);
1494 symbol_class_set (yyval
.symbol
, token_sym
, yylsp
[0]);
1499 #line 391 "parse-gram.y"
1501 yyval
.string
= yyvsp
[0].string
+ 1;
1502 yyval
.string
[strlen (yyval
.string
) - 1] = '\0';
1507 #line 399 "parse-gram.y"
1509 yyval
.string
= xstrdup ("");
1514 #line 403 "parse-gram.y"
1516 yyval
.string
= yyvsp
[0].string
;
1523 /* Line 1040 of /home/cs/hilfingr/work/grammars/glr2/install/share/bison/yacc.c. */
1524 #line 1525 "parse-gram.c"
1533 short *yyssp1
= yyss
- 1;
1534 YYFPRINTF (stderr
, "state stack now");
1535 while (yyssp1
!= yyssp
)
1536 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1537 YYFPRINTF (stderr
, "\n");
1544 /* Now `shift' the result of the reduction. Determine what state
1545 that goes to, based on the state we popped back to and the rule
1546 number reduced by. */
1550 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1551 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1552 yystate
= yytable
[yystate
];
1554 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1559 /*------------------------------------.
1560 | yyerrlab -- here on detecting error |
1561 `------------------------------------*/
1563 /* If not already recovering from an error, report this error. */
1569 yyn
= yypact
[yystate
];
1571 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1573 YYSIZE_T yysize
= 0;
1578 /* Start YYX at -YYN if negative to avoid negative indexes in
1580 for (yyx
= yyn
< 0 ? -yyn
: 0;
1581 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1582 if (yycheck
[yyx
+ yyn
] == yyx
)
1583 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1584 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1585 yysize
+= yystrlen (yytname
[YYTRANSLATE (yychar
)]);
1586 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1589 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1590 yyp
= yystpcpy (yyp
, yytname
[YYTRANSLATE (yychar
)]);
1595 for (yyx
= yyn
< 0 ? -yyn
: 0;
1596 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1598 if (yycheck
[yyx
+ yyn
] == yyx
)
1600 const char *yyq
= ! yycount
? ", expecting " : " or ";
1601 yyp
= yystpcpy (yyp
, yyq
);
1602 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1607 YYSTACK_FREE (yymsg
);
1610 yyerror ("parse error; also virtual memory exhausted");
1613 #endif /* YYERROR_VERBOSE */
1614 yyerror ("parse error");
1619 /*----------------------------------------------------.
1620 | yyerrlab1 -- error raised explicitly by an action. |
1621 `----------------------------------------------------*/
1623 if (yyerrstatus
== 3)
1625 /* If just tried and failed to reuse lookahead token after an
1626 error, discard it. */
1628 /* Return failure if at end of input. */
1629 if (yychar
== YYEOF
)
1631 /* Pop the error token. */
1633 /* Pop the rest of the stack. */
1634 while (yyssp
> yyss
)
1636 YYDPRINTF ((stderr
, "Error: popping "));
1637 YYDSYMPRINT ((stderr
,
1640 YYDPRINTF ((stderr
, "\n"));
1641 yydestruct (yystos
[*yyssp
], *yyvsp
, *yylsp
);
1647 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1648 yychar
, yytname
[yychar1
]));
1649 yydestruct (yychar1
, yylval
, yylloc
);
1653 /* Else will try to reuse lookahead token after shifting the error
1656 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1660 yyn
= yypact
[yystate
];
1664 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1672 /* Pop the current state because it cannot handle the error token. */
1676 YYDPRINTF ((stderr
, "Error: popping "));
1677 YYDSYMPRINT ((stderr
,
1678 yystos
[*yyssp
], *yyvsp
, *yylsp
));
1679 YYDPRINTF ((stderr
, "\n"));
1681 yydestruct (yystos
[yystate
], *yyvsp
, *yylsp
);
1689 short *yyssp1
= yyss
- 1;
1690 YYFPRINTF (stderr
, "Error: state stack now");
1691 while (yyssp1
!= yyssp
)
1692 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1693 YYFPRINTF (stderr
, "\n");
1701 YYDPRINTF ((stderr
, "Shifting error token, "));
1710 /*-------------------------------------.
1711 | yyacceptlab -- YYACCEPT comes here. |
1712 `-------------------------------------*/
1717 /*-----------------------------------.
1718 | yyabortlab -- YYABORT comes here. |
1719 `-----------------------------------*/
1725 /*----------------------------------------------.
1726 | yyoverflowlab -- parser overflow comes here. |
1727 `----------------------------------------------*/
1729 yyerror ("parser stack overflow");
1737 YYSTACK_FREE (yyss
);
1743 /*-----------------------------------------------.
1744 | Release the memory associated to this symbol. |
1745 `-----------------------------------------------*/
1748 yydestruct (int yytype
,
1749 YYSTYPE yyvalue
, YYLTYPE yylocation
)
1760 /*-----------------------------.
1761 | Print this symbol on YYOUT. |
1762 `-----------------------------*/
1765 yysymprint (FILE* yyout
, int yytype
,
1766 YYSTYPE yyvalue
, YYLTYPE yylocation
)
1768 if (yytype
< YYNTOKENS
)
1770 YYFPRINTF (yyout
, "token %s (", yytname
[yytype
]);
1772 YYPRINT (yyout
, yytoknum
[yytype
], yyvalue
);
1776 YYFPRINTF (yyout
, "nterm %s (", yytname
[yytype
]);
1783 YYFPRINTF (yyout
, ")");
1785 #endif /* YYDEBUG. */
1787 #line 412 "parse-gram.y"
1789 /*------------------------------------------------------------------.
1790 | When debugging the parser, display tokens' locations and values. |
1791 `------------------------------------------------------------------*/
1794 yyprint (FILE *file
,
1795 int type
, const yystype
*value
)
1801 fprintf (file
, " = '%s'", value
->string
);
1805 fprintf (file
, " = %s", value
->symbol
->tag
);
1809 fprintf (file
, " = %d", value
->integer
);
1813 fprintf (file
, " = \"%s\"", value
->string
);
1817 fprintf (file
, " = <%s>", value
->string
);
1823 fprintf (file
, " = {{ %s }}", value
->string
);
1829 gram_error (gram_control_t
*control ATTRIBUTE_UNUSED
,
1830 location_t
*yylloc
, const char *msg
)
1832 LOCATION_PRINT (stderr
, *yylloc
);
1833 fprintf (stderr
, ": %s\n", msg
);