[][src]Trait antlr_rust::parser_rule_context::ParserRuleContext

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

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

pub fn set_exception(&self, _e: ANTLRError)[src]

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

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

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.

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

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

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

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.

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

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

pub fn remove_last_child(&self)[src]

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

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

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

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

Loading content...

Implementors

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

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

impl<'input, Node: ParserNodeType<'input> + TidAble<'input>, T: 'static + TidAble<'input>> ParserRuleContext<'input> for LeafNode<'input, Node, T>[src]

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

Loading content...