Fix some bugs in JSON data format
This commit is contained in:
parent
b436b09c58
commit
ffd4161a7a
@ -141,8 +141,16 @@ namespace UniversalEditor.DataFormats.PropertyList.JavaScriptObjectNotation
|
||||
}
|
||||
else if (c == ',')
|
||||
{
|
||||
list.Add(lastObject);
|
||||
lastObject = null;
|
||||
if (lastObject == null && !String.IsNullOrEmpty(ctx.CurrentString))
|
||||
{
|
||||
list.Add(ctx.CurrentString);
|
||||
ctx.CurrentString = String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(lastObject);
|
||||
lastObject = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +159,11 @@ namespace UniversalEditor.DataFormats.PropertyList.JavaScriptObjectNotation
|
||||
list.Add(lastObject);
|
||||
lastObject = null;
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(ctx.CurrentString))
|
||||
{
|
||||
list.Add(ctx.CurrentString);
|
||||
ctx.CurrentString = String.Empty;
|
||||
}
|
||||
// hack hack hack
|
||||
ctx.CurrentString = String.Empty;
|
||||
return list.ToArray();
|
||||
@ -193,6 +206,18 @@ namespace UniversalEditor.DataFormats.PropertyList.JavaScriptObjectNotation
|
||||
ctx.CurrentStringRaw = String.Empty;
|
||||
return null;
|
||||
}
|
||||
else if (ctx.CurrentStringRaw == "true")
|
||||
{
|
||||
r.Seek(-1, SeekOrigin.Current);
|
||||
ctx.CurrentStringRaw = String.Empty;
|
||||
return true;
|
||||
}
|
||||
else if (ctx.CurrentStringRaw == "false")
|
||||
{
|
||||
r.Seek(-1, SeekOrigin.Current);
|
||||
ctx.CurrentStringRaw = String.Empty;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -249,6 +274,12 @@ namespace UniversalEditor.DataFormats.PropertyList.JavaScriptObjectNotation
|
||||
ctx.Escaped = true;
|
||||
continue;
|
||||
}
|
||||
else if (c == '\\' && ctx.Escaped)
|
||||
{
|
||||
ctx.Escaped = false;
|
||||
ctx.CurrentString += '\\';
|
||||
continue;
|
||||
}
|
||||
else if (c == '"' && !ctx.Escaped)
|
||||
{
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user