MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / parse

Function parse

src/math-json/parse-sympy.ts:376–392  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

374}
375
376export function parse(s: string): Expression {
377 if (!s) return 'Nothing';
378 try {
379 // eslint-disable-next-line prefer-const
380 let [i, result] = expression(s, skipWhitespace(s, 0));
381
382 i = skipWhitespace(s, i);
383
384 if (i < s.length)
385 return ['Error', { str: 'unexpected-token' }, { str: s.substring(i) }];
386
387 return result ?? 'Nothing';
388 } catch (e) {
389 console.error(e instanceof Error ? e.message : String(e));
390 }
391 return 'Nothing';
392}

Callers 2

sympy.test.tsFile · 0.90
run_sympyFunction · 0.50

Calls 3

expressionFunction · 0.70
skipWhitespaceFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected