     {result, data, pos}
   end
 
-  defp float(<<char>> <> _data, pos, [@full_stop|_])
+  defp float(<<char>> <> _data, pos, _chars, :full_stop)
     when char in @exps,
     do: throw {:float, pos}
-  defp float(<<char>> <> data, pos, chars)
+  defp float(<<char>> <> data, pos, chars, _last)
     when char in @exps,
     do: exponential(data, pos + 1, [chars, 'e'], :exp)
-  defp float(<<char>> <> data, pos, chars)
+  defp float(<<char>> <> data, pos, chars, _last)
     when char in @digits,
-    do: float(data, pos + 1, [chars, char])
-  defp float(data, pos, chars) do
+    do: float(data, pos + 1, [chars, char], :digit)
+  defp float(data, pos, chars, _last) do
     result = chars
              |> IO.iodata_to_binary
              |> String.to_float

  @minus_sign ?-
  @full_stop ?.
  @exps 'eE'
  @exp ?e
  @quotation_mark ?"
  @escape ?\\
  @escapes %{

  defp key(<<char>> <> data, pos)
    when char == @quotation_mark,
    do: string(data, pos + 1, [])
  defp key(_data, pos),
    do: throw {:key, pos}

  defp number(<<char>> <> data, pos, chars, _last)
    when char in @digits,
    do: number(data, pos + 1, [chars,char], :digit)
  defp number(<<@full_stop>> <> _data, pos, _chars, :minus),
    do: throw {:number, pos + 1}
  defp number(<<@full_stop>> <> data, pos, chars, _last),
    do: float(data, pos + 1, [chars, @full_stop], :full_stop)
  defp number(<<char>> <> _data, pos, _chars, :minus)
    when char in @exps,
    do: throw {:number, pos}
  defp number(<<char>> <> data, pos, chars, _last)
    when char in @exps,
    do: exponential(data, pos + 1, [chars, '.0e'], :exp)
  defp number(_data, pos, _chars, :minus),
    do: throw {:number, pos}
  defp number(data, pos, chars, _last) do
    result = chars
             |> IO.iodata_to_binary
             |> String.to_integer
