mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
* src/state.h (state_number_t, STATE_NUMBER_MAX): New.
* src/LR0.c, src/LR0.h, src/conflicts.c, src/lalr.c, src/lalr.h, * src/output.c, src/print.c, src/print_graph.c: Propagate. * src/LR0.h, src/LR0.h (final_state): Is a state_t*.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2002-06-30 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* src/state.h (state_number_t, STATE_NUMBER_MAX): New.
|
||||
* src/LR0.c, src/LR0.h, src/conflicts.c, src/lalr.c, src/lalr.h,
|
||||
* src/output.c, src/print.c, src/print_graph.c: Propagate.
|
||||
* src/LR0.h, src/LR0.h (final_state): Is a state_t*.
|
||||
|
||||
2002-06-30 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Make the test suite pass with warnings checked.
|
||||
|
||||
25
src/LR0.c
25
src/LR0.c
@@ -37,15 +37,10 @@
|
||||
#include "lalr.h"
|
||||
#include "reduce.h"
|
||||
|
||||
unsigned int nstates = 0;
|
||||
/* 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,
|
||||
which is of course needed.
|
||||
|
||||
FINAL_STATE is properly set by new_state when it recognizes the
|
||||
state_number_t nstates = 0;
|
||||
/* FINAL_STATE is properly set by new_state when it recognizes its
|
||||
accessing symbol: EOF. */
|
||||
int final_state = -1;
|
||||
state_t *final_state = NULL;
|
||||
static state_t *first_state = NULL;
|
||||
|
||||
static state_t *this_state = NULL;
|
||||
@@ -55,7 +50,7 @@ static int nshifts;
|
||||
static symbol_number_t *shift_symbol = NULL;
|
||||
|
||||
static short *redset = NULL;
|
||||
static short *shiftset = NULL;
|
||||
static state_number_t *shiftset = NULL;
|
||||
|
||||
static item_number_t **kernel_base = NULL;
|
||||
static int *kernel_size = NULL;
|
||||
@@ -114,7 +109,7 @@ allocate_storage (void)
|
||||
{
|
||||
allocate_itemsets ();
|
||||
|
||||
shiftset = XCALLOC (short, nsyms);
|
||||
shiftset = XCALLOC (state_number_t, nsyms);
|
||||
redset = XCALLOC (short, nrules + 1);
|
||||
state_hash = XCALLOC (state_t *, STATE_HASH_SIZE);
|
||||
shift_symbol = XCALLOC (symbol_number_t, nsyms);
|
||||
@@ -193,8 +188,8 @@ new_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
|
||||
fprintf (stderr, "Entering new_state, state = %d, symbol = %d (%s)\n",
|
||||
nstates, symbol, symbol_tag_get (symbols[symbol]));
|
||||
|
||||
if (nstates >= SHRT_MAX)
|
||||
fatal (_("too many states (max %d)"), SHRT_MAX);
|
||||
if (nstates >= STATE_NUMBER_MAX)
|
||||
fatal (_("too many states (max %d)"), STATE_NUMBER_MAX);
|
||||
|
||||
p = STATE_ALLOC (core_size);
|
||||
p->accessing_symbol = symbol;
|
||||
@@ -207,7 +202,7 @@ new_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
|
||||
/* If this is the eoftoken, and this is not the initial state, then
|
||||
this is the final state. */
|
||||
if (symbol == 0 && first_state)
|
||||
final_state = p->number;
|
||||
final_state = p;
|
||||
|
||||
if (!first_state)
|
||||
first_state = p;
|
||||
@@ -227,7 +222,7 @@ new_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
|
||||
| equivalent one exists already. Used by append_states. |
|
||||
`--------------------------------------------------------------*/
|
||||
|
||||
static int
|
||||
static state_number_t
|
||||
get_state (symbol_number_t symbol, size_t core_size, item_number_t *core)
|
||||
{
|
||||
int key;
|
||||
@@ -363,7 +358,7 @@ save_reductions (void)
|
||||
|
||||
/* If this is the final state, we want it to have no reductions at
|
||||
all, although it has one for `START_SYMBOL EOF .'. */
|
||||
if (this_state->number == final_state)
|
||||
if (final_state && this_state->number == final_state->number)
|
||||
return;
|
||||
|
||||
/* Find and count the active items that represent ends of rules. */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
void generate_states PARAMS ((void));
|
||||
|
||||
extern unsigned int nstates;
|
||||
extern int final_state;
|
||||
extern state_number_t nstates;
|
||||
extern state_t *final_state;
|
||||
|
||||
#endif /* !LR0_H_ */
|
||||
|
||||
@@ -287,7 +287,7 @@ set_conflicts (state_t *state)
|
||||
void
|
||||
conflicts_solve (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
|
||||
conflicts = XCALLOC (char, nstates);
|
||||
shiftset = bitset_create (ntokens, BITSET_FIXED);
|
||||
@@ -409,7 +409,7 @@ void
|
||||
conflicts_output (FILE *out)
|
||||
{
|
||||
bool printed_sth = FALSE;
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (conflicts[i])
|
||||
{
|
||||
@@ -432,7 +432,7 @@ conflicts_output (FILE *out)
|
||||
int
|
||||
conflicts_total_count (void)
|
||||
{
|
||||
unsigned i;
|
||||
state_number_t i;
|
||||
int count;
|
||||
|
||||
/* Conflicts by state. */
|
||||
@@ -454,8 +454,6 @@ conflicts_total_count (void)
|
||||
void
|
||||
conflicts_print (void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* Is the number of SR conflicts OK? Either EXPECTED_CONFLICTS is
|
||||
not set, and then we want 0 SR, or else it is specified, in which
|
||||
case we want equality. */
|
||||
@@ -465,12 +463,16 @@ conflicts_print (void)
|
||||
int rrc_total = 0;
|
||||
|
||||
/* Conflicts by state. */
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (conflicts[i])
|
||||
{
|
||||
src_total += count_sr_conflicts (states[i]);
|
||||
rrc_total += count_rr_conflicts (states[i], TRUE);
|
||||
}
|
||||
{
|
||||
state_number_t i;
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (conflicts[i])
|
||||
{
|
||||
src_total += count_sr_conflicts (states[i]);
|
||||
rrc_total += count_rr_conflicts (states[i], TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
src_ok = src_total == (expected_conflicts == -1 ? 0 : expected_conflicts);
|
||||
|
||||
|
||||
30
src/lalr.c
30
src/lalr.c
@@ -48,8 +48,8 @@ size_t nLA;
|
||||
|
||||
static int ngotos;
|
||||
short *goto_map = NULL;
|
||||
short *from_state = NULL;
|
||||
short *to_state = NULL;
|
||||
state_number_t *from_state = NULL;
|
||||
state_number_t *to_state = NULL;
|
||||
|
||||
/* And for the famous F variable, which name is so descriptive that a
|
||||
comment is hardly needed. <grin>. */
|
||||
@@ -134,7 +134,7 @@ digraph (short **relation)
|
||||
static void
|
||||
initialize_LA (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
int j;
|
||||
rule_t **np;
|
||||
|
||||
@@ -157,8 +157,7 @@ initialize_LA (void)
|
||||
static void
|
||||
set_goto_map (void)
|
||||
{
|
||||
size_t state;
|
||||
int i;
|
||||
state_number_t state;
|
||||
short *temp_map;
|
||||
|
||||
goto_map = XCALLOC (short, nvars + 1) - ntokens;
|
||||
@@ -168,6 +167,7 @@ set_goto_map (void)
|
||||
for (state = 0; state < nstates; ++state)
|
||||
{
|
||||
shifts *sp = states[state]->shifts;
|
||||
int i;
|
||||
for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
|
||||
{
|
||||
if (ngotos == SHRT_MAX)
|
||||
@@ -180,6 +180,7 @@ set_goto_map (void)
|
||||
|
||||
{
|
||||
int k = 0;
|
||||
int i;
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
temp_map[i] = k;
|
||||
@@ -193,12 +194,13 @@ set_goto_map (void)
|
||||
temp_map[nsyms] = ngotos;
|
||||
}
|
||||
|
||||
from_state = XCALLOC (short, ngotos);
|
||||
to_state = XCALLOC (short, ngotos);
|
||||
from_state = XCALLOC (state_number_t, ngotos);
|
||||
to_state = XCALLOC (state_number_t, ngotos);
|
||||
|
||||
for (state = 0; state < nstates; ++state)
|
||||
{
|
||||
shifts *sp = states[state]->shifts;
|
||||
int i;
|
||||
for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
|
||||
{
|
||||
int k = temp_map[SHIFT_SYMBOL (sp, i)]++;
|
||||
@@ -217,12 +219,12 @@ set_goto_map (void)
|
||||
`----------------------------------------------------------*/
|
||||
|
||||
static int
|
||||
map_goto (int state, symbol_number_t symbol)
|
||||
map_goto (state_number_t state, symbol_number_t symbol)
|
||||
{
|
||||
int high;
|
||||
int low;
|
||||
int middle;
|
||||
int s;
|
||||
state_number_t s;
|
||||
|
||||
low = goto_map[symbol];
|
||||
high = goto_map[symbol + 1] - 1;
|
||||
@@ -258,7 +260,7 @@ initialize_F (void)
|
||||
|
||||
for (i = 0; i < ngotos; i++)
|
||||
{
|
||||
int stateno = to_state[i];
|
||||
state_number_t stateno = to_state[i];
|
||||
shifts *sp = states[stateno]->shifts;
|
||||
|
||||
int j;
|
||||
@@ -400,7 +402,7 @@ static void
|
||||
build_relations (void)
|
||||
{
|
||||
short *edge = XCALLOC (short, ngotos + 1);
|
||||
short *states1 = XCALLOC (short, ritem_longest_rhs () + 1);
|
||||
state_number_t *states1 = XCALLOC (state_number_t, ritem_longest_rhs () + 1);
|
||||
int i;
|
||||
|
||||
includes = XCALLOC (short *, ngotos);
|
||||
@@ -514,7 +516,7 @@ compute_lookaheads (void)
|
||||
static void
|
||||
states_lookaheads_count (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
nLA = 0;
|
||||
|
||||
/* Count */
|
||||
@@ -555,7 +557,7 @@ states_lookaheads_count (void)
|
||||
static void
|
||||
states_lookaheads_initialize (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
bitsetv pLA = LA;
|
||||
rule_t **pLArule = LArule;
|
||||
|
||||
@@ -578,7 +580,7 @@ states_lookaheads_initialize (void)
|
||||
static void
|
||||
lookaheads_print (FILE *out)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
int j, k;
|
||||
fprintf (out, "Lookaheads: BEGIN\n");
|
||||
for (i = 0; i < nstates; ++i)
|
||||
|
||||
@@ -50,8 +50,8 @@ void lalr PARAMS ((void));
|
||||
TO_STATE of the first of them. */
|
||||
|
||||
extern short *goto_map;
|
||||
extern short *from_state;
|
||||
extern short *to_state;
|
||||
extern state_number_t *from_state;
|
||||
extern state_number_t *to_state;
|
||||
|
||||
/* LARULE is a vector which records the rules that need lookahead in
|
||||
various states. The elements of LARULE that apply to state S are
|
||||
|
||||
82
src/output.c
82
src/output.c
@@ -225,6 +225,7 @@ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_short_table, short)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_symbol_number_table, symbol_number_t)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_item_number_table, item_number_t)
|
||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number_t)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------.
|
||||
@@ -350,13 +351,13 @@ prepare_rules (void)
|
||||
static void
|
||||
prepare_states (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
symbol_number_t *values =
|
||||
(symbol_number_t *) alloca (sizeof (symbol_number_t) * nstates);
|
||||
for (i = 0; i < nstates; ++i)
|
||||
values[i] = states[i]->accessing_symbol;
|
||||
muscle_insert_symbol_number_table ("stos", values,
|
||||
0, 1, nstates);
|
||||
0, 1, nstates);
|
||||
}
|
||||
|
||||
|
||||
@@ -463,7 +464,7 @@ action_row (state_t *state)
|
||||
for (i = 0; i < shiftp->nshifts; i++)
|
||||
{
|
||||
symbol_number_t symbol;
|
||||
int shift_state = shiftp->shifts[i];
|
||||
state_number_t shift_state = shiftp->shifts[i];
|
||||
if (!shift_state)
|
||||
continue;
|
||||
|
||||
@@ -474,7 +475,7 @@ action_row (state_t *state)
|
||||
|
||||
if (actrow[symbol] != 0)
|
||||
conflicted = conflrow[symbol] = 1;
|
||||
actrow[symbol] = shift_state;
|
||||
actrow[symbol] = state_number_as_int (shift_state);
|
||||
|
||||
/* Do not use any default reduction if there is a shift for
|
||||
error */
|
||||
@@ -550,9 +551,9 @@ action_row (state_t *state)
|
||||
|
||||
|
||||
static void
|
||||
save_row (int state)
|
||||
save_row (state_number_t state)
|
||||
{
|
||||
int i;
|
||||
symbol_number_t i;
|
||||
int count;
|
||||
short *sp = NULL;
|
||||
short *sp1 = NULL;
|
||||
@@ -599,7 +600,7 @@ save_row (int state)
|
||||
static void
|
||||
token_actions (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
int nconflict = conflicts_total_count ();
|
||||
|
||||
short *yydefact = XCALLOC (short, nstates);
|
||||
@@ -796,17 +797,17 @@ symbol_printers_output (FILE *out)
|
||||
|
||||
|
||||
static void
|
||||
save_column (int symbol, int default_state)
|
||||
save_column (symbol_number_t symbol, state_number_t default_state)
|
||||
{
|
||||
int i;
|
||||
short *sp;
|
||||
short *sp1;
|
||||
short *sp2;
|
||||
int count;
|
||||
int symno = symbol - ntokens + nstates;
|
||||
int symno = symbol - ntokens + state_number_as_int (nstates);
|
||||
|
||||
short begin = goto_map[symbol];
|
||||
short end = goto_map[symbol + 1];
|
||||
int begin = goto_map[symbol];
|
||||
int end = goto_map[symbol + 1];
|
||||
|
||||
count = 0;
|
||||
for (i = begin; i < end; i++)
|
||||
@@ -830,29 +831,31 @@ save_column (int symbol, int default_state)
|
||||
width[symno] = sp1[-1] - sp[0] + 1;
|
||||
}
|
||||
|
||||
static int
|
||||
default_goto (int symbol)
|
||||
|
||||
static state_number_t
|
||||
default_goto (symbol_number_t symbol)
|
||||
{
|
||||
size_t i;
|
||||
size_t m = goto_map[symbol];
|
||||
size_t n = goto_map[symbol + 1];
|
||||
int default_state = -1;
|
||||
state_number_t s;
|
||||
int i;
|
||||
int m = goto_map[symbol];
|
||||
int n = goto_map[symbol + 1];
|
||||
state_number_t default_state = (state_number_t) -1;
|
||||
int max = 0;
|
||||
|
||||
if (m == n)
|
||||
return -1;
|
||||
return (state_number_t) -1;
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
state_count[i] = 0;
|
||||
for (s = 0; s < nstates; s++)
|
||||
state_count[s] = 0;
|
||||
|
||||
for (i = m; i < n; i++)
|
||||
state_count[to_state[i]]++;
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
if (state_count[i] > max)
|
||||
for (s = 0; s < nstates; s++)
|
||||
if (state_count[s] > max)
|
||||
{
|
||||
max = state_count[i];
|
||||
default_state = i;
|
||||
max = state_count[s];
|
||||
default_state = s;
|
||||
}
|
||||
|
||||
return default_state;
|
||||
@@ -871,19 +874,19 @@ default_goto (int symbol)
|
||||
static void
|
||||
goto_actions (void)
|
||||
{
|
||||
int i;
|
||||
short *yydefgoto = XMALLOC (short, nsyms - ntokens);
|
||||
symbol_number_t i;
|
||||
state_number_t *yydefgoto = XMALLOC (state_number_t, nsyms - ntokens);
|
||||
|
||||
state_count = XCALLOC (short, nstates);
|
||||
for (i = ntokens; i < nsyms; ++i)
|
||||
{
|
||||
int default_state = default_goto (i);
|
||||
state_number_t default_state = default_goto (i);
|
||||
save_column (i, default_state);
|
||||
yydefgoto[i - ntokens] = default_state;
|
||||
}
|
||||
|
||||
muscle_insert_short_table ("defgoto", yydefgoto,
|
||||
yydefgoto[0], 1, nsyms - ntokens);
|
||||
muscle_insert_state_number_table ("defgoto", yydefgoto,
|
||||
yydefgoto[0], 1, nsyms - ntokens);
|
||||
XFREE (state_count);
|
||||
XFREE (yydefgoto);
|
||||
}
|
||||
@@ -978,7 +981,7 @@ pack_vector (int vector)
|
||||
|
||||
for (k = 0; ok && k < t; k++)
|
||||
{
|
||||
loc = j + from[k];
|
||||
loc = j + state_number_as_int (from[k]);
|
||||
if (loc > (int) table_size)
|
||||
table_grow (loc);
|
||||
|
||||
@@ -994,11 +997,11 @@ pack_vector (int vector)
|
||||
{
|
||||
for (k = 0; k < t; k++)
|
||||
{
|
||||
loc = j + from[k];
|
||||
table[loc] = to[k];
|
||||
loc = j + state_number_as_int (from[k]);
|
||||
table[loc] = state_number_as_int (to[k]);
|
||||
if (glr_parser && conflict_to != NULL)
|
||||
conflict_table[loc] = conflict_to[k];
|
||||
check[loc] = from[k];
|
||||
check[loc] = state_number_as_int (from[k]);
|
||||
}
|
||||
|
||||
while (table[lowzero] != 0)
|
||||
@@ -1129,8 +1132,15 @@ output_check (void)
|
||||
static void
|
||||
output_actions (void)
|
||||
{
|
||||
size_t i;
|
||||
nvectors = nstates + nvars;
|
||||
state_number_t i;
|
||||
|
||||
/* That's a poor way to make sure the sizes are properly corelated,
|
||||
in particular the signedness is not taking into account, but it's
|
||||
not useless. */
|
||||
assert (sizeof (nvectors) >= sizeof (nstates));
|
||||
assert (sizeof (nvectors) >= sizeof (nvars));
|
||||
|
||||
nvectors = state_number_as_int (nstates) + nvars;
|
||||
|
||||
froms = XCALLOC (short *, nvectors);
|
||||
tos = XCALLOC (short *, nvectors);
|
||||
@@ -1266,7 +1276,7 @@ prepare (void)
|
||||
MUSCLE_INSERT_INT ("pure", pure_parser);
|
||||
MUSCLE_INSERT_INT ("nsym", nsyms);
|
||||
MUSCLE_INSERT_INT ("debug", debug_flag);
|
||||
MUSCLE_INSERT_INT ("final", final_state);
|
||||
MUSCLE_INSERT_INT ("final", final_state->number);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||
MUSCLE_INSERT_INT ("error_verbose", error_verbose);
|
||||
|
||||
@@ -113,7 +113,7 @@ print_shifts (FILE *out, state_t *state)
|
||||
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
state_number_t state1 = shiftp->shifts[i];
|
||||
symbol_number_t symbol = states[state1]->accessing_symbol;
|
||||
fprintf (out,
|
||||
_(" %-4s\tshift, and go to state %d\n"),
|
||||
@@ -155,7 +155,7 @@ print_gotos (FILE *out, state_t *state)
|
||||
for (; i < shiftp->nshifts; i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
state_number_t state1 = shiftp->shifts[i];
|
||||
symbol_number_t symbol = states[state1]->accessing_symbol;
|
||||
fprintf (out, _(" %-4s\tgo to state %d\n"),
|
||||
symbol_tag_get (symbols[symbol]), state1);
|
||||
@@ -309,7 +309,7 @@ print_actions (FILE *out, state_t *state)
|
||||
|
||||
if (shiftp->nshifts == 0 && redp->nreds == 0)
|
||||
{
|
||||
if (final_state == state->number)
|
||||
if (state->number == final_state->number)
|
||||
fprintf (out, _(" $default\taccept\n"));
|
||||
else
|
||||
fprintf (out, _(" NO ACTIONS\n"));
|
||||
@@ -449,7 +449,7 @@ print_grammar (FILE *out)
|
||||
void
|
||||
print_results (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
|
||||
/* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
|
||||
that conflicts with Posix. */
|
||||
|
||||
@@ -135,7 +135,7 @@ print_actions (state_t *state, const char *node_name)
|
||||
for (i = 0; i < shiftp->nshifts; i++)
|
||||
if (!SHIFT_IS_DISABLED (shiftp, i))
|
||||
{
|
||||
int state1 = shiftp->shifts[i];
|
||||
state_number_t state1 = shiftp->shifts[i];
|
||||
symbol_number_t symbol = states[state1]->accessing_symbol;
|
||||
|
||||
new_edge (&edge);
|
||||
@@ -194,7 +194,7 @@ print_state (state_t *state)
|
||||
void
|
||||
print_graph (void)
|
||||
{
|
||||
size_t i;
|
||||
state_number_t i;
|
||||
|
||||
/* Output file. */
|
||||
fgraph = xfopen (spec_graph_file, "w");
|
||||
|
||||
15
src/state.h
15
src/state.h
@@ -90,6 +90,17 @@
|
||||
|
||||
# include "bitsetv.h"
|
||||
|
||||
|
||||
/*-------------------.
|
||||
| Numbering states. |
|
||||
`-------------------*/
|
||||
|
||||
typedef short state_number_t;
|
||||
# define STATE_NUMBER_MAX ((state_number_t) SHRT_MAX)
|
||||
|
||||
/* Be ready to map a state_number_t to an int. */
|
||||
# define state_number_as_int(Tok) ((int) (Tok))
|
||||
|
||||
/*---------.
|
||||
| Shifts. |
|
||||
`---------*/
|
||||
@@ -97,7 +108,7 @@
|
||||
typedef struct shifts
|
||||
{
|
||||
short nshifts;
|
||||
short shifts[1];
|
||||
state_number_t shifts[1];
|
||||
} shifts;
|
||||
|
||||
shifts *shifts_new PARAMS ((int n));
|
||||
@@ -171,7 +182,7 @@ typedef struct state_s
|
||||
struct state_s *next;
|
||||
struct state_s *link;
|
||||
|
||||
short number;
|
||||
state_number_t number;
|
||||
symbol_number_t accessing_symbol;
|
||||
shifts *shifts;
|
||||
reductions *reductions;
|
||||
|
||||
Reference in New Issue
Block a user