()
| 48591 | // Place holder for the value function. |
| 48592 | |
| 48593 | array = function array() { |
| 48594 | |
| 48595 | // Parse an array value. |
| 48596 | |
| 48597 | var array = []; |
| 48598 | |
| 48599 | if (ch === '[') { |
| 48600 | next('['); |
| 48601 | white(); |
| 48602 | while (ch) { |
| 48603 | if (ch === ']') { |
| 48604 | next(']'); |
| 48605 | return array; // Potentially empty array |
| 48606 | } |
| 48607 | // ES5 allows omitting elements in arrays, e.g. [,] and |
| 48608 | // [,null]. We don't allow this in JSON5. |
| 48609 | if (ch === ',') { |
| 48610 | error("Missing array element"); |
| 48611 | } else { |
| 48612 | array.push(value()); |
| 48613 | } |
| 48614 | white(); |
| 48615 | // If there's no comma after this value, this needs to |
| 48616 | // be the end of the array. |
| 48617 | if (ch !== ',') { |
| 48618 | next(']'); |
| 48619 | return array; |
| 48620 | } |
| 48621 | next(','); |
| 48622 | white(); |
| 48623 | } |
| 48624 | } |
| 48625 | error("Bad array"); |
| 48626 | }, |
| 48627 | object = function object() { |
| 48628 | |
| 48629 | // Parse an object value. |
no test coverage detected