pub struct ParserRuleContext { /* private fields */ }Expand description
Transient builder for one open rule.
This value owns no tree nodes or child vector. Child IDs are appended to parser-owned scratch links and are copied once into the global child pool when the rule completes.
Implementations§
Source§impl ParserRuleContext
impl ParserRuleContext
pub const fn new(rule_index: usize, invoking_state: isize) -> Self
pub const fn rule_index(&self) -> usize
pub const fn invoking_state(&self) -> isize
pub const fn alt_number(&self) -> usize
pub const fn set_alt_number(&mut self, alt_number: usize)
pub fn start<'a>(&self, tokens: &'a TokenStore) -> Option<TokenView<'a>>
pub fn stop<'a>(&self, tokens: &'a TokenStore) -> Option<TokenView<'a>>
pub fn set_int_return(&mut self, name: impl Into<String>, value: i64)
pub fn int_return(&self, name: &str) -> Option<i64>
pub fn set_generated_attrs(&mut self, attrs: GeneratedAttrs)
pub fn generated_attrs<T: Any>(&self) -> Option<&T>
pub const fn exception(&self) -> Option<&AntlrError>
pub fn set_exception(&mut self, error: AntlrError)
pub const fn child_count(&self) -> usize
pub const fn has_matched_child(&self) -> bool
pub const fn note_matched_child(&mut self)
pub fn child_nodes<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, ) -> impl Iterator<Item = Node<'a>> + 'a
pub fn child_rules<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, rule_index: usize, ) -> impl Iterator<Item = RuleNodeView<'a>> + 'a
pub fn child_rule_trees<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, rule_index: usize, ) -> impl Iterator<Item = Node<'a>> + 'a
pub fn child_tokens<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, token_type: i32, ) -> impl Iterator<Item = TerminalNodeView<'a>> + 'a
pub fn terminal_children<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, ) -> impl Iterator<Item = TerminalNodeView<'a>> + 'a
pub fn text(&self, storage: &ParseTreeStorage, tokens: &TokenStore) -> String
pub fn to_string_tree_with_names<S: AsRef<str>>( &self, storage: &ParseTreeStorage, tokens: &TokenStore, rule_names: &[S], ) -> String
pub fn to_string_tree<R: Recognizer>( &self, recognizer: Option<&R>, storage: &ParseTreeStorage, tokens: &TokenStore, ) -> String
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ParserRuleContext
impl !Send for ParserRuleContext
impl !Sync for ParserRuleContext
impl !UnwindSafe for ParserRuleContext
impl Freeze for ParserRuleContext
impl Unpin for ParserRuleContext
impl UnsafeUnpin for ParserRuleContext
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