#pest-grammar #pest #pest-parser #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

#1923 in Text processing

Download history 1168/week @ 2024-08-26 1208/week @ 2024-09-02 1025/week @ 2024-09-09 1306/week @ 2024-09-16 1976/week @ 2024-09-23 1501/week @ 2024-09-30 1675/week @ 2024-10-07 1418/week @ 2024-10-14 4576/week @ 2024-10-21 5146/week @ 2024-10-28 3410/week @ 2024-11-04 1929/week @ 2024-11-11 840/week @ 2024-11-18 388/week @ 2024-11-25 404/week @ 2024-12-02 401/week @ 2024-12-09

2,119 downloads per month
Used in 5 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

~2–2.8MB
~56K SLoC