style: comment changes

* src/lr0.c, src/state.c, src/state.h: here.
This commit is contained in:
Akim Demaille
2019-01-25 19:27:48 +01:00
parent 7fec997ecf
commit 3075d96d44
3 changed files with 16 additions and 13 deletions

View File

@@ -80,7 +80,10 @@ state_list_append (symbol_number sym, size_t core_size, item_number *core)
bitset shift_symbol; bitset shift_symbol;
static rule **redset; static rule **redset;
/* For the current state, the states that can be reached via a "shift". */ /* For the current state, the list of pointers to states that can be
reached via a shift/goto. Could be indexed by the reaching symbol,
but labels of incoming transitions can be recovered by the state
itself. */
static state **shiftset; static state **shiftset;
static item_number **kernel_base; static item_number **kernel_base;

View File

@@ -41,12 +41,12 @@
`-----------------------------------------*/ `-----------------------------------------*/
static transitions * static transitions *
transitions_new (int num, state **the_states) transitions_new (int num, state **dst)
{ {
size_t states_size = num * sizeof *the_states; size_t states_size = num * sizeof *dst;
transitions *res = xmalloc (offsetof (transitions, states) + states_size); transitions *res = xmalloc (offsetof (transitions, states) + states_size);
res->num = num; res->num = num;
memcpy (res->states, the_states, states_size); memcpy (res->states, dst, states_size);
return res; return res;
} }
@@ -198,10 +198,10 @@ state_free (state *s)
`---------------------------*/ `---------------------------*/
void void
state_transitions_set (state *s, int num, state **trans) state_transitions_set (state *s, int num, state **dst)
{ {
aver (!s->transitions); aver (!s->transitions);
s->transitions = transitions_new (num, trans); s->transitions = transitions_new (num, dst);
} }

View File

@@ -51,11 +51,11 @@
lookahead token alone). When the states are generated, these lookahead token alone). When the states are generated, these
actions are represented in two other lists. actions are represented in two other lists.
Each transition structure describes the possible transitions out Each transition structure describes the possible transitions out of
of one state, the state whose number is in the number field. Each one state (there are NUM of them). Each contains a vector of
contains a vector of numbers of the states that transitions can go numbers of the states that transitions can go to. The
to. The accessing_symbol fields of those states' cores say what accessing_symbol fields of those states' cores say what kind of
kind of input leads to them. input leads to them.
A transition to state zero should be ignored: conflict resolution A transition to state zero should be ignored: conflict resolution
deletes transitions by having them point to zero. deletes transitions by having them point to zero.
@@ -233,8 +233,8 @@ state *state_new (symbol_number accessing_symbol,
size_t core_size, item_number *core); size_t core_size, item_number *core);
state *state_new_isocore (state const *s); state *state_new_isocore (state const *s);
/* Set the transitions of STATE. */ /* Record that from S we can reach all the DST states (NUM of them). */
void state_transitions_set (state *s, int num, state **trans); void state_transitions_set (state *s, int num, state **dst);
/* Set the reductions of STATE. */ /* Set the reductions of STATE. */
void state_reductions_set (state *s, int num, rule **reds); void state_reductions_set (state *s, int num, rule **reds);