summaryrefslogtreecommitdiff
path: root/src/gram.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-03-29 21:49:50 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-03-30 10:10:39 +0100
commitdee8fbbc1eb82b28c1adb5c6c1e46b0e68201628 (patch)
treef8b73edd56ffd79f3a9240f5b31982141770e811 /src/gram.c
parent75303c61d86606a400a6398aa8f914a1070bdf6d (diff)
downloadbison-dee8fbbc1eb82b28c1adb5c6c1e46b0e68201628.tar.gz
gram: fix and improve log message
It seems that not many people read these logs: the error was introduced in 2001 (3067fbef531832df1e43bbd28787655808361eed), * src/gram.c (grammar_dump): Fix the headers of the table: remove duplicate display of "Ritem Range". While at it, remove duplicate display of the rule number (and remove an incorrect comment about it: these numbers _are_ equal). * tests/sets.at (Reduced Grammar): Use useless rule, nterm and token in the example.
Diffstat (limited to 'src/gram.c')
-rw-r--r--src/gram.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/gram.c b/src/gram.c
index b580dac4..dd25da34 100644
--- a/src/gram.c
+++ b/src/gram.c
@@ -274,25 +274,23 @@ grammar_dump (FILE *out, const char *title)
fprintf (out, "Rules\n-----\n\n");
{
- /* Reduced number, then original number in the sources. */
fprintf (out,
- "Num (Num, Prec, Assoc, Useful, UselessChain, Ritem Range)"
- " Lhs -> Rhs (Ritem range)\n");
+ "Num (Prec, Assoc, Useful, UselessChain) Lhs"
+ " -> (Ritem Range) Rhs\n");
for (rule_number i = 0; i < nrules + nuseless_productions; ++i)
{
rule const *rule_i = &rules[i];
unsigned const rhs_itemno = rule_i->rhs - ritem;
unsigned length = rule_rhs_length (rule_i);
- fprintf (out, "%3d (%3d, %2d, %2d, %2s, %2s, %2u-%2u) %2d ->",
- item_number_as_rule_number (rule_i->rhs[length]),
+ aver (item_number_as_rule_number (rule_i->rhs[length] == i));
+ fprintf (out, "%3d (%2d, %2d, %2s, %2s) %2d -> (%2u-%2u)",
i,
rule_i->prec ? rule_i->prec->prec : 0,
rule_i->prec ? rule_i->prec->assoc : 0,
rule_i->useful ? "t" : "f",
rule_useless_chain_p (rule_i) ? "t" : "f",
- rhs_itemno,
- rhs_itemno + length - 1,
- rule_i->lhs->number);
+ rule_i->lhs->number,
+ rhs_itemno, rhs_itemno + length - 1);
/* Dumped the RHS. */
for (item_number *rhsp = rule_i->rhs; 0 <= *rhsp; ++rhsp)
fprintf (out, " %3d", *rhsp);