pub struct ParseTree<'gram> {
pub lhs: &'gram Term,
/* private fields */
}
Expand description
A tree derived by successfully parsing an input string via Grammar::parse_input
Fields§
§lhs: &'gram Term
the “left hand side” Term
used for this ParseTree
Implementations§
source§impl<'gram> ParseTree<'gram>
impl<'gram> ParseTree<'gram>
sourcepub fn mermaid(&self) -> MermaidParseTree<'_>
pub fn mermaid(&self) -> MermaidParseTree<'_>
Opt into formatting as Mermaid.js flowchart.
let grammar: Grammar = "<dna> ::= <base> | <base> <dna>
<base> ::= 'A' | 'C' | 'G' | 'T'"
.parse()
.unwrap();
let input = "GATTACA";
let parsed = grammar.parse_input(input).next().unwrap();
let mermaid = parsed.mermaid().to_string();
println!("parse tree mermaid: {}", mermaid);
sourcepub fn rhs_iter(&self) -> impl Iterator<Item = &ParseTreeNode<'_>>
pub fn rhs_iter(&self) -> impl Iterator<Item = &ParseTreeNode<'_>>
Iterate the “right hand side” parse tree nodes
sourcepub fn rhs_iter_mut<'a>(
&'a mut self
) -> impl Iterator<Item = &'a mut ParseTreeNode<'gram>>
pub fn rhs_iter_mut<'a>( &'a mut self ) -> impl Iterator<Item = &'a mut ParseTreeNode<'gram>>
Mutably iterate the “right hand side” parse tree nodes