Isolated rule finding
This commit is contained in:
parent
8cb22a9966
commit
f28444f60e
|
@ -203,7 +203,7 @@ compile_rule(Rule *r, int id, char *src)
|
|||
static int
|
||||
rewrite(void)
|
||||
{
|
||||
char c, last = 0, *cap, *s = src_, *regs[0x08], *res;
|
||||
char c, last = 0, *cap, *s = src_, *regs[0x08], *res = NULL;
|
||||
while(*s == ' ') s++;
|
||||
while((c = *s)) {
|
||||
if(spacer(last)) {
|
||||
|
@ -220,12 +220,14 @@ rewrite(void)
|
|||
Rule lambda;
|
||||
cap = walk(s + 1), compile_rule(&lambda, -1, s + 2), s = cap;
|
||||
while(*s == ' ') s++;
|
||||
if((res = match_rule(&lambda, regs, s)) != NULL)
|
||||
if((res = match_rule(&lambda, regs, s)))
|
||||
return apply_rule(&lambda, regs, res);
|
||||
}
|
||||
/* phase: match */
|
||||
for(r = rules; r < rules_; r++)
|
||||
if((res = match_rule(r, regs, s)) != NULL)
|
||||
if((res = match_rule(r, regs, s))) break;
|
||||
/* phase: apply */
|
||||
if(res)
|
||||
return apply_rule(r, regs, res);
|
||||
}
|
||||
*dst_++ = last = c;
|
||||
|
|
Loading…
Reference in New Issue