mirror of
https://github.com/joshuadavidthomas/django-template-ast.git
synced 2025-08-04 17:08:00 +00:00
20 lines
541 B
Rust
20 lines
541 B
Rust
use std::fmt;
|
|
|
|
#[derive(Debug)]
|
|
pub enum LexerError {
|
|
EmptyToken(usize),
|
|
UnexpectedCharacter(char, usize),
|
|
}
|
|
|
|
impl fmt::Display for LexerError {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
LexerError::EmptyToken(line) => write!(f, "Empty token at line {}", line),
|
|
LexerError::UnexpectedCharacter(c, line) => {
|
|
write!(f, "Unexpected character '{}' at line {}", c, line)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for LexerError {}
|