Constellation/escodegen — pull request #32 by RGustBardon (2012-07-23 22:34:45+00:00)
Title: Allow safe concatenation with other programs

Implements #27.

Introduces options.format.safe which takes precedence over
options.format.compact and options.format.semicolons.

If a program is not empty, it emits a new line at the beginning of
the generated code. The rationale behind this is that the program to
which this non-empty program would be concatenated to might end with a
single-line comment.

For the same reason, if a program ends with a single-line comment, a
new line is added after that comment.

If the last statement of a program is to end with a semicolon that
would be removed due to disabled options.format.semicolons, that
semicolon is preserved.

Cases such as "!{}//A" have to wait for the implementation of
expression-level comments.

To the extent possible under law, I have dedicated all copyright and
related and neighboring rights to this patch to the public domain
worldwide.