#645
awk: whitespace before parentheses silently loses concatenated strings
On just-bash 3.6.0 and current main (9ab0e0d3):
import { Bash } from "just-bash";
console.log(await new Bash().exec(
`awk 'BEGIN { s="A"; s=s (1 ? "B" : "C"); print s }'`
));Expected stdout: AB\n. Actual stdout: \n, with empty stderr and exit status 0.
The parser treats any identifier followed by ( as a function call, even with intervening whitespace. Here it calls an undefined function named s instead of concatenating strings. This silently changes computed results.
Awk distinguishes these forms: user-defined calls require an adjacent (; built-ins allow whitespace. The fix can use the existing token positions and built-in registry, without changing the lexer or evaluator.
Activity
0No activity yet.