Inlined addrule

This commit is contained in:
Devine Lu Linvega 2024-04-06 18:09:18 -07:00
parent 8a94adc1c3
commit e6e2188797
2 changed files with 6 additions and 12 deletions

View File

@ -1,3 +1,4 @@
<> ((eval ?x)) (?x)
(eval (<> (join (?x) (?y)) (?x ?y))) (join (foo) (bar))
(eval (<> (join (?x) (?y)) (?x ?y)))
(join (foo) (bar))

View File

@ -137,16 +137,6 @@ parse_rulefrag(char *line)
return res;
}
static char *
addrule(char *s)
{
Rule *r = &rules[rules_len++];
s += 3;
r->a = parse_rulefrag(s), s = walk(s) + 1;
r->b = parse_rulefrag(s), s = walk(s);
return s;
}
static int
rewrite(char *incoming)
{
@ -154,7 +144,10 @@ rewrite(char *incoming)
while((c = *p)) {
int i;
if(p[0] == '<' && p[1] == '>') {
p = addrule(p);
Rule *r = &rules[rules_len++];
p += 3;
r->a = parse_rulefrag(p), p = walk(p) + 1;
r->b = parse_rulefrag(p), p = walk(p);
while((*outp_++ = *p++))
;
save(-1);