Add support for negative numbers

This commit is contained in:
Pavle Portic 2019-05-03 14:41:36 +02:00
parent 95edb52c87
commit f6e03b934c
Signed by: TheEdgeOfRage
GPG Key ID: 6758ACE46AA2A849
1 changed files with 3 additions and 0 deletions

View File

@ -74,6 +74,9 @@ class Lexer():
elif self.current_char == '-':
self.advance()
if self.current_char.isdigit():
return Token(NUMBER, -self.number())
return Token(MINUS, operator.sub)
elif self.current_char == '*':