#![allow(clippy::upper_case_acronyms)] pub mod new; mod test; use std::fmt; /// Represents a parsing error #[derive(Debug)] pub struct ParseError { pub msg: String, pub location: Location, } #[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct Location { pub(crate) offset: usize, } impl From for Location { fn from(offset: usize) -> Self { Self { offset } } } impl fmt::Display for Location { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.offset) } }