     end
   end
 
-  # Instead of doing just :elixir.eval, we first parse the expression to see
-  # if it's well formed. If parsing succeeds, we evaluate the AST as usual.
-  #
-  # If parsing fails, this might be a TokenMissingError which we treat in
-  # a special way (to allow for continuation of an expression on the next
-  # line in IEx).
-  #
-  # Returns updated state.
-  #
-  # The first two clauses provide support for the break-trigger allowing to
-  # break out from a pending incomplete expression. See
-  # https://github.com/elixir-lang/elixir/issues/1089 for discussion.
-  @break_trigger "#iex:break\n"
-
-  @doc false
-  def parse(@break_trigger, _opts, "") do
-    {:incomplete, ""}
-  end
-
-  @doc false
-  def parse(@break_trigger, opts, _buffer) do
-    :elixir_errors.parse_error([line: opts[:line]], opts[:file], "incomplete expression", "")
-  end
-
-  @doc false
-  def parse(input, opts, buffer) do
-    input = buffer <> input
-
-    case Code.string_to_quoted(input, opts) do
-      {:ok, forms} ->
-        {:ok, forms, ""}
-
-      {:error, {_, _, ""}} ->
-        {:incomplete, input}
-
-      {:error, {location, error, token}} ->
-        :elixir_errors.parse_error(location, opts[:file], error, token)
-    end
-  end
-
   defp eval(code, iex_state, state) do
     try do
-      do_eval(code, iex_state, state)
+      {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__)

      end

      :ok
    end
  end


    end
  end

  defp do_eval({:ok, forms, buffer}, iex_state, state) do
    put_history(state)
    put_whereami(state)
    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
