|
|
@ -537,12 +537,12 @@ public function JSON Clone() |
|
|
|
public function bool ParseIntoSelfWith(Parser parser) |
|
|
|
public function bool ParseIntoSelfWith(Parser parser) |
|
|
|
{ |
|
|
|
{ |
|
|
|
local bool parsingSucceeded; |
|
|
|
local bool parsingSucceeded; |
|
|
|
local Parser.ParserState initState; |
|
|
|
local Parser.ParserState initState, confirmedState; |
|
|
|
local JProperty nextProperty; |
|
|
|
local JProperty nextProperty; |
|
|
|
local array<JProperty> parsedProperties; |
|
|
|
local array<JProperty> parsedProperties; |
|
|
|
if (parser == none) return false; |
|
|
|
if (parser == none) return false; |
|
|
|
initState = parser.GetCurrentState(); |
|
|
|
initState = parser.GetCurrentState(); |
|
|
|
parser.Skip().Match("{").Confirm(); |
|
|
|
confirmedState = parser.Skip().Match("{").GetCurrentState(); |
|
|
|
if (!parser.Ok()) |
|
|
|
if (!parser.Ok()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
parser.RestoreState(initState); |
|
|
|
parser.RestoreState(initState); |
|
|
@ -550,19 +550,21 @@ public function bool ParseIntoSelfWith(Parser parser) |
|
|
|
} |
|
|
|
} |
|
|
|
while (parser.Ok() && !parser.HasFinished()) |
|
|
|
while (parser.Ok() && !parser.HasFinished()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
parser.Skip().Confirm(); |
|
|
|
confirmedState = parser.Skip().GetCurrentState(); |
|
|
|
if (parser.Match("}").Ok()) |
|
|
|
if (parser.Match("}").Ok()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
parsingSucceeded = true; |
|
|
|
parsingSucceeded = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (parsedProperties.length > 0 && !parser.R().Match(",").Skip().Ok()) { |
|
|
|
if ( parsedProperties.length > 0 |
|
|
|
|
|
|
|
&& !parser.RestoreState(confirmedState).Match(",").Skip().Ok()) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else if (parser.Ok()) { |
|
|
|
parser.Confirm(); |
|
|
|
confirmedState = parser.GetCurrentState(); |
|
|
|
} |
|
|
|
} |
|
|
|
parser.R().Skip().MStringLiteral(nextProperty.name).Skip().Match(":"); |
|
|
|
parser.RestoreState(confirmedState).Skip(); |
|
|
|
|
|
|
|
parser.MStringLiteral(nextProperty.name).Skip().Match(":"); |
|
|
|
nextProperty.value = ParseAtom(parser.Skip()); |
|
|
|
nextProperty.value = ParseAtom(parser.Skip()); |
|
|
|
if (!parser.Ok() || nextProperty.value.type == JSON_Undefined) { |
|
|
|
if (!parser.Ok() || nextProperty.value.type == JSON_Undefined) { |
|
|
|
break; |
|
|
|
break; |
|
|
|