Files
zen/core/template/src/lib.rs
stefan-gorules 602d214b96 feat: expression static analysis (#449)
* feat: expression static analysis

* fix: cargo fmt

* fix: python workflow

* fix: python workflow

* fix: python workflow

* fix: ignore miri test bound by clock

* fix: memory leaks
2026-06-22 15:48:05 +02:00

21 lines
539 B
Rust

#![forbid(unsafe_code)]
mod error;
mod interpreter;
mod lexer;
mod parser;
use crate::interpreter::Interpreter;
use crate::lexer::Lexer;
use crate::parser::Parser;
use zen_expression::variable::Variable;
pub use crate::error::{ParserError, TemplateRenderError};
pub fn render(template: &str, context: Variable) -> Result<Variable, TemplateRenderError> {
let tokens = Lexer::from(template.trim()).collect();
let nodes = Parser::from(tokens.as_slice()).collect()?;
Interpreter::from(nodes.as_slice()).collect_for(context)
}