Evaluate the input using #loop_eval and handle it
357315
def eval_input input
    [loop_eval(input), nil]
  rescue SystemExit
    throw(:rib_exit, input)
  rescue Exception => e
    [nil, e]
  ensure
    config[:line] += 1
  end
1216900
def _evaluate(expression, defines):
    
    #interpolated = _interpolate(s, defines)
    try:
        defined = {'defined': (lambda v: v in defines)}
        return_value = eval(expression, defined, defines)
    except Exception, ex:
        message = str(ex)
        if message.startswith("name '") and message.endswith("' is not defined"):
            # A common error (at least this is presumed:) is to have
            #   defined(FOO)   instead of   defined('FOO')
            # We should give a little insight into what might be wrong.
            # message == "name 'FOO' is not defined"
            #    -->  variable_name == "FOO"
            variable_name = message[len("name '"):-len("' is not defined")]
            if expression.find("defined(%s)" % variable_name) > -1:
                # "defined(FOO)" in expr instead of "defined('FOO')"
                message += ''' (perhaps you want `defined('%s')` instead of `defined(%s)`)''' % (variable_name, variable_name)
        elif message.startswith("invalid syntax"):
            message = "invalid syntax: `%s`" % expression
        raise PreprocessorError(message, defines['__FILE__'], defines['__LINE__'])

    logger.debug("evaluate %r -> %s (defines=%r)", expression, return_value, defines)
    return return_value
140174
def evaluate(expression):
    
    op_stack  = deque() # operator stack
    out_stack = deque() # output stack (values)
    tokens = parse(expression) # calls the function only once!
    for token in tokens:
        if numeric_value.match(token):
            out_stack.append(float(token))
        elif token == '(':
            op_stack.append(token)
        elif token == ')':
            while len(op_stack) > 0 and op_stack[-1] != '(':
                apply_operation(op_stack, out_stack)
            op_stack.pop() # Remove remaining '('
        else: # is_operator(token)
            while len(op_stack) > 0 and is_operator(op_stack[-1]) and higher_priority(op_stack[-1], token):
                apply_operation(op_stack, out_stack)
            op_stack.append(token)

    while len(op_stack) > 0:
        apply_operation(op_stack, out_stack)

    return out_stack[-1]
298061
def handle_user_input
      while true
        begin
          break if !wait_for_prompt
          input = $stdin.gets.chomp!
          execute_action(input, true)
        rescue SignalException => e
          return false
        end
      end
      wait
    end
883414
def eval(self, statement, ctxt=None):
        
        self._no_debug = True

        statement = statement.strip()

        if not statement.endswith(";"):
            statement += ";"

        ast = self._parse_string(statement, predefines=False)

        self._dlog("evaluating statement: {}".format(statement))
        
        try:
            res = None
            for child in ast.children():
                res = self._handle_node(child, self._scope, self._ctxt, self._stream)
            return res
        except errors.InterpReturn as e:
            return e.value
        finally:
            self._no_debug = False
307812
def handle_input(input)
      raise ArgumentError unless input.instance_of?(String)
      begin
        output = ''
        case input.strip
        when PuppetDebugger::InputResponders::Commands.command_list_regex
          args = input.split(' ')
          command = args.shift
          plugin = PuppetDebugger::InputResponders::Commands.plugin_from_command(command)
          output = plugin.execute(args, self)
          return out_buffer.puts output
        when '_'
          output = " => #{@last_item}"
        else
          result = puppet_eval(input)
          @last_item = result
          output = normalize_output(result)
          output = output.nil? ? '' : output.ai
        end
      rescue PuppetDebugger::Exception::InvalidCommand => e
        output = e.message.fatal
      rescue LoadError => e
        output = e.message.fatal
      rescue Errno::ETIMEDOUT => e
        output = e.message.fatal
      rescue ArgumentError => e
        output = e.message.fatal
      rescue Puppet::ResourceError => e
        output = e.message.fatal
      rescue Puppet::Error => e
        output = e.message.fatal
      rescue Puppet::ParseErrorWithIssue => e
        output = e.message.fatal
      rescue PuppetDebugger::Exception::FatalError => e
        output = e.message.fatal
        out_buffer.puts output
        exit 1 # this can sometimes causes tests to fail
      rescue PuppetDebugger::Exception::Error => e
        output = e.message.fatal
      end
      unless output.empty?
        out_buffer.print ' => '
        out_buffer.puts output unless output.empty?
        exec_hook :after_output, out_buffer, self, self
      end
    end
