print_core (FILE *out, int state)
{
int i;
- short *sitems = state_table[state].state->items;
- int snitems = state_table[state].state->nitems;
+ short *sitems = state_table[state]->items;
+ int snitems = state_table[state]->nitems;
/* New experimental feature: if TRACE_FLAGS output all the items of
a state, not only its kernel. */
{
int i;
- shifts *shiftp = state_table[state].shift_table;
- reductions *redp = state_table[state].reduction_table;
- errs *errp = err_table[state];
+ shifts *shiftp = state_table[state]->shifts;
+ reductions *redp = state_table[state]->reductions;
+ errs *errp = state_table[state]->errs;
if (!shiftp->nshifts && !redp)
{
return;
}
- for (i = 0; i < shiftp->nshifts; i++)
+ for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
- int symbol = state_table[state1].accessing_symbol;
- /* The following line used to be turned off. */
- if (ISVAR (symbol))
- break;
- if (symbol == 0) /* I.e. strcmp(tags[symbol],"$")==0 */
- fprintf (out,
- _(" $ \tgo to state %d\n"), state1);
- else
- fprintf (out,
- _(" %-4s\tshift, and go to state %d\n"),
- tags[symbol], state1);
+ int symbol = state_table[state1]->accessing_symbol;
+ fprintf (out,
+ _(" %-4s\tshift, and go to state %d\n"),
+ tags[symbol], state1);
}
if (i > 0)
fputc ('\n', out);
}
- if (state_table[state].consistent && redp)
+ if (state_table[state]->consistent && redp)
{
int rule = redp->rules[0];
int symbol = rule_table[rule].lhs;
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
- int symbol = state_table[state1].accessing_symbol;
+ int symbol = state_table[state1]->accessing_symbol;
fprintf (out, _(" %-4s\tgo to state %d\n"),
tags[symbol], state1);
}
void
print_results (void)
{
- if (verbose_flag)
- {
- int i;
+ int i;
- /* We used to use just .out if spec_name_prefix (-p) was used, but
- that conflicts with Posix. */
- FILE *out = xfopen (spec_verbose_file, "w");
+ /* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
+ that conflicts with Posix. */
+ FILE *out = xfopen (spec_verbose_file, "w");
- size_t size = obstack_object_size (&output_obstack);
- fwrite (obstack_finish (&output_obstack), 1, size, out);
- if (size)
- fputs ("\n\n", out);
+ size_t size = obstack_object_size (&output_obstack);
+ fwrite (obstack_finish (&output_obstack), 1, size, out);
+ obstack_free (&output_obstack, NULL);
- reduce_output (out);
- conflicts_output (out);
+ if (size)
+ fputs ("\n\n", out);
- print_grammar (out);
+ reduce_output (out);
+ conflicts_output (out);
- /* New experimental feature: output all the items of a state,
- not only its kernel. Requires to run closure, which need
- memory allocation/deallocation. */
- if (trace_flag)
- new_closure (nitems);
- for (i = 0; i < nstates; i++)
- print_state (out, i);
- if (trace_flag)
- free_closure ();
+ print_grammar (out);
- xfclose (out);
- }
- obstack_free (&output_obstack, NULL);
+ /* New experimental feature: output all the items of a state,
+ not only its kernel. Requires to run closure, which need
+ memory allocation/deallocation. */
+ if (trace_flag)
+ new_closure (nitems);
+ for (i = 0; i < nstates; i++)
+ print_state (out, i);
+ if (trace_flag)
+ free_closure ();
+
+ xfclose (out);
}