[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thu, 14 Feb 2019 16:03:35 -0600
yylex() still gives the token ARITH_CMD for the following command. The
error seems to be raised at the parsing stage. Shouldn't the error be
caught in the lexical analysis stage?
$ ((x = 10 + 5; ++x; echo $x))
bash: ((: x = 10 + 5; ++x: syntax error: invalid arithmetic operator
(error token is "; ++x")
Why the parsing of the arithmetic expression is in the lexical
analysis. Why not introduce token `((` and `))` and handle arithmetic
expression in the bison parsing code?
Also, I don't find that POSIX specifies `((`. (Let me know if I miss
anything.) If `((` is a bash-specific thing, why not allow it to
handle multiple arithmetic expressions instead of just one? Thanks.
- About ARITH_CMD,
Peng Yu <=