use std::{error::Error, fmt::Display};
type PestErr = pest::error::Error<crate::parser::grammar::Rule>;
#[derive(Debug, Clone)]
pub enum TeaCatErr {
Parsing(PestErr),
}
impl Display for TeaCatErr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Parsing(pest_err) => pest_err.fmt(f),
}
}
}
impl Error for TeaCatErr {}
impl From<PestErr> for TeaCatErr {
fn from(err: PestErr) -> Self {
TeaCatErr::Parsing(err)
}
}