Hi guys,
I was in the mood of reinventing the wheel yesterday, so I wrote an alternate json5 parser. Naturally, what kind of a standard it would be if it had only one implementation? :)
So, source code is here:
https://github.com/rlidwka/json5-utils (suggestion about a better name are appreciated, that's where I usually suck at).
In current/reference json5 implementation you started with a JSON parser, and added a new javascript-like features on top of that.
I used the other way around, starting from ES5 specification and adding a set of additional restrictions on top of ES5 spec.
So I'd expect my implementation to be much closer to javascript. It's no longer an extension of json, but a reduction of ecmascript, which was my original intent.
All existing json5 tests which I wanted to pass, pass. Including unicode support with 2 huge regexes that take up 50% of the entire codebase. Ouch. Why can't these people just use English for everything.
Anyway, it took one day (about 10 hours) to implement, so I guess it's not so hard after all. Mostly from scratch, except that unicode stuff is generated with esprima scripts.
Feel free to backport all code and/or ideas. It's largely a reason why I wrote this, at this point it's easier to just point to the code and say "that's how it should work in my opinion", instead of going "nyaah, nyaah, it doesn't look good, change this because" in the issue tracker.
No stringify() method for now, so it's coming soon. After that I'll go for an editing JSON5 file in place preserving comments and a whitespace, it's the feature I wanted for a long while.
PS: there was a funny idea to use .j5 extension by the way
--
Regards,
alex