1 /* A Bison parser, made from parse-gram.y, by GNU bison 1.75a. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
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)
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.
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. */
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. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
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. */
36 /* Identify Bison output. */
42 /* Using locations. */
43 #define YYLSP_NEEDED 1
45 /* If NAME_PREFIX is specified substitute the variables and functions
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
59 /* Put the tokens into the symbol table, so that GDB and other debuggers
69 PERCENT_DESTRUCTOR
= 264,
70 PERCENT_PRINTER
= 265,
74 PERCENT_NONASSOC
= 269,
80 PERCENT_DEFINES
= 275,
81 PERCENT_ERROR_VERBOSE
= 276,
83 PERCENT_FILE_PREFIX
= 278,
84 PERCENT_GLR_PARSER
= 279,
85 PERCENT_LEX_PARAM
= 280,
86 PERCENT_LOCATIONS
= 281,
87 PERCENT_NAME_PREFIX
= 282,
88 PERCENT_NO_LINES
= 283,
90 PERCENT_PARSE_PARAM
= 285,
91 PERCENT_PURE_PARSER
= 286,
92 PERCENT_SKELETON
= 287,
94 PERCENT_TOKEN_TABLE
= 289,
95 PERCENT_VERBOSE
= 290,
104 PERCENT_PERCENT
= 299,
112 #define CHARACTER 259
114 #define PERCENT_TOKEN 261
115 #define PERCENT_NTERM 262
116 #define PERCENT_TYPE 263
117 #define PERCENT_DESTRUCTOR 264
118 #define PERCENT_PRINTER 265
119 #define PERCENT_UNION 266
120 #define PERCENT_LEFT 267
121 #define PERCENT_RIGHT 268
122 #define PERCENT_NONASSOC 269
123 #define PERCENT_PREC 270
124 #define PERCENT_DPREC 271
125 #define PERCENT_MERGE 272
126 #define PERCENT_DEBUG 273
127 #define PERCENT_DEFINE 274
128 #define PERCENT_DEFINES 275
129 #define PERCENT_ERROR_VERBOSE 276
130 #define PERCENT_EXPECT 277
131 #define PERCENT_FILE_PREFIX 278
132 #define PERCENT_GLR_PARSER 279
133 #define PERCENT_LEX_PARAM 280
134 #define PERCENT_LOCATIONS 281
135 #define PERCENT_NAME_PREFIX 282
136 #define PERCENT_NO_LINES 283
137 #define PERCENT_OUTPUT 284
138 #define PERCENT_PARSE_PARAM 285
139 #define PERCENT_PURE_PARSER 286
140 #define PERCENT_SKELETON 287
141 #define PERCENT_START 288
142 #define PERCENT_TOKEN_TABLE 289
143 #define PERCENT_VERBOSE 290
144 #define PERCENT_YACC 291
147 #define SEMICOLON 294
152 #define PERCENT_PERCENT 299
155 #define BRACED_CODE 302
160 /* Copy the first part of user declarations. */
161 #line 31 "parse-gram.y"
164 #include "complain.h"
165 #include "muscle_tab.h"
172 #include "conflicts.h"
174 /* Produce verbose parse errors. */
175 #define YYERROR_VERBOSE 1
176 #define YYLLOC_DEFAULT(Current, Rhs, N) \
180 Current.first_column = Rhs[1].first_column; \
181 Current.first_line = Rhs[1].first_line; \
182 Current.last_column = Rhs[N].last_column; \
183 Current.last_line = Rhs[N].last_line; \
191 /* Pass the control structure to YYPARSE and YYLEX. */
192 #define YYPARSE_PARAM gram_control
193 #define YYLEX_PARAM gram_control
194 /* YYPARSE receives GRAM_CONTROL as a void *. Provide a
195 correctly typed access to it. */
196 #define yycontrol ((gram_control_t *) gram_control)
198 /* Request detailed parse error messages, and pass them to GRAM_ERROR.
199 FIXME: depends on the undocumented availability of YYLLOC.t */
201 #define yyerror(Msg) \
202 gram_error (&yylloc, Msg)
204 #define YYPRINT(File, Type, Value) \
205 yyprint (File, Type, &Value)
206 static void yyprint (FILE *file
, int type
, const yystype
*value
);
208 symbol_class current_class
= unknown_sym
;
209 char *current_type
= 0;
210 symbol_t
*current_lhs
;
211 location_t current_lhs_location
;
212 assoc_t current_assoc
;
213 int current_prec
= 0;
214 braced_code_t current_braced_code
= action_braced_code
;
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 89 "parse-gram.y"
239 /* Line 193 of /usr/local/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 213 of /usr/local/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 #if defined (__STDC__) || defined (__cplusplus)
353 typedef signed char yysigned_char
;
355 typedef short yysigned_char
;
358 /* YYFINAL -- State number of the termination state. */
362 /* YYNTOKENS -- Number of terminals. */
364 /* YYNNTS -- Number of nonterminals. */
366 /* YYNRULES -- Number of rules. */
368 /* YYNRULES -- Number of states. */
369 #define YYNSTATES 116
371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
373 #define YYMAXUTOK 302
375 #define YYTRANSLATE(X) \
376 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
378 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
379 static const unsigned char yytranslate
[] =
381 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
407 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
408 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
409 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
410 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
415 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
417 static const unsigned char yyprhs
[] =
419 0, 0, 3, 8, 9, 13, 15, 17, 19, 23,
420 25, 27, 30, 34, 36, 41, 43, 47, 49, 53,
421 58, 60, 63, 65, 67, 69, 71, 73, 76, 79,
422 80, 85, 86, 91, 92, 96, 97, 101, 105, 109,
423 111, 113, 115, 116, 118, 120, 123, 125, 127, 130,
424 133, 137, 139, 142, 144, 147, 149, 152, 155, 156,
425 162, 164, 168, 169, 172, 175, 179, 183, 187, 189,
426 191, 193, 195, 197, 199, 200, 203, 204
429 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
430 static const yysigned_char yyrhs
[] =
432 49, 0, -1, 50, 44, 64, 74, -1, -1, 50,
433 51, 75, -1, 52, -1, 45, -1, 18, -1, 19,
434 73, 73, -1, 20, -1, 21, -1, 22, 5, -1,
435 23, 38, 73, -1, 24, -1, 25, 73, 41, 73,
436 -1, 26, -1, 27, 38, 73, -1, 28, -1, 29,
437 38, 73, -1, 30, 73, 41, 73, -1, 31, -1,
438 32, 73, -1, 34, -1, 35, -1, 36, -1, 58,
439 -1, 55, -1, 33, 70, -1, 11, 47, -1, -1,
440 9, 53, 47, 61, -1, -1, 10, 54, 47, 61,
441 -1, -1, 7, 56, 63, -1, -1, 6, 57, 63,
442 -1, 8, 37, 61, -1, 59, 60, 61, -1, 12,
443 -1, 13, -1, 14, -1, -1, 37, -1, 70, -1,
444 61, 70, -1, 37, -1, 43, -1, 43, 5, -1,
445 43, 72, -1, 43, 5, 72, -1, 62, -1, 63,
446 62, -1, 65, -1, 64, 65, -1, 66, -1, 52,
447 39, -1, 1, 39, -1, -1, 43, 40, 67, 68,
448 39, -1, 69, -1, 68, 42, 69, -1, -1, 69,
449 70, -1, 69, 71, -1, 69, 15, 70, -1, 69,
450 16, 5, -1, 69, 17, 37, -1, 43, -1, 72,
451 -1, 4, -1, 47, -1, 3, -1, 3, -1, -1,
452 44, 46, -1, -1, 39, -1
455 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
456 static const unsigned short yyrline
[] =
458 0, 168, 168, 181, 183, 186, 188, 189, 190, 191,
459 192, 193, 194, 195, 196, 198, 199, 200, 201, 202,
460 204, 205, 206, 207, 208, 211, 213, 214, 218, 225,
461 224, 235, 234, 247, 246, 252, 252, 257, 266, 281,
462 283, 284, 287, 289, 294, 296, 300, 305, 310, 316,
463 322, 332, 335, 344, 346, 352, 354, 359, 366, 365,
464 370, 372, 375, 378, 380, 382, 384, 386, 390, 392,
465 393, 396, 402, 411, 419, 424, 430, 432
469 #if YYDEBUG || YYERROR_VERBOSE
470 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
471 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
472 static const char *const yytname
[] =
474 "\"end of file\"", "error", "$undefined", "\"string\"", "\"character\"",
475 "\"integer\"", "\"%token\"", "\"%nterm\"", "\"%type\"",
476 "\"%destructor\"", "\"%printer\"", "\"%union\"", "\"%left\"",
477 "\"%right\"", "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"",
478 "\"%debug\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
479 "\"%expect\"", "\"%file-prefix\"", "\"%glr-parser\"", "\"%lex-param\"",
480 "\"%locations\"", "\"%name-prefix\"", "\"%no-lines\"", "\"%output\"",
481 "\"%parse-param\"", "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"",
482 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"",
483 "\";\"", "\":\"", "\",\"", "\"|\"", "\"identifier\"", "\"%%\"",
484 "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input",
485 "declarations", "declaration", "grammar_declaration", "@1", "@2",
486 "symbol_declaration", "@3", "@4", "precedence_declaration",
487 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
488 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
489 "@5", "rhses.1", "rhs", "symbol", "action", "string_as_id",
490 "string_content", "epilogue.opt", "semi_colon.opt", 0
495 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
497 static const unsigned short yytoknum
[] =
499 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
500 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
501 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
502 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
503 295, 296, 297, 298, 299, 300, 301, 302
507 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
508 static const unsigned char yyr1
[] =
510 0, 48, 49, 50, 50, 51, 51, 51, 51, 51,
511 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
512 51, 51, 51, 51, 51, 52, 52, 52, 52, 53,
513 52, 54, 52, 56, 55, 57, 55, 55, 58, 59,
514 59, 59, 60, 60, 61, 61, 62, 62, 62, 62,
515 62, 63, 63, 64, 64, 65, 65, 65, 67, 66,
516 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
517 70, 71, 72, 73, 74, 74, 75, 75
520 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
521 static const unsigned char yyr2
[] =
523 0, 2, 4, 0, 3, 1, 1, 1, 3, 1,
524 1, 2, 3, 1, 4, 1, 3, 1, 3, 4,
525 1, 2, 1, 1, 1, 1, 1, 2, 2, 0,
526 4, 0, 4, 0, 3, 0, 3, 3, 3, 1,
527 1, 1, 0, 1, 1, 2, 1, 1, 2, 2,
528 3, 1, 2, 1, 2, 1, 2, 2, 0, 5,
529 1, 3, 0, 2, 2, 3, 3, 3, 1, 1,
530 1, 1, 1, 1, 0, 2, 0, 1
533 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
534 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
535 means the default is an error. */
536 static const unsigned char yydefact
[] =
538 3, 0, 0, 1, 35, 33, 0, 29, 31, 0,
539 39, 40, 41, 7, 0, 9, 10, 0, 0, 13,
540 0, 15, 0, 17, 0, 0, 20, 0, 0, 22,
541 23, 24, 0, 6, 76, 5, 26, 25, 42, 0,
542 0, 0, 0, 0, 28, 73, 0, 11, 0, 0,
543 0, 0, 0, 21, 72, 70, 68, 27, 69, 0,
544 0, 0, 0, 53, 55, 77, 4, 43, 0, 46,
545 47, 51, 36, 34, 37, 44, 0, 0, 8, 12,
546 0, 16, 18, 0, 57, 58, 56, 0, 54, 2,
547 38, 48, 49, 52, 45, 30, 32, 14, 19, 62,
548 75, 50, 0, 60, 59, 62, 0, 0, 0, 71,
549 63, 64, 61, 65, 66, 67
552 /* YYDEFGOTO[NTERM-NUM]. */
553 static const yysigned_char yydefgoto
[] =
555 -1, 1, 2, 34, 61, 42, 43, 36, 40, 39,
556 37, 38, 68, 74, 71, 72, 62, 63, 64, 99,
557 102, 103, 75, 111, 58, 46, 89, 66
560 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
562 #define YYPACT_NINF -64
563 static const yysigned_char yypact
[] =
565 -64, 9, 107, -64, -64, -64, -13, -64, -64, -9,
566 -64, -64, -64, -64, 27, -64, -64, 38, 3, -64,
567 27, -64, 6, -64, 7, 27, -64, 27, -1, -64,
568 -64, -64, 79, -64, 10, -64, -64, -64, 13, -17,
569 -17, -1, 8, 11, -64, -64, 27, -64, 27, 15,
570 27, 27, 16, -64, -64, -64, -64, -64, -64, 20,
571 14, 21, 4, -64, -64, -64, -64, -64, -1, -64,
572 18, -64, -17, -17, -1, -64, -1, -1, -64, -64,
573 27, -64, -64, 27, -64, -64, -64, 17, -64, -64,
574 -1, 62, -64, -64, -64, -1, -1, -64, -64, -64,
575 -64, -64, -20, 36, -64, -64, -1, 61, 32, -64,
576 -64, -64, 36, -64, -64, -64
579 /* YYPGOTO[NTERM-NUM]. */
580 static const yysigned_char yypgoto
[] =
582 -64, -64, -64, -64, 68, -64, -64, -64, -64, -64,
583 -64, -64, -64, -43, -37, 31, -64, 12, -64, -64,
584 -64, -33, -28, -64, -63, -19, -64, -64
587 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
588 positive, shift that token. If negative, reduce the rule which
589 number is the opposite. If zero, do what YYDEFACT says.
590 If YYTABLE_NINF, parse error. */
591 #define YYTABLE_NINF -75
592 static const yysigned_char yytable
[] =
594 57, 49, 54, 55, -74, 59, 52, 92, 53, 3,
595 4, 5, 6, 7, 8, 9, 10, 11, 12, 104,
596 69, 54, 105, 91, 41, 90, 70, 78, 101, 79,
597 45, 81, 82, 95, 96, 93, 93, 28, 44, 54,
598 55, 48, 56, 47, 50, 51, 94, 60, 87, 65,
599 67, 106, 107, 108, 85, 76, 80, 83, 77, 84,
600 86, 97, 94, 100, 98, 54, 114, 94, 94, 115,
601 35, 73, 112, 0, 88, 110, 0, 0, 113, 56,
602 59, 0, 0, 109, 110, 4, 5, 6, 7, 8,
603 9, 10, 11, 12, 0, 0, 0, 0, 0, 0,
604 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
605 0, 0, 28, 4, 5, 6, 7, 8, 9, 10,
606 11, 12, 60, 0, 0, 13, 14, 15, 16, 17,
607 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
608 28, 29, 30, 31, 0, 0, 0, 0, 0, 0,
612 static const yysigned_char yycheck
[] =
614 28, 20, 3, 4, 0, 1, 25, 70, 27, 0,
615 6, 7, 8, 9, 10, 11, 12, 13, 14, 39,
616 37, 3, 42, 5, 37, 68, 43, 46, 91, 48,
617 3, 50, 51, 76, 77, 72, 73, 33, 47, 3,
618 4, 38, 43, 5, 38, 38, 74, 43, 44, 39,
619 37, 15, 16, 17, 40, 47, 41, 41, 47, 39,
620 39, 80, 90, 46, 83, 3, 5, 95, 96, 37,
621 2, 40, 105, -1, 62, 103, -1, -1, 106, 43,
622 1, -1, -1, 47, 112, 6, 7, 8, 9, 10,
623 11, 12, 13, 14, -1, -1, -1, -1, -1, -1,
624 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
625 -1, -1, 33, 6, 7, 8, 9, 10, 11, 12,
626 13, 14, 43, -1, -1, 18, 19, 20, 21, 22,
627 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
628 33, 34, 35, 36, -1, -1, -1, -1, -1, -1,
632 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
633 symbol of state STATE-NUM. */
634 static const unsigned char yystos
[] =
636 0, 49, 50, 0, 6, 7, 8, 9, 10, 11,
637 12, 13, 14, 18, 19, 20, 21, 22, 23, 24,
638 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
639 35, 36, 44, 45, 51, 52, 55, 58, 59, 57,
640 56, 37, 53, 54, 47, 3, 73, 5, 38, 73,
641 38, 38, 73, 73, 3, 4, 43, 70, 72, 1,
642 43, 52, 64, 65, 66, 39, 75, 37, 60, 37,
643 43, 62, 63, 63, 61, 70, 47, 47, 73, 73,
644 41, 73, 73, 41, 39, 40, 39, 44, 65, 74,
645 61, 5, 72, 62, 70, 61, 61, 73, 73, 67,
646 46, 72, 68, 69, 39, 42, 15, 16, 17, 47,
647 70, 71, 69, 70, 5, 37
650 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
651 # define YYSIZE_T __SIZE_TYPE__
653 #if ! defined (YYSIZE_T) && defined (size_t)
654 # define YYSIZE_T size_t
656 #if ! defined (YYSIZE_T)
657 # if defined (__STDC__) || defined (__cplusplus)
658 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
659 # define YYSIZE_T size_t
662 #if ! defined (YYSIZE_T)
663 # define YYSIZE_T unsigned int
666 #define yyerrok (yyerrstatus = 0)
667 #define yyclearin (yychar = YYEMPTY)
671 #define YYACCEPT goto yyacceptlab
672 #define YYABORT goto yyabortlab
673 #define YYERROR goto yyerrlab1
675 /* Like YYERROR except do call yyerror. This remains here temporarily
676 to ease the transition to the new meaning of YYERROR, for GCC.
677 Once GCC version 2 has supplanted version 1, this can go. */
679 #define YYFAIL goto yyerrlab
681 #define YYRECOVERING() (!!yyerrstatus)
683 #define YYBACKUP(Token, Value) \
685 if (yychar == YYEMPTY && yylen == 1) \
689 yychar1 = YYTRANSLATE (yychar); \
695 yyerror ("syntax error: cannot back up"); \
701 #define YYERRCODE 256
703 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
706 #ifndef YYLLOC_DEFAULT
707 # define YYLLOC_DEFAULT(Current, Rhs, N) \
708 Current.first_line = Rhs[1].first_line; \
709 Current.first_column = Rhs[1].first_column; \
710 Current.last_line = Rhs[N].last_line; \
711 Current.last_column = Rhs[N].last_column;
714 /* YYLEX -- calling `yylex' with the right arguments. */
717 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
719 # define YYLEX yylex (&yylval, &yylloc)
722 /* Enable debugging if requested. */
726 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
727 # define YYFPRINTF fprintf
730 # define YYDPRINTF(Args) \
735 # define YYDSYMPRINT(Args) \
740 /* Nonzero means print parse trace. It is left uninitialized so that
741 multiple parsers can coexist. */
744 # define YYDPRINTF(Args)
745 # define YYDSYMPRINT(Args)
746 #endif /* !YYDEBUG */
748 /* YYINITDEPTH -- initial size of the parser's stacks. */
750 # define YYINITDEPTH 200
753 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
754 if the built-in stack extension method is used).
756 Do not make this value too large; the results are undefined if
757 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
758 evaluated with infinite-precision integer arithmetic. */
765 # define YYMAXDEPTH 10000
773 # if defined (__GLIBC__) && defined (_STRING_H)
774 # define yystrlen strlen
776 /* Return the length of YYSTR. */
778 # if defined (__STDC__) || defined (__cplusplus)
779 yystrlen (const char *yystr
)
785 register const char *yys
= yystr
;
787 while (*yys
++ != '\0')
790 return yys
- yystr
- 1;
796 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
797 # define yystpcpy stpcpy
799 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
802 # if defined (__STDC__) || defined (__cplusplus)
803 yystpcpy (char *yydest
, const char *yysrc
)
805 yystpcpy (yydest
, yysrc
)
810 register char *yyd
= yydest
;
811 register const char *yys
= yysrc
;
813 while ((*yyd
++ = *yys
++) != '\0')
821 #endif /* !YYERROR_VERBOSE */
826 /*-----------------------------.
827 | Print this symbol on YYOUT. |
828 `-----------------------------*/
831 #if defined (__STDC__) || defined (__cplusplus)
832 yysymprint (FILE* yyout
, int yytype
, YYSTYPE yyvalue
, YYLTYPE yylocation
)
834 yysymprint (yyout
, yytype
, yyvalue
, yylocation
)
841 /* Pacify ``unused variable'' warnings. */
845 if (yytype
< YYNTOKENS
)
847 YYFPRINTF (yyout
, "token %s (", yytname
[yytype
]);
849 YYPRINT (yyout
, yytoknum
[yytype
], yyvalue
);
853 YYFPRINTF (yyout
, "nterm %s (", yytname
[yytype
]);
860 YYFPRINTF (yyout
, ")");
862 #endif /* YYDEBUG. */
865 /*-----------------------------------------------.
866 | Release the memory associated to this symbol. |
867 `-----------------------------------------------*/
870 #if defined (__STDC__) || defined (__cplusplus)
871 yydestruct (int yytype
, YYSTYPE yyvalue
, YYLTYPE yylocation
)
873 yydestruct (yytype
, yyvalue
, yylocation
)
879 /* Pacify ``unused variable'' warnings. */
892 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
893 into yyparse. The argument should have type void *.
894 It should actually point to an object.
895 Grammar actions can access the variable by casting it
896 to the proper pointer type. */
899 # if defined (__STDC__) || defined (__cplusplus)
900 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
901 # define YYPARSE_PARAM_DECL
903 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
904 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
906 #else /* !YYPARSE_PARAM */
907 # define YYPARSE_PARAM_ARG
908 # define YYPARSE_PARAM_DECL
909 #endif /* !YYPARSE_PARAM */
911 /* Prevent warning if -Wstrict-prototypes. */
913 # ifdef YYPARSE_PARAM
914 int yyparse (void *);
924 yyparse (YYPARSE_PARAM_ARG
)
927 /* The lookahead symbol. */
930 /* The semantic value of the lookahead symbol. */
933 /* Number of parse errors so far. */
935 /* Location data for the lookahead symbol. */
938 register int yystate
;
941 /* Number of tokens to shift before error messages enabled. */
943 /* Lookahead token as an internal (translated) token number. */
946 /* Three stacks and their tools:
947 `yyss': related to states,
948 `yyvs': related to semantic values,
949 `yyls': related to locations.
951 Refer to the stacks thru separate pointers, to allow yyoverflow
952 to reallocate them elsewhere. */
954 /* The state stack. */
955 short yyssa
[YYINITDEPTH
];
957 register short *yyssp
;
959 /* The semantic value stack. */
960 YYSTYPE yyvsa
[YYINITDEPTH
];
961 YYSTYPE
*yyvs
= yyvsa
;
962 register YYSTYPE
*yyvsp
;
964 /* The location stack. */
965 YYLTYPE yylsa
[YYINITDEPTH
];
966 YYLTYPE
*yyls
= yylsa
;
969 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
971 YYSIZE_T yystacksize
= YYINITDEPTH
;
973 /* The variables used to return semantic value and location from the
978 /* When reducing, the number of symbols on the RHS of the reduced
982 YYDPRINTF ((stderr
, "Starting parse\n"));
987 yychar
= YYEMPTY
; /* Cause a token to be read. */
989 /* Initialize stack pointers.
990 Waste one element of value and location stack
991 so that they stay on the same level as the state stack.
992 The wasted elements are never initialized. */
999 /*------------------------------------------------------------.
1000 | yynewstate -- Push a new state, which is found in yystate. |
1001 `------------------------------------------------------------*/
1003 /* In all cases, when you get here, the value and location stacks
1004 have just been pushed. so pushing a state here evens the stacks.
1011 if (yyssp
>= yyss
+ yystacksize
- 1)
1013 /* Get the current used size of the three stacks, in elements. */
1014 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1018 /* Give user a chance to reallocate the stack. Use copies of
1019 these so that the &'s don't force the real ones into
1021 YYSTYPE
*yyvs1
= yyvs
;
1022 short *yyss1
= yyss
;
1023 YYLTYPE
*yyls1
= yyls
;
1025 /* Each stack pointer address is followed by the size of the
1026 data in use in that stack, in bytes. This used to be a
1027 conditional around just the two extra args, but that might
1028 be undefined if yyoverflow is a macro. */
1029 yyoverflow ("parser stack overflow",
1030 &yyss1
, yysize
* sizeof (*yyssp
),
1031 &yyvs1
, yysize
* sizeof (*yyvsp
),
1032 &yyls1
, yysize
* sizeof (*yylsp
),
1038 #else /* no yyoverflow */
1039 # ifndef YYSTACK_RELOCATE
1042 /* Extend the stack our own way. */
1043 if (yystacksize
>= YYMAXDEPTH
)
1046 if (yystacksize
> YYMAXDEPTH
)
1047 yystacksize
= YYMAXDEPTH
;
1050 short *yyss1
= yyss
;
1051 union yyalloc
*yyptr
=
1052 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1055 YYSTACK_RELOCATE (yyss
);
1056 YYSTACK_RELOCATE (yyvs
);
1057 YYSTACK_RELOCATE (yyls
);
1058 # undef YYSTACK_RELOCATE
1060 YYSTACK_FREE (yyss1
);
1063 #endif /* no yyoverflow */
1065 yyssp
= yyss
+ yysize
- 1;
1066 yyvsp
= yyvs
+ yysize
- 1;
1067 yylsp
= yyls
+ yysize
- 1;
1069 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1070 (unsigned long int) yystacksize
));
1072 if (yyssp
>= yyss
+ yystacksize
- 1)
1076 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1085 /* Do appropriate processing given the current state. */
1086 /* Read a lookahead token if we need one and don't already have one. */
1089 /* First try to decide what to do without reference to lookahead token. */
1091 yyn
= yypact
[yystate
];
1092 if (yyn
== YYPACT_NINF
)
1095 /* Not known => get a lookahead token if don't already have one. */
1097 /* yychar is either YYEMPTY or YYEOF
1098 or a valid token in external form. */
1100 if (yychar
== YYEMPTY
)
1102 YYDPRINTF ((stderr
, "Reading a token: "));
1106 /* Convert token to internal form (in yychar1) for indexing tables with. */
1108 if (yychar
<= 0) /* This means end of input. */
1111 yychar
= YYEOF
; /* Don't call YYLEX any more. */
1113 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1117 yychar1
= YYTRANSLATE (yychar
);
1119 /* We have to keep this `#if YYDEBUG', since we use variables
1120 which are defined only if `YYDEBUG' is set. */
1121 YYDPRINTF ((stderr
, "Next token is "));
1122 YYDSYMPRINT ((stderr
, yychar1
, yylval
, yyloc
));
1123 YYDPRINTF ((stderr
, "\n"));
1126 /* If the proper action on seeing token YYCHAR1 is to reduce or to
1127 detect an error, take that action. */
1129 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
1134 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1143 /* Shift the lookahead token. */
1144 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
1145 yychar
, yytname
[yychar1
]));
1147 /* Discard the token being shifted unless it is eof. */
1148 if (yychar
!= YYEOF
)
1154 /* Count tokens shifted since error; after three, turn off error
1163 /*-----------------------------------------------------------.
1164 | yydefault -- do the default action for the current state. |
1165 `-----------------------------------------------------------*/
1167 yyn
= yydefact
[yystate
];
1173 /*-----------------------------.
1174 | yyreduce -- Do a reduction. |
1175 `-----------------------------*/
1177 /* yyn is the number of a rule to reduce with. */
1180 /* If YYLEN is nonzero, implement the default value of the action:
1183 Otherwise, the following line sets YYVAL to garbage.
1184 This behavior is undocumented and Bison
1185 users should not rely upon it. Assigning to YYVAL
1186 unconditionally makes the parser a bit smaller, and it avoids a
1187 GCC warning that YYVAL may be used uninitialized. */
1188 yyval
= yyvsp
[1-yylen
];
1190 /* Default location. */
1191 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1194 /* We have to keep this `#if YYDEBUG', since we use variables which
1195 are defined only if `YYDEBUG' is set. */
1200 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1201 yyn
- 1, yyrline
[yyn
]);
1203 /* Print the symbols being reduced, and their result. */
1204 for (yyi
= yyprhs
[yyn
]; yyrhs
[yyi
] >= 0; yyi
++)
1205 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1206 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1212 #line 170 "parse-gram.y"
1214 yycontrol
->errcode
= 0;
1215 epilogue_set (yyvsp
[0].string
, yylsp
[0]);
1220 #line 188 "parse-gram.y"
1221 { prologue_augment (yyvsp
[0].string
, yylsp
[0]); }
1225 #line 189 "parse-gram.y"
1230 #line 190 "parse-gram.y"
1231 { muscle_insert (yyvsp
[-1].string
, yyvsp
[0].string
); }
1235 #line 191 "parse-gram.y"
1236 { defines_flag
= 1; }
1240 #line 192 "parse-gram.y"
1241 { error_verbose
= 1; }
1245 #line 193 "parse-gram.y"
1246 { expected_conflicts
= yyvsp
[0].integer
; }
1250 #line 194 "parse-gram.y"
1251 { spec_file_prefix
= yyvsp
[0].string
; }
1255 #line 195 "parse-gram.y"
1260 #line 197 "parse-gram.y"
1261 { muscle_pair_list_grow ("lex_param", yyvsp
[-2].string
, yyvsp
[0].string
); }
1265 #line 198 "parse-gram.y"
1266 { locations_flag
= 1; }
1270 #line 199 "parse-gram.y"
1271 { spec_name_prefix
= yyvsp
[0].string
; }
1275 #line 200 "parse-gram.y"
1276 { no_lines_flag
= 1; }
1280 #line 201 "parse-gram.y"
1281 { spec_outfile
= yyvsp
[0].string
; }
1285 #line 203 "parse-gram.y"
1286 { muscle_pair_list_grow ("parse_param", yyvsp
[-2].string
, yyvsp
[0].string
); }
1290 #line 204 "parse-gram.y"
1291 { pure_parser
= 1; }
1295 #line 205 "parse-gram.y"
1296 { skeleton
= yyvsp
[0].string
; }
1300 #line 206 "parse-gram.y"
1301 { token_table_flag
= 1; }
1305 #line 207 "parse-gram.y"
1306 { report_flag
= 1; }
1310 #line 208 "parse-gram.y"
1315 #line 215 "parse-gram.y"
1317 grammar_start_symbol_set (yyvsp
[0].symbol
, yylsp
[0]);
1322 #line 219 "parse-gram.y"
1325 MUSCLE_INSERT_INT ("stype_line", yylsp
[0].first_line
);
1326 muscle_insert ("stype", yyvsp
[0].string
);
1331 #line 225 "parse-gram.y"
1332 { current_braced_code
= destructor_braced_code
; }
1336 #line 227 "parse-gram.y"
1338 symbol_list_t
*list
;
1339 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1340 symbol_destructor_set (list
->sym
, yyvsp
[-1].string
, yylsp
[-1]);
1341 symbol_list_free (yyvsp
[0].list
);
1342 current_braced_code
= action_braced_code
;
1347 #line 235 "parse-gram.y"
1348 { current_braced_code
= printer_braced_code
; }
1352 #line 237 "parse-gram.y"
1354 symbol_list_t
*list
;
1355 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1356 symbol_printer_set (list
->sym
, yyvsp
[-1].string
, list
->location
);
1357 symbol_list_free (yyvsp
[0].list
);
1358 current_braced_code
= action_braced_code
;
1363 #line 247 "parse-gram.y"
1364 { current_class
= nterm_sym
; }
1368 #line 248 "parse-gram.y"
1370 current_class
= unknown_sym
;
1371 current_type
= NULL
;
1376 #line 252 "parse-gram.y"
1377 { current_class
= token_sym
; }
1381 #line 253 "parse-gram.y"
1383 current_class
= unknown_sym
;
1384 current_type
= NULL
;
1389 #line 258 "parse-gram.y"
1391 symbol_list_t
*list
;
1392 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1393 symbol_type_set (list
->sym
, yyvsp
[-1].string
, yylsp
[-1]);
1394 symbol_list_free (yyvsp
[0].list
);
1399 #line 268 "parse-gram.y"
1401 symbol_list_t
*list
;
1403 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1405 symbol_type_set (list
->sym
, current_type
, yylsp
[-1]);
1406 symbol_precedence_set (list
->sym
, current_prec
, yyvsp
[-2].assoc
, yylsp
[-2]);
1408 symbol_list_free (yyvsp
[0].list
);
1409 current_type
= NULL
;
1414 #line 282 "parse-gram.y"
1415 { yyval
.assoc
= left_assoc
; }
1419 #line 283 "parse-gram.y"
1420 { yyval
.assoc
= right_assoc
; }
1424 #line 284 "parse-gram.y"
1425 { yyval
.assoc
= non_assoc
; }
1429 #line 288 "parse-gram.y"
1430 { current_type
= NULL
;}
1434 #line 289 "parse-gram.y"
1435 { current_type
= yyvsp
[0].string
; }
1439 #line 295 "parse-gram.y"
1440 { yyval
.list
= symbol_list_new (yyvsp
[0].symbol
, yylsp
[0]); }
1444 #line 296 "parse-gram.y"
1445 { yyval
.list
= symbol_list_prepend (yyvsp
[-1].list
, yyvsp
[0].symbol
, yylsp
[0]); }
1449 #line 302 "parse-gram.y"
1451 current_type
= yyvsp
[0].string
;
1456 #line 306 "parse-gram.y"
1458 symbol_class_set (yyvsp
[0].symbol
, current_class
, yylsp
[0]);
1459 symbol_type_set (yyvsp
[0].symbol
, current_type
, yylsp
[0]);
1464 #line 311 "parse-gram.y"
1466 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1467 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1468 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
, yylsp
[0]);
1473 #line 317 "parse-gram.y"
1475 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1476 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1477 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
, yyloc
);
1482 #line 323 "parse-gram.y"
1484 symbol_class_set (yyvsp
[-2].symbol
, current_class
, yylsp
[-2]);
1485 symbol_type_set (yyvsp
[-2].symbol
, current_type
, yylsp
[-2]);
1486 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
, yylsp
[-1]);
1487 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
, yyloc
);
1492 #line 334 "parse-gram.y"
1497 #line 336 "parse-gram.y"
1502 #line 355 "parse-gram.y"
1505 complain_at (yyloc
, _("POSIX forbids declarations in the grammar"));
1510 #line 360 "parse-gram.y"
1517 #line 366 "parse-gram.y"
1518 { current_lhs
= yyvsp
[-1].symbol
; current_lhs_location
= yylsp
[-1]; }
1522 #line 367 "parse-gram.y"
1527 #line 371 "parse-gram.y"
1528 { grammar_rule_end (yylsp
[0]); }
1532 #line 372 "parse-gram.y"
1533 { grammar_rule_end (yylsp
[0]); }
1537 #line 377 "parse-gram.y"
1538 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
1542 #line 379 "parse-gram.y"
1543 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
, yylsp
[0]); }
1547 #line 381 "parse-gram.y"
1548 { grammar_current_rule_action_append (yyvsp
[0].string
, yylsp
[0]); }
1552 #line 383 "parse-gram.y"
1553 { grammar_current_rule_prec_set (yyvsp
[0].symbol
, yylsp
[0]); }
1557 #line 385 "parse-gram.y"
1558 { grammar_current_rule_dprec_set (yyvsp
[0].integer
, yylsp
[0]); }
1562 #line 387 "parse-gram.y"
1563 { grammar_current_rule_merge_set (yyvsp
[0].string
, yylsp
[0]); }
1567 #line 391 "parse-gram.y"
1568 { yyval
.symbol
= yyvsp
[0].symbol
; }
1572 #line 392 "parse-gram.y"
1573 { yyval
.symbol
= yyvsp
[0].symbol
; }
1577 #line 393 "parse-gram.y"
1578 { yyval
.symbol
= symbol_get (yyvsp
[0].string
, yylsp
[0]); }
1582 #line 398 "parse-gram.y"
1583 { yyval
.string
= yyvsp
[0].string
; }
1587 #line 404 "parse-gram.y"
1589 yyval
.symbol
= symbol_get (yyvsp
[0].string
, yylsp
[0]);
1590 symbol_class_set (yyval
.symbol
, token_sym
, yylsp
[0]);
1595 #line 413 "parse-gram.y"
1597 yyval
.string
= yyvsp
[0].string
+ 1;
1598 yyval
.string
[strlen (yyval
.string
) - 1] = '\0';
1603 #line 421 "parse-gram.y"
1605 yyval
.string
= xstrdup ("");
1610 #line 425 "parse-gram.y"
1612 yyval
.string
= yyvsp
[0].string
;
1619 /* Line 1016 of /usr/local/share/bison/yacc.c. */
1620 #line 1621 "parse-gram.c"
1629 short *yyssp1
= yyss
- 1;
1630 YYFPRINTF (stderr
, "state stack now");
1631 while (yyssp1
!= yyssp
)
1632 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1633 YYFPRINTF (stderr
, "\n");
1640 /* Now `shift' the result of the reduction. Determine what state
1641 that goes to, based on the state we popped back to and the rule
1642 number reduced by. */
1646 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1647 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1648 yystate
= yytable
[yystate
];
1650 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1655 /*------------------------------------.
1656 | yyerrlab -- here on detecting error |
1657 `------------------------------------*/
1659 /* If not already recovering from an error, report this error. */
1664 yyn
= yypact
[yystate
];
1666 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1668 YYSIZE_T yysize
= 0;
1669 int yytype
= YYTRANSLATE (yychar
);
1674 /* Start YYX at -YYN if negative to avoid negative indexes in
1676 for (yyx
= yyn
< 0 ? -yyn
: 0;
1677 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1678 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1679 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1680 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1681 yysize
+= yystrlen (yytname
[yytype
]);
1682 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1685 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1686 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1691 for (yyx
= yyn
< 0 ? -yyn
: 0;
1692 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1694 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1696 const char *yyq
= ! yycount
? ", expecting " : " or ";
1697 yyp
= yystpcpy (yyp
, yyq
);
1698 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1703 YYSTACK_FREE (yymsg
);
1706 yyerror ("parse error; also virtual memory exhausted");
1709 #endif /* YYERROR_VERBOSE */
1710 yyerror ("parse error");
1715 /*----------------------------------------------------.
1716 | yyerrlab1 -- error raised explicitly by an action. |
1717 `----------------------------------------------------*/
1719 if (yyerrstatus
== 3)
1721 /* If just tried and failed to reuse lookahead token after an
1722 error, discard it. */
1724 /* Return failure if at end of input. */
1725 if (yychar
== YYEOF
)
1727 /* Pop the error token. */
1729 /* Pop the rest of the stack. */
1730 while (yyssp
> yyss
)
1732 YYDPRINTF ((stderr
, "Error: popping "));
1733 YYDSYMPRINT ((stderr
,
1736 YYDPRINTF ((stderr
, "\n"));
1737 yydestruct (yystos
[*yyssp
], *yyvsp
, *yylsp
);
1743 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1744 yychar
, yytname
[yychar1
]));
1745 yydestruct (yychar1
, yylval
, yylloc
);
1749 /* Else will try to reuse lookahead token after shifting the error
1752 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1756 yyn
= yypact
[yystate
];
1757 if (yyn
!= YYPACT_NINF
)
1760 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1768 /* Pop the current state because it cannot handle the error token. */
1772 YYDPRINTF ((stderr
, "Error: popping "));
1773 YYDSYMPRINT ((stderr
,
1774 yystos
[*yyssp
], *yyvsp
, *yylsp
));
1775 YYDPRINTF ((stderr
, "\n"));
1777 yydestruct (yystos
[yystate
], *yyvsp
, *yylsp
);
1785 short *yyssp1
= yyss
- 1;
1786 YYFPRINTF (stderr
, "Error: state stack now");
1787 while (yyssp1
!= yyssp
)
1788 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1789 YYFPRINTF (stderr
, "\n");
1797 YYDPRINTF ((stderr
, "Shifting error token, "));
1806 /*-------------------------------------.
1807 | yyacceptlab -- YYACCEPT comes here. |
1808 `-------------------------------------*/
1813 /*-----------------------------------.
1814 | yyabortlab -- YYABORT comes here. |
1815 `-----------------------------------*/
1821 /*----------------------------------------------.
1822 | yyoverflowlab -- parser overflow comes here. |
1823 `----------------------------------------------*/
1825 yyerror ("parser stack overflow");
1833 YYSTACK_FREE (yyss
);
1839 #line 434 "parse-gram.y"
1841 /*------------------------------------------------------------------.
1842 | When debugging the parser, display tokens' locations and values. |
1843 `------------------------------------------------------------------*/
1846 yyprint (FILE *file
,
1847 int type
, const yystype
*value
)
1853 fprintf (file
, " = '%s'", value
->string
);
1857 fprintf (file
, " = %s", value
->symbol
->tag
);
1861 fprintf (file
, " = %d", value
->integer
);
1865 fprintf (file
, " = \"%s\"", value
->string
);
1869 fprintf (file
, " = <%s>", value
->string
);
1875 fprintf (file
, " = {{ %s }}", value
->string
);
1881 gram_error (location_t
*yylloc
, const char *msg
)
1883 complain_at (*yylloc
, "%s", msg
);