Skip to content

Commit

Permalink
Don't use list labels for elements that appear twice in a block set
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Jan 6, 2017
1 parent 204c281 commit 587ea36
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ protected void enterBlockSet(GrammarAST tree) {

@Override
protected void exitBlockSet(GrammarAST tree) {
for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) {
// This visitor counts a block set as a sequence of elements, not a
// sequence of alternatives of elements. Reset the count back to 1
// for all items when leaving the set to ensure duplicate entries in
// the set are treated as a maximum of one item.
entry.getValue().v = 1;
}

if (minFrequencies.peek().size() > 1) {
// Everything is optional
minFrequencies.peek().clear();
Expand Down

0 comments on commit 587ea36

Please sign in to comment.