Adding epislon and nothing

This commit is contained in:
Rob Zinkov 2013-03-18 15:27:16 -07:00
parent 875c9b9c57
commit e69fd2e5b9
2 changed files with 11 additions and 1 deletions

View file

@ -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 = {

View file

@ -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() {