Lines 2979-3019javascript
2980 capturing: hasNodeDef(combinator),
2981 lazyUsage: analyzeLazyUsage(combinator)
2983 const r = emit(combinator, ctx, "_pos");
2984 const collatorDecl = ctx.needsCollator ? `const _collator = new Intl.Collator(undefined, { sensitivity: 'accent' })
2986 const namedPrelude = ctx.namedFnDecls.length > 0 ? [...namedFnPrelude(), ""] : [];
2987 const emptyTlDecls = ctx.needsEmptyTl ? ["const _EMPTY_TL = Object.freeze([])"] : [];
2993 ctx.namedFnDecls.join("\n\n"),
2994 `${collatorDecl}function _parse(input, _pos, _rp, _mf, _build, _ctx) {`,
2997 ` return { ok: true, value: ${r.valueVar}, span: { start: _pos, end: ${r.endVar} } }`,
3000 const fn = new Function("input", "_pos", "_rp", "_mf", "_build", "_ctx", [
3001 ...emptyTlDecls,
LowEval
Package source references a known benign dynamic code generation pattern.
dist/plugin/index.jsView on unpkg · L2999 3005 ...ctx.namedFnDecls.flatMap((decl, i) => i > 0 ? ["", decl] : [decl]),
3008 `return { ok: true, value: ${r.valueVar}, span: { start: _pos, end: ${r.endVar} } }`
3010 const defaultCtx = {
3012 ...ctx.triviaKindLabels ? { triviaKindLabels: ctx.triviaKindLabels } : {}
3014 const derivedSrcs = ctx.mapFnSrcs.length === ctx.mapFns.length && ctx.mapFnSrcs.every((s) => s !== null) ? ctx.mapFnSrcs : void 0;
3015 const effectiveSources = mapFnSources ?? derivedSrcs;
3016 const buildCovered = ctx.buildFns.length === 0 || ctx.buildSrcs.every((s) => s !== null);
3017 const buildSources = ctx.buildFns.length === 0 ? void 0 : ctx.buildSrcs;
3018 const mfCovered = ctx.mapFns.length === 0 || effectiveSources !== void 0 && effectiveSources.length === ctx.mapFns.length;
3019 const canInline = ctx.runtimeParsers.length === 0 && mfCovered && buildCovered;