]> git.saurik.com Git - bison.git/blobdiff - src/state.c
* src/state.h, src/state.c (shifts_to): New.
[bison.git] / src / state.c
index dd8ec7500c5387e82313f81c8aad0e028c17cc88..f365039d76da65a424331d27c28d7fe2827c8fca 100644 (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 ();
+}
 
 
                        /*--------------------.