Ensure negative numbers are handled properly
This commit is contained in:
		| @@ -170,12 +170,12 @@ | ||||
|       "-x", | ||||
|       "c", | ||||
|       "-o", | ||||
|       "/tmp/main-6b800d.o", | ||||
|       "/tmp/main-5fdd54.o", | ||||
|       "src/main.c" | ||||
|     ], | ||||
|     "directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json", | ||||
|     "file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/main.c", | ||||
|     "output": "/tmp/main-6b800d.o" | ||||
|     "output": "/tmp/main-5fdd54.o" | ||||
|   }, | ||||
|   { | ||||
|     "arguments": [ | ||||
| @@ -243,12 +243,12 @@ | ||||
|       "-x", | ||||
|       "c", | ||||
|       "-o", | ||||
|       "/tmp/dstring-08596e.o", | ||||
|       "/tmp/dstring-157144.o", | ||||
|       "src/dstring/dstring.c" | ||||
|     ], | ||||
|     "directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json", | ||||
|     "file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/dstring/dstring.c", | ||||
|     "output": "/tmp/dstring-08596e.o" | ||||
|     "output": "/tmp/dstring-157144.o" | ||||
|   }, | ||||
|   { | ||||
|     "arguments": [ | ||||
| @@ -316,12 +316,12 @@ | ||||
|       "-x", | ||||
|       "c", | ||||
|       "-o", | ||||
|       "/tmp/json_entities-a48410.o", | ||||
|       "/tmp/json_entities-f20100.o", | ||||
|       "src/json_entities/json_entities.c" | ||||
|     ], | ||||
|     "directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json", | ||||
|     "file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/json_entities/json_entities.c", | ||||
|     "output": "/tmp/json_entities-a48410.o" | ||||
|     "output": "/tmp/json_entities-f20100.o" | ||||
|   }, | ||||
|   { | ||||
|     "arguments": [ | ||||
| @@ -389,12 +389,12 @@ | ||||
|       "-x", | ||||
|       "c", | ||||
|       "-o", | ||||
|       "/tmp/lexer-174a98.o", | ||||
|       "/tmp/lexer-eb6c2d.o", | ||||
|       "src/lexer/lexer.c" | ||||
|     ], | ||||
|     "directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json", | ||||
|     "file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/lexer/lexer.c", | ||||
|     "output": "/tmp/lexer-174a98.o" | ||||
|     "output": "/tmp/lexer-eb6c2d.o" | ||||
|   }, | ||||
|   { | ||||
|     "arguments": [ | ||||
| @@ -462,11 +462,11 @@ | ||||
|       "-x", | ||||
|       "c", | ||||
|       "-o", | ||||
|       "/tmp/parser-baae30.o", | ||||
|       "/tmp/parser-73724a.o", | ||||
|       "src/parser/parser.c" | ||||
|     ], | ||||
|     "directory": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json", | ||||
|     "file": "/mnt/3A5CDF785CDF2CFF/Users/abdoo/dev/say_it_in_json/src/parser/parser.c", | ||||
|     "output": "/tmp/parser-baae30.o" | ||||
|     "output": "/tmp/parser-73724a.o" | ||||
|   } | ||||
| ] | ||||
|   | ||||
| @@ -639,7 +639,7 @@ lexer_state_t handle_key(lexer_t *lexer, char input) { | ||||
| lexer_state_t handle_value(lexer_t *lexer, char input) { | ||||
|   if (isspace(input)) { | ||||
|     return LEXER_STATE_VALUE; | ||||
|   } else if (isdigit(input) && input != '0') { | ||||
|   } else if ((isdigit(input) && input != '0') || input == '-') { | ||||
|     dstr_append(&(lexer->current_string), input); | ||||
|  | ||||
|     return LEXER_STATE_NUMBER; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user