summaryrefslogtreecommitdiff
path: root/src/bsr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bsr.c')
-rw-r--r--src/bsr.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bsr.c b/src/bsr.c
index bd0a84c..c034072 100644
--- a/src/bsr.c
+++ b/src/bsr.c
@@ -474,6 +474,33 @@ bsr_find(CCR_MOD(bsr *) b, CCR_MOD(Grammar *) g,
return result;
}
+ht *
+bsr_lookup(CCR_MOD(bsr *) b, BOOL * const restrict errorp,
+ NUM X, NUM i, NUM j)
+{
+ *errorp = 0;
+ ht *result = NULL;
+
+ if (X < 0 || X >= b->f.len) {
+ fleprintf("Invalid X: %ld\n", X);
+ goto cleanup;
+ }
+
+ if (!((b->f.array+X)->initialized)) goto success;
+
+ pair2 p2 = (pair2) { .x = i, .y = j };
+
+ result = (ht *) ht_find((b->f.array+X)->table, &p2);
+
+ goto success;
+
+ cleanup:
+ *errorp = 1;
+
+ success:
+ return result;
+}
+
static void
print_sep()
{