Enum Token

Source
pub enum Token {
Show 111 variants Abstract, Assert, Boolean, Break, Byte, Case, Catch, Char, Class, Const, Continue, Default, Do, Double, Else, Enum, Extends, Final, Finally, Float, For, If, Implements, Import, Instanceof, Int, Interface, Long, Native, New, Package, Private, Protected, Public, Return, Short, Static, Strictfp, Super, Switch, Synchronized, This, Throw, Throws, Transient, Try, Void, Volatile, While, Comment { text: String, single_line: bool, }, Identifier(String), BooleanLiteral(bool), CharLiteral(char), IntegerLiteral(i32), DoubleLiteral(f64), FloatLiteral(f32), HexLiteral(u32), OctLiteral(u32), BinLiteral(u32), StringLiteral(String), NullLiteral, ShiftRight, UnsignedShiftRight, SemiColon, Comma, Dot, LeftParen, RightParen, LeftBrace, RightBrace, LeftBracket, RightBracket, JavaDoc(String), UnsignedShiftRightAssign, ShiftRightAssign, ShiftLeftAssign, ModAssign, XorAssign, OrAssign, AndAssign, SlashAssign, StarAssign, MinusAssign, PlusAssign, ShiftLeft, DoubleMinus, DoublePlus, LogicalOr, LogicalAnd, NotEqual, GreaterThanOrEqual, LessThanOrEqual, DoubleEqual, Mod, Xor, Or, And, Slash, Star, Minus, Plus, Colon, Question, Not, LogicalNot, LessThan, GreaterThan, Assign, TripleDot, Arrow, DoubleColon,
}

Variants§

§

Abstract

abstract

§

Assert

assert

§

Boolean

boolean

§

Break

break

§

Byte

byte

§

Case

case

§

Catch

catch

§

Char

char

§

Class

class

§

Const

const

§

Continue

continue

§

Default

default

§

Do

do

§

Double

double

§

Else

else

§

Enum

enum

§

Extends

extends

§

Final

final

§

Finally

finally

§

Float

float

§

For

for

§

If

if

§

Implements

implements

§

Import

import

§

Instanceof

instanceof

§

Int

int

§

Interface

interface

§

Long

long

§

Native

native

§

New

new

§

Package

package

§

Private

private

§

Protected

protected

§

Public

public

§

Return

return

§

Short

short

§

Static

static

§

Strictfp

strictfp

§

Super

super

§

Switch

switch

§

Synchronized

synchronized

§

This

this

§

Throw

throw

§

Throws

throws

§

Transient

transient

§

Try

try

§

Void

void

§

Volatile

volatile

§

While

while

§

Comment

注释

Fields

§text: String
§single_line: bool
§

Identifier(String)

任意有效标识符

§

BooleanLiteral(bool)

任意布尔值

§

CharLiteral(char)

任意字符字面量

§

IntegerLiteral(i32)

任意有效整数字面量

§

DoubleLiteral(f64)

任意双精度小数字面量

§

FloatLiteral(f32)

任意浮点数字面量

§

HexLiteral(u32)

任意十六进制数字

§

OctLiteral(u32)

任意八进制数字

§

BinLiteral(u32)

任意二进制数字

§

StringLiteral(String)

任意字符串字面量

§

NullLiteral

空值字面量

§

ShiftRight

右移 >>

§

UnsignedShiftRight

无符号右移 >>>

§

SemiColon

分号 ;

§

Comma

逗号 ,

§

Dot

. (用于访问成员)

§

LeftParen

左括号 ( (用于方法调用或类型转换)

§

RightParen

右括号 ) (用于方法调用或类型转换)

§

LeftBrace

左大括号 { (用于代码块或对象初始化)

§

RightBrace

右大括号 } (用于代码块或对象初始化)

§

LeftBracket

左方括号 [ (用于数组访问)

§

RightBracket

右方括号 ] (用于数组访问)

§

JavaDoc(String)

Java文档注释

§

UnsignedShiftRightAssign

无符号右移赋值 >>>=

§

ShiftRightAssign

右移赋值 >>=

§

ShiftLeftAssign

左移赋值 <<=

§

ModAssign

取模赋值 %=

§

XorAssign

位异或赋值 ^=

§

OrAssign

位或赋值 |=

§

AndAssign

位与赋值 &=

§

SlashAssign

除法赋值 /=

§

StarAssign

乘法赋值 *=

§

MinusAssign

减法赋值 -=

§

PlusAssign

加法赋值 +=

§

ShiftLeft

左移 <<

§

DoubleMinus

双减 -- (用于自减)

§

DoublePlus

双加 ++ (用于自增)

§

LogicalOr

逻辑或 ||

§

LogicalAnd

逻辑与 &&

§

NotEqual

不等于 !=

§

GreaterThanOrEqual

大于等于 >=

§

LessThanOrEqual

小于等于 <=

§

DoubleEqual

双等号 == (用于比较)

§

Mod

取模 %

§

Xor

位异或 ^

§

Or

位或 |

§

And

位与 &

§

Slash

除号 /

§

Star

乘号 *

§

Minus

减号 -

§

Plus

加号 +

§

Colon

冒号 :

§

Question

三元运算符 ?

§

Not

位非 ~

§

LogicalNot

逻辑非 !

§

LessThan

小于 <

§

GreaterThan

大于 >

§

Assign

赋值 =

§

TripleDot

三点 ... (用于可变参数或数组切片)

§

Arrow

箭头 -> (用于Lambda表达式)

§

DoubleColon

双冒号 :: (用于方法引用或包访问)

Implementations§

Source§

impl Token

Source

pub fn is_method_reference(&self) -> bool

Source

pub fn is_keyword(&self) -> bool

Source

pub fn is_modifier(&self) -> bool

Source

pub fn is_basic_type(&self) -> bool

Source

pub fn is_literal(&self) -> bool

Source

pub fn is_integer(&self) -> bool

Source

pub fn is_octal(&self) -> bool

Source

pub fn is_binary(&self) -> bool

Source

pub fn is_double(&self) -> bool

Source

pub fn is_float(&self) -> bool

Source

pub fn is_hex(&self) -> bool

Source

pub fn is_boolean(&self) -> bool

Source

pub fn is_character(&self) -> bool

Source

pub fn is_string(&self) -> bool

Source

pub fn is_null(&self) -> bool

Source

pub fn is_documentation(&self) -> bool

Source

pub fn is_separator(&self) -> bool

Source

pub fn is_operator(&self) -> bool

Source

pub fn is_annotation(&self) -> bool

Source

pub fn is_identifier(&self) -> bool

Trait Implementations§

Source§

impl Clone for Token

Source§

fn clone(&self) -> Token

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Token

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Token

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&str> for Token

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Token

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Token

Auto Trait Implementations§

§

impl Freeze for Token

§

impl RefUnwindSafe for Token

§

impl Send for Token

§

impl Sync for Token

§

impl Unpin for Token

§

impl UnwindSafe for Token

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.