Strip double spaces

This commit is contained in:
Devine Lu Linvega 2024-04-07 13:09:58 -07:00
parent 936d57adc3
commit 47aa06a2f3
2 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,8 @@
<> (explode ?*) (?*)
<> (explode ?*) (str (?*))
<> (reverse (str (?h ?t))) (reverse/l ?t (?h))
<> (reverse (str (?h))) (?h)
<> (reverse/l (?h ?t) ?l) (reverse/l ?t (?h ?l))
<> (reverse/l (?h) ?l) (str (?h ?l))
<> (implode str ?*) (?*)
<> (?x pin) (done: ?x)
(explode hello) pin
(implode reverse (explode hello))

View File

@ -226,16 +226,16 @@ main(int argc, char **argv)
if(argc < 2)
return !printf("usage: modal [-v] source.modal\n");
if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v')
return !printf("Modal - Modal Interpreter, 4 Apr 2024.\n");
return !printf("Modal - Modal Interpreter, 7 Apr 2024.\n");
if(!(f = fopen(argv[1], "r")))
return !printf("Invalid Modal file: %s.\n", argv[1]);
while(fread(&c, 1, 1, f)) {
if(prog_ > bank_a) {
if(c == ')' && *(w - 1) == ' ') w--;
if(c == '(' && *(w - 1) == ' ') w--;
if(w > bank_a) {
/* if(c == ')' && *(w - 1) == ' ') w--; */
/* if(c == '(' && *(w - 1) == ' ') w--; */
/* if(c == ' ' && *(w - 1) == '(') continue; */
/* if(c == ' ' && *(w - 1) == ')') continue; */
if(c == ' ' && *(w - 1) == ' ') w--;
if(c == ' ' && *(w - 1) == '(') continue;
if(c == ' ' && *(w - 1) == ')') continue;
}
*w++ = c;
}