bin/pegjs: Output just the parser source if --export-var is empty

This will make embedding generated parsers into other files easier.

Based on a patch by Glen Huang:

  https://github.com/dmajda/pegjs/pull/143
redux
David Majda 12 years ago
parent e1af175af8
commit 2dc39bb779

@ -197,7 +197,9 @@ readStream(inputStream, function(input) {
}
}
outputStream.write(exportVar + " = " + source + ";\n");
outputStream.write(
exportVar !== "" ? exportVar + " = " + source + ";\n" : source + "\n"
);
if (outputStream !== process.stdout) {
outputStream.end();
}

Loading…
Cancel
Save