boolean (@NotNull IElementType source, @NotNull TokenSet tokenSet) { if (tokenSet.contains(source)) { return true; } if (source instanceof ParentProviderElementType) { Set<IElementType> parents = ((ParentProviderElementType)source).getParents(); return ContainerUtil.exists(parents, parent -> parent != null && containsWithSourceParent(parent, tokenSet)); } return false; }