final Set<BnfRule> rules = new THashSet<BnfRule>();
GrammarUtil.processChildrenDummyAware(file, new Processor<PsiElement>() {
@Override
public boolean process(PsiElement psiElement) {
String name = psiElement instanceof BnfRule ? ((BnfRule)psiElement).getName() : null;
BnfRule rule = name == null? null : bnfFile.getRule(name);
if (name != null && rule != psiElement) {
rules.add(rule);
rules.add((BnfRule)psiElement);
}
return true;
}
});
for (BnfRule rule : rules) {
problemsHolder.registerProblem(rule.getId(), "'" + rule.getName() + "' rule is defined more than once");
}
}