- fprintf (out, "%-5d(%5d%5d)%5d : (@%-5d)",
- i, rprec[i], rassoc[i], rlhs[i], rrhs[i]);
- for (r = &ritem[rrhs[i]]; *r > 0; r++)
- fprintf (out, "%5d", *r);
- fprintf (out, " [%d]\n", -(*r));
+ int rhs_count = 0;
+ /* Find the last RHS index in ritems. */
+ for (r = &ritem[rules[i].rhs]; *r >= 0; ++r)
+ ++rhs_count;
+ fprintf (out, "%3d (%2d, %2d, %2d, %2d-%2d) %2d ->",
+ i - 1,
+ rules[i].prec, rules[i].assoc, rules[i].useful,
+ rules[i].rhs, rules[i].rhs + rhs_count - 1,
+ rules[i].lhs);
+ /* Dumped the RHS. */
+ for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
+ fprintf (out, "%3d", *r);
+ fprintf (out, " [%d]\n", -(*r) - 1);