From a512cb2888e21d38bee549b4edb120a5b29d483a Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Apr 2024 10:03:15 -0700 Subject: [PATCH] Simplified match --- src/modal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modal.c b/src/modal.c index 6566ccc..0f543c4 100644 --- a/src/modal.c +++ b/src/modal.c @@ -135,7 +135,7 @@ parse_rule(char *s) static int rewrite(void) { - char c, *p = direction ? bank_b : bank_a, *o = p; + char c, last = 0, *p = direction ? bank_b : bank_a, *o = p; while((c = *p) && c <= ' ') p++; while((c = *p)) { int i; @@ -154,7 +154,7 @@ rewrite(void) char *res = match(p, r); if(res != NULL) { char cc, *b = r->b; - if(!*b && outp_ != bank_a && outp_ != bank_b) outp_--; + if(!*b && last == ' ') outp_--; while((cc = *b++)) { if(cc == '?') commit(*b++); @@ -165,7 +165,7 @@ rewrite(void) } } } - *outp_++ = c; + *outp_++ = last = c; p++; } *outp_++ = 0;