The lexer now skips newlines

This commit is contained in:
nocturn9x 2021-08-02 08:00:54 +02:00
parent d1f96da9d1
commit 24785c9a0f
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ func createToken(self: Lexer, tokenType: TokenType): Token =
result = Token(kind: tokenType,
lexeme: self.source[self.start..<self.current],
)
proc parseNumber(self: Lexer) =
## Parses numeric literals
@ -140,7 +140,7 @@ proc scanToken(self: Lexer) =
## called iteratively until the source
## string reaches EOF
var single = self.step()
if single in [' ', '\t', '\r']: # We skip whitespaces, tabs and other stuff
if single in [' ', '\t', '\r', '\n']: # We skip whitespaces, tabs and other stuff
return
elif single.isDigit():
self.parseNumber()