add an assertion that catches the infinite loop

This commit is contained in:
Sven M. Hallberg 2013-05-24 14:08:13 +02:00
parent bd9f9293c1
commit e4984fe60c

View file

@ -343,6 +343,9 @@ HParseResult *h_llk_parse(HAllocator* mm__, const HParser* parser, HInputStream*
if(p == NULL) if(p == NULL)
goto no_parse; goto no_parse;
// an infinite loop case that shouldn't happen
assert(!p->items[0] || p->items[0] != x);
// push production's rhs onto the stack (in reverse order) // push production's rhs onto the stack (in reverse order)
HCFChoice **s; HCFChoice **s;
for(s = p->items; *s; s++); for(s = p->items; *s; s++);