Added overrun protection

This commit is contained in:
Dan Hirsch 2012-05-10 14:32:11 +01:00
parent d6c0eaf3de
commit dc0a7572f7
3 changed files with 29 additions and 2 deletions

View file

@ -72,6 +72,8 @@ parse_result_t* do_parse(const parser_t* parser, parse_state_t *state) {
// It doesn't exist... run the
parse_result_t *res;
res = parser->fn(parser->env, state);
if (state->input.overrun)
res = NULL; // overrun is always failure.
// update the cache
g_hash_table_replace(state->cache, &key, res);
#ifdef CONSISTENCY_CHECK