boolean (@Nullable IElementType token1, @Nullable IElementType token2) { if (token1 == token2) return false; if (token1 == null || token2 == null) return true; if (StringEscapesTokenTypes.STRING_LITERAL_ESCAPES.contains(token1) || StringEscapesTokenTypes.STRING_LITERAL_ESCAPES.contains(token2)) return false; if (token1 != TokenType.WHITE_SPACE && token2 != TokenType.WHITE_SPACE && !token1.getLanguage().is(token2.getLanguage())) return true; Language language = token1.getLanguage(); if (language == Language.ANY) language = token2.getLanguage(); BidiRegionsSeparator separator = LanguageBidiRegionsSeparator.INSTANCE.forLanguage(language); return separator.createBorderBetweenTokens(token1, token2); }