Struct antlr_rust::rule_context::BaseRuleContext [−][src]
pub struct BaseRuleContext<'input, ExtCtx: CustomRuleContext<'input>> { /* fields omitted */ }
Expand description
Minimal parse tree node implementation, that stores only data required for correct parsing
Implementations
pub fn new_parser_ctx(
parent_ctx: Option<Rc<<ExtCtx::Ctx as ParserNodeType<'input>>::Type>>,
invoking_state: isize,
ext: ExtCtx
) -> Self
Trait Implementations
Mutably borrows from an owned value. Read more
impl<'input, ExtCtx: CustomRuleContext<'input>> CustomRuleContext<'input> for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx: CustomRuleContext<'input>> CustomRuleContext<'input> for BaseRuleContext<'input, ExtCtx>
Rule index that corresponds to this context type
impl<'input, ExtCtx: CustomRuleContext<'input>> ParseTree<'input> for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx: CustomRuleContext<'input>> ParseTree<'input> for BaseRuleContext<'input, ExtCtx>
Return an {@link Interval} indicating the index in the {@link TokenStream} of the first and last token associated with this subtree. If this node is a leaf, then the interval represents a single token and has interval i..i for token index i. Read more
Return combined text of this AST node. To create resulting string it does traverse whole subtree, also it includes only tokens added to the parse tree Read more
impl<'input, ExtCtx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseRuleContext<'input, ExtCtx>
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. Read more
fn start_mut<'a>(
&'a self
) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok> 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. Read more
fn stop_mut<'a>(&'a self) -> RefMut<'a, <Self::TF as TokenFactory<'input>>::Tok> where
'input: 'a,
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,
impl<'input, ExtCtx: CustomRuleContext<'input>> RuleContext<'input> for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx: CustomRuleContext<'input>> RuleContext<'input> for BaseRuleContext<'input, ExtCtx>
Internal parser state
Sets internal parser state
Get parent context
Set parent context
impl<'input, ExtCtx: CustomRuleContext<'input>> Tree<'input> for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx: CustomRuleContext<'input>> Tree<'input> for BaseRuleContext<'input, ExtCtx>
fn get_children<'a>(
&'a self
) -> Box<dyn Iterator<Item = Rc<<Self::Ctx as ParserNodeType<'input>>::Type>> + 'a> where
'input: 'a,
impl<'input, ExtCtx: CustomRuleContext<'input>> TidAble<'input> for BaseRuleContext<'input, ExtCtx> where
ExtCtx: TidAble<'input>,
Auto Trait Implementations
impl<'input, ExtCtx> !RefUnwindSafe for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx> !Send for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx> !Sync for BaseRuleContext<'input, ExtCtx>
impl<'input, ExtCtx> Unpin for BaseRuleContext<'input, ExtCtx> where
ExtCtx: Unpin,
impl<'input, ExtCtx> !UnwindSafe for BaseRuleContext<'input, ExtCtx>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<'input, T> RuleContextExt<'input> for T where
T: 'input + ParserRuleContext<'input> + ?Sized,
impl<'input, T> RuleContextExt<'input> for T where
T: 'input + ParserRuleContext<'input> + ?Sized,
pub fn to_string<Z>(&Rc<T>, Option<&[&str]>, Option<Rc<Z>>) -> String where
Z: 'input + ParserRuleContext<'input, Ctx = <T as CustomRuleContext<'input>>::Ctx, TF = <T as CustomRuleContext<'input>>::TF> + ?Sized,
<T as CustomRuleContext<'input>>::Ctx: ParserNodeType<'input>,
Rc<T>: CoerceUnsized<Rc<Z>>,
<<T as CustomRuleContext<'input>>::Ctx as ParserNodeType<'input>>::Type == Z,
pub fn to_string<Z>(&Rc<T>, Option<&[&str]>, Option<Rc<Z>>) -> String where
Z: 'input + ParserRuleContext<'input, Ctx = <T as CustomRuleContext<'input>>::Ctx, TF = <T as CustomRuleContext<'input>>::TF> + ?Sized,
<T as CustomRuleContext<'input>>::Ctx: ParserNodeType<'input>,
Rc<T>: CoerceUnsized<Rc<Z>>,
<<T as CustomRuleContext<'input>>::Ctx as ParserNodeType<'input>>::Type == Z,
Prints list of parent rules
pub fn accept_children<V>(&Self, &mut V) where
V: ParseTreeVisitor<'input, <T as CustomRuleContext<'input>>::Ctx> + ?Sized,
<<T as CustomRuleContext<'input>>::Ctx as ParserNodeType<'input>>::Type: VisitableDyn<V>,
Returns true if type behind self is equal to the type of T.
Attempts to downcast self to T
behind reference
Attempts to downcast self to T
behind mutable reference
Attempts to downcast self to T
behind Rc
pointer
Attempts to downcast self to T
behind Arc
pointer