diff --git a/src/org/rascalmpl/library/util/ErrorRecovery.java b/src/org/rascalmpl/library/util/ErrorRecovery.java index d117a59d717..8282d3dec4a 100644 --- a/src/org/rascalmpl/library/util/ErrorRecovery.java +++ b/src/org/rascalmpl/library/util/ErrorRecovery.java @@ -31,10 +31,12 @@ public ErrorRecovery(IRascalValueFactory rascalValues) { private static class ScoredTree { public final IConstructor tree; public final int score; + public final boolean hasErrors; - public ScoredTree(IConstructor tree, int score) { + public ScoredTree(IConstructor tree, int score, boolean hasErrors) { this.tree = tree; this.score = score; + this.hasErrors = hasErrors; } } @@ -60,8 +62,8 @@ private ScoredTree disambiguate(IConstructor tree, boolean allowAmbiguity, Map disambiguatedAlt.score) { + errorAltWithBestScore = disambiguatedAlt; + } + } else { // Non-error tree if (alternativesWithoutErrors == null) { alternativesWithoutErrors = rascalValues.setWriter(); } alternativesWithoutErrors.insert(disambiguatedAlt.tree); - } else { - // Only keep the best of the error trees - if (errorAltWithBestScore == null || errorAltWithBestScore.score > disambiguatedAlt.score) { - errorAltWithBestScore = disambiguatedAlt; - } } } @@ -166,7 +170,7 @@ private ScoredTree disambiguateAmb(ITree amb, boolean allowAmbiguity, Map