Generate NFAs from regexes
This commit is contained in:
parent
0688a5edd3
commit
ead6ca1738
7 changed files with 399 additions and 1 deletions
11
src/error.rs
11
src/error.rs
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue