Struct hime_redist::tokens::TokenRepository
source · pub struct TokenRepository<'a> { /* private fields */ }
Expand description
The proxy structure for a repository of matched tokens
Implementations§
source§impl<'a> TokenRepository<'a>
impl<'a> TokenRepository<'a>
sourcepub fn new(
terminals: &'static [Symbol],
text: &'a Text,
tokens: &'a TokenRepositoryImpl
) -> TokenRepository<'a>
pub fn new(
terminals: &'static [Symbol],
text: &'a Text,
tokens: &'a TokenRepositoryImpl
) -> TokenRepository<'a>
Creates a new repository
sourcepub fn new_mut(
terminals: &'static [Symbol],
text: &'a Text,
tokens: &'a mut TokenRepositoryImpl
) -> TokenRepository<'a>
pub fn new_mut(
terminals: &'static [Symbol],
text: &'a Text,
tokens: &'a mut TokenRepositoryImpl
) -> TokenRepository<'a>
Creates a new mutable repository
sourcepub fn add(&mut self, terminal: usize, index: usize, length: usize) -> usize
pub fn add(&mut self, terminal: usize, index: usize, length: usize) -> usize
Registers a new token in this repository
sourcepub fn get_terminals(&self) -> &'static [Symbol]
pub fn get_terminals(&self) -> &'static [Symbol]
Gets the terminals
sourcepub fn get_tokens_count(&self) -> usize
pub fn get_tokens_count(&self) -> usize
Gets the number of tokens in this repository
sourcepub fn get_symbol_id_for(&self, index: usize) -> u32
pub fn get_symbol_id_for(&self, index: usize) -> u32
Gets the terminal’s identifier for the i-th token
sourcepub fn find_token_at(&self, index: usize) -> Option<Token<'_>>
pub fn find_token_at(&self, index: usize) -> Option<Token<'_>>
Gets the token (if any) that contains the specified index in the input text
Trait Implementations§
source§impl<'a> Iterable<'a> for TokenRepository<'a>
impl<'a> Iterable<'a> for TokenRepository<'a>
Implementation of Iterable
for TokenRepository
§type IteratorType = TokenRepositoryIterator<'a>
type IteratorType = TokenRepositoryIterator<'a>
The type of the iterator.
source§fn iter(&'a self) -> Self::IteratorType
fn iter(&'a self) -> Self::IteratorType
Creates an iterator over this
Iterable
structure.