Merge branch 'closure-labels' of github.com:sharwell/antlr4 into main

This commit is contained in:
Terence Parr 2012-09-04 18:40:25 -07:00
commit a0563656f7
1 changed files with 13 additions and 1 deletions

View File

@ -170,7 +170,19 @@ public class RuleFunction extends OutputModelObject {
FrequencySet<String> altFreq = getElementFrequenciesForAlt(ast);
for (GrammarAST t : refs) {
String refLabelName = t.getText();
if ( altFreq.count(t.getText())>1 ) needsList.add(refLabelName);
if (needsList.contains(refLabelName)) {
continue;
}
if ( altFreq.count(t.getText())>1 ) {
needsList.add(refLabelName);
}
else {
boolean inLoop = t.hasAncestor(CLOSURE) || t.hasAncestor(POSITIVE_CLOSURE);
if (inLoop) {
needsList.add(refLabelName);
}
}
}
}
Set<Decl> decls = new HashSet<Decl>();