Fixed issue with invalid lambda

This commit is contained in:
Devine Lu Linvega 2024-04-25 22:39:37 -07:00
parent 2f9f9d7f15
commit 927479bc44
2 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@ all: dest
dest:
@ mkdir -p bin
run: all bin/modal
@ bin/modal examples/hello.modal
@ bin/modal -q examples/hello.modal
debug: all bin/modal-debug
@ bin/modal-debug examples/hello.modal
test: all bin/modal-debug bin/modal

View File

@ -216,7 +216,8 @@ rewrite(void)
if(c == '?' && s[1] == '(') {
cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap;
while(*s == ' ') s++;
return apply_rule(&lambda, s);
if(!apply_rule(&lambda, s)) write_rule(r, s, 0);
return 1;
}
/* phase: match */
for(r = rules; r < rules_; r++)