Now that states have a complete set of members, the linked list of

reductions is useless: just fill directly the state's reductions
member.
* src/state.h (struct reductions): Remove member `number' and
`next'.
* src/LR0.c (first_reduction, last_reduction): Remove.
(save_reductions): Don't link the new reductions, store them in
this_state.
* src/lalr.c (set_state_table): No need to attach reductions to
states, it's already done.
* src/output.c (output_actions): No longer free the shifts, then
the reductions, then the states: free all the states and their
members.
This commit is contained in:
Akim Demaille
2001-12-10 09:06:48 +00:00
parent 0edad74997
commit 49701457c2
5 changed files with 29 additions and 21 deletions

View File

@@ -30,18 +30,17 @@
#include "complain.h"
#include "closure.h"
#include "LR0.h"
#include "lalr.h"
#include "reduce.h"
int nstates;
int final_state;
state_t *first_state = NULL;
shifts *first_shift = NULL;
reductions *first_reduction = NULL;
static state_t *this_state = NULL;
static state_t *last_state = NULL;
static shifts *last_shift = NULL;
static reductions *last_reduction = NULL;
static int nshifts;
static short *shift_symbol = NULL;
@@ -551,17 +550,10 @@ save_reductions (void)
if (count)
{
reductions *p = REDUCTIONS_ALLOC (count);
p->number = this_state->number;
p->nreds = count;
shortcpy (p->rules, redset, count);
if (last_reduction)
last_reduction->next = p;
else
first_reduction = p;
last_reduction = p;
this_state->reductions = p;
}
}