pub enum TokenKind<'s> {
Eof,
Identifier(&'s str),
Ordinal(i32),
Number(f64, Box<NumberInfo<'s>>),
String(Cow<'s, str>, Box<StringInfo<'s>>),
InterpolatedString(Vec<(Cow<'s, str>, Vec<Token<'s>>, &'s str)>, Box<StringInfo<'s>>),
Operator(Operator),
Keyword(Keyword),
Unknown {
recovered: Box<TokenKind<'s>>,
errors: Vec<SourceDiagnostic>,
},
Empty,
}Variants§
Eof
Identifier(&'s str)
Ordinal(i32)
Number(f64, Box<NumberInfo<'s>>)
String(Cow<'s, str>, Box<StringInfo<'s>>)
InterpolatedString(Vec<(Cow<'s, str>, Vec<Token<'s>>, &'s str)>, Box<StringInfo<'s>>)
Interpolated string, stored as a tuple of the string parts, the tokens that are interpolated, and format string of tokens. The last tuple element is the string part after the last interpolation, with the tokens and format being empty.
Operator(Operator)
Keyword(Keyword)
Unknown
Empty
Contains no token, only position information.
Implementations§
Source§impl<'s> TokenKind<'s>
impl<'s> TokenKind<'s>
Sourcepub const fn is_identifier(&self) -> bool
pub const fn is_identifier(&self) -> bool
Returns true if the enum is TokenKind::Identifier otherwise false
Sourcepub const fn is_ordinal(&self) -> bool
pub const fn is_ordinal(&self) -> bool
Returns true if the enum is TokenKind::Ordinal otherwise false
Sourcepub const fn is_number(&self) -> bool
pub const fn is_number(&self) -> bool
Returns true if the enum is TokenKind::Number otherwise false
Sourcepub const fn is_string(&self) -> bool
pub const fn is_string(&self) -> bool
Returns true if the enum is TokenKind::String otherwise false
Sourcepub const fn is_interpolated_string(&self) -> bool
pub const fn is_interpolated_string(&self) -> bool
Returns true if the enum is TokenKind::InterpolatedString otherwise false
Sourcepub const fn is_operator(&self) -> bool
pub const fn is_operator(&self) -> bool
Returns true if the enum is TokenKind::Operator otherwise false
Sourcepub const fn is_keyword(&self) -> bool
pub const fn is_keyword(&self) -> bool
Returns true if the enum is TokenKind::Keyword otherwise false
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if the enum is TokenKind::Unknown otherwise false