Struct antlr_rust::parser_rule_context::BaseParserRuleContext [−][src]
pub struct BaseParserRuleContext<'input, Ctx: CustomRuleContext<'input>> {
pub exception: Option<Box<ANTLRError>>,
// some fields omitted
}
Expand description
Default rule context implementation that keeps everything provided by parser
Fields
exception: Option<Box<ANTLRError>>
error if there was any in this node
Implementations
pub fn new_parser_ctx(
parent_ctx: Option<Rc<<Ctx::Ctx as ParserNodeType<'input>>::Type>>,
invoking_state: isize,
ext: Ctx
) -> Self
Trait Implementations
impl<'input, Ctx: CustomRuleContext<'input>> Borrow<Ctx> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> Borrow<Ctx> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> BorrowMut<Ctx> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> BorrowMut<Ctx> for BaseParserRuleContext<'input, Ctx>
Mutably borrows from an owned value. Read more
impl<'input, Ctx: CustomRuleContext<'input>> CustomRuleContext<'input> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> CustomRuleContext<'input> for BaseParserRuleContext<'input, Ctx>
Rule index that corresponds to this context type
impl<'input, Ctx: CustomRuleContext<'input> + TidAble<'input>> ParseTree<'input> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input> + TidAble<'input>> ParseTree<'input> for BaseParserRuleContext<'input, Ctx>
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, Ctx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input> + TidAble<'input>> ParserRuleContext<'input> for BaseParserRuleContext<'input, Ctx>
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, Ctx: CustomRuleContext<'input>> RuleContext<'input> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> RuleContext<'input> for BaseParserRuleContext<'input, Ctx>
Internal parser state
Sets internal parser state
Get parent context
Set parent context
impl<'input, Ctx: CustomRuleContext<'input>> Tree<'input> for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx: CustomRuleContext<'input>> Tree<'input> for BaseParserRuleContext<'input, Ctx>
fn get_children<'a>(
&'a self
) -> Box<dyn Iterator<Item = Rc<<Self::Ctx as ParserNodeType<'input>>::Type>> + 'a> where
'input: 'a,
impl<'input, Ctx: CustomRuleContext<'input>> TidAble<'input> for BaseParserRuleContext<'input, Ctx> where
Ctx: TidAble<'input>,
Auto Trait Implementations
impl<'input, Ctx> !RefUnwindSafe for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx> !Send for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx> !Sync for BaseParserRuleContext<'input, Ctx>
impl<'input, Ctx> Unpin for BaseParserRuleContext<'input, Ctx> where
Ctx: Unpin,
<<Ctx as CustomRuleContext<'input>>::TF as TokenFactory<'input>>::Tok: Unpin,
impl<'input, Ctx> !UnwindSafe for BaseParserRuleContext<'input, Ctx>
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