Fix interval usage

For JavaScript runtime, Interval class constructor assume start and stop
to be number.
This commit is contained in:
zqlu.cn 2017-11-24 16:37:40 +08:00
parent e158824ca8
commit 88a7580b78
1 changed files with 2 additions and 2 deletions

View File

@ -267,7 +267,7 @@ DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer,
if (e.startToken.type===Token.EOF) { if (e.startToken.type===Token.EOF) {
input = "<EOF>"; input = "<EOF>";
} else { } else {
input = tokens.getText(new Interval(e.startToken, e.offendingToken)); input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
} }
} else { } else {
input = "<unknown input>"; input = "<unknown input>";
@ -753,4 +753,4 @@ BailErrorStrategy.prototype.sync = function(recognizer) {
}; };
exports.BailErrorStrategy = BailErrorStrategy; exports.BailErrorStrategy = BailErrorStrategy;
exports.DefaultErrorStrategy = DefaultErrorStrategy; exports.DefaultErrorStrategy = DefaultErrorStrategy;