mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +00:00
Instead of mapping the LHS of unused rules to -1, keep the LHS
valid, but flag the rules as invalid. * src/gram.h (rule_t): `useful' is a new member. * src/print.c (print_grammar): Adjust. * src/derives.c (set_derives): Likewise. * src/reader.c (packgram, reduce_output): Likewise. * src/reduce.c (reduce_grammar_tables): Likewise. * tests/reduce.at (Underivable Rules, Useless Rules): New.
This commit is contained in:
@@ -216,7 +216,7 @@ print_grammar (FILE *out)
|
||||
fprintf (out, " %s\n", _("Number, Line, Rule"));
|
||||
for (i = 1; i <= nrules; i++)
|
||||
/* Don't print rules disabled in reduce_grammar_tables. */
|
||||
if (rule_table[i].lhs >= 0)
|
||||
if (rule_table[i].useful)
|
||||
{
|
||||
fprintf (out, _(" %3d %3d %s ->"),
|
||||
i, rule_table[i].line, tags[rule_table[i].lhs]);
|
||||
|
||||
Reference in New Issue
Block a user