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 Termthe “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
Trait Implementations§
impl<'gram> Eq for ParseTree<'gram>
impl<'gram> StructuralPartialEq for ParseTree<'gram>
Auto Trait Implementations§
impl<'gram> Freeze for ParseTree<'gram>
impl<'gram> RefUnwindSafe for ParseTree<'gram>
impl<'gram> Send for ParseTree<'gram>
impl<'gram> Sync for ParseTree<'gram>
impl<'gram> Unpin for ParseTree<'gram>
impl<'gram> UnwindSafe for ParseTree<'gram>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more