pub enum TokenKind {
Show 64 variants
HexLiteral(String),
Eof,
Comment(String),
Div,
Define,
Include,
Macro,
Fn,
Test,
Function,
Event,
Constant,
Error,
Takes,
Returns,
View,
Pure,
Payable,
NonPayable,
Indexed,
FreeStoragePointer,
Noop,
Ident(String),
Assign,
OpenParen,
CloseParen,
OpenBracket,
CloseBracket,
OpenBrace,
CloseBrace,
LeftAngle,
RightAngle,
Add,
Sub,
Mul,
Mod,
EqualEqual,
NotEqual,
LessEqual,
GreaterEqual,
Not,
Comma,
Colon,
Pound,
Integer(usize),
Whitespace,
Str(String),
Opcode(Opcode),
Label(String),
PrimitiveType(PrimitiveEVMType),
ArrayType(PrimitiveEVMType, Vec<usize>),
JumpTable,
JumpTablePacked,
CodeTable,
BuiltinFunction(String),
Calldata,
Memory,
Storage,
For,
In,
Step,
DoubleDot,
If,
Else,
}Expand description
The kind of token
Variants§
HexLiteral(String)
Hexadecimal literal (e.g., 0x42, 0x1234) - hex string with even number of characters
Eof
EOF Token
Comment(String)
A Comment
Div
Division Lexing done at the comment level due to clash
Define
“#define” keyword
Include
“#include” keyword
Macro
“macro” keyword
Fn
“fn” keyword
Test
“test” keyword
Function
“function” keyword
Event
“event” keyword
Constant
“constant” keyword
Error
“error” keyword
Takes
“takes” keyword
Returns
“returns” keyword
View
“view” keyword
Pure
“pure” keyword
Payable
“payable” keyword
NonPayable
“nonpayable” keyword
Indexed
“indexed” keyword
FreeStoragePointer
“FREE_STORAGE_POINTER()” keyword
Noop
“__NOOP” builtin constant
Ident(String)
An Identifier
Assign
Equal Sign
OpenParen
An open parenthesis
CloseParen
A close parenthesis
OpenBracket
An open bracket
CloseBracket
A close bracket
OpenBrace
An open brace
CloseBrace
A close brace
LeftAngle
A Less-Than Angle Bracket
RightAngle
A Greater-Than Angle Bracket
Add
Addition
Sub
Subtraction
Mul
Multiplication
Mod
Modulo
EqualEqual
Equal comparison (==)
NotEqual
Not equal comparison (!=)
LessEqual
Less than or equal (<=)
GreaterEqual
Greater than or equal (>=)
Not
Logical NOT (!)
Comma
A comma
Colon
A Colon
Pound
A pound
Integer(usize)
Integer literal (decimal number)
Whitespace
A Space
Str(String)
A string literal
Opcode(Opcode)
Opcode
Label(String)
Huff label (aka PC)
PrimitiveType(PrimitiveEVMType)
EVM Type
ArrayType(PrimitiveEVMType, Vec<usize>)
Array of EVM Types
uint256[5][2][3] => ArrayType(PrimitiveEVMType::Uint(256), [5, 2, 3])
JumpTable
A Jump Table
JumpTablePacked
A Packed Jump Table
CodeTable
A Code Table
BuiltinFunction(String)
A builtin function (__codesize, __tablesize, __tablestart)
Calldata
Calldata Data Location
Memory
Memory Data Location
Storage
Storage Data Location
For
“for” keyword
In
“in” keyword
Step
“step” keyword
DoubleDot
“..” range operator
If
“if” keyword
Else
“else” keyword
Implementations§
Source§impl TokenKind
impl TokenKind
Sourcepub fn into_single_span(
self,
position: u32,
file: Option<Arc<FileSource>>,
) -> Token
pub fn into_single_span( self, position: u32, file: Option<Arc<FileSource>>, ) -> Token
Transform a single char TokenKind into a Token given a single position
Sourcepub fn into_span(
self,
start: u32,
end: u32,
file: Option<Arc<FileSource>>,
) -> Token
pub fn into_span( self, start: u32, end: u32, file: Option<Arc<FileSource>>, ) -> Token
Transform a TokenKind into a Token given a start and end position
Sourcepub fn into_token_with_span(self, span: Span) -> Token
pub fn into_token_with_span(self, span: Span) -> Token
Transform a TokenKind into a Token given a Span
Trait Implementations§
impl Eq for TokenKind
Source§impl Ord for TokenKind
impl Ord for TokenKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TokenKind
impl PartialOrd for TokenKind
impl StructuralPartialEq for TokenKind
Auto Trait Implementations§
impl Freeze for TokenKind
impl RefUnwindSafe for TokenKind
impl Send for TokenKind
impl Sync for TokenKind
impl Unpin for TokenKind
impl UnsafeUnpin for TokenKind
impl UnwindSafe for TokenKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
HexLiteral: 32 bytesEof: 0 bytesComment: 32 bytesDiv: 0 bytesDefine: 0 bytesInclude: 0 bytesMacro: 0 bytesFn: 0 bytesTest: 0 bytesFunction: 0 bytesEvent: 0 bytesConstant: 0 bytesError: 0 bytesTakes: 0 bytesReturns: 0 bytesView: 0 bytesPure: 0 bytesPayable: 0 bytesNonPayable: 0 bytesIndexed: 0 bytesFreeStoragePointer: 0 bytesNoop: 0 bytesIdent: 32 bytesAssign: 0 bytesOpenParen: 0 bytesCloseParen: 0 bytesOpenBracket: 0 bytesCloseBracket: 0 bytesOpenBrace: 0 bytesCloseBrace: 0 bytesLeftAngle: 0 bytesRightAngle: 0 bytesAdd: 0 bytesSub: 0 bytesMul: 0 bytesMod: 0 bytesEqualEqual: 0 bytesNotEqual: 0 bytesLessEqual: 0 bytesGreaterEqual: 0 bytesNot: 0 bytesComma: 0 bytesColon: 0 bytesPound: 0 bytesInteger: 16 bytesWhitespace: 0 bytesStr: 32 bytesOpcode: 9 bytesLabel: 32 bytesPrimitiveType: 24 bytesArrayType: 40 bytesJumpTable: 0 bytesJumpTablePacked: 0 bytesCodeTable: 0 bytesBuiltinFunction: 32 bytesCalldata: 0 bytesMemory: 0 bytesStorage: 0 bytesFor: 0 bytesIn: 0 bytesStep: 0 bytesDoubleDot: 0 bytesIf: 0 bytesElse: 0 bytes