MCPcopy Create free account
hub / github.com/Marus/cortex-debug / parseTupleOrList

Function parseTupleOrList

src/backend/mi_parse.ts:227–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225 let parseResult;
226
227 const parseTupleOrList = () => {
228 if (output[0] !== '{' && output[0] !== '[') {
229 return undefined;
230 }
231 const oldContent = output;
232 const canBeValueList = output[0] === '[';
233 output = output.substr(1);
234 if (output[0] === '}' || output[0] === ']') {
235 output = output.substr(1);
236 return [];
237 }
238 if (canBeValueList) {
239 let value = parseValue();
240 if (value) { // is value list
241 const values = [];
242 values.push(value);
243 const remaining = output;
244 while ((value = parseCommaValue()) !== undefined) {
245 values.push(value);
246 }
247 output = output.substr(1); // ]
248 return values;
249 }
250 }
251 let result = parseResult();
252 if (result) {
253 const results = [];
254 results.push(result);
255 while (result = parseCommaResult()) {
256 results.push(result);
257 }
258 output = output.substr(1); // }
259 return results;
260 }
261 output = (canBeValueList ? '[' : '{') + output;
262 return undefined;
263 };
264
265 parseValue = () => {
266 if (output[0] === '"') {

Callers 1

parseMIFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected