ParserRuleContext

Trait ParserRuleContext 

Source
pub trait ParserRuleContext<'input>:
    ParseTree<'input>
    + RuleContext<'input>
    + Debug
    + Tid<'input> {
Show 13 methods // Provided methods fn set_exception(&self, _e: ANTLRError) { ... } fn set_start(&self, _t: Option<<Self::TF as TokenFactory<'input>>::Tok>) { ... } fn start<'a>(&'a self) -> Ref<'a, <Self::TF as TokenFactory<'input>>::Inner> where 'input: 'a { ... } fn start_mut<'a>( &'a self, ) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok> where 'input: 'a { ... } fn set_stop(&self, _t: Option<<Self::TF as TokenFactory<'input>>::Tok>) { ... } fn stop<'a>(&'a self) -> Ref<'a, <Self::TF as TokenFactory<'input>>::Inner> where 'input: 'a { ... } fn stop_mut<'a>( &'a self, ) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok> where 'input: 'a { ... } fn add_child(&self, _child: Rc<<Self::Ctx as ParserNodeType<'input>>::Type>) { ... } fn remove_last_child(&self) { ... } fn child_of_type<T>(&self, pos: usize) -> Option<Rc<T>> where T: ParserRuleContext<'input, TF = Self::TF, Ctx = Self::Ctx> + 'input, Self: Sized { ... } fn children_of_type<T>(&self) -> Vec<Rc<T>> where T: ParserRuleContext<'input, TF = Self::TF, Ctx = Self::Ctx> + 'input, Self: Sized { ... } fn get_token( &self, ttype: isize, pos: usize, ) -> Option<Rc<TerminalNode<'input, Self::Ctx>>> { ... } fn get_tokens( &self, ttype: isize, ) -> Vec<Rc<TerminalNode<'input, Self::Ctx>>> { ... }
}
Expand description

Syntax tree node for particular parser rule.

Not yet good for custom implementations so currently easiest option is to just copy BaseParserRuleContext or BaseRuleContext and strip/extend them

Provided Methods§

Source

fn set_exception(&self, _e: ANTLRError)

Source

fn set_start(&self, _t: Option<<Self::TF as TokenFactory<'input>>::Tok>)

Source

fn start<'a>(&'a self) -> Ref<'a, <Self::TF as TokenFactory<'input>>::Inner>
where 'input: 'a,

Get the initial token in this context. Note that the range from start to stop is inclusive, so for rules that do not consume anything (for example, zero length or error productions) this token may exceed stop.

Source

fn start_mut<'a>( &'a self, ) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok>
where 'input: 'a,

Source

fn set_stop(&self, _t: Option<<Self::TF as TokenFactory<'input>>::Tok>)

Source

fn stop<'a>(&'a self) -> Ref<'a, <Self::TF as TokenFactory<'input>>::Inner>
where 'input: 'a,

Get the final token in this context. Note that the range from start to stop is inclusive, so for rules that do not consume anything (for example, zero length or error productions) this token may precede start.

Source

fn stop_mut<'a>(&'a self) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok>
where 'input: 'a,

Source

fn add_child(&self, _child: Rc<<Self::Ctx as ParserNodeType<'input>>::Type>)

Source

fn remove_last_child(&self)

Source

fn child_of_type<T>(&self, pos: usize) -> Option<Rc<T>>
where T: ParserRuleContext<'input, TF = Self::TF, Ctx = Self::Ctx> + 'input, Self: Sized,

Source

fn children_of_type<T>(&self) -> Vec<Rc<T>>
where T: ParserRuleContext<'input, TF = Self::TF, Ctx = Self::Ctx> + 'input, Self: Sized,

Source

fn get_token( &self, ttype: isize, pos: usize, ) -> Option<Rc<TerminalNode<'input, Self::Ctx>>>

Source

fn get_tokens(&self, ttype: isize) -> Vec<Rc<TerminalNode<'input, Self::Ctx>>>

Implementors§

Source§

impl<'input, Ctx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseParserRuleContext<'input, Ctx>

Source§

impl<'input, ExtCtx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseRuleContext<'input, ExtCtx>

Source§

impl<'input, Node: ParserNodeType<'input>, T: 'static> ParserRuleContext<'input> for LeafNode<'input, Node, T>

Source§

impl<'input, T, I> ParserRuleContext<'input> for T
where T: DerefSeal<Target = I> + 'input + Debug + Tid<'input>, I: ParserRuleContext<'input> + 'input + ?Sized,