hammer/src/parsers/end.c

27 lines
572 B
C
Raw Normal View History

2012-05-26 16:00:43 +02:00
#include "parser_internal.h"
static HParseResult* parse_end(void *env, HParseState *state) {
if (state->input_stream.index == state->input_stream.length) {
HParseResult *ret = a_new(HParseResult, 1);
ret->ast = NULL;
return ret;
} else {
return NULL;
}
}
static const HParserVtable end_vt = {
.parse = parse_end,
};
2012-10-10 15:58:03 +02:00
const HParser* h_end_p() {
return h_end_p__m(&system_allocator);
}
const HParser* h_end_p__m(HAllocator* mm__) {
HParser *ret = h_new(HParser, 1);
ret->vtable = &end_vt;
ret->env = NULL;
2012-05-26 16:00:43 +02:00
return (const HParser*)ret;
}