1 /* A Bison parser, made by GNU Bison 2.1a. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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 YYBISON_VERSION "2.1a"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 1
51 /* Substitute the variable and function names. */
52 #define yyparse gram_parse
53 #define yylex gram_lex
54 #define yyerror gram_error
55 #define yylval gram_lval
56 #define yychar gram_char
57 #define yydebug gram_debug
58 #define yynerrs gram_nerrs
59 #define yylloc gram_lloc
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
73 PERCENT_DESTRUCTOR
= 263,
74 PERCENT_PRINTER
= 264,
78 PERCENT_NONASSOC
= 268,
83 PERCENT_DEFAULT_PREC
= 273,
85 PERCENT_DEFINES
= 275,
86 PERCENT_ERROR_VERBOSE
= 276,
88 PERCENT_EXPECT_RR
= 278,
89 PERCENT_FILE_PREFIX
= 279,
90 PERCENT_GLR_PARSER
= 280,
91 PERCENT_INITIAL_ACTION
= 281,
92 PERCENT_LEX_PARAM
= 282,
93 PERCENT_LOCATIONS
= 283,
94 PERCENT_NAME_PREFIX
= 284,
95 PERCENT_NO_DEFAULT_PREC
= 285,
96 PERCENT_NO_LINES
= 286,
97 PERCENT_NONDETERMINISTIC_PARSER
= 287,
99 PERCENT_PARSE_PARAM
= 289,
100 PERCENT_PURE_PARSER
= 290,
101 PERCENT_REQUIRE
= 291,
102 PERCENT_SKELETON
= 292,
104 PERCENT_TOKEN_TABLE
= 294,
105 PERCENT_VERBOSE
= 295,
113 PERCENT_PERCENT
= 303,
123 #define PERCENT_TOKEN 260
124 #define PERCENT_NTERM 261
125 #define PERCENT_TYPE 262
126 #define PERCENT_DESTRUCTOR 263
127 #define PERCENT_PRINTER 264
128 #define PERCENT_UNION 265
129 #define PERCENT_LEFT 266
130 #define PERCENT_RIGHT 267
131 #define PERCENT_NONASSOC 268
132 #define PERCENT_PREC 269
133 #define PERCENT_DPREC 270
134 #define PERCENT_MERGE 271
135 #define PERCENT_DEBUG 272
136 #define PERCENT_DEFAULT_PREC 273
137 #define PERCENT_DEFINE 274
138 #define PERCENT_DEFINES 275
139 #define PERCENT_ERROR_VERBOSE 276
140 #define PERCENT_EXPECT 277
141 #define PERCENT_EXPECT_RR 278
142 #define PERCENT_FILE_PREFIX 279
143 #define PERCENT_GLR_PARSER 280
144 #define PERCENT_INITIAL_ACTION 281
145 #define PERCENT_LEX_PARAM 282
146 #define PERCENT_LOCATIONS 283
147 #define PERCENT_NAME_PREFIX 284
148 #define PERCENT_NO_DEFAULT_PREC 285
149 #define PERCENT_NO_LINES 286
150 #define PERCENT_NONDETERMINISTIC_PARSER 287
151 #define PERCENT_OUTPUT 288
152 #define PERCENT_PARSE_PARAM 289
153 #define PERCENT_PURE_PARSER 290
154 #define PERCENT_REQUIRE 291
155 #define PERCENT_SKELETON 292
156 #define PERCENT_START 293
157 #define PERCENT_TOKEN_TABLE 294
158 #define PERCENT_VERBOSE 295
159 #define PERCENT_YACC 296
162 #define SEMICOLON 299
166 #define PERCENT_PERCENT 303
169 #define BRACED_CODE 306
174 /* Copy the first part of user declarations. */
175 #line 1 "parse-gram.y"
176 /* Bison Grammar Parser -*- C -*-
178 Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
180 This file is part of Bison, the GNU Compiler Compiler.
182 This program is free software; you can redistribute it and/or modify
183 it under the terms of the GNU General Public License as published by
184 the Free Software Foundation; either version 2 of the License, or
185 (at your option) any later version.
187 This program is distributed in the hope that it will be useful,
188 but WITHOUT ANY WARRANTY; without even the implied warranty of
189 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
190 GNU General Public License for more details.
192 You should have received a copy of the GNU General Public License
193 along with this program; if not, write to the Free Software
194 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
200 #include "complain.h"
201 #include "conflicts.h"
205 #include "muscle_tab.h"
207 #include "quotearg.h"
210 #include "strverscmp.h"
212 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
213 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
215 #define YY_LOCATION_PRINT(File, Loc) \
216 location_print (File, Loc)
218 static void version_check (location
const *loc
, char const *version
);
220 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
221 FIXME: depends on the undocumented availability of YYLLOC. */
223 #define yyerror(Msg) \
224 gram_error (&yylloc, Msg)
225 static void gram_error (location
const *, char const *);
227 static void add_param (char const *, char *, location
);
229 static symbol_class current_class
= unknown_sym
;
230 static uniqstr current_type
= 0;
232 location current_lhs_location
;
234 static int current_prec
= 0;
237 /* Enabling traces. */
242 /* Enabling verbose error messages. */
243 #ifdef YYERROR_VERBOSE
244 # undef YYERROR_VERBOSE
245 # define YYERROR_VERBOSE 1
247 # define YYERROR_VERBOSE 1
250 /* Enabling the token table. */
251 #ifndef YYTOKEN_TABLE
252 # define YYTOKEN_TABLE 0
255 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
256 #line 82 "parse-gram.y"
257 typedef union YYSTYPE
{
265 /* Line 196 of yacc.c. */
266 #line 267 "parse-gram.c"
267 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
268 # define YYSTYPE_IS_DECLARED 1
269 # define YYSTYPE_IS_TRIVIAL 1
272 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
273 typedef struct YYLTYPE
280 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
281 # define YYLTYPE_IS_DECLARED 1
282 # define YYLTYPE_IS_TRIVIAL 1
286 /* Copy the second part of user declarations. */
289 /* Line 219 of yacc.c. */
290 #line 291 "parse-gram.c"
292 /* Define YYMODERN_C if this compiler supports C89 or better. If
293 __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
294 as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
295 reasons, but it defines __C99__FUNC__ so check that as well.
296 Consider a C++ compiler to be modern if it defines __cplusplus. */
298 # if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
299 # define YYMODERN_C 1
301 # define YYMODERN_C 0
306 # if defined (__SIZE_TYPE__)
307 # define YYSIZE_T __SIZE_TYPE__
308 # elif defined (size_t)
309 # define YYSIZE_T size_t
310 # elif ! defined (YYSIZE_T) && YYMODERN_C
311 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
312 # define YYSIZE_T size_t
314 # define YYSIZE_T unsigned int
318 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
323 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
324 # define YY_(msgid) dgettext ("bison-runtime", msgid)
328 # define YY_(msgid) msgid
332 /* Suppress unused-variable warnings by "using" E. */
333 #define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
335 #if ! defined (yyoverflow) || YYERROR_VERBOSE
337 /* The parser invokes alloca or malloc; define the necessary symbols. */
339 # ifdef YYSTACK_USE_ALLOCA
340 # if YYSTACK_USE_ALLOCA
342 # define YYSTACK_ALLOC __builtin_alloca
343 # elif defined (__BUILTIN_VA_ARG_INCR)
344 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
345 # elif defined (_AIX)
346 # define YYSTACK_ALLOC __alloca
347 # elif defined (_MSC_VER)
348 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
349 # define alloca _alloca
351 # define YYSTACK_ALLOC alloca
352 # if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
353 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
362 # ifdef YYSTACK_ALLOC
363 /* Pacify GCC's `empty if-body' warning. */
364 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
365 # ifndef YYSTACK_ALLOC_MAXIMUM
366 /* The OS might guarantee only one guard page at the bottom of the stack,
367 and a page size can be as small as 4096 bytes. So we cannot safely
368 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
369 to allow for a few compiler-allocated temporary stack slots. */
370 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
373 # define YYSTACK_ALLOC YYMALLOC
374 # define YYSTACK_FREE YYFREE
375 # ifndef YYSTACK_ALLOC_MAXIMUM
376 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
382 # define YYMALLOC malloc
383 # if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
384 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
389 # if ! defined (free) && ! defined (_STDLIB_H) && YYMODERN_C
390 void free (void *); /* INFRINGES ON USER NAME SPACE */
397 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
400 #if (! defined (yyoverflow) \
401 && (! defined (__cplusplus) \
402 || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
403 && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
405 /* A type that is properly aligned for any stack member. */
413 /* The size of the maximum gap between one aligned stack and the next. */
414 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
416 /* The size of an array large to enough to hold all stacks, each with
418 # define YYSTACK_BYTES(N) \
419 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
420 + 2 * YYSTACK_GAP_MAXIMUM)
422 /* Copy COUNT objects from FROM to TO. The source and destination do
425 # if defined (__GNUC__) && 1 < __GNUC__
426 # define YYCOPY(To, From, Count) \
427 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
429 # define YYCOPY(To, From, Count) \
433 for (yyi = 0; yyi < (Count); yyi++) \
434 (To)[yyi] = (From)[yyi]; \
436 while (/*CONSTCOND*/ 0)
440 /* Relocate STACK from its old location to the new one. The
441 local variables YYSIZE and YYSTACKSIZE give the old and new number of
442 elements in the stack, and YYPTR gives the new location of the
443 stack. Advance YYPTR to a properly aligned location for the next
445 # define YYSTACK_RELOCATE(Stack) \
448 YYSIZE_T yynewbytes; \
449 YYCOPY (&yyptr->Stack, Stack, yysize); \
450 Stack = &yyptr->Stack; \
451 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
452 yyptr += yynewbytes / sizeof (*yyptr); \
454 while (/*CONSTCOND*/ 0)
459 typedef signed char yysigned_char
;
461 typedef short int yysigned_char
;
464 /* YYFINAL -- State number of the termination state. */
466 /* YYLAST -- Last index in YYTABLE. */
469 /* YYNTOKENS -- Number of terminals. */
471 /* YYNNTS -- Number of nonterminals. */
473 /* YYNRULES -- Number of rules. */
475 /* YYNRULES -- Number of states. */
476 #define YYNSTATES 110
478 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
480 #define YYMAXUTOK 306
482 #define YYTRANSLATE(YYX) \
483 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
485 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
486 static const unsigned char yytranslate
[] =
488 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
514 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
515 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
516 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
517 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
518 45, 46, 47, 48, 49, 50, 51
522 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
524 static const unsigned char yyprhs
[] =
526 0, 0, 3, 8, 9, 12, 14, 16, 18, 21,
527 25, 27, 29, 32, 35, 39, 41, 43, 45, 47,
528 51, 53, 55, 59, 61, 63, 66, 69, 71, 73,
529 75, 77, 79, 81, 84, 86, 89, 92, 94, 96,
530 97, 101, 102, 106, 110, 114, 116, 118, 120, 121,
531 123, 125, 128, 130, 132, 135, 138, 142, 144, 147,
532 149, 152, 154, 157, 160, 161, 165, 167, 171, 174,
533 175, 178, 181, 185, 189, 193, 195, 197, 199, 201,
537 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
538 static const yysigned_char yyrhs
[] =
540 53, 0, -1, 54, 48, 66, 76, -1, -1, 54,
541 55, -1, 56, -1, 49, -1, 17, -1, 19, 75,
542 -1, 19, 75, 75, -1, 20, -1, 21, -1, 22,
543 4, -1, 23, 4, -1, 24, 43, 75, -1, 25,
544 -1, 26, -1, 27, -1, 28, -1, 29, 43, 75,
545 -1, 31, -1, 32, -1, 33, 43, 75, -1, 34,
546 -1, 35, -1, 36, 75, -1, 37, 75, -1, 39,
547 -1, 40, -1, 41, -1, 44, -1, 60, -1, 57,
548 -1, 38, 72, -1, 10, -1, 8, 63, -1, 9,
549 63, -1, 18, -1, 30, -1, -1, 6, 58, 65,
550 -1, -1, 5, 59, 65, -1, 7, 42, 63, -1,
551 61, 62, 63, -1, 11, -1, 12, -1, 13, -1,
552 -1, 42, -1, 72, -1, 63, 72, -1, 42, -1,
553 46, -1, 46, 4, -1, 46, 74, -1, 46, 4,
554 74, -1, 64, -1, 65, 64, -1, 67, -1, 66,
555 67, -1, 68, -1, 56, 44, -1, 1, 44, -1,
556 -1, 47, 69, 70, -1, 71, -1, 70, 45, 71,
557 -1, 70, 44, -1, -1, 71, 72, -1, 71, 73,
558 -1, 71, 14, 72, -1, 71, 15, 4, -1, 71,
559 16, 42, -1, 46, -1, 74, -1, 51, -1, 3,
560 -1, 3, -1, -1, 48, 50, -1
563 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
564 static const unsigned short int yyrline
[] =
566 0, 192, 192, 200, 202, 206, 207, 208, 209, 210,
567 211, 212, 213, 214, 215, 216, 221, 225, 226, 227,
568 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
569 238, 242, 243, 244, 248, 254, 261, 268, 272, 279,
570 279, 284, 284, 289, 299, 314, 315, 316, 320, 321,
571 327, 328, 333, 337, 342, 348, 354, 365, 366, 375,
572 376, 382, 383, 388, 395, 395, 399, 400, 401, 406,
573 407, 409, 411, 413, 415, 420, 421, 425, 431, 440,
578 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
579 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
580 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
581 static const char *const yytname
[] =
583 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
584 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
585 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
586 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
587 "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
588 "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
589 "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"",
590 "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
591 "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"",
592 "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"",
593 "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"",
594 "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
595 "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input",
596 "declarations", "declaration", "grammar_declaration",
597 "symbol_declaration", "@1", "@2", "precedence_declaration",
598 "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
599 "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
600 "@3", "rhses.1", "rhs", "symbol", "action", "string_as_id",
601 "string_content", "epilogue.opt", 0
606 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
608 static const unsigned short int yytoknum
[] =
610 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
611 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
612 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
613 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
614 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
619 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
620 static const unsigned char yyr1
[] =
622 0, 52, 53, 54, 54, 55, 55, 55, 55, 55,
623 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
624 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
625 55, 56, 56, 56, 56, 56, 56, 56, 56, 58,
626 57, 59, 57, 57, 60, 61, 61, 61, 62, 62,
627 63, 63, 64, 64, 64, 64, 64, 65, 65, 66,
628 66, 67, 67, 67, 69, 68, 70, 70, 70, 71,
629 71, 71, 71, 71, 71, 72, 72, 73, 74, 75,
633 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
634 static const unsigned char yyr2
[] =
636 0, 2, 4, 0, 2, 1, 1, 1, 2, 3,
637 1, 1, 2, 2, 3, 1, 1, 1, 1, 3,
638 1, 1, 3, 1, 1, 2, 2, 1, 1, 1,
639 1, 1, 1, 2, 1, 2, 2, 1, 1, 0,
640 3, 0, 3, 3, 3, 1, 1, 1, 0, 1,
641 1, 2, 1, 1, 2, 2, 3, 1, 2, 1,
642 2, 1, 2, 2, 0, 3, 1, 3, 2, 0,
643 2, 2, 3, 3, 3, 1, 1, 1, 1, 1,
647 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
648 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
649 means the default is an error. */
650 static const unsigned char yydefact
[] =
652 3, 0, 0, 1, 41, 39, 0, 0, 0, 34,
653 45, 46, 47, 7, 37, 0, 10, 11, 0, 0,
654 0, 15, 16, 17, 18, 0, 38, 20, 21, 0,
655 23, 24, 0, 0, 0, 27, 28, 29, 30, 0,
656 6, 4, 5, 32, 31, 48, 0, 0, 0, 78,
657 75, 35, 50, 76, 36, 79, 8, 12, 13, 0,
658 0, 0, 25, 26, 33, 0, 64, 0, 0, 59,
659 61, 49, 0, 52, 53, 57, 42, 40, 43, 51,
660 9, 14, 19, 22, 63, 69, 62, 0, 60, 2,
661 44, 54, 55, 58, 65, 66, 81, 56, 68, 69,
662 0, 0, 0, 77, 70, 71, 67, 72, 73, 74
665 /* YYDEFGOTO[NTERM-NUM]. */
666 static const yysigned_char yydefgoto
[] =
668 -1, 1, 2, 41, 67, 43, 47, 46, 44, 45,
669 72, 51, 75, 76, 68, 69, 70, 85, 94, 95,
673 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
675 #define YYPACT_NINF -69
676 static const yysigned_char yypact
[] =
678 -69, 5, 112, -69, -69, -69, -35, 0, 0, -69,
679 -69, -69, -69, -69, -69, 13, -69, -69, 20, 31,
680 -18, -69, -69, -69, -69, -6, -69, -69, -69, -5,
681 -69, -69, 13, 13, 0, -69, -69, -69, -69, 69,
682 -69, -69, -69, -69, -69, -2, -38, -38, 0, -69,
683 -69, 0, -69, -69, 0, -69, 13, -69, -69, 13,
684 13, 13, -69, -69, -69, -8, -69, 3, 21, -69,
685 -69, -69, 0, -69, 6, -69, -38, -38, 0, -69,
686 -69, -69, -69, -69, -69, -69, -69, 2, -69, -69,
687 0, 39, -69, -69, -33, -1, -69, -69, -69, -69,
688 0, 44, 1, -69, -69, -69, -1, -69, -69, -69
691 /* YYPGOTO[NTERM-NUM]. */
692 static const yysigned_char yypgoto
[] =
694 -69, -69, -69, -69, 47, -69, -69, -69, -69, -69,
695 -69, -7, -58, 7, -69, -15, -69, -69, -69, -44,
696 -34, -69, -68, 30, -69
699 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
700 positive, shift that token. If negative, reduce the rule which
701 number is the opposite. If zero, do what YYDEFACT says.
702 If YYTABLE_NINF, syntax error. */
703 #define YYTABLE_NINF -81
704 static const yysigned_char yytable
[] =
706 64, 54, 49, 49, 73, 3, 92, 48, 74, 49,
707 91, 98, 99, 100, 101, 102, 55, 79, 93, 93,
708 79, -80, 65, 97, 57, 59, 4, 5, 6, 7,
709 8, 9, 10, 11, 12, 58, 84, 60, 61, 14,
710 71, 78, 49, 109, 79, 50, 50, 86, 108, 42,
711 103, 26, 96, 88, 77, 106, 79, 0, 0, 34,
712 0, 104, 62, 63, 0, 90, 107, 0, 66, 87,
713 65, 0, 104, 0, 4, 5, 6, 7, 8, 9,
714 10, 11, 12, 0, 0, 0, 80, 14, 0, 81,
715 82, 83, 0, 0, 0, 0, 0, 0, 0, 26,
716 0, 0, 0, 0, 0, 0, 0, 34, 0, 0,
717 0, 0, 0, 0, 0, 0, 66, 4, 5, 6,
718 7, 8, 9, 10, 11, 12, 0, 0, 0, 13,
719 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
720 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
721 34, 35, 36, 37, 0, 0, 38, 0, 0, 0,
725 static const yysigned_char yycheck
[] =
727 34, 8, 3, 3, 42, 0, 74, 42, 46, 3,
728 4, 44, 45, 14, 15, 16, 3, 51, 76, 77,
729 54, 0, 1, 91, 4, 43, 5, 6, 7, 8,
730 9, 10, 11, 12, 13, 4, 44, 43, 43, 18,
731 42, 48, 3, 42, 78, 46, 46, 44, 4, 2,
732 51, 30, 50, 68, 47, 99, 90, -1, -1, 38,
733 -1, 95, 32, 33, -1, 72, 100, -1, 47, 48,
734 1, -1, 106, -1, 5, 6, 7, 8, 9, 10,
735 11, 12, 13, -1, -1, -1, 56, 18, -1, 59,
736 60, 61, -1, -1, -1, -1, -1, -1, -1, 30,
737 -1, -1, -1, -1, -1, -1, -1, 38, -1, -1,
738 -1, -1, -1, -1, -1, -1, 47, 5, 6, 7,
739 8, 9, 10, 11, 12, 13, -1, -1, -1, 17,
740 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
741 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
742 38, 39, 40, 41, -1, -1, 44, -1, -1, -1,
746 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
747 symbol of state STATE-NUM. */
748 static const unsigned char yystos
[] =
750 0, 53, 54, 0, 5, 6, 7, 8, 9, 10,
751 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
752 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
753 34, 35, 36, 37, 38, 39, 40, 41, 44, 48,
754 49, 55, 56, 57, 60, 61, 59, 58, 42, 3,
755 46, 63, 72, 74, 63, 3, 75, 4, 4, 43,
756 43, 43, 75, 75, 72, 1, 47, 56, 66, 67,
757 68, 42, 62, 42, 46, 64, 65, 65, 63, 72,
758 75, 75, 75, 75, 44, 69, 44, 48, 67, 76,
759 63, 4, 74, 64, 70, 71, 50, 74, 44, 45,
760 14, 15, 16, 51, 72, 73, 71, 72, 4, 42
763 #define yyerrok (yyerrstatus = 0)
764 #define yyclearin (yychar = YYEMPTY)
768 #define YYACCEPT goto yyacceptlab
769 #define YYABORT goto yyabortlab
770 #define YYERROR goto yyerrorlab
773 /* Like YYERROR except do call yyerror. This remains here temporarily
774 to ease the transition to the new meaning of YYERROR, for GCC.
775 Once GCC version 2 has supplanted version 1, this can go. */
777 #define YYFAIL goto yyerrlab
779 #define YYRECOVERING() (!!yyerrstatus)
781 #define YYBACKUP(Token, Value) \
783 if (yychar == YYEMPTY && yylen == 1) \
787 yytoken = YYTRANSLATE (yychar); \
793 yyerror (YY_("syntax error: cannot back up")); \
796 while (/*CONSTCOND*/ 0)
800 #define YYERRCODE 256
803 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
804 If N is 0, then set CURRENT to the empty location which ends
805 the previous symbol: RHS[0] (always defined). */
807 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
808 #ifndef YYLLOC_DEFAULT
809 # define YYLLOC_DEFAULT(Current, Rhs, N) \
813 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
814 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
815 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
816 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
820 (Current).first_line = (Current).last_line = \
821 YYRHSLOC (Rhs, 0).last_line; \
822 (Current).first_column = (Current).last_column = \
823 YYRHSLOC (Rhs, 0).last_column; \
825 while (/*CONSTCOND*/ 0)
829 /* YY_LOCATION_PRINT -- Print the location on the stream.
830 This macro was not mandated originally: define only if we know
831 we won't break user code: when these are the locations we know. */
833 #ifndef YY_LOCATION_PRINT
834 # if YYLTYPE_IS_TRIVIAL
835 # define YY_LOCATION_PRINT(File, Loc) \
836 fprintf (File, "%d.%d-%d.%d", \
837 (Loc).first_line, (Loc).first_column, \
838 (Loc).last_line, (Loc).last_column)
840 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
845 /* YYLEX -- calling `yylex' with the right arguments. */
848 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
850 # define YYLEX yylex (&yylval, &yylloc)
853 /* Enable debugging if requested. */
857 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
858 # define YYFPRINTF fprintf
861 # define YYDPRINTF(Args) \
865 } while (/*CONSTCOND*/ 0)
867 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
871 YYFPRINTF (stderr, "%s ", Title); \
872 yysymprint (stderr, \
873 Type, Value, Location); \
874 YYFPRINTF (stderr, "\n"); \
876 } while (/*CONSTCOND*/ 0)
878 /*------------------------------------------------------------------.
879 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
881 `------------------------------------------------------------------*/
883 #if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
885 yy_stack_print (short int *bottom
, short int *top
)
888 yy_stack_print (bottom
, top
)
893 YYFPRINTF (stderr
, "Stack now");
894 for (/* Nothing. */; bottom
<= top
; ++bottom
)
895 YYFPRINTF (stderr
, " %d", *bottom
);
896 YYFPRINTF (stderr
, "\n");
899 # define YY_STACK_PRINT(Bottom, Top) \
902 yy_stack_print ((Bottom), (Top)); \
903 } while (/*CONSTCOND*/ 0)
906 /*------------------------------------------------.
907 | Report that the YYRULE is going to be reduced. |
908 `------------------------------------------------*/
910 #if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
912 yy_reduce_print (int yyrule
)
915 yy_reduce_print (yyrule
)
920 unsigned long int yylno
= yyrline
[yyrule
];
921 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu), ",
923 /* Print the symbols being reduced, and their result. */
924 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
925 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
926 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
929 # define YY_REDUCE_PRINT(Rule) \
932 yy_reduce_print (Rule); \
933 } while (/*CONSTCOND*/ 0)
935 /* Nonzero means print parse trace. It is left uninitialized so that
936 multiple parsers can coexist. */
939 # define YYDPRINTF(Args)
940 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
941 # define YY_STACK_PRINT(Bottom, Top)
942 # define YY_REDUCE_PRINT(Rule)
943 #endif /* !YYDEBUG */
946 /* YYINITDEPTH -- initial size of the parser's stacks. */
948 # define YYINITDEPTH 200
951 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
952 if the built-in stack extension method is used).
954 Do not make this value too large; the results are undefined if
955 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
956 evaluated with infinite-precision integer arithmetic. */
959 # define YYMAXDEPTH 10000
967 # if defined (__GLIBC__) && defined (_STRING_H)
968 # define yystrlen strlen
970 /* Return the length of YYSTR. */
973 yystrlen (const char *yystr
)
979 const char *yys
= yystr
;
981 while (*yys
++ != '\0')
984 return yys
- yystr
- 1;
990 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
991 # define yystpcpy stpcpy
993 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
997 yystpcpy (char *yydest
, const char *yysrc
)
999 yystpcpy (yydest
, yysrc
)
1005 const char *yys
= yysrc
;
1007 while ((*yyd
++ = *yys
++) != '\0')
1016 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1017 quotes and backslashes, so that it's suitable for yyerror. The
1018 heuristic is that double-quoting is unnecessary unless the string
1019 contains an apostrophe, a comma, or backslash (other than
1020 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1021 null, do not copy; instead, return the length of what the result
1024 yytnamerr (char *yyres
, const char *yystr
)
1029 char const *yyp
= yystr
;
1036 goto do_not_strip_quotes
;
1040 goto do_not_strip_quotes
;
1053 do_not_strip_quotes
: ;
1057 return yystrlen (yystr
);
1059 return yystpcpy (yyres
, yystr
) - yyres
;
1063 /* Copy into YYRESULT an error message about the unexpected token
1064 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1065 including the terminating null byte. If YYRESULT is null, do not
1066 copy anything; just return the number of bytes that would be
1067 copied. As a special case, return 0 if an ordinary "syntax error"
1068 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1069 size calculation. */
1071 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1073 int yyn
= yypact
[yystate
];
1075 if (! (YYPACT_NINF
< yyn
&& yyn
< YYLAST
))
1079 int yytype
= YYTRANSLATE (yychar
);
1080 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1081 YYSIZE_T yysize
= yysize0
;
1083 int yysize_overflow
= 0;
1084 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1085 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1089 /* This is so xgettext sees the translatable formats that are
1090 constructed on the fly. */
1091 YY_("syntax error, unexpected %s");
1092 YY_("syntax error, unexpected %s, expecting %s");
1093 YY_("syntax error, unexpected %s, expecting %s or %s");
1094 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1095 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1099 static char const yyunexpected
[] = "syntax error, unexpected %s";
1100 static char const yyexpecting
[] = ", expecting %s";
1101 static char const yyor
[] = " or %s";
1102 char yyformat
[sizeof yyunexpected
1103 + sizeof yyexpecting
- 1
1104 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1105 * (sizeof yyor
- 1))];
1106 char const *yyprefix
= yyexpecting
;
1108 /* Start YYX at -YYN if negative to avoid negative indexes in
1110 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1112 /* Stay within bounds of both yycheck and yytname. */
1113 int yychecklim
= YYLAST
- yyn
;
1114 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1117 yyarg
[0] = yytname
[yytype
];
1118 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1120 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1121 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1123 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1127 yyformat
[sizeof yyunexpected
- 1] = '\0';
1130 yyarg
[yycount
++] = yytname
[yyx
];
1131 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1132 yysize_overflow
|= yysize1
< yysize
;
1134 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1138 yyf
= YY_(yyformat
);
1139 yysize1
= yysize
+ yystrlen (yyf
);
1140 yysize_overflow
|= yysize1
< yysize
;
1143 if (yysize_overflow
)
1144 return YYSIZE_MAXIMUM
;
1148 /* Avoid sprintf, as that infringes on the user's name space.
1149 Don't have undefined behavior even if the translation
1150 produced a string with the wrong number of "%s"s. */
1151 char *yyp
= yyresult
;
1153 while ((*yyp
= *yyf
))
1155 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1157 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1170 #endif /* YYERROR_VERBOSE */
1174 /*--------------------------------.
1175 | Print this symbol on YYOUTPUT. |
1176 `--------------------------------*/
1178 #if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
1180 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1183 yysymprint (yyoutput
, yytype
, yyvaluep
, yylocationp
)
1187 YYLTYPE
*yylocationp
;
1191 YYUSE (yylocationp
);
1193 if (yytype
< YYNTOKENS
)
1194 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1196 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1198 YY_LOCATION_PRINT (yyoutput
, *yylocationp
);
1199 YYFPRINTF (yyoutput
, ": ");
1202 if (yytype
< YYNTOKENS
)
1203 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1207 case 3: /* "\"string\"" */
1208 #line 169 "parse-gram.y"
1209 { fprintf (stderr
, "\"%s\"", (yyvaluep
->chars
)); };
1210 #line 1211 "parse-gram.c"
1212 case 4: /* "\"integer\"" */
1213 #line 182 "parse-gram.y"
1214 { fprintf (stderr
, "%d", (yyvaluep
->integer
)); };
1215 #line 1216 "parse-gram.c"
1217 case 8: /* "\"%destructor {...}\"" */
1218 #line 171 "parse-gram.y"
1219 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1220 #line 1221 "parse-gram.c"
1222 case 9: /* "\"%printer {...}\"" */
1223 #line 175 "parse-gram.y"
1224 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1225 #line 1226 "parse-gram.c"
1227 case 10: /* "\"%union {...}\"" */
1228 #line 176 "parse-gram.y"
1229 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1230 #line 1231 "parse-gram.c"
1232 case 26: /* "\"%initial-action {...}\"" */
1233 #line 172 "parse-gram.y"
1234 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1235 #line 1236 "parse-gram.c"
1237 case 27: /* "\"%lex-param {...}\"" */
1238 #line 173 "parse-gram.y"
1239 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1240 #line 1241 "parse-gram.c"
1242 case 34: /* "\"%parse-param {...}\"" */
1243 #line 174 "parse-gram.y"
1244 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1245 #line 1246 "parse-gram.c"
1247 case 42: /* "\"type\"" */
1248 #line 180 "parse-gram.y"
1249 { fprintf (stderr
, "<%s>", (yyvaluep
->uniqstr
)); };
1250 #line 1251 "parse-gram.c"
1252 case 46: /* "\"identifier\"" */
1253 #line 184 "parse-gram.y"
1254 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1255 #line 1256 "parse-gram.c"
1257 case 47: /* "\"identifier:\"" */
1258 #line 186 "parse-gram.y"
1259 { fprintf (stderr
, "%s:", (yyvaluep
->symbol
)->tag
); };
1260 #line 1261 "parse-gram.c"
1262 case 49: /* "\"%{...%}\"" */
1263 #line 178 "parse-gram.y"
1264 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1265 #line 1266 "parse-gram.c"
1267 case 50: /* "\"epilogue\"" */
1268 #line 178 "parse-gram.y"
1269 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1270 #line 1271 "parse-gram.c"
1272 case 51: /* "\"{...}\"" */
1273 #line 177 "parse-gram.y"
1274 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1275 #line 1276 "parse-gram.c"
1277 case 72: /* "symbol" */
1278 #line 184 "parse-gram.y"
1279 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1280 #line 1281 "parse-gram.c"
1282 case 73: /* "action" */
1283 #line 177 "parse-gram.y"
1284 { fprintf (stderr
, "{\n%s\n}", (yyvaluep
->chars
)); };
1285 #line 1286 "parse-gram.c"
1287 case 74: /* "string_as_id" */
1288 #line 184 "parse-gram.y"
1289 { fprintf (stderr
, "%s", (yyvaluep
->symbol
)->tag
); };
1290 #line 1291 "parse-gram.c"
1292 case 75: /* "string_content" */
1293 #line 169 "parse-gram.y"
1294 { fprintf (stderr
, "\"%s\"", (yyvaluep
->chars
)); };
1295 #line 1296 "parse-gram.c"
1300 YYFPRINTF (yyoutput
, ")");
1303 #endif /* ! YYDEBUG */
1304 /*-----------------------------------------------.
1305 | Release the memory associated to this symbol. |
1306 `-----------------------------------------------*/
1308 #if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
1310 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
1313 yydestruct (yymsg
, yytype
, yyvaluep
, yylocationp
)
1317 YYLTYPE
*yylocationp
;
1321 YYUSE (yylocationp
);
1325 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1336 /* Prevent warnings from -Wmissing-prototypes. */
1338 #ifdef YYPARSE_PARAM
1340 int yyparse (void *YYPARSE_PARAM
);
1344 #else /* ! YYPARSE_PARAM */
1345 #if defined (__STDC__) || defined (__cplusplus)
1350 #endif /* ! YYPARSE_PARAM */
1361 #ifdef YYPARSE_PARAM
1363 int yyparse (void *YYPARSE_PARAM
)
1365 int yyparse (YYPARSE_PARAM
)
1366 void *YYPARSE_PARAM
;
1368 #else /* ! YYPARSE_PARAM */
1369 #if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
1379 /* The look-ahead symbol. */
1382 /* The semantic value of the look-ahead symbol. */
1385 /* Number of syntax errors so far. */
1387 /* Location data for the look-ahead symbol. */
1393 /* Number of tokens to shift before error messages enabled. */
1395 /* Look-ahead token as an internal (translated) token number. */
1398 /* Buffer for error messages, and its allocated size. */
1400 char *yymsg
= yymsgbuf
;
1401 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1404 /* Three stacks and their tools:
1405 `yyss': related to states,
1406 `yyvs': related to semantic values,
1407 `yyls': related to locations.
1409 Refer to the stacks thru separate pointers, to allow yyoverflow
1410 to reallocate them elsewhere. */
1412 /* The state stack. */
1413 short int yyssa
[YYINITDEPTH
];
1414 short int *yyss
= yyssa
;
1417 /* The semantic value stack. */
1418 YYSTYPE yyvsa
[YYINITDEPTH
];
1419 YYSTYPE
*yyvs
= yyvsa
;
1422 /* The location stack. */
1423 YYLTYPE yylsa
[YYINITDEPTH
];
1424 YYLTYPE
*yyls
= yylsa
;
1426 /* The locations where the error started and ended. */
1427 YYLTYPE yyerror_range
[2];
1429 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1431 YYSIZE_T yystacksize
= YYINITDEPTH
;
1433 /* The variables used to return semantic value and location from the
1438 /* When reducing, the number of symbols on the RHS of the reduced
1442 YYDPRINTF ((stderr
, "Starting parse\n"));
1447 yychar
= YYEMPTY
; /* Cause a token to be read. */
1449 /* Initialize stack pointers.
1450 Waste one element of value and location stack
1451 so that they stay on the same level as the state stack.
1452 The wasted elements are never initialized. */
1457 #if YYLTYPE_IS_TRIVIAL
1458 /* Initialize the default location before parsing starts. */
1459 yylloc
.first_line
= yylloc
.last_line
= 1;
1460 yylloc
.first_column
= yylloc
.last_column
= 0;
1464 /* User initialization code. */
1465 #line 72 "parse-gram.y"
1467 /* Bison's grammar can initial empty locations, hence a default
1468 location is needed. */
1469 yylloc
.start
.file
= yylloc
.end
.file
= current_file
;
1470 yylloc
.start
.line
= yylloc
.end
.line
= 1;
1471 yylloc
.start
.column
= yylloc
.end
.column
= 0;
1473 /* Line 1066 of yacc.c. */
1474 #line 1475 "parse-gram.c"
1478 /*------------------------------------------------------------.
1479 | yynewstate -- Push a new state, which is found in yystate. |
1480 `------------------------------------------------------------*/
1482 /* In all cases, when you get here, the value and location stacks
1483 have just been pushed. so pushing a state here evens the stacks.
1490 if (yyss
+ yystacksize
- 1 <= yyssp
)
1492 /* Get the current used size of the three stacks, in elements. */
1493 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1497 /* Give user a chance to reallocate the stack. Use copies of
1498 these so that the &'s don't force the real ones into
1500 YYSTYPE
*yyvs1
= yyvs
;
1501 short int *yyss1
= yyss
;
1502 YYLTYPE
*yyls1
= yyls
;
1504 /* Each stack pointer address is followed by the size of the
1505 data in use in that stack, in bytes. This used to be a
1506 conditional around just the two extra args, but that might
1507 be undefined if yyoverflow is a macro. */
1508 yyoverflow (YY_("memory exhausted"),
1509 &yyss1
, yysize
* sizeof (*yyssp
),
1510 &yyvs1
, yysize
* sizeof (*yyvsp
),
1511 &yyls1
, yysize
* sizeof (*yylsp
),
1517 #else /* no yyoverflow */
1518 # ifndef YYSTACK_RELOCATE
1519 goto yyexhaustedlab
;
1521 /* Extend the stack our own way. */
1522 if (YYMAXDEPTH
<= yystacksize
)
1523 goto yyexhaustedlab
;
1525 if (YYMAXDEPTH
< yystacksize
)
1526 yystacksize
= YYMAXDEPTH
;
1529 short int *yyss1
= yyss
;
1530 union yyalloc
*yyptr
=
1531 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1533 goto yyexhaustedlab
;
1534 YYSTACK_RELOCATE (yyss
);
1535 YYSTACK_RELOCATE (yyvs
);
1536 YYSTACK_RELOCATE (yyls
);
1537 # undef YYSTACK_RELOCATE
1539 YYSTACK_FREE (yyss1
);
1542 #endif /* no yyoverflow */
1544 yyssp
= yyss
+ yysize
- 1;
1545 yyvsp
= yyvs
+ yysize
- 1;
1546 yylsp
= yyls
+ yysize
- 1;
1548 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1549 (unsigned long int) yystacksize
));
1551 if (yyss
+ yystacksize
- 1 <= yyssp
)
1555 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1564 /* Do appropriate processing given the current state. */
1565 /* Read a look-ahead token if we need one and don't already have one. */
1568 /* First try to decide what to do without reference to look-ahead token. */
1570 yyn
= yypact
[yystate
];
1571 if (yyn
== YYPACT_NINF
)
1574 /* Not known => get a look-ahead token if don't already have one. */
1576 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1577 if (yychar
== YYEMPTY
)
1579 YYDPRINTF ((stderr
, "Reading a token: "));
1583 if (yychar
<= YYEOF
)
1585 yychar
= yytoken
= YYEOF
;
1586 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1590 yytoken
= YYTRANSLATE (yychar
);
1591 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1594 /* If the proper action on seeing token YYTOKEN is to reduce or to
1595 detect an error, take that action. */
1597 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1602 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1611 /* Shift the look-ahead token. */
1612 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1614 /* Discard the token being shifted unless it is eof. */
1615 if (yychar
!= YYEOF
)
1621 /* Count tokens shifted since error; after three, turn off error
1630 /*-----------------------------------------------------------.
1631 | yydefault -- do the default action for the current state. |
1632 `-----------------------------------------------------------*/
1634 yyn
= yydefact
[yystate
];
1640 /*-----------------------------.
1641 | yyreduce -- Do a reduction. |
1642 `-----------------------------*/
1644 /* yyn is the number of a rule to reduce with. */
1647 /* If YYLEN is nonzero, implement the default value of the action:
1650 Otherwise, the following line sets YYVAL to garbage.
1651 This behavior is undocumented and Bison
1652 users should not rely upon it. Assigning to YYVAL
1653 unconditionally makes the parser a bit smaller, and it avoids a
1654 GCC warning that YYVAL may be used uninitialized. */
1655 yyval
= yyvsp
[1-yylen
];
1657 /* Default location. */
1658 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);
1659 YY_REDUCE_PRINT (yyn
);
1663 #line 207 "parse-gram.y"
1664 { prologue_augment ((yyvsp
[0].chars
), (yylsp
[0])); }
1668 #line 208 "parse-gram.y"
1669 { debug_flag
= true; }
1673 #line 209 "parse-gram.y"
1674 { muscle_insert ((yyvsp
[0].chars
), "1"); }
1678 #line 210 "parse-gram.y"
1679 { muscle_insert ((yyvsp
[-1].chars
), (yyvsp
[0].chars
)); }
1683 #line 211 "parse-gram.y"
1684 { defines_flag
= true; }
1688 #line 212 "parse-gram.y"
1689 { error_verbose
= true; }
1693 #line 213 "parse-gram.y"
1694 { expected_sr_conflicts
= (yyvsp
[0].integer
); }
1698 #line 214 "parse-gram.y"
1699 { expected_rr_conflicts
= (yyvsp
[0].integer
); }
1703 #line 215 "parse-gram.y"
1704 { spec_file_prefix
= (yyvsp
[0].chars
); }
1708 #line 217 "parse-gram.y"
1710 nondeterministic_parser
= true;
1716 #line 222 "parse-gram.y"
1718 muscle_code_grow ("initial_action", (yyvsp
[0].chars
), (yylsp
[0]));
1723 #line 225 "parse-gram.y"
1724 { add_param ("lex_param", (yyvsp
[0].chars
), (yylsp
[0])); }
1728 #line 226 "parse-gram.y"
1729 { locations_flag
= true; }
1733 #line 227 "parse-gram.y"
1734 { spec_name_prefix
= (yyvsp
[0].chars
); }
1738 #line 228 "parse-gram.y"
1739 { no_lines_flag
= true; }
1743 #line 229 "parse-gram.y"
1744 { nondeterministic_parser
= true; }
1748 #line 230 "parse-gram.y"
1749 { spec_outfile
= (yyvsp
[0].chars
); }
1753 #line 231 "parse-gram.y"
1754 { add_param ("parse_param", (yyvsp
[0].chars
), (yylsp
[0])); }
1758 #line 232 "parse-gram.y"
1759 { pure_parser
= true; }
1763 #line 233 "parse-gram.y"
1764 { version_check (&(yylsp
[0]), (yyvsp
[0].chars
)); }
1768 #line 234 "parse-gram.y"
1769 { skeleton
= (yyvsp
[0].chars
); }
1773 #line 235 "parse-gram.y"
1774 { token_table_flag
= true; }
1778 #line 236 "parse-gram.y"
1779 { report_flag
= report_states
; }
1783 #line 237 "parse-gram.y"
1784 { yacc_flag
= true; }
1788 #line 245 "parse-gram.y"
1790 grammar_start_symbol_set ((yyvsp
[0].symbol
), (yylsp
[0]));
1795 #line 249 "parse-gram.y"
1798 MUSCLE_INSERT_INT ("stype_line", (yylsp
[0]).start
.line
);
1799 muscle_insert ("stype", (yyvsp
[0].chars
));
1804 #line 255 "parse-gram.y"
1807 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
1808 symbol_destructor_set (list
->sym
, (yyvsp
[-1].chars
), (yylsp
[-1]));
1809 symbol_list_free ((yyvsp
[0].list
));
1814 #line 262 "parse-gram.y"
1817 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
1818 symbol_printer_set (list
->sym
, (yyvsp
[-1].chars
), list
->location
);
1819 symbol_list_free ((yyvsp
[0].list
));
1824 #line 269 "parse-gram.y"
1826 default_prec
= true;
1831 #line 273 "parse-gram.y"
1833 default_prec
= false;
1838 #line 279 "parse-gram.y"
1839 { current_class
= nterm_sym
; }
1843 #line 280 "parse-gram.y"
1845 current_class
= unknown_sym
;
1846 current_type
= NULL
;
1851 #line 284 "parse-gram.y"
1852 { current_class
= token_sym
; }
1856 #line 285 "parse-gram.y"
1858 current_class
= unknown_sym
;
1859 current_type
= NULL
;
1864 #line 290 "parse-gram.y"
1867 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
1868 symbol_type_set (list
->sym
, (yyvsp
[-1].uniqstr
), (yylsp
[-1]));
1869 symbol_list_free ((yyvsp
[0].list
));
1874 #line 300 "parse-gram.y"
1878 for (list
= (yyvsp
[0].list
); list
; list
= list
->next
)
1880 symbol_type_set (list
->sym
, current_type
, (yylsp
[-1]));
1881 symbol_precedence_set (list
->sym
, current_prec
, (yyvsp
[-2].assoc
), (yylsp
[-2]));
1883 symbol_list_free ((yyvsp
[0].list
));
1884 current_type
= NULL
;
1889 #line 314 "parse-gram.y"
1890 { (yyval
.assoc
) = left_assoc
; }
1894 #line 315 "parse-gram.y"
1895 { (yyval
.assoc
) = right_assoc
; }
1899 #line 316 "parse-gram.y"
1900 { (yyval
.assoc
) = non_assoc
; }
1904 #line 320 "parse-gram.y"
1905 { current_type
= NULL
; }
1909 #line 321 "parse-gram.y"
1910 { current_type
= (yyvsp
[0].uniqstr
); }
1914 #line 327 "parse-gram.y"
1915 { (yyval
.list
) = symbol_list_new ((yyvsp
[0].symbol
), (yylsp
[0])); }
1919 #line 328 "parse-gram.y"
1920 { (yyval
.list
) = symbol_list_prepend ((yyvsp
[-1].list
), (yyvsp
[0].symbol
), (yylsp
[0])); }
1924 #line 334 "parse-gram.y"
1926 current_type
= (yyvsp
[0].uniqstr
);
1931 #line 338 "parse-gram.y"
1933 symbol_class_set ((yyvsp
[0].symbol
), current_class
, (yylsp
[0]));
1934 symbol_type_set ((yyvsp
[0].symbol
), current_type
, (yylsp
[0]));
1939 #line 343 "parse-gram.y"
1941 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]));
1942 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
1943 symbol_user_token_number_set ((yyvsp
[-1].symbol
), (yyvsp
[0].integer
), (yylsp
[0]));
1948 #line 349 "parse-gram.y"
1950 symbol_class_set ((yyvsp
[-1].symbol
), current_class
, (yylsp
[-1]));
1951 symbol_type_set ((yyvsp
[-1].symbol
), current_type
, (yylsp
[-1]));
1952 symbol_make_alias ((yyvsp
[-1].symbol
), (yyvsp
[0].symbol
), (yyloc
));
1957 #line 355 "parse-gram.y"
1959 symbol_class_set ((yyvsp
[-2].symbol
), current_class
, (yylsp
[-2]));
1960 symbol_type_set ((yyvsp
[-2].symbol
), current_type
, (yylsp
[-2]));
1961 symbol_user_token_number_set ((yyvsp
[-2].symbol
), (yyvsp
[-1].integer
), (yylsp
[-1]));
1962 symbol_make_alias ((yyvsp
[-2].symbol
), (yyvsp
[0].symbol
), (yyloc
));
1967 #line 384 "parse-gram.y"
1970 complain_at ((yyloc
), _("POSIX forbids declarations in the grammar"));
1975 #line 389 "parse-gram.y"
1982 #line 395 "parse-gram.y"
1983 { current_lhs
= (yyvsp
[0].symbol
); current_lhs_location
= (yylsp
[0]); }
1987 #line 399 "parse-gram.y"
1988 { grammar_rule_end ((yylsp
[0])); }
1992 #line 400 "parse-gram.y"
1993 { grammar_rule_end ((yylsp
[0])); }
1997 #line 406 "parse-gram.y"
1998 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
2002 #line 408 "parse-gram.y"
2003 { grammar_current_rule_symbol_append ((yyvsp
[0].symbol
), (yylsp
[0])); }
2007 #line 410 "parse-gram.y"
2008 { grammar_current_rule_action_append ((yyvsp
[0].chars
), (yylsp
[0])); }
2012 #line 412 "parse-gram.y"
2013 { grammar_current_rule_prec_set ((yyvsp
[0].symbol
), (yylsp
[0])); }
2017 #line 414 "parse-gram.y"
2018 { grammar_current_rule_dprec_set ((yyvsp
[0].integer
), (yylsp
[0])); }
2022 #line 416 "parse-gram.y"
2023 { grammar_current_rule_merge_set ((yyvsp
[0].uniqstr
), (yylsp
[0])); }
2027 #line 420 "parse-gram.y"
2028 { (yyval
.symbol
) = (yyvsp
[0].symbol
); }
2032 #line 421 "parse-gram.y"
2033 { (yyval
.symbol
) = (yyvsp
[0].symbol
); }
2037 #line 426 "parse-gram.y"
2038 { (yyval
.chars
) = (yyvsp
[0].chars
); }
2042 #line 432 "parse-gram.y"
2044 (yyval
.symbol
) = symbol_get (quotearg_style (c_quoting_style
, (yyvsp
[0].chars
)), (yylsp
[0]));
2045 symbol_class_set ((yyval
.symbol
), token_sym
, (yylsp
[0]));
2050 #line 441 "parse-gram.y"
2051 { (yyval
.chars
) = (yyvsp
[0].chars
); }
2055 #line 448 "parse-gram.y"
2057 muscle_code_grow ("epilogue", (yyvsp
[0].chars
), (yylsp
[0]));
2058 scanner_last_string_free ();
2066 /* Line 1262 of yacc.c. */
2067 #line 2068 "parse-gram.c"
2073 YY_STACK_PRINT (yyss
, yyssp
);
2078 /* Now `shift' the result of the reduction. Determine what state
2079 that goes to, based on the state we popped back to and the rule
2080 number reduced by. */
2084 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2085 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2086 yystate
= yytable
[yystate
];
2088 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2093 /*------------------------------------.
2094 | yyerrlab -- here on detecting error |
2095 `------------------------------------*/
2097 /* If not already recovering from an error, report this error. */
2101 #if ! YYERROR_VERBOSE
2102 yyerror (YY_("syntax error"));
2105 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2106 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2108 YYSIZE_T yyalloc
= 2 * yysize
;
2109 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2110 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2111 if (yymsg
!= yymsgbuf
)
2112 YYSTACK_FREE (yymsg
);
2113 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2115 yymsg_alloc
= yyalloc
;
2119 yymsg_alloc
= sizeof yymsgbuf
;
2123 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2125 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2130 yyerror (YY_("syntax error"));
2132 goto yyexhaustedlab
;
2138 yyerror_range
[0] = yylloc
;
2140 if (yyerrstatus
== 3)
2142 /* If just tried and failed to reuse look-ahead token after an
2143 error, discard it. */
2145 if (yychar
<= YYEOF
)
2147 /* Return failure if at end of input. */
2148 if (yychar
== YYEOF
)
2153 yydestruct ("Error: discarding", yytoken
, &yylval
, &yylloc
);
2158 /* Else will try to reuse look-ahead token after shifting the error
2163 /*---------------------------------------------------.
2164 | yyerrorlab -- error raised explicitly by YYERROR. |
2165 `---------------------------------------------------*/
2168 /* Pacify compilers like GCC when the user code never invokes
2169 YYERROR and the label yyerrorlab therefore never appears in user
2171 if (/*CONSTCOND*/ 0)
2174 yyerror_range
[0] = yylsp
[1-yylen
];
2182 /*-------------------------------------------------------------.
2183 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2184 `-------------------------------------------------------------*/
2186 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2190 yyn
= yypact
[yystate
];
2191 if (yyn
!= YYPACT_NINF
)
2194 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2202 /* Pop the current state because it cannot handle the error token. */
2206 yyerror_range
[0] = *yylsp
;
2207 yydestruct ("Error: popping", yystos
[yystate
], yyvsp
, yylsp
);
2210 YY_STACK_PRINT (yyss
, yyssp
);
2218 yyerror_range
[1] = yylloc
;
2219 /* Using YYLLOC is tempting, but would change the location of
2220 the look-ahead. YYLOC is available though. */
2221 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
2224 /* Shift the error token. */
2225 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2231 /*-------------------------------------.
2232 | yyacceptlab -- YYACCEPT comes here. |
2233 `-------------------------------------*/
2238 /*-----------------------------------.
2239 | yyabortlab -- YYABORT comes here. |
2240 `-----------------------------------*/
2246 /*-------------------------------------------------.
2247 | yyexhaustedlab -- memory exhaustion comes here. |
2248 `-------------------------------------------------*/
2250 yyerror (YY_("memory exhausted"));
2256 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2257 yydestruct ("Cleanup: discarding lookahead",
2258 yytoken
, &yylval
, &yylloc
);
2259 while (yyssp
!= yyss
)
2261 yydestruct ("Cleanup: popping",
2262 yystos
[*yyssp
], yyvsp
, yylsp
);
2267 YYSTACK_FREE (yyss
);
2270 if (yymsg
!= yymsgbuf
)
2271 YYSTACK_FREE (yymsg
);
2277 #line 454 "parse-gram.y"
2281 /* Return the location of the left-hand side of a rule whose
2282 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
2283 the right-hand side, and return an empty location equal to the end
2284 boundary of RHS[0] if the right-hand side is empty. */
2287 lloc_default (YYLTYPE
const *rhs
, int n
)
2292 /* SGI MIPSpro 7.4.1m miscompiles "loc.start = loc.end = rhs[n].end;".
2293 The bug is fixed in 7.4.2m, but play it safe for now. */
2294 loc
.start
= rhs
[n
].end
;
2295 loc
.end
= rhs
[n
].end
;
2297 /* Ignore empty nonterminals the start of the the right-hand side.
2298 Do not bother to ignore them at the end of the right-hand side,
2299 since empty nonterminals have the same end as their predecessors. */
2300 for (i
= 1; i
<= n
; i
++)
2301 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
2303 loc
.start
= rhs
[i
].start
;
2311 /* Add a lex-param or a parse-param (depending on TYPE) with
2312 declaration DECL and location LOC. */
2315 add_param (char const *type
, char *decl
, location loc
)
2317 static char const alphanum
[26 + 26 + 1 + 10] =
2318 "abcdefghijklmnopqrstuvwxyz"
2319 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2322 char const *name_start
= NULL
;
2325 /* Stop on last actual character. */
2326 for (p
= decl
; p
[1]; p
++)
2328 || ! memchr (alphanum
, p
[-1], sizeof alphanum
))
2329 && memchr (alphanum
, p
[0], sizeof alphanum
- 10))
2332 /* Strip the surrounding '{' and '}', and any blanks just inside
2334 while (*--p
== ' ' || *p
== '\t')
2337 while (*++decl
== ' ' || *decl
== '\t')
2341 complain_at (loc
, _("missing identifier in parameter declaration"));
2348 memchr (alphanum
, name_start
[name_len
], sizeof alphanum
);
2352 name
= xmalloc (name_len
+ 1);
2353 memcpy (name
, name_start
, name_len
);
2354 name
[name_len
] = '\0';
2355 muscle_pair_list_grow (type
, decl
, name
);
2359 scanner_last_string_free ();
2363 version_check (location
const *loc
, char const *version
)
2365 if (strverscmp (version
, PACKAGE_VERSION
) > 0)
2367 complain_at (*loc
, "require bison %s, but have %s",
2368 version
, PACKAGE_VERSION
);
2374 gram_error (location
const *loc
, char const *msg
)
2376 complain_at (*loc
, "%s", msg
);
2380 token_name (int type
)
2382 return yytname
[YYTRANSLATE (type
)];