diff --git a/bin/pegjs b/bin/pegjs index e934ed9..57d2b76 100755 --- a/bin/pegjs +++ b/bin/pegjs @@ -1,5 +1,7 @@ #!/usr/bin/env node +/* eslint no-console: 0 */ + "use strict"; var fs = require("fs"); @@ -219,17 +221,20 @@ while (args.length > 0 && isOption(args[0])) { nextArg(); } +var inputStream; +var outputStream; + switch (args.length) { case 0: process.stdin.resume(); - var inputStream = process.stdin; - var outputStream = process.stdout; + inputStream = process.stdin; + outputStream = process.stdout; break; case 1: case 2: var inputFile = args[0]; - var inputStream = fs.createReadStream(inputFile); + inputStream = fs.createReadStream(inputFile); inputStream.on("error", function() { abort("Can't read from file \"" + inputFile + "\"."); }); @@ -237,7 +242,7 @@ switch (args.length) { var outputFile = args.length === 1 ? args[0].replace(/\.[^.]*$/, ".js") : args[1]; - var outputStream = fs.createWriteStream(outputFile); + outputStream = fs.createWriteStream(outputFile); outputStream.on("error", function() { abort("Can't write to file \"" + outputFile + "\"."); });