#![doc = include_str!("../README.md")]
use std::{error, fmt};
mod ast;
mod compile;
mod parse;
pub mod re;
mod se;
pub mod template;
pub use ast::{ErrorKind, ParseError};
pub use re::Captures;
pub use se::{Action, Structex, StructexBuilder, TaggedCaptures, TaggedCapturesIter};
#[derive(Debug)]
pub enum Error {
Syntax(ParseError),
Regex(Box<dyn error::Error + Send + Sync>),
}
impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Syntax(e) => write!(f, "{e}"),
Self::Regex(e) => write!(f, "{e}"),
}
}
}
impl From<ParseError> for Error {
fn from(err: ParseError) -> Self {
Error::Syntax(err)
}
}