np = LArule;
for (i = 0; i < nstates; i++)
if (!states[i]->consistent)
- for (j = 0; j < states[i]->reductions->nreds; j++)
+ for (j = 0; j < states[i]->reductions->num; j++)
*np++ = &rules[states[i]->reductions->rules[j]];
}
ngotos = 0;
for (state = 0; state < nstates; ++state)
{
- shifts_t *sp = states[state]->shifts;
+ transitions_t *sp = states[state]->shifts;
int i;
- for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
+ for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
{
if (ngotos == SHRT_MAX)
fatal (_("too many gotos (max %d)"), SHRT_MAX);
ngotos++;
- goto_map[SHIFT_SYMBOL (sp, i)]++;
+ goto_map[TRANSITION_SYMBOL (sp, i)]++;
}
}
for (state = 0; state < nstates; ++state)
{
- shifts_t *sp = states[state]->shifts;
+ transitions_t *sp = states[state]->shifts;
int i;
- for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
+ for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
{
- int k = temp_map[SHIFT_SYMBOL (sp, i)]++;
+ int k = temp_map[TRANSITION_SYMBOL (sp, i)]++;
from_state[k] = state;
- to_state[k] = sp->shifts[i];
+ to_state[k] = sp->states[i];
}
}
for (i = 0; i < ngotos; i++)
{
state_number_t stateno = to_state[i];
- shifts_t *sp = states[stateno]->shifts;
+ transitions_t *sp = states[stateno]->shifts;
int j;
- for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++)
- bitset_set (F[i], SHIFT_SYMBOL (sp, j));
+ for (j = 0; j < sp->num && TRANSITION_IS_SHIFT (sp, j); j++)
+ bitset_set (F[i], TRANSITION_SYMBOL (sp, j));
- for (; j < sp->nshifts; j++)
+ for (; j < sp->num; j++)
{
- symbol_number_t symbol = SHIFT_SYMBOL (sp, j);
+ symbol_number_t symbol = TRANSITION_SYMBOL (sp, j);
if (nullable[symbol])
edge[nedges++] = map_goto (stateno, symbol);
}
for (rp = rules[*rulep].rhs; *rp >= 0; rp++)
{
- state = shifts_to (state->shifts,
+ state = transitions_to (state->shifts,
item_number_as_symbol_number (*rp));
states1[length++] = state->number;
}
int k;
int nlookaheads = 0;
reductions_t *rp = states[i]->reductions;
- shifts_t *sp = states[i]->shifts;
+ transitions_t *sp = states[i]->shifts;
/* We need a lookahead either to distinguish different
reductions (i.e., there are two or more), or to distinguish a
reduction from a shift. Otherwise, it is straightforward,
and the state is `consistent'. */
- if (rp->nreds > 1
- || (rp->nreds == 1 && sp->nshifts && SHIFT_IS_SHIFT (sp, 0)))
- nlookaheads += rp->nreds;
+ if (rp->num > 1
+ || (rp->num == 1 && sp->num && TRANSITION_IS_SHIFT (sp, 0)))
+ nlookaheads += rp->num;
else
states[i]->consistent = 1;
- for (k = 0; k < sp->nshifts; k++)
- if (SHIFT_IS_ERROR (sp, k))
+ for (k = 0; k < sp->num; k++)
+ if (TRANSITION_IS_ERROR (sp, k))
{
states[i]->consistent = 0;
break;
BITSET_EXECUTE (states[i]->lookaheads[j], 0, k,
{
fprintf (out, " on %d (%s) -> rule %d\n",
- k, symbol_tag_get (symbols[k]),
+ k, symbols[k]->tag,
states[i]->lookaheads_rule[j]->number - 1);
});
}