Simplified match
This commit is contained in:
parent
fcc4076d62
commit
a512cb2888
|
@ -135,7 +135,7 @@ parse_rule(char *s)
|
||||||
static int
|
static int
|
||||||
rewrite(void)
|
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) && c <= ' ') p++;
|
||||||
while((c = *p)) {
|
while((c = *p)) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -154,7 +154,7 @@ rewrite(void)
|
||||||
char *res = match(p, r);
|
char *res = match(p, r);
|
||||||
if(res != NULL) {
|
if(res != NULL) {
|
||||||
char cc, *b = r->b;
|
char cc, *b = r->b;
|
||||||
if(!*b && outp_ != bank_a && outp_ != bank_b) outp_--;
|
if(!*b && last == ' ') outp_--;
|
||||||
while((cc = *b++)) {
|
while((cc = *b++)) {
|
||||||
if(cc == '?')
|
if(cc == '?')
|
||||||
commit(*b++);
|
commit(*b++);
|
||||||
|
@ -165,7 +165,7 @@ rewrite(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*outp_++ = c;
|
*outp_++ = last = c;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
*outp_++ = 0;
|
*outp_++ = 0;
|
||||||
|
|
Loading…
Reference in New Issue