Wrong Parsing Unquoted strings in HJson
Zelaux opened this issue · 8 comments
I used this when writing HJson Support for Intellij idea
and I found some tricky cases which are parsed counterintuitively
Cases thats parsed in wrong way:
-
- Given HJson
it: it, value: value,
- Expected Json
{"it": "it,", "value": "value,"}
- Actual Json
{"it": "it", "value": "value"}
-
- Given HJson
[ 1, 2, O, T, 3, 4, T, F ]
- Expected Json
[1, 2, "O, T,", 3, 4, "T, F"]
- Actual Json
[1,2,"O","T",3,4,"T","F"]
This is not counterintuitive; why on earth would you expect the trailing comma to be part of the parsed string?! I intentionally made this change so modders wouldn't mess up when using unquoted strings. I don't care about the official spec - including commas (or, frankly, using unquoted strings at all) is a horrible idea.
I meant that the behavior described in the official spec is a little bit counterintuitive
Right, but my parser doesn't have that behavior, so what is the issue with Arc...?
if you try to parse
key: very, very, very, long value
You got pasing exeption.
And also if someone try to search information how to write on hjson, he will find this
key: very, very, very, long value
Why do this? I don't see why one would do that in a mindustry mod.
And also if someone try to search information how to write on hjson, he will find this
What's your point?
Result: ....
I apologize in that case, further discussion is pointless