Trait tokenizer_lib::TokenReader[][src]

pub trait TokenReader<T> where
    T: PartialEq + Debug
{ fn peek(&mut self) -> Option<&Token<T>>;
fn next(&mut self) -> Option<Token<T>>; fn expect_next(&mut self, expected_type: T) -> Result<Span, ParseError> { ... } }

Trait for a reader which returns tokens over a current sequence

Required methods

fn peek(&mut self) -> Option<&Token<T>>[src]

Returns reference to next token but does not advance iterator forward

fn next(&mut self) -> Option<Token<T>>[src]

Returns token and advances forward

Loading content...

Provided methods

fn expect_next(&mut self, expected_type: T) -> Result<Span, ParseError>[src]

Tests that next token matches an expected type. Will return ParseError if does not match. Else it will return the position of the correctly matching token

Loading content...

Implementors

impl<T: PartialEq + Debug> TokenReader<T> for StaticTokenChannel<T>[src]

impl<T: PartialEq + Debug> TokenReader<T> for StreamedTokenReader<T>[src]

Loading content...