Permalink
Browse files

Update documentation.

  • Loading branch information...
1 parent a60e5d9 commit 5cedc78688117570c4f9f4899b319e6b361944e6 @weaver committed Aug 18, 2010
Showing with 8 additions and 8 deletions.
  1. +6 −6 README.md
  2. +2 −2 lib/reparse.js
View
@@ -154,14 +154,14 @@ Return an array of one or more values produced by `method`. Each
value is separated by `sep` and the entire sequence is optionally
terminated by `sep`.
-#### .chainl(method, op, otherwise) ####
+#### .chainl(method, op, [otherwise]) ####
-Parse zero or more values produced by `method` and separated by `op`.
-Returns a value obtained by left associative application of functions
-returned by `op`. This can be used to eliminate direct
-left-recursion.
+This can be used to eliminate direct left-recursion. Parse zero or
+more values produced by `method` and separated by `op`. Returns a
+value obtained by left associative application of functions returned
+by `op`. If zero values are produced, return otherwise.
-#### .chainl1(method, op, otherwise) ####
+#### .chainl1(method, op) ####
Like `.chainl`, but at least one value must be produced by `method`.
For example, this grammar:
View
@@ -263,6 +263,6 @@ ReParse.prototype.chainl = function(method, op, otherwise, min) {
return (min && (found < min)) ? this.fail(input) : result;
};
-ReParse.prototype.chainl1 = function(method, op, otherwise) {
- return this.chainl(method, op, otherwise, 1);
+ReParse.prototype.chainl1 = function(method, op) {
+ return this.chainl(method, op, undefined, 1);
};

0 comments on commit 5cedc78

Please sign in to comment.