-/* subroutine of augment_automaton.
- Create the next-to-final state, to which a shift has already been made in
- the initial state. */
+/*----------------------------------------------------------------.
+| Find which rules can be used for reduction transitions from the |
+| current state and make a reductions structure for the state to |
+| record their rule numbers. |
+`----------------------------------------------------------------*/
+
+static void
+save_reductions (void)
+{
+ int count;
+ int i;
+
+ /* Find and count the active items that represent ends of rules. */
+
+ count = 0;
+ for (i = 0; i < itemsetsize; ++i)
+ {
+ int item = ritem[itemset[i]];
+ if (item < 0)
+ redset[count++] = -item;
+ }
+
+ /* Make a reductions structure and copy the data into it. */
+
+ if (count)
+ {
+ reductions *p = REDUCTIONS_ALLOC (count);
+
+ p->number = this_state->number;
+ p->nreds = count;
+
+ shortcpy (p->rules, redset, count);
+
+ if (last_reduction)
+ last_reduction->next = p;
+ else
+ first_reduction = p;
+ last_reduction = p;
+ }
+}
+
+\f
+/*-------------------------------------------------------------------.
+| Compute the nondeterministic finite state machine (see state.h for |
+| details) from the grammar. |
+`-------------------------------------------------------------------*/
+