Skip to main content

vyre_libs/scan/
mod.rs

1//! Substrate-neutral byte and text scan compositions.
2//!
3//! Builders in this module return typed programs or immutable compilation
4//! artifacts. Dispatch, resident-resource, timing, and readback adapters are
5//! deliberately owned by upper integration crates.
6
7pub mod builders;
8pub mod hit_buffer;
9
10#[cfg(feature = "matching-dfa")]
11pub mod classic_ac;
12#[cfg(feature = "matching-dfa")]
13pub mod dfa;
14#[cfg(feature = "matching-nfa")]
15pub mod nfa;
16pub mod post_process;
17#[cfg(feature = "matching-nfa")]
18pub mod scan_program;
19#[cfg(feature = "matching-substring")]
20pub mod substring;
21
22#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
23pub mod fused_region_evidence;
24#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
25pub mod regex_anchored_window;
26#[cfg(feature = "matching-regex")]
27pub mod regex_compile;
28#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
29pub mod regex_dfa;
30#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
31pub mod regex_region_admission;
32
33#[cfg(feature = "matching-dfa")]
34pub use crate::fixture_bytes::pack_haystack_u32;
35pub use dfa::aho_corasick;
36#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
37pub use fused_region_evidence::{
38    fused_region_evidence_program, fused_region_evidence_reference, FusedRegionEvidence,
39    FUSED_EVIDENCE_ADMISSION_BINDING, FUSED_EVIDENCE_MATCHES_BINDING,
40    FUSED_EVIDENCE_MATCH_COUNT_BINDING, FUSED_EVIDENCE_PRESENCE_BINDING,
41};
42pub use hit_buffer::{
43    compact_hits, compact_hits_with_layout, emit_hit, emit_hit_then_compact,
44    emit_hit_then_compact_with_layout, emit_hit_with_layout, HIT_BUFFER_LIVE_LENGTH,
45    HIT_BUFFER_OVERFLOW_COUNT,
46};
47#[cfg(any(test, feature = "cpu-parity"))]
48pub use post_process::{
49    reference_post_process, shannon_entropy_bits_per_byte, try_reference_post_process,
50    try_reference_post_process_into,
51};
52pub use post_process::{PostProcessError, PostProcessedMatch};
53#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
54pub use regex_anchored_window::{
55    anchored_window_extract_program, AnchoredWindowValidator, ANCHORED_WINDOW_MATCHES_BINDING,
56    ANCHORED_WINDOW_MATCH_COUNT_BINDING,
57};
58#[cfg(feature = "matching-regex")]
59pub use regex_compile::{
60    build_scan_program_from_regex, compile_regex_set, compile_regex_set_with_policy,
61    regex_construct_diagnostic_code, CaptureMode, CaptureModeContract, CompiledRegexSet,
62    RegexCompileError, RegexConstruct, RegexPatternExtent, RegexReplayPolicy,
63    DEFAULT_OPEN_ENDED_REPLAY_LIMIT_BYTES,
64};
65#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
66pub use regex_dfa::{
67    build_regex_dfa_pipeline, build_regex_dfa_pipeline_with_policy,
68    build_regex_dfa_pipeline_with_policy_and_subgroup_coalesce, build_regex_dfa_shards,
69    build_regex_dfa_shards_unanchored, build_regex_dfa_unanchored, RegexDfaError, RegexDfaPipeline,
70    RegexDfaShard,
71};
72#[cfg(all(feature = "matching-regex", feature = "matching-dfa"))]
73pub use regex_region_admission::{
74    regex_admission_by_region_program, regex_admission_by_region_reference,
75    regex_admission_presence_words, region_of,
76};
77#[cfg(feature = "matching-nfa")]
78pub use scan_program::{build as build_scan_program, ScanProgram};
79#[cfg(feature = "matching-substring")]
80pub use substring::{substring_search, SCAN_SUBSTRING_OP_ID};
81
82pub use vyre_foundation::execution_plan::fusion::{fuse_programs, fuse_programs_vec, FusionError};
83
84#[cfg(feature = "cpu-parity")]
85use vyre_primitives::matching::region::dedup_regions_cpu as primitive_dedup_regions_cpu;
86#[cfg(any(test, feature = "cpu-parity"))]
87pub use vyre_primitives::matching::region::dedup_regions_inplace;
88pub use vyre_primitives::matching::region::{dedup_regions_flag_program, RegionTriple};
89
90/// Reference region deduplication helper for parity tests.
91#[cfg(feature = "cpu-parity")]
92#[must_use]
93pub fn dedup_regions_reference(input: Vec<RegionTriple>) -> Vec<RegionTriple> {
94    primitive_dedup_regions_cpu(input)
95}