Skip to main content

Crate ruitl_compiler

Crate ruitl_compiler 

Source
Expand description

§ruitl_compiler

Parser and code generator for the RUITL template language.

This crate is runtime-free: it contains only syn/quote/proc-macro2-based AST and codegen logic so it can be depended on from both the ruitl runtime crate and its build.rs without pulling in server-side deps like hyper/tokio.

Re-exports§

pub use codegen::CodeGenerator;
pub use error::CompileError;
pub use error::Result;
pub use parser::Attribute;
pub use parser::AttributeValue;
pub use parser::ComponentDef;
pub use parser::ImportDef;
pub use parser::MatchArm;
pub use parser::ParamDef;
pub use parser::PropDef;
pub use parser::PropValue;
pub use parser::RuitlFile;
pub use parser::RuitlParser;
pub use parser::TemplateAst;
pub use parser::TemplateDef;

Modules§

codegen
RUITL Code Generator
error
Error types for the RUITL compiler.
format
Pretty-print a parsed RuitlFile back to canonical .ruitl source.
parser
RUITL Template Parser
suggest
Fuzzy-match helpers for “did you mean” diagnostics.

Constants§

CODEGEN_VERSION
Bumped whenever codegen output changes shape. Used as a cache-buster in the sibling-file hash header so cargo build invalidates cached output after any codegen.rs change, even if the .ruitl source is unchanged.

Functions§

compile_dir_sibling
Walk a directory for .ruitl files and compile each into a sibling *_ruitl.rs file. Also writes a top-level mod.rs in dir that declares and re-exports each compiled module, so consumers can mod templates;. Returns the list of written output paths.
compile_file
Compile a single .ruitl file to the given output path.
compile_file_sibling
Compile a single .ruitl file to a sibling *_ruitl.rs file.
generate
Generate Rust code (as a formatted string) from a RuitlFile.
parse_str
Parse a .ruitl source string into a RuitlFile AST.