Constellation/escodegen — pull request #18 by RGustBardon (2012-07-17 22:42:03+00:00)
Title: Add JSON and concise representation of strings

Introduces options.format.quotes and options.format.escapeless.

options.format.json takes precedence over the abovementioned options
and is meant to mimic JSON.stringify.

options.format.json results in delimiting strings with U+0022
(QUOTATION MARK), escaping U+002F (SOLIDUS), and escaping U+0000
through U+001F without resorting to hexadecimal escape sequences, \0,
and \v.

Regardless of the value of options.format.json, LINE SEPARATOR
(U+2028) and PARAGRAPH SEPARATOR (U+2029) are always escaped.

If options.format.quotes is set to 'double', it results in delimiting
strings with U+0022 (QUOTATION MARK). If it is set to 'auto', it
results in delimiting strings with a delimiter that leads to a shorter
string literal.

If options.format.escapeless is set to true, it results in escaping
only those characters that are required to be escaped.