Skip to content

Commit

Permalink
Add KItem subsorts to the disambiguation module when parsing progra…
Browse files Browse the repository at this point in the history
…ms (#3814)

Previously, when parsing programs, the subsort declarations `syntax
KItem ::= Sort` were only added to the parsing module. However, sort
inference is run in the disambiguation module, so they should be
included there as well.

This is necessary for #3601.
  • Loading branch information
Scott-Guest authored Nov 15, 2023
1 parent faffe57 commit 1ddf072
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,12 @@ public static Tuple3<Module, Module, Module> getCombinedGrammarImpl(
// if no start symbol has been defined in the configuration, then use K
for (Sort srt : iterable(mod.allSorts())) {
if (!isParserSort(srt) && !mod.listSorts().contains(srt)) {
// K ::= Sort
// KItem ::= Sort
prods3.add(Production(Seq(), Sorts.KItem(), Seq(NonTerminal(srt)), Att()));
}
}
// Add KItem subsorts to disambiguation for use by sort inference
disambProds.addAll(prods3);
// for each triple, generate a new pattern which works better for parsing lists in programs.
prods3.addAll(new HashSet<>(parseProds));
Set<Sentence> res = new HashSet<>();
Expand Down

0 comments on commit 1ddf072

Please sign in to comment.