var
p : PChar = '[123, 2345, ''test'', ''str1, str2'', -1234, ''str3 ''is'' str4'']';
Chunks : Integer = 1; BetweenQuotes : Boolean = false;
begin Writeln(p);
while p^ <> #0 do begin inc(p);
case p^ of
'''': BetweenQuotes := not BetweenQuotes;
',': if not BetweenQuotes then inc(Chunks)
end
end;
Writeln('Chunks = ', Chunks); Readln
end.
dmFyCiAgcCA6IFBDaGFyID0gICdbMTIzLCAyMzQ1LCAnJ3Rlc3QnJywgJydzdHIxLCBzdHIyJycsIC0xMjM0LCAnJ3N0cjMgJydpcycnIHN0cjQnJ10nOwogIENodW5rcyA6IEludGVnZXIgPSAxOyBCZXR3ZWVuUXVvdGVzIDogQm9vbGVhbiA9IGZhbHNlOwoKYmVnaW4gV3JpdGVsbihwKTsKICB3aGlsZSBwXiA8PiAjMCBkbyBiZWdpbiBpbmMocCk7CiAgICBjYXNlIHBeIG9mCiAgICAgICcnJyc6IEJldHdlZW5RdW90ZXMgOj0gbm90IEJldHdlZW5RdW90ZXM7CiAgICAgICAnLCc6IGlmIG5vdCBCZXR3ZWVuUXVvdGVzIHRoZW4gaW5jKENodW5rcykgCiAgICBlbmQKICBlbmQ7ICAKICBXcml0ZWxuKCdDaHVua3MgPSAnLCBDaHVua3MpOyBSZWFkbG4KZW5kLg==