Enum rhai::Token

source ·
#[non_exhaustive]
pub enum Token {
Show 90 variants IntegerConstant(INT), FloatConstant(FloatWrapper<FLOAT>), DecimalConstant(Box<Decimal>), Identifier(Box<Identifier>), CharConstant(char), StringConstant(Box<SmartString<LazyCompact>>), InterpolatedString(Box<SmartString<LazyCompact>>), LeftBrace, RightBrace, LeftParen, RightParen, LeftBracket, RightBracket, Unit, Plus, UnaryPlus, Minus, UnaryMinus, Multiply, Divide, Modulo, PowerOf, LeftShift, RightShift, SemiColon, Colon, DoubleColon, DoubleArrow, Underscore, Comma, Period, Elvis, DoubleQuestion, QuestionBracket, 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(Box<SmartString<LazyCompact>>), Reserved(Box<SmartString<LazyCompact>>), Custom(Box<SmartString<LazyCompact>>), EOF,
}
Expand description

(internals) A Rhai language token. Exported under the internals feature only.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

IntegerConstant(INT)

An INT constant.

FloatConstant(FloatWrapper<FLOAT>)

A FLOAT constant.

Reserved under the no_float feature.

DecimalConstant(Box<Decimal>)

A Decimal constant.

Requires the decimal feature.

Identifier(Box<Identifier>)

An identifier.

CharConstant(char)

A character constant.

StringConstant(Box<SmartString<LazyCompact>>)

A string constant.

InterpolatedString(Box<SmartString<LazyCompact>>)

An interpolated string.

LeftBrace

{

RightBrace

}

LeftParen

(

RightParen

)

LeftBracket

[

RightBracket

]

Unit

()

Plus

+

UnaryPlus

+ (unary)

Minus

-

UnaryMinus

- (unary)

Multiply

*

Divide

/

Modulo

%

PowerOf

**

LeftShift

<<

RightShift

>>

SemiColon

;

Colon

:

DoubleColon

::

DoubleArrow

=>

Underscore

_

Comma

,

Period

.

Elvis

?.

Reserved under the no_object feature.

DoubleQuestion

??

QuestionBracket

?[

Reserved under the no_object feature.

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(Box<SmartString<LazyCompact>>)

A comment block.

Reserved(Box<SmartString<LazyCompact>>)

A reserved symbol.

Custom(Box<SmartString<LazyCompact>>)

A custom keyword.

Not available under no_custom_syntax.

EOF

End of the input stream.

Implementations

Get the literal syntax of the token.

Get the syntax of the token.

Is this token an op-assignment operator?

Get the corresponding operator of the token if it is an op-assignment operator.

Has this token a corresponding op-assignment operator?

Get the corresponding op-assignment operator of the token.

Reverse lookup a symbol token from a piece of syntax.

Is a piece of syntax a reserved keyword?

Is this token EOF?

If another operator is after these, it’s probably a unary operator (not sure about fn name).

Get the precedence number of the token.

Does an expression bind to the right (instead of left)?

Is this token a standard symbol used in the language?

Is this token a standard keyword?

Is this token a reserved keyword or symbol?

Is this token a custom keyword?

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.