pub struct ParserRuleContext { /* private fields */ }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(&self) -> Option<&CommonToken>
pub fn stop(&self) -> Option<&CommonToken>
pub fn set_start(&mut self, token: CommonToken)
pub fn set_stop(&mut self, token: CommonToken)
Sourcepub fn set_int_return(&mut self, name: impl Into<String>, value: i64)
pub fn set_int_return(&mut self, name: impl Into<String>, value: i64)
Stores a generated integer return value on this rule context.
Sourcepub fn int_return(&self, name: &str) -> Option<i64>
pub fn int_return(&self, name: &str) -> Option<i64>
Reads a generated integer return value from this rule context.
pub fn exception(&self) -> Option<&AntlrError>
pub fn set_exception(&mut self, error: AntlrError)
pub fn children(&self) -> &[ParseTree]
Sourcepub const fn child_count(&self) -> usize
pub const fn child_count(&self) -> usize
Returns the number of direct children in this context.
Sourcepub fn child_rule(&self, rule_index: usize) -> Option<&Self>
pub fn child_rule(&self, rule_index: usize) -> Option<&Self>
Finds the first direct child rule with rule_index.
Sourcepub fn child_rules(&self, rule_index: usize) -> impl Iterator<Item = &Self> + '_
pub fn child_rules(&self, rule_index: usize) -> impl Iterator<Item = &Self> + '_
Iterates over direct child rules with rule_index.
Sourcepub fn child_token(&self, token_type: i32) -> Option<&TerminalNode>
pub fn child_token(&self, token_type: i32) -> Option<&TerminalNode>
Finds the first direct token child with token_type.
Includes recovery error nodes, which ANTLR treats as terminal nodes for token-getter helpers.
Sourcepub fn has_token(&self, token_type: i32) -> bool
pub fn has_token(&self, token_type: i32) -> bool
Returns whether this context has a direct token child with token_type.
pub fn add_child(&mut self, child: ParseTree)
Sourcepub const fn note_matched_child(&mut self)
pub const fn note_matched_child(&mut self)
Records that a child was matched without storing it (used when parse-tree
construction is disabled). Keeps has_matched_child accurate even though
children stays empty.
Sourcepub const fn has_matched_child(&self) -> bool
pub const fn has_matched_child(&self) -> bool
Whether this context has matched at least one child (token, rule, or error node) so far, regardless of whether parse-tree construction is enabled.
pub fn text(&self) -> String
pub fn to_string_tree<S: AsRef<str>>(&self, rule_names: &[S]) -> String
Trait Implementations§
Source§impl Clone for ParserRuleContext
impl Clone for ParserRuleContext
Source§fn clone(&self) -> ParserRuleContext
fn clone(&self) -> ParserRuleContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParserRuleContext
impl Debug for ParserRuleContext
impl Eq for ParserRuleContext
Source§impl PartialEq for ParserRuleContext
impl PartialEq for ParserRuleContext
Source§fn eq(&self, other: &ParserRuleContext) -> bool
fn eq(&self, other: &ParserRuleContext) -> bool
self and other values to be equal, and is used by ==.