Edited docstring for Lexer.error()

This commit is contained in:
Nocturn9x 2021-10-05 10:15:10 +02:00
parent 69e20e4446
commit f2cc2d0ef4
1 changed files with 3 additions and 5 deletions

View File

@ -144,10 +144,8 @@ proc peek(self: Lexer, distance: int = 0): char =
proc error(self: Lexer, message: string) =
## Sets the errored and errorMessage fields
## for the lexer. The lex method will not
## continue tokenizing if it finds out
## an error occurred
## Raises a lexing error with a formatted
## error message
raise newException(LexingError, &"A fatal error occurred while parsing '{self.file}', line {self.line} at '{self.peek()}' -> {message}")
@ -514,4 +512,4 @@ proc lex*(self: Lexer, source, file: string): seq[Token] =
self.start = self.current
self.tokens.add(Token(kind: EndOfFile, lexeme: "",
line: self.line))
return self.tokens
return self.tokens