summaryrefslogtreecommitdiff
path: root/src/diagnostics/stray_end_tag.rs
blob: fa4ca07c060354ff835256ba5173472be99c318e (plain)
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<Self> {
		let Node::StrayEndTag(token) = node else {
			return None;
		};

		Some(Self { token: token.span })
	}
}