mirror of
				https://github.com/eledio-devices/thirdparty-tinyexpr.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Bug fix in list grammar.
This commit is contained in:
		
							
								
								
									
										3
									
								
								test.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								test.c
									
									
									
									
									
								
							| @@ -116,9 +116,11 @@ void test_results() { | |||||||
|         {"sqrt (100 * 100)", 100}, |         {"sqrt (100 * 100)", 100}, | ||||||
|  |  | ||||||
|         {"1,2", 2}, |         {"1,2", 2}, | ||||||
|  |         {"1,2+1", 3}, | ||||||
|         {"1,2,3", 3}, |         {"1,2,3", 3}, | ||||||
|         {"(1,2),3", 3}, |         {"(1,2),3", 3}, | ||||||
|         {"1,(2,3)", 3}, |         {"1,(2,3)", 3}, | ||||||
|  |         {"-(1,(2,3))", -3}, | ||||||
|  |  | ||||||
|         {"2^2", 4}, |         {"2^2", 4}, | ||||||
|         {"pow(2,2)", 4}, |         {"pow(2,2)", 4}, | ||||||
| @@ -358,6 +360,7 @@ void test_dynamic() { | |||||||
|         {"f+f", 10}, |         {"f+f", 10}, | ||||||
|         {"f+test0", 11}, |         {"f+test0", 11}, | ||||||
|         {"test0+test0", 12}, |         {"test0+test0", 12}, | ||||||
|  |         {"test0()+test0", 12}, | ||||||
|         {"test1 test0", 12}, |         {"test1 test0", 12}, | ||||||
|         {"test1 f", 10}, |         {"test1 f", 10}, | ||||||
|         {"test1 x", 4}, |         {"test1 x", 4}, | ||||||
|   | |||||||
| @@ -361,7 +361,7 @@ static te_expr *list(state *s) { | |||||||
|  |  | ||||||
|     while (s->type == TOK_SEP) { |     while (s->type == TOK_SEP) { | ||||||
|         next_token(s); |         next_token(s); | ||||||
|         ret = new_expr(TE_FUNCTION2, ret, term(s)); |         ret = new_expr(TE_FUNCTION2, ret, expr(s)); | ||||||
|         ret->f2 = comma; |         ret->f2 = comma; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user