Trait logos::Logos [−][src]
Trait implemented for an enum representing all tokens. You should never have
to implement it manually, use the #[derive(Logos)]
attribute on your enum.
Associated Types
type Extras
[src]
Associated type Extras
for the particular lexer. This can be set using
#[logos(extras = MyExtras)]
and accessed inside callbacks.
type Source: Source + ?Sized + 'source
[src]
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]
.
Associated Constants
Loading content...Required methods
fn lex(lexer: &mut Lexer<'source, Self>)
[src]
The heart of Logos. Called by the Lexer
. The implementation for this function
is generated by the logos-derive
crate.
Provided methods
fn lexer(source: &'source Self::Source) -> Lexer<'source, Self>ⓘ where
Self::Extras: Default,
[src]
Self::Extras: Default,
Create a new instance of a Lexer
that will produce tokens implementing
this Logos
.
fn lexer_with_extras(
source: &'source Self::Source,
extras: Self::Extras
) -> Lexer<'source, Self>ⓘ
[src]
source: &'source Self::Source,
extras: Self::Extras
) -> Lexer<'source, Self>ⓘ
Create a new instance of a Lexer
with the provided Extras
that will
produce tokens implementing this Logos
.