pub enum LexicalToken {
    Atom(AtomToken),
    Char(CharToken),
    Float(FloatToken),
    Integer(IntegerToken),
    Keyword(KeywordToken),
    String(StringToken),
    Symbol(SymbolToken),
    Variable(VariableToken),
}
Expand description

Lexical token.

This kind of token is meaningful in lexical analysis.

Variants§

Implementations§

source§

impl LexicalToken

source

pub fn text(&self) -> &str

Returns the original textual representation of this token.

source

pub fn as_atom_token(&self) -> Option<&AtomToken>

Tries to return the reference to the inner AtomToken.

source

pub fn as_char_token(&self) -> Option<&CharToken>

Tries to return the reference to the inner CharToken.

source

pub fn as_float_token(&self) -> Option<&FloatToken>

Tries to return the reference to the inner FloatToken.

source

pub fn as_integer_token(&self) -> Option<&IntegerToken>

Tries to return the reference to the inner IntegerToken.

source

pub fn as_keyword_token(&self) -> Option<&KeywordToken>

Tries to return the reference to the inner KeywordToken.

source

pub fn as_string_token(&self) -> Option<&StringToken>

Tries to return the reference to the inner StringToken.

source

pub fn as_symbol_token(&self) -> Option<&SymbolToken>

Tries to return the reference to the inner SymbolToken.

source

pub fn as_variable_token(&self) -> Option<&VariableToken>

Tries to return the reference to the inner VariableToken.

source

pub fn into_atom_token(self) -> Result<AtomToken, Self>

Tries to return the inner AtomToken.

source

pub fn into_char_token(self) -> Result<CharToken, Self>

Tries to return the inner CharToken.

source

pub fn into_float_token(self) -> Result<FloatToken, Self>

Tries to return the inner FloatToken.

source

pub fn into_integer_token(self) -> Result<IntegerToken, Self>

Tries to return the inner IntegerToken.

source

pub fn into_keyword_token(self) -> Result<KeywordToken, Self>

Tries to return the inner KeywordToken.

source

pub fn into_string_token(self) -> Result<StringToken, Self>

Tries to return the inner StringToken.

source

pub fn into_symbol_token(self) -> Result<SymbolToken, Self>

Tries to return the inner SymbolToken.

source

pub fn into_variable_token(self) -> Result<VariableToken, Self>

Tries to return the inner VariableToken.

Trait Implementations§

source§

impl Clone for LexicalToken

source§

fn clone(&self) -> LexicalToken

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 LexicalToken

source§

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

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

impl Display for LexicalToken

source§

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

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

impl From<AtomToken> for LexicalToken

source§

fn from(f: AtomToken) -> Self

Converts to this type from the input type.
source§

impl From<CharToken> for LexicalToken

source§

fn from(f: CharToken) -> Self

Converts to this type from the input type.
source§

impl From<FloatToken> for LexicalToken

source§

fn from(f: FloatToken) -> Self

Converts to this type from the input type.
source§

impl From<IntegerToken> for LexicalToken

source§

fn from(f: IntegerToken) -> Self

Converts to this type from the input type.
source§

impl From<KeywordToken> for LexicalToken

source§

fn from(f: KeywordToken) -> Self

Converts to this type from the input type.
source§

impl From<LexicalToken> for Token

source§

fn from(f: LexicalToken) -> Self

Converts to this type from the input type.
source§

impl From<StringToken> for LexicalToken

source§

fn from(f: StringToken) -> Self

Converts to this type from the input type.
source§

impl From<SymbolToken> for LexicalToken

source§

fn from(f: SymbolToken) -> Self

Converts to this type from the input type.
source§

impl From<VariableToken> for LexicalToken

source§

fn from(f: VariableToken) -> Self

Converts to this type from the input type.
source§

impl PositionRange for LexicalToken

source§

fn start_position(&self) -> Position

Returns the (inclusive) start position of this.
source§

fn end_position(&self) -> Position

Returns the (exclusive) end position of this.

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.