Fixed issue with wrapped cells

This commit is contained in:
Devine Lu Linvega 2024-04-04 17:26:16 -07:00
parent f51040de77
commit 258fd27a9c
2 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,4 @@
<> (dup ?x) (?x ?x)
<> (?x ?y swap) (?y ?x)
((hey) (there) swap)
(dup (123))

View File

@ -20,8 +20,11 @@ walk(char *s)
char c;
while((c = *s++)) {
if(c == '(') depth++;
if(c == ')') --depth;
if(spacer(c) && !depth) break;
if(c == ')') {
--depth;
if(!depth) break;
}
if(depth < 0) break;
}
return s;
}
@ -46,10 +49,13 @@ writereg(char r)
int depth = 0;
char c, *s = regs[(int)r];
while((c = *s++)) {
*outp_++ = c;
if(c == '(') depth++;
if(c == ')') --depth;
if(!depth) break;
if(c == ')') {
--depth;
if(!depth) break;
}
if(depth < 0) break;
*outp_++ = c;
}
return 1;
}