From 0e6e963425a8e22af385ea47889cfd0425f8f9eb Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 19 Apr 2024 14:08:18 -0700 Subject: [PATCH] Fixed issue with matching tokens of different length --- src/modal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modal.c b/src/modal.c index 5f3206b..b9f4c90 100644 --- a/src/modal.c +++ b/src/modal.c @@ -35,7 +35,7 @@ set_reg(int r, char *b) { if(regs[r]) { char *a = regs[r], *aa = walk(a), *bb = walk(b); - while(a < aa && b < bb) + while(a < aa || b < bb) if(*a++ != *b++) return 0; } else { regs[r] = b; @@ -222,7 +222,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, 18 Apr 2024.\n"); + case 'v': /* version */ return !printf("Modal Interpreter, 19 Apr 2024.\n"); case 'q': /* quiet */ fclose(stderr); break; case 'n': /* infinite */ cycles = 0xffffffff; break; }