[][src]Trait antlr_rust::token_source::TokenSource

pub trait TokenSource<'input>: TokenAware<'input> {
    fn next_token(&mut self) -> <Self::TF as TokenFactory<'input>>::Tok;
fn get_line(&self) -> isize;
fn get_char_position_in_line(&self) -> isize;
fn get_input_stream(&mut self) -> Option<&mut dyn IntStream>;
fn get_source_name(&self) -> String;
fn get_token_factory(&self) -> &'input Self::TF; }

Provides tokens for parser via TokenStream

Required methods

fn next_token(&mut self) -> <Self::TF as TokenFactory<'input>>::Tok

fn get_line(&self) -> isize

Get the line number for the current position in the input stream. The first line in the input is line 1.

@return The line number for the current position in the input stream, or 0 if the current token source does not track line numbers.

fn get_char_position_in_line(&self) -> isize

Get the index into the current line for the current position in the input stream. The first character on a line has position 0.

@return The line number for the current position in the input stream, or -1 if the current token source does not track character positions.

fn get_input_stream(&mut self) -> Option<&mut dyn IntStream>

fn get_source_name(&self) -> String

fn get_token_factory(&self) -> &'input Self::TF

Gets the {@link TokenFactory} this token source is currently using for creating {@link Token} objects from the input.

Required by Parser for creating missing tokens.

@return The {@link TokenFactory} currently used by this token source.

Loading content...

Implementations on Foreign Types

impl<'input, T, '_> TokenSource<'input> for &'_ mut T where
    T: TokenSource<'input>, 
[src]

Loading content...

Implementors

impl<'input, T, Input, TF> TokenSource<'input> for BaseLexer<'input, T, Input, TF> where
    T: LexerRecog<'input, Self> + 'static,
    Input: CharStream<TF::From>,
    TF: TokenFactory<'input>, 
[src]

Loading content...