Enum rhai::Token[][src]

pub enum Token {
Show variants IntegerConstant(INT), FloatConstant(FloatWrapper<FLOAT>), DecimalConstant(Decimal), Identifier(String), CharConstant(char), StringConstant(String), InterpolatedString(String), LeftBrace, RightBrace, LeftParen, RightParen, LeftBracket, RightBracket, Plus, UnaryPlus, Minus, UnaryMinus, Multiply, Divide, Modulo, PowerOf, LeftShift, RightShift, SemiColon, Colon, DoubleColon, DoubleArrow, Underscore, Comma, Period, 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(LexError), Comment(String), Reserved(String), Custom(String), EOF,
}
Expand description

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

Volatile Data Structure

This type is volatile and may change.

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(String)

An identifier.

CharConstant(char)

A character constant.

StringConstant(String)

A string constant.

InterpolatedString(String)

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

.

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(LexError)

A lexer error.

Comment(String)

A comment block.

Reserved(String)

A reserved symbol.

Custom(String)

A custom keyword.

EOF

End of the input stream.

Implementations

impl Token[src]

pub fn keyword_syntax(&self) -> &'static str[src]

Get the syntax of the token if it is a keyword.

Panics

Panics if the token is not a keyword.

pub fn syntax(&self) -> Cow<'static, str>[src]

Get the syntax of the token.

pub fn is_op_assignment(&self) -> bool[src]

Is this token an op-assignment operator?

pub fn map_op_assignment(&self) -> Option<Self>[src]

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

pub fn has_op_assignment(&self) -> bool[src]

Has this token a corresponding op-assignment operator?

pub fn make_op_assignment(&self) -> Option<Self>[src]

Get the corresponding op-assignment operator of the token.

pub fn lookup_from_syntax(syntax: &str) -> Option<Self>[src]

Reverse lookup a token from a piece of syntax.

pub fn is_eof(&self) -> bool[src]

pub fn is_next_unary(&self) -> bool[src]

pub fn precedence(&self) -> Option<NonZeroU8>[src]

Get the precedence number of the token.

pub fn is_bind_right(&self) -> bool[src]

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

pub fn is_symbol(&self) -> bool[src]

Is this token a standard symbol used in the language?

pub fn is_keyword(&self) -> bool[src]

Is this token an active standard keyword?

pub fn is_reserved(&self) -> bool[src]

Is this token a reserved symbol?

pub fn is_custom(&self) -> bool[src]

Is this token a custom keyword?

Trait Implementations

impl Clone for Token[src]

fn clone(&self) -> Token[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Token[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Hash for Token[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<Token> for Token[src]

fn eq(&self, other: &Token) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Token) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for Token[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CallHasher for T where
    T: Hash + ?Sized
[src]

pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
    H: Hash + ?Sized,
    B: BuildHasher
[src]

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.