1use oak_core::SyntaxKind;
2use serde::{Deserialize, Serialize};
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
5pub enum XmlSyntaxKind {
6 Whitespace,
8 Newline,
9 Comment,
10 Text,
11 Error,
12 Eof,
13
14 XmlDeclaration,
16 DoctypeDeclaration,
17 ProcessingInstruction,
18 CData,
19
20 StartTag,
22 EndTag,
23 SelfClosingTag,
24 TagName,
25
26 AttributeName,
27 AttributeValue,
28
29 StringLiteral,
31
32 LeftAngle, RightAngle, LeftAngleSlash, SlashRightAngle, Equals, Quote, SingleQuote, Exclamation, Question, Ampersand, Semicolon, EntityReference,
47 CharacterReference,
48
49 Identifier,
51}
52
53impl SyntaxKind for XmlSyntaxKind {
54 fn is_trivia(&self) -> bool {
55 matches!(self, Self::Whitespace | Self::Newline | Self::Comment)
56 }
57
58 fn is_comment(&self) -> bool {
59 matches!(self, Self::Comment)
60 }
61
62 fn is_whitespace(&self) -> bool {
63 matches!(self, Self::Whitespace | Self::Newline)
64 }
65
66 fn is_token_type(&self) -> bool {
67 !matches!(self, Self::XmlDeclaration | Self::DoctypeDeclaration | Self::StartTag | Self::EndTag | Self::SelfClosingTag)
68 }
69
70 fn is_element_type(&self) -> bool {
71 matches!(self, Self::XmlDeclaration | Self::DoctypeDeclaration | Self::StartTag | Self::EndTag | Self::SelfClosingTag)
72 }
73}