Skip to main content

ParserRuleContext

Struct ParserRuleContext 

Source
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

Source

pub const fn new(rule_index: usize, invoking_state: isize) -> Self

Source

pub const fn rule_index(&self) -> usize

Source

pub const fn invoking_state(&self) -> isize

Source

pub const fn alt_number(&self) -> usize

Source

pub const fn set_alt_number(&mut self, alt_number: usize)

Source

pub fn start<'a>(&self, tokens: &'a TokenStore) -> Option<TokenView<'a>>

Source

pub fn stop<'a>(&self, tokens: &'a TokenStore) -> Option<TokenView<'a>>

Source

pub fn set_int_return(&mut self, name: impl Into<String>, value: i64)

Source

pub fn int_return(&self, name: &str) -> Option<i64>

Source

pub fn set_generated_attrs(&mut self, attrs: GeneratedAttrs)

Source

pub fn generated_attrs<T: Any>(&self) -> Option<&T>

Source

pub const fn exception(&self) -> Option<&AntlrError>

Source

pub fn set_exception(&mut self, error: AntlrError)

Source

pub const fn child_count(&self) -> usize

Source

pub const fn has_matched_child(&self) -> bool

Source

pub const fn note_matched_child(&mut self)

Source

pub fn child_nodes<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, ) -> impl Iterator<Item = Node<'a>> + 'a

Source

pub fn child_rules<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, rule_index: usize, ) -> impl Iterator<Item = RuleNodeView<'a>> + 'a

Source

pub fn child_rule_trees<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, rule_index: usize, ) -> impl Iterator<Item = Node<'a>> + 'a

Source

pub fn child_tokens<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, token_type: i32, ) -> impl Iterator<Item = TerminalNodeView<'a>> + 'a

Source

pub fn terminal_children<'a>( &'a self, storage: &'a ParseTreeStorage, tokens: &'a TokenStore, ) -> impl Iterator<Item = TerminalNodeView<'a>> + 'a

Source

pub fn text(&self, storage: &ParseTreeStorage, tokens: &TokenStore) -> String

Source

pub fn to_string_tree_with_names<S: AsRef<str>>( &self, storage: &ParseTreeStorage, tokens: &TokenStore, rule_names: &[S], ) -> String

Source

pub fn to_string_tree<R: Recognizer>( &self, recognizer: Option<&R>, storage: &ParseTreeStorage, tokens: &TokenStore, ) -> String

Trait Implementations§

Source§

impl Debug for ParserRuleContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.