Enum erg_parser::token::TokenKind

source ·
#[repr(u8)]
pub enum TokenKind {
Show 86 variants Symbol = 0, NatLit = 1, IntLit = 2, BinLit = 3, OctLit = 4, HexLit = 5, RatioLit = 6, BoolLit = 7, StrLit = 8, StrInterpLeft = 9, StrInterpMid = 10, StrInterpRight = 11, NoneLit = 12, EllipsisLit = 13, InfLit = 14, DocComment = 15, PrePlus = 16, PreMinus = 17, PreBitNot = 18, Mutate = 19, PreStar = 20, PreDblStar = 21, Try = 22, Plus = 23, Minus = 24, Star = 25, Slash = 26, FloorDiv = 27, Pow = 28, Mod = 29, Closed = 30, RightOpen = 31, LeftOpen = 32, Open = 33, BitAnd = 34, BitOr = 35, BitXor = 36, Shl = 37, Shr = 38, Less = 39, Gre = 40, LessEq = 41, GreEq = 42, DblEq = 43, NotEq = 44, InOp = 45, NotInOp = 46, ContainsOp = 47, SubOp = 48, IsOp = 49, IsNotOp = 50, AndOp = 51, OrOp = 52, RefOp = 53, RefMutOp = 54, Assign = 55, Inclusion = 56, Walrus = 57, FuncArrow = 58, ProcArrow = 59, LParen = 60, RParen = 61, LSqBr = 62, RSqBr = 63, LBrace = 64, RBrace = 65, Indent = 66, Dedent = 67, Dot = 68, Pipe = 69, Colon = 70, DblColon = 71, SupertypeOf = 72, SubtypeOf = 73, As = 74, Comma = 75, Caret = 76, Amper = 77, AtSign = 78, VBar = 79, UBar = 80, Newline = 81, Semi = 82, Illegal = 83, BOF = 84, EOF = 85,
}
Expand description

意味論的名前と記号自体の名前が混在しているが、Pythonの名残である

Variants§

§

Symbol = 0

e.g. i, p!, $s, T, +, and, ‘d/dx’

§

NatLit = 1

e.g. 0, 1

§

IntLit = 2

e.g. -1, -2

§

BinLit = 3

e.g. 0b101

§

OctLit = 4

e.g. 0o777

§

HexLit = 5

e.g. 0xdeadbeef

§

RatioLit = 6

§

BoolLit = 7

§

StrLit = 8

§

StrInterpLeft = 9

e.g. “abc{

§

StrInterpMid = 10

e.g. }abc{

§

StrInterpRight = 11

e.g. }def“

§

NoneLit = 12

§

EllipsisLit = 13

… (== Ellipsis)

§

InfLit = 14

§

DocComment = 15

§

PrePlus = 16

+ (unary)

§

PreMinus = 17

- (unary)

§

PreBitNot = 18

~ (unary)

§

Mutate = 19

! (unary)

§

PreStar = 20

§

PreDblStar = 21

§

Try = 22

? (postfix)

§

Plus = 23

+

§

Minus = 24

-

§

Star = 25

*

§

Slash = 26

/

§

FloorDiv = 27

//

§

Pow = 28

**

§

Mod = 29

%

§

Closed = 30

..

§

RightOpen = 31

..<

§

LeftOpen = 32

<..

§

Open = 33

<..<

§

BitAnd = 34

&&

§

BitOr = 35

||

§

BitXor = 36

^^

§

Shl = 37

<<

§

Shr = 38

§

Less = 39

<

§

Gre = 40

§

LessEq = 41

<=

§

GreEq = 42

=

§

DblEq = 43

==

§

NotEq = 44

!=

§

InOp = 45

in

§

NotInOp = 46

notin

§

ContainsOp = 47

§

SubOp = 48

sub (subtype of)

§

IsOp = 49

is!

§

IsNotOp = 50

isnot!

§

AndOp = 51

and

§

OrOp = 52

or

§

RefOp = 53

ref (special unary)

§

RefMutOp = 54

ref! (special unary)

§

Assign = 55

=

§

Inclusion = 56

<-

§

Walrus = 57

:=

§

FuncArrow = 58

->

§

ProcArrow = 59

=>

§

LParen = 60

(

§

RParen = 61

)

§

LSqBr = 62

[

§

RSqBr = 63

]

§

LBrace = 64

{

§

RBrace = 65

}

§

Indent = 66

§

Dedent = 67

§

Dot = 68

.

§

Pipe = 69

|>

§

Colon = 70

:

§

DblColon = 71

::

§

SupertypeOf = 72

:>

§

SubtypeOf = 73

<:

§

As = 74

as

§

Comma = 75

,

§

Caret = 76

^

§

Amper = 77

&

§

AtSign = 78

@

§

VBar = 79

|

§

UBar = 80

_

§

Newline = 81

\n

§

Semi = 82

;

§

Illegal = 83

§

BOF = 84

Beginning Of File

§

EOF = 85

Implementations§

source§

impl TokenKind

source

pub const fn category(&self) -> TokenCategory

source

pub const fn precedence(&self) -> Option<usize>

source

pub const fn is_right_associative(&self) -> bool

source

pub const fn is_range_op(&self) -> bool

Trait Implementations§

source§

impl Clone for TokenKind

source§

fn clone(&self) -> TokenKind

Returns a copy 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 TokenKind

source§

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

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

impl Display for TokenKind

source§

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

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

impl From<TokenKind> for BinOpCode

source§

fn from(tk: TokenKind) -> Self

Converts to this type from the input type.
source§

impl Hash for TokenKind

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl PartialEq for TokenKind

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TokenKind

source§

impl Eq for TokenKind

source§

impl StructuralPartialEq for TokenKind

Auto Trait Implementations§

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

§

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§

default 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>,

§

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

§

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.