chrivers/pyjaco — pull request #10 by buchuki (2012-01-06 18:27:19+00:00)
Title: Run script

Merge (rewrite) the generate_library.py into pyjs.py

This commit also moves the library into the pyjaco package to ease distribution via setup.py.

The output of the new generate script is not quite identical to the output of the original. I passed it through vimdiff and found the following:

* all multi-line comments are stripped, not just the headers. This was an intentional change.
* there are some misalignments on the /* somefile.js */ headers in terms of blank lines surrounding it. This is cosmetic and doesn't matter
* the value of the /* somefile.js */ headers no longer includes the "library/" directory.

The second commit is a bug I discovered in testing. The parser was not able to error because there was no reference to the parser. Moving the parser to a global was a quick fix, there should probably a bit more object orientation in this script, eventually.

I am going to make a few further changes that will likely end up on this same pull request (unless you happen merge it ahead of me):

* Allow -b generate to be passed with zero input files. In this case, the py-builtins.gs will be generated to standard out, or to the output filename or directory if specified with -o
* Allow multiple input filenames to be passed on the command line. Currently exactly one input filename can be specified, but it can be a directory containing multiple files. There should be no reason that multiple arguments can't be included instead/too.