     end
   end
 
-  defp do_eval(latest_input, iex_state, state) do
-    line = iex_state.counter
+  defp do_eval({:ok, forms, buffer}, iex_state, state) do
     put_history(state)
     put_whereami(state)
-    {parser_module, parse_method, additional_args} = IEx.Config.parser()
-    arguments = [latest_input, [line: line, file: "iex"], iex_state.buffer | additional_args]
-
-    case apply(parser_module, parse_method, arguments) do
-      {:ok, forms, buffer} ->
-        iex_state = %{iex_state | buffer: buffer, counter: iex_state.counter + 1}
-        {iex_state, handle_eval(forms, line, state)}
-
-      {:incomplete, buffer} ->
-        # Update iex_state.buffer so that IEx continues to add new input to
-        # the unfinished expression in "code"
-        {%{iex_state | buffer: buffer}, state}
-    end
+    state = handle_eval(forms, iex_state.counter, state)
+    {%{iex_state | buffer: buffer, counter: iex_state.counter + 1}, state}
   after
     Process.delete(:iex_history)
     Process.delete(:iex_whereami)
+  end
+
+  defp do_eval({:incomplete, buffer}, iex_state, state) do
+    {%{iex_state | buffer: buffer}, state}
   end
 
   defp put_history(%{history: history}) do

      end

      :ok
    end
  end


    end
  end

  defp eval(code, iex_state, state) do
    try do
      {parser_module, parser_fun, args} = IEx.Config.parser()
      args = [code, [line: iex_state.counter, file: "iex"], iex_state.buffer | args]
      do_eval(apply(parser_module, parser_fun, args), iex_state, state)
    catch
      kind, error ->
        print_error(kind, error, __STACKTRACE__)
