mirror of
				https://github.com/eledio-devices/thirdparty-tinyexpr.git
				synced 2025-10-31 16:14:16 +01:00 
			
		
		
		
	Allow whitespace at end of expression.
This commit is contained in:
		
							
								
								
									
										1
									
								
								test.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								test.c
									
									
									
									
									
								
							| @@ -37,6 +37,7 @@ typedef struct { | |||||||
|  |  | ||||||
| void test_results() { | void test_results() { | ||||||
|     test_case cases[] = { |     test_case cases[] = { | ||||||
|  |         {"1", 1}, | ||||||
|         {"1 ", 1}, |         {"1 ", 1}, | ||||||
|         {"(1)", 1}, |         {"(1)", 1}, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -172,13 +172,13 @@ static double comma(double a, double b) {return b;} | |||||||
| void next_token(state *s) { | void next_token(state *s) { | ||||||
|     s->type = TOK_NULL; |     s->type = TOK_NULL; | ||||||
|  |  | ||||||
|  |     do { | ||||||
|  |  | ||||||
|         if (!*s->next){ |         if (!*s->next){ | ||||||
|             s->type = TOK_END; |             s->type = TOK_END; | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     do { |  | ||||||
|  |  | ||||||
|         /* Try reading a number. */ |         /* Try reading a number. */ | ||||||
|         if ((s->next[0] >= '0' && s->next[0] <= '9') || s->next[0] == '.') { |         if ((s->next[0] >= '0' && s->next[0] <= '9') || s->next[0] == '.') { | ||||||
|             s->value = strtod(s->next, (char**)&s->next); |             s->value = strtod(s->next, (char**)&s->next); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user