summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorAkim Demaille <akim@epita.fr>2002-06-30 17:31:37 +0000
committerAkim Demaille <akim@epita.fr>2002-06-30 17:31:37 +0000
commit24c7d80020623c5bfda79b5d55c18b4111389656 (patch)
tree54ded329326a910ba3fbb70f52c58c4dc609e7a4 /src/state.c
parent9222837b2743308e4971fc0ad299ca2f73fb20ae (diff)
downloadbison-24c7d80020623c5bfda79b5d55c18b4111389656.tar.gz
* src/state.h, src/state.c (shifts_to): New.
* src/lalr.c (build_relations): Use it.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index dd8ec750..f365039d 100644
--- a/src/state.c
+++ b/src/state.c
@@ -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 ();
+}
/*--------------------.