Add proper impl for templating

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-06 12:56:16 +01:00
parent 1ee7611981
commit 4470af3926
5 changed files with 85 additions and 27 deletions

View file

@ -1,3 +1,4 @@
use thiserror::Error;
use winnow::Parser;
use winnow::RecoverableParser;
use winnow::combinator::alt;
@ -113,9 +114,15 @@ impl ParserError<Input<'_>> for AstError {
}
}
#[derive(Debug)]
#[derive(Debug, Error)]
pub struct AstFailure {}
impl std::fmt::Display for AstFailure {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("TODO")
}
}
impl AstFailure {
fn from_errors(_errors: Vec<AstError>, _input: &[TemplateToken]) -> AstFailure {
AstFailure {}
@ -217,7 +224,7 @@ mod tests {
fn check_only_content() {
let input = "Hello World";
let parsed = crate::parser::parse(input).unwrap();
let parsed = crate::parser::parse(input.into()).unwrap();
let ast = parse(parsed.tokens()).unwrap();
@ -239,7 +246,7 @@ mod tests {
fn check_simple_variable_interpolation() {
let input = "Hello {{= world }}";
let parsed = crate::parser::parse(input).unwrap();
let parsed = crate::parser::parse(input.into()).unwrap();
let ast = parse(parsed.tokens()).unwrap();