From 31782a849f464eaa97b477ff31e4d0b5ef91ec3d Mon Sep 17 00:00:00 2001 From: Lewis Van Winkle Date: Wed, 24 Feb 2016 13:52:42 -0600 Subject: [PATCH] Bug fix in list grammar. --- test.c | 3 +++ tinyexpr.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test.c b/test.c index ffbfbf3..bf5344d 100644 --- a/test.c +++ b/test.c @@ -116,9 +116,11 @@ void test_results() { {"sqrt (100 * 100)", 100}, {"1,2", 2}, + {"1,2+1", 3}, {"1,2,3", 3}, {"(1,2),3", 3}, {"1,(2,3)", 3}, + {"-(1,(2,3))", -3}, {"2^2", 4}, {"pow(2,2)", 4}, @@ -358,6 +360,7 @@ void test_dynamic() { {"f+f", 10}, {"f+test0", 11}, {"test0+test0", 12}, + {"test0()+test0", 12}, {"test1 test0", 12}, {"test1 f", 10}, {"test1 x", 4}, diff --git a/tinyexpr.c b/tinyexpr.c index fb56ef8..b111537 100644 --- a/tinyexpr.c +++ b/tinyexpr.c @@ -361,7 +361,7 @@ static te_expr *list(state *s) { while (s->type == TOK_SEP) { next_token(s); - ret = new_expr(TE_FUNCTION2, ret, term(s)); + ret = new_expr(TE_FUNCTION2, ret, expr(s)); ret->f2 = comma; }