use regex::RegexSet;
pub use crate::parser::Quantifier;
#[derive(Clone, Debug)]
pub enum Segment {
Text(String),
Capture(Capture),
Group(Vec<Capture>),
PriorityGroup(Vec<Capture>),
}
#[derive(Debug, Clone)]
pub enum Pattern {
Eq { any_of: Vec<String>, no_case: bool },
Delimited {
starts: Vec<String>,
ends: Vec<String>,
reg: Option<RegexSet>,
no_case: bool,
no_trim: bool,
},
Word { reg: Option<RegexSet> },
}
#[derive(Clone, Debug)]
pub struct Capture {
pub name: String,
pub quantifier: Quantifier,
pub patterns: Vec<Pattern>,
}
impl Pattern {
pub(crate) fn is_deterministic(&self) -> bool {
!matches!(self, Self::Word { reg: None })
}
}