Menu

#1 Patch for parse Number and Empty Array correctly

open
nobody
None
5
2014-08-17
2010-01-14
Anonymous
No

to parse number correctly, the regular-expression of _regexNumber should be
@"(?<minus>[-])?(?<int>(0)|([1-9])[0-9]*)(?<frac>\\.[0-9]+)?(?<exp>(e|E)([-]|[+])[0-9]+)?",
you forget to escape the dot(.)

for allowing empty array, the function ParseSomethingWithoutName()
should return null for "]"
and for its caller, ParseCollection(), should allow null being returned.

JsonObject obj = ParseSomethingWithoutName();
// add name to item, if object.
if (!is_array)
{
if (obj == null)
{
throw new Exception();
}
obj.Name = name;
}

if(obj!=null)
result.Add(obj);

Discussion


Log in to post a comment.