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

Fixed lingering CoffeeScript Compiler running live in Internet Explorer bugs. Implemented helpers.index_of and removed named functions. Ticket #366

This commit is contained in:
Jeremy Ashkenas 2010-05-14 23:40:04 -04:00
parent f84eb9ed47
commit dfb3a13246
16 changed files with 319 additions and 298 deletions

View file

@ -5,7 +5,7 @@
// parser: new OptionParser switches, help_banner
// options: parser.parse process.argv
exports.OptionParser = (function() {
OptionParser = function OptionParser(rules, banner) {
OptionParser = function(rules, banner) {
this.banner = banner;
this.rules = build_rules(rules);
return this;
@ -18,7 +18,7 @@
// containing the remaning non-option arguments. This is a simpler API than
// many option parsers that allow you to attach callback actions for every
// flag. Instead, you're responsible for interpreting the options object.
OptionParser.prototype.parse = function parse(args) {
OptionParser.prototype.parse = function(args) {
var _a, _b, _c, arg, is_option, matched_rule, options, rule;
options = {
arguments: []
@ -47,7 +47,7 @@
};
// Return the help text for this **OptionParser**, listing and describing all
// of the valid options, for `--help` and such.
OptionParser.prototype.help = function help() {
OptionParser.prototype.help = function() {
var _a, _b, _c, _d, _e, _f, i, let_part, lines, rule, spaces;
lines = ['Available options:'];
if (this.banner) {
@ -80,7 +80,7 @@
OPTIONAL = /\[(.+)\]/;
// Build and return the list of option rules. If the optional *short-flag* is
// unspecified, leave it out by padding with `null`.
build_rules = function build_rules(rules) {
build_rules = function(rules) {
var _a, _b, _c, _d, tuple;
_a = []; _c = rules;
for (_b = 0, _d = _c.length; _b < _d; _b++) {
@ -96,7 +96,7 @@
};
// Build a rule from a `-o` short flag, a `--output [DIR]` long flag, and the
// description of what the option does.
build_rule = function build_rule(short_flag, long_flag, description) {
build_rule = function(short_flag, long_flag, description) {
var match;
match = long_flag.match(OPTIONAL);
long_flag = long_flag.match(LONG_FLAG)[1];
@ -110,7 +110,7 @@
};
// Normalize arguments by expanding merged flags into multiple flags. This allows
// you to have `-wl` be the same as `--watch --lint`.
normalize_arguments = function normalize_arguments(args) {
normalize_arguments = function(args) {
var _a, _b, _c, _d, _e, _f, arg, l, match, result;
args = args.slice(0);
result = [];