peggyjs / peggy

Peggy: Parser generator for JavaScript

Home Page:https://peggyjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feature request] watch

yukulele opened this issue · comments

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...

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.

That would be perfect!

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