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