fix skipping of the first opening brace in key-value lists

This commit is contained in:
Riccardo Mottola 2021-07-06 22:36:51 +02:00
parent 8970a0617d
commit c0fd3f8df7

View file

@ -188,7 +188,10 @@
NSLog(@"parseArray in: %@", [string substringFromIndex: [scanner scanLocation]]);
mArray = [[NSMutableArray alloc] init];
[scanner scanString: @"[" intoString: NULL];
// we chomp up the first opening [
if (![scanner isAtEnd])
[scanner scanString: @"[" intoString: NULL];
elementEnd = NO;
value = nil;
while([scanner isAtEnd] == NO && elementEnd == NO)
@ -199,7 +202,6 @@
}
else if ([string characterAtIndex:[scanner scanLocation]] == '{')
{
[scanner scanString: @"{" intoString: NULL];
value = [self parseKeyValue: scanner];
}
else if ([string characterAtIndex:[scanner scanLocation]] == ']')
@ -239,6 +241,11 @@
value = nil;
elementEnd = NO;
// we chomp up the first opening { which may not be always present
if (![scanner isAtEnd])
[scanner scanString: @"{" intoString: NULL];
while([scanner isAtEnd] == NO && elementEnd == NO)
{
[scanner scanUpToString: @"=" intoString: &key];