Skip to main content

sim_lib_pattern/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Pattern behavior for the SIM runtime over the kernel `Shape` protocol.
4//!
5//! The kernel defines the `Shape` match/binding protocol; this crate supplies
6//! the concrete pattern organ (algebraic data types, destructuring, match arms,
7//! and exhaustiveness checking) as pattern surfaces over that protocol.
8
9mod adt;
10mod claims;
11mod compile;
12mod cursor;
13mod dialect;
14mod domain_execute;
15mod execute;
16mod extension;
17mod glob_dialect;
18mod ir;
19mod lua_dialect;
20mod match_form;
21mod matching;
22mod runtime;
23mod shapes;
24mod text_vm;
25
26pub use adt::{
27    AlgebraicDataType, PatternField, TaggedValue, VariantConstructor, VariantDeclaration,
28    tagged_value,
29};
30pub use claims::{
31    pattern_adt_op_key, pattern_declared_op_keys, pattern_destructure_op_key,
32    pattern_exhaustive_op_key, pattern_live_ops, pattern_match_op_key, pattern_op_keys,
33    pattern_organ_symbol, pattern_tag_op_key, publish_pattern_organ_claims,
34    publish_pattern_organ_claims_for_lib,
35};
36pub use compile::{
37    AssertionProgram, Automaton, CompilationEvidence, Instruction, State, StateId, TagBoundary,
38    compile,
39};
40pub use cursor::{
41    ByteDomain, ByteOffset, CodeUnitDomain, CodeUnitOffset, Cursor, ScalarDomain, ScalarOffset,
42    SymbolDomain,
43};
44pub use dialect::PatternDialect;
45pub use domain_execute::{
46    DomainCaptureSpan, DomainExecutionOutcome, DomainMatch, execute_bytes, execute_code_units,
47    execute_scalars, require_code_unit_offset,
48};
49pub use execute::{
50    CaptureSpan, ExecutionLimit, ExecutionMatch, ExecutionOutcome, ExecutionReceipt,
51    UnsupportedFeature, execute_regular,
52};
53pub use extension::{
54    BoundedExtension, ExtensionKind, ExtensionLimits, ExtensionOutcome, ExtensionReceipt,
55    ExtensionRefusal, ExtensionStep, ExtensionWork, execute_extension,
56};
57pub use glob_dialect::{GlobPatternDialect, compile_glob_pattern};
58pub use ir::{
59    Anchor, AssertionId, CaptureId, EnginePolicy, IrError, IrNode, PatternIr, RepeatBounds,
60};
61pub use lua_dialect::{LuaPatternDialect, compile_lua_pattern};
62pub use match_form::MatchForm;
63pub use matching::{
64    MatchArm, PatternMatch, destructure_expr, destructure_value, exhaustiveness_diagnostics,
65    match_value,
66};
67pub use runtime::{PatternLib, install_pattern_lib, manifest_name, pattern_exports};
68pub use shapes::{AdtShape, VariantShape};
69pub use text_vm::{TextClass, TextLimits, TextMatch, TextOp, run_text_pattern};
70
71/// Cookbook recipes for this lib, embedded at build time.
72pub static RECIPES: sim_cookbook::EmbeddedDir =
73    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
74
75#[cfg(test)]
76mod tests;
77#[cfg(test)]
78mod text_tests;