commit a360af6355f49472654954f5f6ddb43c1b3f1a17
parent 69d08810f5633d4dd1ac2b486fa96f29123b0a37
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 26 Nov 2025 08:55:10 +0100
bc: Add leading space to explicit return
Without this space we cannot guarantee that the 0 is appended
to any other previous token.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/bc.y b/bc.y
@@ -133,9 +133,9 @@ stat : exprstat
| STRING {$$ = code("[%s]P", $1);}
| BREAK {$$ = brkcode();}
| QUIT {quit();}
- | RETURN {$$ = retcode(code("0"));}
+ | RETURN {$$ = retcode(code(" 0"));}
| RETURN '(' expr ')' {$$ = retcode($3);}
- | RETURN '(' ')' {$$ = retcode(code("0"));}
+ | RETURN '(' ')' {$$ = retcode(code(" 0"));}
| while cond stat {$$ = whilecode($1, $2, $3);}
| if cond stat {$$ = ifcode($1, $2, $3);}
| '{' statlst '}' {$$ = $2;}
@@ -625,7 +625,6 @@ operand(int ch)
peekc = ungetc(getc(filep), filep);
if (strchr(DIGITS, peekc))
return number(ch);
- yylval.str = ".";
return DOT;
case '"':
return string(ch);