From 84531bcfc329c4119162bb5d0e1f7a448c3e8714 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 6 Apr 2024 21:12:30 -0700 Subject: [PATCH] Fixed matching error --- examples/test.modal | 7 ++++--- src/modal.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/test.modal b/examples/test.modal index cde9d99..2b3e220 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,4 +1,5 @@ -<> (?x (?y ?z) extract) (?y ?z extract) -<> (?x ?y extract) (?y extract) +<> (?x dup) (?x ?x) +<> (?x ?y swap) (?y ?x) +<> ( ?x pop) () -(cow (owl (bat (cat (dog)))) extract) +(1 2 3) (4 5 6) swap pop dup diff --git a/src/modal.c b/src/modal.c index 73b8396..0499d19 100644 --- a/src/modal.c +++ b/src/modal.c @@ -67,10 +67,10 @@ match(char *p, Rule *r) call(b); else regs[id] = b; - a++, b = walk(b), c = *b; + a++, b = walk(b); } if(!*a && spacer(*b)) return b; - if(c != *b) return NULL; + if(*a != *b) return NULL; a++, b++; } return spacer(*b) ? b : NULL;