style: comment changes and refactoring in state.c

* src/state.h, src/state.c: Comment changes.
(transitions_to): Take a state* as argument.
* src/lalr.h, src/lalr.c: Comment changes.
(initialize_F): Use clear variable names.
This commit is contained in:
Akim Demaille
2019-01-31 06:31:14 +01:00
parent eed9550993
commit 40b5f89ee0
4 changed files with 21 additions and 27 deletions

View File

@@ -51,20 +51,14 @@ transitions_new (int num, state **dst)
}
/*-------------------------------------------------------.
| Return the state such that SHIFTS contain a shift/goto |
| to it on SYM. Abort if none found. |
`-------------------------------------------------------*/
state *
transitions_to (transitions *shifts, symbol_number sym)
transitions_to (state *s, symbol_number sym)
{
for (int j = 0; ; j++)
{
aver (j < shifts->num);
if (TRANSITION_SYMBOL (shifts, j) == sym)
return shifts->states[j];
}
transitions *trans = s->transitions;
for (int i = 0; i < trans->num; ++i)
if (TRANSITION_SYMBOL (trans, i) == sym)
return trans->states[i];
abort ();
}