Do not consume dictionary in lambdas
This commit is contained in:
parent
e1f4641f69
commit
19d03dc116
|
@ -37,7 +37,7 @@ sint(char *s)
|
|||
char c;
|
||||
int r = 0, n = 1;
|
||||
if(*s == '-') { n = -1, s++; }
|
||||
while((c = *s++) && c > 0x20) r = r * 10 + c - '0';
|
||||
while((c = *s++) && !spacer(c)) r = r * 10 + c - '0';
|
||||
return r * n;
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,7 @@ write_reg(char r, char *reg)
|
|||
{
|
||||
char c, *cap = walk(reg);
|
||||
switch(r) {
|
||||
case '>': /* op: output */
|
||||
case ':': device_write(reg); return;
|
||||
case '<': /* op: input */
|
||||
case '~': device_read(); return;
|
||||
case '^': /* op: join */
|
||||
if(*reg == '(') reg++, --cap;
|
||||
|
@ -262,6 +260,7 @@ rewrite(void)
|
|||
}
|
||||
/* phase: lambda */
|
||||
if(c == '?' && s[1] == '(') {
|
||||
char *d_ = dict_;
|
||||
cap = walk(s + 1);
|
||||
r = &lambda, r->id = -1;
|
||||
parse_frag(&r->b, parse_frag(&r->a, s + 2));
|
||||
|
@ -271,6 +270,7 @@ rewrite(void)
|
|||
if(!quiet) fprintf(stderr, "%02d %s\n", r->id, src_), ++r->refs;
|
||||
write_tail(s);
|
||||
}
|
||||
dict_ = d_;
|
||||
return 1;
|
||||
}
|
||||
/* phase: match */
|
||||
|
|
Loading…
Reference in New Issue