Issues when unmarshalling arrays containing 'null' values
homacs opened this issue · 2 comments
Found different issues with null
values in arrays - some times elements are missing and in other cases the parser bails to a non-existing syntax error. Error behaviour is kind of undeterministic, so I prepared a small test program which hopefully allows to reproduce it.
The source code contains infos on compiler flags and architecture as well.
Hi, thanks for your detailed error description.
testVector2
is indeed a syntax error according to the definition of quoteless strings here:
https://hjson.github.io/syntax.html
The only char that terminates a quoteless string is a line feed. The ,
or ]
chars do not terminate a quoteless string. So testVector2
is interpreted as an array containing a single quoteless string and missing the termination bracket.
In the case of testVector3
, the first element is eins,2,
because the quoteless string is not terminated until at the first \n
, and then there are only two more elements.
In order to avoid this type of errors you can make sure to always quote strings, even though quoteless strings are allowed in Hjson.
Hi, thanks for pointing that out.
I just figured that out and was about to close the issue myself. Without that rule, there would be no way for a parser to tell, whether a punctuator is part of a quoteless string or not.