fix #1023: getExpectedTokens() returns out of context tokens on consecutive runs

This commit is contained in:
Martin Probst 2015-10-21 10:50:05 +02:00
parent 8abc1106f7
commit af9e8a1e92
1 changed files with 2 additions and 1 deletions

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;