Returned expression results in first non-NULL, non-MISSING value.
776054
public static Expression ifMissingOrNull(Expression expression1, Expression expression2, Expression... others) {
        return build("IFMISSINGORNULL", expression1, expression2, others);
    }
640927
@Override
	public Expression getValueExpression() {
		return ifThenElse(equalTo(count, literal(0L)), nullOf(getResultType()), div(sum, count));
	}
1278699
@Nonnull
  public static Value evalExpression(@Nonnull final String expression, @Nonnull final PreprocessorContext context) {
    try {
      final ExpressionTree tree = ExpressionParser.getInstance().parse(expression, context);
      return evalTree(tree, context);
    } catch (IOException unexpected) {
      throw context.makeException("[Expression]Wrong expression format detected [" + expression + ']', unexpected);
    }
  }
489302
@NonNull
    public Expression equalTo(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new BinaryExpression(this, expression, BinaryExpression.OpType.EqualTo);
    }
175109
@NonNull
    public static Expression negated(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new CompoundExpression(Arrays.asList(expression), CompoundExpression.OpType.Not);
    }
416953
Expression XreadValueSpecificationOrNull() {

        Expression e     = null;
        boolean    minus = false;

        switch (token.tokenType) {

            case Tokens.PLUS :
                read();
                break;

            case Tokens.MINUS :
                read();

                minus = true;
                break;
        }

        e = XreadUnsignedValueSpecificationOrNull();

        if (e == null) {
            return null;
        }

        if (minus) {
            e = new ExpressionArithmetic(OpTypes.NEGATE, e);
        }

        return e;
    }
1215761
@NonNull
    public static ValueIndexItem expression(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new ValueIndexItem(expression);
    }
843570
private ParseTree parseReturnStatement() {
    SourcePosition start = getTreeStartLocation();
    eat(TokenType.RETURN);
    ParseTree expression = null;
    if (!peekImplicitSemiColon()) {
      expression = parseExpression();
    }
    eatPossibleImplicitSemiColon();
    return new ReturnStatementTree(getTreeLocation(start), expression);
  }
1060748
private void evaluateExpressions() throws JspException {
        /* 
         * Note: we don't check for type mismatches here; we assume
         * the expression evaluator will return the expected type
         * (by virtue of knowledge we give it about what that type is).
         * A ClassCastException here is truly unexpected, so we let it
         * propagate up.
         */

        if (begin_ != null) {
            Object r = ExpressionEvaluatorManager.evaluate(
                    "begin", begin_, Integer.class, this, pageContext);
            if (r == null) {
                throw new NullAttributeException("forEach", "begin");
            }
            begin = ((Integer) r).intValue();
            validateBegin();
        }

        if (end_ != null) {
            Object r = ExpressionEvaluatorManager.evaluate(
                    "end", end_, Integer.class, this, pageContext);
            if (r == null) {
                throw new NullAttributeException("forEach", "end");
            }
            end = ((Integer) r).intValue();
            validateEnd();
        }

        if (step_ != null) {
            Object r = ExpressionEvaluatorManager.evaluate(
                    "step", step_, Integer.class, this, pageContext);
            if (r == null) {
                throw new NullAttributeException("forEach", "step");
            }
            step = ((Integer) r).intValue();
            validateStep();
        }

        if (items_ != null) {
            rawItems = ExpressionEvaluatorManager.evaluate(
                    "items", items_, Object.class, this, pageContext);
            // use an empty list to indicate "no iteration", if relevant
            if (rawItems == null) {
                rawItems = new ArrayList();
            }
        }
    }
1306177
private final Return returnStatement(Data data) throws TemplateException {
	if (!data.srcCode.forwardIfCurrentAndNoVarExt("return")) return null;

	Position line = data.srcCode.getPosition();
	Return rtn;

	comments(data);
	if (checkSemiColonLineFeed(data, false, false, false)) rtn = new Return(data.factory, line, data.srcCode.getPosition());
	else {
	    Expression expr = expression(data);
	    checkSemiColonLineFeed(data, true, true, false);
	    rtn = new Return(expr, line, data.srcCode.getPosition());
	}
	comments(data);

	return rtn;
    }
266014
public BooleanExpression isNull() {
        if (isnull == null) {
            isnull = Expressions.booleanOperation(Ops.IS_NULL, mixin);
        }
        return isnull;
    }
850171
private String ifNull(int rowIndex){

        if(params.length != 2){
            throw new IllegalArgumentException("Wrong number of Parameters for if null expression");
        }

        final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
        final String field1 = currentRecord.getValueByFieldName(params[0]);

        if (!field1.isEmpty()){
            return field1;
        }
        final String field2 = currentRecord.getValueByFieldName(params[1]);
        return field2;
    }
554622
function getConditional ( parser ) {
  	var start, expression, ifTrue, ifFalse;

  	expression = readLogicalOr$1( parser );
  	if ( !expression ) {
  		return null;
  	}

  	start = parser.pos;

  	parser.allowWhitespace();

  	if ( !parser.matchString( '?' ) ) {
  		parser.pos = start;
  		return expression;
  	}

  	parser.allowWhitespace();

  	ifTrue = readExpression( parser );
  	if ( !ifTrue ) {
  		parser.error( expectedExpression );
  	}

  	parser.allowWhitespace();

  	if ( !parser.matchString( ':' ) ) {
  		parser.error( 'Expected ":"' );
  	}

  	parser.allowWhitespace();

  	ifFalse = readExpression( parser );
  	if ( !ifFalse ) {
  		parser.error( expectedExpression );
  	}

  	return {
  		t: CONDITIONAL,
  		o: [ expression, ifTrue, ifFalse ]
  	};
  }
423313
final public Expression ValuePrefix() throws ParseException {
  Expression ret;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INTEGER_LITERAL:
    case FLOATING_POINT_LITERAL:
    case STRING_LITERAL:
    case TRUE:
    case FALSE:
    case NULL:
      ret = Literal();
      break;
    case LPAREN:
      jj_consume_token(LPAREN);
      ret = Expression();
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[27] = jj_gen;
      if (jj_2_1(2147483647)) {
        ret = FunctionInvocation();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ret = NamedValue();
          break;
        default:
          jj_la1[28] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
      {if (true) return ret;}
    throw new Error("Missing return statement in function");
  }
746375
@SuppressWarnings("rawtypes")
    private static Object findFirstNonNull(Iterator it) {
        Object result = null;
        while(it.hasNext()) {
            result = it.next();
            if(result != null) {
                break;
            }
        }
        return result;
    }
1134670
private static String getFreeVariable(Expression2 expression, int index, Scope scope) {
    Expression2 sub = expression.getSubexpression(index);
    if (sub.isConstant()) {
      String constant = sub.getConstant();
      if (!constant.equals(LAMBDA) && !scope.isBound(constant)) {
        return sub.getConstant();
      } 
    }
    return null;
  }
1280125
@NonNull
    public Expression isNot(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new BinaryExpression(this, expression, BinaryExpression.OpType.IsNot);
    }