(s_and_end, scan_once, array_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR)
| 219 | return pairs, end |
| 220 | |
| 221 | def JSONArray(s_and_end, scan_once, array_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR): |
| 222 | s, end = s_and_end |
| 223 | values = [] |
| 224 | nextchar = s[end:end + 1] |
| 225 | if nextchar in _ws: |
| 226 | end = _w(s, end + 1).end() |
| 227 | nextchar = s[end:end + 1] |
| 228 | # Look-ahead for trivial empty array |
| 229 | if nextchar == ']': |
| 230 | if array_hook is not None: |
| 231 | values = array_hook(values) |
| 232 | return values, end + 1 |
| 233 | _append = values.append |
| 234 | while True: |
| 235 | try: |
| 236 | value, end = scan_once(s, end) |
| 237 | except StopIteration as err: |
| 238 | raise JSONDecodeError("Expecting value", s, err.value) from None |
| 239 | _append(value) |
| 240 | nextchar = s[end:end + 1] |
| 241 | if nextchar in _ws: |
| 242 | end = _w(s, end + 1).end() |
| 243 | nextchar = s[end:end + 1] |
| 244 | end += 1 |
| 245 | if nextchar == ']': |
| 246 | break |
| 247 | elif nextchar != ',': |
| 248 | raise JSONDecodeError("Expecting ',' delimiter", s, end - 1) |
| 249 | comma_idx = end - 1 |
| 250 | try: |
| 251 | if s[end] in _ws: |
| 252 | end += 1 |
| 253 | if s[end] in _ws: |
| 254 | end = _w(s, end + 1).end() |
| 255 | nextchar = s[end:end + 1] |
| 256 | except IndexError: |
| 257 | pass |
| 258 | if nextchar == ']': |
| 259 | raise JSONDecodeError("Illegal trailing comma before end of array", s, comma_idx) |
| 260 | |
| 261 | if array_hook is not None: |
| 262 | values = array_hook(values) |
| 263 | return values, end |
| 264 | |
| 265 | |
| 266 | class JSONDecoder(object): |
nothing calls this directly
no test coverage detected
searching dependent graphs…