From 0fa0b620b3977ded34a659f0ca5dbd71dfb5b62e Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 14 Feb 2018 20:50:40 +0100 Subject: [PATCH] [tinyexpr] Remove list() This just read comma-separated expressions and returned the last of them, which is useless and confusing. --- src/tinyexpr.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/tinyexpr.c b/src/tinyexpr.c index 22f6d3b54..ccb6fe9e7 100755 --- a/src/tinyexpr.c +++ b/src/tinyexpr.c @@ -200,7 +200,6 @@ static double sub(double a, double b) {return a - b;} static double mul(double a, double b) {return a * b;} static double divide(double a, double b) {return a / b;} static double negate(double a) {return -a;} -static double comma(double a, double b) {(void)a; return b;} void next_token(state *s) { @@ -272,7 +271,6 @@ void next_token(state *s) { } -static te_expr *list(state *s); static te_expr *expr(state *s); static te_expr *power(state *s); @@ -353,7 +351,7 @@ static te_expr *base(state *s) { case TOK_OPEN: next_token(s); - ret = list(s); + ret = expr(s); if (s->type == TOK_CLOSE) { next_token(s); } else if (s->type != TOK_ERROR) { @@ -441,20 +439,6 @@ static te_expr *expr(state *s) { } -static te_expr *list(state *s) { - /* = {"," } */ - te_expr *ret = expr(s); - - while (s->type == TOK_SEP) { - next_token(s); - ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, expr(s)); - ret->function = comma; - } - - return ret; -} - - #define TE_FUN(...) ((double(*)(__VA_ARGS__))n->function) #define M(e) te_eval(n->parameters[e]) @@ -535,7 +519,7 @@ te_expr *te_compile(const char *expression, const te_variable *variables, int va s.lookup_len = var_count; next_token(&s); - te_expr *root = list(&s); + te_expr *root = expr(&s); if (s.type != TOK_END) { te_free(root);