- fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n");
- for (i = 1; i < nrules + nuseless_productions + 1; i++)
- {
- int rhs_count = 0;
- /* Find the last RHS index in ritems. */
- for (r = rules[i].rhs; *r >= 0; ++r)
- ++rhs_count;
- fprintf (out, "%3d (%2d, %2d, %2d, %2d-%2d) %2d ->",
- i - 1,
- rules[i].prec ? rules[i].prec->prec : 0,
- rules[i].prec ? rules[i].prec->assoc : 0,
- rules[i].useful,
- rules[i].rhs - ritem,
- rules[i].rhs - ritem + rhs_count - 1,
- rules[i].lhs->number);
- /* Dumped the RHS. */
- for (r = rules[i].rhs; *r >= 0; r++)
- fprintf (out, " %3d", *r);
- fprintf (out, " [%d]\n", -(*r) - 1);
- }
+ {
+ rule_number i;
+ fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n");
+ for (i = 0; i < nrules + nuseless_productions; i++)
+ {
+ rule *rule_i = &rules[i];
+ item_number *rp = NULL;
+ unsigned int rhs_itemno = rule_i->rhs - ritem;
+ unsigned int rhs_count = 0;
+ /* Find the last RHS index in ritems. */
+ for (rp = rule_i->rhs; *rp >= 0; ++rp)
+ ++rhs_count;
+ fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->",
+ i,
+ rule_i->prec ? rule_i->prec->prec : 0,
+ rule_i->prec ? rule_i->prec->assoc : 0,
+ rule_i->useful,
+ rhs_itemno,
+ rhs_itemno + rhs_count - 1,
+ rule_i->lhs->number);
+ /* Dumped the RHS. */
+ for (rp = rule_i->rhs; *rp >= 0; rp++)
+ fprintf (out, " %3d", *rp);
+ fprintf (out, " [%d]\n", item_number_as_rule_number (*rp));
+ }
+ }