cvsuser 03/11/15 05:56:52
Modified: imcc imcc.y imcparser.c imcparser.h
Log:
Fix minor bug in grammar
Revision Changes Path
1.108 +1 -1 parrot/imcc/imcc.y
Index: imcc.y
===================================================================
RCS file: /cvs/public/parrot/imcc/imcc.y,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -w -r1.107 -r1.108
--- imcc.y 13 Nov 2003 07:04:06 -0000 1.107
+++ imcc.y 15 Nov 2003 13:56:51 -0000 1.108
@@ -659,7 +659,7 @@
*/
$$ = iNEWSUB(interp, cur_unit, NULL, $3,
mk_address($4, U_add_once),
- mk_address($5, U_add_once), 1); }
+ mk_address($6, U_add_once), 1); }
| target '=' DEFINED var { $$ = MK_I(interp, cur_unit,
"defined",2, $1,$4); }
| target '=' DEFINED var '[' keylist ']' { keyvec=KEY_BIT(2);
$$ = MK_I(interp, cur_unit, "defined", 3, $1,
$4, $6); }
1.93 +226 -186 parrot/imcc/imcparser.c
Index: imcparser.c
===================================================================
RCS file: /cvs/public/parrot/imcc/imcparser.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -w -r1.92 -r1.93
--- imcparser.c 13 Nov 2003 07:05:44 -0000 1.92
+++ imcparser.c 15 Nov 2003 13:56:51 -0000 1.93
@@ -1,4 +1,4 @@
-/* A Bison parser, made from imcc/imcc.y, by GNU bison 1.75. */
+/* A Bison parser, made by GNU Bison 1.875. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
@@ -36,6 +36,9 @@
/* Identify Bison output. */
#define YYBISON 1
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
/* Pure parsers. */
#define YYPURE 1
@@ -381,7 +384,7 @@
/*
- * substr or X = Pkey
+ * substr or X = P[key]
*/
static Instruction *
iINDEXFETCH(struct Parrot_Interp *interp, IMC_Unit * unit, SymReg * r0, SymReg * r1,
@@ -396,7 +399,7 @@
}
/*
- * substr or Pkey = X
+ * substr or P[key] = X
*/
static Instruction *
@@ -438,9 +441,9 @@
# define YYERROR_VERBOSE 0
#endif
-#ifndef YYSTYPE
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 204 "imcc/imcc.y"
-typedef union {
+typedef union YYSTYPE {
int t;
char * s;
SymReg * sr;
@@ -448,30 +451,21 @@
Symbol * sym;
SymbolList * symlist;
SymbolTable * symtab;
-} yystype;
-/* Line 193 of /usr/local/share/bison/yacc.c. */
-#line 454 "imcc/imcparser.c"
-# define YYSTYPE yystype
+} YYSTYPE;
+/* Line 191 of yacc.c. */
+#line 456 "imcc/imcparser.c"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
-#ifndef YYLTYPE
-typedef struct yyltype
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-} yyltype;
-# define YYLTYPE yyltype
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
+
/* Copy the second part of user declarations. */
-/* Line 213 of /usr/local/share/bison/yacc.c. */
-#line 475 "imcc/imcparser.c"
+/* Line 214 of yacc.c. */
+#line 468 "imcc/imcparser.c"
#if ! defined (yyoverflow) || YYERROR_VERBOSE
@@ -507,7 +501,7 @@
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -517,13 +511,13 @@
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAX)
+ + YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
@@ -554,7 +548,7 @@
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
@@ -569,6 +563,7 @@
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
+/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 394
/* YYNTOKENS -- Number of terminals. */
@@ -584,8 +579,8 @@
#define YYUNDEFTOK 2
#define YYMAXUTOK 339
-#define YYTRANSLATE(X) \
- ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const unsigned char yytranslate[] =
@@ -730,25 +725,25 @@
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short yyrline[] =
{
- 0, 261, 261, 261, 265, 267, 268, 269, 270, 271,
+ 0, 261, 261, 261, 266, 267, 268, 269, 270, 271,
274, 275, 278, 279, 282, 283, 284, 285, 288, 288,
- 292, 297, 300, 305, 304, 320, 318, 338, 340, 343,
- 345, 348, 350, 351, 354, 369, 385, 389, 401, 400,
- 409, 411, 408, 421, 422, 423, 426, 426, 430, 430,
+ 292, 297, 301, 305, 305, 320, 319, 339, 340, 344,
+ 345, 349, 350, 351, 355, 370, 385, 390, 401, 401,
+ 409, 411, 409, 421, 422, 423, 426, 426, 430, 430,
458, 459, 462, 463, 466, 467, 470, 474, 477, 483,
484, 487, 488, 491, 492, 495, 496, 496, 499, 499,
516, 516, 534, 535, 536, 539, 542, 543, 553, 556,
558, 559, 560, 561, 562, 563, 566, 567, 570, 571,
- 574, 577, 581, 583, 584, 585, 586, 586, 587, 587,
+ 574, 578, 582, 583, 584, 585, 586, 586, 587, 587,
589, 589, 591, 591, 593, 594, 595, 596, 597, 598,
- 599, 600, 601, 602, 603, 604, 604, 606, 608, 611,
- 613, 614, 615, 618, 620, 621, 622, 625, 629, 631,
+ 599, 600, 601, 602, 603, 604, 604, 606, 608, 612,
+ 613, 614, 615, 619, 620, 621, 622, 626, 630, 631,
632, 633, 634, 635, 636, 637, 638, 639, 640, 641,
642, 643, 644, 645, 646, 647, 648, 649, 650, 651,
652, 653, 654, 656, 663, 664, 666, 667, 669, 670,
- 673, 673, 675, 676, 678, 681, 683, 685, 686, 687,
- 688, 692, 694, 695, 696, 697, 698, 702, 703, 705,
- 706, 709, 710, 713, 714, 717, 718, 722, 724, 726,
+ 673, 673, 675, 676, 678, 682, 683, 685, 686, 687,
+ 688, 693, 694, 695, 696, 697, 698, 702, 703, 705,
+ 706, 709, 710, 713, 714, 717, 718, 723, 724, 727,
728, 731, 732, 735, 735, 739, 740, 743, 746, 747,
750, 751, 752, 753, 754, 757, 758, 759, 762, 763
};
@@ -978,7 +973,7 @@
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, parse error. */
+ If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -199
static const short yytable[] =
{
@@ -1128,7 +1123,7 @@
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
+#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
@@ -1149,7 +1144,7 @@
{ \
yychar = (Token); \
yylval = (Value); \
- yychar1 = YYTRANSLATE (yychar); \
+ yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
@@ -1195,19 +1190,93 @@
if (yydebug) \
YYFPRINTF Args; \
} while (0)
+
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
+
+# define YYDSYMPRINTF(Title, Token, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yysymprint (stderr, \
+ Token, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (cinluded). |
+`------------------------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_stack_print (short *bottom, short *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ short *bottom;
+ short *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (/* Nothing. */; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if defined (__STDC__) || defined (__cplusplus)
+static void
+yy_reduce_print (int yyrule)
+#else
+static void
+yy_reduce_print (yyrule)
+ int yyrule;
+#endif
+{
+ int yyi;
+ unsigned int yylineno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ yyrule - 1, yylineno);
+ /* Print the symbols being reduced, and their result. */
+ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
+ YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (Rule); \
+} while (0)
+
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
+# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
+
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
@@ -1286,102 +1355,111 @@
#if YYDEBUG
-/*-----------------------------.
-| Print this symbol on YYOUT. |
-`-----------------------------*/
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
-static void
#if defined (__STDC__) || defined (__cplusplus)
-yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
+static void
+yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
-yysymprint (yyout, yytype, yyvalue)
- FILE* yyout;
+static void
+yysymprint (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
int yytype;
- YYSTYPE yyvalue;
+ YYSTYPE *yyvaluep;
#endif
{
/* Pacify ``unused variable'' warnings. */
- (void) yyvalue;
+ (void) yyvaluep;
if (yytype < YYNTOKENS)
{
- YYFPRINTF (yyout, "token %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
- YYPRINT (yyout, yytoknum[yytype], yyvalue);
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
}
else
- YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
switch (yytype)
{
default:
break;
}
- YYFPRINTF (yyout, ")");
+ YYFPRINTF (yyoutput, ")");
}
-#endif /* YYDEBUG. */
-
+#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-static void
#if defined (__STDC__) || defined (__cplusplus)
-yydestruct (int yytype, YYSTYPE yyvalue)
+static void
+yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
-yydestruct (yytype, yyvalue)
+static void
+yydestruct (yytype, yyvaluep)
int yytype;
- YYSTYPE yyvalue;
+ YYSTYPE *yyvaluep;
#endif
{
/* Pacify ``unused variable'' warnings. */
- (void) yyvalue;
+ (void) yyvaluep;
switch (yytype)
{
+
default:
break;
}
}
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
+/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
-# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL
+int yyparse (void *YYPARSE_PARAM);
# else
-# define YYPARSE_PARAM_ARG YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+int yyparse ();
# endif
#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
+#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
+#else
+int yyparse ();
# endif
-#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+int yyparse (void *YYPARSE_PARAM)
+# else
+int yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+# endif
+#else /* ! YYPARSE_PARAM */
+#if defined (__STDC__) || defined (__cplusplus)
+int
+yyparse (void)
+#else
int
-yyparse (YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
+yyparse ()
+
+#endif
+#endif
{
/* The lookahead symbol. */
int yychar;
@@ -1389,7 +1467,7 @@
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of parse errors so far. */
+/* Number of syntax errors so far. */
int yynerrs;
register int yystate;
@@ -1398,7 +1476,7 @@
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
- int yychar1 = 0;
+ int yytoken = 0;
/* Three stacks and their tools:
`yyss': related to states,
@@ -1462,7 +1540,7 @@
yysetstate:
*yyssp = yystate;
- if (yyssp >= yyss + yystacksize - 1)
+ if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
@@ -1494,10 +1572,10 @@
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
+ if (YYMAXDEPTH <= yystacksize)
goto yyoverflowlab;
yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
+ if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
@@ -1523,7 +1601,7 @@
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
- if (yyssp >= yyss + yystacksize - 1)
+ if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
@@ -1548,39 +1626,28 @@
/* Not known => get a lookahead token if don't already have one. */
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
- /* Convert token to internal form (in yychar1) for indexing tables with. */
-
- if (yychar <= 0) /* This means end of input. */
+ if (yychar <= YYEOF)
{
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more. */
-
+ yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
- yychar1 = YYTRANSLATE (yychar);
-
- /* We have to keep this `#if YYDEBUG', since we use variables
- which are defined only if `YYDEBUG' is set. */
- YYDPRINTF ((stderr, "Next token is "));
- YYDSYMPRINT ((stderr, yychar1, yylval));
- YYDPRINTF ((stderr, "\n"));
+ yytoken = YYTRANSLATE (yychar);
+ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
}
- /* If the proper action on seeing token YYCHAR1 is to reduce or to
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
- yyn += yychar1;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
@@ -1595,8 +1662,7 @@
YYACCEPT;
/* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %d (%s), ",
- yychar, yytname[yychar1]));
+ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
@@ -1642,23 +1708,7 @@
yyval = yyvsp[1-yylen];
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables which
- are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- int yyi;
-
- YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
- yyn - 1, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
- YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
- YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
+ YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
@@ -1915,7 +1965,7 @@
i->type = ITPCCSUB;
/*
* if we are inside a pcc_sub mark the sub as doing a
- * sub call; the sub is in r1 of the first ins
+ * sub call; the sub is in r[1] of the first ins
*/
if (cur_unit->instructions->r[1] &&
cur_unit->instructions->r[1]->pcc_sub)
cur_unit->instructions->r[1]->pcc_sub->calls_a_sub = 1;
@@ -2426,11 +2476,11 @@
case 153:
#line 657 "imcc/imcc.y"
{ /* XXX: Fix 4arg version of newsub PASM op
- * to use instead of implicit P0
+ * to use $1 instead of implicit P0
*/
yyval.i = iNEWSUB(interp, cur_unit, NULL,
yyvsp[-3].t,
mk_address(yyvsp[-2].s,
U_add_once),
- mk_address(yyvsp[-1].t,
U_add_once), 1); }
+ mk_address(yyvsp[0].s,
U_add_once), 1); }
break;
case 154:
@@ -2662,23 +2712,14 @@
}
-/* Line 1016 of /usr/local/share/bison/yacc.c. */
-#line 2667 "imcc/imcparser.c"
+/* Line 991 of yacc.c. */
+#line 2716 "imcc/imcparser.c"
yyvsp -= yylen;
yyssp -= yylen;
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
+ YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
@@ -2723,12 +2764,12 @@
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("parse error, unexpected ") + 1;
+ yysize += yystrlen ("syntax error, unexpected ") + 1;
yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
- char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
+ char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
if (yycount < 5)
@@ -2749,19 +2790,15 @@
YYSTACK_FREE (yymsg);
}
else
- yyerror ("parse error; also virtual memory exhausted");
+ yyerror ("syntax error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */
- yyerror ("parse error");
+ yyerror ("syntax error");
}
- goto yyerrlab1;
-/*----------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action. |
-`----------------------------------------------------*/
-yyerrlab1:
+
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
@@ -2773,28 +2810,45 @@
/* Pop the error token. */
YYPOPSTACK;
/* Pop the rest of the stack. */
- while (yyssp > yyss)
+ while (yyss < yyssp)
{
- YYDPRINTF ((stderr, "Error: popping "));
- YYDSYMPRINT ((stderr,
- yystos[*yyssp],
- *yyvsp));
- YYDPRINTF ((stderr, "\n"));
- yydestruct (yystos[*yyssp], *yyvsp);
+ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+ yydestruct (yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
YYABORT;
}
- YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
- yychar, yytname[yychar1]));
- yydestruct (yychar1, yylval);
+ YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
+ yydestruct (yytoken, &yylval);
yychar = YYEMPTY;
+
}
/* Else will try to reuse lookahead token after shifting the error
token. */
+ goto yyerrlab2;
+
+
+/*----------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action. |
+`----------------------------------------------------*/
+yyerrlab1:
+
+ /* Suppress GCC warning that yyerrlab1 is unused when no action
+ invokes YYERROR. */
+#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
+ __attribute__ ((__unused__))
+#endif
+
+
+ goto yyerrlab2;
+
+/*---------------------------------------------------------------.
+| yyerrlab2 -- pop states until the error token can be shifted. |
+`---------------------------------------------------------------*/
+yyerrlab2:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
@@ -2815,26 +2869,12 @@
if (yyssp == yyss)
YYABORT;
- YYDPRINTF ((stderr, "Error: popping "));
- YYDSYMPRINT ((stderr,
- yystos[*yyssp], *yyvsp));
- YYDPRINTF ((stderr, "\n"));
-
- yydestruct (yystos[yystate], *yyvsp);
+ YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+ yydestruct (yystos[yystate], yyvsp);
yyvsp--;
yystate = *--yyssp;
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "Error: state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
+ YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
1.62 +9 -11 parrot/imcc/imcparser.h
Index: imcparser.h
===================================================================
RCS file: /cvs/public/parrot/imcc/imcparser.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -w -r1.61 -r1.62
--- imcparser.h 4 Nov 2003 07:48:01 -0000 1.61
+++ imcparser.h 15 Nov 2003 13:56:51 -0000 1.62
@@ -1,4 +1,4 @@
-/* A Bison parser, made from imcc/imcc.y, by GNU bison 1.75. */
+/* A Bison parser, made by GNU Bison 1.875. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
@@ -23,9 +23,6 @@
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
-#ifndef BISON_IMCC_IMCPARSER_H
-# define BISON_IMCC_IMCPARSER_H
-
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -202,9 +199,9 @@
-#ifndef YYSTYPE
+#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 204 "imcc/imcc.y"
-typedef union {
+typedef union YYSTYPE {
int t;
char * s;
SymReg * sr;
@@ -212,14 +209,15 @@
Symbol * sym;
SymbolList * symlist;
SymbolTable * symtab;
-} yystype;
-/* Line 1281 of /usr/local/share/bison/yacc.c. */
-#line 218 "imcc/imcparser.h"
-# define YYSTYPE yystype
+} YYSTYPE;
+/* Line 1248 of yacc.c. */
+#line 214 "imcc/imcparser.h"
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
#endif
-#endif /* not BISON_IMCC_IMCPARSER_H */