mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +00:00
One structure for states is enough, even though theoretically
there are LR(0) states and LALR(1) states. * src/lalr.h (state_t): Remove. (state_table): Be state_t **, not state_t *. * src/state.h (core, CORE_ALLOC): Rename as... (state_t, STATE_ALLOC): this. Add the LALR(1) members: shifts, reductions, errs. * src/LR0.c (state_table): Rename as... (state_hash): this, to avoid name clashes with the global `state_table'. * src/print_graph.c, src/LR0.c, src/LR0.h, src/conflicts.c * src/lalr.c, src/lalr.h, src/output.c, src/print.c: Adjust.
This commit is contained in:
26
src/lalr.h
26
src/lalr.h
@@ -69,30 +69,8 @@ extern unsigned *LA;
|
||||
#define LA(Rule) (LA + (Rule) * tokensetsize)
|
||||
|
||||
|
||||
/* A structure decorating a state, with additional information. */
|
||||
typedef struct state_s
|
||||
{
|
||||
/* A state. */
|
||||
core *state;
|
||||
|
||||
/* Its accessing symbol. */
|
||||
short accessing_symbol;
|
||||
|
||||
shifts *shifts;
|
||||
reductions *reductions;
|
||||
errs *errs;
|
||||
|
||||
/* Nonzero if no lookahead is needed to decide what to do in state
|
||||
S. */
|
||||
char consistent;
|
||||
|
||||
short lookaheads;
|
||||
} state_t;
|
||||
|
||||
/* All the decorated states, indexed by the state number. Warning:
|
||||
there is a state_TABLE in LR0.c, but it is different and static.
|
||||
*/
|
||||
extern state_t *state_table;
|
||||
/* All the states, indexed by the state number. */
|
||||
extern state_t **state_table;
|
||||
|
||||
extern int tokensetsize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user