From 60325b23a350052b574808d93ed9c84d06742069 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 15 Apr 2024 15:58:38 -0700 Subject: [PATCH] Fixed issue with unwrapping rues --- makefile | 2 +- src/modal.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index d3a098f..eaf3ae3 100644 --- a/makefile +++ b/makefile @@ -11,7 +11,7 @@ run: all bin/modal @ bin/modal examples/hello.modal 2> /dev/null test: bin/modal-debug bin/modal @ bin/modal -v - @ bin/modal-debug examples/tests.modal 2> /dev/null + @ bin/modal-debug examples/tests.modal install: bin/modal cp bin/modal ~/bin/ uninstall: diff --git a/src/modal.c b/src/modal.c index 8b72423..11965aa 100644 --- a/src/modal.c +++ b/src/modal.c @@ -140,9 +140,13 @@ parse_frag(char *s) while((c = *s) && c <= ' ') s++; if(*s != ')' && *s != '<' && s[1] != '>') { ss = walk(s); - if(*s == '(') s++, ss--; - while(s < ss) *dict_++ = *s++; - s++; + if(*s == '('){ + s++; + while(s < ss-1) *dict_++ = *s++; + s++; + } + else + while(s < ss) *dict_++ = *s++; } *dict_++ = 0; return s;