Skip to main content

TokenKind

Enum TokenKind 

Source
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

Source

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

Source

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

Source

pub fn into_token_with_span(self, span: Span) -> Token

Transform a TokenKind into a Token given a Span

Trait Implementations§

Source§

impl Clone for TokenKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Eq for TokenKind

Source§

impl From<TokenKind> for TableKind

Source§

fn from(token_kind: TokenKind) -> Self

Public associated function that converts a TokenKind to a TableKind

Source§

impl Ord for TokenKind

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for TokenKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for TokenKind

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
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> 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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

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 bytes
  • Eof: 0 bytes
  • Comment: 32 bytes
  • Div: 0 bytes
  • Define: 0 bytes
  • Include: 0 bytes
  • Macro: 0 bytes
  • Fn: 0 bytes
  • Test: 0 bytes
  • Function: 0 bytes
  • Event: 0 bytes
  • Constant: 0 bytes
  • Error: 0 bytes
  • Takes: 0 bytes
  • Returns: 0 bytes
  • View: 0 bytes
  • Pure: 0 bytes
  • Payable: 0 bytes
  • NonPayable: 0 bytes
  • Indexed: 0 bytes
  • FreeStoragePointer: 0 bytes
  • Noop: 0 bytes
  • Ident: 32 bytes
  • Assign: 0 bytes
  • OpenParen: 0 bytes
  • CloseParen: 0 bytes
  • OpenBracket: 0 bytes
  • CloseBracket: 0 bytes
  • OpenBrace: 0 bytes
  • CloseBrace: 0 bytes
  • LeftAngle: 0 bytes
  • RightAngle: 0 bytes
  • Add: 0 bytes
  • Sub: 0 bytes
  • Mul: 0 bytes
  • Mod: 0 bytes
  • EqualEqual: 0 bytes
  • NotEqual: 0 bytes
  • LessEqual: 0 bytes
  • GreaterEqual: 0 bytes
  • Not: 0 bytes
  • Comma: 0 bytes
  • Colon: 0 bytes
  • Pound: 0 bytes
  • Integer: 16 bytes
  • Whitespace: 0 bytes
  • Str: 32 bytes
  • Opcode: 9 bytes
  • Label: 32 bytes
  • PrimitiveType: 24 bytes
  • ArrayType: 40 bytes
  • JumpTable: 0 bytes
  • JumpTablePacked: 0 bytes
  • CodeTable: 0 bytes
  • BuiltinFunction: 32 bytes
  • Calldata: 0 bytes
  • Memory: 0 bytes
  • Storage: 0 bytes
  • For: 0 bytes
  • In: 0 bytes
  • Step: 0 bytes
  • DoubleDot: 0 bytes
  • If: 0 bytes
  • Else: 0 bytes