diff --git a/examples/test.modal b/examples/test.modal index 22c8abc..b6a2297 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -5,5 +5,7 @@ <> (reverse/l (?h) ?l) (str (?h ?l)) <> (implode str ?*) (?*) <> ((read)) (?:) +<> (empty-register) (?x) +<> (explode ?*) (str (?*)) -(implode reverse (explode hello)) (read) \ No newline at end of file +(implode reverse (explode hello)) (read) (explode hello) empty-register \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index e935f2e..900d4c4 100644 --- a/src/modal.c +++ b/src/modal.c @@ -105,7 +105,6 @@ commit(char r) { int depth = 0; char c, *s = regs[(int)r]; - if(!s) return !fprintf(stderr, "?%c Empty\n", r); if(r == '*') s = plode(s); else if(s[0] == '(') { @@ -184,7 +183,7 @@ rewrite(void) if(res != NULL) { char cc, *b = r->b; while((cc = *b++)) { - if(cc == '?') + if(cc == '?' && regs[(int)b[0]]) commit(*b++); else *outp_++ = cc;