Trait antlr_rust::token_stream::TokenStream
source · [−]pub trait TokenStream<'input>: IntStream {
type TF: TokenFactory<'input> + 'input;
fn lt(
&mut self,
k: isize
) -> Option<&<Self::TF as TokenFactory<'input>>::Tok>;
fn get(&self, index: isize) -> &<Self::TF as TokenFactory<'input>>::Tok;
fn get_token_source(&self) -> &dyn TokenSource<'input, TF = Self::TF>;
fn get_text_from_interval(&self, start: isize, stop: isize) -> String;
fn get_all_text(&self) -> String { ... }
fn get_text_from_tokens<T: Token + ?Sized>(&self, a: &T, b: &T) -> String
where
Self: Sized,
{ ... }
}Expand description
An IntSteam of Tokens
Used as an input for Parsers
If there is an existing source of tokens, you should implement
TokenSource, not TokenStream
Required Associated Types
type TF: TokenFactory<'input> + 'input
type TF: TokenFactory<'input> + 'input
Token factory that created tokens in this stream
Required Methods
Lookahead for tokens, same as IntSteam::la but return reference to full token
Returns reference to token at index
fn get_token_source(&self) -> &dyn TokenSource<'input, TF = Self::TF>
fn get_token_source(&self) -> &dyn TokenSource<'input, TF = Self::TF>
Token source that produced data for tokens for this stream
fn get_text_from_interval(&self, start: isize, stop: isize) -> String
fn get_text_from_interval(&self, start: isize, stop: isize) -> String
Get combined text of tokens in start..=stop interval
Provided Methods
fn get_all_text(&self) -> String
fn get_all_text(&self) -> String
Get combined text of all tokens in this stream