(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR)
| 233 | return pairs, end |
| 234 | |
| 235 | def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): |
| 236 | s, end = s_and_end |
| 237 | values = [] |
| 238 | nextchar = s[end:end + 1] |
| 239 | if nextchar in _ws: |
| 240 | end = _w(s, end + 1).end() |
| 241 | nextchar = s[end:end + 1] |
| 242 | # Look-ahead for trivial empty array |
| 243 | if nextchar == ']': |
| 244 | return values, end + 1 |
| 245 | _append = values.append |
| 246 | while True: |
| 247 | try: |
| 248 | value, end = scan_once(s, end) |
| 249 | except StopIteration as err: |
| 250 | raise JSONDecodeError("Expecting value", s, err.value) from None |
| 251 | _append(value) |
| 252 | nextchar = s[end:end + 1] |
| 253 | if nextchar in _ws: |
| 254 | end = _w(s, end + 1).end() |
| 255 | nextchar = s[end:end + 1] |
| 256 | end += 1 |
| 257 | if nextchar == ']': |
| 258 | break |
| 259 | elif nextchar != ',': |
| 260 | raise JSONDecodeError("Expecting ',' delimiter", s, end - 1) |
| 261 | comma_idx = end - 1 |
| 262 | try: |
| 263 | if s[end] in _ws: |
| 264 | end += 1 |
| 265 | if s[end] in _ws: |
| 266 | end = _w(s, end + 1).end() |
| 267 | nextchar = s[end:end + 1] |
| 268 | except IndexError: |
| 269 | pass |
| 270 | if nextchar == ']': |
| 271 | raise JSONDecodeError("Illegal trailing comma before end of array", s, comma_idx) |
| 272 | |
| 273 | return values, end |
| 274 | |
| 275 | |
| 276 | class JSONDecoder(object): |
nothing calls this directly
no test coverage detected