@ -2,7 +2,6 @@
"use strict";
var util = require("util");
var fs = require("fs");
var path = require("path");
var PEG = require("../lib/peg");
@ -10,39 +9,39 @@ var PEG = require("../lib/peg");
/* Helpers */
function printVersion() {
util.puts ("PEG.js " + PEG.VERSION);
console.log ("PEG.js " + PEG.VERSION);
}
function printHelp() {
util.puts ("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
util.puts ("");
util.puts ("Generates a parser from the PEG grammar specified in the <input_file> and writes");
util.puts ("it to the <output_file>.");
util.puts ("");
util.puts ("If the <output_file> is omitted, its name is generated by changing the");
util.puts ("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
util.puts ("omitted, standard input and output are used.");
util.puts ("");
util.puts ("Options:");
util.puts (" -e, --export-var <variable> name of the variable where the parser");
util.puts (" object will be stored (default:");
util.puts (" \"module.exports\")");
util.puts (" --cache make generated parser cache results");
util.puts (" --allowed-start-rules <rules> comma-separated list of rules the generated");
util.puts (" parser will be allowed to start parsing");
util.puts (" from (default: the first rule in the");
util.puts (" grammar)");
util.puts (" -o, --optimize <goal> select optimization for speed or size");
util.puts (" (default: speed)");
util.puts (" --trace enable tracing in generated parser");
util.puts (" --plugin <plugin> use a specified plugin (can be specified");
util.puts (" multiple times)");
util.puts (" --extra-options <options> additional options (in JSON format) to pass");
util.puts (" to PEG.buildParser");
util.puts (" --extra-options-file <file> file with additional options (in JSON");
util.puts (" format) to pass to PEG.buildParser");
util.puts (" -v, --version print version information and exit");
util.puts (" -h, --help print help and exit");
console.log ("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
console.log ("");
console.log ("Generates a parser from the PEG grammar specified in the <input_file> and writes");
console.log ("it to the <output_file>.");
console.log ("");
console.log ("If the <output_file> is omitted, its name is generated by changing the");
console.log ("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
console.log ("omitted, standard input and output are used.");
console.log ("");
console.log ("Options:");
console.log (" -e, --export-var <variable> name of the variable where the parser");
console.log (" object will be stored (default:");
console.log (" \"module.exports\")");
console.log (" --cache make generated parser cache results");
console.log (" --allowed-start-rules <rules> comma-separated list of rules the generated");
console.log (" parser will be allowed to start parsing");
console.log (" from (default: the first rule in the");
console.log (" grammar)");
console.log (" -o, --optimize <goal> select optimization for speed or size");
console.log (" (default: speed)");
console.log (" --trace enable tracing in generated parser");
console.log (" --plugin <plugin> use a specified plugin (can be specified");
console.log (" multiple times)");
console.log (" --extra-options <options> additional options (in JSON format) to pass");
console.log (" to PEG.buildParser");
console.log (" --extra-options-file <file> file with additional options (in JSON");
console.log (" format) to pass to PEG.buildParser");
console.log (" -v, --version print version information and exit");
console.log (" -h, --help print help and exit");
}
function exitSuccess() {
@ -54,7 +53,7 @@ function exitFailure() {
}
function abort(message) {
util .error(message);
console .error(message);
exitFailure();
}