summaryrefslogtreecommitdiff
path: root/src/diagnostics/image_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/image_tag.rs
initial commitHEADmain
Diffstat (limited to 'src/diagnostics/image_tag.rs')
-rw-r--r--src/diagnostics/image_tag.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/diagnostics/image_tag.rs b/src/diagnostics/image_tag.rs
new file mode 100644
index 0000000..dc5a633
--- /dev/null
+++ b/src/diagnostics/image_tag.rs
@@ -0,0 +1,34 @@
+use miette::Diagnostic;
+use thiserror::Error;
+
+use crate::{
+ diagnostics::AstDiagnostic,
+ tokenize::{Span, TokenType},
+};
+
+#[derive(Error, Debug, Diagnostic)]
+#[error("image tags is not allowed in kuht")]
+#[diagnostic(code(ImageTag), severity(Error))]
+pub struct ImageTag {
+ #[label(primary, "invalid image tag")]
+ tag: Span,
+}
+
+impl AstDiagnostic for ImageTag {
+ fn handle_element(element: &crate::parse::Element<'_>) -> Option<Self> {
+ let TokenType::Tag {
+ lowercase_tag_name, ..
+ } = element.start_tag.ty
+ else {
+ return None;
+ };
+
+ if lowercase_tag_name != "image" {
+ return None;
+ }
+
+ Some(Self {
+ tag: element.start_tag.span,
+ })
+ }
+}