nearley icon indicating copy to clipboard operation
nearley copied to clipboard

Allow the user to pick an output language

Open DavidTanner opened this issue 4 years ago • 1 comments

I would like to be able to use the cli to generate typescript output. This change adds an optional language flag to specify which of the existing generators might be used.

DavidTanner avatar Apr 13 '22 17:04 DavidTanner

Just use @preprocessor in your grammar file. For example: @preprocessor typescript at the beginning of your grammar file lets you use typescript in your post-processors and generates typescript for you. @preprocessor also supports coffeescript.

the-jasoney avatar Jun 22 '22 19:06 the-jasoney

Awesome. Thank you for the answer. That took a bit of digging to find in the docs. https://nearley.js.org/docs/parser#using-preprocessors

DavidTanner avatar Aug 23 '22 16:08 DavidTanner