Returns the value as an expression. Only call on an expression attribute.
492342
public ExprNode valueAsExpr(ErrorReporter reporter) {
    checkState(value == null);
    if (valueExprList.size() > 1) {
      reporter.report(
          valueExprList.get(1).getSourceLocation(), EXPECTED_A_SINGLE_EXPRESSION, key.identifier());
      // Return the first expr to avoid an NPE in CallNode ctor.
      return valueExprList.get(0);
    }
    return Iterables.getOnlyElement(valueExprList);
  }
912329
def get_value(self):
        
        if (self._value is None) and (self.expr is not None):
            self._value = self.expr.get_value()

        return self._value
305701
public Expression getFromExpression() {
        if (_fromExpression == null && _from != null) {
            _fromExpression = ExpressionFactory.INSTANCE.create(_from, null, _propertyResolver);
        }
        return _fromExpression;
    }
386506
public Object eval(String expression) {
    	expression = transform(expression);
    	Object result = calculate(expression);
        return result;
    }
64963
public static Statement returnExpression(final Expression expression) {
    // TODO(lukes): it would be nice to do a checkType operation here to make sure that expression
    // is compatible with the return type of the method, but i don't know how to get that
    // information here (reasonably).  So it is the caller's responsibility.
    return new Statement() {
      @Override
      protected void doGen(CodeBuilder adapter) {
        expression.gen(adapter);
        adapter.returnValue();
      }
    };
  }
1135786
def get_value(self, expression):
        """"""
        self._check_valid()
        return super(Result, self).get_value(expression)
1251566
public static ValueExpression eval( CssFormatter formatter, Expression expr ) {
        expr = expr.unpack( formatter ); // unpack to increase the chance to find a ValueExpression
        if( expr.getClass() == ValueExpression.class ) {
            return (ValueExpression)expr;
        }
        ValueExpression valueEx = new ValueExpression( expr, expr.stringValue( formatter ) );
        valueEx.type = expr.getDataType( formatter );
        valueEx.unit = expr.unit( formatter );
        switch( valueEx.type ) {
            case STRING:
            case BOOLEAN:
                break; //string is already set
            case LIST:
                Operation op = valueEx.op = new Operation( expr, ' ' );
                ArrayList<Expression> operants = expr.listValue( formatter ).getOperands();
                for( int j = 0; j < operants.size(); j++ ) {
                    op.addOperand( ValueExpression.eval( formatter, operants.get( j ) ) );
                }
                break;
            default:
                valueEx.value = expr.doubleValue( formatter );
        }
        return valueEx;
    }
115867
public String getExpressionString() {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < mElements.length; i++) {
            Object elem = mElements[i];
            if (elem instanceof String) {
                buf.append((String) elem);
            } else if (elem instanceof Expression) {
                buf.append("${");
                buf.append(((Expression) elem).getExpressionString());
                buf.append("}");
            }
        }
        return buf.toString();
    }
114873
public String getProperty(String expression) {
    if (expression == null || expression.length() == 0) { return expression; }
    for (int i = 0; i < expression.length(); i++) {
      char c = expression.charAt(i);
      if (c == Nested) {
        return expression.substring(0, i);
      } else if (c == MappedStart || c == IndexedStart) { return expression.substring(0, i); }
    }
    return expression;
  }
1358582
private ExpressionEvaluator getExpressionEvaluator()
    {
        if (ee == null)
            ee = ExpressionEvaluatorFactory.getInstance();

        assert(ee != null);
        return ee;
    }
1201882
def jx_expression_to_function(expr):
    
    if is_expression(expr):
        if is_op(expr, ScriptOp) and not is_text(expr.script):
            return expr.script
        else:
            return compile_expression(Python[expr].to_python())
    if (
        expr != None
        and not is_data(expr)
        and not is_list(expr)
        and hasattr(expr, "__call__")
    ):
        return expr
    return compile_expression(Python[jx_expression(expr)].to_python())
