2012-05-26 16:00:43 +02:00
|
|
|
#include "parser_internal.h"
|
|
|
|
|
|
|
|
|
|
static HParseResult* parse_nothing() {
|
|
|
|
|
// not a mistake, this parser always fails
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-25 03:35:42 +02:00
|
|
|
static void desugar_nothing(HAllocator *mm__, HCFStack *stk__, void *env) {
|
|
|
|
|
HCFS_BEGIN_CHOICE() {
|
|
|
|
|
} HCFS_END_CHOICE();
|
2013-02-03 02:18:19 -05:00
|
|
|
}
|
|
|
|
|
|
2013-03-18 15:27:16 -07:00
|
|
|
static bool nothing_ctrvm(HRVMProg *prog, void* env) {
|
2013-04-26 20:36:54 -07:00
|
|
|
h_rvm_insert_insn(prog, RVM_MATCH, 0x0000);
|
|
|
|
|
h_rvm_insert_insn(prog, RVM_MATCH, 0xFFFF);
|
2013-03-18 15:27:16 -07:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-26 16:00:43 +02:00
|
|
|
static const HParserVtable nothing_vt = {
|
|
|
|
|
.parse = parse_nothing,
|
2012-12-18 18:10:40 -05:00
|
|
|
.isValidRegular = h_true,
|
|
|
|
|
.isValidCF = h_true,
|
2013-02-03 02:18:19 -05:00
|
|
|
.desugar = desugar_nothing,
|
2013-03-18 15:27:16 -07:00
|
|
|
.compile_to_rvm = nothing_ctrvm,
|
2012-05-26 16:00:43 +02:00
|
|
|
};
|
|
|
|
|
|
2013-04-26 20:36:54 -07:00
|
|
|
HParser* h_nothing_p() {
|
2012-10-10 15:58:03 +02:00
|
|
|
return h_nothing_p__m(&system_allocator);
|
|
|
|
|
}
|
2013-04-26 20:36:54 -07:00
|
|
|
HParser* h_nothing_p__m(HAllocator* mm__) {
|
2013-04-27 04:17:47 +02:00
|
|
|
return h_new_parser(mm__, ¬hing_vt, NULL);
|
2012-05-26 16:00:43 +02:00
|
|
|
}
|