pub trait TokenStream<'input>: IntStream {
type TF: TokenFactory<'input> + 'input;
// Required methods
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;
// Provided methods
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§
Sourcetype TF: TokenFactory<'input> + 'input
type TF: TokenFactory<'input> + 'input
Token factory that created tokens in this stream
Required Methods§
Sourcefn lt(&mut self, k: isize) -> Option<&<Self::TF as TokenFactory<'input>>::Tok>
fn lt(&mut self, k: isize) -> Option<&<Self::TF as TokenFactory<'input>>::Tok>
Lookahead for tokens, same as IntSteam::la but return reference to full token
Sourcefn get(&self, index: isize) -> &<Self::TF as TokenFactory<'input>>::Tok
fn get(&self, index: isize) -> &<Self::TF as TokenFactory<'input>>::Tok
Returns reference to token at index
Sourcefn 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
Sourcefn 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§
Sourcefn get_all_text(&self) -> String
fn get_all_text(&self) -> String
Get combined text of all tokens in this stream