LighterASTNode (LighterAST tree, @NotNull LighterASTNode node, TokenSet types) { node = tree.getParent(node); while (node != null) { final IElementType type = node.getTokenType(); if (types.contains(type)) return node; if (type != PARENTH_EXPRESSION && type != CONDITIONAL_EXPRESSION) return null; node = tree.getParent(node); } return null; }