Enum dedukti_parse::Token
source · [−]pub enum Token<S> {
}
Expand description
A token generated by the lexer.
Variants
Def
definition
Thm
theorem
LBrk
opening bracket
RBrk
closing bracket
LPar
opening parenthesis
RPar
closing parenthesis
Colon
has type
ColonEq
is defined as
Arrow
product
FatArrow
abstraction
LongArrow
rewrites to
Comma
separate variables in rewrite rule contexts
Dot
terminate command
Symb(Symb<S>)
symbol
Comment(usize)
unclosed comments (the number indicates how many comments are still open)
Error
unrecognised token
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 {
/// definition
#[token("def")]
Def,
/// theorem
#[token("thm")]
Thm,
/// opening bracket
#[token("[")]
LBrk,
/// closing bracket
#[token("]")]
RBrk,
/// opening parenthesis
#[token("(")]
LPar,
/// closing parenthesis
#[token(")")]
RPar,
/// has type
#[token(":")]
Colon,
/// is defined as
#[token(":=")]
ColonEq,
/// product
#[token("->")]
Arrow,
/// abstraction
#[token("=>")]
FatArrow,
/// rewrites to
#[token("-->")]
LongArrow,
/// separate variables in rewrite rule contexts
#[token(",")]
Comma,
/// terminate command
#[token(".")]
Dot,
/// symbol
#[regex("[a-zA-Z0-9_!?][a-zA-Z0-9_!?']*", symb)]
#[token("{|", moustache)]
Symb(Symb),
/// unclosed comments (the number indicates how many comments are still open)
#[token("(;", comment1)]
Comment(usize),
/// unrecognised token
#[regex(r"[ \t\n\f]+", logos::skip)]
#[error]
Error
const ERROR: Self = Token {
/// definition
#[token("def")]
Def,
/// theorem
#[token("thm")]
Thm,
/// opening bracket
#[token("[")]
LBrk,
/// closing bracket
#[token("]")]
RBrk,
/// opening parenthesis
#[token("(")]
LPar,
/// closing parenthesis
#[token(")")]
RPar,
/// has type
#[token(":")]
Colon,
/// is defined as
#[token(":=")]
ColonEq,
/// product
#[token("->")]
Arrow,
/// abstraction
#[token("=>")]
FatArrow,
/// rewrites to
#[token("-->")]
LongArrow,
/// separate variables in rewrite rule contexts
#[token(",")]
Comma,
/// terminate command
#[token(".")]
Dot,
/// symbol
#[regex("[a-zA-Z0-9_!?][a-zA-Z0-9_!?']*", symb)]
#[token("{|", moustache)]
Symb(Symb),
/// unclosed comments (the number indicates how many comments are still open)
#[token("(;", comment1)]
Comment(usize),
/// unrecognised token
#[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