From e6e2188797bf9073bc0f5c90db0d17535de55d70 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 6 Apr 2024 18:09:18 -0700 Subject: [PATCH] Inlined addrule --- examples/test.modal | 3 ++- src/modal.c | 15 ++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/test.modal b/examples/test.modal index aefdb2d..98d9edb 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,3 +1,4 @@ <> ((eval ?x)) (?x) -(eval (<> (join (?x) (?y)) (?x ?y))) (join (foo) (bar)) \ No newline at end of file +(eval (<> (join (?x) (?y)) (?x ?y))) +(join (foo) (bar)) diff --git a/src/modal.c b/src/modal.c index 9840135..73b8396 100644 --- a/src/modal.c +++ b/src/modal.c @@ -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);