diff --git a/examples/test.modal b/examples/test.modal index 7bf0ba0..312e9f4 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,4 +1,4 @@ -<> (dup ?x) (?x ?x) +<> (swap ?x ?y) (?y ?x) -(dup (123)) +(swap 123 456) diff --git a/src/modal.c b/src/modal.c index 0619992..9f6600a 100644 --- a/src/modal.c +++ b/src/modal.c @@ -24,7 +24,8 @@ walk(char *s) --depth; if(!depth) break; } - if(depth < 0) break; + if(depth == 0 && c == ' ') return s - 1; + if(depth < 1 && c == ' ') { return s - 1; } } return s; } @@ -55,6 +56,7 @@ writereg(char r) if(!depth) break; } if(depth < 0) break; + if(depth == 0 && c == ' ') break; *outp_++ = c; } return 1;