Add %define lr.keep_unreachable_states.

* NEWS (2.3a+): Mention it in the entry for unreachable state removal.
* doc/bison.texinfo (Decl Summary): Mention it in the %define entry.
* src/main.c (main): Implement it.
* tests/conflicts.at (Unreachable States After Conflict Resolution):
Extend to test it, and fix a typo.
This commit is contained in:
Joel E. Denny
2007-10-19 06:14:44 +00:00
parent 88c7874756
commit 31984206a7
5 changed files with 86 additions and 12 deletions

View File

@@ -114,14 +114,16 @@ main (int argc, char *argv[])
declarations. */
timevar_push (TV_CONFLICTS);
conflicts_solve ();
{
state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new);
state_number nstates_old = nstates;
state_remove_unreachable_states (old_to_new);
lalr_update_state_numbers (old_to_new, nstates_old);
conflicts_update_state_numbers (old_to_new, nstates_old);
free (old_to_new);
}
muscle_percent_define_default ("lr.keep_unreachable_states", "false");
if (!muscle_percent_define_flag_if ("lr.keep_unreachable_states"))
{
state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new);
state_number nstates_old = nstates;
state_remove_unreachable_states (old_to_new);
lalr_update_state_numbers (old_to_new, nstates_old);
conflicts_update_state_numbers (old_to_new, nstates_old);
free (old_to_new);
}
conflicts_print ();
timevar_pop (TV_CONFLICTS);