test/arithm: reset variable before assignment tests
shell/arithm: implement variables
test/pipeline: disable early close test
This test doesn't work, because variables in arithmetic expressions are not yet
parser/arithm: parse variables
arithm: introduce mrsh_arithm_variable
parser/arithm: fix assignments with operators
We need to peek the assignment variable *and* the assignment operator
(otherwise we have no guarantee it's an assignment).
The previous logic was wrong and assumed "=" was in front of all assignment
shell/arithm: fix assignments with operators
The variable got assigned the rvalue instead of the result of the operation.
parser/arithm: fix addend and factor left-associativity
Instead of calling ourselves recursively, call the inner parser in a loop. This
is described in .
parser/arithm: fix && and ||
"&" and "|" have higher priority, so they were consuming the first character of
"&&" and "||", leaving a trailing "&" or "|".
parser/arithm: fix comparison operators
> and < were recognized before >= and <=. For this reason, >= and <= were never
parsed (since they are prefixes of < and >).
builtin/hash: new utility
This implements a minimal hash(1) utility, without any caching.
builtin/pwd: implement -L and -P
Note that this is mostly a placation, because mrsh manages the PWD
variable and ensures that none of the conditions -P or -L are meant to
address will occur.
shell/arithm: implement assignments
The parser still chokes on assignments with an operation.
shell/arithm: strip mrsh_ prefix for static functions
The mrsh_ prefix is reserved for exported, public functions.
shell: make mrsh_run_arithm_expr take a mrsh_state
This function needs access to the shell's state to assign to variables.
builtins: implement return
mrsh_state: move loop control into call frame
mrsh_state: rename args field to frame
unspecified builtins: add missing newline
frontend/readline: fix undefined rl_replace_line with editline
editline doesn't define rl_replace_line. I haven't found a good way to make
SIGINT handling work with editline, let's just disable it for now.
Fixes: 763feb2ee5dd ("readline: reset on SIGINT")