Attaching lineno to buckets is stupid, since only one copy of each

symbol is kept, only the line of the first occurrence is kept too.
* src/symtab.h, src/symtab.c (bucket): Remove the line member.
* src/reader.c (rline_allocated): Remove, unused.
(symbol_list): Have a `line' member.
(symbol_list_new): New.
(readgram): Use it.
* src/print.c (print_grammar): Output the rule line numbers.
* tests/regression.at (Solved SR Conflicts)
(Unresolved SR Conflicts): Adjust.
Reported by Hans Aberg.
This commit is contained in:
Akim Demaille
2001-11-23 14:13:02 +00:00
parent b497173564
commit b29b2ed560
6 changed files with 52 additions and 35 deletions

View File

@@ -213,17 +213,19 @@ print_grammar (FILE *out)
/* rule # : LHS -> RHS */
fprintf (out, "\n%s\n\n", _("Grammar"));
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)
{
fprintf (out, _("rule %-4d %s ->"), i, tags[rule_table[i].lhs]);
fprintf (out, _(" %3d %3d %s ->"),
i, rule_table[i].line, tags[rule_table[i].lhs]);
rule = &ritem[rule_table[i].rhs];
if (*rule > 0)
while (*rule > 0)
fprintf (out, " %s", tags[*rule++]);
else
fprintf (out, " /* %s */", _("empty"));
fprintf (out, " /* %s */", _("empty"));
fputc ('\n', out);
}