From 88a7580b78ed09c2d31bc182cb760efe9ac15334 Mon Sep 17 00:00:00 2001 From: "zqlu.cn" Date: Fri, 24 Nov 2017 16:37:40 +0800 Subject: [PATCH] Fix interval usage For JavaScript runtime, Interval class constructor assume start and stop to be number. --- runtime/JavaScript/src/antlr4/error/ErrorStrategy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js b/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js index 7af139952..94038e13a 100644 --- a/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js +++ b/runtime/JavaScript/src/antlr4/error/ErrorStrategy.js @@ -267,7 +267,7 @@ DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, if (e.startToken.type===Token.EOF) { input = ""; } else { - input = tokens.getText(new Interval(e.startToken, e.offendingToken)); + input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex)); } } else { input = ""; @@ -753,4 +753,4 @@ BailErrorStrategy.prototype.sync = function(recognizer) { }; exports.BailErrorStrategy = BailErrorStrategy; -exports.DefaultErrorStrategy = DefaultErrorStrategy; \ No newline at end of file +exports.DefaultErrorStrategy = DefaultErrorStrategy;