+2001-12-05 Akim Demaille <akim@epita.fr>
+
+ * src/closure.c (print_closure): Improve.
+ (closure): Use it for printing input and output.
+
+
2001-12-05 Akim Demaille <akim@epita.fr>
* src/closure.c (FIRSTS, FDERIVES): Adjust to reality: they are
while (this_state)
{
+ if (trace_flag)
+ fprintf (stderr, "Processing state %d (reached by %s)\n",
+ this_state->number, tags[this_state->accessing_symbol]);
/* Set up ruleset and itemset for the transitions out of this
state. ruleset gets a 1 bit for each rule that could reduce
now. itemset gets a vector of all the items that could be
`-----------------*/
static void
-print_closure (int n)
+print_closure (const char *title, short *array, size_t size)
{
- int i;
- fprintf (stderr, "n = %d\n", n);
- for (i = 0; i < itemsetsize; ++i)
- fprintf (stderr, " %d\n", itemset[i]);
- fprintf (stderr, "\n\n");
+ size_t i;
+ fprintf (stderr, "Closure: %s\n", title);
+ for (i = 0; i < size; ++i)
+ {
+ short *rp;
+ fprintf (stderr, " %2d: .", array[i]);
+ for (rp = &ritem[array[i]]; *rp > 0; ++rp)
+ fprintf (stderr, " %s", tags[*rp]);
+ fprintf (stderr, " (rule %d)\n", -*rp);
+ }
+ fputs ("\n\n", stderr);
}
int ruleno;
if (trace_flag)
- {
- fprintf (stderr, "Entering closure (items = {");
- for (c = 0; c < n; ++c)
- fprintf (stderr, " %d ", core[c]);
- fprintf (stderr, "})\n");
- }
+ print_closure ("input", core, n);
if (n == 0)
{
}
if (trace_flag)
- print_closure (n);
+ print_closure ("output", itemset, itemsetsize);
}