public class BnfPinMarkerAnnotator implements Annotator, DumbAware {
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) {
if (!(psiElement instanceof BnfRule)) return;
BnfRule rule = (BnfRule) psiElement;
final BnfFile bnfFile = (BnfFile)rule.getContainingFile();
final ArrayList<Pair<BnfExpression, BnfAttr>> pinned = new ArrayList<Pair<BnfExpression, BnfAttr>>();
GrammarUtil.processPinnedExpressions(rule, new PairProcessor<BnfExpression, ParserGeneratorUtil.PinMatcher>() {
@Override
public boolean process(BnfExpression bnfExpression, ParserGeneratorUtil.PinMatcher pinMatcher) {
BnfAttr attr = bnfFile.findAttribute(pinMatcher.rule, KnownAttribute.PIN, pinMatcher.funcName);
return pinned.add(Pair.create(bnfExpression, attr));
}
});
for (int i = 0, len = pinned.size(); i < len; i++) {
BnfExpression e = pinned.get(i).first;