Bug fix in list grammar.

This commit is contained in:
Lewis Van Winkle
2016-02-24 13:52:42 -06:00
parent 3f1d5d2553
commit 31782a849f
2 changed files with 4 additions and 1 deletions

3
test.c
View File

@@ -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},

View File

@@ -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;
}