mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 04:43:03 +00:00
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:
18
src/state.c
18
src/state.c
@@ -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 ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user