From 234103d8ec691fcd82462badce702e0dfdf52638 Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" <pesco@khjk.org> Date: Mon, 17 Feb 2020 14:05:23 +0100 Subject: [PATCH] remove empty follow set assertion there is a case where fs can be empty: when reducing by lhs would lead to certain parse failure, by means of h_nothing_p() for instance. fixes issue 83. --- src/backends/lalr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backends/lalr.c b/src/backends/lalr.c index 5ba3be58..86e358b7 100644 --- a/src/backends/lalr.c +++ b/src/backends/lalr.c @@ -338,7 +338,10 @@ int h_lalr_compile(HAllocator* mm__, HParser* parser, const void* params) const HStringMap *fs = h_follow(1, eg->grammar, lhs); assert(fs != NULL); assert(fs->epsilon_branch == NULL); - assert(!h_stringmap_empty(fs)); + // NB: there is a case where fs can be empty: when reducing by lhs + // would lead to certain parse failure, by means of h_nothing_p() + // for instance. in that case, the below code correctly adds no + // reduce action. // for each lookahead symbol, put action into table cell if(terminals_put(table->tmap[state], fs, action) < 0) -- GitLab