use oak_core::{Token, TokenType, UniversalTokenRole};
pub type XmlToken = Token<XmlTokenType>;
impl TokenType for XmlTokenType {
type Role = UniversalTokenRole;
const END_OF_STREAM: Self = Self::Error;
fn is_ignored(&self) -> bool {
false
}
fn role(&self) -> Self::Role {
match self {
_ => UniversalTokenRole::None,
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum XmlTokenType {
Root,
Whitespace,
Newline,
Comment,
Text,
Error,
Eof,
XmlDeclaration,
DoctypeDeclaration,
ProcessingInstruction,
CData,
StartTag,
EndTag,
SelfClosingTag,
TagName,
AttributeName,
AttributeValue,
StringLiteral,
LeftAngle,
RightAngle,
LeftAngleSlash,
SlashRightAngle,
Equals,
Quote,
SingleQuote,
Exclamation,
Question,
Ampersand,
Semicolon,
EntityReference,
CharacterReference,
Identifier,
SourceFile,
Element,
Attribute,
Prolog,
}