[][src]Enum rhai::Token

pub enum Token {
    IntegerConstant(INT),
    FloatConstant(FLOAT),
    Identifier(String),
    CharConstant(char),
    StringConstant(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,
}

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

WARNING

This type is volatile and may change.

Variants

IntegerConstant(INT)

An INT constant.

FloatConstant(FLOAT)

A FLOAT constant.

Reserved under the no_float feature.

Identifier(String)

An identifier.

CharConstant(char)

A character constant.

StringConstant(String)

A string constant.

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 syntax(&self) -> Cow<'static, str>[src]

Get the syntax 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) -> u8[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_operator(&self) -> bool[src]

Is this token an operator?

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]

impl Debug for Token[src]

impl From<Token> for String[src]

impl PartialEq<Token> for Token[src]

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]

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.