use crate::nfa::Nfa;
use super::interpreter::LazyDfa;
pub struct LazyDfaEngine {
dfa: LazyDfa,
}
impl std::fmt::Debug for LazyDfaEngine {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("LazyDfaEngine")
.field("state_count", &self.dfa.state_count())
.finish()
}
}
impl LazyDfaEngine {
pub fn new(nfa: Nfa) -> Self {
Self {
dfa: LazyDfa::new(nfa),
}
}
#[inline]
pub fn is_match_bytes(&mut self, input: &[u8]) -> bool {
self.dfa.is_match_bytes(input)
}
#[inline]
pub fn find(&mut self, input: &[u8]) -> Option<(usize, usize)> {
self.dfa.find(input)
}
#[inline]
pub fn find_at(&mut self, input: &[u8], pos: usize) -> Option<usize> {
self.dfa.find_at(input, pos)
}
pub fn state_count(&self) -> usize {
self.dfa.state_count()
}
pub fn set_cache_limit(&mut self, limit: usize) {
self.dfa.set_cache_limit(limit);
}
pub fn flush_count(&self) -> usize {
self.dfa.flush_count()
}
pub fn clear_cache(&mut self) {
self.dfa.clear_cache();
}
pub fn dfa(&self) -> &LazyDfa {
&self.dfa
}
pub fn dfa_mut(&mut self) -> &mut LazyDfa {
&mut self.dfa
}
pub fn is_jit(&self) -> bool {
false
}
pub fn has_word_boundary(&self) -> bool {
self.dfa.has_word_boundary()
}
pub fn has_anchors(&self) -> bool {
self.dfa.has_anchors()
}
pub fn has_start_anchor(&self) -> bool {
self.dfa.has_start_anchor()
}
pub fn has_end_anchor(&self) -> bool {
self.dfa.has_end_anchor()
}
pub fn has_multiline_anchors(&self) -> bool {
self.dfa.has_multiline_anchors()
}
}