Walk during commit
This commit is contained in:
parent
e87950292d
commit
0dc32f04f9
21
src/modal.c
21
src/modal.c
|
@ -94,20 +94,15 @@ plode(char *s)
|
||||||
static int
|
static int
|
||||||
commit(char r)
|
commit(char r)
|
||||||
{
|
{
|
||||||
int depth = 0;
|
char *s = regs[(int)r];
|
||||||
char c, *s = regs[(int)r];
|
|
||||||
if(r == '*')
|
if(r == '*')
|
||||||
s = plode(s);
|
s = plode(s);
|
||||||
else if(s[0] == '(') {
|
else if(s) {
|
||||||
while((c = *s++)) {
|
char *ss = walk(s);
|
||||||
if(c == '(') depth++;
|
while((s < ss) && (*outp_++ = *s++))
|
||||||
*outp_++ = c;
|
;
|
||||||
if(c == ')') --depth;
|
} else
|
||||||
if(!depth) return 1;
|
*outp_++ = r;
|
||||||
}
|
|
||||||
}
|
|
||||||
while(!spacer(s[0]) && (*outp_++ = *s++))
|
|
||||||
;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +170,7 @@ rewrite(void)
|
||||||
char cc, *b = r->b;
|
char cc, *b = r->b;
|
||||||
if(!*b && outp_ != bank_a && outp_ != bank_b) outp_--;
|
if(!*b && outp_ != bank_a && outp_ != bank_b) outp_--;
|
||||||
while((cc = *b++)) {
|
while((cc = *b++)) {
|
||||||
if(cc == '?' && regs[(int)b[0]])
|
if(cc == '?')
|
||||||
commit(*b++);
|
commit(*b++);
|
||||||
else
|
else
|
||||||
*outp_++ = cc;
|
*outp_++ = cc;
|
||||||
|
|
Loading…
Reference in New Issue