-/* A Bison parser, made by GNU Bison 1.75e. */
+/* A Bison parser, made by GNU Bison 1.875b. */
/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* Copy the first part of user declarations. */
-#line 31 "parse-gram.y"
+#line 32 "parse-gram.y"
#include "system.h"
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 74 "parse-gram.y"
+#line 75 "parse-gram.y"
typedef union YYSTYPE {
symbol *symbol;
symbol_list *list;
assoc assoc;
uniqstr uniqstr;
} YYSTYPE;
-/* Line 192 of yacc.c. */
-#line 225 "parse-gram.c"
+/* Line 191 of yacc.c. */
+#line 226 "parse-gram.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
/* Copy the second part of user declarations. */
-/* Line 215 of yacc.c. */
-#line 249 "parse-gram.c"
+/* Line 214 of yacc.c. */
+#line 250 "parse-gram.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short yyrline[] =
{
- 0, 160, 160, 168, 170, 174, 175, 176, 177, 178,
- 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
- 189, 190, 191, 192, 193, 194, 198, 199, 200, 204,
- 210, 217, 227, 227, 232, 232, 237, 247, 262, 263,
- 264, 268, 269, 275, 276, 281, 285, 290, 296, 302,
- 313, 314, 323, 324, 330, 331, 336, 340, 344, 344,
- 348, 349, 354, 355, 357, 359, 361, 363, 368, 369,
- 373, 379, 388, 395, 397
+ 0, 161, 161, 169, 171, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+ 190, 191, 192, 193, 194, 195, 199, 200, 201, 205,
+ 211, 218, 228, 228, 233, 233, 238, 248, 263, 264,
+ 265, 269, 270, 276, 277, 282, 286, 291, 297, 303,
+ 314, 315, 324, 325, 331, 332, 337, 341, 345, 345,
+ 349, 350, 355, 356, 358, 360, 362, 364, 369, 370,
+ 374, 380, 389, 396, 398
};
#endif
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
+#define YYERROR do \
+ { \
+ yylerrsp = yylsp; \
+ *++yylerrsp = yyloc; \
+ goto yyerrlab1; \
+ } \
+ while (0)
+
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
#endif
{
int yyi;
- unsigned int yylineno = yyrline[yyrule];
+ unsigned int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
- yyrule - 1, yylineno);
+ yyrule - 1, yylno);
/* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
+ YYLTYPE *yylerrsp;
#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
switch (yyn)
{
case 6:
-#line 175 "parse-gram.y"
+#line 176 "parse-gram.y"
{ prologue_augment (yyvsp[0].chars, yylsp[0]); }
break;
case 7:
-#line 176 "parse-gram.y"
+#line 177 "parse-gram.y"
{ debug_flag = 1; }
break;
case 8:
-#line 177 "parse-gram.y"
+#line 178 "parse-gram.y"
{ muscle_insert (yyvsp[-1].chars, yyvsp[0].chars); }
break;
case 9:
-#line 178 "parse-gram.y"
+#line 179 "parse-gram.y"
{ defines_flag = 1; }
break;
case 10:
-#line 179 "parse-gram.y"
+#line 180 "parse-gram.y"
{ error_verbose = 1; }
break;
case 11:
-#line 180 "parse-gram.y"
+#line 181 "parse-gram.y"
{ expected_conflicts = yyvsp[0].integer; }
break;
case 12:
-#line 181 "parse-gram.y"
+#line 182 "parse-gram.y"
{ spec_file_prefix = yyvsp[0].chars; }
break;
case 13:
-#line 182 "parse-gram.y"
+#line 183 "parse-gram.y"
{ glr_parser = 1; }
break;
case 14:
-#line 183 "parse-gram.y"
+#line 184 "parse-gram.y"
{ add_param ("lex_param", yyvsp[0].chars, yylsp[0]); }
break;
case 15:
-#line 184 "parse-gram.y"
+#line 185 "parse-gram.y"
{ locations_flag = 1; }
break;
case 16:
-#line 185 "parse-gram.y"
+#line 186 "parse-gram.y"
{ spec_name_prefix = yyvsp[0].chars; }
break;
case 17:
-#line 186 "parse-gram.y"
+#line 187 "parse-gram.y"
{ no_lines_flag = 1; }
break;
case 18:
-#line 187 "parse-gram.y"
+#line 188 "parse-gram.y"
{ spec_outfile = yyvsp[0].chars; }
break;
case 19:
-#line 188 "parse-gram.y"
+#line 189 "parse-gram.y"
{ add_param ("parse_param", yyvsp[0].chars, yylsp[0]); }
break;
case 20:
-#line 189 "parse-gram.y"
+#line 190 "parse-gram.y"
{ pure_parser = 1; }
break;
case 21:
-#line 190 "parse-gram.y"
+#line 191 "parse-gram.y"
{ skeleton = yyvsp[0].chars; }
break;
case 22:
-#line 191 "parse-gram.y"
+#line 192 "parse-gram.y"
{ token_table_flag = 1; }
break;
case 23:
-#line 192 "parse-gram.y"
- { report_flag = 1; }
+#line 193 "parse-gram.y"
+ { report_flag = report_states; }
break;
case 24:
-#line 193 "parse-gram.y"
+#line 194 "parse-gram.y"
{ yacc_flag = 1; }
break;
case 28:
-#line 201 "parse-gram.y"
+#line 202 "parse-gram.y"
{
grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]);
}
break;
case 29:
-#line 205 "parse-gram.y"
+#line 206 "parse-gram.y"
{
typed = 1;
MUSCLE_INSERT_INT ("stype_line", yylsp[0].start.line);
break;
case 30:
-#line 211 "parse-gram.y"
+#line 212 "parse-gram.y"
{
symbol_list *list;
for (list = yyvsp[0].list; list; list = list->next)
break;
case 31:
-#line 218 "parse-gram.y"
+#line 219 "parse-gram.y"
{
symbol_list *list;
for (list = yyvsp[0].list; list; list = list->next)
break;
case 32:
-#line 227 "parse-gram.y"
+#line 228 "parse-gram.y"
{ current_class = nterm_sym; }
break;
case 33:
-#line 228 "parse-gram.y"
+#line 229 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
break;
case 34:
-#line 232 "parse-gram.y"
+#line 233 "parse-gram.y"
{ current_class = token_sym; }
break;
case 35:
-#line 233 "parse-gram.y"
+#line 234 "parse-gram.y"
{
current_class = unknown_sym;
current_type = NULL;
break;
case 36:
-#line 238 "parse-gram.y"
+#line 239 "parse-gram.y"
{
symbol_list *list;
for (list = yyvsp[0].list; list; list = list->next)
break;
case 37:
-#line 248 "parse-gram.y"
+#line 249 "parse-gram.y"
{
symbol_list *list;
++current_prec;
break;
case 38:
-#line 262 "parse-gram.y"
+#line 263 "parse-gram.y"
{ yyval.assoc = left_assoc; }
break;
case 39:
-#line 263 "parse-gram.y"
+#line 264 "parse-gram.y"
{ yyval.assoc = right_assoc; }
break;
case 40:
-#line 264 "parse-gram.y"
+#line 265 "parse-gram.y"
{ yyval.assoc = non_assoc; }
break;
case 41:
-#line 268 "parse-gram.y"
+#line 269 "parse-gram.y"
{ current_type = NULL; }
break;
case 42:
-#line 269 "parse-gram.y"
+#line 270 "parse-gram.y"
{ current_type = yyvsp[0].uniqstr; }
break;
case 43:
-#line 275 "parse-gram.y"
+#line 276 "parse-gram.y"
{ yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); }
break;
case 44:
-#line 276 "parse-gram.y"
+#line 277 "parse-gram.y"
{ yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); }
break;
case 45:
-#line 282 "parse-gram.y"
+#line 283 "parse-gram.y"
{
current_type = yyvsp[0].uniqstr;
}
break;
case 46:
-#line 286 "parse-gram.y"
+#line 287 "parse-gram.y"
{
symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]);
symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]);
break;
case 47:
-#line 291 "parse-gram.y"
+#line 292 "parse-gram.y"
{
symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
break;
case 48:
-#line 297 "parse-gram.y"
+#line 298 "parse-gram.y"
{
symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]);
symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]);
break;
case 49:
-#line 303 "parse-gram.y"
+#line 304 "parse-gram.y"
{
symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]);
symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]);
break;
case 55:
-#line 332 "parse-gram.y"
+#line 333 "parse-gram.y"
{
if (yacc_flag)
complain_at (yyloc, _("POSIX forbids declarations in the grammar"));
break;
case 56:
-#line 337 "parse-gram.y"
+#line 338 "parse-gram.y"
{
yyerrok;
}
break;
case 58:
-#line 344 "parse-gram.y"
+#line 345 "parse-gram.y"
{ current_lhs = yyvsp[0].symbol; current_lhs_location = yylsp[0]; }
break;
case 60:
-#line 348 "parse-gram.y"
+#line 349 "parse-gram.y"
{ grammar_rule_end (yylsp[0]); }
break;
case 61:
-#line 349 "parse-gram.y"
+#line 350 "parse-gram.y"
{ grammar_rule_end (yylsp[0]); }
break;
case 62:
-#line 354 "parse-gram.y"
+#line 355 "parse-gram.y"
{ grammar_rule_begin (current_lhs, current_lhs_location); }
break;
case 63:
-#line 356 "parse-gram.y"
+#line 357 "parse-gram.y"
{ grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); }
break;
case 64:
-#line 358 "parse-gram.y"
+#line 359 "parse-gram.y"
{ grammar_current_rule_action_append (yyvsp[0].chars, yylsp[0]); }
break;
case 65:
-#line 360 "parse-gram.y"
+#line 361 "parse-gram.y"
{ grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); }
break;
case 66:
-#line 362 "parse-gram.y"
+#line 363 "parse-gram.y"
{ grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); }
break;
case 67:
-#line 364 "parse-gram.y"
+#line 365 "parse-gram.y"
{ grammar_current_rule_merge_set (yyvsp[0].uniqstr, yylsp[0]); }
break;
case 68:
-#line 368 "parse-gram.y"
+#line 369 "parse-gram.y"
{ yyval.symbol = yyvsp[0].symbol; }
break;
case 69:
-#line 369 "parse-gram.y"
+#line 370 "parse-gram.y"
{ yyval.symbol = yyvsp[0].symbol; }
break;
case 70:
-#line 374 "parse-gram.y"
+#line 375 "parse-gram.y"
{ yyval.chars = yyvsp[0].chars; }
break;
case 71:
-#line 380 "parse-gram.y"
+#line 381 "parse-gram.y"
{
yyval.symbol = symbol_get (yyvsp[0].chars, yylsp[0]);
symbol_class_set (yyval.symbol, token_sym, yylsp[0]);
break;
case 72:
-#line 389 "parse-gram.y"
+#line 390 "parse-gram.y"
{
yyval.chars = yyvsp[0].chars + 1;
yyval.chars[strlen (yyval.chars) - 1] = '\0';
break;
case 74:
-#line 398 "parse-gram.y"
+#line 399 "parse-gram.y"
{
epilogue_augment (yyvsp[0].chars, yylsp[0]);
scanner_last_string_free ();
}
-/* Line 991 of yacc.c. */
-#line 1613 "parse-gram.c"
+/* Line 999 of yacc.c. */
+#line 1622 "parse-gram.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
+ const char* yyprefix;
char *yymsg;
- int yyx, yycount;
+ int yyx;
- yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 0;
+
+ yyprefix = ", expecting ";
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("syntax error, unexpected ") + 1;
- yysize += yystrlen (yytname[yytype]);
+ {
+ yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
+ yycount += 1;
+ if (yycount == 5)
+ {
+ yysize = 0;
+ break;
+ }
+ }
+ yysize += (sizeof ("syntax error, unexpected ")
+ + yystrlen (yytname[yytype]));
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
if (yycount < 5)
{
- yycount = 0;
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *));
- yyx++)
+ yyprefix = ", expecting ";
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
- const char *yyq = ! yycount ? ", expecting " : " or ";
- yyp = yystpcpy (yyp, yyq);
+ yyp = yystpcpy (yyp, yyprefix);
yyp = yystpcpy (yyp, yytname[yyx]);
- yycount++;
+ yyprefix = " or ";
}
}
yyerror (yymsg);
yyerror ("syntax error");
}
+ yylerrsp = yylsp;
+
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
yydestruct (yytoken, &yylval, &yylloc);
yychar = YYEMPTY;
+ *++yylerrsp = yylloc;
}
/* Else will try to reuse lookahead token after shifting the error
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
- *++yylsp = yylloc;
+ YYLLOC_DEFAULT (yyloc, yylsp, (yylerrsp - yylsp));
+ *++yylsp = yyloc;
yystate = yyn;
goto yynewstate;
}
-#line 404 "parse-gram.y"
+#line 405 "parse-gram.y"
lloc_default (YYLTYPE const *rhs, int n)
{
int i;
- YYLTYPE r;
- r.start = r.end = rhs[n].end;
+ YYLTYPE loc;
+ loc.start = loc.end = rhs[n].end;
/* Ignore empty nonterminals the start of the the right-hand side.
Do not bother to ignore them at the end of the right-hand side,
for (i = 1; i <= n; i++)
if (! equal_boundaries (rhs[i].start, rhs[i].end))
{
- r.start = rhs[i].start;
+ loc.start = rhs[i].start;
break;
}
- return r;
+ return loc;
}