mod glushkov;
mod state;
pub mod tagged;
mod thompson;
pub mod utf8_automata;
pub use glushkov::{
compile_glushkov, compile_glushkov_wide, BitSet256, BitSet256Iter, ByteSet, GlushkovNfa,
GlushkovWideNfa, MAX_POSITIONS, MAX_POSITIONS_WIDE,
};
pub use state::*;
pub use thompson::*;
use crate::error::Result;
use crate::hir::Hir;
#[inline]
pub fn at_end_or_before_final_newline(input: &[u8], pos: usize) -> bool {
pos == input.len() || (pos + 1 == input.len() && input[pos] == b'\n')
}
#[inline]
pub fn is_word_boundary(input: &[u8], pos: usize) -> bool {
let before = pos
.checked_sub(1)
.and_then(|i| input.get(i))
.is_some_and(|&b| crate::hir::unicode::is_word_byte(b));
let after = input
.get(pos)
.is_some_and(|&b| crate::hir::unicode::is_word_byte(b));
before != after
}
#[inline]
pub fn is_utf8_boundary(input: &[u8], pos: usize) -> bool {
pos >= input.len() || (input[pos] & 0xC0) != 0x80
}
pub fn compile(hir: &Hir) -> Result<Nfa> {
let mut builder = NfaBuilder::new();
builder.build(hir)
}