regen/sdk/mod.rs
1//! Generic implementations of functions and objects that are used to parse plain text into application specific objects.
2//!
3//! The SDK module is the base module of Regen that provides shared implementation for all language environment.
4//! The rust code generated by the Regen compiler depends on this module to provide functionality.
5//!
6//! This module should not depend on the other Regen modules.
7
8mod util;
9pub use util::*;
10mod token;
11pub use token::*;
12mod ast_parser;
13/// Module with macros to implement the generated language environment.
14pub mod gen;
15pub use ast_parser::*;
16mod parse_tree;
17pub use parse_tree::*;
18
19pub use heck::AsKebabCase;
20pub use regex::Regex;
21
22/// Convenience macro for casting enum variants for AST and PT.
23#[macro_export]
24macro_rules! tree_cast {
25 (($($t:tt)*) $var:expr ) => {
26 match $var {
27 $($t)*(x) => x,
28 _ => panic!(
29 "Unable to tree_cast: Expected {}, got {:?}",
30 stringify!($enum_variant),
31 $var
32 ),
33 }
34 };
35}