+/*------------------------------------------------------------------.
+| A state was just discovered from another state. Queue it for |
+| later examination, in order to find its transitions. Return it. |
+`------------------------------------------------------------------*/
+
+static state_t *
+state_list_append (symbol_number_t symbol,
+ size_t core_size, item_number_t *core)
+{
+ state_list_t *node = XMALLOC (state_list_t, 1);
+ state_t *state = state_new (symbol, core_size, core);
+
+ if (trace_flag & trace_automaton)
+ fprintf (stderr, "state_list_append (state = %d, symbol = %d (%s))\n",
+ nstates, symbol, symbols[symbol]->tag);
+
+ /* If this is the endtoken, and this is not the initial state, then
+ this is the final state. */
+ if (symbol == 0 && first_state)
+ final_state = state;
+
+ node->next = NULL;
+ node->state = state;
+
+ if (!first_state)
+ first_state = node;
+ if (last_state)
+ last_state->next = node;
+ last_state = node;
+
+ return state;
+}