muscle_insert ("prhs", obstack_finish (&format_obstack));
{
- size_t yyrhs_size = 1;
- short *yyrhs, *sp;
+ short *yyrhs;
int i;
- for (sp = ritem + 1; *sp; sp++)
- ++yyrhs_size;
- yyrhs = XMALLOC (short, yyrhs_size);
+ yyrhs = XMALLOC (short, nritems);
- for (sp = ritem + 1, i = 1; *sp; ++sp, ++i)
- yyrhs[i] = *sp > 0 ? *sp : 0;
+ for (i = 1; i < nritems; ++i)
+ yyrhs[i] = ritem[i] >= 0 ? ritem[i] : -1;
output_table_data (&format_obstack, yyrhs,
- ritem[0], 1, yyrhs_size);
+ ritem[0], 1, nritems);
muscle_insert ("rhs", obstack_finish (&format_obstack));
XFREE (yyrhs);
int i;
int default_rule = 0;
reductions *redp = state->reductions;
- int nreds = redp ? redp->nreds : 0;
shifts *shiftp = state->shifts;
errs *errp = state->errs;
/* set nonzero to inhibit having any default reduction */
for (i = 0; i < ntokens; i++)
actrow[i] = 0;
- if (nreds >= 1)
+ if (redp->nreds >= 1)
{
int j;
/* loop over all the rules available here which require
/* See which tokens are an explicit error in this state (due to
%nonassoc). For them, record MINSHORT as the action. */
- if (errp)
- for (i = 0; i < errp->nerrs; i++)
- {
- int symbol = errp->errs[i];
- actrow[symbol] = MINSHORT;
- }
+ for (i = 0; i < errp->nerrs; i++)
+ {
+ int symbol = errp->errs[i];
+ actrow[symbol] = MINSHORT;
+ }
/* Now find the most common reduction and make it the default action
for this state. */
- if (nreds >= 1 && !nodefault)
+ if (redp->nreds >= 1 && !nodefault)
{
if (state->consistent)
default_rule = redp->rules[0];
for (i = 0; i < nstates; ++i)
{
- XFREE (state_table[i]->shifts);
+ free (state_table[i]->shifts);
XFREE (state_table[i]->reductions);
- XFREE (state_table[i]->errs);
+ free (state_table[i]->errs);
free (state_table[i]);
}
XFREE (state_table);