item_number_t *sitems = state->items;
int snritems = state->nitems;
- /* New experimental feature: if TRACE_FLAGS output all the items of
- a state, not only its kernel. */
- if (trace_flag)
+ /* Output all the items of a state, not only its kernel. */
+ if (report_flag & report_itemsets)
{
closure (sitems, snritems);
sitems = itemset;
for (/* Nothing */; *sp >= 0; ++sp)
fprintf (out, " %s", escape (symbols[*sp]->tag));
- /* Experimental feature: display the lookaheads. */
- if (trace_flag && state->nlookaheads)
+ /* Display the lookaheads? */
+ if (report_flag & report_lookaheads)
{
int j, k;
int nlookaheads = 0;
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
- token_number_t symbol = states[state1]->accessing_symbol;
+ symbol_number_t symbol = states[state1]->accessing_symbol;
fprintf (out,
_(" %-4s\tshift, and go to state %d\n"),
escape (symbols[symbol]->tag), state1);
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
- token_number_t symbol = states[state1]->accessing_symbol;
+ symbol_number_t symbol = states[state1]->accessing_symbol;
fprintf (out, _(" %-4s\tgo to state %d\n"),
escape (symbols[symbol]->tag), state1);
}
if (state->consistent)
{
int rule = redp->rules[0];
- token_number_t symbol = rules[rule].lhs->number;
+ symbol_number_t symbol = rules[rule].lhs->number;
fprintf (out, _(" $default\treduce using rule %d (%s)\n\n"),
rule - 1, escape (symbols[symbol]->tag));
return;
fputs ("\n\n", out);
print_core (out, state);
print_actions (out, state);
+ if ((report_flag & report_solved_conflicts)
+ && state->solved_conflicts)
+ fputs (state->solved_conflicts, out);
fputs ("\n\n", out);
}
\f
static void
print_grammar (FILE *out)
{
- token_number_t i;
+ symbol_number_t i;
int j;
item_number_t *rule;
char buffer[90];
for (j = 1; j < nrules + 1; j++)
for (rule = rules[j].rhs; *rule >= 0; rule++)
- if (item_number_as_token_number (*rule) == token_translations[i])
+ if (item_number_as_symbol_number (*rule) == token_translations[i])
{
END_TEST (65);
sprintf (buffer + strlen (buffer), " %d", j - 1);
if (rules[j].lhs->number == i)
left_count++;
for (rule = rules[j].rhs; *rule >= 0; rule++)
- if (item_number_as_token_number (*rule) == i)
+ if (item_number_as_symbol_number (*rule) == i)
{
right_count++;
break;
for (j = 1; j < nrules + 1; j++)
{
for (rule = rules[j].rhs; *rule >= 0; rule++)
- if (item_number_as_token_number (*rule) == i)
+ if (item_number_as_symbol_number (*rule) == i)
{
END_TEST (65);
sprintf (buffer + strlen (buffer), " %d", j - 1);
print_grammar (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)
+ /* If the whole state item sets, not only the kernels, are wanted,
+ `closure' will be run, which needs memory allocation/deallocation. */
+ if (report_flag & report_itemsets)
new_closure (nritems);
/* Storage for print_reductions. */
shiftset = bitset_create (ntokens, BITSET_FIXED);
print_state (out, states[i]);
bitset_free (shiftset);
bitset_free (lookaheadset);
- if (trace_flag)
+ if (report_flag & report_itemsets)
free_closure ();
xfclose (out);