diff --git a/makefile b/makefile index 4688cf0..85aa564 100644 --- a/makefile +++ b/makefile @@ -8,11 +8,11 @@ all: dest dest: @ mkdir -p bin run: all bin/modal - @ bin/modal examples/hello.modal + @ bin/modal examples/hello.modal 2> /dev/null test: bin/modal-debug bin/modal @ bin/modal -v @ bin/modal-debug examples/test.modal "(arg1) (arg2 (arg3))" - @ time bin/modal examples/test.modal 2> /dev/null + @ bin/modal examples/test.modal install: bin/modal cp bin/modal ~/bin/ uninstall: diff --git a/src/modal.c b/src/modal.c index 0e7887e..5323f43 100644 --- a/src/modal.c +++ b/src/modal.c @@ -164,7 +164,7 @@ create_rule(Rule *r, int id, char *s) static int rewrite(void) { - char c, last = 0, *s = dst ? bank_b : bank_a, *res; + char c, last = 0, *cap, *s = dst ? bank_b : bank_a, *res; while((c = *s) && c <= ' ') s++; while((c = *s)) { if(spacer(last)) { @@ -175,8 +175,8 @@ rewrite(void) return commit_rule(r, s, 1); } if(s[0] == '?' && s[1] == '(') { - r = λ - s = create_rule(&lambda, -1, s) + 1; + cap = walk(s+1); + r = &lambda, create_rule(&lambda, -1, s), s = cap; while((c = *s) && c <= ' ') s++; if((res = match_rule(&lambda, s)) != NULL) return write_rule(&lambda, last, res);