Merge remote-tracking branch 'tq/master' into LL such that it compiles
Conflicts: src/Makefile src/backends/packrat.c src/compile.c src/hammer.h src/internal.h src/parsers/action.c src/parsers/and.c src/parsers/attr_bool.c src/parsers/bits.c src/parsers/butnot.c src/parsers/ch.c src/parsers/charset.c src/parsers/choice.c src/parsers/difference.c src/parsers/end.c src/parsers/epsilon.c src/parsers/ignore.c src/parsers/ignoreseq.c src/parsers/indirect.c src/parsers/int_range.c src/parsers/many.c src/parsers/not.c src/parsers/nothing.c src/parsers/optional.c src/parsers/sequence.c src/parsers/token.c src/parsers/unimplemented.c src/parsers/whitespace.c src/parsers/xor.c
This commit is contained in:
commit
c64a4e435e
46 changed files with 1289 additions and 263 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include <assert.h>
|
||||
#include "parser_internal.h"
|
||||
|
||||
static HParseResult* parse_ignore(void* env, HParseState* state) {
|
||||
|
|
@ -25,16 +26,30 @@ static HCFChoice* desugar_ignore(HAllocator *mm__, void *env) {
|
|||
return (h_desugar(mm__, p));
|
||||
}
|
||||
|
||||
static bool h_svm_action_pop(HArena *arena, HSVMContext *ctx, void* arg) {
|
||||
assert(ctx->stack_count > 0);
|
||||
ctx->stack_count--;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ignore_ctrvm(HRVMProg *prog, void *env) {
|
||||
HParser *p = (HParser*)env;
|
||||
h_compile_regex(prog, p->env);
|
||||
h_rvm_insert_insn(prog, RVM_ACTION, h_rvm_create_action(prog, h_svm_action_pop, NULL));
|
||||
return true;
|
||||
}
|
||||
|
||||
static const HParserVtable ignore_vt = {
|
||||
.parse = parse_ignore,
|
||||
.isValidRegular = ignore_isValidRegular,
|
||||
.isValidCF = ignore_isValidCF,
|
||||
.desugar = desugar_ignore,
|
||||
.compile_to_rvm = ignore_ctrvm,
|
||||
};
|
||||
|
||||
const HParser* h_ignore(const HParser* p) {
|
||||
HParser* h_ignore(const HParser* p) {
|
||||
return h_ignore__m(&system_allocator, p);
|
||||
}
|
||||
const HParser* h_ignore__m(HAllocator* mm__, const HParser* p) {
|
||||
HParser* h_ignore__m(HAllocator* mm__, const HParser* p) {
|
||||
return h_new_parser(mm__, &ignore_vt, (void *)p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue