Generate NFAs from regexes

This commit is contained in:
Max Brunsfeld 2018-12-08 13:44:11 -08:00
parent 0688a5edd3
commit ead6ca1738
7 changed files with 399 additions and 1 deletions

View file

@ -2,10 +2,21 @@
pub enum Error {
GrammarError(String),
SymbolError(String),
RegexError(String),
}
pub type Result<T> = std::result::Result<T, Error>;
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<serde_json::Error> for Error {
fn from(error: serde_json::Error) -> Self {
Error::GrammarError(error.to_string())