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

Function backtrack

src/compute-engine/boxed-expression/match.ts:929–940  ·  view source on GitHub ↗
(start: number)

Source from the content-addressed store, hash-verified

927 exprOps.length > maxAllowed
928 )
929 return null;
930
931 // Sort anchors by specificity (most specific first)
932 // This reduces backtracking by pruning impossible branches early
933 const sortedAnchors = [...anchors].sort(
934 (a, b) => anchorSpecificity(b) - anchorSpecificity(a)
935 );
936
937 // Try to match anchors against expression elements using backtracking
938 return tryMatchAnchors(0, exprOps, substitution);
939
940 function tryMatchAnchors(
941 anchorIndex: number,
942 remainingOps: Expression[],
943 sub: BoxedSubstitution

Callers 2

getCombinationsFunction · 0.85
combinationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected