Fixed bug with counting parens

This commit is contained in:
Devine Lu Linvega 2024-04-23 09:35:58 -07:00
parent 1ed120f569
commit a111783887
1 changed files with 3 additions and 3 deletions

View File

@ -212,7 +212,7 @@ main(int argc, char **argv)
return !printf("usage: modal [-vqn] source.modal\n");
for(i = 1; i < argc && *argv[i] == '-'; i++) {
switch(argv[i][1]) {
case 'v': /* version */ return !printf("Modal Interpreter, 22 Apr 2024.\n");
case 'v': /* version */ return !printf("Modal Interpreter, 23 Apr 2024.\n");
case 'q': /* quiet */ quiet = 1; break;
case 'n': /* infinite */ cycles = 0xffffffff; break;
}
@ -225,9 +225,9 @@ main(int argc, char **argv)
if(c == ' ' && *(w - 1) == '(') continue;
if(c == ')' && *(w - 1) == ' ') w--;
if(c == ' ' && *(w - 1) == ' ') w--;
if(c == '(') pl++;
if(c == ')') pr++;
}
if(c == '(') pl++;
if(c == ')') pr++;
*w++ = c;
}
while(*(--w) <= ' ') *w = 0;