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>
+
+ * 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>
* src/bison.s1 (yyparse): Reorganize the definitions of the stacks
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
+
#if YYDEBUG != 0
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
/* YYINITDEPTH indicates the initial size of the parser's stacks */
int yylen;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
+ fprintf (stderr, "Starting parse\n");
yystate = 0;
yyerrstatus = 0;
yylsp = yyls + size - 1;
#endif
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
+ fprintf (stderr, "Stack size increased to %d\n", yystacksize);
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
+ fprintf (stderr, "Entering state %d\n", yystate);
goto yybackup;
yybackup:
if (yychar == YYEMPTY)
{
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
+ fprintf (stderr, "Reading a token: ");
yychar = YYLEX;
}
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
+ fprintf (stderr, "Now at end of input.\n");
}
else
{
yychar1 = YYTRANSLATE(yychar);
-#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
# endif
fprintf (stderr, ")\n");
}
-#endif
}
yyn += yychar1;
/* Shift the lookahead token. */
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
+ fprintf (stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
if (yylen > 0)
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)
{
int i;
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
-
$ /* the action file gets copied in in place of this dollarsign */
#line 543 "bison.simple"
\f
yylsp -= yylen;
#endif
-#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
-#endif
*++yyvsp = yyval;
if (yychar == YYEOF)
YYABORT;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
+ fprintf (stderr, "Discarding token %d (%s).\n",
+ yychar, yytname[yychar1]);
yychar = YYEMPTY;
}
yylsp--;
#endif
-#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
-#endif
yyerrhandle:
if (yyn == YYFINAL)
YYACCEPT;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
+ fprintf (stderr, "Shifting error token, ");
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
int yynerrs; /* number of parse errors so far */
#endif /* not YYPURE */
+
#if YYDEBUG != 0
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
/* YYINITDEPTH indicates the initial size of the parser's stacks */
int yylen;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
+ fprintf (stderr, "Starting parse\n");
yystate = 0;
yyerrstatus = 0;
yylsp = yyls + size - 1;
#endif
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
+ fprintf (stderr, "Stack size increased to %d\n", yystacksize);
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
+ fprintf (stderr, "Entering state %d\n", yystate);
goto yybackup;
yybackup:
if (yychar == YYEMPTY)
{
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
+ fprintf (stderr, "Reading a token: ");
yychar = YYLEX;
}
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
+ fprintf (stderr, "Now at end of input.\n");
}
else
{
yychar1 = YYTRANSLATE(yychar);
-#if YYDEBUG != 0
if (yydebug)
{
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
# endif
fprintf (stderr, ")\n");
}
-#endif
}
yyn += yychar1;
/* Shift the lookahead token. */
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
+ fprintf (stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
if (yylen > 0)
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)
{
int i;
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
-
$ /* the action file gets copied in in place of this dollarsign */
#line 543 "bison.simple"
\f
yylsp -= yylen;
#endif
-#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
-#endif
*++yyvsp = yyval;
if (yychar == YYEOF)
YYABORT;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
+ fprintf (stderr, "Discarding token %d (%s).\n",
+ yychar, yytname[yychar1]);
yychar = YYEMPTY;
}
yylsp--;
#endif
-#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
-#endif
yyerrhandle:
if (yyn == YYFINAL)
YYACCEPT;
-#if YYDEBUG != 0
if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
+ fprintf (stderr, "Shifting error token, ");
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED