[phobos] [D-Programming-Language/phobos] 4f423c: Enable std.json.parseJSON to parse nan/inf.

GitHub via phobos phobos at puremagic.com
Tue Apr 14 02:43:20 PDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: 4f423caa9fa70f8e8c9d20dabca860e20b8a0267
      https://github.com/D-Programming-Language/phobos/commit/4f423caa9fa70f8e8c9d20dabca860e20b8a0267
  Author: Ryan <ryan at rcorre.net>
  Date:   2015-04-02 (Thu, 02 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  Enable std.json.parseJSON to parse nan/inf.

JSONValue.toString will output 'nan', 'inf', or '-inf', when it has type
JSON_TYPE.FLOAT and value double.nan/double.infinity/-double.infinity.
However, parseJSON would fail on encountering these values in a string.
This patch enables parseJSON to read special float values.


  Commit: ef0b39334d268fb7bdf1be9b5a751c9d5f935b71
      https://github.com/D-Programming-Language/phobos/commit/ef0b39334d268fb7bdf1be9b5a751c9d5f935b71
  Author: Ryan <ryan at rcorre.net>
  Date:   2015-04-10 (Fri, 10 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  JSON: option to encode special floats as strings.

Adds the SpecialFloats flag to JSONValue.toString, JSONValue.toPrettyString,
and JSONValue.toJSON.
Given SpecialFloats.yes, the special float values NaN, Infinity, and -Infinity
will be encoded as the strings "NaN", "Infinite", "-Infinite".
Given SpecialFloats.no, attempting to stringify a JSONValue containing a
special float value will throw.
This overrides the previous behavior of encoding special float values as
non-string literals, which resulted in non-standard JSON strings.


  Commit: c33dca96be0b5aa3c0cc49a6a24d2f122508100c
      https://github.com/D-Programming-Language/phobos/commit/c33dca96be0b5aa3c0cc49a6a24d2f122508100c
  Author: Ryan <ryan at rcorre.net>
  Date:   2015-04-10 (Fri, 10 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  JSON: option to decode special strings as floats.

Passing JsonSpecialFloats.yes to parseJSON prompts the parser to interpret
"NaN", "Infinite", and "-Infinite" as the special floating-point values they
represent.

Adds the overload parseJSON(JSONValue, SpecialFloats) that takes a JSONValue and
the JsonSpecialFloats flag so users do not have to pass maxDepth in order to
specify special float handling behavior.


  Commit: fecf9b3972e727dcfae06ef307890da9cc67e5f6
      https://github.com/D-Programming-Language/phobos/commit/fecf9b3972e727dcfae06ef307890da9cc67e5f6
  Author: Ryan <ryan at rcorre.net>
  Date:   2015-04-13 (Mon, 13 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  JSON: Nan/Inf code review tweaks.

Replace Flag!"JsonSpecialFloats" with a flagset enum to allow future
extensibility.
Add more documentation to modified functions.


  Commit: 51674c81d787003804dc3e50ac30389663dd8ce2
      https://github.com/D-Programming-Language/phobos/commit/51674c81d787003804dc3e50ac30389663dd8ce2
  Author: Ryan <ryan at rcorre.net>
  Date:   2015-04-13 (Mon, 13 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  JSON: remove unused import std.typecons : Flag.


  Commit: c9122fcb7f2fec8701dfb24b79a21cf150291e4e
      https://github.com/D-Programming-Language/phobos/commit/c9122fcb7f2fec8701dfb24b79a21cf150291e4e
  Author: Martin Nowak <code at dawg.eu>
  Date:   2015-04-14 (Tue, 14 Apr 2015)

  Changed paths:
    M std/json.d

  Log Message:
  -----------
  Merge pull request #3141 from rcorre/json-nan-inf

Enable std.json.parseJSON to parse nan/inf.


Compare: https://github.com/D-Programming-Language/phobos/compare/9f43949ccb41...c9122fcb7f2f


More information about the phobos mailing list