Trait antlr_rust::tree::ParseTree [−][src]
pub trait ParseTree<'input>: Tree<'input> {
fn get_source_interval(&self) -> Interval { ... }
fn get_text(&self) -> String { ... }
fn to_string_tree(
&self,
r: &dyn Recognizer<'input, TF = Self::TF, Node = Self::Ctx>
) -> String { ... }
}
Expand description
Tree that knows about underlying text
Provided methods
fn get_source_interval(&self) -> Interval
fn get_source_interval(&self) -> Interval
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.
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.
fn to_string_tree(
&self,
r: &dyn Recognizer<'input, TF = Self::TF, Node = Self::Ctx>
) -> String
fn to_string_tree(
&self,
r: &dyn Recognizer<'input, TF = Self::TF, Node = Self::Ctx>
) -> String
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.