Remove 'fs' as dependency

This commit is contained in:
Tyler Long
2017-09-10 23:16:35 +08:00
parent 4947c75ff7
commit c5a7eeaa0f
11 changed files with 106 additions and 106 deletions

View File

@@ -84,19 +84,19 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return yy;
return yy;
break;
case 4:
break;
case 6:
yy.setInfo(true);
yy.setInfo(true);
break;
case 7:
yy.setMessage($$[$0]);
yy.setMessage($$[$0]);
break;
case 8:
this.$ = $$[$0-1].substring(1).trim().replace(/\\n/gm, "\n");
this.$ = $$[$0-1].substring(1).trim().replace(/\\n/gm, "\n");
break;
}
},
@@ -621,14 +621,14 @@ exports.parser = parser;
exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) {
if (!args[1]) {
console.log('Usage: '+args[0]+' FILE');
process.exit(1);
}
var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
return exports.parser.parse(source);
// if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE');
// process.exit(1);
// }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source);
};
if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1));
}
}
}