@colin_t/lezer-tree-visualizer
Version:
Visualizes a lezer tree to view it in a console
36 lines (25 loc) • 1.32 kB
Markdown
[](https://codemirror.net/6/)
[](https://colintimbarndt.github.io/lezer-tree-visualizer/)
[](https://www.npmjs.com/package/@colin_t/lezer-tree-visualizer)
A basic tool for debugging syntax trees by visualizing them. This module
exports two functions, one for directly printing to the console and another
one for storing the formatted string (without color formatting).
This modules supports both native consoles and the web. This library detects
if it is run in the browser or Node.
## Example
This is a simple Java program which can be parsed with `lezer-java`:
```java
package tests;
import java.lang.String;
/**
* Test
*/
public class Test {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
```
When printing the syntax tree to the console:
[](https://github.com/ColinTimBarndt/lezer-tree-visualizer/blob/master/img/java-tree.png)