Trait Lexer

Source
pub trait Lexer {
    type Char;

    // Required method
    fn consume_next_token(
        &mut self,
        input: &mut (impl Iterator<Item = Self::Char> + PeekingNext),
        output: impl FnMut(Self::Char),
    ) -> Result<(), ParserError<Self::Char>>;
}
Expand description

Partition an input stream into tokens. The lexer consumes one token from an input stream in each call of consume_next_token.

Required Associated Types§

Source

type Char

Character datatype used by this lexer. Typically, this might be char or u8.

Required Methods§

Source

fn consume_next_token( &mut self, input: &mut (impl Iterator<Item = Self::Char> + PeekingNext), output: impl FnMut(Self::Char), ) -> Result<(), ParserError<Self::Char>>

Consume the next token from the iterator.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§