crftng-intrprtrs/src/lexer/error.rs

21 lines
341 B
Rust

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
}
}