}
@Nullable
private Pair<PsiElement, PsiElement> getArguments(PsiFile file, int offset) {
PsiElement element = file.getViewProvider().findElementAt(offset);
final BnfChoice choice = PsiTreeUtil.getParentOfType(element, BnfChoice.class);
if (choice == null) return null;
for (PsiElement cur = choice.getFirstChild(), prev = null; cur != null; cur = cur.getNextSibling()) {
if (!(cur instanceof BnfExpression) ) continue;
int start = prev == null? choice.getTextRange().getStartOffset() : prev.getTextRange().getEndOffset();
int end = cur.getTextRange().getStartOffset();
if (start <= offset && offset <= end) return Pair.create(cur, prev);
prev = cur;
}
return null;