summaryrefslogtreecommitdiff
path: root/src/diagnostics/unterminated_tag.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-07-12 19:49:14 -0400
committerMica White <botahamec@outlook.com>2026-07-12 19:49:14 -0400
commit8399983fd45bc0f11eac9def280c0833ffb93c04 (patch)
treef84173ca30a3c62db7abb92a0d869ff5d5199c51 /src/diagnostics/unterminated_tag.rs
initial commitHEADmain
Diffstat (limited to 'src/diagnostics/unterminated_tag.rs')
-rw-r--r--src/diagnostics/unterminated_tag.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/diagnostics/unterminated_tag.rs b/src/diagnostics/unterminated_tag.rs
new file mode 100644
index 0000000..cab21f8
--- /dev/null
+++ b/src/diagnostics/unterminated_tag.rs
@@ -0,0 +1,33 @@
+use miette::Diagnostic;
+use thiserror::Error;
+
+use crate::{
+ diagnostics::TokenDiagnostic,
+ tokenize::{Span, Token, TokenType},
+};
+
+#[derive(Error, Debug, Diagnostic)]
+#[error("Unterminated tag")]
+#[diagnostic(code(UnterminatedTag), severity(Error))]
+pub struct UnterminatedTag {
+ #[label(primary, "This tag is not terminated by a greater-than sign (>)")]
+ tag: Span,
+}
+
+impl TokenDiagnostic for UnterminatedTag {
+ fn handle_token(token: &Token<'_>) -> Option<Self> {
+ let TokenType::Tag {
+ greater_than_exists,
+ ..
+ } = token.ty
+ else {
+ return None;
+ };
+
+ if greater_than_exists {
+ return None;
+ }
+
+ Some(Self { tag: token.span })
+ }
+}