MCPcopy
hub / github.com/xianfei/SysMocap / resolveComplexPattern

Function resolveComplexPattern

pdfviewer/viewer.mjs:1796–1824  ·  view source on GitHub ↗
(scope, ptn)

Source from the content-addressed store, hash-verified

1794 return getDefault(scope, variants, star);
1795}
1796function resolveComplexPattern(scope, ptn) {
1797 if (scope.dirty.has(ptn)) {
1798 scope.reportError(new RangeError("Cyclic reference"));
1799 return new FluentNone();
1800 }
1801 scope.dirty.add(ptn);
1802 const result = [];
1803 const useIsolating = scope.bundle._useIsolating && ptn.length > 1;
1804 for (const elem of ptn) {
1805 if (typeof elem === "string") {
1806 result.push(scope.bundle._transform(elem));
1807 continue;
1808 }
1809 scope.placeables++;
1810 if (scope.placeables > MAX_PLACEABLES) {
1811 scope.dirty.delete(ptn);
1812 throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `max allowed is ${MAX_PLACEABLES}`);
1813 }
1814 if (useIsolating) {
1815 result.push(FSI);
1816 }
1817 result.push(resolveExpression(scope, elem).toString(scope));
1818 if (useIsolating) {
1819 result.push(PDI);
1820 }
1821 }
1822 scope.dirty.delete(ptn);
1823 return result.join("");
1824}
1825function resolvePattern(scope, value) {
1826 if (typeof value === "string") {
1827 return scope.bundle._transform(value);

Callers 2

resolvePatternFunction · 0.85
formatPatternMethod · 0.85

Calls 5

resolveExpressionFunction · 0.85
hasMethod · 0.80
reportErrorMethod · 0.80
pushMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected