Fixed negative number bug in the tokenizer related to open parenthesises.
This commit is contained in:
+5
-10
@@ -27,19 +27,14 @@ def get_tokens_from_expression_string(expression_string):
|
||||
|
||||
elif c == '-' and not parsing_number:
|
||||
if expression_string[i + 1] == '.' or expression_string[i + 1].isdigit():
|
||||
if token.TokenType.get_operator(tokens[-1].value) == token.TokenType.unknown:#tokens[-1].type == token.TokenType
|
||||
print(tokens[-1].value)
|
||||
tokens.append(token.Token('+', token.TokenType.add))
|
||||
if token.TokenType.get_operator(tokens[-1].value) != token.TokenType.unknown:#tokens[-1].type == token.TokenType
|
||||
#print(tokens[-1].value)
|
||||
#tokens.append(token.Token('+', token.TokenType.add))
|
||||
parsing_number = True
|
||||
tmp = "-"
|
||||
'''if 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('+', token.TokenType.add))
|
||||
elif tokens[-1].type == token.TokenType.exp_start:
|
||||
parsing_number = True
|
||||
tmp = "-"
|
||||
parsing_number = True'''
|
||||
else:
|
||||
tokens.append(token.Token(c, token.TokenType.get_operator(c)))
|
||||
parsing_number = False
|
||||
|
||||
Reference in New Issue
Block a user