((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR)
| 274 | return pairs, end |
| 275 | |
| 276 | def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): |
| 277 | values = [] |
| 278 | nextchar = s[end:end + 1] |
| 279 | if nextchar in _ws: |
| 280 | end = _w(s, end + 1).end() |
| 281 | nextchar = s[end:end + 1] |
| 282 | # Look-ahead for trivial empty array |
| 283 | if nextchar == ']': |
| 284 | return values, end + 1 |
| 285 | _append = values.append |
| 286 | while True: |
| 287 | try: |
| 288 | value, end = scan_once(s, end) |
| 289 | except StopIteration: |
| 290 | raise JSONDecodeError("Expecting object", s, end) |
| 291 | _append(value) |
| 292 | nextchar = s[end:end + 1] |
| 293 | if nextchar in _ws: |
| 294 | end = _w(s, end + 1).end() |
| 295 | nextchar = s[end:end + 1] |
| 296 | end += 1 |
| 297 | if nextchar == ']': |
| 298 | break |
| 299 | elif nextchar != ',': |
| 300 | raise JSONDecodeError("Expecting ',' delimiter", s, end) |
| 301 | |
| 302 | try: |
| 303 | if s[end] in _ws: |
| 304 | end += 1 |
| 305 | if s[end] in _ws: |
| 306 | end = _w(s, end + 1).end() |
| 307 | except IndexError: |
| 308 | pass |
| 309 | |
| 310 | return values, end |
| 311 | |
| 312 | class JSONDecoder(object): |
| 313 | """Simple JSON <http://json.org> decoder |
nothing calls this directly
no test coverage detected
searching dependent graphs…