lezer-parser / lezer

Dev utils and issues for the Lezer core packages
33 stars 1 forks source link

Add a printer package #45

Closed deemp closed 11 months ago

deemp commented 11 months ago

Recently, I started making a new parser and discovered there's still no official parse tree pretty printer. I found one on the CodeMirror forum (link) and saw the original post has gotten 1.8K views since 2020.

Currently, I packaged that pretty printer (link) to use for my new package. However, it'd be nice to have an official package, with at least some parse tree pretty-printing format (not necessarily JSON).

@marijnh, could you please consider adding such a printer to the @lezer family?

marijnh commented 11 months ago

No. That's not something I'm going to work on.

deemp commented 11 months ago

May I call it @lezer/printer to make it searchable by prefix on npmjs? Or @lezer-unofficial/printer? Or how?

marijnh commented 11 months ago

I don't really want to open the @lezer namespace to 3rd-party code. Just lezer-printer or @lezer-unofficial/printer is perfectly fine.

(You are aware of the very basic pretty-printing that Tree.toString provides, no?)

deemp commented 11 months ago

Okay, it's @lezer-unofficial/printer. I added a comparison with Tree.toString to the README.