use oak_core::{Token, TokenType, UniversalTokenRole};
pub type NoteToken = Token<NoteTokenType>;
impl TokenType for NoteTokenType {
type Role = UniversalTokenRole;
const END_OF_STREAM: Self = Self::Eof;
fn is_ignored(&self) -> bool {
matches!(self, Self::Whitespace)
}
fn role(&self) -> Self::Role {
match self {
Self::Whitespace | Self::Newline => UniversalTokenRole::Whitespace,
Self::Text => UniversalTokenRole::None,
Self::Eof => UniversalTokenRole::Eof,
Self::Error => UniversalTokenRole::Error,
_ => UniversalTokenRole::None,
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(u8)]
pub enum NoteTokenType {
Text,
Whitespace,
Newline,
Heading1,
Heading2,
Heading3,
Heading4,
Heading5,
Heading6,
HeadingText,
Emphasis,
Strong,
Strikethrough,
InlineCode,
CodeBlock,
CodeFence,
CodeLanguage,
Link,
LinkText,
LinkUrl,
LinkTitle,
Image,
ImageAlt,
ImageUrl,
ImageTitle,
UnorderedList,
OrderedList,
ListItem,
ListMarker,
TaskList,
TaskMarker,
Blockquote,
BlockquoteMarker,
HorizontalRule,
Table,
TableRow,
TableCell,
TableHeader,
TableSeparator,
TableAlignment,
HtmlTag,
HtmlComment,
Escape,
LeftBracket,
RightBracket,
LeftParen,
RightParen,
LeftAngle,
RightAngle,
Asterisk,
Underscore,
Backtick,
Tilde,
Hash,
Pipe,
Dash,
Plus,
Dot,
Colon,
Exclamation,
Error,
Root,
Document,
Paragraph,
Metadata,
Eof,
}