Skip to content

Commit 1584228

Browse files
committed
Use new EOFSymbol in SLR parsing
This EOFSymbol was introduced when changing the EOF value from 256 to -1
1 parent 0e95db4 commit 1584228

File tree

1 file changed

+7
-0
lines changed
  • org.metaborg.sdf2table/src/main/java/org/metaborg/sdf2table/parsetable

1 file changed

+7
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
import com.google.common.collect.*;
1717

18+
import static org.metaborg.parsetable.characterclasses.CharacterClassFactory.EOF_SINGLETON;
19+
1820
public class ParseTable implements IParseTable, Serializable {
1921

2022
// FIXME Currently generating an LR(0) table, compute first/follow sets to generate SLR(1)
@@ -178,6 +180,11 @@ private void calculateFirst() {
178180
s.setFirst(((CharacterClassSymbol) s).getCC());
179181
continue;
180182
}
183+
// The FIRST set of an EOFSymbol is equal to the EOF singleton character class.
184+
if(s instanceof EOFSymbol) {
185+
s.setFirst(EOF_SINGLETON);
186+
continue;
187+
}
181188

182189
for(IProduction p : symbolProductionsMapping.get(s)) {
183190
// Direct contributions:

0 commit comments

Comments
 (0)