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.
+2001-12-29 Akim Demaille <akim@epita.fr>
+
+ * 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.
+
2001-12-29 Akim Demaille <akim@epita.fr>
* src/lalr.c (lookaheads_print): New.
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);
}
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);
}
{
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);
}
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);
}
AT_CHECK([[sed 's/[ ]*$//' stderr]], [],
[[RITEM
- e $ (rule 1)
- 'e' (rule 2)
- (rule 3)
+ e $ (rule 0)
+ 'e' (rule 1)
+ (rule 2)
DERIVES
FDERIVES
$axiom derives
- 1: e $
- 2: 'e'
- 3:
+ 0: e $
+ 1: 'e'
+ 2:
e derives
- 2: 'e'
- 3:
+ 1: 'e'
+ 2:
Processing state 0 (reached by $)
Closure: output
- 0: . e $ (rule 1)
- 3: . 'e' (rule 2)
- 5: . (rule 3)
+ 0: . e $ (rule 0)
+ 3: . 'e' (rule 1)
+ 5: . (rule 2)
Entering new_itemsets, state = 0
Exiting get_state => 2
Processing state 1 (reached by 'e')
Closure: input
- 4: . (rule 2)
+ 4: . (rule 1)
Closure: output
- 4: . (rule 2)
+ 4: . (rule 1)
Entering new_itemsets, state = 1
Entering append_states, state = 1
Processing state 2 (reached by e)
Closure: input
- 1: . $ (rule 1)
+ 1: . $ (rule 0)
Closure: output
- 1: . $ (rule 1)
+ 1: . $ (rule 0)
Entering new_itemsets, state = 2
Exiting get_state => 3
Processing state 3 (reached by $)
Closure: input
- 2: . (rule 1)
+ 2: . (rule 0)
Closure: output
- 2: . (rule 1)
+ 2: . (rule 0)
Entering new_itemsets, state = 3