Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1 Patch for parse Number and Empty Array correctly

open
nobody
None
5
2010-01-14
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