Execute a variable access expression at a given point in the function or
method body. This simply loads the value of the given variable from the
frame.

@param expr
--- The expression to execute
@param frame
--- The current stack frame
@return
434322
private RValue executeVariableAccess(Expr.VariableAccess expr, CallStack frame) {
		Decl.Variable decl = expr.getVariableDeclaration();
		return frame.getLocal(decl.getName());
	}
842117
protected ElemTemplateElement getElemFromExpression(Expression expr)
  {
  	ExpressionNode parent = expr.exprGetParent();
  	while(null != parent)
  	{
  		if(parent instanceof ElemTemplateElement)
  			return (ElemTemplateElement)parent;
  		parent = parent.exprGetParent();
  	}
  	throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null));
  	// "Programmer's error! expr has no ElemTemplateElement parent!");
  }
1302913
def assign(self, expr):
        """"""
        name = self.variable()
        self.statements.append(ast.Assign([ast.Name(name, ast.Store())], expr))
        return ast.Name(name, ast.Load())
1037525
public final DSLMapParser.variable_reference_expr_return variable_reference_expr() throws RecognitionException {
		DSLMapParser.variable_reference_expr_return retval = new DSLMapParser.variable_reference_expr_return();
		retval.start = input.LT(1);

		Object root_0 = null;

		Token set36=null;

		Object set36_tree=null;

		try {
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:248:5: ( ( LITERAL | EQUALS )+ )
			// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:248:8: ( LITERAL | EQUALS )+
			{
			root_0 = (Object)adaptor.nil();


			// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:248:8: ( LITERAL | EQUALS )+
			int cnt17=0;
			loop17:
			while (true) {
				int alt17=2;
				int LA17_0 = input.LA(1);
				if ( (LA17_0==EQUALS||LA17_0==LITERAL) ) {
					alt17=1;
				}

				switch (alt17) {
				case 1 :
					// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:
					{
					set36=input.LT(1);
					if ( input.LA(1)==EQUALS||input.LA(1)==LITERAL ) {
						input.consume();
						if ( state.backtracking==0 ) adaptor.addChild(root_0, (Object)adaptor.create(set36));
						state.errorRecovery=false;
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return retval;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						throw mse;
					}
					}
					break;

				default :
					if ( cnt17 >= 1 ) break loop17;
					if (state.backtracking>0) {state.failed=true; return retval;}
					EarlyExitException eee = new EarlyExitException(17, input);
					throw eee;
				}
				cnt17++;
			}

			}

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

			if ( state.backtracking==0 ) {
			retval.tree = (Object)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
293186
public static Object calculateGuess(JCExpression expr) {
		if (expr instanceof JCLiteral) {
			JCLiteral lit = (JCLiteral) expr;
			if (lit.getKind() == com.sun.source.tree.Tree.Kind.BOOLEAN_LITERAL) {
				return ((Number) lit.value).intValue() == 0 ? false : true;
			}
			return lit.value;
		}
		
		if (expr instanceof JCIdent || expr instanceof JCFieldAccess) {
			String x = expr.toString();
			if (x.endsWith(".class")) return new ClassLiteral(x.substring(0, x.length() - 6));
			int idx = x.lastIndexOf('.');
			if (idx > -1) x = x.substring(idx + 1);
			return new FieldSelect(x);
		}
		
		return null;
	}
280782
public static Query parseQuery(String expr) {
    try {
      return (Query) parse(expr);
    } catch (ClassCastException e) {
      throw new IllegalArgumentException("invalid query expression: " + expr, e);
    }
  }
42588
@Override
    public GroovyExpression apply(GroovyExpression expr, OptimizationContext context) {

        FunctionCallExpression exprAsFunction = (FunctionCallExpression)expr;
        GroovyExpression result = exprAsFunction.getCaller();

        List<GroovyExpression> nonExtractableArguments = new ArrayList<>();
        for(GroovyExpression argument : exprAsFunction.getArguments()) {

            if (GremlinQueryOptimizer.isExtractable(argument)) {
                //Set the caller of the deepest expression in the call hierarchy
                //of the argument to point to the current result.
                //For example, if result is "g.V()" and the updatedArgument is "has('x').has('y')",
                //updatedArgument would be a tree like this:
                //
                //                  has('y')
                //                 /
                //                / caller
                //              |/_
                //           has('x')
                //             /
                //            / caller
                //          |/_
                //        (null)
                //
                //We would set the caller of has('x') to be g.V(), so result would become g.V().has('x').has('y').
                //
                // Note: This operation is currently done by making a copy of the argument tree.  That should
                // be changed.
                result = GremlinQueryOptimizer.copyWithNewLeafNode(
                        (AbstractFunctionExpression) argument, result);
            } else {
                logger_.warn("Found non-extractable argument '{}' in the 'and' expression '{}'",argument.toString(), expr.toString());
                nonExtractableArguments.add(argument);
            }
        }

        if (!nonExtractableArguments.isEmpty()) {
            //add a final 'and' call with the arguments that could not be extracted
            result =  factory.generateLogicalExpression(result, "and", nonExtractableArguments);
        }
        return result;
    }
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;
    }
847409
public static <T> JDOQuery<T> select(Expression<T> expr) {
        return new JDOQuery<Void>().select(expr);
    }
487513
function callExpression(exprFn, key, value) {
          locals[valueName] = value;
          if (keyName) locals[keyName] = key;
          return exprFn(scope, locals);
        }
707771
private Statement store(final Expression expr, final Optional<Label> firstVarInstruction) {
    expr.checkAssignableTo(resultType());
    return new Statement() {
      @Override
      protected void doGen(CodeBuilder adapter) {
        expr.gen(adapter);
        if (firstVarInstruction.isPresent()) {
          adapter.mark(firstVarInstruction.get());
        }
        adapter.visitVarInsn(resultType().getOpcode(Opcodes.ISTORE), index());
      }
    };
  }
1270601
def __get_scope(cls,
            expr: Union['Expression', Tuple]) -> Set[str]:
        '''
        '''
        scope = set()
        for i, atom in enumerate(expr):
            if isinstance(atom, Expression):
                scope.update(cls.__get_scope(atom._expr))
            elif type(atom) in [tuple, list]:
                scope.update(cls.__get_scope(atom))
            elif atom == 'pvar_expr':
                functor, params = expr[i+1]
                arity = len(params) if params is not None else 0
                name = '{}/{}'.format(functor, arity)
                scope.add(name)
                break
        return scope
1248655
private Object evaluateExpressionInternal(String expression, String attrName, PageContext pageContext)
            throws JspException
    {
        if (logger.isDebugEnabled())
            logger.debug("evaluate expression=\"" + expression + "\"");

        Object result = null;
        try {
            VariableResolver vr = ImplicitObjectUtil.getReadVariableResolver(pageContext);
            result = getExpressionEvaluator().evaluateStrict(expression, vr);
        }
        catch (ExpressionEvaluationException ee) {
            // if there is an expression evaluation error set the error and return null
            if (logger.isWarnEnabled())
                logger.warn(Bundle.getString("Tags_ExpressionEvaluationFailure", expression));

            // create the expression info an add it to the error tracking
            EvalErrorInfo info = new EvalErrorInfo();
            info.evalExcp = ee;
            info.expression = expression;
            info.attr = attrName;
            info.tagType = _tag.getTagName();

            // report the error
            _tag.registerTagError(info);
            return null;
        }
        catch (Exception e) {
            String s = Bundle.getString("Tags_ExpressionEvaluationException", new Object[]{expression, e.toString()});
            _tag.registerTagError(s, e);
            return null;
        }

        if (logger.isDebugEnabled()) logger.debug("resulting object: " + result);
        return result;
    }
1138599
private void unbox(Expression expr, PrimitiveType primitiveType) {
    TypeElement boxedClass = findBoxedSuperclass(expr.getTypeMirror());
    if (primitiveType == null && boxedClass != null) {
      primitiveType = typeUtil.unboxedType(boxedClass.asType());
    }
    if (primitiveType == null) {
      return;
    }
    ExecutableElement valueMethod = ElementUtil.findMethod(
        boxedClass, TypeUtil.getName(primitiveType) + VALUE_METHOD);
    assert valueMethod != null : "could not find value method for " + boxedClass;
    MethodInvocation invocation = new MethodInvocation(new ExecutablePair(valueMethod), null);
    expr.replaceWith(invocation);
    invocation.setExpression(expr);
  }
1205481
private Statement expressionStatement(Data data, Body parent) throws TemplateException {

	// first we check if we have a access modifier
	int pos = data.srcCode.getPos();
	int access = -1;
	boolean _final = false;
	if (data.context == CTX_CFC || data.context == CTX_STATIC) {
	    if (data.srcCode.forwardIfCurrent("final ")) {
		_final = true;
		comments(data);
	    }
	    if (data.srcCode.forwardIfCurrent("private ")) {
		access = Component.ACCESS_PRIVATE;
		comments(data);
	    }
	    else if (data.srcCode.forwardIfCurrent("package ")) {
		access = Component.ACCESS_PACKAGE;
		comments(data);
	    }
	    else if (data.srcCode.forwardIfCurrent("public ")) {
		access = Component.ACCESS_PUBLIC;
		comments(data);
	    }
	    else if (data.srcCode.forwardIfCurrent("remote ")) {
		access = Component.ACCESS_REMOTE;
		// comments(data);
		throw new TemplateException(data.srcCode, "access modifier [remote] not supported in this context");

	    }
	    if (!_final && data.srcCode.forwardIfCurrent("final ")) {
		_final = true;
		comments(data);
	    }
	}
	Body prior = data.setParent(parent);
	Expression expr = expression(data);
	data.setParent(prior);
	checkSemiColonLineFeed(data, true, true, false);

	// variable declaration (variable in body)
	if (expr instanceof Variable) {
	    Variable v = (Variable) expr;
	    if (ASMUtil.isOnlyDataMember(v)) {

		expr = new Assign(v, data.factory.createEmpty(), data.srcCode.getPosition());
	    }
	}

	// if a specific access was defined
	if (access > -1 || _final) {
	    if (!(expr instanceof Assign)) {
		data.srcCode.setPos(pos);
		throw new TemplateException(data.srcCode, "invalid syntax, access modifier cannot be used in this context");
	    }
	    if (access > -1) {
		// this is only supported with the Lucee dialect
		// if(data.srcCode.getDialect()==CFMLEngine.DIALECT_CFML)
		// throw new TemplateException(data.srcCode,
		// "invalid syntax, access modifier cannot be used in this context");
		((Assign) expr).setAccess(access);
	    }
	    if (_final) ((Assign) expr).setModifier(Member.MODIFIER_FINAL);
	}

	if (expr instanceof FunctionAsExpression) return ((FunctionAsExpression) expr).getFunction();

	return new ExpressionAsStatement(expr);
    }
110557
private static String do_eval(Context cx, StackFrame frame, String expr) {
        String resultString;
        Debugger saved_debugger = cx.getDebugger();
        Object saved_data = cx.getDebuggerContextData();
        int saved_level = cx.getOptimizationLevel();

        cx.setDebugger(null, null);
        cx.setOptimizationLevel(-1);
        cx.setGeneratingDebug(false);
        try {
            Callable script = (Callable)cx.compileString(expr, "", 0, null);
            Object result = script.call(cx, frame.scope, frame.thisObj,
                                        ScriptRuntime.emptyArgs);
            if (result == Undefined.instance) {
                resultString = "";
            } else {
                resultString = ScriptRuntime.toString(result);
            }
        } catch (Exception exc) {
            resultString = exc.getMessage();
        } finally {
            cx.setGeneratingDebug(true);
            cx.setOptimizationLevel(saved_level);
            cx.setDebugger(saved_debugger, saved_data);
        }
        if (resultString == null) {
            resultString = "null";
        }
        return resultString;
    }
855703
private boolean executeQuantifier(int index, Expr.Quantifier expr, CallStack frame) {
		Tuple<Decl.Variable> vars = expr.getParameters();
		if (index == vars.size()) {
			// This is the base case where we evaluate the condition itself.
			RValue.Bool r = executeExpression(BOOL_T, expr.getOperand(), frame);
			boolean q = (expr instanceof Expr.UniversalQuantifier);
			// If this evaluates to true, then we will continue executing the
			// quantifier.
			return r.boolValue() == q;
		} else {
			Decl.Variable var = vars.get(index);
			RValue.Array range = executeExpression(ARRAY_T, var.getInitialiser(), frame);
			RValue[] elements = range.getElements();
			for (int i = 0; i != elements.length; ++i) {
				frame.putLocal(var.getName(), elements[i]);
				boolean r = executeQuantifier(index + 1, expr, frame);
				if (!r) {
					// early termination
					return r;
				}
			}
			return true;
		}
	}