Only test for registers following a spacer

This commit is contained in:
Devine Lu Linvega 2024-04-12 09:45:53 -07:00
parent 86bc540ee2
commit dfbb9c4fac
1 changed files with 3 additions and 3 deletions

View File

@ -98,17 +98,17 @@ static char *
match_rule(Rule *r, char *p) match_rule(Rule *r, char *p)
{ {
int i; int i;
char c, *a = r->a, *b = p; char c, last = 0, *a = r->a, *b = p;
for(i = 0x21; i < 0x7f; i++) for(i = 0x21; i < 0x7f; i++)
regs[i] = 0; regs[i] = 0;
while((c = *a)) { while((c = *a)) {
if(c == '?') { if(spacer(last) && c == '?') {
if(!set_reg(*(++a), b)) return NULL; if(!set_reg(*(++a), b)) return NULL;
a++, b = walk(b); a++, b = walk(b);
continue; continue;
} }
if(*a != *b) return NULL; if(*a != *b) return NULL;
a++, b++; a++, b++, last = c;
} }
c = *b; c = *b;
return spacer(c) ? b : NULL; return spacer(c) ? b : NULL;