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;
BnfExpression prev = i == 0? null : pinned.get(i - 1).first;
BnfAttr attr = pinned.get(i).second;
boolean fullRange = prev == null || !PsiTreeUtil.isAncestor(e, prev, true);
TextRange textRange = e.getTextRange();
TextRange infoRange = fullRange ? textRange : TextRange.create(prev.getTextRange().getEndOffset() + 1, textRange.getEndOffset());
String message = attr == null? (fullRange ? "pinned" : "pinned again") : attr.getText();
annotationHolder.createInfoAnnotation(infoRange, message).setTextAttributes(BnfSyntaxHighlighter.PIN_MARKER);
}
}