Catching wildcards

This commit is contained in:
Devine Lu Linvega 2024-04-04 10:42:43 -07:00
parent f65e5634ff
commit 1a0dcb2a5e
2 changed files with 5 additions and 2 deletions

View File

@ -14,6 +14,9 @@ match(char *p, Rule *r)
{ {
char c, *a = r->a, *b = p; char c, *a = r->a, *b = p;
while((c = *a)) { while((c = *a)) {
if(c == '?') {
printf("WILDCARD: %s | %s\n", p, r->a);
}
if(c != *b) return 0; if(c != *b) return 0;
a++, b++; a++, b++;
} }

View File

@ -1,5 +1,5 @@
<> (dup ?x) (?x ?x done) <> (dup ?x) (?x ?x done)
<> hello bye <> (hello ?x) (bye ?x)
<> (a (b (c))) (end) <> (a (b (c))) (end)
hello world (hello world)