binary_to_whatever is not available on R15? fixed

This commit is contained in:
alisdair sullivan 2014-12-09 05:08:05 +00:00
parent b1320a2e67
commit 1033245da3
2 changed files with 12 additions and 1 deletions

View file

@ -929,10 +929,19 @@ finish_number(Rest, Handler, Acc, Stack, Config) ->
maybe_done(Rest, handle_event(format_number(Acc), Handler, Config), Stack, Config).
-ifndef(no_binary_to_whatever).
format_number({zero, Acc}) -> {integer, binary_to_integer(Acc)};
format_number({integer, Acc}) -> {integer, binary_to_integer(Acc)};
format_number({decimal, Acc}) -> {float, binary_to_float(Acc)};
format_number({exp, Acc}) -> {float, binary_to_float(Acc)}.
-endif.
-ifdef(no_binary_to_whatever).
format_number({zero, Acc}) -> {integer, list_to_integer(unicode:characters_to_list(Acc))};
format_number({integer, Acc}) -> {integer, list_to_integer(unicode:characters_to_list(Acc))};
format_number({decimal, Acc}) -> {float, list_to_float(unicode:characters_to_list(Acc))};
format_number({exp, Acc}) -> {float, list_to_float(unicode:characters_to_list(Acc))}.
-endif.
true(<<$r, $u, $e, Rest/binary>>, Handler, Stack, Config) ->