diff --git a/makefile b/makefile index cf49fed..24e2457 100644 --- a/makefile +++ b/makefile @@ -13,6 +13,8 @@ debug: all bin/modal-debug @ bin/modal-debug examples/hello.modal test: all bin/modal-debug bin/modal @ bin/modal -v + @ bin/modal-debug -q examples/fizzbuzz.modal + @ bin/modal-debug -q examples/sierpinski.modal @ bin/modal-debug -q examples/tests.modal install: bin/modal cp bin/modal ~/bin/ diff --git a/src/modal.c b/src/modal.c index 8296df0..de10d82 100644 --- a/src/modal.c +++ b/src/modal.c @@ -129,9 +129,9 @@ apply_rule(Rule *r, char *s) if(!(c = *s) || spacer(c)) { char *b = r->b, *origin = dst_; while((c = *b++)) { - if(c == '?' && (unsigned int)(*b - '0') < 9) { + if(c == '?') { unsigned int id = *b - '0'; - if((reg = regs[id])) { + if(id < 9 && (reg = regs[id])) { b++; if(!write_reg(r->key[id], reg) && dst_ != origin) dst_--; } else