mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
* src/bison.s1 [!YYDEBUG]: Define yydebug to 0. This allows to
remove most `#if YYDEBUG != 0', since `if (yydebug)' is enough. One `#if YYDEBUG' remains, since it uses variables which are defined only if `YYDEBUG != 0'.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2000-03-16 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/bison.s1 [!YYDEBUG]: Define yydebug to 0. This allows to
|
||||||
|
remove most `#if YYDEBUG != 0', since `if (yydebug)' is enough.
|
||||||
|
One `#if YYDEBUG' remains, since it uses variables which are
|
||||||
|
defined only if `YYDEBUG != 0'.
|
||||||
|
|
||||||
2000-03-16 Akim Demaille <akim@epita.fr>
|
2000-03-16 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/bison.s1 (yyparse): Reorganize the definitions of the stacks
|
* src/bison.s1 (yyparse): Reorganize the definitions of the stacks
|
||||||
|
|||||||
55
src/bison.s1
55
src/bison.s1
@@ -148,10 +148,17 @@ YYLTYPE yylloc; /* location data for the lookahead */
|
|||||||
int yynerrs; /* number of parse errors so far */
|
int yynerrs; /* number of parse errors so far */
|
||||||
#endif /* not YYPURE */
|
#endif /* not YYPURE */
|
||||||
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
#if YYDEBUG != 0
|
||||||
int yydebug; /* nonzero means print parse trace */
|
int yydebug; /* nonzero means print parse trace */
|
||||||
/* Since this is uninitialized, it does not stop multiple parsers
|
|
||||||
from coexisting. */
|
/* [The following comment makes no sense to me. Could someone
|
||||||
|
clarify it? --akim] Since this is uninitialized, it does not
|
||||||
|
stop multiple parsers from coexisting. */
|
||||||
|
#else
|
||||||
|
/* To avoid crippling this file with `#if YYDEBUG', define `yydebug'
|
||||||
|
as `0', so that the `if (yydebug)' be removed as dead code. */
|
||||||
|
# define yydebug 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||||
@@ -306,10 +313,8 @@ yyparse(YYPARSE_PARAM_ARG)
|
|||||||
|
|
||||||
int yylen;
|
int yylen;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Starting parse\n");
|
fprintf (stderr, "Starting parse\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
yystate = 0;
|
yystate = 0;
|
||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
@@ -409,19 +414,15 @@ yynewstate:
|
|||||||
yylsp = yyls + size - 1;
|
yylsp = yyls + size - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
fprintf (stderr, "Stack size increased to %d\n", yystacksize);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (yyssp >= yyss + yystacksize - 1)
|
if (yyssp >= yyss + yystacksize - 1)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Entering state %d\n", yystate);
|
fprintf (stderr, "Entering state %d\n", yystate);
|
||||||
#endif
|
|
||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
yybackup:
|
yybackup:
|
||||||
@@ -443,10 +444,8 @@ yynewstate:
|
|||||||
|
|
||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
{
|
{
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Reading a token: ");
|
fprintf (stderr, "Reading a token: ");
|
||||||
#endif
|
|
||||||
yychar = YYLEX;
|
yychar = YYLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,16 +456,13 @@ yynewstate:
|
|||||||
yychar1 = 0;
|
yychar1 = 0;
|
||||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Now at end of input.\n");
|
fprintf (stderr, "Now at end of input.\n");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yychar1 = YYTRANSLATE(yychar);
|
yychar1 = YYTRANSLATE(yychar);
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||||
@@ -477,7 +473,6 @@ yynewstate:
|
|||||||
# endif
|
# endif
|
||||||
fprintf (stderr, ")\n");
|
fprintf (stderr, ")\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yyn += yychar1;
|
yyn += yychar1;
|
||||||
@@ -508,10 +503,8 @@ yynewstate:
|
|||||||
|
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
fprintf (stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Discard the token being shifted unless it is eof. */
|
/* Discard the token being shifted unless it is eof. */
|
||||||
if (yychar != YYEOF)
|
if (yychar != YYEOF)
|
||||||
@@ -541,7 +534,9 @@ yyreduce:
|
|||||||
if (yylen > 0)
|
if (yylen > 0)
|
||||||
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
#if YYDEBUG
|
||||||
|
/* We have to keep this `#if YYDEBUG', since we use variables which
|
||||||
|
are defined only if `YYDEBUG' is set. */
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -555,7 +550,6 @@ yyreduce:
|
|||||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
$ /* the action file gets copied in in place of this dollarsign */
|
$ /* the action file gets copied in in place of this dollarsign */
|
||||||
#line 543 "bison.simple"
|
#line 543 "bison.simple"
|
||||||
|
|
||||||
@@ -565,7 +559,6 @@ $ /* the action file gets copied in in place of this dollarsign */
|
|||||||
yylsp -= yylen;
|
yylsp -= yylen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
short *ssp1 = yyss - 1;
|
short *ssp1 = yyss - 1;
|
||||||
@@ -574,7 +567,6 @@ $ /* the action file gets copied in in place of this dollarsign */
|
|||||||
fprintf (stderr, " %d", *++ssp1);
|
fprintf (stderr, " %d", *++ssp1);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yyval;
|
*++yyvsp = yyval;
|
||||||
|
|
||||||
@@ -672,10 +664,9 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
fprintf (stderr, "Discarding token %d (%s).\n",
|
||||||
#endif
|
yychar, yytname[yychar1]);
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
}
|
}
|
||||||
@@ -705,7 +696,6 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||||||
yylsp--;
|
yylsp--;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
short *ssp1 = yyss - 1;
|
short *ssp1 = yyss - 1;
|
||||||
@@ -714,7 +704,6 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||||||
fprintf (stderr, " %d", *++ssp1);
|
fprintf (stderr, " %d", *++ssp1);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
yyerrhandle:
|
yyerrhandle:
|
||||||
|
|
||||||
@@ -740,10 +729,8 @@ yyerrhandle:
|
|||||||
if (yyn == YYFINAL)
|
if (yyn == YYFINAL)
|
||||||
YYACCEPT;
|
YYACCEPT;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Shifting error token, ");
|
fprintf (stderr, "Shifting error token, ");
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
#ifdef YYLSP_NEEDED
|
#ifdef YYLSP_NEEDED
|
||||||
|
|||||||
@@ -148,10 +148,17 @@ YYLTYPE yylloc; /* location data for the lookahead */
|
|||||||
int yynerrs; /* number of parse errors so far */
|
int yynerrs; /* number of parse errors so far */
|
||||||
#endif /* not YYPURE */
|
#endif /* not YYPURE */
|
||||||
|
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
#if YYDEBUG != 0
|
||||||
int yydebug; /* nonzero means print parse trace */
|
int yydebug; /* nonzero means print parse trace */
|
||||||
/* Since this is uninitialized, it does not stop multiple parsers
|
|
||||||
from coexisting. */
|
/* [The following comment makes no sense to me. Could someone
|
||||||
|
clarify it? --akim] Since this is uninitialized, it does not
|
||||||
|
stop multiple parsers from coexisting. */
|
||||||
|
#else
|
||||||
|
/* To avoid crippling this file with `#if YYDEBUG', define `yydebug'
|
||||||
|
as `0', so that the `if (yydebug)' be removed as dead code. */
|
||||||
|
# define yydebug 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||||
@@ -306,10 +313,8 @@ yyparse(YYPARSE_PARAM_ARG)
|
|||||||
|
|
||||||
int yylen;
|
int yylen;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Starting parse\n");
|
fprintf (stderr, "Starting parse\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
yystate = 0;
|
yystate = 0;
|
||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
@@ -409,19 +414,15 @@ yynewstate:
|
|||||||
yylsp = yyls + size - 1;
|
yylsp = yyls + size - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
fprintf (stderr, "Stack size increased to %d\n", yystacksize);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (yyssp >= yyss + yystacksize - 1)
|
if (yyssp >= yyss + yystacksize - 1)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Entering state %d\n", yystate);
|
fprintf (stderr, "Entering state %d\n", yystate);
|
||||||
#endif
|
|
||||||
|
|
||||||
goto yybackup;
|
goto yybackup;
|
||||||
yybackup:
|
yybackup:
|
||||||
@@ -443,10 +444,8 @@ yynewstate:
|
|||||||
|
|
||||||
if (yychar == YYEMPTY)
|
if (yychar == YYEMPTY)
|
||||||
{
|
{
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Reading a token: ");
|
fprintf (stderr, "Reading a token: ");
|
||||||
#endif
|
|
||||||
yychar = YYLEX;
|
yychar = YYLEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,16 +456,13 @@ yynewstate:
|
|||||||
yychar1 = 0;
|
yychar1 = 0;
|
||||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Now at end of input.\n");
|
fprintf (stderr, "Now at end of input.\n");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yychar1 = YYTRANSLATE(yychar);
|
yychar1 = YYTRANSLATE(yychar);
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||||
@@ -477,7 +473,6 @@ yynewstate:
|
|||||||
# endif
|
# endif
|
||||||
fprintf (stderr, ")\n");
|
fprintf (stderr, ")\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yyn += yychar1;
|
yyn += yychar1;
|
||||||
@@ -508,10 +503,8 @@ yynewstate:
|
|||||||
|
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
fprintf (stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Discard the token being shifted unless it is eof. */
|
/* Discard the token being shifted unless it is eof. */
|
||||||
if (yychar != YYEOF)
|
if (yychar != YYEOF)
|
||||||
@@ -541,7 +534,9 @@ yyreduce:
|
|||||||
if (yylen > 0)
|
if (yylen > 0)
|
||||||
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
#if YYDEBUG
|
||||||
|
/* We have to keep this `#if YYDEBUG', since we use variables which
|
||||||
|
are defined only if `YYDEBUG' is set. */
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -555,7 +550,6 @@ yyreduce:
|
|||||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
$ /* the action file gets copied in in place of this dollarsign */
|
$ /* the action file gets copied in in place of this dollarsign */
|
||||||
#line 543 "bison.simple"
|
#line 543 "bison.simple"
|
||||||
|
|
||||||
@@ -565,7 +559,6 @@ $ /* the action file gets copied in in place of this dollarsign */
|
|||||||
yylsp -= yylen;
|
yylsp -= yylen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
short *ssp1 = yyss - 1;
|
short *ssp1 = yyss - 1;
|
||||||
@@ -574,7 +567,6 @@ $ /* the action file gets copied in in place of this dollarsign */
|
|||||||
fprintf (stderr, " %d", *++ssp1);
|
fprintf (stderr, " %d", *++ssp1);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yyval;
|
*++yyvsp = yyval;
|
||||||
|
|
||||||
@@ -672,10 +664,9 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
fprintf (stderr, "Discarding token %d (%s).\n",
|
||||||
#endif
|
yychar, yytname[yychar1]);
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
}
|
}
|
||||||
@@ -705,7 +696,6 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||||||
yylsp--;
|
yylsp--;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
short *ssp1 = yyss - 1;
|
short *ssp1 = yyss - 1;
|
||||||
@@ -714,7 +704,6 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||||||
fprintf (stderr, " %d", *++ssp1);
|
fprintf (stderr, " %d", *++ssp1);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
yyerrhandle:
|
yyerrhandle:
|
||||||
|
|
||||||
@@ -740,10 +729,8 @@ yyerrhandle:
|
|||||||
if (yyn == YYFINAL)
|
if (yyn == YYFINAL)
|
||||||
YYACCEPT;
|
YYACCEPT;
|
||||||
|
|
||||||
#if YYDEBUG != 0
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
fprintf(stderr, "Shifting error token, ");
|
fprintf (stderr, "Shifting error token, ");
|
||||||
#endif
|
|
||||||
|
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
#ifdef YYLSP_NEEDED
|
#ifdef YYLSP_NEEDED
|
||||||
|
|||||||
Reference in New Issue
Block a user