[][src]Trait antlr_rust::tree::ParseTree

pub trait ParseTree<'input>: Tree<'input> {
    pub fn get_source_interval(&self) -> Interval { ... }
pub fn get_text(&self) -> String { ... }
pub fn to_string_tree(
        &self,
        r: &dyn Recognizer<'input, TF = Self::TF, Node = Self::Ctx>
    ) -> String { ... } }

Tree that knows about underlying text

Provided methods

pub fn get_source_interval(&self) -> Interval[src]

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.

pub fn get_text(&self) -> String[src]

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

Since tokens on hidden channels (e.g. whitespace or comments) are not added to the parse trees, they will not appear in the output of this method.

pub fn to_string_tree(
    &self,
    r: &dyn Recognizer<'input, TF = Self::TF, Node = Self::Ctx>
) -> String
[src]

Print out a whole tree, not just a node, in LISP format (root child1 .. childN). Print just a node if this is a leaf. We have to know the recognizer so we can get rule names.

Loading content...

Implementors

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

impl<'input, ExtCtx: CustomRuleContext<'input>> ParseTree<'input> for BaseRuleContext<'input, ExtCtx>[src]

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

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

Loading content...