876667
def evaluate(expr, **variables):
    
    module = ast.parse(expr)  # Module(body=[Expr(value=...)])
    if len(module.body) != 1:
        raise BadExpression(
            "One expression expected, got %d." % len(module.body))

    expression = module.body[0]
    if not isinstance(expression, ast.Expr):
        raise BadExpression(
            "Expression expected, got %s instead."
            % expression.__class__.__name__
        )

    return _eval(expression.value, variables)
675350
def execute(self, js_str, timeout=0, max_memory=0):
        

        wrapped = "(function(){return (%s)})()" % js_str
        return self.eval(wrapped, timeout, max_memory)
125622
def evaluate(self, m):
        """"""

        g = m.groupdict()
        if g["strings"]:
            self.evaluate_strings(g)
            self.line_num += g['strings'].count('\n')
        elif g["code"]:
            self.line_num += g["code"].count('\n')
        else:
            if g['block']:
                self.evaluate_block(g)
            elif g['start'] is None:
                self.evaluate_inline_tail(g)
            else:
                self.evaluate_inline(g)
            self.line_num += g['comments'].count('\n')
268240
def do_eval(self, inputs, ctx):
        """"""
        return cwltool.expression.do_eval(
            self.expr, inputs, self.req, None, None, {}, context=ctx)
102411
def eval(self, expression):
        
        expression_wrapped = wrap_script.format(expression)


        ### Evaluate the expression
        self._libeng.engEvalString(self._ep, expression_wrapped)

        ### Check for exceptions in MATLAB
        mxresult = self._libeng.engGetVariable(self._ep, 'ERRSTR__')

        error_string = self._libmx.mxArrayToString(mxresult)

        self._libmx.mxDestroyArray(mxresult)

        if error_string != "":
            raise RuntimeError("Error from MATLAB\n{0}".format(error_string))
770526
def _exec_eval(data, expr):
  
  ns = {}
  exec(data, ns)
  return eval(expr, ns)
463896
def perform(self):
        
        last_value = None
        last_step = None

        while self.items.qsize():

            item = self.items.get()

            if item.flag == self.do:
                last_value = item.item(*item.args, **item.kwargs)
                last_step = item.message
            elif item.flag == self.expect:
                message = item.message
                local = {'value': last_value, 'expectation': item.item}
                expression = 'value {operator} expectation'.format(operator=item.operator)
                result = eval(expression, local)

                # Format the error message
                format_vars = {
                    'actual': last_value,
                    'expected': item.item,
                    'step': last_step,
                    'operator': item.operator
                }

                for var, val in format_vars.iteritems():
                    message = message.replace('{' + str(var) + '}', str(val))

                assert result, message

        return last_value
512047
function evalsha(req, res, sha, args) {
  this.spawn();
  this.reply(req, res, this._limit);
  // need to coerce buffers for the moment
  args = args.map(function(a) {
    if(a instanceof Buffer) return a.toString();
    return a;
  })
  this.ps.send({event: 'evalsha', sha: sha, args: args});
}
310273
def eval_string(stri):
    ''
    tokens = shlex.split(stri)

    return run_write_read(['plash', 'eval'], '\n'.join(tokens).encode()).decode()
1049679
def handle_input(self, input_str, place=True, check=False):
        ''''''
        user = self.get_player()
        pos = self.validate_input(input_str)
        if pos[0] == 'u':
            self.undo(pos[1])
            return pos
        if place:
            result = self.set_pos(pos, check)
            return result
        else:
            return pos
523016
def _do_eval(self, cmd, args):
        
        code = args[0].lstrip()
        if not code:
            self.stderr.write('e: cannot evalutate empty expression\n')
            return
        try:
            eval(code)
        except:
            self.stderr.write('''When executing code '{}', the following error was raised:\n\n'''.format(code))
            self.stderr.write(textwrap.indent(traceback.format_exc(), '    '))