Write empty register name when null

This commit is contained in:
Devine Lu Linvega 2024-04-07 16:26:53 -07:00
parent 865f040da3
commit 66bd58b89b
2 changed files with 4 additions and 3 deletions

View File

@ -5,5 +5,7 @@
<> (reverse/l (?h) ?l) (str (?h ?l))
<> (implode str ?*) (?*)
<> ((read)) (?:)
<> (empty-register) (?x)
<> (explode ?*) (str (?*))
(implode reverse (explode hello)) (read)
(implode reverse (explode hello)) (read) (explode hello) empty-register

View File

@ -105,7 +105,6 @@ commit(char r)
{
int depth = 0;
char c, *s = regs[(int)r];
if(!s) return !fprintf(stderr, "?%c Empty\n", r);
if(r == '*')
s = plode(s);
else if(s[0] == '(') {
@ -184,7 +183,7 @@ rewrite(void)
if(res != NULL) {
char cc, *b = r->b;
while((cc = *b++)) {
if(cc == '?')
if(cc == '?' && regs[(int)b[0]])
commit(*b++);
else
*outp_++ = cc;