| 50283 | // Place holder for the value function. |
| 50284 | |
| 50285 | array = function array() { |
| 50286 | |
| 50287 | // Parse an array value. |
| 50288 | |
| 50289 | var array = []; |
| 50290 | |
| 50291 | if (ch === '[') { |
| 50292 | next('['); |
| 50293 | white(); |
| 50294 | while (ch) { |
| 50295 | if (ch === ']') { |
| 50296 | next(']'); |
| 50297 | return array; // Potentially empty array |
| 50298 | } |
| 50299 | // ES5 allows omitting elements in arrays, e.g. [,] and |
| 50300 | // [,null]. We don't allow this in JSON5. |
| 50301 | if (ch === ',') { |
| 50302 | error("Missing array element"); |
| 50303 | } else { |
| 50304 | array.push(value()); |
| 50305 | } |
| 50306 | white(); |
| 50307 | // If there's no comma after this value, this needs to |
| 50308 | // be the end of the array. |
| 50309 | if (ch !== ',') { |
| 50310 | next(']'); |
| 50311 | return array; |
| 50312 | } |
| 50313 | next(','); |
| 50314 | white(); |
| 50315 | } |
| 50316 | } |
| 50317 | error("Bad array"); |
| 50318 | }, |
| 50319 | object = function object() { |
| 50320 | |
| 50321 | // Parse an object value. |