diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/HoistingProcessor.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/HoistingProcessor.java index 51df56ba9..9ad351e47 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/HoistingProcessor.java +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/HoistingProcessor.java @@ -238,7 +238,7 @@ public class HoistingProcessor { // all paths are trivial // if there is a terminal on all branches set has terminal to true - // else we need might need to consider the following tokens in the path + // else we might need to consider the following tokens in the path if (guards.stream().allMatch(HoistingGuard::hasTerminal)) { return HoistingGuard.terminal(); } else { diff --git a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/pathAnalysis/TokenAnalysis.java b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/pathAnalysis/TokenAnalysis.java index 43a48273a..41953d2da 100644 --- a/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/pathAnalysis/TokenAnalysis.java +++ b/org.eclipse.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/parser/antlr/hoisting/pathAnalysis/TokenAnalysis.java @@ -500,7 +500,7 @@ public class TokenAnalysis { tokenCombinations(indexList -> { log.info("current index list: " + indexList); - // no context analysis + // no context analysis // TODO why? List> tokenListsForPath = getTokenPaths(element, indexList, false); List> tokenListForContext = getTokenPathsContextOnly(element, indexList); @@ -572,7 +572,8 @@ public class TokenAnalysis { } public List> getAllPossiblePaths(AbstractElement path) { - return getTokenPaths(path, new TokenAnalysisPaths(range(0, config.getTokenLimit() + 1)), false, false, true) + // token limit + 2 so identity analysis will recognize paths that are identical up to the token limit on the flattened tree + return getTokenPaths(path, new TokenAnalysisPaths(range(0, config.getTokenLimit() + 2)), false, false, true) .getTokenPaths() .stream() .map(l -> l.stream()