Improved negative variable handling in the tokenizer. Updated the tolerance checking in the main program.

This commit is contained in:
2020-04-26 19:11:01 -05:00
parent 917b58ee87
commit 5a585cf6f8
2 changed files with 7 additions and 2 deletions
+6
View File
@@ -44,6 +44,12 @@ def get_tokens_from_expression_string(expression_string):
#Must be a variable.
if tokens[-1].type == token.TokenType.exp_start:
variable_is_negative = True
elif token.TokenType.get_operator(tokens[-1].value) != token.TokenType.unknown:
variable_is_negative = True
elif tokens[-1].type == token.TokenType.exp_end:
tokens.append(token.Token(c, token.TokenType.get_operator(c)))
parsing_number = False
tmp = ""
else:
tokens.append(token.Token(c, token.TokenType.get_operator(c)))
parsing_number = False