mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
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:
13
src/gram.h
13
src/gram.h
@@ -1,6 +1,6 @@
|
||||
/* Data definitions for internal representation of Bison's input.
|
||||
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004
|
||||
Copyright (C) 1984, 1986, 1989, 1992, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
@@ -138,6 +138,12 @@ item_number_as_symbol_number (item_number i)
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
item_number_is_symbol_number (item_number i)
|
||||
{
|
||||
return i >= 0;
|
||||
}
|
||||
|
||||
/* Rule numbers. */
|
||||
typedef int rule_number;
|
||||
extern rule_number nrules;
|
||||
@@ -154,6 +160,11 @@ item_number_as_rule_number (item_number i)
|
||||
return -1 - i;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
item_number_is_rule_number (item_number i)
|
||||
{
|
||||
return i < 0;
|
||||
}
|
||||
|
||||
/*--------.
|
||||
| Rules. |
|
||||
|
||||
Reference in New Issue
Block a user