From: Akim Demaille Date: Mon, 19 Nov 2001 10:08:02 +0000 (+0000) Subject: * src/lalr.h (consistent): Removed array, which contents is now X-Git-Tag: before-m4-back-end~306 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/de326cc0de0e14b33c64d40171eb74640ff2e20a * 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. --- diff --git a/ChangeLog b/ChangeLog index 09d1b416..4663bec0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-19 Akim Demaille + + * 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 * src/lalr.h (reduction_table, shift_table): Removed arrays, which diff --git a/src/conflicts.c b/src/conflicts.c index 2f213850..60a5edec 100644 --- a/src/conflicts.c +++ b/src/conflicts.c @@ -191,7 +191,7 @@ set_conflicts (int state) unsigned *fp1; int symbol; - if (consistent[state]) + if (state_table[state].consistent) return; for (i = 0; i < tokensetsize; i++) diff --git a/src/lalr.c b/src/lalr.c index 27e04be4..d4795b57 100644 --- a/src/lalr.c +++ b/src/lalr.c @@ -42,7 +42,6 @@ short *lookaheads; short *LAruleno; unsigned *LA; -char *consistent; short *goto_map; short *from_state; short *to_state; @@ -208,7 +207,6 @@ initialize_LA (void) shifts *sp; short *np; - consistent = XCALLOC (char, nstates); lookaheads = XCALLOC (short, nstates + 1); count = 0; @@ -225,14 +223,14 @@ initialize_LA (void) || (sp && !ISVAR (state_table[sp->shifts[0]].accessing_symbol)))) count += rp->nreds; else - consistent[i] = 1; + state_table[i].consistent = 1; if (sp) for (k = 0; k < sp->nshifts; k++) if (state_table[sp->shifts[k]].accessing_symbol == error_token_number) { - consistent[i] = 0; + state_table[i].consistent = 0; break; } } @@ -255,7 +253,7 @@ initialize_LA (void) np = LAruleno; for (i = 0; i < nstates; i++) { - if (!consistent[i]) + if (!state_table[i].consistent) { if ((rp = state_table[i].reduction_table)) for (j = 0; j < rp->nreds; j++) @@ -580,7 +578,7 @@ build_relations (void) states[length++] = stateno; } - if (!consistent[stateno]) + if (!state_table[stateno].consistent) add_lookback_edge (stateno, *rulep, i); length--; diff --git a/src/lalr.h b/src/lalr.h index c3d719fd..c2444883 100644 --- a/src/lalr.h +++ b/src/lalr.h @@ -49,12 +49,6 @@ extern short *goto_map; extern short *from_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 various states. The elements of LARULENO that apply to state S are those from LOOKAHEADS[S] through LOOKAHEADS[S+1]-1. Each element @@ -85,6 +79,10 @@ typedef struct state_s shifts *shift_table; reductions *reduction_table; + + /* Nonzero if no lookahead is needed to decide what to do in state + S. */ + char consistent; } state_t; /* All the decorated states, indexed by the state number. Warning: diff --git a/src/output.c b/src/output.c index 4c86b22e..8abbd5d2 100644 --- a/src/output.c +++ b/src/output.c @@ -428,7 +428,7 @@ action_row (int state) if (nreds >= 1 && !nodefault) { - if (consistent[state]) + if (state_table[state].consistent) default_rule = redp->rules[0]; else { diff --git a/src/print.c b/src/print.c index cbc0ceb2..d676f7f3 100644 --- a/src/print.c +++ b/src/print.c @@ -165,7 +165,7 @@ print_actions (FILE *out, int state) fputc ('\n', out); } - if (consistent[state] && redp) + if (state_table[state].consistent && redp) { rule = redp->rules[0]; symbol = rlhs[rule]; diff --git a/src/print_graph.c b/src/print_graph.c index 55eb702c..2ce8e451 100644 --- a/src/print_graph.c +++ b/src/print_graph.c @@ -178,7 +178,7 @@ print_actions (int state, const char *node_name, struct obstack *node_obstack) obstack_sgrow (node_obstack, "\\n"); } - if (consistent[state] && redp) + if (state_table[state].consistent && redp) { rule = redp->rules[0]; symbol = rlhs[rule];