Files
fudge2.1/src/ast/errors.rs

14 lines
419 B
Rust

use std::fmt::Display;
pub struct ExpectedTokenError {
line: usize,
column_start: usize,
actual: &'static str,
expected: Vec<&'static str>,
}
impl Display for ExpectedTokenError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "line {} column {}:\nExpected one of {} but got {}", self.line, self.column_start, self.expected.join(", "), self.actual)
}
}