* src/lalr.c (build_relations): Use it.
2002-06-30 Akim Demaille <akim@epita.fr>
+ * src/state.h, src/state.c (shifts_to): New.
+ * src/lalr.c (build_relations): Use it.
+
+
+2002-06-30 Akim Demaille <akim@epita.fr>
+
* src/gram.h (rule_number_t, RULE_NUMBER_MAX, int_of_rule_number)
(item_number_of_rule_number, rule_number_of_item_number): New.
* src/LR0.c, src/closure.c, src/derives.c, src/derives.h,
for (rp = rules[*rulep].rhs; *rp >= 0; rp++)
{
- shifts_t *sp = state->shifts;
- int j;
- for (j = 0; j < sp->nshifts; j++)
- {
- state = states[sp->shifts[j]];
- if (state->accessing_symbol
- == item_number_as_symbol_number (*rp))
- break;
- }
-
+ state = shifts_to (state->shifts,
+ item_number_as_symbol_number (*rp));
states1[length++] = state->number;
}
}
+/*-----------------------------------------------------------------.
+| Return the state such these SHIFTS contain a shift/goto to it on |
+| SYMBOL. Aborts if none found. |
+`-----------------------------------------------------------------*/
+
+state_t *
+shifts_to (shifts_t *shifts, symbol_number_t s)
+{
+ int j;
+ for (j = 0; j < shifts->nshifts; j++)
+ if (SHIFT_SYMBOL (shifts, j) == s)
+ return states[shifts->shifts[j]];
+ abort ();
+}
/*--------------------.
#define SHIFT_IS_DISABLED(Shifts, Shift) \
(Shifts->shifts[Shift] == 0)
+/* Return the state such these SHIFTS contain a shift/goto to it on
+ SYMBOL. Aborts if none found. */
+struct state_s;
+struct state_s *shifts_to PARAMS ((shifts_t *shifts, symbol_number_t s));
/*-------.
| Errs. |