Walk during commit

This commit is contained in:
Devine Lu Linvega 2024-04-08 09:28:36 -07:00
parent e87950292d
commit 0dc32f04f9
1 changed files with 8 additions and 13 deletions

View File

@ -94,20 +94,15 @@ plode(char *s)
static int
commit(char r)
{
int depth = 0;
char c, *s = regs[(int)r];
char *s = regs[(int)r];
if(r == '*')
s = plode(s);
else if(s[0] == '(') {
while((c = *s++)) {
if(c == '(') depth++;
*outp_++ = c;
if(c == ')') --depth;
if(!depth) return 1;
}
}
while(!spacer(s[0]) && (*outp_++ = *s++))
else if(s) {
char *ss = walk(s);
while((s < ss) && (*outp_++ = *s++))
;
} else
*outp_++ = r;
return 1;
}
@ -175,7 +170,7 @@ rewrite(void)
char cc, *b = r->b;
if(!*b && outp_ != bank_a && outp_ != bank_b) outp_--;
while((cc = *b++)) {
if(cc == '?' && regs[(int)b[0]])
if(cc == '?')
commit(*b++);
else
*outp_++ = cc;