Age | Commit message (Collapse) | Author |
|
Android forces -Wformat on for all source.
toys/pending/expr.c:116:28: warning: field precision should have type 'int',
but argument has type 'long' [-Wformat]
ret->s = xmprintf("%.*s", m[1].rm_eo-m[1].rm_so, target+m[1].rm_so);
~~^~ ~~~~~~~~~~~~~~~~~~~~~
|
|
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression
had to match). Don't exit() from a command, set exitval and return.
|
|
|
|
copying itinto a second variable. Also add error message for empty ( )
|
|
eliminate syntax_error() function (just call error_exit() directly),
eliminate advance() wrapper, pipe expected error messages in test to /dev/null
|
|
All tests pass now; this fixes the 2 remaining failures, including a
segfault.
The structure of the code has changed a lot -- instead of having a tiny
function per operator, we have eval_op() which does common type coercion
and then evaluates the operator. I tried writing it a couple different
ways, and this was the cleanest.
The OPS table now contains the operator string, precedence level,
signature for type coercion, and operator ID.
|
|
expr now uses the precedence table specified by POSIX, implemented using
the "precedence climbing" algorithm. See the references at the top of
eval_expr().
This fixes 3 of 4 failing tests.
I also added more tests for correct behavior and for syntax errors.
This includes a new test exposing a segfault, related to type coercion.
|
|
|
|
|
|
standard.
|
|
with the one in pending.
|
|
regex pattern match.
|
|
|
|
|