calculate result bit_length of h_bind and h_left and friends properly

This commit is contained in:
Sven M. Hallberg 2015-08-31 17:28:01 +02:00
parent e01d10f0ab
commit 57b3495d5e
3 changed files with 28 additions and 3 deletions

View file

@ -49,10 +49,12 @@ static HParseResult *parse_bind(void *be_, HParseState *state) {
return NULL;
}
res = h_do_parse(kx, state);
HParseResult *res2 = h_do_parse(kx, state);
if(res2)
res2->bit_length = 0; // recalculate
h_delete_arena(arena);
return res;
return res2;
}
static const HParserVtable bind_vt = {

View file

@ -24,8 +24,10 @@ static HParseResult* parse_ignoreseq(void* env, HParseState *state) {
HParseResult *tmp = h_do_parse(seq->parsers[i], state);
if (!tmp)
return NULL;
else if (i == seq->which)
else if (i == seq->which) {
res = tmp;
res->bit_length = 0; // recalculate
}
}
return res;