void (PsiElement @NotNull [] elements, @NotNull GlobalCompilingVisitor globalVisitor) { if (elements.length > 1) throw new MalformedPatternException(); final CompiledPattern pattern = globalVisitor.getContext().getPattern(); for (PsiElement element : elements) { if (element instanceof PsiComment comment) { final String commentText = comment.getText(); if (globalVisitor.hasFragments(commentText)) { final MatchingHandler handler = globalVisitor.processPatternStringWithFragments(commentText, GlobalCompilingVisitor.OccurenceKind.COMMENT); if (handler != null) { comment.putUserData(CompiledPattern.HANDLER_KEY, handler); } } else { globalVisitor.handle(comment); } pattern.getHandler(element).setFilter(e -> e instanceof PsiComment); } else if (element instanceof Property property) { pattern.getHandler(element).setFilter(e -> e instanceof Property); final PsiElement firstChild = property.getFirstChild(); if (firstChild instanceof PropertyKeyImpl) { globalVisitor.handle(firstChild); pattern.getHandler(firstChild).setFilter(e -> e instanceof PropertyKeyImpl); } final PsiElement lastChild = property.getLastChild(); if (lastChild instanceof PropertyValueImpl) { final String valueText = lastChild.getText(); final MatchingHandler handler = globalVisitor.processPatternStringWithFragments(valueText, GlobalCompilingVisitor.OccurenceKind.TEXT); if (handler != null) { lastChild.putUserData(CompiledPattern.HANDLER_KEY, handler); } pattern.getHandler(firstChild).setFilter(e -> e instanceof PropertyValueImpl); } } pattern.setHandler(element, new TopLevelMatchingHandler(pattern.getHandler(element))); } }