X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ad949da96bf5621185a28f354c08f4595bc42952..e53c6322978d2f8cb8a8aa893c20727aa82cd09c:/src/LR0.c diff --git a/src/LR0.c b/src/LR0.c index 2b78dd03..02798cd9 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -1,5 +1,5 @@ /* Generate the nondeterministic finite state machine for bison, - Copyright 1984, 1986, 1989, 2000, 2001 Free Software Foundation, Inc. + Copyright 1984, 1986, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -23,6 +23,7 @@ The entry point is generate_states. */ #include "system.h" +#include "bitset.h" #include "symtab.h" #include "getargs.h" #include "reader.h" @@ -34,7 +35,7 @@ #include "lalr.h" #include "reduce.h" -int nstates; +unsigned int nstates; /* Initialize the final state to -1, otherwise, it might be set to 0 by default, and since we don't compute the reductions of the final state, we end up not computing the reductions of the initial state, @@ -113,6 +114,7 @@ allocate_storage (void) shiftset = XCALLOC (short, nsyms); redset = XCALLOC (short, nrules + 1); state_hash = XCALLOC (state_t *, STATE_HASH_SIZE); + shift_symbol = XCALLOC (short, nsyms); } @@ -154,7 +156,6 @@ new_itemsets (void) for (i = 0; i < nsyms; i++) kernel_size[i] = 0; - shift_symbol = XCALLOC (short, nsyms); nshifts = 0; for (i = 0; i < nitemset; ++i) @@ -364,15 +365,15 @@ save_reductions (void) } -/*--------------------. -| Build STATE_TABLE. | -`--------------------*/ +/*---------------. +| Build STATES. | +`---------------*/ static void -set_state_table (void) +set_states (void) { state_t *sp; - state_table = XCALLOC (state_t *, nstates); + states = XCALLOC (state_t *, nstates); for (sp = first_state; sp; sp = sp->next) { @@ -386,7 +387,7 @@ set_state_table (void) if (!sp->reductions) sp->reductions = reductions_new (0); - state_table[sp->number] = sp; + states[sp->number] = sp; } } @@ -432,6 +433,6 @@ generate_states (void) free_closure (); free_storage (); - /* Set up STATE_TABLE. */ - set_state_table (); + /* Set up STATES. */ + set_states (); }