Skip to main content

maskforge_core/
lib.rs

1//! MaskForge core: bounded schema lowering, frozen IR, incremental matching, and vocabulary masks.
2//! Links without PyO3; correctness oracles are test/benchmark-only.
3//!
4//! Architecture: <https://github.com/dhanavanthesh/maskforge/blob/main/docs/architecture.md>.
5
6#![deny(rust_2018_idioms)]
7// `bench-internals` only widens visibility for benchmarks and never ships.
8#![cfg_attr(not(feature = "bench-internals"), warn(missing_docs))]
9
10pub mod api;
11pub mod automaton;
12pub mod compile;
13#[cfg(any(test, feature = "test-utils"))]
14pub mod correctness;
15pub mod diagnostics;
16pub mod error;
17pub mod frontend;
18pub mod index;
19pub mod ir;
20pub mod mask;
21mod mem_gate;
22pub mod primitives;
23pub mod routing;
24pub mod runtime;
25pub mod structured;
26mod vocab;
27mod wire;
28
29pub use api::{
30    BindPolicy, BoundSchema, CompiledVocabulary, Compiler, CompilerOptions, SchemaProgram, Session,
31    SessionError, TrieCacheStats,
32};
33pub use automaton::RefEngine;
34pub use compile::compile_ir;
35pub use diagnostics::{Diagnostic, Span, UnsupportedReason};
36pub use error::{
37    CompileError, ErrorCode, HashState, LimitKind, MatcherError, Provenance, ProvenanceProfile,
38    Stage, VocabError,
39};
40pub use frontend::{
41    regex_to_ir, schema_to_ir, schema_to_ir_with_external_refs, schema_to_ir_with_resources,
42    SchemaRegistry, SchemaResourceLimits,
43};
44// The trie-joint vocabulary-binding types stay namespaced under `index::` rather than re-exported at
45// the crate root: they are an opt-in optimization path, not yet a frozen top-level API surface.
46pub use ir::{
47    Builder, Charset, CompileOptions, Node, ObjectClosure, ScalarLit, SchemaIR, UnsupportedPolicy,
48    IR_VERSION,
49};
50pub use mask::Bitmask;
51pub use primitives::{ByteClassId, MintermId, StateId, TokenId};
52pub use routing::{
53    add_bound, mul_bound, pow2_bound, Bound, CostEstimate, ExecutionKind, NodeRoute, RouteReason,
54    RouteTable,
55};
56pub use runtime::{CompiledArtifact, ExecutableCache, ExecutableSchema, Matcher};
57pub use structured::{StructuredMatcher, StructuredMatcherError, StructuredProgram};
58#[cfg(feature = "tokenizer-processing")]
59pub use vocab::build_vocabulary_from_tokenizer_json;
60#[cfg(feature = "huggingface-hub")]
61pub use vocab::FromPretrainedParameters;
62pub use vocab::{
63    build_vocabulary, build_vocabulary_from_str_keys, StringTokenMap, TokenMap, Vocabulary,
64};