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

Function lhsNames

src/compute-engine/rubi/compile.ts:169–182  ·  view source on GitHub ↗

Pattern-variable names appearing in a rule LHS (excluding the variable).

(
  lhs: Json,
  variable: string,
  out = new Set<string>()
)

Source from the content-addressed store, hash-verified

167 expr.symbol.startsWith(OPT)
168 );
169 if (!expr.ops) return false;
170 return expr.ops.some(hasPlaceholder);
171}
172
173/** Pattern-variable names appearing in a rule LHS (excluding the variable). */
174function lhsNames(
175 lhs: Json,
176 variable: string,
177 out = new Set<string>()
178): Set<string> {
179 if (
180 (isCall(lhs, 'Blank') || isCall(lhs, 'BlankOptional')) &&
181 typeof lhs[1] === 'string'
182 ) {
183 if (lhs[1] !== variable) out.add(lhs[1]);
184 } else if (Array.isArray(lhs))
185 for (const a of lhs.slice(1)) lhsNames(a, variable, out);

Callers 1

compileRuleFunction · 0.85

Calls 3

isCallFunction · 0.85
addMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected