Merge pull request #1026 from martin-probst/master

fix #1023: getExpectedTokens() returns out of context tokens on conse…
This commit is contained in:
Terence Parr 2015-10-25 12:32:29 -07:00
commit 5148e15d93
2 changed files with 3 additions and 1 deletions

View File

@ -78,3 +78,4 @@ YYYY/MM/DD, github id, Full name, email
2015/08/18, krzkaczor, Krzysztof Kaczor, krzysztof@kaczor.io
2015/09/18, worsht, Rajiv Subrahmanyam, rajiv.public@gmail.com
2015/10/08, fedotovalex, Alex Fedotov, me@alexfedotov.com
2015/10/21, martin-probst, Martin Probst, martin-probst@web.de

View File

@ -269,7 +269,8 @@ DefaultErrorStrategy.prototype.sync = function(recognizer) {
case ATNState.PLUS_LOOP_BACK:
case ATNState.STAR_LOOP_BACK:
this.reportUnwantedToken(recognizer);
var expecting = recognizer.getExpectedTokens();
var expecting = new IntervalSet();
expecting.addSet(recognizer.getExpectedTokens());
var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
break;