1use oak_core::SyntaxKind;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6pub enum HtmlSyntaxKind {
7 TagOpen, TagClose, TagSlashOpen, TagSelfClose, TagName,
15 AttributeName,
16 AttributeValue,
17
18 Text,
20
21 Comment, Equal, Quote, Doctype, CData, ProcessingInstruction, EntityRef, CharRef, Whitespace,
43 Newline,
44
45 Eof,
47 Error,
48}
49
50impl SyntaxKind for HtmlSyntaxKind {
51 fn is_trivia(&self) -> bool {
52 matches!(self, Self::Whitespace | Self::Comment | Self::Newline)
53 }
54
55 fn is_comment(&self) -> bool {
56 matches!(self, Self::Comment)
57 }
58
59 fn is_whitespace(&self) -> bool {
60 matches!(self, Self::Whitespace | Self::Newline)
61 }
62
63 fn is_token_type(&self) -> bool {
64 !matches!(self, Self::Error)
65 }
66
67 fn is_element_type(&self) -> bool {
68 matches!(self, Self::Error)
69 }
70}