pub enum TokenKind {
Keyword(Keyword),
Ident,
Int,
Float,
Char,
Str,
Punct(Punct),
Eof,
}Expand description
What a token is.
Two bytes, so that a Token fits in sixteen. The categories that carry a value carry it
in the token’s value field instead of in the variant, which is what keeps it that small.
Variants§
Keyword(Keyword)
A keyword in this dialect.
Ident
An identifier, whose symbol is in Token::value.
Int
An integer constant, indexed by Token::value into Tokens::ints.
Float
A floating constant, indexed by Token::value into Tokens::floats.
Char
A character constant, indexed by Token::value into Tokens::chars.
Str
A string literal, indexed by Token::value into Tokens::strings. One token per run
of adjacent literals, because that is one literal.
Punct(Punct)
A punctuator.
Eof
End of the translation unit.
Trait Implementations§
impl Copy for TokenKind
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