pub enum Token {
Show 86 variants
IntegerConstant(INT),
FloatConstant(FloatWrapper<FLOAT>),
DecimalConstant(Decimal),
Identifier(Identifier),
CharConstant(char),
StringConstant(SmartString<LazyCompact>),
InterpolatedString(SmartString<LazyCompact>),
LeftBrace,
RightBrace,
LeftParen,
RightParen,
LeftBracket,
RightBracket,
Plus,
UnaryPlus,
Minus,
UnaryMinus,
Multiply,
Divide,
Modulo,
PowerOf,
LeftShift,
RightShift,
SemiColon,
Colon,
DoubleColon,
DoubleArrow,
Underscore,
Comma,
Period,
ExclusiveRange,
InclusiveRange,
MapStart,
Equals,
True,
False,
Let,
Const,
If,
Else,
Switch,
Do,
While,
Until,
Loop,
For,
In,
LessThan,
GreaterThan,
LessThanEqualsTo,
GreaterThanEqualsTo,
EqualsTo,
NotEqualsTo,
Bang,
Pipe,
Or,
XOr,
Ampersand,
And,
Fn,
Continue,
Break,
Return,
Throw,
Try,
Catch,
PlusAssign,
MinusAssign,
MultiplyAssign,
DivideAssign,
LeftShiftAssign,
RightShiftAssign,
AndAssign,
OrAssign,
XOrAssign,
ModuloAssign,
PowerOfAssign,
Private,
Import,
Export,
As,
LexError(Box<LexError>),
Comment(SmartString<LazyCompact>),
Reserved(SmartString<LazyCompact>),
Custom(SmartString<LazyCompact>),
EOF,
}
Expand description
(internals) A Rhai language token.
Exported under the internals
feature only.
Variants
IntegerConstant(INT)
An INT
constant.
FloatConstant(FloatWrapper<FLOAT>)
A FLOAT
constant.
Reserved under the no_float
feature.
DecimalConstant(Decimal)
A Decimal
constant.
Requires the decimal
feature.
Identifier(Identifier)
An identifier.
CharConstant(char)
A character constant.
StringConstant(SmartString<LazyCompact>)
A string constant.
InterpolatedString(SmartString<LazyCompact>)
An interpolated string.
LeftBrace
{
RightBrace
}
LeftParen
(
RightParen
)
LeftBracket
[
RightBracket
]
Plus
+
UnaryPlus
+
(unary)
Minus
-
UnaryMinus
-
(unary)
Multiply
*
Divide
/
Modulo
%
PowerOf
**
LeftShift
<<
RightShift
>>
SemiColon
;
Colon
:
DoubleColon
::
DoubleArrow
=>
Underscore
_
Comma
,
Period
.
ExclusiveRange
..
InclusiveRange
..=
MapStart
#{
Equals
=
True
true
False
false
Let
let
Const
const
If
if
Else
else
Switch
switch
Do
do
While
while
Until
until
Loop
loop
For
for
In
in
LessThan
<
GreaterThan
>
LessThanEqualsTo
<=
GreaterThanEqualsTo
>=
EqualsTo
==
NotEqualsTo
!=
Bang
!
Pipe
|
Or
||
XOr
^
Ampersand
&
And
&&
Fn
fn
Reserved under the no_function
feature.
Continue
continue
Break
break
Return
return
Throw
throw
Try
try
Catch
catch
PlusAssign
+=
MinusAssign
-=
MultiplyAssign
*=
DivideAssign
/=
LeftShiftAssign
<<=
RightShiftAssign
>>=
AndAssign
&=
OrAssign
|=
XOrAssign
^=
ModuloAssign
%=
PowerOfAssign
**=
Private
private
Reserved under the no_function
feature.
Import
import
Reserved under the no_module
feature.
Export
export
Reserved under the no_module
feature.
As
as
Reserved under the no_module
feature.
LexError(Box<LexError>)
A lexer error.
Comment(SmartString<LazyCompact>)
A comment block.
Reserved(SmartString<LazyCompact>)
A reserved symbol.
Custom(SmartString<LazyCompact>)
A custom keyword.
EOF
End of the input stream.
Implementations
sourceimpl Token
impl Token
sourcepub const fn literal_syntax(&self) -> &'static str
pub const fn literal_syntax(&self) -> &'static str
Get the literal syntax of the token.
sourcepub const fn is_op_assignment(&self) -> bool
pub const fn is_op_assignment(&self) -> bool
Is this token an op-assignment operator?
sourcepub const fn get_base_op_from_assignment(&self) -> Option<Self>
pub const fn get_base_op_from_assignment(&self) -> Option<Self>
Get the corresponding operator of the token if it is an op-assignment operator.
sourcepub const fn has_op_assignment(&self) -> bool
pub const fn has_op_assignment(&self) -> bool
Has this token a corresponding op-assignment operator?
sourcepub const fn convert_to_op_assignment(&self) -> Option<Self>
pub const fn convert_to_op_assignment(&self) -> Option<Self>
Get the corresponding op-assignment operator of the token.
sourcepub fn lookup_from_syntax(syntax: &str) -> Option<Self>
pub fn lookup_from_syntax(syntax: &str) -> Option<Self>
Reverse lookup a token from a piece of syntax.
pub const fn is_eof(&self) -> bool
pub const fn is_next_unary(&self) -> bool
sourcepub const fn precedence(&self) -> Option<NonZeroU8>
pub const fn precedence(&self) -> Option<NonZeroU8>
Get the precedence number of the token.
sourcepub const fn is_bind_right(&self) -> bool
pub const fn is_bind_right(&self) -> bool
Does an expression bind to the right (instead of left)?
sourcepub const fn is_standard_symbol(&self) -> bool
pub const fn is_standard_symbol(&self) -> bool
Is this token a standard symbol used in the language?
sourcepub const fn is_standard_keyword(&self) -> bool
pub const fn is_standard_keyword(&self) -> bool
Is this token a standard keyword?
sourcepub const fn is_reserved(&self) -> bool
pub const fn is_reserved(&self) -> bool
Is this token a reserved keyword or symbol?
Trait Implementations
impl StructuralPartialEq for Token
Auto Trait Implementations
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more