pub enum TokenKind {
DirectiveOpen,
DirectiveClose,
ChordOpen,
ChordClose,
Colon,
Text(String),
Newline,
Eof,
}Expand description
The kind of a token.
These represent the distinct syntactic elements that the lexer recognizes in a ChordPro document.
Variants§
DirectiveOpen
Opening brace { — starts a directive.
DirectiveClose
Closing brace } — ends a directive.
ChordOpen
Opening bracket [ — starts a chord annotation.
ChordClose
Closing bracket ] — ends a chord annotation.
Colon
Colon : — separates a directive name from its value.
Only emitted when the lexer is inside a directive (between { and }).
Text(String)
A run of text content (lyrics, directive names, directive values, chord names, etc.).
The lexer does not interpret text — it simply captures contiguous runs of characters that are not special delimiters.
Newline
A newline character (\n or \r\n).
Eof
End of input.
Trait Implementations§
impl Eq for TokenKind
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Freeze for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnsafeUnpin for TokenKind
impl UnwindSafe for TokenKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more