- /* This rule has a non empty RHS. */
- short *r;
- int any_tokens = 0;
- for (r = ritem + rule_table[ruleno].rhs; *r > 0; ++r)
- if (ISTOKEN (*r))
- any_tokens = 1;
-
- /* This rule has only nonterminals: schedule it for the second
- pass. */
- if (!any_tokens)
- for (r = ritem + rule_table[ruleno].rhs; *r > 0; ++r)
- {
- rcount[ruleno]++;
- p->next = rsets[*r];
- p->value = ruleno;
- rsets[*r] = p;
- p++;
- }
- }
- else
- {
- /* This rule has an empty RHS. */
- assert (ritem[rule_table[ruleno].rhs] == -ruleno);
- if (rule_table[ruleno].useful && !nullable[rule_table[ruleno].lhs])
+ rule *rules_ruleno = &rules[ruleno];
+ if (rules_ruleno->rhs[0] >= 0)
+ {
+ /* This rule has a non empty RHS. */
+ item_number *rp = NULL;
+ bool any_tokens = false;
+ for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
+ if (ISTOKEN (*rp))
+ any_tokens = true;
+
+ /* This rule has only nonterminals: schedule it for the second
+ pass. */
+ if (!any_tokens)
+ for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
+ {
+ rcount[ruleno]++;
+ p->next = rsets[*rp - ntokens];
+ p->value = rules_ruleno;
+ rsets[*rp - ntokens] = p;
+ p++;
+ }
+ }
+ else