| 50317 | error("Bad array"); |
| 50318 | }, |
| 50319 | object = function object() { |
| 50320 | |
| 50321 | // Parse an object value. |
| 50322 | |
| 50323 | var key, |
| 50324 | object = {}; |
| 50325 | |
| 50326 | if (ch === '{') { |
| 50327 | next('{'); |
| 50328 | white(); |
| 50329 | while (ch) { |
| 50330 | if (ch === '}') { |
| 50331 | next('}'); |
| 50332 | return object; // Potentially empty object |
| 50333 | } |
| 50334 | |
| 50335 | // Keys can be unquoted. If they are, they need to be |
| 50336 | // valid JS identifiers. |
| 50337 | if (ch === '"' || ch === "'") { |
| 50338 | key = string(); |
| 50339 | } else { |
| 50340 | key = identifier(); |
| 50341 | } |
| 50342 | |
| 50343 | white(); |
| 50344 | next(':'); |
| 50345 | object[key] = value(); |
| 50346 | white(); |
| 50347 | // If there's no comma after this pair, this needs to be |
| 50348 | // the end of the object. |
| 50349 | if (ch !== ',') { |
| 50350 | next('}'); |
| 50351 | return object; |
| 50352 | } |
| 50353 | next(','); |
| 50354 | white(); |
| 50355 | } |
| 50356 | } |
| 50357 | error("Bad object"); |
| 50358 | }; |
| 50359 | |
| 50360 | value = function value() { |
| 50361 | |