I loathe storing the product.
This commit is contained in:
parent
c6aa50fc11
commit
b43f34afa8
|
@ -38,14 +38,14 @@
|
|||
|
||||
this.choice = __bind(this.choice, this);
|
||||
|
||||
this.match = __bind(this.match, this);
|
||||
|
||||
this.between = __bind(this.between, this);
|
||||
|
||||
this.option = __bind(this.option, this);
|
||||
|
||||
this.maybe = __bind(this.maybe, this);
|
||||
|
||||
this.match = __bind(this.match, this);
|
||||
|
||||
this.start = __bind(this.start, this);
|
||||
|
||||
this.produce = __bind(this.produce, this);
|
||||
|
@ -101,6 +101,20 @@
|
|||
throw new Error("Could not parse '" + this.input + "'.");
|
||||
};
|
||||
|
||||
ReParse.prototype.match = function(pattern) {
|
||||
var probe;
|
||||
probe = this.input.match(pattern);
|
||||
if (!probe) {
|
||||
return this.fail();
|
||||
}
|
||||
this.input = this.input.substr(probe[0].length);
|
||||
if (probe[1] === undefined) {
|
||||
return probe[0];
|
||||
} else {
|
||||
return probe[1];
|
||||
}
|
||||
};
|
||||
|
||||
ReParse.prototype.maybe = function(method) {
|
||||
var input;
|
||||
input = this.input;
|
||||
|
@ -142,20 +156,6 @@
|
|||
return this.fail(input);
|
||||
};
|
||||
|
||||
ReParse.prototype.match = function(pattern) {
|
||||
var probe;
|
||||
probe = this.input.match(pattern);
|
||||
if (!probe) {
|
||||
return this.fail();
|
||||
}
|
||||
this.input = this.input.substr(probe[0].length);
|
||||
if (probe[1] === undefined) {
|
||||
return probe[0];
|
||||
} else {
|
||||
return probe[1];
|
||||
}
|
||||
};
|
||||
|
||||
ReParse.prototype.choice = function() {
|
||||
var arg, input, _i, _len;
|
||||
input = this.input;
|
||||
|
@ -233,12 +233,10 @@
|
|||
min = null;
|
||||
}
|
||||
input = this.input;
|
||||
result = (function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
result = [];
|
||||
while (!this.eof()) {
|
||||
try {
|
||||
this.maybe(method);
|
||||
result.push(this.maybe(method));
|
||||
} catch (err) {
|
||||
if (err !== this.fail) {
|
||||
throw err;
|
||||
|
@ -246,8 +244,6 @@
|
|||
}
|
||||
break;
|
||||
}
|
||||
return _results;
|
||||
}).call(this);
|
||||
if (min && (result.length < min)) {
|
||||
return this.fail(input);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue