1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
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,
82 PERCENT_DEFINES
= 274,
83 PERCENT_ERROR_VERBOSE
= 275,
85 PERCENT_FILE_PREFIX
= 277,
86 PERCENT_GLR_PARSER
= 278,
87 PERCENT_LEX_PARAM
= 279,
88 PERCENT_LOCATIONS
= 280,
89 PERCENT_NAME_PREFIX
= 281,
90 PERCENT_NO_LINES
= 282,
92 PERCENT_PARSE_PARAM
= 284,
93 PERCENT_PURE_PARSER
= 285,
94 PERCENT_SKELETON
= 286,
96 PERCENT_TOKEN_TABLE
= 288,
97 PERCENT_VERBOSE
= 289,
105 PERCENT_PERCENT
= 297,
114 #define PERCENT_TOKEN 260
115 #define PERCENT_NTERM 261
116 #define PERCENT_TYPE 262
117 #define PERCENT_DESTRUCTOR 263
118 #define PERCENT_PRINTER 264
119 #define PERCENT_UNION 265
120 #define PERCENT_LEFT 266
121 #define PERCENT_RIGHT 267
122 #define PERCENT_NONASSOC 268
123 #define PERCENT_PREC 269
124 #define PERCENT_DPREC 270
125 #define PERCENT_MERGE 271
126 #define PERCENT_DEBUG 272
127 #define PERCENT_DEFINE 273
128 #define PERCENT_DEFINES 274
129 #define PERCENT_ERROR_VERBOSE 275
130 #define PERCENT_EXPECT 276
131 #define PERCENT_FILE_PREFIX 277
132 #define PERCENT_GLR_PARSER 278
133 #define PERCENT_LEX_PARAM 279
134 #define PERCENT_LOCATIONS 280
135 #define PERCENT_NAME_PREFIX 281
136 #define PERCENT_NO_LINES 282
137 #define PERCENT_OUTPUT 283
138 #define PERCENT_PARSE_PARAM 284
139 #define PERCENT_PURE_PARSER 285
140 #define PERCENT_SKELETON 286
141 #define PERCENT_START 287
142 #define PERCENT_TOKEN_TABLE 288
143 #define PERCENT_VERBOSE 289
144 #define PERCENT_YACC 290
147 #define SEMICOLON 293
151 #define PERCENT_PERCENT 297
154 #define BRACED_CODE 300
159 /* Copy the first part of user declarations. */
160 #line 31 "parse-gram.y"
164 #include "complain.h"
165 #include "conflicts.h"
169 #include "muscle_tab.h"
174 /* Produce verbose syntax errors. */
175 #define YYERROR_VERBOSE 1
177 #define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
178 static YYLTYPE
lloc_default (YYLTYPE
const *, int);
180 /* Request detailed syntax error messages, and pass them to GRAM_ERROR.
181 FIXME: depends on the undocumented availability of YYLLOC. */
183 #define yyerror(Msg) \
184 gram_error (&yylloc, Msg)
185 static void gram_error (location
const *, char const *);
187 #define YYPRINT(File, Type, Value) \
188 print_token_value (File, Type, &Value)
189 static void print_token_value (FILE *, int, YYSTYPE
const *);
191 static void add_param (char const *, char *, location
);
193 symbol_class current_class
= unknown_sym
;
194 uniqstr current_type
= 0;
196 location current_lhs_location
;
198 int current_prec
= 0;
201 /* Enabling traces. */
206 /* Enabling verbose error messages. */
207 #ifdef YYERROR_VERBOSE
208 # undef YYERROR_VERBOSE
209 # define YYERROR_VERBOSE 1
211 # define YYERROR_VERBOSE 0
214 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
215 #line 74 "parse-gram.y"
216 typedef union YYSTYPE
{
224 /* Line 191 of yacc.c. */
225 #line 225 "parse-gram.c"
226 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
227 # define YYSTYPE_IS_DECLARED 1
228 # define YYSTYPE_IS_TRIVIAL 1
231 #if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
232 typedef struct YYLTYPE
239 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
240 # define YYLTYPE_IS_DECLARED 1
241 # define YYLTYPE_IS_TRIVIAL 1
245 /* Copy the second part of user declarations. */
248 /* Line 214 of yacc.c. */
249 #line 249 "parse-gram.c"
251 #if ! defined (yyoverflow) || YYERROR_VERBOSE
253 /* The parser invokes alloca or malloc; define the necessary symbols. */
255 # if YYSTACK_USE_ALLOCA
256 # define YYSTACK_ALLOC alloca
258 # ifndef YYSTACK_USE_ALLOCA
259 # if defined (alloca) || defined (_ALLOCA_H)
260 # define YYSTACK_ALLOC alloca
263 # define YYSTACK_ALLOC __builtin_alloca
269 # ifdef YYSTACK_ALLOC
270 /* Pacify GCC's `empty if-body' warning. */
271 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
273 # if defined (__STDC__) || defined (__cplusplus)
274 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
275 # define YYSIZE_T size_t
277 # define YYSTACK_ALLOC malloc
278 # define YYSTACK_FREE free
280 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
283 #if (! defined (yyoverflow) \
284 && (! defined (__cplusplus) \
285 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
287 /* A type that is properly aligned for any stack member. */
295 /* The size of the maximum gap between one aligned stack and the next. */
296 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
298 /* The size of an array large to enough to hold all stacks, each with
300 # define YYSTACK_BYTES(N) \
301 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
302 + 2 * YYSTACK_GAP_MAXIMUM)
304 /* Copy COUNT objects from FROM to TO. The source and destination do
308 # define YYCOPY(To, From, Count) \
309 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
311 # define YYCOPY(To, From, Count) \
314 register YYSIZE_T yyi; \
315 for (yyi = 0; yyi < (Count); yyi++) \
316 (To)[yyi] = (From)[yyi]; \
322 /* Relocate STACK from its old location to the new one. The
323 local variables YYSIZE and YYSTACKSIZE give the old and new number of
324 elements in the stack, and YYPTR gives the new location of the
325 stack. Advance YYPTR to a properly aligned location for the next
327 # define YYSTACK_RELOCATE(Stack) \
330 YYSIZE_T yynewbytes; \
331 YYCOPY (&yyptr->Stack, Stack, yysize); \
332 Stack = &yyptr->Stack; \
333 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
334 yyptr += yynewbytes / sizeof (*yyptr); \
340 #if defined (__STDC__) || defined (__cplusplus)
341 typedef signed char yysigned_char
;
343 typedef short yysigned_char
;
346 /* YYFINAL -- State number of the termination state. */
348 /* YYLAST -- Last index in YYTABLE. */
351 /* YYNTOKENS -- Number of terminals. */
353 /* YYNNTS -- Number of nonterminals. */
355 /* YYNRULES -- Number of rules. */
357 /* YYNRULES -- Number of states. */
358 #define YYNSTATES 101
360 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
362 #define YYMAXUTOK 300
364 #define YYTRANSLATE(YYX) \
365 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
367 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
368 static const unsigned char yytranslate
[] =
370 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
371 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
396 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
397 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
398 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
399 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
404 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
406 static const unsigned char yyprhs
[] =
408 0, 0, 3, 8, 9, 12, 14, 16, 18, 22,
409 24, 26, 29, 33, 35, 37, 39, 43, 45, 49,
410 51, 53, 56, 58, 60, 62, 64, 66, 68, 71,
411 73, 76, 79, 80, 84, 85, 89, 93, 97, 99,
412 101, 103, 104, 106, 108, 111, 113, 115, 118, 121,
413 125, 127, 130, 132, 135, 137, 139, 142, 144, 145,
414 149, 151, 155, 156, 159, 162, 166, 170, 174, 176,
415 178, 180, 182, 184, 185
418 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
419 static const yysigned_char yyrhs
[] =
421 47, 0, -1, 48, 42, 60, 70, -1, -1, 48,
422 49, -1, 50, -1, 43, -1, 17, -1, 18, 69,
423 69, -1, 19, -1, 20, -1, 21, 4, -1, 22,
424 37, 69, -1, 23, -1, 24, -1, 25, -1, 26,
425 37, 69, -1, 27, -1, 28, 37, 69, -1, 29,
426 -1, 30, -1, 31, 69, -1, 33, -1, 34, -1,
427 35, -1, 38, -1, 54, -1, 51, -1, 32, 66,
428 -1, 10, -1, 8, 57, -1, 9, 57, -1, -1,
429 6, 52, 59, -1, -1, 5, 53, 59, -1, 7,
430 36, 57, -1, 55, 56, 57, -1, 11, -1, 12,
431 -1, 13, -1, -1, 36, -1, 66, -1, 57, 66,
432 -1, 36, -1, 40, -1, 40, 4, -1, 40, 68,
433 -1, 40, 4, 68, -1, 58, -1, 59, 58, -1,
434 61, -1, 60, 61, -1, 62, -1, 50, -1, 1,
435 38, -1, 38, -1, -1, 41, 63, 64, -1, 65,
436 -1, 64, 39, 65, -1, -1, 65, 66, -1, 65,
437 67, -1, 65, 14, 66, -1, 65, 15, 4, -1,
438 65, 16, 36, -1, 40, -1, 68, -1, 45, -1,
439 3, -1, 3, -1, -1, 42, 44, -1
442 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
443 static const unsigned short yyrline
[] =
445 0, 160, 160, 168, 170, 174, 175, 176, 177, 178,
446 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
447 189, 190, 191, 192, 193, 194, 198, 199, 200, 204,
448 210, 217, 227, 227, 232, 232, 237, 247, 262, 263,
449 264, 268, 269, 275, 276, 281, 285, 290, 296, 302,
450 313, 314, 323, 324, 330, 331, 336, 340, 344, 344,
451 348, 349, 354, 355, 357, 359, 361, 363, 368, 369,
452 373, 379, 388, 395, 397
456 #if YYDEBUG || YYERROR_VERBOSE
457 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
458 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
459 static const char *const yytname
[] =
461 "\"end of file\"", "error", "$undefined", "\"string\"", "\"integer\"",
462 "\"%token\"", "\"%nterm\"", "\"%type\"", "\"%destructor {...}\"",
463 "\"%printer {...}\"", "\"%union {...}\"", "\"%left\"", "\"%right\"",
464 "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
465 "\"%define\"", "\"%defines\"", "\"%error-verbose\"", "\"%expect\"",
466 "\"%file-prefix\"", "\"%glr-parser\"", "\"%lex-param {...}\"",
467 "\"%locations\"", "\"%name-prefix\"", "\"%no-lines\"", "\"%output\"",
468 "\"%parse-param {...}\"", "\"%pure-parser\"", "\"%skeleton\"",
469 "\"%start\"", "\"%token-table\"", "\"%verbose\"", "\"%yacc\"",
470 "\"type\"", "\"=\"", "\";\"", "\"|\"", "\"identifier\"",
471 "\"identifier:\"", "\"%%\"", "\"%{...%}\"", "\"epilogue\"", "\"{...}\"",
472 "$accept", "input", "declarations", "declaration",
473 "grammar_declaration", "symbol_declaration", "@1", "@2",
474 "precedence_declaration", "precedence_declarator", "type.opt",
475 "symbols.1", "symbol_def", "symbol_defs.1", "grammar",
476 "rules_or_grammar_declaration", "rules", "@3", "rhses.1", "rhs",
477 "symbol", "action", "string_as_id", "string_content", "epilogue.opt", 0
482 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
484 static const unsigned short yytoknum
[] =
486 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
487 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
488 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
489 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
490 295, 296, 297, 298, 299, 300
494 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
495 static const unsigned char yyr1
[] =
497 0, 46, 47, 48, 48, 49, 49, 49, 49, 49,
498 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
499 49, 49, 49, 49, 49, 49, 50, 50, 50, 50,
500 50, 50, 52, 51, 53, 51, 51, 54, 55, 55,
501 55, 56, 56, 57, 57, 58, 58, 58, 58, 58,
502 59, 59, 60, 60, 61, 61, 61, 61, 63, 62,
503 64, 64, 65, 65, 65, 65, 65, 65, 66, 66,
507 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
508 static const unsigned char yyr2
[] =
510 0, 2, 4, 0, 2, 1, 1, 1, 3, 1,
511 1, 2, 3, 1, 1, 1, 3, 1, 3, 1,
512 1, 2, 1, 1, 1, 1, 1, 1, 2, 1,
513 2, 2, 0, 3, 0, 3, 3, 3, 1, 1,
514 1, 0, 1, 1, 2, 1, 1, 2, 2, 3,
515 1, 2, 1, 2, 1, 1, 2, 1, 0, 3,
516 1, 3, 0, 2, 2, 3, 3, 3, 1, 1,
520 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
521 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
522 means the default is an error. */
523 static const unsigned char yydefact
[] =
525 3, 0, 0, 1, 34, 32, 0, 0, 0, 29,
526 38, 39, 40, 7, 0, 9, 10, 0, 0, 13,
527 14, 15, 0, 17, 0, 19, 20, 0, 0, 22,
528 23, 24, 25, 0, 6, 4, 5, 27, 26, 41,
529 0, 0, 0, 71, 68, 30, 43, 69, 31, 72,
530 0, 11, 0, 0, 0, 21, 28, 0, 57, 58,
531 55, 0, 52, 54, 42, 0, 45, 46, 50, 35,
532 33, 36, 44, 8, 12, 16, 18, 56, 62, 0,
533 53, 2, 37, 47, 48, 51, 59, 60, 74, 49,
534 62, 0, 0, 0, 70, 63, 64, 61, 65, 66,
538 /* YYDEFGOTO[NTERM-NUM]. */
539 static const yysigned_char yydefgoto
[] =
541 -1, 1, 2, 35, 60, 37, 41, 40, 38, 39,
542 65, 45, 68, 69, 61, 62, 63, 78, 86, 87,
546 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
548 #define YYPACT_NINF -65
549 static const yysigned_char yypact
[] =
551 -65, 5, 114, -65, -65, -65, -24, 1, 1, -65,
552 -65, -65, -65, -65, 10, -65, -65, 11, -23, -65,
553 -65, -65, -21, -65, -15, -65, -65, 10, 1, -65,
554 -65, -65, -65, 77, -65, -65, -65, -65, -65, -13,
555 -34, -34, 1, -65, -65, 1, -65, -65, 1, -65,
556 10, -65, 10, 10, 10, -65, -65, -17, -65, -65,
557 -65, 39, -65, -65, -65, 1, -65, 4, -65, -34,
558 -34, 1, -65, -65, -65, -65, -65, -65, -65, -20,
559 -65, -65, 1, 22, -65, -65, -12, 15, -65, -65,
560 -65, 1, 24, -10, -65, -65, -65, 15, -65, -65,
564 /* YYPGOTO[NTERM-NUM]. */
565 static const yysigned_char yypgoto
[] =
567 -65, -65, -65, -65, 30, -65, -65, -65, -65, -65,
568 -65, -7, -60, -8, -65, -19, -65, -65, -65, -37,
569 -28, -65, -64, -16, -65
572 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
573 positive, shift that token. If negative, reduce the rule which
574 number is the opposite. If zero, do what YYDEFACT says.
575 If YYTABLE_NINF, syntax error. */
576 #define YYTABLE_NINF -74
577 static const yysigned_char yytable
[] =
579 56, 48, 66, 84, 43, 3, 67, 43, 83, 85,
580 85, 55, 42, 49, 52, 51, 53, 72, 43, 89,
581 72, 77, 54, 64, 88, 43, 100, 90, 99, 91,
582 92, 93, 36, 70, 73, 71, 74, 75, 76, -73,
583 57, 44, 80, 72, 4, 5, 6, 7, 8, 9,
584 10, 11, 12, 97, 72, 44, 0, 0, 82, 95,
585 94, 0, 0, 98, 0, 0, 0, 0, 0, 95,
586 0, 28, 0, 0, 0, 0, 0, 58, 57, 0,
587 59, 79, 4, 5, 6, 7, 8, 9, 10, 11,
588 12, 0, 0, 0, 0, 0, 0, 0, 0, 0,
589 0, 0, 0, 0, 0, 0, 0, 0, 0, 28,
590 0, 0, 0, 0, 0, 58, 0, 0, 59, 4,
591 5, 6, 7, 8, 9, 10, 11, 12, 0, 0,
592 0, 13, 14, 15, 16, 17, 18, 19, 20, 21,
593 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
594 0, 0, 32, 0, 0, 0, 33, 34
597 static const yysigned_char yycheck
[] =
599 28, 8, 36, 67, 3, 0, 40, 3, 4, 69,
600 70, 27, 36, 3, 37, 4, 37, 45, 3, 83,
601 48, 38, 37, 36, 44, 3, 36, 39, 4, 14,
602 15, 16, 2, 41, 50, 42, 52, 53, 54, 0,
603 1, 40, 61, 71, 5, 6, 7, 8, 9, 10,
604 11, 12, 13, 90, 82, 40, -1, -1, 65, 87,
605 45, -1, -1, 91, -1, -1, -1, -1, -1, 97,
606 -1, 32, -1, -1, -1, -1, -1, 38, 1, -1,
607 41, 42, 5, 6, 7, 8, 9, 10, 11, 12,
608 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
609 -1, -1, -1, -1, -1, -1, -1, -1, -1, 32,
610 -1, -1, -1, -1, -1, 38, -1, -1, 41, 5,
611 6, 7, 8, 9, 10, 11, 12, 13, -1, -1,
612 -1, 17, 18, 19, 20, 21, 22, 23, 24, 25,
613 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
614 -1, -1, 38, -1, -1, -1, 42, 43
617 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
618 symbol of state STATE-NUM. */
619 static const unsigned char yystos
[] =
621 0, 47, 48, 0, 5, 6, 7, 8, 9, 10,
622 11, 12, 13, 17, 18, 19, 20, 21, 22, 23,
623 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
624 34, 35, 38, 42, 43, 49, 50, 51, 54, 55,
625 53, 52, 36, 3, 40, 57, 66, 68, 57, 3,
626 69, 4, 37, 37, 37, 69, 66, 1, 38, 41,
627 50, 60, 61, 62, 36, 56, 36, 40, 58, 59,
628 59, 57, 66, 69, 69, 69, 69, 38, 63, 42,
629 61, 70, 57, 4, 68, 58, 64, 65, 44, 68,
630 39, 14, 15, 16, 45, 66, 67, 65, 66, 4,
634 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
635 # define YYSIZE_T __SIZE_TYPE__
637 #if ! defined (YYSIZE_T) && defined (size_t)
638 # define YYSIZE_T size_t
640 #if ! defined (YYSIZE_T)
641 # if defined (__STDC__) || defined (__cplusplus)
642 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
643 # define YYSIZE_T size_t
646 #if ! defined (YYSIZE_T)
647 # define YYSIZE_T unsigned int
650 #define yyerrok (yyerrstatus = 0)
651 #define yyclearin (yychar = YYEMPTY)
655 #define YYACCEPT goto yyacceptlab
656 #define YYABORT goto yyabortlab
657 #define YYERROR goto yyerrlab1
659 /* Like YYERROR except do call yyerror. This remains here temporarily
660 to ease the transition to the new meaning of YYERROR, for GCC.
661 Once GCC version 2 has supplanted version 1, this can go. */
663 #define YYFAIL goto yyerrlab
665 #define YYRECOVERING() (!!yyerrstatus)
667 #define YYBACKUP(Token, Value) \
669 if (yychar == YYEMPTY && yylen == 1) \
673 yytoken = YYTRANSLATE (yychar); \
679 yyerror ("syntax error: cannot back up");\
685 #define YYERRCODE 256
687 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
690 #ifndef YYLLOC_DEFAULT
691 # define YYLLOC_DEFAULT(Current, Rhs, N) \
692 Current.first_line = Rhs[1].first_line; \
693 Current.first_column = Rhs[1].first_column; \
694 Current.last_line = Rhs[N].last_line; \
695 Current.last_column = Rhs[N].last_column;
698 /* YYLEX -- calling `yylex' with the right arguments. */
701 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
703 # define YYLEX yylex (&yylval, &yylloc)
706 /* Enable debugging if requested. */
710 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
711 # define YYFPRINTF fprintf
714 # define YYDPRINTF(Args) \
720 # define YYDSYMPRINT(Args) \
726 # define YYDSYMPRINTF(Title, Token, Value, Location) \
730 YYFPRINTF (stderr, "%s ", Title); \
731 yysymprint (stderr, \
732 Token, Value, Location); \
733 YYFPRINTF (stderr, "\n"); \
737 /*------------------------------------------------------------------.
738 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
740 `------------------------------------------------------------------*/
742 #if defined (__STDC__) || defined (__cplusplus)
744 yy_stack_print (short *bottom
, short *top
)
747 yy_stack_print (bottom
, top
)
752 YYFPRINTF (stderr
, "Stack now");
753 for (/* Nothing. */; bottom
<= top
; ++bottom
)
754 YYFPRINTF (stderr
, " %d", *bottom
);
755 YYFPRINTF (stderr
, "\n");
758 # define YY_STACK_PRINT(Bottom, Top) \
761 yy_stack_print ((Bottom), (Top)); \
765 /*------------------------------------------------.
766 | Report that the YYRULE is going to be reduced. |
767 `------------------------------------------------*/
769 #if defined (__STDC__) || defined (__cplusplus)
771 yy_reduce_print (int yyrule
)
774 yy_reduce_print (yyrule
)
779 unsigned int yylineno
= yyrline
[yyrule
];
780 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
781 yyrule
- 1, yylineno
);
782 /* Print the symbols being reduced, and their result. */
783 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
784 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
785 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
788 # define YY_REDUCE_PRINT(Rule) \
791 yy_reduce_print (Rule); \
794 /* Nonzero means print parse trace. It is left uninitialized so that
795 multiple parsers can coexist. */
798 # define YYDPRINTF(Args)
799 # define YYDSYMPRINT(Args)
800 # define YYDSYMPRINTF(Title, Token, Value, Location)
801 # define YY_STACK_PRINT(Bottom, Top)
802 # define YY_REDUCE_PRINT(Rule)
803 #endif /* !YYDEBUG */
806 /* YYINITDEPTH -- initial size of the parser's stacks. */
808 # define YYINITDEPTH 200
811 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
812 if the built-in stack extension method is used).
814 Do not make this value too large; the results are undefined if
815 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
816 evaluated with infinite-precision integer arithmetic. */
823 # define YYMAXDEPTH 10000
831 # if defined (__GLIBC__) && defined (_STRING_H)
832 # define yystrlen strlen
834 /* Return the length of YYSTR. */
836 # if defined (__STDC__) || defined (__cplusplus)
837 yystrlen (const char *yystr
)
843 register const char *yys
= yystr
;
845 while (*yys
++ != '\0')
848 return yys
- yystr
- 1;
854 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
855 # define yystpcpy stpcpy
857 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
860 # if defined (__STDC__) || defined (__cplusplus)
861 yystpcpy (char *yydest
, const char *yysrc
)
863 yystpcpy (yydest
, yysrc
)
868 register char *yyd
= yydest
;
869 register const char *yys
= yysrc
;
871 while ((*yyd
++ = *yys
++) != '\0')
879 #endif /* !YYERROR_VERBOSE */
884 /*--------------------------------.
885 | Print this symbol on YYOUTPUT. |
886 `--------------------------------*/
888 #if defined (__STDC__) || defined (__cplusplus)
890 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
893 yysymprint (yyoutput
, yytype
, yyvaluep
, yylocationp
)
897 YYLTYPE
*yylocationp
;
900 /* Pacify ``unused variable'' warnings. */
904 if (yytype
< YYNTOKENS
)
906 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
908 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
912 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
919 YYFPRINTF (yyoutput
, ")");
922 #endif /* ! YYDEBUG */
923 /*-----------------------------------------------.
924 | Release the memory associated to this symbol. |
925 `-----------------------------------------------*/
927 #if defined (__STDC__) || defined (__cplusplus)
929 yydestruct (int yytype
, YYSTYPE
*yyvaluep
, YYLTYPE
*yylocationp
)
932 yydestruct (yytype
, yyvaluep
, yylocationp
)
935 YYLTYPE
*yylocationp
;
938 /* Pacify ``unused variable'' warnings. */
951 /* Prevent warnings from -Wmissing-prototypes. */
954 # if defined (__STDC__) || defined (__cplusplus)
955 int yyparse (void *YYPARSE_PARAM
);
959 #else /* ! YYPARSE_PARAM */
960 #if defined (__STDC__) || defined (__cplusplus)
965 #endif /* ! YYPARSE_PARAM */
977 # if defined (__STDC__) || defined (__cplusplus)
978 int yyparse (void *YYPARSE_PARAM
)
980 int yyparse (YYPARSE_PARAM
)
983 #else /* ! YYPARSE_PARAM */
984 #if defined (__STDC__) || defined (__cplusplus)
994 /* The lookahead symbol. */
997 /* The semantic value of the lookahead symbol. */
1000 /* Number of syntax errors so far. */
1002 /* Location data for the lookahead symbol. */
1005 register int yystate
;
1008 /* Number of tokens to shift before error messages enabled. */
1010 /* Lookahead token as an internal (translated) token number. */
1013 /* Three stacks and their tools:
1014 `yyss': related to states,
1015 `yyvs': related to semantic values,
1016 `yyls': related to locations.
1018 Refer to the stacks thru separate pointers, to allow yyoverflow
1019 to reallocate them elsewhere. */
1021 /* The state stack. */
1022 short yyssa
[YYINITDEPTH
];
1023 short *yyss
= yyssa
;
1024 register short *yyssp
;
1026 /* The semantic value stack. */
1027 YYSTYPE yyvsa
[YYINITDEPTH
];
1028 YYSTYPE
*yyvs
= yyvsa
;
1029 register YYSTYPE
*yyvsp
;
1031 /* The location stack. */
1032 YYLTYPE yylsa
[YYINITDEPTH
];
1033 YYLTYPE
*yyls
= yylsa
;
1037 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1039 YYSIZE_T yystacksize
= YYINITDEPTH
;
1041 /* The variables used to return semantic value and location from the
1046 /* When reducing, the number of symbols on the RHS of the reduced
1050 YYDPRINTF ((stderr
, "Starting parse\n"));
1055 yychar
= YYEMPTY
; /* Cause a token to be read. */
1057 /* Initialize stack pointers.
1058 Waste one element of value and location stack
1059 so that they stay on the same level as the state stack.
1060 The wasted elements are never initialized. */
1067 /*------------------------------------------------------------.
1068 | yynewstate -- Push a new state, which is found in yystate. |
1069 `------------------------------------------------------------*/
1071 /* In all cases, when you get here, the value and location stacks
1072 have just been pushed. so pushing a state here evens the stacks.
1079 if (yyss
+ yystacksize
- 1 <= yyssp
)
1081 /* Get the current used size of the three stacks, in elements. */
1082 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1086 /* Give user a chance to reallocate the stack. Use copies of
1087 these so that the &'s don't force the real ones into
1089 YYSTYPE
*yyvs1
= yyvs
;
1090 short *yyss1
= yyss
;
1091 YYLTYPE
*yyls1
= yyls
;
1093 /* Each stack pointer address is followed by the size of the
1094 data in use in that stack, in bytes. This used to be a
1095 conditional around just the two extra args, but that might
1096 be undefined if yyoverflow is a macro. */
1097 yyoverflow ("parser stack overflow",
1098 &yyss1
, yysize
* sizeof (*yyssp
),
1099 &yyvs1
, yysize
* sizeof (*yyvsp
),
1100 &yyls1
, yysize
* sizeof (*yylsp
),
1106 #else /* no yyoverflow */
1107 # ifndef YYSTACK_RELOCATE
1110 /* Extend the stack our own way. */
1111 if (YYMAXDEPTH
<= yystacksize
)
1114 if (YYMAXDEPTH
< yystacksize
)
1115 yystacksize
= YYMAXDEPTH
;
1118 short *yyss1
= yyss
;
1119 union yyalloc
*yyptr
=
1120 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1123 YYSTACK_RELOCATE (yyss
);
1124 YYSTACK_RELOCATE (yyvs
);
1125 YYSTACK_RELOCATE (yyls
);
1126 # undef YYSTACK_RELOCATE
1128 YYSTACK_FREE (yyss1
);
1131 #endif /* no yyoverflow */
1133 yyssp
= yyss
+ yysize
- 1;
1134 yyvsp
= yyvs
+ yysize
- 1;
1135 yylsp
= yyls
+ yysize
- 1;
1137 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1138 (unsigned long int) yystacksize
));
1140 if (yyss
+ yystacksize
- 1 <= yyssp
)
1144 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1153 /* Do appropriate processing given the current state. */
1154 /* Read a lookahead token if we need one and don't already have one. */
1157 /* First try to decide what to do without reference to lookahead token. */
1159 yyn
= yypact
[yystate
];
1160 if (yyn
== YYPACT_NINF
)
1163 /* Not known => get a lookahead token if don't already have one. */
1165 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1166 if (yychar
== YYEMPTY
)
1168 YYDPRINTF ((stderr
, "Reading a token: "));
1172 if (yychar
<= YYEOF
)
1174 yychar
= yytoken
= YYEOF
;
1175 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1179 yytoken
= YYTRANSLATE (yychar
);
1180 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1183 /* If the proper action on seeing token YYTOKEN is to reduce or to
1184 detect an error, take that action. */
1186 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1191 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1200 /* Shift the lookahead token. */
1201 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1203 /* Discard the token being shifted unless it is eof. */
1204 if (yychar
!= YYEOF
)
1210 /* Count tokens shifted since error; after three, turn off error
1219 /*-----------------------------------------------------------.
1220 | yydefault -- do the default action for the current state. |
1221 `-----------------------------------------------------------*/
1223 yyn
= yydefact
[yystate
];
1229 /*-----------------------------.
1230 | yyreduce -- Do a reduction. |
1231 `-----------------------------*/
1233 /* yyn is the number of a rule to reduce with. */
1236 /* If YYLEN is nonzero, implement the default value of the action:
1239 Otherwise, the following line sets YYVAL to garbage.
1240 This behavior is undocumented and Bison
1241 users should not rely upon it. Assigning to YYVAL
1242 unconditionally makes the parser a bit smaller, and it avoids a
1243 GCC warning that YYVAL may be used uninitialized. */
1244 yyval
= yyvsp
[1-yylen
];
1246 /* Default location. */
1247 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);
1248 YY_REDUCE_PRINT (yyn
);
1252 #line 175 "parse-gram.y"
1253 { prologue_augment (yyvsp
[0].chars
, yylsp
[0]); }
1257 #line 176 "parse-gram.y"
1262 #line 177 "parse-gram.y"
1263 { muscle_insert (yyvsp
[-1].chars
, yyvsp
[0].chars
); }
1267 #line 178 "parse-gram.y"
1268 { defines_flag
= 1; }
1272 #line 179 "parse-gram.y"
1273 { error_verbose
= 1; }
1277 #line 180 "parse-gram.y"
1278 { expected_conflicts
= yyvsp
[0].integer
; }
1282 #line 181 "parse-gram.y"
1283 { spec_file_prefix
= yyvsp
[0].chars
; }
1287 #line 182 "parse-gram.y"
1292 #line 183 "parse-gram.y"
1293 { add_param ("lex_param", yyvsp
[0].chars
, yylsp
[0]); }
1297 #line 184 "parse-gram.y"
1298 { locations_flag
= 1; }
1302 #line 185 "parse-gram.y"
1303 { spec_name_prefix
= yyvsp
[0].chars
; }
1307 #line 186 "parse-gram.y"
1308 { no_lines_flag
= 1; }
1312 #line 187 "parse-gram.y"
1313 { spec_outfile
= yyvsp
[0].chars
; }
1317 #line 188 "parse-gram.y"
1318 { add_param ("parse_param", yyvsp
[0].chars
, yylsp
[0]); }
1322 #line 189 "parse-gram.y"
1323 { pure_parser
= 1; }
1327 #line 190 "parse-gram.y"
1328 { skeleton
= yyvsp
[0].chars
; }
1332 #line 191 "parse-gram.y"
1333 { token_table_flag
= 1; }
1337 #line 192 "parse-gram.y"
1338 { report_flag
= report_states
; }
1342 #line 193 "parse-gram.y"
1347 #line 201 "parse-gram.y"
1349 grammar_start_symbol_set (yyvsp
[0].symbol
, yylsp
[0]);
1354 #line 205 "parse-gram.y"
1357 MUSCLE_INSERT_INT ("stype_line", yylsp
[0].start
.line
);
1358 muscle_insert ("stype", yyvsp
[0].chars
);
1363 #line 211 "parse-gram.y"
1366 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1367 symbol_destructor_set (list
->sym
, yyvsp
[-1].chars
, yylsp
[-1]);
1368 symbol_list_free (yyvsp
[0].list
);
1373 #line 218 "parse-gram.y"
1376 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1377 symbol_printer_set (list
->sym
, yyvsp
[-1].chars
, list
->location
);
1378 symbol_list_free (yyvsp
[0].list
);
1383 #line 227 "parse-gram.y"
1384 { current_class
= nterm_sym
; }
1388 #line 228 "parse-gram.y"
1390 current_class
= unknown_sym
;
1391 current_type
= NULL
;
1396 #line 232 "parse-gram.y"
1397 { current_class
= token_sym
; }
1401 #line 233 "parse-gram.y"
1403 current_class
= unknown_sym
;
1404 current_type
= NULL
;
1409 #line 238 "parse-gram.y"
1412 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1413 symbol_type_set (list
->sym
, yyvsp
[-1].uniqstr
, yylsp
[-1]);
1414 symbol_list_free (yyvsp
[0].list
);
1419 #line 248 "parse-gram.y"
1423 for (list
= yyvsp
[0].list
; list
; list
= list
->next
)
1425 symbol_type_set (list
->sym
, current_type
, yylsp
[-1]);
1426 symbol_precedence_set (list
->sym
, current_prec
, yyvsp
[-2].assoc
, yylsp
[-2]);
1428 symbol_list_free (yyvsp
[0].list
);
1429 current_type
= NULL
;
1434 #line 262 "parse-gram.y"
1435 { yyval
.assoc
= left_assoc
; }
1439 #line 263 "parse-gram.y"
1440 { yyval
.assoc
= right_assoc
; }
1444 #line 264 "parse-gram.y"
1445 { yyval
.assoc
= non_assoc
; }
1449 #line 268 "parse-gram.y"
1450 { current_type
= NULL
; }
1454 #line 269 "parse-gram.y"
1455 { current_type
= yyvsp
[0].uniqstr
; }
1459 #line 275 "parse-gram.y"
1460 { yyval
.list
= symbol_list_new (yyvsp
[0].symbol
, yylsp
[0]); }
1464 #line 276 "parse-gram.y"
1465 { yyval
.list
= symbol_list_prepend (yyvsp
[-1].list
, yyvsp
[0].symbol
, yylsp
[0]); }
1469 #line 282 "parse-gram.y"
1471 current_type
= yyvsp
[0].uniqstr
;
1476 #line 286 "parse-gram.y"
1478 symbol_class_set (yyvsp
[0].symbol
, current_class
, yylsp
[0]);
1479 symbol_type_set (yyvsp
[0].symbol
, current_type
, yylsp
[0]);
1484 #line 291 "parse-gram.y"
1486 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1487 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1488 symbol_user_token_number_set (yyvsp
[-1].symbol
, yyvsp
[0].integer
, yylsp
[0]);
1493 #line 297 "parse-gram.y"
1495 symbol_class_set (yyvsp
[-1].symbol
, current_class
, yylsp
[-1]);
1496 symbol_type_set (yyvsp
[-1].symbol
, current_type
, yylsp
[-1]);
1497 symbol_make_alias (yyvsp
[-1].symbol
, yyvsp
[0].symbol
, yyloc
);
1502 #line 303 "parse-gram.y"
1504 symbol_class_set (yyvsp
[-2].symbol
, current_class
, yylsp
[-2]);
1505 symbol_type_set (yyvsp
[-2].symbol
, current_type
, yylsp
[-2]);
1506 symbol_user_token_number_set (yyvsp
[-2].symbol
, yyvsp
[-1].integer
, yylsp
[-1]);
1507 symbol_make_alias (yyvsp
[-2].symbol
, yyvsp
[0].symbol
, yyloc
);
1512 #line 332 "parse-gram.y"
1515 complain_at (yyloc
, _("POSIX forbids declarations in the grammar"));
1520 #line 337 "parse-gram.y"
1527 #line 344 "parse-gram.y"
1528 { current_lhs
= yyvsp
[0].symbol
; current_lhs_location
= yylsp
[0]; }
1532 #line 348 "parse-gram.y"
1533 { grammar_rule_end (yylsp
[0]); }
1537 #line 349 "parse-gram.y"
1538 { grammar_rule_end (yylsp
[0]); }
1542 #line 354 "parse-gram.y"
1543 { grammar_rule_begin (current_lhs
, current_lhs_location
); }
1547 #line 356 "parse-gram.y"
1548 { grammar_current_rule_symbol_append (yyvsp
[0].symbol
, yylsp
[0]); }
1552 #line 358 "parse-gram.y"
1553 { grammar_current_rule_action_append (yyvsp
[0].chars
, yylsp
[0]); }
1557 #line 360 "parse-gram.y"
1558 { grammar_current_rule_prec_set (yyvsp
[0].symbol
, yylsp
[0]); }
1562 #line 362 "parse-gram.y"
1563 { grammar_current_rule_dprec_set (yyvsp
[0].integer
, yylsp
[0]); }
1567 #line 364 "parse-gram.y"
1568 { grammar_current_rule_merge_set (yyvsp
[0].uniqstr
, yylsp
[0]); }
1572 #line 368 "parse-gram.y"
1573 { yyval
.symbol
= yyvsp
[0].symbol
; }
1577 #line 369 "parse-gram.y"
1578 { yyval
.symbol
= yyvsp
[0].symbol
; }
1582 #line 374 "parse-gram.y"
1583 { yyval
.chars
= yyvsp
[0].chars
; }
1587 #line 380 "parse-gram.y"
1589 yyval
.symbol
= symbol_get (yyvsp
[0].chars
, yylsp
[0]);
1590 symbol_class_set (yyval
.symbol
, token_sym
, yylsp
[0]);
1595 #line 389 "parse-gram.y"
1597 yyval
.chars
= yyvsp
[0].chars
+ 1;
1598 yyval
.chars
[strlen (yyval
.chars
) - 1] = '\0';
1603 #line 398 "parse-gram.y"
1605 epilogue_augment (yyvsp
[0].chars
, yylsp
[0]);
1606 scanner_last_string_free ();
1613 /* Line 991 of yacc.c. */
1614 #line 1614 "parse-gram.c"
1620 YY_STACK_PRINT (yyss
, yyssp
);
1625 /* Now `shift' the result of the reduction. Determine what state
1626 that goes to, based on the state we popped back to and the rule
1627 number reduced by. */
1631 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1632 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1633 yystate
= yytable
[yystate
];
1635 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1640 /*------------------------------------.
1641 | yyerrlab -- here on detecting error |
1642 `------------------------------------*/
1644 /* If not already recovering from an error, report this error. */
1649 yyn
= yypact
[yystate
];
1651 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1653 YYSIZE_T yysize
= 0;
1654 int yytype
= YYTRANSLATE (yychar
);
1659 /* Start YYX at -YYN if negative to avoid negative indexes in
1661 for (yyx
= yyn
< 0 ? -yyn
: 0;
1662 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1663 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1664 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1665 yysize
+= yystrlen ("syntax error, unexpected ") + 1;
1666 yysize
+= yystrlen (yytname
[yytype
]);
1667 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1670 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1671 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1676 for (yyx
= yyn
< 0 ? -yyn
: 0;
1677 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1679 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1681 const char *yyq
= ! yycount
? ", expecting " : " or ";
1682 yyp
= yystpcpy (yyp
, yyq
);
1683 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1688 YYSTACK_FREE (yymsg
);
1691 yyerror ("syntax error; also virtual memory exhausted");
1694 #endif /* YYERROR_VERBOSE */
1695 yyerror ("syntax error");
1700 if (yyerrstatus
== 3)
1702 /* If just tried and failed to reuse lookahead token after an
1703 error, discard it. */
1705 /* Return failure if at end of input. */
1706 if (yychar
== YYEOF
)
1708 /* Pop the error token. */
1710 /* Pop the rest of the stack. */
1711 while (yyss
< yyssp
)
1713 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1714 yydestruct (yystos
[*yyssp
], yyvsp
, yylsp
);
1720 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1721 yydestruct (yytoken
, &yylval
, &yylloc
);
1723 *++yylerrsp
= yylloc
;
1726 /* Else will try to reuse lookahead token after shifting the error
1731 /*----------------------------------------------------.
1732 | yyerrlab1 -- error raised explicitly by an action. |
1733 `----------------------------------------------------*/
1736 /* Suppress GCC warning that yyerrlab1 is unused when no action
1738 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1739 __attribute__ ((__unused__
))
1743 *++yylerrsp
= yyloc
;
1747 /*---------------------------------------------------------------.
1748 | yyerrlab2 -- pop states until the error token can be shifted. |
1749 `---------------------------------------------------------------*/
1751 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1755 yyn
= yypact
[yystate
];
1756 if (yyn
!= YYPACT_NINF
)
1759 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1767 /* Pop the current state because it cannot handle the error token. */
1771 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1772 yydestruct (yystos
[yystate
], yyvsp
, yylsp
);
1776 YY_STACK_PRINT (yyss
, yyssp
);
1782 YYDPRINTF ((stderr
, "Shifting error token, "));
1785 YYLLOC_DEFAULT (yyloc
, yylsp
, (yylerrsp
- yylsp
));
1792 /*-------------------------------------.
1793 | yyacceptlab -- YYACCEPT comes here. |
1794 `-------------------------------------*/
1799 /*-----------------------------------.
1800 | yyabortlab -- YYABORT comes here. |
1801 `-----------------------------------*/
1807 /*----------------------------------------------.
1808 | yyoverflowlab -- parser overflow comes here. |
1809 `----------------------------------------------*/
1811 yyerror ("parser stack overflow");
1819 YYSTACK_FREE (yyss
);
1825 #line 404 "parse-gram.y"
1829 /* Return the location of the left-hand side of a rule whose
1830 right-hand side is RHS[1] ... RHS[N]. Ignore empty nonterminals in
1831 the right-hand side, and return an empty location equal to the end
1832 boundary of RHS[0] if the right-hand side is empty. */
1835 lloc_default (YYLTYPE
const *rhs
, int n
)
1839 r
.start
= r
.end
= rhs
[n
].end
;
1841 /* Ignore empty nonterminals the start of the the right-hand side.
1842 Do not bother to ignore them at the end of the right-hand side,
1843 since empty nonterminals have the same end as their predecessors. */
1844 for (i
= 1; i
<= n
; i
++)
1845 if (! equal_boundaries (rhs
[i
].start
, rhs
[i
].end
))
1847 r
.start
= rhs
[i
].start
;
1855 /* Add a lex-param or a parse-param (depending on TYPE) with
1856 declaration DECL and location LOC. */
1859 add_param (char const *type
, char *decl
, location loc
)
1861 static char const alphanum
[] =
1863 "abcdefghijklmnopqrstuvwxyz"
1864 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1866 char const *alpha
= alphanum
+ 10;
1867 char const *name_start
= NULL
;
1870 for (p
= decl
; *p
; p
++)
1871 if ((p
== decl
|| ! strchr (alphanum
, p
[-1])) && strchr (alpha
, p
[0]))
1874 /* Strip the surrounding '{' and '}'. */
1879 complain_at (loc
, _("missing identifier in parameter declaration"));
1886 name_start
[name_len
] && strchr (alphanum
, name_start
[name_len
]);
1890 name
= xmalloc (name_len
+ 1);
1891 memcpy (name
, name_start
, name_len
);
1892 name
[name_len
] = '\0';
1893 muscle_pair_list_grow (type
, decl
, name
);
1897 scanner_last_string_free ();
1900 /*----------------------------------------------------.
1901 | When debugging the parser, display tokens' values. |
1902 `----------------------------------------------------*/
1905 print_token_value (FILE *file
, int type
, YYSTYPE
const *value
)
1911 fprintf (file
, " = %s", value
->symbol
->tag
);
1915 fprintf (file
, " = %d", value
->integer
);
1919 fprintf (file
, " = \"%s\"", value
->chars
);
1923 fprintf (file
, " = <%s>", value
->uniqstr
);
1927 case PERCENT_DESTRUCTOR
:
1928 case PERCENT_LEX_PARAM
:
1929 case PERCENT_PARSE_PARAM
:
1930 case PERCENT_PRINTER
:
1934 fprintf (file
, " = {{ %s }}", value
->chars
);
1938 fprintf (file
, "unknown token type");
1944 gram_error (location
const *loc
, char const *msg
)
1946 complain_at (*loc
, "%s", msg
);
1950 token_name (int type
)
1952 return yytname
[type
];