In some (weird) cases, the final state number is incorrect.

Reported by Alexandre Duret-Lutz.
* src/LR0.c (state_list_append): Remove the computation of
final_state.
(save_reductions): Do it here.
(get_state): Alpha conversion.
(generate_states): Use a for loop.
* src/gram.h (item_number_is_rule_number)
(item_number_is_symbol_number): New.
* src/state.c: Use assert.
* src/system.h: Include assert.h.
* tests/sets.at (Accept): New.
This commit is contained in:
Akim Demaille
2005-11-09 15:48:05 +00:00
parent 317fce927c
commit 36b5e963e6
5 changed files with 59 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
/* Type definitions for nondeterministic finite state machine for Bison.
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -174,8 +174,7 @@ state_free (state *s)
void
state_transitions_set (state *s, int num, state **trans)
{
if (s->transitions)
abort ();
assert (!s->transitions);
s->transitions = transitions_new (num, trans);
}
@@ -187,8 +186,7 @@ state_transitions_set (state *s, int num, state **trans)
void
state_reductions_set (state *s, int num, rule **reds)
{
if (s->reductions)
abort ();
assert (!s->reductions);
s->reductions = reductions_new (num, reds);
}
@@ -248,9 +246,9 @@ state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out)
}
/*----------------------.
/*---------------------.
| A state hash table. |
`----------------------*/
`---------------------*/
/* Initial capacity of states hash table. */
#define HT_INITIAL_CAPACITY 257