#[derive(Debug)] pub enum Error { GrammarError(String), SymbolError(String), RegexError(String), ConflictError(String), } pub type Result = std::result::Result; impl Error { pub fn grammar(message: &str) -> Self { Error::GrammarError(message.to_string()) } pub fn regex(message: &str) -> Self { Error::RegexError(message.to_string()) } } impl From for Error { fn from(error: serde_json::Error) -> Self { Error::GrammarError(error.to_string()) } }