Struct antlr_rust::tree::LeafNode [−][src]
pub struct LeafNode<'input, Node: ParserNodeType<'input>, T: 'static> {
pub symbol: <Node::TF as TokenFactory<'input>>::Tok,
// some fields omitted
}
Expand description
Generic leaf AST node
Fields
symbol: <Node::TF as TokenFactory<'input>>::Tok
Token, this leaf consist of
Implementations
creates new leaf node
Trait Implementations
impl<'input, Node: ParserNodeType<'input>, T: 'static> CustomRuleContext<'input> for LeafNode<'input, Node, T>
impl<'input, Node: ParserNodeType<'input>, T: 'static> CustomRuleContext<'input> for LeafNode<'input, Node, T>
type Ctx = Node
type Ctx = Node
Type that describes type of context nodes, stored in this context
Rule index that corresponds to this context type
impl<'input, Node: ParserNodeType<'input>, T: 'static> ParseTree<'input> for LeafNode<'input, Node, T>
impl<'input, Node: ParserNodeType<'input>, T: 'static> ParseTree<'input> for LeafNode<'input, Node, T>
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, Node: ParserNodeType<'input> + TidAble<'input>, T: 'static + TidAble<'input>> ParserRuleContext<'input> for LeafNode<'input, Node, T>
impl<'input, Node: ParserNodeType<'input> + TidAble<'input>, T: 'static + TidAble<'input>> ParserRuleContext<'input> for LeafNode<'input, Node, T>
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, Node: ParserNodeType<'input>, T: 'static> RuleContext<'input> for LeafNode<'input, Node, T>
impl<'input, Node: ParserNodeType<'input>, T: 'static> RuleContext<'input> for LeafNode<'input, Node, T>
Internal parser state
Sets internal parser state
A context is empty if there is no invoking state; meaning nobody called current context. Which is usually true for the root of the syntax tree Read more
Get parent context
Set parent context
impl<'input, Node: ParserNodeType<'input>, T: 'static> Tree<'input> for LeafNode<'input, Node, T>
impl<'input, Node: ParserNodeType<'input>, T: 'static> Tree<'input> for LeafNode<'input, Node, T>
fn get_children<'a>(
&'a self
) -> Box<dyn Iterator<Item = Rc<<Self::Ctx as ParserNodeType<'input>>::Type>> + 'a> where
'input: 'a,
impl<'input, Node: ParserNodeType<'input>, T: 'static> TidAble<'input> for LeafNode<'input, Node, T> where
Node: TidAble<'input>,
Auto Trait Implementations
impl<'input, Node, T> RefUnwindSafe for LeafNode<'input, Node, T> where
T: RefUnwindSafe,
<<Node as ParserNodeType<'input>>::TF as TokenFactory<'input>>::Tok: RefUnwindSafe,
impl<'input, Node, T> Send for LeafNode<'input, Node, T> where
T: Send,
<<Node as ParserNodeType<'input>>::TF as TokenFactory<'input>>::Tok: Send,
impl<'input, Node, T> Sync for LeafNode<'input, Node, T> where
T: Sync,
<<Node as ParserNodeType<'input>>::TF as TokenFactory<'input>>::Tok: Sync,
impl<'input, Node, T> Unpin for LeafNode<'input, Node, T> where
T: Unpin,
<<Node as ParserNodeType<'input>>::TF as TokenFactory<'input>>::Tok: Unpin,
impl<'input, Node, T> UnwindSafe for LeafNode<'input, Node, T> where
T: UnwindSafe,
<<Node as ParserNodeType<'input>>::TF as TokenFactory<'input>>::Tok: UnwindSafe,
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