Ian learns how to use exceptions in JavaScript.
This commit is contained in:
@@ -576,7 +576,8 @@ rr.ZeroOrMore_.prototype.match = function(context) {
|
|||||||
return { 'done': true };
|
return { 'done': true };
|
||||||
}
|
}
|
||||||
if (next['value']['context'].remaining() == context.remaining()) {
|
if (next['value']['context'].remaining() == context.remaining()) {
|
||||||
throw "Child of ZeroOrMore didn't consume input; grammar bug?";
|
throw new Error(
|
||||||
|
"Child of ZeroOrMore didn't consume input; grammar bug?");
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
@@ -751,7 +752,7 @@ rr.Context.prototype.remaining = function() {
|
|||||||
*/
|
*/
|
||||||
rr.Context.prototype.advance = function(numChars) {
|
rr.Context.prototype.advance = function(numChars) {
|
||||||
if (!numChars) {
|
if (!numChars) {
|
||||||
throw 'Context.advance(0) called';
|
throw new Error('Context.advance(0) called');
|
||||||
}
|
}
|
||||||
var context = this.copy();
|
var context = this.copy();
|
||||||
context.inputIndex += numChars;
|
context.inputIndex += numChars;
|
||||||
|
|||||||
Reference in New Issue
Block a user