 
   @spec parse(iodata) :: {:ok, json} | {:error, String.t}
   def parse(data) do
-    {result, data, pos} = parse_json(data, 0)
+    {result, data, pos} = json(data, 0)
     if data =~ ~r/^\s*$/ do
       {:ok, result}
     else

    {result, data, pos}
  end

  defp parse_float(<<char>> <> _data, pos, [@full_stop|_])
    when char in @exps,
    do: throw {:float, pos}
  defp parse_float(<<char>> <> data, pos, chars)
    when char in @exps,
    do: parse_exponential(data, pos + 1, [@exp|chars])
  defp parse_float(<<char>> <> data, pos, chars)
    when char in @digits,
    do: parse_float(data, pos + 1, [char|chars])
  defp parse_float(data, pos, chars) do
    result = chars
             |> Enum.reverse
             |> IO.iodata_to_binary

    {result, data, pos}
  end

  defp exponential(<<@minus_sign>> <> data, pos, [@exp|_] = chars),
    do: exponential(data, pos + 1, [@minus_sign|chars])
  defp exponential(<<char>> <> data, pos, chars)
    when char in @digits,
    do: exponential(data, pos + 1, [char|chars])
  defp exponential(_data, pos, [@exp|_]),
    do: throw {:exponential, pos}
  defp exponential(_data, pos, [@minus_sign|_]),
    do: throw {:exponential, pos}
  defp exponential(data, pos, chars) do
    result = chars
        |> Enum.reverse
        |> IO.iodata_to_binary
