boolean (@NotNull FileType fileType, @NotNull HighlighterIterator iterator, @NotNull CharSequence fileText) { Stack<IElementType> braceStack = new Stack<>(); Stack<String> tagNameStack = new Stack<>(); BraceMatcher matcher = getBraceMatcher(fileType, iterator); while (!iterator.atEnd()) { if (isStructuralBraceToken(fileType, iterator, fileText)) { if (isRBraceToken(iterator, fileText, fileType)) { braceStack.push(iterator.getTokenType()); tagNameStack.push(getTagName(matcher, fileText, iterator)); } if (isLBraceToken(iterator, fileText, fileType)) { if (braceStack.isEmpty()) return true; int group = matcher.getBraceTokenGroupId(iterator.getTokenType()); IElementType topTokenType = braceStack.pop(); IElementType tokenType = iterator.getTokenType(); boolean isStrict = isStrictTagMatching(matcher, fileType, group); boolean isCaseSensitive = areTagsCaseSensitive(matcher, fileType, group); String topTagName = null; String tagName = null; if (isStrict) { topTagName = tagNameStack.pop(); tagName = getTagName(matcher, fileText, iterator); } if (!isPairBraces(topTokenType, tokenType, fileType) || isStrict && !Comparing.equal(topTagName, tagName, isCaseSensitive)) { return false; } } } iterator.retreat(); } return false; }