- rule_t *rule = &rules[ruleno];
- if (rule->rhs[0] >= 0)
- {
- /* This rule has a non empty RHS. */
- item_number_t *r = NULL;
- int any_tokens = 0;
- for (r = rule->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 = rule->rhs; *r >= 0; ++r)
- {
- rcount[ruleno]++;
- p->next = rsets[*r];
- p->value = rule;
- rsets[*r] = p;
- p++;
- }
- }
- else
- {
- /* This rule has an empty RHS. */
- if (item_number_as_rule_number (rule->rhs[0]) != ruleno)
- abort ();
- if (rule->useful && !nullable[rule->lhs->number])
- {
- nullable[rule->lhs->number] = 1;
- *s2++ = rule->lhs->number;
- }
- }
+ 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
+ {
+ /* This rule has an empty RHS. */
+ aver (item_number_as_rule_number (rules_ruleno->rhs[0])
+ == ruleno);
+ if (rules_ruleno->useful
+ && ! nullable[rules_ruleno->lhs->number - ntokens])
+ {
+ nullable[rules_ruleno->lhs->number - ntokens] = true;
+ *s2++ = rules_ruleno->lhs->number;
+ }
+ }