Fixed issue with walking beyond rule
This commit is contained in:
parent
b7bdc5d8cb
commit
70d567011e
|
@ -1,4 +1,3 @@
|
||||||
<> (?x dup) (?x ?x)
|
<> (copy ?x) (?x ?x)
|
||||||
<> (?x ?y swap) (?y ?x)
|
|
||||||
|
|
||||||
(A B swap) dup
|
(copy ABC)
|
|
@ -36,6 +36,7 @@ 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 == '?') regs[(int)*(++a)] = b, a++, b = walk(b), c = *b;
|
if(c == '?') regs[(int)*(++a)] = b, a++, b = walk(b), c = *b;
|
||||||
|
if(!a[0]) return b;
|
||||||
if(c != *b) return NULL;
|
if(c != *b) return NULL;
|
||||||
a++, b++;
|
a++, b++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue