MCPcopy Create free account
hub / github.com/WebFreak001/code-debug / parseTupleOrList

Function parseTupleOrList

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

Source from the content-addressed store, hash-verified

195 let parseValue, parseCommaResult, parseCommaValue, parseResult;
196
197 const parseTupleOrList = () => {
198 if (output[0] != '{' && output[0] != '[')
199 return undefined;
200 const oldContent = output;
201 const canBeValueList = output[0] == '[';
202 output = output.substring(1);
203 if (output[0] == '}' || output[0] == ']') {
204 output = output.substring(1); // ] or }
205 return [];
206 }
207 if (canBeValueList) {
208 let value = parseValue();
209 if (value !== undefined) { // is value list
210 const values = [];
211 values.push(value);
212 const remaining = output;
213 while ((value = parseCommaValue()) !== undefined)
214 values.push(value);
215 output = output.substring(1); // ]
216 return values;
217 }
218 }
219 let result = parseResult();
220 if (result) {
221 const results = [];
222 results.push(result);
223 while (result = parseCommaResult())
224 results.push(result);
225 output = output.substring(1); // }
226 return results;
227 }
228 output = (canBeValueList ? '[' : '{') + output;
229 return undefined;
230 };
231
232 parseValue = () => {
233 if (output[0] == '"')

Callers 1

parseMIFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected