* src/conflicts.c (log_resolution, flush_shift)

(resolve_sr_conflict, set_conflicts, solve_conflicts)
(count_sr_conflicts, count_rr_conflicts, conflicts_output)
(conflicts_print, print_reductions): Use a state_t instead of an
integer when referring to a state.
As much as possible, depend upon nlookaheads, instead of the
`lookaheadsp' member of the following state (since lookaheads of
successive states are successive, the difference between state n + 1
and n served as the number of lookaheads for state n).
* src/lalr.c (add_lookback_edge): Likewise.
* src/print.c (print_core, print_actions, print_state)
(print_results): Likewise.
* src/print_graph.c (print_core, print_actions, print_state)
(print_graph): Likewise.
* src/conflicts.h: Adjust.
This commit is contained in:
Akim Demaille
2001-12-27 18:05:05 +00:00
parent 1b177bd731
commit 065fbd27af
6 changed files with 100 additions and 102 deletions

View File

@@ -310,27 +310,18 @@ static void
add_lookback_edge (int stateno, int ruleno, int gotono)
{
int i;
int k;
int found;
shorts *sp;
i = state_table[stateno]->lookaheadsp;
k = state_table[stateno + 1]->lookaheadsp;
found = 0;
while (!found && i < k)
{
if (LAruleno[i] == ruleno)
found = 1;
else
i++;
}
for (i = 0; i < state_table[stateno]->nlookaheads; ++i)
if (LAruleno[state_table[stateno]->lookaheadsp + i] == ruleno)
break;
assert (found);
assert (LAruleno[state_table[stateno]->lookaheadsp + i] == ruleno);
sp = XCALLOC (shorts, 1);
sp->next = lookback[i];
sp->next = lookback[state_table[stateno]->lookaheadsp + i];
sp->value = gotono;
lookback[i] = sp;
lookback[state_table[stateno]->lookaheadsp + i] = sp;
}