for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
{
ngotos++;
- if (! ngotos)
+
+ /* Abort if (ngotos + 1) would overflow. */
+ if (ngotos == GOTO_NUMBER_MAXIMUM)
abort ();
+
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
}
}
{
- int k = 0;
+ goto_number k = 0;
int i;
for (i = ntokens; i < nsyms; i++)
{
int i;
for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
{
- int k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
+ goto_number k = temp_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
from_state[k] = s;
to_state[k] = sp->states[i]->number;
}
| Map a state/symbol pair into its numeric representation. |
`----------------------------------------------------------*/
-static int
+static goto_number
map_goto (state_number s0, symbol_number sym)
{
- int high;
- int low;
- int middle;
+ goto_number high;
+ goto_number low;
+ goto_number middle;
state_number s;
low = goto_map[sym - ntokens];
{
goto_number **reads = CALLOC (reads, ngotos);
goto_number *edge = CALLOC (edge, ngotos + 1);
- int nedges = 0;
+ goto_number nedges = 0;
- int i;
+ goto_number i;
F = bitsetv_create (ngotos, ntokens, BITSET_FIXED);
{
CALLOC (reads[i], nedges + 1);
memcpy (reads[i], edge, nedges * sizeof (edge[0]));
- reads[i][nedges] = -1;
+ reads[i][nedges] = END_NODE;
nedges = 0;
}
}
static void
-add_lookback_edge (state *s, rule *r, int gotono)
+add_lookback_edge (state *s, rule *r, goto_number gotono)
{
int ri = state_reduction_find (s, r);
goto_list *sp = MALLOC (sp, 1);
{
goto_number *edge = CALLOC (edge, ngotos + 1);
state_number *states1 = CALLOC (states1, ritem_longest_rhs () + 1);
- int i;
+ goto_number i;
CALLOC (includes, ngotos);
CALLOC (includes[i], nedges + 1);
for (j = 0; j < nedges; j++)
includes[i][j] = edge[j];
- includes[i][nedges] = -1;
+ includes[i][nedges] = END_NODE;
}
}
static void
compute_FOLLOWS (void)
{
- int i;
+ goto_number i;
relation_digraph (includes, ngotos, &F);