diff --git a/examples/hello.modal b/examples/hello.modal index ce71e00..1ddb7ae 100644 --- a/examples/hello.modal +++ b/examples/hello.modal @@ -2,5 +2,4 @@ <> (?: print $) (?:) <> ($ ?x) (?x $) -$ (Welcome to NAME -Have fun!\n\n) print \ No newline at end of file +$ (Welcome to NAME \nHave fun!\n\n) print \ No newline at end of file diff --git a/examples/tictactoe.modal b/examples/tictactoe.modal index d76448b..6991bbe 100644 --- a/examples/tictactoe.modal +++ b/examples/tictactoe.modal @@ -40,5 +40,5 @@ -- (Interface) -(put-str (Input a move, like "X 0 1":\n)) +((Input a move, like "X 0 1":\n) put-str) ((- - -) (- - -) (- - -)) ready diff --git a/src/modal.c b/src/modal.c index 24e3235..8c73066 100644 --- a/src/modal.c +++ b/src/modal.c @@ -76,11 +76,13 @@ put_reg(char r) } else if(s) { char *ss = walk(s); if(r == ':') { + if(*(outp_ - 1) == ' ') outp_--; if(*s == '(') s++, --ss; while(s < ss) { char c = *s++; if(c == '\\') { switch(*s++) { + case 't': putc(0x09, stdout); break; case 'n': putc(0x0a, stdout); break; case 's': putc(0x20, stdout); break; } @@ -209,6 +211,7 @@ main(int argc, char **argv) if(!(f = fopen(argv[1], "r"))) return !printf("Invalid Modal file: %s.\n", argv[1]); while(fread(&c, 1, 1, f)) { + c = c <= 0x20 ? 0x20 : c; if(w > bank_a) { if(c == ' ' && *(w - 1) == '(') continue; if(c == ')' && *(w - 1) == ' ') w--;