haml-more 0.4.0.c → 0.4.0.d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. data/vendor/coffee-script/Cakefile +8 -0
  2. data/vendor/coffee-script/Rakefile +11 -0
  3. data/vendor/coffee-script/documentation/index.html.erb +85 -50
  4. data/vendor/coffee-script/documentation/js/aliases.js +1 -1
  5. data/vendor/coffee-script/documentation/js/arguments.js +1 -1
  6. data/vendor/coffee-script/documentation/js/array_comprehensions.js +1 -1
  7. data/vendor/coffee-script/documentation/js/assignment.js +1 -1
  8. data/vendor/coffee-script/documentation/js/cake_tasks.js +1 -1
  9. data/vendor/coffee-script/documentation/js/comparisons.js +1 -1
  10. data/vendor/coffee-script/documentation/js/conditionals.js +1 -1
  11. data/vendor/coffee-script/documentation/js/embedded.js +1 -1
  12. data/vendor/coffee-script/documentation/js/existence.js +1 -1
  13. data/vendor/coffee-script/documentation/js/expressions.js +1 -1
  14. data/vendor/coffee-script/documentation/js/expressions_assignment.js +1 -1
  15. data/vendor/coffee-script/documentation/js/expressions_comprehension.js +1 -1
  16. data/vendor/coffee-script/documentation/js/expressions_try.js +1 -1
  17. data/vendor/coffee-script/documentation/js/fat_arrow.js +1 -1
  18. data/vendor/coffee-script/documentation/js/functions.js +1 -1
  19. data/vendor/coffee-script/documentation/js/heredocs.js +1 -1
  20. data/vendor/coffee-script/documentation/js/multiple_return_values.js +1 -1
  21. data/vendor/coffee-script/documentation/js/object_comprehensions.js +1 -1
  22. data/vendor/coffee-script/documentation/js/object_extraction.js +1 -1
  23. data/vendor/coffee-script/documentation/js/objects_and_arrays.js +1 -1
  24. data/vendor/coffee-script/documentation/js/overview.js +1 -1
  25. data/vendor/coffee-script/documentation/js/parallel_assignment.js +1 -1
  26. data/vendor/coffee-script/documentation/js/range_comprehensions.js +1 -1
  27. data/vendor/coffee-script/documentation/js/scope.js +1 -1
  28. data/vendor/coffee-script/documentation/js/slices.js +1 -1
  29. data/vendor/coffee-script/documentation/js/soaks.js +1 -1
  30. data/vendor/coffee-script/documentation/js/splats.js +1 -1
  31. data/vendor/coffee-script/documentation/js/splices.js +1 -1
  32. data/vendor/coffee-script/documentation/js/strings.js +1 -1
  33. data/vendor/coffee-script/documentation/js/super.js +1 -1
  34. data/vendor/coffee-script/documentation/js/switch.js +1 -1
  35. data/vendor/coffee-script/documentation/js/try.js +1 -1
  36. data/vendor/coffee-script/documentation/js/while.js +1 -1
  37. data/vendor/coffee-script/extras/EXTRAS +9 -1
  38. data/vendor/coffee-script/extras/coffee-script.js +1 -0
  39. data/vendor/coffee-script/index.html +83 -48
  40. data/vendor/coffee-script/lib/cake.js +30 -32
  41. data/vendor/coffee-script/lib/coffee-script.js +12 -16
  42. data/vendor/coffee-script/lib/command_line.js +64 -74
  43. data/vendor/coffee-script/lib/grammar.js +1 -1
  44. data/vendor/coffee-script/lib/lexer.js +1 -1
  45. data/vendor/coffee-script/lib/narwhal.js +1 -1
  46. data/vendor/coffee-script/lib/nodes.js +48 -44
  47. data/vendor/coffee-script/lib/optparse.js +11 -17
  48. data/vendor/coffee-script/lib/repl.js +1 -1
  49. data/vendor/coffee-script/lib/rewriter.js +1 -1
  50. data/vendor/coffee-script/lib/scope.js +1 -1
  51. data/vendor/coffee-script/package.json +1 -1
  52. data/vendor/coffee-script/src/cake.coffee +15 -15
  53. data/vendor/coffee-script/src/coffee-script.coffee +6 -6
  54. data/vendor/coffee-script/src/command_line.coffee +43 -39
  55. data/vendor/coffee-script/src/nodes.coffee +43 -41
  56. data/vendor/coffee-script/src/optparse.coffee +6 -13
  57. data/vendor/coffee-script/test/test_destructuring_assignment.coffee +6 -0
  58. metadata +7 -6
