MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / readValue

Method readValue

shared/rison.ts:392–418  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390 }
391
392 readValue(): JSONValue {
393 const c = this.next();
394 const fn = c && this.table[c];
395
396 if (fn) return fn.apply(this);
397
398 // fell through table, parse as an id
399
400 const s = this.string;
401 const i = this.index - 1;
402
403 // Regexp.lastIndex may not work right in IE before 5.5?
404 // g flag on the regexp is also necessary
405 next_id.lastIndex = i;
406 const m = unwrap(next_id.exec(s));
407
408 // console.log('matched id', i, r.lastIndex);
409
410 if (m.length > 0) {
411 const id = m[0];
412 this.index = i + id.length;
413 return id; // a string
414 }
415
416 if (c) this.error("invalid character: '" + c + "'");
417 this.error('empty expression');
418 }
419
420 next(): string | undefined {
421 let c: string;

Callers 3

constructorMethod · 0.95
parseMethod · 0.95
parse_arrayMethod · 0.80

Calls 5

nextMethod · 0.95
errorMethod · 0.95
applyMethod · 0.80
unwrapFunction · 0.70
execMethod · 0.45

Tested by

no test coverage detected