* src/LR0.c (new_state, get_state): Complete TRACE code.

* src/closure.c: Include `reader.h' to get `tags', needed by the
trace code.
Rename the conditional DEBUG as TRACE.
Output consistently TRACEs to stderr, not stdout.
* src/derives.c: Likewise.
* src/reduce.c: (inaccessable_symbols): Using if is better style
than goto.
Use `#if TRACE' instead of `#if 0' for tracing code.
This commit is contained in:
Akim Demaille
2001-11-19 09:16:24 +00:00
parent 377bd7c9a2
commit 8639df64a6
5 changed files with 67 additions and 68 deletions

View File

@@ -1,5 +1,5 @@
/* Match rules with nonterminals for bison,
Copyright 1984, 1989, 2000 Free Software Foundation, Inc.
Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -26,12 +26,13 @@
#include "system.h"
#include "types.h"
#include "reader.h"
#include "gram.h"
#include "derives.h"
short **derives;
#if DEBUG
#if TRACE
static void
print_derives (void)
@@ -39,21 +40,17 @@ print_derives (void)
int i;
short *sp;
fputs ("\n\n\n", stdout);
printf (_("DERIVES"));
fputs ("\n\n", stdout);
fputs ("\n\n\nDERIVES\n\n", stderr);
for (i = ntokens; i < nsyms; i++)
{
printf (_("%s derives"), tags[i]);
fprintf (stderr, "%s derives", tags[i]);
for (sp = derives[i]; *sp > 0; sp++)
{
printf (" %d", *sp);
}
putchar ('\n');
fprintf (stderr, " %d", *sp);
putc ('\n', stderr);
}
putchar ('\n');
putc ('\n', stderr);
}
#endif
@@ -99,7 +96,7 @@ set_derives (void)
*q++ = -1;
}
#if DEBUG
#if TRACE
print_derives ();
#endif