1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

big whitespace / readability change. join top level block with extra newlines, and class definitions as well.

This commit is contained in:
Jeremy Ashkenas 2011-09-18 17:16:39 -05:00
parent 4419f7ca0f
commit d2b0404188
14 changed files with 643 additions and 2 deletions

View file

@ -1,10 +1,13 @@
(function() {
var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments;
exports.OptionParser = OptionParser = (function() {
function OptionParser(rules, banner) {
this.banner = banner;
this.rules = buildRules(rules);
}
OptionParser.prototype.parse = function(args) {
var arg, i, isOption, matchedRule, options, rule, value, _i, _len, _len2, _ref;
options = {
@ -40,6 +43,7 @@
}
return options;
};
OptionParser.prototype.help = function() {
var letPart, lines, rule, spaces, _i, _len, _ref;
lines = [];
@ -54,12 +58,19 @@
}
return "\n" + (lines.join('\n')) + "\n";
};
return OptionParser;
})();
LONG_FLAG = /^(--\w[\w\-]+)/;
SHORT_FLAG = /^(-\w)/;
MULTI_FLAG = /^-(\w{2,})/;
OPTIONAL = /\[(\w+(\*?))\]/;
buildRules = function(rules) {
var tuple, _i, _len, _results;
_results = [];
@ -70,6 +81,7 @@
}
return _results;
};
buildRule = function(shortFlag, longFlag, description, options) {
var match;
if (options == null) options = {};
@ -84,6 +96,7 @@
isList: !!(match && match[2])
};
};
normalizeArguments = function(args) {
var arg, l, match, result, _i, _j, _len, _len2, _ref;
args = args.slice(0);
@ -102,4 +115,5 @@
}
return result;
};
}).call(this);