From e69fd2e5b9f71b650bc26b61316842560668255d Mon Sep 17 00:00:00 2001 From: Rob Zinkov Date: Mon, 18 Mar 2013 15:27:16 -0700 Subject: [PATCH] Adding epislon and nothing --- src/parsers/epsilon.c | 5 +++++ src/parsers/nothing.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/parsers/epsilon.c b/src/parsers/epsilon.c index 5ae91e3..71dcfe7 100644 --- a/src/parsers/epsilon.c +++ b/src/parsers/epsilon.c @@ -8,10 +8,15 @@ static HParseResult* parse_epsilon(void* env, HParseState* state) { return res; } +static bool episilon_ctrvm(HRVMProg *prog, void* env) { + return true; +} + static const HParserVtable epsilon_vt = { .parse = parse_epsilon, .isValidRegular = h_true, .isValidCF = h_true, + .compile_to_rvm = episilon_ctrvm, }; static const HParser epsilon_p = { diff --git a/src/parsers/nothing.c b/src/parsers/nothing.c index 01c029e..19b8bbd 100644 --- a/src/parsers/nothing.c +++ b/src/parsers/nothing.c @@ -1,15 +1,20 @@ #include "parser_internal.h" - static HParseResult* parse_nothing() { // not a mistake, this parser always fails return NULL; } +static bool nothing_ctrvm(HRVMProg *prog, void* env) { + h_rvm_insert_insn(prog, RVM_MATCH, 0x00FF); + return true; +} + static const HParserVtable nothing_vt = { .parse = parse_nothing, .isValidRegular = h_true, .isValidCF = h_true, + .compile_to_rvm = nothing_ctrvm, }; const HParser* h_nothing_p() {