pub(super) enum InnerToken {
CommentStart,
Newline,
Annotation,
LeftBrace,
RightBrace,
Text,
Tab,
Spaces,
}
Expand description
InnerToken
is the result of a “partial” lexer which only
identifies enough tokens to determine whether we’re inside an
RC-block or a comment. We do this in order to handle
differing interpretations of ‘}’ within a comment; if the
comment is inside an RC-block, then ‘}’ terminates the
RC-block. But if the comment is not inside an RC-block, then
‘}’ is not special and forms part of the comment.
Variants§
CommentStart
Newline
Annotation
We use annotations in source files where we want a comment which isn’t part of
LeftBrace
RightBrace
Text
Tab
Spaces
Trait Implementations§
Source§impl Clone for InnerToken
impl Clone for InnerToken
Source§fn clone(&self) -> InnerToken
fn clone(&self) -> InnerToken
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for InnerToken
impl Debug for InnerToken
Source§impl<'s> Logos<'s> for InnerToken
impl<'s> Logos<'s> for InnerToken
Source§type Error = ()
type Error = ()
Error type returned by the lexer. This can be set using
#[logos(error = MyError)]
. Defaults to ()
if not set.Source§type Extras = ()
type Extras = ()
Associated type
Extras
for the particular lexer. This can be set using
#[logos(extras = MyExtras)]
and accessed inside callbacks.Source§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]
.Source§fn 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.§fn lexer(source: &'source Self::Source) -> Lexer<'source, Self> ⓘwhere
Self::Extras: Default,
fn lexer(source: &'source Self::Source) -> Lexer<'source, Self> ⓘwhere
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> ⓘ
fn lexer_with_extras( 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
.Source§impl PartialEq for InnerToken
impl PartialEq for InnerToken
impl Copy for InnerToken
impl StructuralPartialEq for InnerToken
Auto Trait Implementations§
impl Freeze for InnerToken
impl RefUnwindSafe for InnerToken
impl Send for InnerToken
impl Sync for InnerToken
impl Unpin for InnerToken
impl UnwindSafe for InnerToken
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef
].