mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
* src/lalr.h (consistent): Removed array, which contents is now
member of... (state_t): this structure. * src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c: Adjust.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2001-11-19 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/lalr.h (consistent): Removed array, which contents is now
|
||||||
|
member of...
|
||||||
|
(state_t): this structure.
|
||||||
|
* src/output.c, src/lalr.c, src/print_graph.c, src/conflicts.c:
|
||||||
|
Adjust.
|
||||||
|
|
||||||
2001-11-19 Akim Demaille <akim@epita.fr>
|
2001-11-19 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/lalr.h (reduction_table, shift_table): Removed arrays, which
|
* src/lalr.h (reduction_table, shift_table): Removed arrays, which
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ set_conflicts (int state)
|
|||||||
unsigned *fp1;
|
unsigned *fp1;
|
||||||
int symbol;
|
int symbol;
|
||||||
|
|
||||||
if (consistent[state])
|
if (state_table[state].consistent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < tokensetsize; i++)
|
for (i = 0; i < tokensetsize; i++)
|
||||||
|
|||||||
10
src/lalr.c
10
src/lalr.c
@@ -42,7 +42,6 @@ short *lookaheads;
|
|||||||
short *LAruleno;
|
short *LAruleno;
|
||||||
unsigned *LA;
|
unsigned *LA;
|
||||||
|
|
||||||
char *consistent;
|
|
||||||
short *goto_map;
|
short *goto_map;
|
||||||
short *from_state;
|
short *from_state;
|
||||||
short *to_state;
|
short *to_state;
|
||||||
@@ -208,7 +207,6 @@ initialize_LA (void)
|
|||||||
shifts *sp;
|
shifts *sp;
|
||||||
short *np;
|
short *np;
|
||||||
|
|
||||||
consistent = XCALLOC (char, nstates);
|
|
||||||
lookaheads = XCALLOC (short, nstates + 1);
|
lookaheads = XCALLOC (short, nstates + 1);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -225,14 +223,14 @@ initialize_LA (void)
|
|||||||
|| (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol))))
|
|| (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol))))
|
||||||
count += rp->nreds;
|
count += rp->nreds;
|
||||||
else
|
else
|
||||||
consistent[i] = 1;
|
state_table[i].consistent = 1;
|
||||||
|
|
||||||
if (sp)
|
if (sp)
|
||||||
for (k = 0; k < sp->nshifts; k++)
|
for (k = 0; k < sp->nshifts; k++)
|
||||||
if (state_table[sp->shifts[k]].accessing_symbol
|
if (state_table[sp->shifts[k]].accessing_symbol
|
||||||
== error_token_number)
|
== error_token_number)
|
||||||
{
|
{
|
||||||
consistent[i] = 0;
|
state_table[i].consistent = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +253,7 @@ initialize_LA (void)
|
|||||||
np = LAruleno;
|
np = LAruleno;
|
||||||
for (i = 0; i < nstates; i++)
|
for (i = 0; i < nstates; i++)
|
||||||
{
|
{
|
||||||
if (!consistent[i])
|
if (!state_table[i].consistent)
|
||||||
{
|
{
|
||||||
if ((rp = state_table[i].reduction_table))
|
if ((rp = state_table[i].reduction_table))
|
||||||
for (j = 0; j < rp->nreds; j++)
|
for (j = 0; j < rp->nreds; j++)
|
||||||
@@ -580,7 +578,7 @@ build_relations (void)
|
|||||||
states[length++] = stateno;
|
states[length++] = stateno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!consistent[stateno])
|
if (!state_table[stateno].consistent)
|
||||||
add_lookback_edge (stateno, *rulep, i);
|
add_lookback_edge (stateno, *rulep, i);
|
||||||
|
|
||||||
length--;
|
length--;
|
||||||
|
|||||||
10
src/lalr.h
10
src/lalr.h
@@ -49,12 +49,6 @@ extern short *goto_map;
|
|||||||
extern short *from_state;
|
extern short *from_state;
|
||||||
extern short *to_state;
|
extern short *to_state;
|
||||||
|
|
||||||
/* CONSISTENT[S] is nonzero if no lookahead is needed to decide what
|
|
||||||
to do in state S. */
|
|
||||||
|
|
||||||
extern char *consistent;
|
|
||||||
|
|
||||||
|
|
||||||
/* LARULENO is a vector which records the rules that need lookahead in
|
/* LARULENO is a vector which records the rules that need lookahead in
|
||||||
various states. The elements of LARULENO that apply to state S are
|
various states. The elements of LARULENO that apply to state S are
|
||||||
those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1. Each element
|
those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1. Each element
|
||||||
@@ -85,6 +79,10 @@ typedef struct state_s
|
|||||||
|
|
||||||
shifts *shift_table;
|
shifts *shift_table;
|
||||||
reductions *reduction_table;
|
reductions *reduction_table;
|
||||||
|
|
||||||
|
/* Nonzero if no lookahead is needed to decide what to do in state
|
||||||
|
S. */
|
||||||
|
char consistent;
|
||||||
} state_t;
|
} state_t;
|
||||||
|
|
||||||
/* All the decorated states, indexed by the state number. Warning:
|
/* All the decorated states, indexed by the state number. Warning:
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ action_row (int state)
|
|||||||
|
|
||||||
if (nreds >= 1 && !nodefault)
|
if (nreds >= 1 && !nodefault)
|
||||||
{
|
{
|
||||||
if (consistent[state])
|
if (state_table[state].consistent)
|
||||||
default_rule = redp->rules[0];
|
default_rule = redp->rules[0];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ print_actions (FILE *out, int state)
|
|||||||
fputc ('\n', out);
|
fputc ('\n', out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consistent[state] && redp)
|
if (state_table[state].consistent && redp)
|
||||||
{
|
{
|
||||||
rule = redp->rules[0];
|
rule = redp->rules[0];
|
||||||
symbol = rlhs[rule];
|
symbol = rlhs[rule];
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ print_actions (int state, const char *node_name, struct obstack *node_obstack)
|
|||||||
obstack_sgrow (node_obstack, "\\n");
|
obstack_sgrow (node_obstack, "\\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consistent[state] && redp)
|
if (state_table[state].consistent && redp)
|
||||||
{
|
{
|
||||||
rule = redp->rules[0];
|
rule = redp->rules[0];
|
||||||
symbol = rlhs[rule];
|
symbol = rlhs[rule];
|
||||||
|
|||||||
Reference in New Issue
Block a user