* data/bison.simple (YYDSYMPRINT): New.

Use it to remove many of the #if YYDEBUG/if (yydebug).
This commit is contained in:
Akim Demaille
2002-06-20 09:22:56 +00:00
parent 366eea36d3
commit 253862fd4c
2 changed files with 25 additions and 30 deletions

View File

@@ -1,3 +1,8 @@
2002-06-20 Akim Demaille <akim@epita.fr>
* data/bison.simple (YYDSYMPRINT): New.
Use it to remove many of the #if YYDEBUG/if (yydebug).
2002-06-20 Akim Demaille <akim@epita.fr> 2002-06-20 Akim Demaille <akim@epita.fr>
* src/symtab.h, src/symtab.c (symbol_t): printer and * src/symtab.h, src/symtab.c (symbol_t): printer and

View File

@@ -556,11 +556,17 @@ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (0) } while (0)
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
int yydebug; int yydebug;
#else /* !YYDEBUG */ #else /* !YYDEBUG */
# define YYDPRINTF(Args) # define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
#endif /* !YYDEBUG */ #endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */ /* YYINITDEPTH -- initial size of the parser's stacks. */
@@ -886,16 +892,11 @@ yybackup:
{ {
yychar1 = YYTRANSLATE (yychar); yychar1 = YYTRANSLATE (yychar);
#if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables
/* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */
which are defined only if `YYDEBUG' is set. */ YYDPRINTF ((stderr, "Next token is "));
if (yydebug) YYDSYMPRINT ((stderr, yychar1, yylval]b4_location_if([, yyloc])[));
{ YYDPRINTF ((stderr, "\n"));
YYFPRINTF (stderr, "Next token is ");
yysymprint (stderr, yychar1, yylval]b4_location_if([, yyloc])[);
YYFPRINTF (stderr, "\n");
}
#endif
} }
yyn += yychar1; yyn += yychar1;
@@ -1109,16 +1110,11 @@ yyerrlab1:
/* Pop the rest of the stack. */ /* Pop the rest of the stack. */
while (yyssp > yyss) while (yyssp > yyss)
{ {
#if YYDEBUG YYDPRINTF ((stderr, "Error: popping "));
if (yydebug) YYDSYMPRINT ((stderr,
{ yystos[*yyssp],
YYFPRINTF (stderr, "Error: popping "); *yyvsp]b4_location_if([, *yylsp])[));
yysymprint (stderr, YYDPRINTF ((stderr, "\n"));
yystos[*yyssp],
*yyvsp]b4_location_if([, *yylsp])[);
YYFPRINTF (stderr, "\n");
}
#endif
yydestructor (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[); yydestructor (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[);
YYPOPSTACK; YYPOPSTACK;
} }
@@ -1154,16 +1150,10 @@ yyerrlab1:
if (yyssp == yyss) if (yyssp == yyss)
YYABORT; YYABORT;
#if YYDEBUG YYDPRINTF ((stderr, "Error: popping "));
if (yydebug) YYDSYMPRINT ((stderr,
{ yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[));
YYFPRINTF (stderr, "Error: popping "); YYDPRINTF ((stderr, "\n"));
yysymprint (stderr,
yystos[*yyssp],
*yyvsp]b4_location_if([, *yylsp])[);
YYFPRINTF (stderr, "\n");
}
#endif
yydestructor (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[); yydestructor (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[);
yyvsp--; yyvsp--;