(parser: Parser)
| 430 | } |
| 431 | |
| 432 | static parse_array(parser: Parser): JSONValue[] | undefined { |
| 433 | const ar: JSONValue[] = []; |
| 434 | let c; |
| 435 | while ((c = parser.next()) !== ')') { |
| 436 | if (!c) return parser.error("unmatched '!('"); |
| 437 | if (ar.length) { |
| 438 | if (c !== ',') parser.error("missing ','"); |
| 439 | } else if (c === ',') { |
| 440 | return parser.error("extra ','"); |
| 441 | } else --parser.index; |
| 442 | const n = parser.readValue(); |
| 443 | if (n === undefined) return undefined; |
| 444 | ar.push(n); |
| 445 | } |
| 446 | return ar; |
| 447 | } |
| 448 | } |