Desugaring functions are all done! But we're not ready for the CF backends yet because desugared structures still need to be stashed in the parser.
This commit is contained in:
parent
ab89b0fd4d
commit
810c06c6db
2 changed files with 7 additions and 2 deletions
|
|
@ -112,10 +112,13 @@ typedef bool (*HPredicate)(HParseResult *p);
|
||||||
|
|
||||||
typedef struct HParserVtable_ HParserVtable;
|
typedef struct HParserVtable_ HParserVtable;
|
||||||
|
|
||||||
|
typedef struct HCFChoice_ HCFChoice; // forward declaration
|
||||||
|
|
||||||
typedef struct HParser_ {
|
typedef struct HParser_ {
|
||||||
const HParserVtable *vtable;
|
const HParserVtable *vtable;
|
||||||
void *env;
|
void *env;
|
||||||
void *data; /* e.g., parse tables */
|
void *data; /* e.g., parse tables */
|
||||||
|
HCFChoice *desugared; /* if the parser can be desugared, its desugared form */
|
||||||
} HParser;
|
} HParser;
|
||||||
|
|
||||||
// {{{ Stuff for benchmarking
|
// {{{ Stuff for benchmarking
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ static bool indirect_isValidCF(void *env) {
|
||||||
return inner->vtable->isValidCF(inner->env);
|
return inner->vtable->isValidCF(inner->env);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HCFChoice desugar_indirect(HAllocator *mm__, void *env) {
|
static HCFChoice* desugar_indirect(HAllocator *mm__, void *env) {
|
||||||
|
HParser *p = (HParser*)env;
|
||||||
|
HParser *inner = (HParser*)p->env;
|
||||||
|
return inner->desugared;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const HParserVtable indirect_vt = {
|
static const HParserVtable indirect_vt = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue