Struct moore_common::lexer::BufferedLexer
[−]
[src]
pub struct BufferedLexer<T> { /* fields omitted */ }
A buffered lexer that allows tokens to be peeked at before they are actually consumed.
Methods
impl<T: Clone + PartialEq> BufferedLexer<T>
[src]
fn new(inner: Box<Lexer<T>>, eof: T) -> BufferedLexer<T>
[src]
Create a new buffered lexer.
fn peek<'td>(&mut self, offset: usize) -> DiagResult<'td, &T>
[src]
Peek at a token not yet consumed. This function merely returns a
reference to said token. Use pop()
to advance the lexer.
fn push(&mut self, token: T)
[src]
Insert a token in front of the stream such that it becomes the next
token to be returned from peek(0)
or pop()
.
fn pop<'td>(&mut self) -> DiagResult<'td, T>
[src]
Consume and return the current token. This is the same token that would
be returned by peek(0)
.