@@ -561,4 +561,4 @@
561
561
  }, {
562
562
  debug: false
563
563
  });
564
- })();
564
+ })();
@@ -402,4 +402,4 @@
402
402
  lex.prototype.close_indentation = function close_indentation() {
403
403
  return this.outdent_token(this.indent);
404
404
  };
405
- })();
405
+ })();
@@ -41,4 +41,4 @@
41
41
  return factories[topId] = factories[topId] || this.reload(topId, path);
42
42
  };
43
43
  require.loader.loaders.unshift([".coffee", loader]);
44
- })();
44
+ })();
@@ -1,5 +1,5 @@
1
1
  (function(){
2
- var AccessorNode, ArrayNode, AssignNode, CallNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IfNode, IndexNode, LiteralNode, Node, ObjectNode, OpNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, ValueNode, WhileNode, compact, del, flatten, inherit, merge, statement;
2
+ var AccessorNode, ArrayNode, AssignNode, BaseNode, CallNode, ClosureNode, CodeNode, CommentNode, ExistenceNode, Expressions, ExtendsNode, ForNode, IDENTIFIER, IfNode, IndexNode, LiteralNode, ObjectNode, OpNode, ParentheticalNode, PushNode, RangeNode, ReturnNode, SliceNode, SplatNode, TAB, TRAILING_WHITESPACE, ThrowNode, TryNode, ValueNode, WhileNode, compact, del, flatten, inherit, merge, statement;
3
3
  var __hasProp = Object.prototype.hasOwnProperty;
4
4
  (typeof process !== "undefined" && process !== null) ? process.mixin(require('scope')) : (this.exports = this);
5
5
  // Some helper functions
@@ -90,12 +90,12 @@
90
90
  // generated code should be wrapped up in a closure. An options hash is passed
91
91
  // and cloned throughout, containing messages from higher in the AST,
92
92
  // information about the current scope, and indentation level.
93
- Node = (exports.Node = function Node() { });
93
+ BaseNode = (exports.BaseNode = function BaseNode() { });
94
94
  // This is extremely important -- we convert JS statements into expressions
95
95
  // by wrapping them in a closure, only if it's possible, and we're not at
96
96
  // the top level of a block (which would be unnecessary), and we haven't
97
97
  // already been asked to return the result.
98
- Node.prototype.compile = function compile(o) {
98
+ BaseNode.prototype.compile = function compile(o) {
99
99
  var closure, top;
100
100
  this.options = merge(o || {});
101
101
  this.indent = o.indent;
@@ -110,21 +110,21 @@
110
110
  };
111
111
  // Statements converted into expressions share scope with their parent
112
112
  // closure, to preserve JavaScript-style lexical scope.
113
- Node.prototype.compile_closure = function compile_closure(o) {
113
+ BaseNode.prototype.compile_closure = function compile_closure(o) {
114
114
  this.indent = o.indent;
115
115
  o.shared_scope = o.scope;
116
116
  return ClosureNode.wrap(this).compile(o);
117
117
  };
118
118
  // If the code generation wishes to use the result of a complex expression
119
119
  // in multiple places, ensure that the expression is only ever evaluated once.
120
- Node.prototype.compile_reference = function compile_reference(o) {
120
+ BaseNode.prototype.compile_reference = function compile_reference(o) {
121
121
  var compiled, reference;
122
122
  reference = new LiteralNode(o.scope.free_variable());
123
123
  compiled = new AssignNode(reference, this);
124
124
  return [compiled, reference];
125
125
  };
126
126
  // Quick short method for the current indentation level, plus tabbing in.
127
- Node.prototype.idt = function idt(tabs) {
127
+ BaseNode.prototype.idt = function idt(tabs) {
128
128
  var _a, _b, _c, _d, i, idt;
129
129
  idt = (this.indent || '');
130
130
  _c = 0; _d = (tabs || 0);
@@ -134,7 +134,7 @@
134
134
  return idt;
135
135
  };
136
136
  // Does this node, or any of its children, contain a node of a certain kind?
137
- Node.prototype.contains = function contains(block) {
137
+ BaseNode.prototype.contains = function contains(block) {
138
138
  var _a, _b, node;
139
139
  _a = this.children;
140
140
  for (_b = 0; _b < _a.length; _b++) {
@@ -142,14 +142,14 @@
142
142
  if (block(node)) {
143
143
  return true;
144
144
  }
145
- if (node instanceof Node && node.contains(block)) {
145
+ if (node instanceof BaseNode && node.contains(block)) {
146
146
  return true;
147
147
  }
148
148
  }
149
149
  return false;
150
150
  };
151
151
  // toString representation of the node, for inspecting the parse tree.
152
- Node.prototype.toString = function toString(idt) {
152
+ BaseNode.prototype.toString = function toString(idt) {
153
153
  var _a, _b, _c, child;
154
154
  idt = idt || '';
155
155
  return '\n' + idt + this.type + (function() {
@@ -162,24 +162,24 @@
162
162
  }).call(this).join('');
163
163
  };
164
164
  // Default implementations of the common node methods.
165
- Node.prototype.unwrap = function unwrap() {
165
+ BaseNode.prototype.unwrap = function unwrap() {
166
166
  return this;
167
167
  };
168
- Node.prototype.children = [];
169
- Node.prototype.is_statement = function is_statement() {
168
+ BaseNode.prototype.children = [];
169
+ BaseNode.prototype.is_statement = function is_statement() {
170
170
  return false;
171
171
  };
172
- Node.prototype.is_statement_only = function is_statement_only() {
172
+ BaseNode.prototype.is_statement_only = function is_statement_only() {
173
173
  return false;
174
174
  };
175
- Node.prototype.top_sensitive = function top_sensitive() {
175
+ BaseNode.prototype.top_sensitive = function top_sensitive() {
176
176
  return false;
177
177
  };
178
- Node.prototype.operation_sensitive = function operation_sensitive() {
178
+ BaseNode.prototype.operation_sensitive = function operation_sensitive() {
179
179
  return false;
180
180
  };
181
181
  // A collection of nodes, each one representing an expression.
182
- Expressions = (exports.Expressions = inherit(Node, {
182
+ Expressions = (exports.Expressions = inherit(BaseNode, {
183
183
  type: 'Expressions',
184
184
  constructor: function constructor(nodes) {
185
185
  this.children = (this.expressions = compact(flatten(nodes || [])));
@@ -212,7 +212,7 @@
212
212
  },
213
213
  compile: function compile(o) {
214
214
  o = o || {};
215
- return o.scope ? Node.prototype.compile.call(this, o) : this.compile_root(o);
215
+ return o.scope ? BaseNode.prototype.compile.call(this, o) : this.compile_root(o);
216
216
  },
217
217
  // Compile each expression in the Expressions body.
218
218
  compile_node: function compile_node(o) {
@@ -233,7 +233,7 @@
233
233
  o.scope = new Scope(null, this, null);
234
234
  code = o.globals ? this.compile_node(o) : this.compile_with_declarations(o);
235
235
  code = code.replace(TRAILING_WHITESPACE, '');
236
- return o.no_wrap ? code : "(function(){\n" + code + "\n})();";
236
+ return o.no_wrap ? code : "(function(){\n" + code + "\n})();\n";
237
237
  },
238
238
  // Compile the expressions body, with declarations of all inner variables
239
239
  // pushed up to the top.
@@ -287,7 +287,7 @@
287
287
  statement(Expressions);
288
288
  // Literals are static values that can be passed through directly into
289
289
  // JavaScript without translation, eg.: strings, numbers, true, false, null...
290
- LiteralNode = (exports.LiteralNode = inherit(Node, {
290
+ LiteralNode = (exports.LiteralNode = inherit(BaseNode, {
291
291
  type: 'Literal',
292
292
  constructor: function constructor(value) {
293
293
  this.value = value;
@@ -310,7 +310,7 @@
310
310
  }));
311
311
  LiteralNode.prototype.is_statement_only = LiteralNode.prototype.is_statement;
312
312
  // Return an expression, or wrap it in a closure and return it.
313
- ReturnNode = (exports.ReturnNode = inherit(Node, {
313
+ ReturnNode = (exports.ReturnNode = inherit(BaseNode, {
314
314
  type: 'Return',
315
315
  constructor: function constructor(expression) {
316
316
  this.children = [(this.expression = expression)];
@@ -327,7 +327,7 @@
327
327
  }));
328
328
  statement(ReturnNode, true);
329
329
  // A value, indexed or dotted into, or vanilla.
330
- ValueNode = (exports.ValueNode = inherit(Node, {
330
+ ValueNode = (exports.ValueNode = inherit(BaseNode, {
331
331
  type: 'Value',
332
332
  SOAK: " == undefined ? undefined : ",
333
333
  constructor: function constructor(base, properties) {
@@ -399,7 +399,7 @@
399
399
  }));
400
400
  // Pass through CoffeeScript comments into JavaScript comments at the
401
401
  // same position.
402
- CommentNode = (exports.CommentNode = inherit(Node, {
402
+ CommentNode = (exports.CommentNode = inherit(BaseNode, {
403
403
  type: 'Comment',
404
404
  constructor: function constructor(lines) {
405
405
  this.lines = lines;
@@ -412,7 +412,7 @@
412
412
  statement(CommentNode);
413
413
  // Node for a function invocation. Takes care of converting super() calls into
414
414
  // calls against the prototype's function of the same name.
415
- CallNode = (exports.CallNode = inherit(Node, {
415
+ CallNode = (exports.CallNode = inherit(BaseNode, {
416
416
  type: 'Call',
417
417
  constructor: function constructor(variable, args) {
418
418
  this.children = flatten([(this.variable = variable), (this.args = (args || []))]);
@@ -477,7 +477,7 @@
477
477
  }));
478
478
  // Node to extend an object's prototype with an ancestor object.
479
479
  // After goog.inherits from the Closure Library.
480
- ExtendsNode = (exports.ExtendsNode = inherit(Node, {
480
+ ExtendsNode = (exports.ExtendsNode = inherit(BaseNode, {
481
481
  type: 'Extends',
482
482
  constructor: function constructor(child, parent) {
483
483
  this.children = [(this.child = child), (this.parent = parent)];
@@ -506,7 +506,7 @@
506
506
  statement(ExtendsNode);
507
507
  // A dotted accessor into a part of a value, or the :: shorthand for
508
508
  // an accessor into the object's prototype.
509
- AccessorNode = (exports.AccessorNode = inherit(Node, {
509
+ AccessorNode = (exports.AccessorNode = inherit(BaseNode, {
510
510
  type: 'Accessor',
511
511
  constructor: function constructor(name, tag) {
512
512
  this.children = [(this.name = name)];
@@ -519,7 +519,7 @@
519
519
  }
520
520
  }));
521
521
  // An indexed accessor into a part of an array or object.
522
- IndexNode = (exports.IndexNode = inherit(Node, {
522
+ IndexNode = (exports.IndexNode = inherit(BaseNode, {
523
523
  type: 'Index',
524
524
  constructor: function constructor(index, tag) {
525
525
  this.children = [(this.index = index)];
@@ -532,7 +532,7 @@
532
532
  }));
533
533
  // A range literal. Ranges can be used to extract portions (slices) of arrays,
534
534
  // or to specify a range for list comprehensions.
535
- RangeNode = (exports.RangeNode = inherit(Node, {
535
+ RangeNode = (exports.RangeNode = inherit(BaseNode, {
536
536
  type: 'Range',
537
537
  constructor: function constructor(from, to, exclusive) {
538
538
  this.children = [(this.from = from), (this.to = to)];
@@ -577,7 +577,7 @@
577
577
  // An array slice literal. Unlike JavaScript's Array#slice, the second parameter
578
578
  // specifies the index of the end of the slice (just like the first parameter)
579
579
  // is the index of the beginning.
580
- SliceNode = (exports.SliceNode = inherit(Node, {
580
+ SliceNode = (exports.SliceNode = inherit(BaseNode, {
581
581
  type: 'Slice',
582
582
  constructor: function constructor(range) {
583
583
  this.children = [(this.range = range)];
@@ -592,7 +592,7 @@
592
592
  }
593
593
  }));
594
594
  // An object literal.
595
- ObjectNode = (exports.ObjectNode = inherit(Node, {
595
+ ObjectNode = (exports.ObjectNode = inherit(BaseNode, {
596
596
  type: 'Object',
597
597
  constructor: function constructor(props) {
598
598
  this.children = (this.objects = (this.properties = props || []));
@@ -639,7 +639,7 @@
639
639
  }
640
640
  }));
641
641
  // An array literal.
642
- ArrayNode = (exports.ArrayNode = inherit(Node, {
642
+ ArrayNode = (exports.ArrayNode = inherit(BaseNode, {
643
643
  type: 'Array',
644
644
  constructor: function constructor(objects) {
645
645
  this.children = (this.objects = objects || []);
@@ -694,7 +694,7 @@
694
694
  }
695
695
  });
696
696
  // Setting the value of a local variable, or the value of an object property.
697
- AssignNode = (exports.AssignNode = inherit(Node, {
697
+ AssignNode = (exports.AssignNode = inherit(BaseNode, {
698
698
  type: 'Assign',
699
699
  PROTO_ASSIGN: /^(\S+)\.prototype/,
700
700
  LEADING_DOT: /^\.(prototype\.)?/,
@@ -756,7 +756,7 @@
756
756
  // object literals to a value. Peeks at their properties to assign inner names.
757
757
  // See: http://wiki.ecmascript.org/doku.php?id=harmony:destructuring
758
758
  compile_pattern_match: function compile_pattern_match(o) {
759
- var _a, _b, access_class, assigns, i, idx, obj, val, val_var;
759
+ var _a, _b, access_class, assigns, code, i, idx, obj, val, val_var;
760
760
  val_var = o.scope.free_variable();
761
761
  assigns = [this.idt() + val_var + ' = ' + this.value.compile(o) + ';'];
762
762
  o.top = true;
@@ -781,7 +781,11 @@
781
781
  }
782
782
  assigns.push(new AssignNode(obj, val).compile(o));
783
783
  }
784
- return assigns.join("\n");
784
+ code = assigns.join("\n");
785
+ if (o.returns) {
786
+ code += '\n' + this.idt() + 'return ' + this.variable.compile(o) + ';';
787
+ }
788
+ return code;
785
789
  },
786
790
  compile_splice: function compile_splice(o) {
787
791
  var from, l, name, plus, range, to;
@@ -798,7 +802,7 @@
798
802
  }));
799
803
  // A function definition. The only node that creates a new Scope.
800
804
  // A CodeNode does not have any children -- they're within the new scope.
801
- CodeNode = (exports.CodeNode = inherit(Node, {
805
+ CodeNode = (exports.CodeNode = inherit(BaseNode, {
802
806
  type: 'Code',
803
807
  constructor: function constructor(params, body, tag) {
804
808
  this.params = params;
@@ -865,7 +869,7 @@
865
869
  }));
866
870
  // A splat, either as a parameter to a function, an argument to a call,
867
871
  // or in a destructuring assignment.
868
- SplatNode = (exports.SplatNode = inherit(Node, {
872
+ SplatNode = (exports.SplatNode = inherit(BaseNode, {
869
873
  type: 'Splat',
870
874
  constructor: function constructor(name) {
871
875
  if (!(name.compile)) {
@@ -890,7 +894,7 @@
890
894
  }));
891
895
  // A while loop, the only sort of low-level loop exposed by CoffeeScript. From
892
896
  // it, all other loops can be manufactured.
893
- WhileNode = (exports.WhileNode = inherit(Node, {
897
+ WhileNode = (exports.WhileNode = inherit(BaseNode, {
894
898
  type: 'While',
895
899
  constructor: function constructor(condition, opts) {
896
900
  this.children = [(this.condition = condition)];
@@ -933,7 +937,7 @@
933
937
  statement(WhileNode);
934
938
  // Simple Arithmetic and logical operations. Performs some conversion from
935
939
  // CoffeeScript operations into their JavaScript equivalents.
936
- OpNode = (exports.OpNode = inherit(Node, {
940
+ OpNode = (exports.OpNode = inherit(BaseNode, {
937
941
  type: 'Op',
938
942
  CONVERSIONS: {
939
943
  '==': '===',
@@ -1019,7 +1023,7 @@
1019
1023
  }
1020
1024
  }));
1021
1025
  // A try/catch/finally block.
1022
- TryNode = (exports.TryNode = inherit(Node, {
1026
+ TryNode = (exports.TryNode = inherit(BaseNode, {
1023
1027
  type: 'Try',
1024
1028
  constructor: function constructor(attempt, error, recovery, ensure) {
1025
1029
  this.children = compact([(this.attempt = attempt), (this.recovery = recovery), (this.ensure = ensure)]);
@@ -1040,7 +1044,7 @@
1040
1044
  }));
1041
1045
  statement(TryNode);
1042
1046
  // Throw an exception.
1043
- ThrowNode = (exports.ThrowNode = inherit(Node, {
1047
+ ThrowNode = (exports.ThrowNode = inherit(BaseNode, {
1044
1048
  type: 'Throw',
1045
1049
  constructor: function constructor(expression) {
1046
1050
  this.children = [(this.expression = expression)];
@@ -1052,7 +1056,7 @@
1052
1056
  }));
1053
1057
  statement(ThrowNode, true);
1054
1058
  // Check an expression for existence (meaning not null or undefined).
1055
- ExistenceNode = (exports.ExistenceNode = inherit(Node, {
1059
+ ExistenceNode = (exports.ExistenceNode = inherit(BaseNode, {
1056
1060
  type: 'Existence',
1057
1061
  constructor: function constructor(expression) {
1058
1062
  this.children = [(this.expression = expression)];
@@ -1075,7 +1079,7 @@
1075
1079
  return '(typeof ' + first.compile(o) + ' !== "undefined" && ' + second.compile(o) + ' !== null)';
1076
1080
  };
1077
1081
  // An extra set of parentheses, specified explicitly in the source.
1078
- ParentheticalNode = (exports.ParentheticalNode = inherit(Node, {
1082
+ ParentheticalNode = (exports.ParentheticalNode = inherit(BaseNode, {
1079
1083
  type: 'Paren',
1080
1084
  constructor: function constructor(expression) {
1081
1085
  this.children = [(this.expression = expression)];
@@ -1101,7 +1105,7 @@
1101
1105
  // into a for loop. Also acts as an expression, able to return the result
1102
1106
  // of the comprehenion. Unlike Python array comprehensions, it's able to pass
1103
1107
  // the current index of the loop as a second parameter.
1104
- ForNode = (exports.ForNode = inherit(Node, {
1108
+ ForNode = (exports.ForNode = inherit(BaseNode, {
1105
1109
  type: 'For',
1106
1110
  constructor: function constructor(body, source, name, index) {
1107
1111
  var _a;
@@ -1199,7 +1203,7 @@
1199
1203
  // expression by pushing down requested returns to the expression bodies.
1200
1204
  // Single-expression IfNodes are compiled into ternary operators if possible,
1201
1205
  // because ternaries are first-class returnable assignable expressions.
1202
- IfNode = (exports.IfNode = inherit(Node, {
1206
+ IfNode = (exports.IfNode = inherit(BaseNode, {
1203
1207
  type: 'If',
1204
1208
  constructor: function constructor(condition, body, else_body, tags) {
1205
1209
  this.condition = condition;
@@ -1325,4 +1329,4 @@
1325
1329
  return if_part + ' : ' + else_part;
1326
1330
  }
1327
1331
  }));
1328
- })();
1332
+ })();
@@ -1,21 +1,19 @@
1
1
  (function(){
2
2
  var LONG_FLAG, OPTIONAL, SHORT_FLAG, build_rule, build_rules, op, spaces;
3
3
  // Create an OptionParser with a list of valid options.
4
- op = (exports.OptionParser = function OptionParser(rules) {
5
- this.banner = 'Usage: [Options]';
4
+ op = (exports.OptionParser = function OptionParser(rules, banner) {
5
+ this.banner = banner || 'Usage: [Options]';
6
6
  this.options_title = 'Available options:';
7
7
  this.rules = build_rules(rules);
8
- this.actions = {};
9
8
  return this;
10
9
  });
11
- // Add a callback to fire when a particular option is encountered.
12
- op.prototype.add = function add(value, callback) {
13
- return this.actions[value] = callback;
14
- };
15
10
  // Parse the argument array, calling defined callbacks, returning the remaining non-option arguments.
16
11
  op.prototype.parse = function parse(args) {
17
- var _a, _b, arg, callback, is_option, results, rule, value;
18
- results = [];
12
+ var _a, _b, arg, is_option, options, rule;
13
+ arguments = Array.prototype.slice.call(arguments, 0);
14
+ options = {
15
+ arguments: []
16
+ };
19
17
  args = args.concat([]);
20
18
  while (((arg = args.shift()))) {
21
19
  is_option = false;
@@ -23,20 +21,16 @@
23
21
  for (_b = 0; _b < _a.length; _b++) {
24
22
  rule = _a[_b];
25
23
  if (rule.letter === arg || rule.flag === arg) {
26
- callback = this.actions[rule.name];
27
- value = rule.argument && args.shift();
28
- if (callback) {
29
- callback(value);
30
- }
24
+ options[rule.name] = rule.argument ? args.shift() : true;
31
25
  is_option = true;
32
26
  break;
33
27
  }
34
28
  }
35
29
  if (!(is_option)) {
36
- results.push(arg);
30
+ options.arguments.push(arg);
37
31
  }
38
32
  }
39
- return results;
33
+ return options;
40
34
  };
41
35
  // Return the help text for this OptionParser, for --help and such.
42
36
  op.prototype.help = function help() {
@@ -114,4 +108,4 @@
114
108
  }
115
109
  return builder.join('');
116
110
  };
117
- })();
111
+ })();
@@ -29,4 +29,4 @@
29
29
  process.stdio.addListener('data', readline);
30
30
  process.stdio.open();
31
31
  print(prompt);
32
- })();
32
+ })();
@@ -380,4 +380,4 @@
380
380
  });
381
381
  })(this));
382
382
  };
383
- })();
383
+ })();
@@ -111,4 +111,4 @@
111
111
  Scope.prototype.compiled_assignments = function compiled_assignments() {
112
112
  return this.assigned_variables().join(', ');
113
113
  };
114
- })();
114
+ })();
@@ -3,5 +3,5 @@
3
3
  "description": "Unfancy JavaScript",
4
4
  "keywords": ["javascript", "language"],
5
5
  "author": "Jeremy Ashkenas",
6
- "version": "0.5.1"
6
+ "version": "0.5.2"
7
7
  }