Enum dedukti_parse::Token
source · [−]pub enum Token<S> {
}Expand description
A token generated by the lexer.
Variants
Def
Thm
LBrk
RBrk
LPar
RPar
Colon
ColonEq
Arrow
FatArrow
LongArrow
Comma
Dot
Symb(Symb<S>)
Comment(usize)
Error
Trait Implementations
sourceimpl<'s> Logos<'s> for Token<&'s str>
impl<'s> Logos<'s> for Token<&'s str>
type Extras = ()
type Extras = ()
Associated type Extras for the particular lexer. This can be set using
#[logos(extras = MyExtras)] and accessed inside callbacks. Read more
type Source = str
type Source = str
Source type this token can be lexed from. This will default to str,
unless one of the defined patterns explicitly uses non-unicode byte values
or byte slices, in which case that implementation will use [u8]. Read more
sourceconst ERROR: Self = Token {
#[token("def")]
Def,
#[token("thm")]
Thm,
#[token("[")]
LBrk,
#[token("]")]
RBrk,
#[token("(")]
LPar,
#[token(")")]
RPar,
#[token(":")]
Colon,
#[token(":=")]
ColonEq,
#[token("->")]
Arrow,
#[token("=>")]
FatArrow,
#[token("-->")]
LongArrow,
#[token(",")]
Comma,
#[token(".")]
Dot,
#[regex("[a-zA-Z0-9_!?][a-zA-Z0-9_!?']*", symb)]
#[token("{|", moustache)]
Symb(Symb),
#[token("(;", comment1)]
Comment(usize),
// Logos requires one token variant to handle errors,
// it can be named anything you wish.
#[regex(r"[ \t\n\f]+", logos::skip)]
#[error]
Error
const ERROR: Self = Token {
#[token("def")]
Def,
#[token("thm")]
Thm,
#[token("[")]
LBrk,
#[token("]")]
RBrk,
#[token("(")]
LPar,
#[token(")")]
RPar,
#[token(":")]
Colon,
#[token(":=")]
ColonEq,
#[token("->")]
Arrow,
#[token("=>")]
FatArrow,
#[token("-->")]
LongArrow,
#[token(",")]
Comma,
#[token(".")]
Dot,
#[regex("[a-zA-Z0-9_!?][a-zA-Z0-9_!?']*", symb)]
#[token("{|", moustache)]
Symb(Symb),
#[token("(;", comment1)]
Comment(usize),
// Logos requires one token variant to handle errors,
// it can be named anything you wish.
#[regex(r"[ \t\n\f]+", logos::skip)]
#[error]
Error
Helper const of the variant marked as #[error].
sourcefn lex(lex: &mut Lexer<'s, Self>)
fn lex(lex: &mut Lexer<'s, Self>)
The heart of Logos. Called by the Lexer. The implementation for this function
is generated by the logos-derive crate. Read more
impl<S: Eq> Eq for Token<S>
impl<S> StructuralEq for Token<S>
impl<S> StructuralPartialEq for Token<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for Token<S> where
S: RefUnwindSafe,
impl<S> Send for Token<S> where
S: Send,
impl<S> Sync for Token<S> where
S: Sync,
impl<S> Unpin for Token<S> where
S: Unpin,
impl<S> UnwindSafe for Token<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more