* src/gram.c (ritem_print): Be sure to subtract 1 when displaying

rule line numbers.
* src/closure.c (print_closure): Likewise.
* src/derives.c (print_derives): Likewise.
* tests/sets.at (Nullable): Adjust: the rule numbers are correct
now.
This commit is contained in:
Akim Demaille
2001-12-29 14:16:46 +00:00
parent 7c6b64d023
commit 29d29c8fff
5 changed files with 31 additions and 22 deletions

View File

@@ -62,7 +62,7 @@ print_closure (const char *title, short *array, size_t size)
fprintf (stderr, " %2d: .", array[i]);
for (rp = &ritem[array[i]]; *rp >= 0; ++rp)
fprintf (stderr, " %s", tags[*rp]);
fprintf (stderr, " (rule %d)\n", -*rp);
fprintf (stderr, " (rule %d)\n", -*rp - 1);
}
fputs ("\n\n", stderr);
}
@@ -100,8 +100,8 @@ print_fderives (void)
if (BITISSET (FDERIVES (i), j))
{
short *rhsp;
fprintf (stderr, "\t\t%d:", j);
for (rhsp = ritem + rule_table[j].rhs; *rhsp >= 0; ++rhsp)
fprintf (stderr, "\t\t%d:", j - 1);
for (rhsp = &ritem[rule_table[j].rhs]; *rhsp >= 0; ++rhsp)
fprintf (stderr, " %s", tags[*rhsp]);
fputc ('\n', stderr);
}

View File

@@ -43,7 +43,7 @@ print_derives (void)
{
short *rhsp;
fprintf (stderr, "\t\t%d:", *sp);
for (rhsp = ritem + rule_table[*sp].rhs; *rhsp >= 0; ++rhsp)
for (rhsp = &ritem[rule_table[*sp].rhs]; *rhsp >= 0; ++rhsp)
fprintf (stderr, " %s", tags[*rhsp]);
fprintf (stderr, " (rule %d)\n", -*rhsp - 1);
}

View File

@@ -66,7 +66,7 @@ ritem_print (FILE *out)
if (ritem[i] >= 0)
fprintf (out, " %s", tags[ritem[i]]);
else
fprintf (out, " (rule %d)\n", -ritem[i]);
fprintf (out, " (rule %d)\n", -ritem[i] - 1);
fputs ("\n\n", out);
}