#pest #ascii #tree

pest_ascii_tree

Helper crates converting the parsing result of any pest grammar into an ascii tree

1 unstable release

0.1.0 Oct 14, 2019

#1620 in Text processing

Download history 1033/week @ 2023-10-31 907/week @ 2023-11-07 809/week @ 2023-11-14 654/week @ 2023-11-21 488/week @ 2023-11-28 430/week @ 2023-12-05 747/week @ 2023-12-12 419/week @ 2023-12-19 412/week @ 2023-12-26 446/week @ 2024-01-02 585/week @ 2024-01-09 631/week @ 2024-01-16 436/week @ 2024-01-23 754/week @ 2024-01-30 439/week @ 2024-02-06 561/week @ 2024-02-13

2,271 downloads per month
Used in 4 crates

MIT/Apache

12KB
185 lines

pest_ascii_tree

pest_ascii_tree

This is a small helper crate useful for quickly debugging your pest grammar. The rules found by parsing the file are formated into an ascii_tree.

It is useful, you you want to quickly debug your grammar without having to write specialized code for handling the Pairs iterator returned by your pest parser.

Example, for whan an output might look like.

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

Please, that the EOI rule is skipped.


lib.rs:

pest_ascii_tree

This is a small helper crate useful for quickly debugging your pest grammar. The rules found by parsing the file are formated into an ascii_tree.

It is useful, you you want to quickly debug your grammar without having to write specialized code for handling the Pairs iterator returned by your pest parser.

Example, for whan an output might look like.

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

Please, that the EOI rule is skipped.

Dependencies

~3MB
~59K SLoC