Refactor ALL the things!
This commit is contained in:
parent
6a2f10df0c
commit
f2def8fa05
28 changed files with 930 additions and 855 deletions
20
src/parsers/indirect.c
Normal file
20
src/parsers/indirect.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "parser_internal.h"
|
||||
|
||||
static HParseResult* parse_indirect(void* env, HParseState* state) {
|
||||
return h_do_parse(env, state);
|
||||
}
|
||||
static const HParserVtable indirect_vt = {
|
||||
.parse = parse_indirect,
|
||||
};
|
||||
|
||||
void h_bind_indirect(HParser* indirect, HParser* inner) {
|
||||
assert_message(indirect->vtable == &indirect_vt, "You can only bind an indirect parser");
|
||||
indirect->env = inner;
|
||||
}
|
||||
|
||||
HParser* h_indirect() {
|
||||
HParser *res = g_new(HParser, 1);
|
||||
res->vtable = &indirect_vt;
|
||||
res->env = NULL;
|
||||
return res;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue