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

Function identifier

src/math-json/parse-sympy.ts:38–45  ·  view source on GitHub ↗
(
  s: string,
  i: number
)

Source from the content-addressed store, hash-verified

36}
37
38function identifier(
39 s: string,
40 i: number
41): [i: number, result: Expression | null] {
42 const m = s.slice(i).match(/^[\p{XIDS}_][\p{XIDC}]*/u);
43 if (m === null) return [i, null];
44 return [i + m[0].length, symbol(m[0])];
45}
46
47function exponent(s: string, i: number): [i: number, result: string | null] {
48 if (s[i] !== 'e' && s[i] !== 'E') return [i, null];

Callers 1

atomFunction · 0.85

Calls 3

symbolFunction · 0.90
matchMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected