Struct moparse::TokenCollection
source · pub struct TokenCollection { /* private fields */ }Expand description
Represents collection of Modelica tokens generated by the lexer.
This object is used in the parsing process. Afterward it should be used together with the list of syntax events to produce parse trees or ASTs.
Implementations§
source§impl TokenCollection
impl TokenCollection
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return number of all lexical elements in the collection.
This function doesn’t discriminate between semantically meaningful tokens, comments and lexical errors.
pub fn is_empty(&self) -> bool
sourcepub fn token_count(&self) -> usize
pub fn token_count(&self) -> usize
Return number of semantically meaningful tokens, ie. not comments and not errors.
sourcepub fn comment_count(&self) -> usize
pub fn comment_count(&self) -> usize
Return number of comments.
sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Return number of lexical errors.
sourcepub fn get_item(&self, i: usize) -> Option<&Token>
pub fn get_item(&self, i: usize) -> Option<&Token>
Return i-th item (token, comment or error). Return None if
there is no such item.
sourcepub fn get_token(&self, i: usize) -> Option<&Token>
pub fn get_token(&self, i: usize) -> Option<&Token>
Return i-th token. Return None if there is no such token.
sourcepub fn get_comment(&self, i: usize) -> Option<&Token>
pub fn get_comment(&self, i: usize) -> Option<&Token>
Return i-th comment. Return None if there is no such comment.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for TokenCollection
impl Send for TokenCollection
impl Sync for TokenCollection
impl Unpin for TokenCollection
impl UnwindSafe for TokenCollection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more