use miette::Diagnostic; use thiserror::Error; use crate::{diagnostics::AstDiagnostic, parse::Node, tokenize::Span}; #[derive(Error, Debug, Diagnostic)] #[error("Stray end tag")] #[diagnostic(code(StrayEndTag), severity(Error))] pub struct StrayEndTag { #[label(primary)] token: Span, } impl AstDiagnostic for StrayEndTag { fn handle_node(node: &Node<'_>) -> Option { let Node::StrayEndTag(token) = node else { return None; }; Some(Self { token: token.span }) } }