| 168 | } |
| 169 | |
| 170 | Value parseArray() { |
| 171 | if (depth >= MAX_DEPTH) return Value(); |
| 172 | ++depth; |
| 173 | next(); // skip [ |
| 174 | Value v; |
| 175 | v.type = Type::Array; |
| 176 | skipWs(); |
| 177 | if (peek() == ']') { next(); --depth; return v; } |
| 178 | while (true) { |
| 179 | v.arrVal.push_back(parseValue()); |
| 180 | skipWs(); |
| 181 | if (peek() == ',') { next(); continue; } |
| 182 | if (peek() == ']') { next(); break; } |
| 183 | break; |
| 184 | } |
| 185 | --depth; |
| 186 | return v; |
| 187 | } |
| 188 | |
| 189 | Value parseObject() { |
| 190 | if (depth >= MAX_DEPTH) return Value(); |