support shebangs - fixes #55

This commit is contained in:
Sebastian McKenzie
2014-10-13 11:55:33 +11:00
parent 4f14810321
commit 51db2ee136
2 changed files with 12 additions and 4 deletions

View File

@@ -33,6 +33,17 @@ File.normaliseOptions = function (opts) {
return opts;
};
File.prototype.parse = function (code) {
// remove shebang
code = code.replace(/^\#\!.*/, "");
var self = this;
return util.parse(this.opts, code, function (tree) {
return self.transform(tree);
});
};
File.prototype.transform = function (ast) {
this.ast = ast;

View File

@@ -11,10 +11,7 @@ function transform(code, opts) {
code = (code || "") + "";
var file = new File(opts);
return util.parse(opts, code, function (tree) {
return file.transform(tree);
});
return util.parse(code);
}
transform.test = function (task, assert) {