Fixed issue in explode

This commit is contained in:
Devine Lu Linvega 2024-04-10 09:04:01 -07:00
parent 9a61ef90f3
commit 417ac2f2ad
1 changed files with 4 additions and 4 deletions

View File

@ -43,11 +43,11 @@ plode(char *s)
if(!depth) return s; if(!depth) return s;
} }
} else { /* explode */ } else { /* explode */
*outp_++ = *s++, *outp_++ = ' '; *outp_++ = *s++;
if(!spacer(*s)) *outp_++ = ' ';
while((c = *s++) && !spacer(c)) { while((c = *s++) && !spacer(c)) {
*outp_++ = '(', *outp_++ = c, depth++, c = *s; *outp_++ = '(', *outp_++ = c, depth++, c = *s;
if(!spacer(c)) if(!spacer(c)) *outp_++ = ' ';
*outp_++ = ' ';
} }
for(i = 0; i < depth; i++) for(i = 0; i < depth; i++)
*outp_++ = ')'; *outp_++ = ')';
@ -193,7 +193,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, 8 Apr 2024.\n"); return !printf("Modal Interpreter, 10 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)) {