Skip to content

Commit 0e95db4

Browse files
committed
Correctly calculate contains-the-follow-of
1 parent ca85161 commit 0e95db4

File tree

1 file changed

+3
-2
lines changed
  • org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable

1 file changed

+3
-2
lines changed

org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable/ParseTable.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private void calculateFollow() {
243243
for(ISymbol s : symbols) {
244244
for(IProduction p : symbolProductionsMapping.get(s)) {
245245
List<ISymbol> rightHand = p.rightHand();
246-
for(int i = 0, rightHandSize = rightHand.size(); i < rightHandSize; i++) {
246+
i: for(int i = 0, rightHandSize = rightHand.size(); i < rightHandSize; i++) {
247247
ISymbol symbolI = rightHand.get(i);
248248

249249
// If p is of the shape A = A0 ... Ai Ak ... Am Aj ... An
@@ -252,8 +252,9 @@ private void calculateFollow() {
252252
ISymbol symbolJ = rightHand.get(j);
253253
containsTheFirstOf.put(symbolI, symbolJ);
254254

255+
// If Ak ... An are NOT all nullable, continue with next Ai
255256
if(!symbolJ.isNullable())
256-
break;
257+
continue i;
257258
}
258259

259260
// If Ak ... An are all nullable, FOLLOW(Ai) contains FOLLOW(A)

0 commit comments

Comments
 (0)