aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/expr.c
AgeCommit message (Collapse)Author
2016-03-16expr cleanup: traverse optargs with tok instead of incrementing optargs andRob Landley
copying itinto a second variable. Also add error message for empty ( )
2016-03-16Move whitespace and curly brackets around, move reference URLs to top of file,Rob Landley
eliminate syntax_error() function (just call error_exit() directly), eliminate advance() wrapper, pipe expected error messages in test to /dev/null
2016-03-16Fix type coercion bugs in expr.Andy Chu
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.
2016-03-16Fix the operator precedence in expr.Andy Chu
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.
2015-01-01typo fixesElliott Hughes
2014-12-28Fluff out help text.Rob Landley
2014-12-02Note posix mailing list posting correcting a bug in the web version of the ↵Rob Landley
standard.
2014-12-01Refactor expr and add another test entry that works with TEST_HOST=1 but not ↵Rob Landley
with the one in pending.
2014-11-29expr.c: Added '==' sign into list of operations. Also added support for ↵Ashwini Sharma
regex pattern match.
2013-06-15Force 64 bit math in expr, from Daniel VerkampRob Landley
2013-06-05Start of expr, by Daniel Verkamp.Rob Landley