1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 1
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse gram_parse
51 #define yylex gram_lex
52 #define yyerror gram_error
53 #define yylval gram_lval
54 #define yychar gram_char
55 #define yydebug gram_debug
56 #define yynerrs gram_nerrs
57 #define yylloc gram_lloc
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
71 PERCENT_DESTRUCTOR
= 263,
72 PERCENT_PRINTER
= 264,
76 PERCENT_NONASSOC
= 268,
81 PERCENT_DEFAULT_PREC
= 273,
83 PERCENT_DEFINES
= 275,
84 PERCENT_ERROR_VERBOSE
= 276,
86 PERCENT_FILE_PREFIX
= 278,
87 PERCENT_GLR_PARSER
= 279,
88 PERCENT_INITIAL_ACTION
= 280,
89 PERCENT_LEX_PARAM
= 281,
90 PERCENT_LOCATIONS
= 282,
91 PERCENT_NAME_PREFIX
= 283,
92 PERCENT_NO_LINES
= 284,
93 PERCENT_NONDETERMINISTIC_PARSER
= 285,
95 PERCENT_PARSE_PARAM
= 287,
96 PERCENT_PURE_PARSER
= 288,
97 PERCENT_SKELETON
= 289,
99 PERCENT_TOKEN_TABLE
= 291,
100 PERCENT_VERBOSE
= 292,
108 PERCENT_PERCENT
= 300,
117 #define PERCENT_TOKEN 260
118 #define PERCENT_NTERM 261
119 #define PERCENT_TYPE 262
120 #define PERCENT_DESTRUCTOR 263
121 #define PERCENT_PRINTER 264
122 #define PERCENT_UNION 265
123 #define PERCENT_LEFT 266
124 #define PERCENT_RIGHT 267
125 #define PERCENT_NONASSOC 268
126 #define PERCENT_PREC 269
127 #define PERCENT_DPREC 270
128 #define PERCENT_MERGE 271
129 #define PERCENT_DEBUG 272
130 #define PERCENT_DEFAULT_PREC 273
131 #define PERCENT_DEFINE 274
132 #define PERCENT_DEFINES 275
133 #define PERCENT_ERROR_VERBOSE 276
134 #define PERCENT_EXPECT 277
135 #define PERCENT_FILE_PREFIX 278
136 #define PERCENT_GLR_PARSER 279
137 #define PERCENT_INITIAL_ACTION 280
138 #define PERCENT_LEX_PARAM 281
139 #define PERCENT_LOCATIONS 282
140 #define PERCENT_NAME_PREFIX 283
141 #define PERCENT_NO_LINES 284
142 #define PERCENT_NONDETERMINISTIC_PARSER 285
143 #define PERCENT_OUTPUT 286
144 #define PERCENT_PARSE_PARAM 287
145 #define PERCENT_PURE_PARSER 288
146 #define PERCENT_SKELETON 289
147 #define PERCENT_START 290
148 #define PERCENT_TOKEN_TABLE 291
149 #define PERCENT_VERBOSE 292
150 #define PERCENT_YACC 293
153 #define SEMICOLON 296
157 #define PERCENT_PERCENT 300
160 #define BRACED_CODE 303
165 /* Copy the first part of user declarations. */
166 #line 32 "parse-gram.y"
170 #include "complain.h"
171 #include "conflicts.h"
175 #include "muscle_tab.h"
180 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
181 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
183 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
184 FIXME: depends on the undocumented availability of YYLLOC. */
186 #define yyerror(Msg) \
187 gram_error (&yylloc, Msg)
188 static void gram_error (location
const *, char const *);
190 #define YYPRINT(File, Type, Value) \
191 print_token_value (File, Type, &Value)
192 static void print_token_value (FILE *, int, YYSTYPE
const *);
194 static void add_param (char const *, char *, location
);
196 symbol_class current_class
= unknown_sym
;
197 uniqstr current_type
= 0;
199 location current_lhs_location
;
201 int current_prec
= 0;
204 /* Enabling traces. */
209 /* Enabling verbose error messages. */
210 #ifdef YYERROR_VERBOSE
211 # undef YYERROR_VERBOSE
212 # define YYERROR_VERBOSE 1
214 # define YYERROR_VERBOSE 1
217 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
218 #line 80 "parse-gram.y"
219 typedef union YYSTYPE
{
227 /* Line 191 of yacc.c. */
228 #line 229 "parse-gram.c"
229 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
230 # define YYSTYPE_IS_DECLARED 1
231 # define YYSTYPE_IS_TRIVIAL 1
234 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
235 typedef struct YYLTYPE
242 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
243 # define YYLTYPE_IS_DECLARED 1
244 # define YYLTYPE_IS_TRIVIAL 1
248 /* Copy the second part of user declarations. */
251 /* Line 214 of yacc.c. */
252 #line 253 "parse-gram.c"
254 #if ! defined (yyoverflow) || YYERROR_VERBOSE
260 # define YYMALLOC malloc
263 /* The parser invokes alloca or malloc; define the necessary symbols. */
265 # ifdef YYSTACK_USE_ALLOCA
266 # if YYSTACK_USE_ALLOCA
267 # define YYSTACK_ALLOC alloca
270 # if defined (alloca) || defined (_ALLOCA_H)
271 # define YYSTACK_ALLOC alloca
274 # define YYSTACK_ALLOC __builtin_alloca
279 # ifdef YYSTACK_ALLOC
280 /* Pacify GCC's `empty if-body' warning. */
281 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
283 # if defined (__STDC__) || defined (__cplusplus)
284 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
285 # define YYSIZE_T size_t
287 # define YYSTACK_ALLOC YYMALLOC
288 # define YYSTACK_FREE YYFREE
290 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
293 #if (! defined (yyoverflow) \
294 && (! defined (__cplusplus) \
295 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
296 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
298 /* A type that is properly aligned for any stack member. */
306 /* The size of the maximum gap between one aligned stack and the next. */
307 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
309 /* The size of an array large to enough to hold all stacks, each with
311 # define YYSTACK_BYTES(N) \
312 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
313 + 2 * YYSTACK_GAP_MAXIMUM)
315 /* Copy COUNT objects from FROM to TO. The source and destination do
318 # if defined (__GNUC__) && 1 < __GNUC__
319 # define YYCOPY(To, From, Count) \
320 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
322 # define YYCOPY(To, From, Count) \
325 register YYSIZE_T yyi; \
326 for (yyi = 0; yyi < (Count); yyi++) \
327 (To)[yyi] = (From)[yyi]; \
333 /* Relocate STACK from its old location to the new one. The
334 local variables YYSIZE and YYSTACKSIZE give the old and new number of
335 elements in the stack, and YYPTR gives the new location of the
336 stack. Advance YYPTR to a properly aligned location for the next
338 # define YYSTACK_RELOCATE(Stack) \
341 YYSIZE_T yynewbytes; \
342 YYCOPY (&yyptr->Stack, Stack, yysize); \
343 Stack = &yyptr->Stack; \
344 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
345 yyptr += yynewbytes / sizeof (*yyptr); \
351 #if defined (__STDC__) || defined (__cplusplus)
352 typedef signed char yysigned_char
;
354 typedef short yysigned_char
;
357 /* YYFINAL -- State number of the termination state. */
359 /* YYLAST -- Last index in YYTABLE. */
362 /* YYNTOKENS -- Number of terminals. */
364 /* YYNNTS -- Number of nonterminals. */
366 /* YYNRULES -- Number of rules. */
368 /* YYNRULES -- Number of states. */
369 #define YYNSTATES 106
371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
373 #define YYMAXUTOK 303
375 #define YYTRANSLATE(YYX) \
376 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : 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, 12, 14, 16, 18, 22,
420 24, 26, 29, 33, 35, 37, 39, 41, 45, 47,
421 49, 53, 55, 57, 60, 62, 64, 66, 68, 70,
422 72, 75, 77, 80, 83, 86, 87, 91, 92, 96,
423 100, 104, 106, 108, 110, 111, 113, 115, 118, 120,
424 122, 125, 128, 132, 134, 137, 139, 142, 144, 147,
425 150, 151, 155, 157, 161, 164, 165, 168, 171, 175,
426 179, 183, 185, 187, 189, 191, 193, 194
429 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
430 static const yysigned_char yyrhs
[] =
432 50, 0, -1, 51, 45, 63, 73, -1, -1, 51,
433 52, -1, 53, -1, 46, -1, 17, -1, 19, 72,
434 72, -1, 20, -1, 21, -1, 22, 4, -1, 23,
435 40, 72, -1, 24, -1, 25, -1, 26, -1, 27,
436 -1, 28, 40, 72, -1, 29, -1, 30, -1, 31,
437 40, 72, -1, 32, -1, 33, -1, 34, 72, -1,
438 36, -1, 37, -1, 38, -1, 41, -1, 57, -1,
439 54, -1, 35, 69, -1, 10, -1, 8, 60, -1,
440 9, 60, -1, 18, 4, -1, -1, 6, 55, 62,
441 -1, -1, 5, 56, 62, -1, 7, 39, 60, -1,
442 58, 59, 60, -1, 11, -1, 12, -1, 13, -1,
443 -1, 39, -1, 69, -1, 60, 69, -1, 39, -1,
444 43, -1, 43, 4, -1, 43, 71, -1, 43, 4,
445 71, -1, 61, -1, 62, 61, -1, 64, -1, 63,
446 64, -1, 65, -1, 53, 41, -1, 1, 41, -1,
447 -1, 44, 66, 67, -1, 68, -1, 67, 42, 68,
448 -1, 67, 41, -1, -1, 68, 69, -1, 68, 70,
449 -1, 68, 14, 69, -1, 68, 15, 4, -1, 68,
450 16, 39, -1, 43, -1, 71, -1, 48, -1, 3,
451 -1, 3, -1, -1, 45, 47, -1
454 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
455 static const unsigned short yyrline
[] =
457 0, 171, 171, 179, 181, 185, 186, 187, 188, 189,
458 190, 191, 192, 193, 198, 202, 203, 204, 205, 206,
459 207, 208, 209, 210, 211, 212, 213, 214, 218, 219,
460 220, 224, 230, 237, 244, 254, 254, 259, 259, 264,
461 274, 289, 290, 291, 295, 296, 302, 303, 308, 312,
462 317, 323, 329, 340, 341, 350, 351, 357, 358, 363,
463 370, 370, 374, 375, 376, 381, 382, 384, 386, 388,
464 390, 395, 396, 400, 406, 415, 422, 424
468 #if YYDEBUG || YYERROR_VERBOSE
469 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
470 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
471 static const char *const yytname
[] =
473 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
474 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
475 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
476 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
477 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
478 "\"%expect\"", "\"%file-prefix\"", "\"%glr-parser\"",
479 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
480 "\"%name-prefix\"", "\"%no-lines\"", "\"%nondeterministic-parser\"",
481 "\"%output\"", "\"%parse-param {...}\"", "\"%pure-parser\"",
482 "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
483 "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"", "\"identifier\"",
484 "\"identifier:\"", "\"%%\"", "\"%{...%}\"", "\"epilogue\"", "\"{...}\"",
485 "$accept", "input", "declarations", "declaration", "grammar_declaration",
486 "symbol_declaration", "@1", "@2", "precedence_declaration",
487 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
488 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
489 "@3", "rhses.1", "rhs", "symbol", "action", "string_as_id",
490 "string_content", "epilogue.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, 303
507 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
508 static const unsigned char yyr1
[] =
510 0, 49, 50, 51, 51, 52, 52, 52, 52, 52,
511 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
512 52, 52, 52, 52, 52, 52, 52, 52, 53, 53,
513 53, 53, 53, 53, 53, 55, 54, 56, 54, 54,
514 57, 58, 58, 58, 59, 59, 60, 60, 61, 61,
515 61, 61, 61, 62, 62, 63, 63, 64, 64, 64,
516 66, 65, 67, 67, 67, 68, 68, 68, 68, 68,
517 68, 69, 69, 70, 71, 72, 73, 73
520 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
521 static const unsigned char yyr2
[] =
523 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
524 1, 2, 3, 1, 1, 1, 1, 3, 1, 1,
525 3, 1, 1, 2, 1, 1, 1, 1, 1, 1,
526 2, 1, 2, 2, 2, 0, 3, 0, 3, 3,
527 3, 1, 1, 1, 0, 1, 1, 2, 1, 1,
528 2, 2, 3, 1, 2, 1, 2, 1, 2, 2,
529 0, 3, 1, 3, 2, 0, 2, 2, 3, 3,
530 3, 1, 1, 1, 1, 1, 0, 2
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, 37, 35, 0, 0, 0, 31,
539 41, 42, 43, 7, 0, 0, 9, 10, 0, 0,
540 13, 14, 15, 16, 0, 18, 19, 0, 21, 22,
541 0, 0, 24, 25, 26, 27, 0, 6, 4, 5,
542 29, 28, 44, 0, 0, 0, 74, 71, 32, 46,
543 72, 33, 34, 75, 0, 11, 0, 0, 0, 23,
544 30, 0, 60, 0, 0, 55, 57, 45, 0, 48,
545 49, 53, 38, 36, 39, 47, 8, 12, 17, 20,
546 59, 65, 58, 0, 56, 2, 40, 50, 51, 54,
547 61, 62, 77, 52, 64, 65, 0, 0, 0, 73,
548 66, 67, 63, 68, 69, 70
551 /* YYDEFGOTO[NTERM-NUM]. */
552 static const yysigned_char yydefgoto
[] =
554 -1, 1, 2, 38, 63, 40, 44, 43, 41, 42,
555 68, 48, 71, 72, 64, 65, 66, 81, 90, 91,
559 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
561 #define YYPACT_NINF -63
562 static const yysigned_char yypact
[] =
564 -63, 12, 107, -63, -63, -63, -18, 1, 1, -63,
565 -63, -63, -63, -63, 28, 31, -63, -63, 33, -5,
566 -63, -63, -63, -63, 0, -63, -63, 5, -63, -63,
567 31, 1, -63, -63, -63, -63, 67, -63, -63, -63,
568 -63, -63, 13, -36, -36, 1, -63, -63, 1, -63,
569 -63, 1, -63, -63, 31, -63, 31, 31, 31, -63,
570 -63, -2, -63, 10, 18, -63, -63, -63, 1, -63,
571 2, -63, -36, -36, 1, -63, -63, -63, -63, -63,
572 -63, -63, -63, -6, -63, -63, 1, 51, -63, -63,
573 -33, -1, -63, -63, -63, -63, 1, 52, 19, -63,
574 -63, -63, -1, -63, -63, -63
577 /* YYPGOTO[NTERM-NUM]. */
578 static const yysigned_char yypgoto
[] =
580 -63, -63, -63, -63, 55, -63, -63, -63, -63, -63,
581 -63, -7, -62, 15, -63, 3, -63, -63, -63, -29,
582 -31, -63, -54, -8, -63
585 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
586 positive, shift that token. If negative, reduce the rule which
587 number is the opposite. If zero, do what YYDEFACT says.
588 If YYTABLE_NINF, syntax error. */
589 #define YYTABLE_NINF -77
590 static const yysigned_char yytable
[] =
592 60, 51, 46, 69, 46, 46, 87, 70, 94, 95,
593 89, 89, 3, 96, 97, 98, 88, 75, -76, 61,
594 75, 45, 59, 4, 5, 6, 7, 8, 9, 10,
595 11, 12, 52, 93, 53, 56, 14, 55, 74, 80,
596 57, 92, 47, 75, 47, 58, 76, 99, 77, 78,
597 79, 82, 67, 31, 46, 75, 104, 39, 105, 73,
598 100, 86, 62, 83, 0, 103, 102, 84, 61, 0,
599 0, 100, 4, 5, 6, 7, 8, 9, 10, 11,
600 12, 0, 0, 0, 0, 14, 0, 0, 0, 0,
601 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
602 0, 0, 31, 0, 0, 0, 0, 0, 0, 0,
603 0, 62, 4, 5, 6, 7, 8, 9, 10, 11,
604 12, 0, 0, 0, 13, 14, 15, 16, 17, 18,
605 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
606 29, 30, 31, 32, 33, 34, 0, 0, 35, 0,
610 static const yysigned_char yycheck
[] =
612 31, 8, 3, 39, 3, 3, 4, 43, 41, 42,
613 72, 73, 0, 14, 15, 16, 70, 48, 0, 1,
614 51, 39, 30, 5, 6, 7, 8, 9, 10, 11,
615 12, 13, 4, 87, 3, 40, 18, 4, 45, 41,
616 40, 47, 43, 74, 43, 40, 54, 48, 56, 57,
617 58, 41, 39, 35, 3, 86, 4, 2, 39, 44,
618 91, 68, 44, 45, -1, 96, 95, 64, 1, -1,
619 -1, 102, 5, 6, 7, 8, 9, 10, 11, 12,
620 13, -1, -1, -1, -1, 18, -1, -1, -1, -1,
621 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
622 -1, -1, 35, -1, -1, -1, -1, -1, -1, -1,
623 -1, 44, 5, 6, 7, 8, 9, 10, 11, 12,
624 13, -1, -1, -1, 17, 18, 19, 20, 21, 22,
625 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
626 33, 34, 35, 36, 37, 38, -1, -1, 41, -1,
630 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
631 symbol of state STATE-NUM. */
632 static const unsigned char yystos
[] =
634 0, 50, 51, 0, 5, 6, 7, 8, 9, 10,
635 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
636 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
637 34, 35, 36, 37, 38, 41, 45, 46, 52, 53,
638 54, 57, 58, 56, 55, 39, 3, 43, 60, 69,
639 71, 60, 4, 3, 72, 4, 40, 40, 40, 72,
640 69, 1, 44, 53, 63, 64, 65, 39, 59, 39,
641 43, 61, 62, 62, 60, 69, 72, 72, 72, 72,
642 41, 66, 41, 45, 64, 73, 60, 4, 71, 61,
643 67, 68, 47, 71, 41, 42, 14, 15, 16, 48,
644 69, 70, 68, 69, 4, 39
647 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
648 # define YYSIZE_T __SIZE_TYPE__
650 #if ! defined (YYSIZE_T) && defined (size_t)
651 # define YYSIZE_T size_t
653 #if ! defined (YYSIZE_T)
654 # if defined (__STDC__) || defined (__cplusplus)
655 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
656 # define YYSIZE_T size_t
659 #if ! defined (YYSIZE_T)
660 # define YYSIZE_T unsigned int
663 #define yyerrok (yyerrstatus = 0)
664 #define yyclearin (yychar = YYEMPTY)
668 #define YYACCEPT goto yyacceptlab
669 #define YYABORT goto yyabortlab
670 #define YYERROR goto yyerrorlab
673 /* Like YYERROR except do call yyerror. This remains here temporarily
674 to ease the transition to the new meaning of YYERROR, for GCC.
675 Once GCC version 2 has supplanted version 1, this can go. */
677 #define YYFAIL goto yyerrlab
679 #define YYRECOVERING() (!!yyerrstatus)
681 #define YYBACKUP(Token, Value) \
683 if (yychar == YYEMPTY && yylen == 1) \
687 yytoken = YYTRANSLATE (yychar); \
693 yyerror ("syntax error: cannot back up");\
699 #define YYERRCODE 256
701 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
704 #ifndef YYLLOC_DEFAULT
705 # define YYLLOC_DEFAULT(Current, Rhs, N) \
706 ((Current).first_line = (Rhs)[1].first_line, \
707 (Current).first_column = (Rhs)[1].first_column, \
708 (Current).last_line = (Rhs)[N].last_line, \
709 (Current).last_column = (Rhs)[N].last_column)
712 /* YYLEX -- calling `yylex' with the right arguments. */
715 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
717 # define YYLEX yylex (&yylval, &yylloc)
720 /* Enable debugging if requested. */
724 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
725 # define YYFPRINTF fprintf
728 # define YYDPRINTF(Args) \
734 # define YYDSYMPRINT(Args) \
740 # define YYDSYMPRINTF(Title, Token, Value, Location) \
744 YYFPRINTF (stderr, "%s ", Title); \
745 yysymprint (stderr, \
746 Token, Value, Location); \
747 YYFPRINTF (stderr, "\n"); \
751 /*------------------------------------------------------------------.
752 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
754 `------------------------------------------------------------------*/
756 #if defined (__STDC__) || defined (__cplusplus)
758 yy_stack_print (short *bottom
, short *top
)
761 yy_stack_print (bottom
, top
)
766 YYFPRINTF (stderr
, "Stack now");
767 for (/* Nothing. */; bottom
<= top
; ++bottom
)
768 YYFPRINTF (stderr
, " %d", *bottom
);
769 YYFPRINTF (stderr
, "\n");
772 # define YY_STACK_PRINT(Bottom, Top) \
775 yy_stack_print ((Bottom), (Top)); \
779 /*------------------------------------------------.
780 | Report that the YYRULE is going to be reduced. |
781 `------------------------------------------------*/
783 #if defined (__STDC__) || defined (__cplusplus)
785 yy_reduce_print (int yyrule
)
788 yy_reduce_print (yyrule
)
793 unsigned int yylno
= yyrline
[yyrule
];
794 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
796 /* Print the symbols being reduced, and their result. */
797 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
798 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
799 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
802 # define YY_REDUCE_PRINT(Rule) \
805 yy_reduce_print (Rule); \
808 /* Nonzero means print parse trace. It is left uninitialized so that
809 multiple parsers can coexist. */
812 # define YYDPRINTF(Args)
813 # define YYDSYMPRINT(Args)
814 # define YYDSYMPRINTF(Title, Token, Value, Location)
815 # define YY_STACK_PRINT(Bottom, Top)
816 # define YY_REDUCE_PRINT(Rule)
817 #endif /* !YYDEBUG */
820 /* YYINITDEPTH -- initial size of the parser's stacks. */
822 # define YYINITDEPTH 200
825 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
826 if the built-in stack extension method is used).
828 Do not make this value too large; the results are undefined if
829 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
830 evaluated with infinite-precision integer arithmetic. */
832 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
837 # define YYMAXDEPTH 10000
845 # if defined (__GLIBC__) && defined (_STRING_H)
846 # define yystrlen strlen
848 /* Return the length of YYSTR. */
850 # if defined (__STDC__) || defined (__cplusplus)
851 yystrlen (const char *yystr
)
857 register const char *yys
= yystr
;
859 while (*yys
++ != '\0')
862 return yys
- yystr
- 1;
868 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
869 # define yystpcpy stpcpy
871 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
874 # if defined (__STDC__) || defined (__cplusplus)
875 yystpcpy (char *yydest
, const char *yysrc
)
877 yystpcpy (yydest
, yysrc
)
882 register char *yyd
= yydest
;
883 register const char *yys
= yysrc
;
885 while ((*yyd
++ = *yys
++) != '\0')
893 #endif /* !YYERROR_VERBOSE */
898 /*--------------------------------.
899 | Print this symbol on YYOUTPUT. |
900 `--------------------------------*/
902 #if defined (__STDC__) || defined (__cplusplus)
904 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
907 yysymprint (yyoutput
, yytype
, yyvaluep
, yylocationp
)
911 YYLTYPE
*yylocationp
;
914 /* Pacify ``unused variable'' warnings. */
918 if (yytype
< YYNTOKENS
)
920 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
922 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
926 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
933 YYFPRINTF (yyoutput
, ")");
936 #endif /* ! YYDEBUG */
937 /*-----------------------------------------------.
938 | Release the memory associated to this symbol. |
939 `-----------------------------------------------*/
941 #if defined (__STDC__) || defined (__cplusplus)
943 yydestruct (int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
946 yydestruct (yytype
, yyvaluep
, yylocationp
)
949 YYLTYPE
*yylocationp
;
952 /* Pacify ``unused variable'' warnings. */
965 /* Prevent warnings from -Wmissing-prototypes. */
968 # if defined (__STDC__) || defined (__cplusplus)
969 int yyparse (void *YYPARSE_PARAM
);
973 #else /* ! YYPARSE_PARAM */
974 #if defined (__STDC__) || defined (__cplusplus)
979 #endif /* ! YYPARSE_PARAM */
991 # if defined (__STDC__) || defined (__cplusplus)
992 int yyparse (void *YYPARSE_PARAM
)
994 int yyparse (YYPARSE_PARAM
)
997 #else /* ! YYPARSE_PARAM */
998 #if defined (__STDC__) || defined (__cplusplus)
1008 /* The lookahead symbol. */
1011 /* The semantic value of the lookahead symbol. */
1014 /* Number of syntax errors so far. */
1016 /* Location data for the lookahead symbol. */
1019 register int yystate
;
1022 /* Number of tokens to shift before error messages enabled. */
1024 /* Lookahead token as an internal (translated) token number. */
1027 /* Three stacks and their tools:
1028 `yyss': related to states,
1029 `yyvs': related to semantic values,
1030 `yyls': related to locations.
1032 Refer to the stacks thru separate pointers, to allow yyoverflow
1033 to reallocate them elsewhere. */
1035 /* The state stack. */
1036 short yyssa
[YYINITDEPTH
];
1037 short *yyss
= yyssa
;
1038 register short *yyssp
;
1040 /* The semantic value stack. */
1041 YYSTYPE yyvsa
[YYINITDEPTH
];
1042 YYSTYPE
*yyvs
= yyvsa
;
1043 register YYSTYPE
*yyvsp
;
1045 /* The location stack. */
1046 YYLTYPE yylsa
[YYINITDEPTH
];
1047 YYLTYPE
*yyls
= yylsa
;
1051 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1053 YYSIZE_T yystacksize
= YYINITDEPTH
;
1055 /* The variables used to return semantic value and location from the
1060 /* When reducing, the number of symbols on the RHS of the reduced
1064 YYDPRINTF ((stderr
, "Starting parse\n"));
1069 yychar
= YYEMPTY
; /* Cause a token to be read. */
1071 /* Initialize stack pointers.
1072 Waste one element of value and location stack
1073 so that they stay on the same level as the state stack.
1074 The wasted elements are never initialized. */
1080 /* User initialization code. */
1081 #line 70 "parse-gram.y"
1083 /* Bison's grammar can initial empty locations, hence a default
1084 location is needed. */
1085 (*yylsp
).start
.file
= (*yylsp
).end
.file
= current_file
;
1086 (*yylsp
).start
.line
= (*yylsp
).end
.line
= 1;
1087 (*yylsp
).start
.column
= (*yylsp
).end
.column
= 0;
1089 /* Line 818 of yacc.c. */
1090 #line 1091 "parse-gram.c"
1093 /*------------------------------------------------------------.
1094 | yynewstate -- Push a new state, which is found in yystate. |
1095 `------------------------------------------------------------*/
1097 /* In all cases, when you get here, the value and location stacks
1098 have just been pushed. so pushing a state here evens the stacks.
1105 if (yyss
+ yystacksize
- 1 <= yyssp
)
1107 /* Get the current used size of the three stacks, in elements. */
1108 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1112 /* Give user a chance to reallocate the stack. Use copies of
1113 these so that the &'s don't force the real ones into
1115 YYSTYPE
*yyvs1
= yyvs
;
1116 short *yyss1
= yyss
;
1117 YYLTYPE
*yyls1
= yyls
;
1119 /* Each stack pointer address is followed by the size of the
1120 data in use in that stack, in bytes. This used to be a
1121 conditional around just the two extra args, but that might
1122 be undefined if yyoverflow is a macro. */
1123 yyoverflow ("parser stack overflow",
1124 &yyss1
, yysize
* sizeof (*yyssp
),
1125 &yyvs1
, yysize
* sizeof (*yyvsp
),
1126 &yyls1
, yysize
* sizeof (*yylsp
),
1132 #else /* no yyoverflow */
1133 # ifndef YYSTACK_RELOCATE
1136 /* Extend the stack our own way. */
1137 if (YYMAXDEPTH
<= yystacksize
)
1140 if (YYMAXDEPTH
< yystacksize
)
1141 yystacksize
= YYMAXDEPTH
;
1144 short *yyss1
= yyss
;
1145 union yyalloc
*yyptr
=
1146 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1149 YYSTACK_RELOCATE (yyss
);
1150 YYSTACK_RELOCATE (yyvs
);
1151 YYSTACK_RELOCATE (yyls
);
1152 # undef YYSTACK_RELOCATE
1154 YYSTACK_FREE (yyss1
);
1157 #endif /* no yyoverflow */
1159 yyssp
= yyss
+ yysize
- 1;
1160 yyvsp
= yyvs
+ yysize
- 1;
1161 yylsp
= yyls
+ yysize
- 1;
1163 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1164 (unsigned long int) yystacksize
));
1166 if (yyss
+ yystacksize
- 1 <= yyssp
)
1170 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1179 /* Do appropriate processing given the current state. */
1180 /* Read a lookahead token if we need one and don't already have one. */
1183 /* First try to decide what to do without reference to lookahead token. */
1185 yyn
= yypact
[yystate
];
1186 if (yyn
== YYPACT_NINF
)
1189 /* Not known => get a lookahead token if don't already have one. */
1191 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1192 if (yychar
== YYEMPTY
)
1194 YYDPRINTF ((stderr
, "Reading a token: "));
1198 if (yychar
<= YYEOF
)
1200 yychar
= yytoken
= YYEOF
;
1201 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1205 yytoken
= YYTRANSLATE (yychar
);
1206 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1209 /* If the proper action on seeing token YYTOKEN is to reduce or to
1210 detect an error, take that action. */
1212 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1217 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1226 /* Shift the lookahead token. */
1227 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1229 /* Discard the token being shifted unless it is eof. */
1230 if (yychar
!= YYEOF
)
1236 /* Count tokens shifted since error; after three, turn off error
1245 /*-----------------------------------------------------------.
1246 | yydefault -- do the default action for the current state. |
1247 `-----------------------------------------------------------*/
1249 yyn
= yydefact
[yystate
];
1255 /*-----------------------------.
1256 | yyreduce -- Do a reduction. |
1257 `-----------------------------*/
1259 /* yyn is the number of a rule to reduce with. */
1262 /* If YYLEN is nonzero, implement the default value of the action:
1265 Otherwise, the following line sets YYVAL to garbage.
1266 This behavior is undocumented and Bison
1267 users should not rely upon it. Assigning to YYVAL
1268 unconditionally makes the parser a bit smaller, and it avoids a
1269 GCC warning that YYVAL may be used uninitialized. */
1270 yyval
= yyvsp
[1-yylen
];
1272 /* Default location. */
1273 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);
1274 YY_REDUCE_PRINT (yyn
);
1278 #line 186 "parse-gram.y"
1279 { prologue_augment (yyvsp
[0].chars
, yylsp
[0]); }
1283 #line 187 "parse-gram.y"
1284 { debug_flag
= true; }
1288 #line 188 "parse-gram.y"
1289 { muscle_insert (yyvsp
[-1].chars
, yyvsp
[0].chars
); }
1293 #line 189 "parse-gram.y"
1294 { defines_flag
= true; }
1298 #line 190 "parse-gram.y"
1299 { error_verbose
= true; }
1303 #line 191 "parse-gram.y"
1304 { expected_conflicts
= yyvsp
[0].integer
; }
1308 #line 192 "parse-gram.y"
1309 { spec_file_prefix
= yyvsp
[0].chars
; }
1313 #line 194 "parse-gram.y"
1315 nondeterministic_parser
= true;
1321 #line 199 "parse-gram.y"
1323 muscle_code_grow ("initial_action", yyvsp
[0].chars
, yylsp
[0]);
1328 #line 202 "parse-gram.y"
1329 { add_param ("lex_param", yyvsp
[0].chars
, yylsp
[0]); }
1333 #line 203 "parse-gram.y"
1334 { locations_flag
= true; }
1338 #line 204 "parse-gram.y"
1339 { spec_name_prefix
= yyvsp
[0].chars
; }
1343 #line 205 "parse-gram.y"
1344 { no_lines_flag
= true; }
1348 #line 206 "parse-gram.y"
1349 { nondeterministic_parser
= true; }
1353 #line 207 "parse-gram.y"
1354 { spec_outfile
= yyvsp
[0].chars
; }
1358 #line 208 "parse-gram.y"
1359 { add_param ("parse_param", yyvsp
[0].chars
, yylsp
[0]); }
1363 #line 209 "parse-gram.y"
1364 { pure_parser
= true; }
1368 #line 210 "parse-gram.y"
1369 { skeleton
= yyvsp
[0].chars
; }
1373 #line 211 "parse-gram.y"
1374 { token_table_flag
= true; }
1378 #line 212 "parse-gram.y"
1379 { report_flag
= report_states
; }
1383 #line 213 "parse-gram.y"
1384 { yacc_flag
= true; }
1388 #line 221 "parse-gram.y"
1390 grammar_start_symbol_set (yyvsp
[0].symbol
, yylsp
[0]);
1395 #line 225 "parse-gram.y"
1398 MUSCLE_INSERT_INT ("stype_line", yylsp
[0].start
.line
);
1399 muscle_insert ("stype", yyvsp
[0].chars
);
1404 #line 231 "parse-gram.y"
1407 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1408 symbol_destructor_set (list
->sym
, yyvsp
[-1].chars
, yylsp
[-1]);
1409 symbol_list_free (yyvsp
[0].list
);
1414 #line 238 "parse-gram.y"
1417 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1418 symbol_printer_set (list
->sym
, yyvsp
[-1].chars
, list
->location
);
1419 symbol_list_free (yyvsp
[0].list
);
1424 #line 245 "parse-gram.y"
1426 if (0 <= yyvsp
[0].integer
&& yyvsp
[0].integer
<= 1)
1427 default_prec
= yyvsp
[0].integer
;
1429 complain_at (yylsp
[-1], _("invalid value for `%default-prec'"));
1434 #line 254 "parse-gram.y"
1435 { current_class
= nterm_sym
; }
1439 #line 255 "parse-gram.y"
1441 current_class
= unknown_sym
;
1442 current_type
= NULL
;
1447 #line 259 "parse-gram.y"
1448 { current_class
= token_sym
; }
1452 #line 260 "parse-gram.y"
1454 current_class
= unknown_sym
;
1455 current_type
= NULL
;
1460 #line 265 "parse-gram.y"
1463 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1464 symbol_type_set (list
->sym
, yyvsp
[-1].uniqstr
, yylsp
[-1]);
1465 symbol_list_free (yyvsp
[0].list
);
1470 #line 275 "parse-gram.y"
1474 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1476 symbol_type_set (list
->sym
, current_type
, yylsp
[-1]);
1477 symbol_precedence_set (list
->sym
, current_prec
, yyvsp
[-2].assoc
, yylsp
[-2]);
1479 symbol_list_free (yyvsp
[0].list
);
1480 current_type
= NULL
;
1485 #line 289 "parse-gram.y"
1486 { yyval
.assoc
= left_assoc
; }
1490 #line 290 "parse-gram.y"
1491 { yyval
.assoc
= right_assoc
; }
1495 #line 291 "parse-gram.y"
1496 { yyval
.assoc
= non_assoc
; }
1500 #line 295 "parse-gram.y"
1501 { current_type
= NULL
; }
1505 #line 296 "parse-gram.y"
1506 { current_type
= yyvsp
[0].uniqstr
; }
1510 #line 302 "parse-gram.y"
1511 { yyval
.list
= symbol_list_new (yyvsp
[0].symbol
, yylsp
[0]); }
1515 #line 303 "parse-gram.y"
1516 { yyval
.list
= symbol_list_prepend (yyvsp
[-1].list
, yyvsp
[0].symbol
, yylsp
[0]); }
1520 #line 309 "parse-gram.y"
1522 current_type
= yyvsp
[0].uniqstr
;
1527 #line 313 "parse-gram.y"
1529 symbol_class_set (yyvsp
[0].symbol
, current_class
, yylsp
[0]);
1530 symbol_type_set (yyvsp
[0].symbol
, current_type
, yylsp
[0]);
1535 #line 318 "parse-gram.y"
1537 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1538 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1539 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
, yylsp
[0]);
1544 #line 324 "parse-gram.y"
1546 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1547 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1548 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
, yyloc
);
1553 #line 330 "parse-gram.y"
1555 symbol_class_set (yyvsp
[-2].symbol
, current_class
, yylsp
[-2]);
1556 symbol_type_set (yyvsp
[-2].symbol
, current_type
, yylsp
[-2]);
1557 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
, yylsp
[-1]);
1558 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
, yyloc
);
1563 #line 359 "parse-gram.y"
1566 complain_at (yyloc
, _("POSIX forbids declarations in the grammar"));
1571 #line 364 "parse-gram.y"
1578 #line 370 "parse-gram.y"
1579 { current_lhs
= yyvsp
[0].symbol
; current_lhs_location
= yylsp
[0]; }
1583 #line 374 "parse-gram.y"
1584 { grammar_rule_end (yylsp
[0]); }
1588 #line 375 "parse-gram.y"
1589 { grammar_rule_end (yylsp
[0]); }
1593 #line 381 "parse-gram.y"
1594 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
1598 #line 383 "parse-gram.y"
1599 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
, yylsp
[0]); }
1603 #line 385 "parse-gram.y"
1604 { grammar_current_rule_action_append (yyvsp
[0].chars
, yylsp
[0]); }
1608 #line 387 "parse-gram.y"
1609 { grammar_current_rule_prec_set (yyvsp
[0].symbol
, yylsp
[0]); }
1613 #line 389 "parse-gram.y"
1614 { grammar_current_rule_dprec_set (yyvsp
[0].integer
, yylsp
[0]); }
1618 #line 391 "parse-gram.y"
1619 { grammar_current_rule_merge_set (yyvsp
[0].uniqstr
, yylsp
[0]); }
1623 #line 395 "parse-gram.y"
1624 { yyval
.symbol
= yyvsp
[0].symbol
; }
1628 #line 396 "parse-gram.y"
1629 { yyval
.symbol
= yyvsp
[0].symbol
; }
1633 #line 401 "parse-gram.y"
1634 { yyval
.chars
= yyvsp
[0].chars
; }
1638 #line 407 "parse-gram.y"
1640 yyval
.symbol
= symbol_get (yyvsp
[0].chars
, yylsp
[0]);
1641 symbol_class_set (yyval
.symbol
, token_sym
, yylsp
[0]);
1646 #line 416 "parse-gram.y"
1648 yyval
.chars
= yyvsp
[0].chars
+ 1;
1649 yyval
.chars
[strlen (yyval
.chars
) - 1] = '\0';
1654 #line 425 "parse-gram.y"
1656 muscle_code_grow ("epilogue", yyvsp
[0].chars
, yylsp
[0]);
1657 scanner_last_string_free ();
1664 /* Line 1010 of yacc.c. */
1665 #line 1666 "parse-gram.c"
1671 YY_STACK_PRINT (yyss
, yyssp
);
1676 /* Now `shift' the result of the reduction. Determine what state
1677 that goes to, based on the state we popped back to and the rule
1678 number reduced by. */
1682 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1683 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1684 yystate
= yytable
[yystate
];
1686 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1691 /*------------------------------------.
1692 | yyerrlab -- here on detecting error |
1693 `------------------------------------*/
1695 /* If not already recovering from an error, report this error. */
1700 yyn
= yypact
[yystate
];
1702 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1704 YYSIZE_T yysize
= 0;
1705 int yytype
= YYTRANSLATE (yychar
);
1706 const char* yyprefix
;
1710 /* Start YYX at -YYN if negative to avoid negative indexes in
1712 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1714 /* Stay within bounds of both yycheck and yytname. */
1715 int yychecklim
= YYLAST
- yyn
;
1716 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1719 yyprefix
= ", expecting ";
1720 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1721 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1723 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1731 yysize
+= (sizeof ("syntax error, unexpected ")
1732 + yystrlen (yytname
[yytype
]));
1733 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1736 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1737 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1741 yyprefix
= ", expecting ";
1742 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1743 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1745 yyp
= yystpcpy (yyp
, yyprefix
);
1746 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1751 YYSTACK_FREE (yymsg
);
1754 yyerror ("syntax error; also virtual memory exhausted");
1757 #endif /* YYERROR_VERBOSE */
1758 yyerror ("syntax error");
1763 if (yyerrstatus
== 3)
1765 /* If just tried and failed to reuse lookahead token after an
1766 error, discard it. */
1768 if (yychar
<= YYEOF
)
1770 /* If at end of input, pop the error token,
1771 then the rest of the stack, then return failure. */
1772 if (yychar
== YYEOF
)
1778 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1779 yydestruct (yystos
[*yyssp
], yyvsp
, yylsp
);
1784 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1785 yydestruct (yytoken
, &yylval
, &yylloc
);
1787 *++yylerrsp
= yylloc
;
1791 /* Else will try to reuse lookahead token after shifting the error
1796 /*---------------------------------------------------.
1797 | yyerrorlab -- error raised explicitly by YYERROR. |
1798 `---------------------------------------------------*/
1802 /* Pacify GCC when the user code never invokes YYERROR and the label
1803 yyerrorlab therefore never appears in user code. */
1812 *++yylerrsp
= yyloc
;
1817 /*-------------------------------------------------------------.
1818 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1819 `-------------------------------------------------------------*/
1821 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1825 yyn
= yypact
[yystate
];
1826 if (yyn
!= YYPACT_NINF
)
1829 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1837 /* Pop the current state because it cannot handle the error token. */
1841 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1842 yydestruct (yystos
[yystate
], yyvsp
, yylsp
);
1845 YY_STACK_PRINT (yyss
, yyssp
);
1851 YYDPRINTF ((stderr
, "Shifting error token, "));
1854 YYLLOC_DEFAULT (yyloc
, yylsp
, yylerrsp
- yylsp
);
1861 /*-------------------------------------.
1862 | yyacceptlab -- YYACCEPT comes here. |
1863 `-------------------------------------*/
1868 /*-----------------------------------.
1869 | yyabortlab -- YYABORT comes here. |
1870 `-----------------------------------*/
1876 /*----------------------------------------------.
1877 | yyoverflowlab -- parser overflow comes here. |
1878 `----------------------------------------------*/
1880 yyerror ("parser stack overflow");
1888 YYSTACK_FREE (yyss
);
1894 #line 431 "parse-gram.y"
1898 /* Return the location of the left-hand side of a rule whose
1899 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
1900 the right-hand side, and return an empty location equal to the end
1901 boundary of RHS[0] if the right-hand side is empty. */
1904 lloc_default (YYLTYPE
const *rhs
, int n
)
1908 loc
.start
= loc
.end
= rhs
[n
].end
;
1910 /* Ignore empty nonterminals the start of the the right-hand side.
1911 Do not bother to ignore them at the end of the right-hand side,
1912 since empty nonterminals have the same end as their predecessors. */
1913 for (i
= 1; i
<= n
; i
++)
1914 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
1916 loc
.start
= rhs
[i
].start
;
1924 /* Add a lex-param or a parse-param (depending on TYPE) with
1925 declaration DECL and location LOC. */
1928 add_param (char const *type
, char *decl
, location loc
)
1930 static char const alphanum
[] =
1932 "abcdefghijklmnopqrstuvwxyz"
1933 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1935 char const *alpha
= alphanum
+ 10;
1936 char const *name_start
= NULL
;
1939 for (p
= decl
; *p
; p
++)
1940 if ((p
== decl
|| ! strchr (alphanum
, p
[-1])) && strchr (alpha
, p
[0]))
1943 /* Strip the surrounding '{' and '}'. */
1948 complain_at (loc
, _("missing identifier in parameter declaration"));
1955 name_start
[name_len
] && strchr (alphanum
, name_start
[name_len
]);
1959 name
= xmalloc (name_len
+ 1);
1960 memcpy (name
, name_start
, name_len
);
1961 name
[name_len
] = '\0';
1962 muscle_pair_list_grow (type
, decl
, name
);
1966 scanner_last_string_free ();
1969 /*----------------------------------------------------.
1970 | When debugging the parser, display tokens' values. |
1971 `----------------------------------------------------*/
1974 print_token_value (FILE *file
, int type
, YYSTYPE
const *value
)
1980 fprintf (file
, " = %s", value
->symbol
->tag
);
1984 fprintf (file
, " = %d", value
->integer
);
1988 fprintf (file
, " = \"%s\"", value
->chars
);
1992 fprintf (file
, " = <%s>", value
->uniqstr
);
1996 case PERCENT_DESTRUCTOR
:
1997 case PERCENT_LEX_PARAM
:
1998 case PERCENT_PARSE_PARAM
:
1999 case PERCENT_PRINTER
:
2003 fprintf (file
, " = {{ %s }}", value
->chars
);
2007 fprintf (file
, "unknown token type");
2013 gram_error (location
const *loc
, char const *msg
)
2015 complain_at (*loc
, "%s", msg
);
2019 token_name (int type
)
2021 return yytname
[type
];