use std::{ error, fmt, num::{ParseFloatError, ParseIntError}, rc::Rc, }; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Error { // Number InvalidFloatLiteral(ParseFloatError), InvalidIntegerLiteral(ParseIntError), // String UnclosedString(Rc), UnexpectedEscapeChar(char), // Par UnexpectedRightPar, UnclosedLeftPar, UnexpectedEof, RecursionLimit, } impl From for Error { fn from(value: ParseFloatError) -> Self { Self::InvalidFloatLiteral(value) } } impl From for Error { fn from(value: ParseIntError) -> Self { Self::InvalidIntegerLiteral(value) } } impl fmt::Display for Error { fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result { todo!() } } impl error::Error for Error {}