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_DEFAULT_PREC
= 284,
93 PERCENT_NO_LINES
= 285,
94 PERCENT_NONDETERMINISTIC_PARSER
= 286,
96 PERCENT_PARSE_PARAM
= 288,
97 PERCENT_PURE_PARSER
= 289,
98 PERCENT_SKELETON
= 290,
100 PERCENT_TOKEN_TABLE
= 292,
101 PERCENT_VERBOSE
= 293,
109 PERCENT_PERCENT
= 301,
118 #define PERCENT_TOKEN 260
119 #define PERCENT_NTERM 261
120 #define PERCENT_TYPE 262
121 #define PERCENT_DESTRUCTOR 263
122 #define PERCENT_PRINTER 264
123 #define PERCENT_UNION 265
124 #define PERCENT_LEFT 266
125 #define PERCENT_RIGHT 267
126 #define PERCENT_NONASSOC 268
127 #define PERCENT_PREC 269
128 #define PERCENT_DPREC 270
129 #define PERCENT_MERGE 271
130 #define PERCENT_DEBUG 272
131 #define PERCENT_DEFAULT_PREC 273
132 #define PERCENT_DEFINE 274
133 #define PERCENT_DEFINES 275
134 #define PERCENT_ERROR_VERBOSE 276
135 #define PERCENT_EXPECT 277
136 #define PERCENT_FILE_PREFIX 278
137 #define PERCENT_GLR_PARSER 279
138 #define PERCENT_INITIAL_ACTION 280
139 #define PERCENT_LEX_PARAM 281
140 #define PERCENT_LOCATIONS 282
141 #define PERCENT_NAME_PREFIX 283
142 #define PERCENT_NO_DEFAULT_PREC 284
143 #define PERCENT_NO_LINES 285
144 #define PERCENT_NONDETERMINISTIC_PARSER 286
145 #define PERCENT_OUTPUT 287
146 #define PERCENT_PARSE_PARAM 288
147 #define PERCENT_PURE_PARSER 289
148 #define PERCENT_SKELETON 290
149 #define PERCENT_START 291
150 #define PERCENT_TOKEN_TABLE 292
151 #define PERCENT_VERBOSE 293
152 #define PERCENT_YACC 294
155 #define SEMICOLON 297
159 #define PERCENT_PERCENT 301
162 #define BRACED_CODE 304
167 /* Copy the first part of user declarations. */
168 #line 32 "parse-gram.y"
172 #include "complain.h"
173 #include "conflicts.h"
177 #include "muscle_tab.h"
182 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
183 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
185 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
186 FIXME: depends on the undocumented availability of YYLLOC. */
188 #define yyerror(Msg) \
189 gram_error (&yylloc, Msg)
190 static void gram_error (location
const *, char const *);
192 #define YYPRINT(File, Type, Value) \
193 print_token_value (File, Type, &Value)
194 static void print_token_value (FILE *, int, YYSTYPE
const *);
196 static void add_param (char const *, char *, location
);
198 symbol_class current_class
= unknown_sym
;
199 uniqstr current_type
= 0;
201 location current_lhs_location
;
203 int current_prec
= 0;
206 /* Enabling traces. */
211 /* Enabling verbose error messages. */
212 #ifdef YYERROR_VERBOSE
213 # undef YYERROR_VERBOSE
214 # define YYERROR_VERBOSE 1
216 # define YYERROR_VERBOSE 1
219 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
220 #line 80 "parse-gram.y"
221 typedef union YYSTYPE
{
229 /* Line 191 of yacc.c. */
230 #line 231 "parse-gram.c"
231 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
232 # define YYSTYPE_IS_DECLARED 1
233 # define YYSTYPE_IS_TRIVIAL 1
236 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
237 typedef struct YYLTYPE
244 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
245 # define YYLTYPE_IS_DECLARED 1
246 # define YYLTYPE_IS_TRIVIAL 1
250 /* Copy the second part of user declarations. */
253 /* Line 214 of yacc.c. */
254 #line 255 "parse-gram.c"
256 #if ! defined (yyoverflow) || YYERROR_VERBOSE
262 # define YYMALLOC malloc
265 /* The parser invokes alloca or malloc; define the necessary symbols. */
267 # ifdef YYSTACK_USE_ALLOCA
268 # if YYSTACK_USE_ALLOCA
269 # define YYSTACK_ALLOC alloca
272 # if defined (alloca) || defined (_ALLOCA_H)
273 # define YYSTACK_ALLOC alloca
276 # 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 YYMALLOC
290 # define YYSTACK_FREE YYFREE
292 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
295 #if (! defined (yyoverflow) \
296 && (! defined (__cplusplus) \
297 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
298 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
300 /* A type that is properly aligned for any stack member. */
308 /* The size of the maximum gap between one aligned stack and the next. */
309 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
311 /* The size of an array large to enough to hold all stacks, each with
313 # define YYSTACK_BYTES(N) \
314 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
315 + 2 * YYSTACK_GAP_MAXIMUM)
317 /* Copy COUNT objects from FROM to TO. The source and destination do
320 # if defined (__GNUC__) && 1 < __GNUC__
321 # define YYCOPY(To, From, Count) \
322 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
324 # define YYCOPY(To, From, Count) \
327 register YYSIZE_T yyi; \
328 for (yyi = 0; yyi < (Count); yyi++) \
329 (To)[yyi] = (From)[yyi]; \
335 /* Relocate STACK from its old location to the new one. The
336 local variables YYSIZE and YYSTACKSIZE give the old and new number of
337 elements in the stack, and YYPTR gives the new location of the
338 stack. Advance YYPTR to a properly aligned location for the next
340 # define YYSTACK_RELOCATE(Stack) \
343 YYSIZE_T yynewbytes; \
344 YYCOPY (&yyptr->Stack, Stack, yysize); \
345 Stack = &yyptr->Stack; \
346 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
347 yyptr += yynewbytes / sizeof (*yyptr); \
353 #if defined (__STDC__) || defined (__cplusplus)
354 typedef signed char yysigned_char
;
356 typedef short yysigned_char
;
359 /* YYFINAL -- State number of the termination state. */
361 /* YYLAST -- Last index in YYTABLE. */
364 /* YYNTOKENS -- Number of terminals. */
366 /* YYNNTS -- Number of nonterminals. */
368 /* YYNRULES -- Number of rules. */
370 /* YYNRULES -- Number of states. */
371 #define YYNSTATES 106
373 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
375 #define YYMAXUTOK 304
377 #define YYTRANSLATE(YYX) \
378 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
380 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
381 static const unsigned char yytranslate
[] =
383 0, 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, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
409 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
410 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
411 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
412 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
417 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
419 static const unsigned char yyprhs
[] =
421 0, 0, 3, 8, 9, 12, 14, 16, 18, 22,
422 24, 26, 29, 33, 35, 37, 39, 41, 45, 47,
423 49, 53, 55, 57, 60, 62, 64, 66, 68, 70,
424 72, 75, 77, 80, 83, 85, 87, 88, 92, 93,
425 97, 101, 105, 107, 109, 111, 112, 114, 116, 119,
426 121, 123, 126, 129, 133, 135, 138, 140, 143, 145,
427 148, 151, 152, 156, 158, 162, 165, 166, 169, 172,
428 176, 180, 184, 186, 188, 190, 192, 194, 195
431 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
432 static const yysigned_char yyrhs
[] =
434 51, 0, -1, 52, 46, 64, 74, -1, -1, 52,
435 53, -1, 54, -1, 47, -1, 17, -1, 19, 73,
436 73, -1, 20, -1, 21, -1, 22, 4, -1, 23,
437 41, 73, -1, 24, -1, 25, -1, 26, -1, 27,
438 -1, 28, 41, 73, -1, 30, -1, 31, -1, 32,
439 41, 73, -1, 33, -1, 34, -1, 35, 73, -1,
440 37, -1, 38, -1, 39, -1, 42, -1, 58, -1,
441 55, -1, 36, 70, -1, 10, -1, 8, 61, -1,
442 9, 61, -1, 18, -1, 29, -1, -1, 6, 56,
443 63, -1, -1, 5, 57, 63, -1, 7, 40, 61,
444 -1, 59, 60, 61, -1, 11, -1, 12, -1, 13,
445 -1, -1, 40, -1, 70, -1, 61, 70, -1, 40,
446 -1, 44, -1, 44, 4, -1, 44, 72, -1, 44,
447 4, 72, -1, 62, -1, 63, 62, -1, 65, -1,
448 64, 65, -1, 66, -1, 54, 42, -1, 1, 42,
449 -1, -1, 45, 67, 68, -1, 69, -1, 68, 43,
450 69, -1, 68, 42, -1, -1, 69, 70, -1, 69,
451 71, -1, 69, 14, 70, -1, 69, 15, 4, -1,
452 69, 16, 40, -1, 44, -1, 72, -1, 49, -1,
453 3, -1, 3, -1, -1, 46, 48, -1
456 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
457 static const unsigned short yyrline
[] =
459 0, 172, 172, 180, 182, 186, 187, 188, 189, 190,
460 191, 192, 193, 194, 199, 203, 204, 205, 206, 207,
461 208, 209, 210, 211, 212, 213, 214, 215, 219, 220,
462 221, 225, 231, 238, 245, 249, 256, 256, 261, 261,
463 266, 276, 291, 292, 293, 297, 298, 304, 305, 310,
464 314, 319, 325, 331, 342, 343, 352, 353, 359, 360,
465 365, 372, 372, 376, 377, 378, 383, 384, 386, 388,
466 390, 392, 397, 398, 402, 408, 417, 424, 426
470 #if YYDEBUG || YYERROR_VERBOSE
471 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
472 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
473 static const char *const yytname
[] =
475 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
476 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
477 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
478 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
479 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
480 "\"%expect\"", "\"%file-prefix\"", "\"%glr-parser\"",
481 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
482 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
483 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
484 "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"", "\"%token-table\"",
485 "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"",
486 "\"identifier\"", "\"identifier:\"", "\"%%\"", "\"%{...%}\"",
487 "\"epilogue\"", "\"{...}\"", "$accept", "input", "declarations",
488 "declaration", "grammar_declaration", "symbol_declaration", "@1", "@2",
489 "precedence_declaration", "precedence_declarator", "type.opt",
490 "symbols.1", "symbol_def", "symbol_defs.1", "grammar",
491 "rules_or_grammar_declaration", "rules", "@3", "rhses.1", "rhs",
492 "symbol", "action", "string_as_id", "string_content", "epilogue.opt", 0
497 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
499 static const unsigned short yytoknum
[] =
501 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
502 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
503 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
504 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
505 295, 296, 297, 298, 299, 300, 301, 302, 303, 304
509 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
510 static const unsigned char yyr1
[] =
512 0, 50, 51, 52, 52, 53, 53, 53, 53, 53,
513 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
514 53, 53, 53, 53, 53, 53, 53, 53, 54, 54,
515 54, 54, 54, 54, 54, 54, 56, 55, 57, 55,
516 55, 58, 59, 59, 59, 60, 60, 61, 61, 62,
517 62, 62, 62, 62, 63, 63, 64, 64, 65, 65,
518 65, 67, 66, 68, 68, 68, 69, 69, 69, 69,
519 69, 69, 70, 70, 71, 72, 73, 74, 74
522 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
523 static const unsigned char yyr2
[] =
525 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
526 1, 2, 3, 1, 1, 1, 1, 3, 1, 1,
527 3, 1, 1, 2, 1, 1, 1, 1, 1, 1,
528 2, 1, 2, 2, 1, 1, 0, 3, 0, 3,
529 3, 3, 1, 1, 1, 0, 1, 1, 2, 1,
530 1, 2, 2, 3, 1, 2, 1, 2, 1, 2,
531 2, 0, 3, 1, 3, 2, 0, 2, 2, 3,
532 3, 3, 1, 1, 1, 1, 1, 0, 2
535 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
536 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
537 means the default is an error. */
538 static const unsigned char yydefact
[] =
540 3, 0, 0, 1, 38, 36, 0, 0, 0, 31,
541 42, 43, 44, 7, 34, 0, 9, 10, 0, 0,
542 13, 14, 15, 16, 0, 35, 18, 19, 0, 21,
543 22, 0, 0, 24, 25, 26, 27, 0, 6, 4,
544 5, 29, 28, 45, 0, 0, 0, 75, 72, 32,
545 47, 73, 33, 76, 0, 11, 0, 0, 0, 23,
546 30, 0, 61, 0, 0, 56, 58, 46, 0, 49,
547 50, 54, 39, 37, 40, 48, 8, 12, 17, 20,
548 60, 66, 59, 0, 57, 2, 41, 51, 52, 55,
549 62, 63, 78, 53, 65, 66, 0, 0, 0, 74,
550 67, 68, 64, 69, 70, 71
553 /* YYDEFGOTO[NTERM-NUM]. */
554 static const yysigned_char yydefgoto
[] =
556 -1, 1, 2, 39, 63, 41, 45, 44, 42, 43,
557 68, 49, 71, 72, 64, 65, 66, 81, 90, 91,
561 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
563 #define YYPACT_NINF -67
564 static const yysigned_char yypact
[] =
566 -67, 8, 109, -67, -67, -67, -30, 0, 0, -67,
567 -67, -67, -67, -67, -67, 13, -67, -67, 20, -16,
568 -67, -67, -67, -67, -15, -67, -67, -67, -5, -67,
569 -67, 13, 0, -67, -67, -67, -67, 68, -67, -67,
570 -67, -67, -67, -3, -35, -35, 0, -67, -67, 0,
571 -67, -67, 0, -67, 13, -67, 13, 13, 13, -67,
572 -67, -4, -67, 4, 22, -67, -67, -67, 0, -67,
573 3, -67, -35, -35, 0, -67, -67, -67, -67, -67,
574 -67, -67, -67, 1, -67, -67, 0, 38, -67, -67,
575 -31, -1, -67, -67, -67, -67, 0, 41, 7, -67,
576 -67, -67, -1, -67, -67, -67
579 /* YYPGOTO[NTERM-NUM]. */
580 static const yysigned_char yypgoto
[] =
582 -67, -67, -67, -67, 48, -67, -67, -67, -67, -67,
583 -67, -7, -54, 10, -67, -12, -67, -67, -67, -42,
584 -32, -67, -66, 31, -67
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, syntax error. */
591 #define YYTABLE_NINF -78
592 static const yysigned_char yytable
[] =
594 60, 52, 47, 47, 88, 69, 47, 87, 3, 70,
595 46, 94, 95, 96, 97, 98, 53, 75, 89, 89,
596 75, 93, -77, 61, 55, 56, 57, 4, 5, 6,
597 7, 8, 9, 10, 11, 12, 58, 67, 80, 74,
598 14, 47, 75, 48, 48, 104, 82, 105, 99, 92,
599 40, 25, 84, 102, 75, 73, 0, 0, 32, 100,
600 0, 86, 59, 0, 103, 0, 0, 62, 83, 61,
601 100, 0, 0, 4, 5, 6, 7, 8, 9, 10,
602 11, 12, 0, 0, 0, 76, 14, 77, 78, 79,
603 0, 0, 0, 0, 0, 0, 0, 25, 0, 0,
604 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
605 0, 0, 0, 62, 4, 5, 6, 7, 8, 9,
606 10, 11, 12, 0, 0, 0, 13, 14, 15, 16,
607 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
608 27, 28, 29, 30, 31, 32, 33, 34, 35, 0,
609 0, 36, 0, 0, 0, 37, 38
612 static const yysigned_char yycheck
[] =
614 32, 8, 3, 3, 70, 40, 3, 4, 0, 44,
615 40, 42, 43, 14, 15, 16, 3, 49, 72, 73,
616 52, 87, 0, 1, 4, 41, 41, 5, 6, 7,
617 8, 9, 10, 11, 12, 13, 41, 40, 42, 46,
618 18, 3, 74, 44, 44, 4, 42, 40, 49, 48,
619 2, 29, 64, 95, 86, 45, -1, -1, 36, 91,
620 -1, 68, 31, -1, 96, -1, -1, 45, 46, 1,
621 102, -1, -1, 5, 6, 7, 8, 9, 10, 11,
622 12, 13, -1, -1, -1, 54, 18, 56, 57, 58,
623 -1, -1, -1, -1, -1, -1, -1, 29, -1, -1,
624 -1, -1, -1, -1, 36, -1, -1, -1, -1, -1,
625 -1, -1, -1, 45, 5, 6, 7, 8, 9, 10,
626 11, 12, 13, -1, -1, -1, 17, 18, 19, 20,
627 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
628 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
629 -1, 42, -1, -1, -1, 46, 47
632 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
633 symbol of state STATE-NUM. */
634 static const unsigned char yystos
[] =
636 0, 51, 52, 0, 5, 6, 7, 8, 9, 10,
637 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
638 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
639 34, 35, 36, 37, 38, 39, 42, 46, 47, 53,
640 54, 55, 58, 59, 57, 56, 40, 3, 44, 61,
641 70, 72, 61, 3, 73, 4, 41, 41, 41, 73,
642 70, 1, 45, 54, 64, 65, 66, 40, 60, 40,
643 44, 62, 63, 63, 61, 70, 73, 73, 73, 73,
644 42, 67, 42, 46, 65, 74, 61, 4, 72, 62,
645 68, 69, 48, 72, 42, 43, 14, 15, 16, 49,
646 70, 71, 69, 70, 4, 40
649 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
650 # define YYSIZE_T __SIZE_TYPE__
652 #if ! defined (YYSIZE_T) && defined (size_t)
653 # define YYSIZE_T size_t
655 #if ! defined (YYSIZE_T)
656 # if defined (__STDC__) || defined (__cplusplus)
657 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
658 # define YYSIZE_T size_t
661 #if ! defined (YYSIZE_T)
662 # define YYSIZE_T unsigned int
665 #define yyerrok (yyerrstatus = 0)
666 #define yyclearin (yychar = YYEMPTY)
670 #define YYACCEPT goto yyacceptlab
671 #define YYABORT goto yyabortlab
672 #define YYERROR goto yyerrorlab
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 yytoken = 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) \
736 # define YYDSYMPRINT(Args) \
742 # define YYDSYMPRINTF(Title, Token, Value, Location) \
746 YYFPRINTF (stderr, "%s ", Title); \
747 yysymprint (stderr, \
748 Token, Value, Location); \
749 YYFPRINTF (stderr, "\n"); \
753 /*------------------------------------------------------------------.
754 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
756 `------------------------------------------------------------------*/
758 #if defined (__STDC__) || defined (__cplusplus)
760 yy_stack_print (short *bottom
, short *top
)
763 yy_stack_print (bottom
, top
)
768 YYFPRINTF (stderr
, "Stack now");
769 for (/* Nothing. */; bottom
<= top
; ++bottom
)
770 YYFPRINTF (stderr
, " %d", *bottom
);
771 YYFPRINTF (stderr
, "\n");
774 # define YY_STACK_PRINT(Bottom, Top) \
777 yy_stack_print ((Bottom), (Top)); \
781 /*------------------------------------------------.
782 | Report that the YYRULE is going to be reduced. |
783 `------------------------------------------------*/
785 #if defined (__STDC__) || defined (__cplusplus)
787 yy_reduce_print (int yyrule
)
790 yy_reduce_print (yyrule
)
795 unsigned int yylno
= yyrline
[yyrule
];
796 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
798 /* Print the symbols being reduced, and their result. */
799 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
800 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
801 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
804 # define YY_REDUCE_PRINT(Rule) \
807 yy_reduce_print (Rule); \
810 /* Nonzero means print parse trace. It is left uninitialized so that
811 multiple parsers can coexist. */
814 # define YYDPRINTF(Args)
815 # define YYDSYMPRINT(Args)
816 # define YYDSYMPRINTF(Title, Token, Value, Location)
817 # define YY_STACK_PRINT(Bottom, Top)
818 # define YY_REDUCE_PRINT(Rule)
819 #endif /* !YYDEBUG */
822 /* YYINITDEPTH -- initial size of the parser's stacks. */
824 # define YYINITDEPTH 200
827 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
828 if the built-in stack extension method is used).
830 Do not make this value too large; the results are undefined if
831 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
832 evaluated with infinite-precision integer arithmetic. */
834 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
839 # define YYMAXDEPTH 10000
847 # if defined (__GLIBC__) && defined (_STRING_H)
848 # define yystrlen strlen
850 /* Return the length of YYSTR. */
852 # if defined (__STDC__) || defined (__cplusplus)
853 yystrlen (const char *yystr
)
859 register const char *yys
= yystr
;
861 while (*yys
++ != '\0')
864 return yys
- yystr
- 1;
870 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
871 # define yystpcpy stpcpy
873 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
876 # if defined (__STDC__) || defined (__cplusplus)
877 yystpcpy (char *yydest
, const char *yysrc
)
879 yystpcpy (yydest
, yysrc
)
884 register char *yyd
= yydest
;
885 register const char *yys
= yysrc
;
887 while ((*yyd
++ = *yys
++) != '\0')
895 #endif /* !YYERROR_VERBOSE */
900 /*--------------------------------.
901 | Print this symbol on YYOUTPUT. |
902 `--------------------------------*/
904 #if defined (__STDC__) || defined (__cplusplus)
906 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
909 yysymprint (yyoutput
, yytype
, yyvaluep
, yylocationp
)
913 YYLTYPE
*yylocationp
;
916 /* Pacify ``unused variable'' warnings. */
920 if (yytype
< YYNTOKENS
)
922 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
924 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
928 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
935 YYFPRINTF (yyoutput
, ")");
938 #endif /* ! YYDEBUG */
939 /*-----------------------------------------------.
940 | Release the memory associated to this symbol. |
941 `-----------------------------------------------*/
943 #if defined (__STDC__) || defined (__cplusplus)
945 yydestruct (int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
948 yydestruct (yytype
, yyvaluep
, yylocationp
)
951 YYLTYPE
*yylocationp
;
954 /* Pacify ``unused variable'' warnings. */
967 /* Prevent warnings from -Wmissing-prototypes. */
970 # if defined (__STDC__) || defined (__cplusplus)
971 int yyparse (void *YYPARSE_PARAM
);
975 #else /* ! YYPARSE_PARAM */
976 #if defined (__STDC__) || defined (__cplusplus)
981 #endif /* ! YYPARSE_PARAM */
993 # if defined (__STDC__) || defined (__cplusplus)
994 int yyparse (void *YYPARSE_PARAM
)
996 int yyparse (YYPARSE_PARAM
)
999 #else /* ! YYPARSE_PARAM */
1000 #if defined (__STDC__) || defined (__cplusplus)
1010 /* The lookahead symbol. */
1013 /* The semantic value of the lookahead symbol. */
1016 /* Number of syntax errors so far. */
1018 /* Location data for the lookahead symbol. */
1021 register int yystate
;
1024 /* Number of tokens to shift before error messages enabled. */
1026 /* Lookahead token as an internal (translated) token number. */
1029 /* Three stacks and their tools:
1030 `yyss': related to states,
1031 `yyvs': related to semantic values,
1032 `yyls': related to locations.
1034 Refer to the stacks thru separate pointers, to allow yyoverflow
1035 to reallocate them elsewhere. */
1037 /* The state stack. */
1038 short yyssa
[YYINITDEPTH
];
1039 short *yyss
= yyssa
;
1040 register short *yyssp
;
1042 /* The semantic value stack. */
1043 YYSTYPE yyvsa
[YYINITDEPTH
];
1044 YYSTYPE
*yyvs
= yyvsa
;
1045 register YYSTYPE
*yyvsp
;
1047 /* The location stack. */
1048 YYLTYPE yylsa
[YYINITDEPTH
];
1049 YYLTYPE
*yyls
= yylsa
;
1053 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1055 YYSIZE_T yystacksize
= YYINITDEPTH
;
1057 /* The variables used to return semantic value and location from the
1062 /* When reducing, the number of symbols on the RHS of the reduced
1066 YYDPRINTF ((stderr
, "Starting parse\n"));
1071 yychar
= YYEMPTY
; /* Cause a token to be read. */
1073 /* Initialize stack pointers.
1074 Waste one element of value and location stack
1075 so that they stay on the same level as the state stack.
1076 The wasted elements are never initialized. */
1082 /* User initialization code. */
1083 #line 70 "parse-gram.y"
1085 /* Bison's grammar can initial empty locations, hence a default
1086 location is needed. */
1087 (*yylsp
).start
.file
= (*yylsp
).end
.file
= current_file
;
1088 (*yylsp
).start
.line
= (*yylsp
).end
.line
= 1;
1089 (*yylsp
).start
.column
= (*yylsp
).end
.column
= 0;
1091 /* Line 818 of yacc.c. */
1092 #line 1093 "parse-gram.c"
1095 /*------------------------------------------------------------.
1096 | yynewstate -- Push a new state, which is found in yystate. |
1097 `------------------------------------------------------------*/
1099 /* In all cases, when you get here, the value and location stacks
1100 have just been pushed. so pushing a state here evens the stacks.
1107 if (yyss
+ yystacksize
- 1 <= yyssp
)
1109 /* Get the current used size of the three stacks, in elements. */
1110 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1114 /* Give user a chance to reallocate the stack. Use copies of
1115 these so that the &'s don't force the real ones into
1117 YYSTYPE
*yyvs1
= yyvs
;
1118 short *yyss1
= yyss
;
1119 YYLTYPE
*yyls1
= yyls
;
1121 /* Each stack pointer address is followed by the size of the
1122 data in use in that stack, in bytes. This used to be a
1123 conditional around just the two extra args, but that might
1124 be undefined if yyoverflow is a macro. */
1125 yyoverflow ("parser stack overflow",
1126 &yyss1
, yysize
* sizeof (*yyssp
),
1127 &yyvs1
, yysize
* sizeof (*yyvsp
),
1128 &yyls1
, yysize
* sizeof (*yylsp
),
1134 #else /* no yyoverflow */
1135 # ifndef YYSTACK_RELOCATE
1138 /* Extend the stack our own way. */
1139 if (YYMAXDEPTH
<= yystacksize
)
1142 if (YYMAXDEPTH
< yystacksize
)
1143 yystacksize
= YYMAXDEPTH
;
1146 short *yyss1
= yyss
;
1147 union yyalloc
*yyptr
=
1148 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1151 YYSTACK_RELOCATE (yyss
);
1152 YYSTACK_RELOCATE (yyvs
);
1153 YYSTACK_RELOCATE (yyls
);
1154 # undef YYSTACK_RELOCATE
1156 YYSTACK_FREE (yyss1
);
1159 #endif /* no yyoverflow */
1161 yyssp
= yyss
+ yysize
- 1;
1162 yyvsp
= yyvs
+ yysize
- 1;
1163 yylsp
= yyls
+ yysize
- 1;
1165 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1166 (unsigned long int) yystacksize
));
1168 if (yyss
+ yystacksize
- 1 <= yyssp
)
1172 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1181 /* Do appropriate processing given the current state. */
1182 /* Read a lookahead token if we need one and don't already have one. */
1185 /* First try to decide what to do without reference to lookahead token. */
1187 yyn
= yypact
[yystate
];
1188 if (yyn
== YYPACT_NINF
)
1191 /* Not known => get a lookahead token if don't already have one. */
1193 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1194 if (yychar
== YYEMPTY
)
1196 YYDPRINTF ((stderr
, "Reading a token: "));
1200 if (yychar
<= YYEOF
)
1202 yychar
= yytoken
= YYEOF
;
1203 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1207 yytoken
= YYTRANSLATE (yychar
);
1208 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1211 /* If the proper action on seeing token YYTOKEN is to reduce or to
1212 detect an error, take that action. */
1214 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1219 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1228 /* Shift the lookahead token. */
1229 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1231 /* Discard the token being shifted unless it is eof. */
1232 if (yychar
!= YYEOF
)
1238 /* Count tokens shifted since error; after three, turn off error
1247 /*-----------------------------------------------------------.
1248 | yydefault -- do the default action for the current state. |
1249 `-----------------------------------------------------------*/
1251 yyn
= yydefact
[yystate
];
1257 /*-----------------------------.
1258 | yyreduce -- Do a reduction. |
1259 `-----------------------------*/
1261 /* yyn is the number of a rule to reduce with. */
1264 /* If YYLEN is nonzero, implement the default value of the action:
1267 Otherwise, the following line sets YYVAL to garbage.
1268 This behavior is undocumented and Bison
1269 users should not rely upon it. Assigning to YYVAL
1270 unconditionally makes the parser a bit smaller, and it avoids a
1271 GCC warning that YYVAL may be used uninitialized. */
1272 yyval
= yyvsp
[1-yylen
];
1274 /* Default location. */
1275 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);
1276 YY_REDUCE_PRINT (yyn
);
1280 #line 187 "parse-gram.y"
1281 { prologue_augment (yyvsp
[0].chars
, yylsp
[0]); }
1285 #line 188 "parse-gram.y"
1286 { debug_flag
= true; }
1290 #line 189 "parse-gram.y"
1291 { muscle_insert (yyvsp
[-1].chars
, yyvsp
[0].chars
); }
1295 #line 190 "parse-gram.y"
1296 { defines_flag
= true; }
1300 #line 191 "parse-gram.y"
1301 { error_verbose
= true; }
1305 #line 192 "parse-gram.y"
1306 { expected_conflicts
= yyvsp
[0].integer
; }
1310 #line 193 "parse-gram.y"
1311 { spec_file_prefix
= yyvsp
[0].chars
; }
1315 #line 195 "parse-gram.y"
1317 nondeterministic_parser
= true;
1323 #line 200 "parse-gram.y"
1325 muscle_code_grow ("initial_action", yyvsp
[0].chars
, yylsp
[0]);
1330 #line 203 "parse-gram.y"
1331 { add_param ("lex_param", yyvsp
[0].chars
, yylsp
[0]); }
1335 #line 204 "parse-gram.y"
1336 { locations_flag
= true; }
1340 #line 205 "parse-gram.y"
1341 { spec_name_prefix
= yyvsp
[0].chars
; }
1345 #line 206 "parse-gram.y"
1346 { no_lines_flag
= true; }
1350 #line 207 "parse-gram.y"
1351 { nondeterministic_parser
= true; }
1355 #line 208 "parse-gram.y"
1356 { spec_outfile
= yyvsp
[0].chars
; }
1360 #line 209 "parse-gram.y"
1361 { add_param ("parse_param", yyvsp
[0].chars
, yylsp
[0]); }
1365 #line 210 "parse-gram.y"
1366 { pure_parser
= true; }
1370 #line 211 "parse-gram.y"
1371 { skeleton
= yyvsp
[0].chars
; }
1375 #line 212 "parse-gram.y"
1376 { token_table_flag
= true; }
1380 #line 213 "parse-gram.y"
1381 { report_flag
= report_states
; }
1385 #line 214 "parse-gram.y"
1386 { yacc_flag
= true; }
1390 #line 222 "parse-gram.y"
1392 grammar_start_symbol_set (yyvsp
[0].symbol
, yylsp
[0]);
1397 #line 226 "parse-gram.y"
1400 MUSCLE_INSERT_INT ("stype_line", yylsp
[0].start
.line
);
1401 muscle_insert ("stype", yyvsp
[0].chars
);
1406 #line 232 "parse-gram.y"
1409 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1410 symbol_destructor_set (list
->sym
, yyvsp
[-1].chars
, yylsp
[-1]);
1411 symbol_list_free (yyvsp
[0].list
);
1416 #line 239 "parse-gram.y"
1419 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1420 symbol_printer_set (list
->sym
, yyvsp
[-1].chars
, list
->location
);
1421 symbol_list_free (yyvsp
[0].list
);
1426 #line 246 "parse-gram.y"
1428 default_prec
= true;
1433 #line 250 "parse-gram.y"
1435 default_prec
= false;
1440 #line 256 "parse-gram.y"
1441 { current_class
= nterm_sym
; }
1445 #line 257 "parse-gram.y"
1447 current_class
= unknown_sym
;
1448 current_type
= NULL
;
1453 #line 261 "parse-gram.y"
1454 { current_class
= token_sym
; }
1458 #line 262 "parse-gram.y"
1460 current_class
= unknown_sym
;
1461 current_type
= NULL
;
1466 #line 267 "parse-gram.y"
1469 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1470 symbol_type_set (list
->sym
, yyvsp
[-1].uniqstr
, yylsp
[-1]);
1471 symbol_list_free (yyvsp
[0].list
);
1476 #line 277 "parse-gram.y"
1480 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1482 symbol_type_set (list
->sym
, current_type
, yylsp
[-1]);
1483 symbol_precedence_set (list
->sym
, current_prec
, yyvsp
[-2].assoc
, yylsp
[-2]);
1485 symbol_list_free (yyvsp
[0].list
);
1486 current_type
= NULL
;
1491 #line 291 "parse-gram.y"
1492 { yyval
.assoc
= left_assoc
; }
1496 #line 292 "parse-gram.y"
1497 { yyval
.assoc
= right_assoc
; }
1501 #line 293 "parse-gram.y"
1502 { yyval
.assoc
= non_assoc
; }
1506 #line 297 "parse-gram.y"
1507 { current_type
= NULL
; }
1511 #line 298 "parse-gram.y"
1512 { current_type
= yyvsp
[0].uniqstr
; }
1516 #line 304 "parse-gram.y"
1517 { yyval
.list
= symbol_list_new (yyvsp
[0].symbol
, yylsp
[0]); }
1521 #line 305 "parse-gram.y"
1522 { yyval
.list
= symbol_list_prepend (yyvsp
[-1].list
, yyvsp
[0].symbol
, yylsp
[0]); }
1526 #line 311 "parse-gram.y"
1528 current_type
= yyvsp
[0].uniqstr
;
1533 #line 315 "parse-gram.y"
1535 symbol_class_set (yyvsp
[0].symbol
, current_class
, yylsp
[0]);
1536 symbol_type_set (yyvsp
[0].symbol
, current_type
, yylsp
[0]);
1541 #line 320 "parse-gram.y"
1543 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1544 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1545 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
, yylsp
[0]);
1550 #line 326 "parse-gram.y"
1552 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1553 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1554 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
, yyloc
);
1559 #line 332 "parse-gram.y"
1561 symbol_class_set (yyvsp
[-2].symbol
, current_class
, yylsp
[-2]);
1562 symbol_type_set (yyvsp
[-2].symbol
, current_type
, yylsp
[-2]);
1563 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
, yylsp
[-1]);
1564 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
, yyloc
);
1569 #line 361 "parse-gram.y"
1572 complain_at (yyloc
, _("POSIX forbids declarations in the grammar"));
1577 #line 366 "parse-gram.y"
1584 #line 372 "parse-gram.y"
1585 { current_lhs
= yyvsp
[0].symbol
; current_lhs_location
= yylsp
[0]; }
1589 #line 376 "parse-gram.y"
1590 { grammar_rule_end (yylsp
[0]); }
1594 #line 377 "parse-gram.y"
1595 { grammar_rule_end (yylsp
[0]); }
1599 #line 383 "parse-gram.y"
1600 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
1604 #line 385 "parse-gram.y"
1605 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
, yylsp
[0]); }
1609 #line 387 "parse-gram.y"
1610 { grammar_current_rule_action_append (yyvsp
[0].chars
, yylsp
[0]); }
1614 #line 389 "parse-gram.y"
1615 { grammar_current_rule_prec_set (yyvsp
[0].symbol
, yylsp
[0]); }
1619 #line 391 "parse-gram.y"
1620 { grammar_current_rule_dprec_set (yyvsp
[0].integer
, yylsp
[0]); }
1624 #line 393 "parse-gram.y"
1625 { grammar_current_rule_merge_set (yyvsp
[0].uniqstr
, yylsp
[0]); }
1629 #line 397 "parse-gram.y"
1630 { yyval
.symbol
= yyvsp
[0].symbol
; }
1634 #line 398 "parse-gram.y"
1635 { yyval
.symbol
= yyvsp
[0].symbol
; }
1639 #line 403 "parse-gram.y"
1640 { yyval
.chars
= yyvsp
[0].chars
; }
1644 #line 409 "parse-gram.y"
1646 yyval
.symbol
= symbol_get (yyvsp
[0].chars
, yylsp
[0]);
1647 symbol_class_set (yyval
.symbol
, token_sym
, yylsp
[0]);
1652 #line 418 "parse-gram.y"
1654 yyval
.chars
= yyvsp
[0].chars
+ 1;
1655 yyval
.chars
[strlen (yyval
.chars
) - 1] = '\0';
1660 #line 427 "parse-gram.y"
1662 muscle_code_grow ("epilogue", yyvsp
[0].chars
, yylsp
[0]);
1663 scanner_last_string_free ();
1670 /* Line 1010 of yacc.c. */
1671 #line 1672 "parse-gram.c"
1677 YY_STACK_PRINT (yyss
, yyssp
);
1682 /* Now `shift' the result of the reduction. Determine what state
1683 that goes to, based on the state we popped back to and the rule
1684 number reduced by. */
1688 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1689 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1690 yystate
= yytable
[yystate
];
1692 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1697 /*------------------------------------.
1698 | yyerrlab -- here on detecting error |
1699 `------------------------------------*/
1701 /* If not already recovering from an error, report this error. */
1706 yyn
= yypact
[yystate
];
1708 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1710 YYSIZE_T yysize
= 0;
1711 int yytype
= YYTRANSLATE (yychar
);
1712 const char* yyprefix
;
1716 /* Start YYX at -YYN if negative to avoid negative indexes in
1718 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1720 /* Stay within bounds of both yycheck and yytname. */
1721 int yychecklim
= YYLAST
- yyn
;
1722 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1725 yyprefix
= ", expecting ";
1726 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1727 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1729 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1737 yysize
+= (sizeof ("syntax error, unexpected ")
1738 + yystrlen (yytname
[yytype
]));
1739 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1742 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1743 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1747 yyprefix
= ", expecting ";
1748 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1749 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1751 yyp
= yystpcpy (yyp
, yyprefix
);
1752 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1757 YYSTACK_FREE (yymsg
);
1760 yyerror ("syntax error; also virtual memory exhausted");
1763 #endif /* YYERROR_VERBOSE */
1764 yyerror ("syntax error");
1769 if (yyerrstatus
== 3)
1771 /* If just tried and failed to reuse lookahead token after an
1772 error, discard it. */
1774 if (yychar
<= YYEOF
)
1776 /* If at end of input, pop the error token,
1777 then the rest of the stack, then return failure. */
1778 if (yychar
== YYEOF
)
1784 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1785 yydestruct (yystos
[*yyssp
], yyvsp
, yylsp
);
1790 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1791 yydestruct (yytoken
, &yylval
, &yylloc
);
1793 *++yylerrsp
= yylloc
;
1797 /* Else will try to reuse lookahead token after shifting the error
1802 /*---------------------------------------------------.
1803 | yyerrorlab -- error raised explicitly by YYERROR. |
1804 `---------------------------------------------------*/
1808 /* Pacify GCC when the user code never invokes YYERROR and the label
1809 yyerrorlab therefore never appears in user code. */
1818 *++yylerrsp
= yyloc
;
1823 /*-------------------------------------------------------------.
1824 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1825 `-------------------------------------------------------------*/
1827 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1831 yyn
= yypact
[yystate
];
1832 if (yyn
!= YYPACT_NINF
)
1835 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1843 /* Pop the current state because it cannot handle the error token. */
1847 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1848 yydestruct (yystos
[yystate
], yyvsp
, yylsp
);
1851 YY_STACK_PRINT (yyss
, yyssp
);
1857 YYDPRINTF ((stderr
, "Shifting error token, "));
1860 YYLLOC_DEFAULT (yyloc
, yylsp
, yylerrsp
- yylsp
);
1867 /*-------------------------------------.
1868 | yyacceptlab -- YYACCEPT comes here. |
1869 `-------------------------------------*/
1874 /*-----------------------------------.
1875 | yyabortlab -- YYABORT comes here. |
1876 `-----------------------------------*/
1882 /*----------------------------------------------.
1883 | yyoverflowlab -- parser overflow comes here. |
1884 `----------------------------------------------*/
1886 yyerror ("parser stack overflow");
1894 YYSTACK_FREE (yyss
);
1900 #line 433 "parse-gram.y"
1904 /* Return the location of the left-hand side of a rule whose
1905 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
1906 the right-hand side, and return an empty location equal to the end
1907 boundary of RHS[0] if the right-hand side is empty. */
1910 lloc_default (YYLTYPE
const *rhs
, int n
)
1914 loc
.start
= loc
.end
= rhs
[n
].end
;
1916 /* Ignore empty nonterminals the start of the the right-hand side.
1917 Do not bother to ignore them at the end of the right-hand side,
1918 since empty nonterminals have the same end as their predecessors. */
1919 for (i
= 1; i
<= n
; i
++)
1920 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
1922 loc
.start
= rhs
[i
].start
;
1930 /* Add a lex-param or a parse-param (depending on TYPE) with
1931 declaration DECL and location LOC. */
1934 add_param (char const *type
, char *decl
, location loc
)
1936 static char const alphanum
[] =
1938 "abcdefghijklmnopqrstuvwxyz"
1939 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1941 char const *alpha
= alphanum
+ 10;
1942 char const *name_start
= NULL
;
1945 for (p
= decl
; *p
; p
++)
1946 if ((p
== decl
|| ! strchr (alphanum
, p
[-1])) && strchr (alpha
, p
[0]))
1949 /* Strip the surrounding '{' and '}'. */
1954 complain_at (loc
, _("missing identifier in parameter declaration"));
1961 name_start
[name_len
] && strchr (alphanum
, name_start
[name_len
]);
1965 name
= xmalloc (name_len
+ 1);
1966 memcpy (name
, name_start
, name_len
);
1967 name
[name_len
] = '\0';
1968 muscle_pair_list_grow (type
, decl
, name
);
1972 scanner_last_string_free ();
1975 /*----------------------------------------------------.
1976 | When debugging the parser, display tokens' values. |
1977 `----------------------------------------------------*/
1980 print_token_value (FILE *file
, int type
, YYSTYPE
const *value
)
1986 fprintf (file
, " = %s", value
->symbol
->tag
);
1990 fprintf (file
, " = %d", value
->integer
);
1994 fprintf (file
, " = \"%s\"", value
->chars
);
1998 fprintf (file
, " = <%s>", value
->uniqstr
);
2002 case PERCENT_DESTRUCTOR
:
2003 case PERCENT_LEX_PARAM
:
2004 case PERCENT_PARSE_PARAM
:
2005 case PERCENT_PRINTER
:
2009 fprintf (file
, " = {{ %s }}", value
->chars
);
2013 fprintf (file
, "unknown token type");
2019 gram_error (location
const *loc
, char const *msg
)
2021 complain_at (*loc
, "%s", msg
);
2025 token_name (int type
)
2027 return yytname
[type
];