# Parses a JSON Array
fun parse_json_array: Serializable do
var max = len
if pos >= max then return make_parse_error("Incomplete JSON array")
var arr = new JsonArray
var c = src[pos]
while not c == ']' do
ignore_whitespaces
if pos >= max then return make_parse_error("Incomplete JSON array")
if src[pos] == ']' then break
var ent = parse_entity
#print "Parsed an entity {ent} for a JSON array"
if ent isa JsonParseError then return ent
arr.add ent
ignore_whitespaces
if pos >= max then return make_parse_error("Incomplete JSON array")
c = src[pos]
if c == ']' then break
if c != ',' then return make_parse_error("Bad array separator {c}")
pos += 1
end
pos += 1
return arr
end
lib/json/static.nit:213,2--236,4