List<IElementType> (ASTNode node, TokenSet types) { List<IElementType> foundTypes = new SmartList<>(); for (ASTNode child = node.getFirstChildNode(); child != null && child.getTreeParent() == node; child = child.getTreeNext()) { IElementType type = child.getElementType(); if (types.contains(type)) { foundTypes.add(type); } } return foundTypes; }