Added escape character for space
This commit is contained in:
parent
12a767dc0e
commit
e04d4fa23f
|
@ -79,7 +79,12 @@ put_reg(char r)
|
||||||
if(*s == '(') s++, --ss;
|
if(*s == '(') s++, --ss;
|
||||||
while(s < ss) {
|
while(s < ss) {
|
||||||
char c = *s++;
|
char c = *s++;
|
||||||
if(c == '\\' && *s++ == 'n') c = 0xa;
|
if(c == '\\') {
|
||||||
|
switch(*s++) {
|
||||||
|
case 'n': putc(0x0a, stdout); break;
|
||||||
|
case 's': putc(0x20, stdout); break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
putc(c, stdout);
|
putc(c, stdout);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -200,7 +205,7 @@ main(int argc, char **argv)
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
return !printf("usage: modal [-v] source.modal\n");
|
return !printf("usage: modal [-v] source.modal\n");
|
||||||
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v')
|
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v')
|
||||||
return !printf("Modal Interpreter, 11 Apr 2024.\n");
|
return !printf("Modal Interpreter, 12 Apr 2024.\n");
|
||||||
if(!(f = fopen(argv[1], "r")))
|
if(!(f = fopen(argv[1], "r")))
|
||||||
return !printf("Invalid Modal file: %s.\n", argv[1]);
|
return !printf("Invalid Modal file: %s.\n", argv[1]);
|
||||||
while(fread(&c, 1, 1, f)) {
|
while(fread(&c, 1, 1, f)) {
|
||||||
|
|
Loading…
Reference in New Issue