boolean (@NotNull IElementType tokenType1, @NotNull IElementType tokenType2) { PairedBraceMatcher matcher = getPairedBraceMatcher(tokenType1); if (matcher != null) { BracePair[] pairs = matcher.getPairs(); for (BracePair pair : pairs) { if (pair.getLeftBraceType() == tokenType1 ) return pair.getRightBraceType() == tokenType2; if (pair.getRightBraceType() == tokenType1 ) return pair.getLeftBraceType() == tokenType2; } } if (tokenType2.equals(PAIRING_TOKENS.get(tokenType1))) return true; List<IElementType> keys = PAIRING_TOKENS.getKeysByValue(tokenType1); return keys != null && keys.contains(tokenType2); }