void (PsiElement expression, List<Object> result, Ref<? super Boolean> unparsable) { if (expression instanceof PsiParenthesizedExpression) { collectOperands(((PsiParenthesizedExpression)expression).getExpression(), result, unparsable); } else if (expression instanceof PsiTypeCastExpression) { collectOperands(((PsiTypeCastExpression)expression).getOperand(), result, unparsable); } else if (expression instanceof PsiConditionalExpression) { unparsable.set(Boolean.TRUE); collectOperands(((PsiConditionalExpression)expression).getThenExpression(), result, unparsable); addStringFragment(" ", result); // do not glue branches together collectOperands(((PsiConditionalExpression)expression).getElseExpression(), result, unparsable); } else if (expression instanceof PsiPolyadicExpression binaryExpression && ((PsiPolyadicExpression)expression).getOperationTokenType() == JavaTokenType.PLUS) { for (PsiExpression operand : binaryExpression.getOperands()) { collectOperands(operand, result, unparsable); } } else if (expression instanceof PsiAssignmentExpression assignmentExpression && ((PsiAssignmentExpression)expression).getOperationTokenType() == JavaTokenType.PLUSEQ) { unparsable.set(Boolean.TRUE); collectOperands(assignmentExpression.getLExpression(), result, unparsable); collectOperands(assignmentExpression.getRExpression(), result, unparsable); } else if (PsiUtilEx.isStringOrCharacterLiteral(expression)) { result.add(expression); } else if (expression instanceof PsiExpression) { SmartList<PsiExpression> uncomputables = new SmartList<>(); Object o = myEvaluationHelper.computeExpression((PsiExpression)expression, uncomputables); // in many languages 'null' is a reserved word addStringFragment(o == null? "missingValue" : String.valueOf(o), result); if (uncomputables.size() > 0) { unparsable.set(Boolean.TRUE); } } else { unparsable.set(Boolean.TRUE); result.add(expression); } }