diff options
| author | Mica White <botahamec@outlook.com> | 2026-09-27 15:48:03 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-09-27 15:48:03 -0400 |
| commit | 35f6fc17d0c98f424e01904b8856cf42c80bcfd3 (patch) | |
| tree | ba99ada4ac6e149c00e5d820b9c5f65e82fed980 /src/diagnostics | |
| parent | 8399983fd45bc0f11eac9def280c0833ffb93c04 (diff) | |
Add buggy diagnostics
Diffstat (limited to 'src/diagnostics')
| -rw-r--r-- | src/diagnostics/non_alphabetic_tag_name.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/diagnostics/non_alphabetic_tag_name.rs b/src/diagnostics/non_alphabetic_tag_name.rs deleted file mode 100644 index b36cb75..0000000 --- a/src/diagnostics/non_alphabetic_tag_name.rs +++ /dev/null @@ -1,38 +0,0 @@ -use miette::Diagnostic; -use thiserror::Error; - -use crate::{ - diagnostics::TokenDiagnostic, - tokenize::{Span, Token, TokenType}, -}; - -#[derive(Error, Debug, Diagnostic)] -#[error("Tag names must be alphabetic")] -#[diagnostic(code(NonAlphabeticTagName), severity(Error))] -pub struct NonAlphabeticTagName { - #[label(primary, "tag names must only contain uppercase and lowercase letters")] - tag: Span, -} - -impl TokenDiagnostic for NonAlphabeticTagName { - fn handle_token(token: &Token<'_>) -> Option<Self> { - let TokenType::Tag { - is_end, - lowercase_tag_name, - .. - } = token.ty - else { - return None; - }; - - if is_end - || lowercase_tag_name - .chars() - .all(|char| char.is_ascii_alphabetic()) - { - return None; - } - - Some(Self { tag: token.span }) - } -} |