1001151
public String conditionalExpression() throws RecognitionException {
        int first = input.index();
        exprParser.conditionalExpression();
        if ( state.failed ) return null;

        if ( state.backtracking == 0 && input.index() > first ) {
            // expression consumed something
            String expr = input.toString( first,
                                          input.LT( -1 ).getTokenIndex() );
            return expr;
        }
        return null;
    }
381767
function getAttributeValue(babelTypes, attributes, name) { // {{{
  var attribute = getAttribute(babelTypes, attributes, name);

  if (typeof attribute === 'undefined') {
    return attribute;
  }

  var attributeValue = attribute.value;

  if (typeof attributeValue.expression !== 'undefined') {
    return attributeValue.expression;
  }

  return attributeValue;
}
636419
def _expression_to_string(expression):
    
    if isinstance(expression, BinaryExp):
        left = _expression_to_string(expression.op1)
        if isinstance(expression.op1, BinaryExp) and not (
                expression.op1.precedence > expression.precedence
                or expression.op1.precedence == expression.precedence
                and expression.associates in ('left', 'both')):
            left = '(' + left + ')'

        right = _expression_to_string(expression.op2)
        if isinstance(expression.op2, BinaryExp) and not (
                expression.precedence < expression.op2.precedence
                or expression.precedence == expression.op2.precedence
                and expression.associates in ('right', 'both')):
            right = '(' + right + ')'

        return left + expression.operator + right
    elif isinstance(expression, Function):
        return expression.name + '(' + _expression_to_string(expression.expression) + ')'
    elif isinstance(expression, Parameter):
        return str(expression)
    else:
        return format_parameter(expression)
1338038
public Expression asCheap() {
    if (isCheap()) {
      return this;
    }
    return new Expression(resultType, features.plus(Feature.CHEAP)) {
      @Override
      protected void doGen(CodeBuilder adapter) {
        Expression.this.gen(adapter);
      }
    };
  }
1101717
public final DRL5Expressions.annotationValue_return annotationValue() throws RecognitionException {
		DRL5Expressions.annotationValue_return retval = new DRL5Expressions.annotationValue_return();
		retval.start = input.LT(1);

		try {
			// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:205:3: ( expression | annotationArray )
			int alt21=2;
			int LA21_0 = input.LA(1);
			if ( (LA21_0==BOOL||(LA21_0 >= DECIMAL && LA21_0 <= DECR)||LA21_0==FLOAT||LA21_0==HEX||(LA21_0 >= ID && LA21_0 <= INCR)||(LA21_0 >= LEFT_PAREN && LA21_0 <= LESS)||LA21_0==MINUS||LA21_0==NEGATION||LA21_0==NULL||LA21_0==PLUS||(LA21_0 >= STAR && LA21_0 <= TIME_INTERVAL)) ) {
				alt21=1;
			}
			else if ( (LA21_0==LEFT_CURLY) ) {
				alt21=2;
			}

			else {
				if (state.backtracking>0) {state.failed=true; return retval;}
				NoViableAltException nvae =
					new NoViableAltException("", 21, 0, input);
				throw nvae;
			}

			switch (alt21) {
				case 1 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:205:5: expression
					{
					pushFollow(FOLLOW_expression_in_annotationValue1053);
					expression();
					state._fsp--;
					if (state.failed) return retval;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:205:18: annotationArray
					{
					pushFollow(FOLLOW_annotationArray_in_annotationValue1057);
					annotationArray();
					state._fsp--;
					if (state.failed) return retval;
					}
					break;

			}
			retval.stop = input.LT(-1);

		}

		catch (RecognitionException re) {
		    throw re;
		}

		finally {
			// do for sure before leaving
		}
		return retval;
	}
141120
def _as_spl_expr(value):
    
    import streamsx._streams._numpy

    if hasattr(value, 'spl_json'):
        return value
      
    if isinstance(value, Enum):
        value = streamsx.spl.op.Expression.expression(value.name)

    npcnv = streamsx._streams._numpy.as_spl_expr(value)
    if npcnv is not None:
        return npcnv
    
    return value