crftng-intrprtrs/src/lexer/error.rs

21 lines
341 B
Rust
Raw Normal View History

2022-03-21 15:47:35 +01:00
use core::fmt;
use std::error::Error;
#[derive(Debug)]
pub struct LexingError {
pub line: usize,
pub msg: String,
}
impl fmt::Display for LexingError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error on line: {}", self.line)
}
}
impl Error for LexingError {
fn description(&self) -> &str {
&self.msg
}
}