From a11178388716e1166dcf818818f285554a3e04e2 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 23 Apr 2024 09:35:58 -0700 Subject: [PATCH] Fixed bug with counting parens --- src/modal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modal.c b/src/modal.c index de55a6c..bdc5464 100644 --- a/src/modal.c +++ b/src/modal.c @@ -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;