pub enum TokenType {
Show 62 variants And, Break, Do, Else, ElseIf, End, False, For, Function, Goto, IDiv, If, In, Local, Nil, Not, Or, Repeat, Return, Then, True, Until, While, Concat, Dots, Eq, Ge, Le, Ne, Shl, Shr, DbColon, Eos, Flt, Int, Name, String, Lp, Rp, Ls, Rs, Lb, Rb, Add, Minus, Mul, Div, Mod, Pow, Len, Assign, Lt, Gt, BAnd, BOr, BXor, Colon, Comma, Semi, Attr, SComment, MComment,
}

Variants§

§

And

§

Break

§

Do

§

Else

§

ElseIf

§

End

§

False

§

For

§

Function

§

Goto

§

IDiv

§

If

§

In

§

Local

§

Nil

§

Not

§

Or

§

Repeat

§

Return

§

Then

§

True

§

Until

§

While

§

Concat

§

Dots

§

Eq

§

Ge

§

Le

§

Ne

§

Shl

§

Shr

§

DbColon

§

Eos

§

Flt

§

Int

§

Name

§

String

§

Lp

§

Rp

§

Ls

§

Rs

§

Lb

§

Rb

§

Add

§

Minus

§

Mul

§

Div

§

Mod

§

Pow

§

Len

§

Assign

§

Lt

§

Gt

§

BAnd

§

BOr

§

BXor

§

Colon

§

Comma

§

Semi

§

Attr

§

SComment

§

MComment

Implementations§

Examples found in repository?
src/lexer.rs (line 612)
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
    fn read_other_tokens(&mut self, ctx: &mut Context) -> LexResult {
        if let Some(c) = ctx.get() {
            let token_type = match c {
                b'+' => Some(TokenType::Add),
                b'-' => Some(TokenType::Minus),
                b'*' => Some(TokenType::Mul),
                b'/' => Some(TokenType::Div),
                b'%' => Some(TokenType::Mod),
                b'^' => Some(TokenType::Pow),
                b'#' => Some(TokenType::Len),
                b'&' => Some(TokenType::BAnd),
                b'|' => Some(TokenType::BOr),
                b'(' => Some(TokenType::Lp),
                b')' => Some(TokenType::Rp),
                b'[' => Some(TokenType::Ls),
                b']' => Some(TokenType::Rs),
                b'{' => Some(TokenType::Lb),
                b'}' => Some(TokenType::Rb),
                b';' => Some(TokenType::Semi),
                b',' => Some(TokenType::Comma),
                _ => None,
            };

            if let Some(t) = token_type {
                ctx.next();
                return success!((t, TokenValue::None));
            } else if self.check_current_if(ctx, |c| Lexer::is_valid_name_start(c)) {
                let mut word: Vec<u8> = Vec::new();
                ctx.write_into(1, &mut word);
                while self.check_current_if(ctx, |c| Lexer::is_valid_name(c)) {
                    ctx.write_into(1, &mut word);
                }
                if let Ok(s) = str::from_utf8(&word) {
                    if let Some(t) = TokenType::from_keyword(s) {
                        return success!((t, TokenValue::None));
                    } else {
                        return success!((TokenType::Name, TokenValue::Str(s.to_string())));
                    }
                }
            } else {
                return lex_error!(self, ctx, &format!("unknown token near {}", c as char));
            }
        }
        unreachable!()
    }

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
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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
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.