()
| 50969 | // Place holder for the value function. |
| 50970 | |
| 50971 | array = function array() { |
| 50972 | |
| 50973 | // Parse an array value. |
| 50974 | |
| 50975 | var array = []; |
| 50976 | |
| 50977 | if (ch === '[') { |
| 50978 | next('['); |
| 50979 | white(); |
| 50980 | while (ch) { |
| 50981 | if (ch === ']') { |
| 50982 | next(']'); |
| 50983 | return array; // Potentially empty array |
| 50984 | } |
| 50985 | // ES5 allows omitting elements in arrays, e.g. [,] and |
| 50986 | // [,null]. We don't allow this in JSON5. |
| 50987 | if (ch === ',') { |
| 50988 | error("Missing array element"); |
| 50989 | } else { |
| 50990 | array.push(value()); |
| 50991 | } |
| 50992 | white(); |
| 50993 | // If there's no comma after this value, this needs to |
| 50994 | // be the end of the array. |
| 50995 | if (ch !== ',') { |
| 50996 | next(']'); |
| 50997 | return array; |
| 50998 | } |
| 50999 | next(','); |
| 51000 | white(); |
| 51001 | } |
| 51002 | } |
| 51003 | error("Bad array"); |
| 51004 | }, |
| 51005 | object = function object() { |
| 51006 | |
| 51007 | // Parse an object value. |
no test coverage detected
searching dependent graphs…