Skip to main content

TokenTy

Enum TokenTy 

Source
pub enum TokenTy {
Show 120 variants LeftCurly, RightCurly, LeftBracket, RightBracket, LeftParen, RightParen, Plus, PlusEq, Star, StarEq, Div, DivEq, Xor, XorEq, Mod, ModEq, Bang, BangEq, Minus, MinusEq, SingleArrow, Eq, EqEq, DoubleArrow, Lt, LtEq, LtLt, LtLtEq, Gt, GtEq, GtGt, GtGtEq, And, AndEq, AndAnd, Or, OrEq, OrOr, Colon, ColonEq, ColonColon, Dot, DotDot, DotDotEq, At, Tilde, Semi, Comma, Hash, Question, Dollar, Underscore, Identifier, LineComment, BlockComment, OuterDocComment, OuterBlockDocComment, InnerDocComment, InnerBlockDocComment, UnterminatedBlockComment, KwRecord, KwType, KwEnum, KwUnion, KwFunc, KwPure, KwNaked, KwUnsafe, KwRepr, KwImpl, KwConstrain, KwConstraint, KwReferences, KwTrait, KwUse, KwAs, KwConst, KwMod, KwIf, KwElse, KwMatch, KwFor, KwIn, KwWhile, KwTrue, KwFalse, KwLoop, KwWhere, KwPub, KwReturn, KwBreak, KwContinue, KwLet, KwVar, KwBool, KwU8, KwI8, KwU16, KwI16, KwU32, KwI32, KwF32, KwU64, KwI64, KwF64, KwChar, IntegerLiteral, FloatLiteral, StringLiteral, FormatStringLiteral, CharLiteral, UnterminatedStringLiteral, UnterminatedFormatStringLiteral, UnterminatedCharLiteral, Whitespace, Unknown, EOF, EOFExpr, EOFTy, Error,
}
Available on crate feature lexer only.
Expand description

The different types of tokens in wright source.

This enum is also used directly as the terminal type of the generated parser (see crate::parser), which is why every variant is field-less and the names line up with the token names in src/parser/wright.llw.

Variants§

§

LeftCurly

§

RightCurly

§

LeftBracket

§

RightBracket

§

LeftParen

§

RightParen

§

Plus

§

PlusEq

§

Star

§

StarEq

§

Div

§

DivEq

§

Xor

§

XorEq

§

Mod

§

ModEq

§

Bang

§

BangEq

§

Minus

§

MinusEq

§

SingleArrow

§

Eq

§

EqEq

§

DoubleArrow

§

Lt

§

LtEq

§

LtLt

§

LtLtEq

§

Gt

§

GtEq

§

GtGt

§

GtGtEq

§

And

§

AndEq

§

AndAnd

§

Or

§

OrEq

§

OrOr

§

Colon

§

ColonEq

§

ColonColon

§

Dot

§

DotDot

§

DotDotEq

§

At

§

Tilde

§

Semi

§

Comma

§

Hash

§

Question

§

Dollar

§

Underscore

§

Identifier

§

LineComment

A non-documenting // ... comment.

§

BlockComment

A non-documenting /* ... */ comment.

§

OuterDocComment

A /// ... comment documenting the item that follows it.

§

OuterBlockDocComment

A /** ... */ comment documenting the item that follows it.

§

InnerDocComment

A //! ... comment documenting the enclosing item (or file).

§

InnerBlockDocComment

A /*! ... */ comment documenting the enclosing item (or file).

§

UnterminatedBlockComment

Indicates a block style comment without termination. Separate from the other comment variants to indicate that unterminated comments will be handled differently (they produce errors).

§

KwRecord

§

KwType

§

KwEnum

§

KwUnion

§

KwFunc

§

KwPure

§

KwNaked

§

KwUnsafe

§

KwRepr

§

KwImpl

§

KwConstrain

§

KwConstraint

§

KwReferences

§

KwTrait

§

KwUse

§

KwAs

§

KwConst

§

KwMod

§

KwIf

§

KwElse

§

KwMatch

§

KwFor

§

KwIn

§

KwWhile

§

KwTrue

§

KwFalse

§

KwLoop

§

KwWhere

§

KwPub

§

KwReturn

§

KwBreak

§

KwContinue

§

KwLet

§

KwVar

§

KwBool

§

KwU8

§

KwI8

§

KwU16

§

KwI16

§

KwU32

§

KwI32

§

KwF32

§

KwU64

§

KwI64

§

KwF64

§

KwChar

§

IntegerLiteral

§

FloatLiteral

§

StringLiteral

§

FormatStringLiteral

§

CharLiteral

§

UnterminatedStringLiteral

A string literal that reached the end of the source before its closing ".

§

UnterminatedFormatStringLiteral

A format string literal that reached the end of the source before its closing `.

§

UnterminatedCharLiteral

A character literal that reached the end of the source before its closing '.

§

Whitespace

Whitespace counts as a token.

§

Unknown

Unknown character in lexer fragment.

§

EOF

End of input. Never produced by the Lexer – used internally by the parser.

§

EOFExpr

End of input when parsing a single expression. Never produced by the Lexer – used internally by the parser.

§

EOFTy

End of input when parsing a single type signature. Never produced by the Lexer – used internally by the parser.

§

Error

A token that could not be lexed. Never produced by the Lexer – the parser converts TokenTy::Unknown tokens into this variant, which is always skipped during parsing.

Implementations§

Source§

impl TokenTy

Source

pub const fn is_trivia(self) -> bool

Is this token whitespace or a comment of some kind (including doc comments and unterminated comments)?

Source

pub const fn is_outer_doc_comment(self) -> bool

Is this token a documentation comment that documents the item following it (/// or /** */)?

Source

pub const fn is_inner_doc_comment(self) -> bool

Is this token a documentation comment that documents the enclosing item (//! or /*! */)?

Trait Implementations§

Source§

impl Clone for TokenTy

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 Copy for TokenTy

Source§

impl Debug for TokenTy

Source§

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

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

impl Eq for TokenTy

Source§

impl Hash for TokenTy

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 TokenTy

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 StructuralPartialEq for TokenTy

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

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

Source§

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

Checks if this value is equivalent to the given key. 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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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.