Open lazytyper opened 3 years ago
I already found a similar parser which seems to be perfect: It parses "just a number/string" correctly, supports hex codes and it doesn't support exotic syntaxes.
@lazytyper actually in the middle of a big rewrite to address those issues! :) Which parser did you choose?
It's json5 (www.json5.org).
I've been testing jsonic for a few minutes and discovered several issues:
jsonic cannot parse this, but should be compatible to JSON.
The result is not what I expected (same result as in JS). Hexadecimal numbers could be supported. And invalid numbers like
0g12
could cause a parse error.I don't really like that way string don't require quotes. It can confuse and it's not much work to add two quotes.
Example:
I don't need to tell what the result of js and jsonic is. And
{ name: John Joe }
is not even valid JS. Better: disable that by default, and require quotes. If the programmer badly wants the short syntax, it could be turned on optionally.