diff --git a/org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable/ParseTable.java b/org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable/ParseTable.java index 18d1f8a65..397f28804 100644 --- a/org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable/ParseTable.java +++ b/org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable/ParseTable.java @@ -238,7 +238,7 @@ private void calculateFollow() { for(ISymbol s : symbols) { for(IProduction p : symbolProductionsMapping.get(s)) { List rightHand = p.rightHand(); - for(int i = 0, rightHandSize = rightHand.size(); i < rightHandSize; i++) { + i: for(int i = 0, rightHandSize = rightHand.size(); i < rightHandSize; i++) { ISymbol symbolI = rightHand.get(i); // If p is of the shape A = A0 ... Ai Ak ... Am Aj ... An @@ -247,8 +247,9 @@ private void calculateFollow() { ISymbol symbolJ = rightHand.get(j); containsTheFirstOf.put(symbolI, symbolJ); + // If Ak ... An are NOT all nullable, continue with next Ai if(!symbolJ.isNullable()) - break; + continue i; } // If Ak ... An are all nullable, FOLLOW(Ai) contains FOLLOW(A)