From 62d48d2f5af95822b2c5eb020c9146f2be8d5fd3 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" <pesco@khjk.org> Date: Sat, 11 May 2013 21:41:53 +0200 Subject: [PATCH] derp, forgot that table lookup can fail --- src/backends/llk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backends/llk.c b/src/backends/llk.c index f2e83108..8e44b1d9 100644 --- a/src/backends/llk.c +++ b/src/backends/llk.c @@ -167,6 +167,8 @@ int h_llk_compile(HAllocator* mm__, HParser* parser, const void* params) HParseResult *h_llk_parse(HAllocator* mm__, const HParser* parser, HInputStream* stream) { const HLLkTable *table = parser->data; + assert(table != NULL); + HArena *arena = h_new_arena(mm__, 0); // will hold the results HArena *tarena = h_new_arena(mm__, 0); // tmp, deleted after parse HSlist *stack = h_slist_new(tarena); @@ -217,6 +219,8 @@ HParseResult *h_llk_parse(HAllocator* mm__, const HParser* parser, HInputStream* // look up applicable production in parse table const HCFSequence *p = h_llk_lookup(table, x, lookahead); + if(p == NULL) + goto no_parse; // push production's rhs onto the stack (in reverse order) HCFChoice **s; -- GitLab