[][src]Function pest_ascii_tree::print_ascii_tree

pub fn print_ascii_tree<R>(parsing_result: Result<Pairs<R>, Error<R>>) where
    R: RuleType

Prints the result returned by your pest Parser as an ascii tree.

Errors

In case of an parsing error, the error is printed. In case of a formating error, the error is printed.

Examples

This example is not tested
pest_ascii_tree::print_ascii_tree(
                    ExpressionParser::parse(Rule::expr,
                                            "(u + (v + w)) + (x + y) + z"));

will result in the output

 expr
 ├─ expr
 │  ├─ val "u"
 │  ├─ op "+"
 │  └─ expr
 │     ├─ val "v"
 │     ├─ op "+"
 │     └─ val "w"
 ├─ op "+"
 ├─ expr
 │  ├─ val "x"
 │  ├─ op "+"
 │  └─ val "y"
 ├─ op "+"
 └─ val "z"