Unparsing an AST

Is there any support for “unparsing” the AST produced by Lezer? That is reproducing the original source code from the AST.

My use-case is basically pretty-printing javascript:

  1. Parse source code and check its syntax validity
  2. If code is valid then perform some transformations on the AST
  3. Reproduce source code with formatting modifications

I have found external modules that do this such as this ruby unparser and this unparser that works together with esprima.

I’ve been wondering if there are any plans to support this within Lezer as well.

No, there isn’t. (The tree itself doesn’t even contain enough information to do this, since it only stores node ranges, not their text content.)