Skip to main content

TokenKind

Enum TokenKind 

Source
pub enum TokenKind {
Show 21 variants Shebang(String), LParen, RParen, LBrace, RBrace, LBracket, RBracket, Quote, Quasiquote, Unquote, UnquoteSplice, Str(String), Int(i64), Float(f64), Bool(bool), Nil, Symbol(String), Keyword(String), LineComment(String), Newlines(u32), Whitespace,
}
Expand description

The typed variant discriminator on the caixa-ast lexer surface — every Token’s carrying-shape (delimiter, reader-macro, atom, trivia) projects through this closed twenty-one-arm partition.

The gen_platform::IsVariant derive emits per-arm arm-discriminator predicates — Self::is_l_paren, Self::is_r_paren, Self::is_l_brace, Self::is_r_brace, Self::is_l_bracket, Self::is_r_bracket, Self::is_quote, Self::is_quasiquote, Self::is_unquote, Self::is_unquote_splice, Self::is_str, Self::is_int, Self::is_float, Self::is_bool, Self::is_nil, Self::is_symbol, Self::is_keyword, Self::is_shebang, Self::is_line_comment, Self::is_newlines, Self::is_whitespace — so every downstream consumer that only needs the arm-discriminator projection (not the borrowed field value) reaches for one typed dispatch on the substrate primitive rather than a hand-rolled matches!(k, TokenKind::X | TokenKind::Y(_)) literal. Peer of the sibling crate::NodeKind / crate::trivia::TriviaKind IsVariant lifts already on the caixa-ast surface (7f6aa98 / 44873ae) — extends the same discipline onto the token-family axis every downstream lexer / parser / authoring consumer partitions on (the internal tokenize test-harness trivia filter today, a future caixa-lint no-tab-indentation or no-map-in-defcaixa-slot rule that walks tokens before parsing).

Variants§

§

Shebang(String)

A verbatim #!… first line. See crate::trivia::TriviaKind::Shebang.

§

LParen

§

RParen

§

LBrace

§

RBrace

§

LBracket

§

RBracket

§

Quote

§

Quasiquote

§

Unquote

§

UnquoteSplice

§

Str(String)

§

Int(i64)

§

Float(f64)

§

Bool(bool)

§

Nil

§

Symbol(String)

§

Keyword(String)

§

LineComment(String)

§

Newlines(u32)

§

Whitespace

Implementations§

Source§

impl TokenKind

Source

pub const fn is_shebang(&self) -> bool

Source

pub const fn is_l_paren(&self) -> bool

Source

pub const fn is_r_paren(&self) -> bool

Source

pub const fn is_l_brace(&self) -> bool

Source

pub const fn is_r_brace(&self) -> bool

Source

pub const fn is_l_bracket(&self) -> bool

Source

pub const fn is_r_bracket(&self) -> bool

Source

pub const fn is_quote(&self) -> bool

Source

pub const fn is_quasiquote(&self) -> bool

Source

pub const fn is_unquote(&self) -> bool

Source

pub const fn is_unquote_splice(&self) -> bool

Source

pub const fn is_str(&self) -> bool

Source

pub const fn is_int(&self) -> bool

Source

pub const fn is_float(&self) -> bool

Source

pub const fn is_bool(&self) -> bool

Source

pub const fn is_nil(&self) -> bool

Source

pub const fn is_symbol(&self) -> bool

Source

pub const fn is_keyword(&self) -> bool

Source

pub const fn is_line_comment(&self) -> bool

Source

pub const fn is_newlines(&self) -> bool

Source

pub const fn is_whitespace(&self) -> bool

Trait Implementations§

Source§

impl Clone for TokenKind

Source§

fn clone(&self) -> TokenKind

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 PartialEq for TokenKind

Source§

fn eq(&self, other: &TokenKind) -> 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 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
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, 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, <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.