Refactored all of the desugaring code to no longer depend on memory being initialized to 0. Everything is about 12% faster now.
This commit is contained in:
parent
d71215d494
commit
ec404ca8fe
36 changed files with 411 additions and 417 deletions
|
|
@ -20,20 +20,16 @@ static HParseResult* parse_action(void *env, HParseState *state) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static HCFChoice* desugar_action(HAllocator *mm__, void *env) {
|
||||
static void desugar_action(HAllocator *mm__, HCFStack *stk__, void *env) {
|
||||
HParseAction *a = (HParseAction*)env;
|
||||
HCFSequence *seq = h_new(HCFSequence, 1);
|
||||
seq->items = h_new(HCFChoice*, 2);
|
||||
seq->items[0] = h_desugar(mm__, a->p);
|
||||
seq->items[1] = NULL;
|
||||
HCFChoice *ret = h_new(HCFChoice, 1);
|
||||
ret->type = HCF_CHOICE;
|
||||
ret->seq = h_new(HCFSequence*, 2);
|
||||
ret->seq[0] = seq;
|
||||
ret->seq[1] = NULL;
|
||||
ret->action = a->action;
|
||||
ret->reshape = h_act_first;
|
||||
return ret;
|
||||
|
||||
HCFS_BEGIN_CHOICE() {
|
||||
HCFS_BEGIN_SEQ() {
|
||||
HCFS_DESUGAR(a->p);
|
||||
} HCFS_END_SEQ();
|
||||
HCFS_THIS_CHOICE->action = a->action;
|
||||
HCFS_THIS_CHOICE->reshape = h_act_first;
|
||||
} HCFS_END_CHOICE();
|
||||
}
|
||||
|
||||
static bool action_isValidRegular(void *env) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue