* src/state.h, src/state.c (shifts_to): New.

* src/lalr.c (build_relations): Use it.
This commit is contained in:
Akim Demaille
2002-06-30 17:31:37 +00:00
parent 9222837b27
commit 24c7d80020
4 changed files with 26 additions and 10 deletions

View File

@@ -49,6 +49,20 @@ shifts_new (int nshifts, state_number_t *shifts)
}
/*-----------------------------------------------------------------.
| Return the state such these SHIFTS contain a shift/goto to it on |
| SYMBOL. Aborts if none found. |
`-----------------------------------------------------------------*/
state_t *
shifts_to (shifts_t *shifts, symbol_number_t s)
{
int j;
for (j = 0; j < shifts->nshifts; j++)
if (SHIFT_SYMBOL (shifts, j) == s)
return states[shifts->shifts[j]];
abort ();
}
/*--------------------.