peggyjs / peggy

Peggy: Parser generator for JavaScript
https://peggyjs.org/
MIT License
914 stars 65 forks source link

[feature request] watch #404

Closed yukulele closed 1 year ago

yukulele commented 1 year ago

is it possible to add a --watch / -w option allowing automatic recompiling each time the source file is modified?

usage example:

> peg my-language.peg --watch
compile my-language.peg → my-language.js
waiting for change...
hildjj commented 1 year ago

Yes, with the caveat that I'll only use the node built-ins for file watching (not one of the more performant wrapper packages), you'll only be able to watch one file at a time, it won't support testing with -t/-T. I think it will print a message on success or failure, but not exit until you hit control-C.

yukulele commented 1 year ago

That would be perfect!

hildjj commented 1 year ago

I decided to go ahead and support -T/-t, since it would have been harder to disable them.