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 dialect;
12mod glob_dialect;
13mod lua_dialect;
14mod match_form;
15mod matching;
16mod runtime;
17mod shapes;
18mod text_vm;
19
20pub use adt::{
21    AlgebraicDataType, PatternField, TaggedValue, VariantConstructor, VariantDeclaration,
22    tagged_value,
23};
24pub use claims::{
25    pattern_adt_op_key, pattern_declared_op_keys, pattern_destructure_op_key,
26    pattern_exhaustive_op_key, pattern_live_ops, pattern_match_op_key, pattern_op_keys,
27    pattern_organ_symbol, pattern_tag_op_key, publish_pattern_organ_claims,
28    publish_pattern_organ_claims_for_lib,
29};
30pub use dialect::PatternDialect;
31pub use glob_dialect::{GlobPatternDialect, compile_glob_pattern};
32pub use lua_dialect::{LuaPatternDialect, compile_lua_pattern};
33pub use match_form::MatchForm;
34pub use matching::{
35    MatchArm, PatternMatch, destructure_expr, destructure_value, exhaustiveness_diagnostics,
36    match_value,
37};
38pub use runtime::{PatternLib, install_pattern_lib, manifest_name, pattern_exports};
39pub use shapes::{AdtShape, VariantShape};
40pub use text_vm::{TextClass, TextLimits, TextMatch, TextOp, run_text_pattern};
41
42/// Cookbook recipes for this lib, embedded at build time.
43pub static RECIPES: sim_cookbook::EmbeddedDir =
44    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
45
46#[cfg(test)]
47mod tests;
48#[cfg(test)]
49mod text_tests;