updated error names and Display

This commit is contained in:
Moritz Gmeiner 2024-09-01 23:53:04 +02:00
commit f9fe77f1e2
7 changed files with 164 additions and 81 deletions

View file

@ -4,13 +4,13 @@ use super::CodePos;
#[derive(Error, Debug)]
pub enum LexerError {
#[error("LexerError: Unexpected character '{c}' at {code_pos}.")]
#[error("unexpected character '{c}' at {code_pos}.")]
UnexpectedCharacter { c: char, code_pos: CodePos },
#[error("LexerError: Unterminated string literal starting at {code_pos}.")]
#[error("unterminated string literal starting at {code_pos}.")]
UnterminatedStringLiteral { code_pos: CodePos },
#[error("LexerError: Unterminated block comment starting at {code_pos}.")]
#[error("unterminated block comment starting at {code_pos}.")]
UnterminatedBlockComment { code_pos: CodePos },
#[error("LexerError: Invalid number literal {lexeme} at {code_pos}: {msg}")]
#[error("invalid number literal {lexeme} at {code_pos}: {msg}")]
InvalidNumberLiteral {
lexeme: String,
msg: String,