-/*-----------------------------------------------------------------.
-| Subroutine of get_state. Create a new state for those items, if |
-| necessary. |
-`-----------------------------------------------------------------*/
-
-static state_t *
-new_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
-{
- state_t *p;
-
- if (trace_flag)
- fprintf (stderr, "Entering new_state, state = %d, symbol = %d (%s)\n",
- nstates, symbol, symbol_tag_get (symbols[symbol]));
-
- if (nstates >= SHRT_MAX)
- fatal (_("too many states (max %d)"), SHRT_MAX);
-
- p = STATE_ALLOC (core_size);
- p->accessing_symbol = symbol;
- p->number = nstates;
- p->solved_conflicts = NULL;
-
- p->nitems = core_size;
- memcpy (p->items, core, core_size * sizeof (core[0]));
-
- /* If this is the eoftoken, and this is not the initial state, then
- this is the final state. */
- if (symbol == 0 && first_state)
- final_state = p->number;
-
- if (!first_state)
- first_state = p;
- if (last_state)
- last_state->next = p;
- last_state = p;
-
- nstates++;
-
- return p;
-}
-
-