On 8/4/14, 12:56 AM, Jacob Carlborg wrote:
On Sunday, 3 August 2014 at 07:16:05 UTC, Andrei Alexandrescu wrote:
We need a better json library at Facebook. I'd discussed with Sönke
the possibility of taking vibe.d's json to std but he said it needs
some more work. So I took std.jgrandson to proof of concept state and
hence ready for destruction:
http://erdani.com/d/jgrandson.d
http://erdani.com/d/phobos-prerelease/std_jgrandson.html
Thanks for your comments! A few responses within:
* Could you please put it on Github to get syntax highlighting and all
the other advantages
Quick workaround: http://dpaste.dzfl.pl/65f4dcc36ab8
* It doesn't completely follow the Phobos naming conventions
What would be the places?
* The indentation is off in some places
Xamarin/Mono-D is at fault here :o).
* The unit tests is a bit lacking for the separate parsing functions
Agreed.
* There are methods for getting the strings and numbers, what about
booleans?
You mean for Token? Good point. Numbers and strings are somewhat special
because they have a payload associated. In contrast Booleans are
represented by two distinct tokens. Would be good to add a convenience
method.
* Shouldn't it be called TokenRange?
Yah.
* Shouldn't this be built using the lexer generator you so strongly have
been pushing for?
Of course, and in the beginning I've actually pasted some code from it.
Then I regressed to minimizing dependencies.
* The unit tests for TokenStream is very dense. I would prefer empty
newlines for grouping "assert" and calls to "popFront" belonging together
De gustibus et the coloribus non est disputandum :o).
Andrei