@prisma/orm-framework 8.0.0-rc.11-dev.33 → 8.0.0-rc.11-dev.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-CIlPUXgy.d.mts → components-D5_c_jNC.d.mts} +2 -2
- package/dist/{components-CIlPUXgy.d.mts.map → components-D5_c_jNC.d.mts.map} +1 -1
- package/dist/components.d.mts +4 -4
- package/dist/components__components.d.mts +2 -2
- package/dist/components__control.d.mts +2 -2
- package/dist/components__execution.d.mts +1 -1
- package/dist/{config-types-fsf2M50T.d.mts → config-types-BKMblqZR.d.mts} +5 -5
- package/dist/{config-types-fsf2M50T.d.mts.map → config-types-BKMblqZR.d.mts.map} +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config__config-types.d.mts +1 -1
- package/dist/{control-ObcoBnYQ.d.mts → control-FPOrnOrH.d.mts} +2 -2
- package/dist/{control-ObcoBnYQ.d.mts.map → control-FPOrnOrH.d.mts.map} +1 -1
- package/dist/{declarations-DU8tJk4J-BAfPaIOL.mjs → declarations-SwNXosDu-D39d5EQ-.mjs} +8 -3
- package/dist/declarations-SwNXosDu-D39d5EQ-.mjs.map +1 -0
- package/dist/diagnostic-Esyl8Qw1-Cd6SnWPN.mjs +83 -0
- package/dist/diagnostic-Esyl8Qw1-Cd6SnWPN.mjs.map +1 -0
- package/dist/errors.d.mts +1 -1
- package/dist/errors__execution.d.mts +1 -1
- package/dist/{execution-yEk-_DKb.d.mts → execution-B5OFHjmC.d.mts} +2 -2
- package/dist/{execution-yEk-_DKb.d.mts.map → execution-B5OFHjmC.d.mts.map} +1 -1
- package/dist/{execution-DfMCQMDy.d.mts → execution-DdsbOiMs.d.mts} +2 -2
- package/dist/{execution-DfMCQMDy.d.mts.map → execution-DdsbOiMs.d.mts.map} +1 -1
- package/dist/{framework-components-Bu5LfryO-CAg5kbVT.d.mts → framework-components-Bak1o3Ye-C7hDfyXj.d.mts} +3 -3
- package/dist/{framework-components-Bu5LfryO-CAg5kbVT.d.mts.map → framework-components-Bak1o3Ye-C7hDfyXj.d.mts.map} +1 -1
- package/dist/{parse-D6t27bbJ-Bq4ihDy9.d.mts → parse-5HXALb4y-RUSJB688.d.mts} +67 -34
- package/dist/parse-5HXALb4y-RUSJB688.d.mts.map +1 -0
- package/dist/{parse-B4QY6R0c-CnBAH0Gd.mjs → parse-Cu6B62PC-BAPPRuso.mjs} +62 -12
- package/dist/parse-Cu6B62PC-BAPPRuso.mjs.map +1 -0
- package/dist/psl-parser.d.mts +9 -11
- package/dist/psl-parser.d.mts.map +1 -1
- package/dist/psl-parser.mjs +147 -161
- package/dist/psl-parser.mjs.map +1 -1
- package/dist/psl-parser__format.mjs +12 -12
- package/dist/psl-parser__format.mjs.map +1 -1
- package/dist/psl-parser__interpret.d.mts +7 -8
- package/dist/psl-parser__interpret.d.mts.map +1 -1
- package/dist/psl-parser__interpret.mjs +3 -3
- package/dist/psl-parser__interpret.mjs.map +1 -1
- package/dist/psl-parser__syntax.d.mts +2 -2
- package/dist/psl-parser__syntax.mjs +3 -3
- package/dist/psl-parser__syntax.mjs.map +1 -1
- package/dist/psl-parser__tokenizer.mjs +1 -1
- package/dist/psl-printer.mjs +4 -4
- package/dist/psl-printer.mjs.map +1 -1
- package/dist/{symbol-table-ajt1Djeq-ByUeoS_l.d.mts → symbol-table-CDtpZvfM-DSP_8jbB.d.mts} +12 -13
- package/dist/symbol-table-CDtpZvfM-DSP_8jbB.d.mts.map +1 -0
- package/dist/{tokenizer-D4sywyzm-gPsD7tYP.mjs → tokenizer-CFsbtfFw-BnfUBepb.mjs} +4 -3
- package/dist/tokenizer-CFsbtfFw-BnfUBepb.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/declarations-DU8tJk4J-BAfPaIOL.mjs.map +0 -1
- package/dist/parse-B4QY6R0c-CnBAH0Gd.mjs.map +0 -1
- package/dist/parse-D6t27bbJ-Bq4ihDy9.d.mts.map +0 -1
- package/dist/symbol-table-ajt1Djeq-ByUeoS_l.d.mts.map +0 -1
- package/dist/tokenizer-D4sywyzm-gPsD7tYP.mjs.map +0 -1
package/dist/psl-parser.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/index.mjs"],"sourcesContent":["import { A as printSyntax, S as TaggedLiteralExprAst, T as IdentifierAst, _ as FunctionCallAst, b as ObjectLiteralExprAst, c as NamespaceDeclarationAst, g as BooleanLiteralExprAst, i as GenericBlockDeclarationAst, l as TypesBlockAst, m as ArrayLiteralAst, o as ModelDeclarationAst, t as CompositeTypeDeclarationAst, v as NumberLiteralExprAst, x as StringLiteralExprAst } from \"./declarations-DU8tJk4J.mjs\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/attribute-helpers.ts\nfunction getPositionalArgument(attribute, index = 0) {\n\treturn attribute.args.filter((arg) => arg.kind === \"positional\")[index]?.value;\n}\nfunction parseQuotedStringLiteral(value) {\n\tconst match = value.trim().match(/^(['\"])(.*)\\1$/);\n\tif (!match) return void 0;\n\treturn match[2] ?? \"\";\n}\n//#endregion\n//#region src/attribute-spec/assemble.ts\nfunction* modelAttributeDescriptors(namespace) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringModelAttributeDescriptor(value)) {\n\t\t\tyield value;\n\t\t\tcontinue;\n\t\t}\n\t\tyield* modelAttributeDescriptors(value);\n\t}\n}\nfunction assembleAttributeSpecs(contributions) {\n\tconst entries = Object.entries(contributions.attributeSpecs.model);\n\tconst claimed = new Set(entries.map(([attribute]) => attribute));\n\tfor (const descriptor of modelAttributeDescriptors(contributions.modelAttributes)) {\n\t\tif (claimed.has(descriptor.attribute)) throw new InternalError(`Duplicate attribute spec registration for \"${descriptor.attribute}\". Each model attribute name may be registered once across family built-ins and model-attribute descriptors.`);\n\t\tclaimed.add(descriptor.attribute);\n\t\tentries.push([descriptor.attribute, descriptor.spec]);\n\t}\n\treturn Object.freeze(blindCast({\n\t\tmodel: Object.freeze(Object.fromEntries(entries)),\n\t\tfield: Object.freeze({ ...contributions.attributeSpecs.field })\n\t}));\n}\n//#endregion\n//#region src/attribute-spec/block-attribute.ts\nfunction blockAttribute(name, config) {\n\treturn {\n\t\tlevel: \"block\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/resolve.ts\nfunction readResolvedAttribute(attribute, sourceFile) {\n\treturn {\n\t\tname: attributeName(attribute.name()),\n\t\targs: readResolvedArgList(attribute.argList(), sourceFile),\n\t\tspan: nodePslSpan(attribute.syntax, sourceFile)\n\t};\n}\nfunction readResolvedAttributes(attributes, sourceFile) {\n\treturn Array.from(attributes, (attribute) => readResolvedAttribute(attribute, sourceFile));\n}\nfunction readResolvedConstructorCall(annotation, sourceFile) {\n\tconst argList = annotation?.argList();\n\tif (annotation === void 0 || argList === void 0) return void 0;\n\treturn {\n\t\tpath: annotation.name()?.path() ?? [],\n\t\targs: readResolvedArgList(argList, sourceFile),\n\t\tspan: nodePslSpan(annotation.syntax, sourceFile)\n\t};\n}\nfunction readResolvedArgList(argList, sourceFile) {\n\tif (argList === void 0) return [];\n\tconst args = [];\n\tfor (const arg of argList.args()) {\n\t\tconst name = arg.name()?.name();\n\t\tconst expression = arg.value();\n\t\targs.push({\n\t\t\tkind: name !== void 0 ? \"named\" : \"positional\",\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\tvalue: renderExpression(expression),\n\t\t\t...expression !== void 0 ? { expression } : {},\n\t\t\tspan: nodePslSpan(arg.syntax, sourceFile)\n\t\t});\n\t}\n\treturn args;\n}\nfunction attributeName(name) {\n\treturn name?.path().join(\".\") ?? \"\";\n}\nfunction renderExpression(expression) {\n\tif (expression === void 0) return \"\";\n\treturn printSyntax(expression.syntax).trim();\n}\nfunction nodePslSpan(node, sourceFile) {\n\tconst start = node.offset;\n\tconst end = start + node.green.textLength;\n\treturn {\n\t\tstart: offsetToPslPosition(start, sourceFile),\n\t\tend: offsetToPslPosition(end, sourceFile)\n\t};\n}\n/** Unsupported-top-level-block diagnostics are anchored to the keyword token. */\nfunction keywordPslSpan(node, keyword, sourceFile) {\n\tconst start = node.offset;\n\tconst end = start + keyword.length;\n\treturn {\n\t\tstart: offsetToPslPosition(start, sourceFile),\n\t\tend: offsetToPslPosition(end, sourceFile)\n\t};\n}\nfunction rangeToPslSpan(range, sourceFile) {\n\treturn {\n\t\tstart: offsetToPslPosition(sourceFile.offsetAt(range.start), sourceFile),\n\t\tend: offsetToPslPosition(sourceFile.offsetAt(range.end), sourceFile)\n\t};\n}\nfunction offsetToPslPosition(offset, sourceFile) {\n\tconst position = sourceFile.positionAt(offset);\n\treturn {\n\t\toffset,\n\t\tline: position.line + 1,\n\t\tcolumn: position.character + 1\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/diagnostic.ts\nconst ATTRIBUTE_DIAGNOSTIC_CODE = \"PSL_INVALID_ATTRIBUTE_SYNTAX\";\nfunction leafDiagnostic(ctx, node, message, code = ATTRIBUTE_DIAGNOSTIC_CODE) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\tsourceId: ctx.sourceId,\n\t\tspan: nodePslSpan(node.syntax, ctx.sourceFile)\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/bool.ts\nfunction bool() {\n\treturn {\n\t\tkind: \"bool\",\n\t\tlabel: \"boolean\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = BooleanLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst value = literal.value();\n\t\t\t\tif (value !== void 0) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a boolean literal\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/entity-ref.ts\nfunction entityRef() {\n\treturn {\n\t\tkind: \"entityRef\",\n\t\tlabel: \"model name\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst identifier = IdentifierAst.cast(arg.syntax);\n\t\t\tif (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a model name\")]);\n\t\t\tconst name = identifier.name();\n\t\t\tif (name === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a model name\")]);\n\t\t\treturn ok(name);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/field-ref.ts\nfunction parseFieldName(arg, ctx, model) {\n\tconst identifier = IdentifierAst.cast(arg.syntax);\n\tif (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a field name\")]);\n\tconst name = identifier.name();\n\tif (name === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a field name\")]);\n\tif (model !== void 0 && !Object.hasOwn(model.fields, name)) return notOk([leafDiagnostic(ctx, arg, `Field \"${name}\" does not exist on model \"${model.name}\"`)]);\n\treturn ok(name);\n}\nfunction fieldRef() {\n\treturn {\n\t\tkind: \"fieldRef\",\n\t\tlabel: \"field name\",\n\t\tparse: (arg, ctx) => parseFieldName(arg, ctx, ctx.selfModel)\n\t};\n}\nfunction referencedFieldRef() {\n\treturn {\n\t\tkind: \"referencedFieldRef\",\n\t\tlabel: \"field name\",\n\t\tparse: (arg, ctx) => parseFieldName(arg, ctx, ctx.resolveReferencedModel())\n\t};\n}\n//#endregion\n//#region src/attribute-spec/interpret.ts\nfunction interpretArgs(args, spec, ctx, span) {\n\tconst diagnostics = [];\n\tconst output = {};\n\tconst seen = /* @__PURE__ */ new Set();\n\tlet positionalSlot = 0;\n\tlet reportedExcess = false;\n\tfor (const arg of args) {\n\t\tconst name = arg.name()?.name();\n\t\tlet key;\n\t\tlet param;\n\t\tif (name === void 0) {\n\t\t\tconst posParam = spec.positional[positionalSlot];\n\t\t\tif (posParam === void 0) {\n\t\t\t\tif (!reportedExcess) {\n\t\t\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received too many positional arguments`, ctx, span));\n\t\t\t\t\treportedExcess = true;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpositionalSlot += 1;\n\t\t\tkey = posParam.key;\n\t\t\tparam = posParam.type;\n\t\t} else {\n\t\t\tconst namedParam = Object.hasOwn(spec.named, name) ? spec.named[name] : void 0;\n\t\t\tif (namedParam === void 0) {\n\t\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received unknown argument \"${name}\"`, ctx, nodePslSpan(arg.syntax, ctx.sourceFile)));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tkey = name;\n\t\t\tparam = namedParam.type;\n\t\t}\n\t\tif (seen.has(key)) {\n\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received duplicate argument \"${key}\"`, ctx, nodePslSpan(arg.syntax, ctx.sourceFile)));\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(key);\n\t\tconst result = parseArgValue(arg, param, ctx, diagnostics);\n\t\tif (result.ok) output[key] = result.value;\n\t}\n\tconst finalized = /* @__PURE__ */ new Set();\n\tconst finalizeAbsentKey = (key, positionalParam, namedParam) => {\n\t\tif (finalized.has(key) || seen.has(key)) return;\n\t\tfinalized.add(key);\n\t\tconst effective = namedParam ?? positionalParam;\n\t\tif (effective === void 0) return;\n\t\tif (isOptionalArgType(effective)) {\n\t\t\tif (effective.hasDefault) output[key] = effective.defaultValue;\n\t\t\treturn;\n\t\t}\n\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" is missing required argument \"${key}\"`, ctx, span));\n\t};\n\tfor (const param of spec.positional) {\n\t\tconst namedParam = Object.hasOwn(spec.named, param.key) ? spec.named[param.key] : void 0;\n\t\tfinalizeAbsentKey(param.key, param.type, namedParam?.type);\n\t}\n\tfor (const key of Object.keys(spec.named)) finalizeAbsentKey(key, void 0, spec.named[key]?.type);\n\tif (diagnostics.length > 0) return notOk(diagnostics);\n\treturn ok(output);\n}\nfunction interpretAttribute(attrNode, spec, ctx) {\n\tconst attributeSpan = nodePslSpan(attrNode.syntax, ctx.sourceFile);\n\tconst bound = interpretArgs(attrNode.argList()?.args() ?? [], spec, ctx, attributeSpan);\n\tif (!bound.ok) return notOk(bound.failure);\n\tconst value = blindCast(bound.value);\n\tif (spec.refine !== void 0) {\n\t\tconst refineDiagnostics = spec.refine(value, ctx, attrNode);\n\t\tif (refineDiagnostics.length > 0) return notOk(refineDiagnostics);\n\t}\n\treturn ok(value);\n}\nfunction parseArgValue(arg, argType, ctx, diagnostics) {\n\tconst value = arg.value();\n\tif (value === void 0) {\n\t\tconst missing = diagnostic(\"Attribute argument is missing a value\", ctx, nodePslSpan(arg.syntax, ctx.sourceFile));\n\t\tdiagnostics.push(missing);\n\t\treturn notOk([missing]);\n\t}\n\tconst result = argType.parse(value, ctx);\n\tif (!result.ok) for (const failure of result.failure) diagnostics.push(failure);\n\treturn result;\n}\nfunction isOptionalArgType(param) {\n\treturn \"optional\" in param && param.optional === true;\n}\nfunction diagnostic(message, ctx, span) {\n\treturn {\n\t\tcode: ATTRIBUTE_DIAGNOSTIC_CODE,\n\t\tmessage,\n\t\tsourceId: ctx.sourceId,\n\t\tspan\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/func-call.ts\nfunction funcCall(name, sig) {\n\treturn {\n\t\tkind: \"funcCall\",\n\t\tlabel: `${name}()`,\n\t\tname,\n\t\tsignature: sig,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst guard = matchCallee(arg, name, ctx);\n\t\t\tif (!guard.ok) return guard;\n\t\t\tconst span = nodePslSpan(guard.value.syntax, ctx.sourceFile);\n\t\t\tconst bound = interpretArgs(guard.value.args(), {\n\t\t\t\tname,\n\t\t\t\tpositional: sig.positional ?? [],\n\t\t\t\tnamed: sig.named ?? {}\n\t\t\t}, ctx, span);\n\t\t\tif (!bound.ok) return notOk(bound.failure);\n\t\t\treturn ok({\n\t\t\t\tfn: name,\n\t\t\t\tspan,\n\t\t\t\targs: bound.value\n\t\t\t});\n\t\t}\n\t};\n}\nfunction matchCallee(arg, name, ctx) {\n\tconst call = FunctionCallAst.cast(arg.syntax);\n\tif (call === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tconst qname = call.name();\n\tif (qname === void 0 || qname.dot() !== void 0 || qname.colon() !== void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tconst calleeName = qname.identifier()?.token()?.text;\n\tif (calleeName === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tif (calleeName !== name) return notOk([leafDiagnostic(ctx, arg, `Expected ${name}()`)]);\n\treturn ok(call);\n}\n//#endregion\n//#region src/attribute-spec/combinators/identifier.ts\nfunction identifier(name, options) {\n\treturn {\n\t\tkind: \"identifier\",\n\t\tlabel: name,\n\t\tname,\n\t\tdocumentation: options.documentation,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst identifier = IdentifierAst.cast(arg.syntax);\n\t\t\tif (identifier !== void 0 && identifier.name() === name) return ok(name);\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${name}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/int.ts\nfunction int(opts) {\n\tconst min = opts?.min;\n\tconst max = opts?.max;\n\treturn {\n\t\tkind: \"int\",\n\t\tlabel: \"integer\",\n\t\t...min === void 0 ? {} : { min },\n\t\t...max === void 0 ? {} : { max },\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst value = literal.value();\n\t\t\t\tif (value !== void 0 && Number.isInteger(value)) {\n\t\t\t\t\tif ((min === void 0 || value >= min) && (max === void 0 || value <= max)) return ok(value);\n\t\t\t\t\treturn notOk([leafDiagnostic(ctx, arg, rangeMessage(min, max))]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected an integer literal\")]);\n\t\t}\n\t};\n}\nfunction rangeMessage(min, max) {\n\tif (min !== void 0 && max !== void 0) return `Expected an integer between ${min} and ${max}`;\n\tif (min !== void 0) return `Expected an integer greater than or equal to ${min}`;\n\treturn `Expected an integer less than or equal to ${max}`;\n}\n//#endregion\n//#region src/attribute-spec/combinators/json.ts\n/**\n* Reads an opaque JSON object from a quoted JSON string — the ADR's one text-encoded surface\n* exception (e.g. an index `filter` / `weights` argument). The string is decoded by the parser,\n* then JSON-parsed; a non-object (array/scalar) or invalid JSON is a diagnostic.\n*/\nfunction json() {\n\treturn {\n\t\tkind: \"json\",\n\t\tlabel: \"JSON object\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a JSON object string\")]);\n\t\t\tconst raw = literal.value();\n\t\t\tif (raw !== void 0) try {\n\t\t\t\tconst parsed = JSON.parse(raw);\n\t\t\t\tif (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) return ok(blindCast(parsed));\n\t\t\t} catch {}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a valid JSON object\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/list.ts\nfunction list(of, opts) {\n\tconst allowEmpty = opts?.allowEmpty ?? true;\n\tconst unique = opts?.unique ?? false;\n\treturn {\n\t\tkind: \"list\",\n\t\tlabel: `${of.label}[]`,\n\t\tof,\n\t\tallowEmpty,\n\t\tunique,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = ArrayLiteralAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, `Expected a list of ${of.label}`)]);\n\t\t\tconst diagnostics = [];\n\t\t\tconst parsed = [];\n\t\t\tlet count = 0;\n\t\t\tfor (const element of literal.elements()) {\n\t\t\t\tcount += 1;\n\t\t\t\tconst result = of.parse(element, ctx);\n\t\t\t\tif (result.ok) parsed.push({\n\t\t\t\t\tnode: element,\n\t\t\t\t\tvalue: result.value\n\t\t\t\t});\n\t\t\t\telse diagnostics.push(...result.failure);\n\t\t\t}\n\t\t\tif (!allowEmpty && count === 0) diagnostics.push(leafDiagnostic(ctx, arg, \"Expected a non-empty list\"));\n\t\t\tif (unique) {\n\t\t\t\tconst seen = /* @__PURE__ */ new Set();\n\t\t\t\tfor (const { node, value } of parsed) if (seen.has(value)) diagnostics.push(leafDiagnostic(ctx, node, \"Duplicate list entry\"));\n\t\t\t\telse seen.add(value);\n\t\t\t}\n\t\t\tif (diagnostics.length > 0) return notOk(diagnostics);\n\t\t\treturn ok(parsed.map((entry) => entry.value));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/num.ts\nfunction num(value) {\n\tif (value === void 0) return {\n\t\tkind: \"num\",\n\t\tlabel: \"number\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst parsed = literal.value();\n\t\t\t\tif (parsed !== void 0) return ok(parsed);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a number literal\")]);\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"num\",\n\t\tlabel: String(value),\n\t\tvalue,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tif (literal.value() === value) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${value}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/num-literal.ts\n/** A number literal kept as its source text, for consumers that must not round it through a JS number. */\nfunction numLiteral() {\n\treturn {\n\t\tkind: \"num\",\n\t\tlabel: \"number\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst text = NumberLiteralExprAst.cast(arg.syntax)?.token()?.text;\n\t\t\tif (text !== void 0) return ok({ text });\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a number literal\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/one-of.ts\nfunction oneOf(...alts) {\n\tconst label = alts.map((alt) => alt.label).join(\" | \");\n\treturn {\n\t\tkind: \"oneOf\",\n\t\tlabel,\n\t\talternatives: alts,\n\t\tparse: (arg, ctx) => {\n\t\t\tfor (const alt of alts) {\n\t\t\t\tconst result = blindCast(alt.parse)(arg, ctx);\n\t\t\t\tif (result.ok) return ok(blindCast(result.value));\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected one of: ${label}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/record.ts\nfunction record(of) {\n\treturn {\n\t\tkind: \"record\",\n\t\tlabel: `{ [key]: ${of.label} }`,\n\t\tof,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = ObjectLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected an object literal\")]);\n\t\t\tconst diagnostics = [];\n\t\t\tconst entries = [];\n\t\t\tconst keys = /* @__PURE__ */ new Set();\n\t\t\tfor (const field of Array.from(literal.fields())) {\n\t\t\t\tconst key = field.keyName();\n\t\t\t\tif (key === void 0) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, \"Expected a key\"));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst value = field.value();\n\t\t\t\tif (value === void 0) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, `Expected a value for key \"${key}\"`));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst parsed = of.parse(value, ctx);\n\t\t\t\tif (!parsed.ok) {\n\t\t\t\t\tdiagnostics.push(...parsed.failure);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (keys.has(key)) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, `Duplicate key \"${key}\"`));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tkeys.add(key);\n\t\t\t\tentries.push([key, parsed.value]);\n\t\t\t}\n\t\t\tif (diagnostics.length > 0) return notOk(diagnostics);\n\t\t\treturn ok(Object.fromEntries(entries));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/str.ts\nfunction str(value) {\n\tif (value === void 0) return {\n\t\tkind: \"str\",\n\t\tlabel: \"string\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst parsed = literal.value();\n\t\t\t\tif (parsed !== void 0) return ok(parsed);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a string literal\")]);\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"str\",\n\t\tlabel: JSON.stringify(value),\n\t\tvalue,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tif (literal.value() === value) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${JSON.stringify(value)}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/tagged-literal.ts\n/**\n* A `` tag`...` ``, `tag\"...\"`, or `tag'...'` argument. `tags` and `documentation` describe the\n* registered tags for tooling; parsing accepts any tag.\n*/\nfunction taggedLiteral(tags, options) {\n\treturn {\n\t\tkind: \"taggedLiteral\",\n\t\tlabel: `${tags[0] ?? \"tag\"}\\`...\\``,\n\t\ttags,\n\t\tdocumentation: options.documentation,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = TaggedLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a tagged literal\")]);\n\t\t\treturn ok({\n\t\t\t\ttag: literal.tagName(),\n\t\t\t\tcanonicalization: literal.canonicalization(),\n\t\t\t\tspan: nodePslSpan(literal.syntax, ctx.sourceFile)\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/field-attribute.ts\nfunction fieldAttribute(name, config) {\n\treturn {\n\t\tlevel: \"field\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/model-attribute.ts\nfunction modelAttribute(name, config) {\n\treturn {\n\t\tlevel: \"model\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/optional.ts\nfunction optional(type, ...rest) {\n\tif (rest.length === 0) return {\n\t\t...type,\n\t\toptional: true,\n\t\thasDefault: false\n\t};\n\treturn {\n\t\t...type,\n\t\toptional: true,\n\t\thasDefault: true,\n\t\tdefaultValue: rest[0]\n\t};\n}\n//#endregion\n//#region src/extension-block.ts\nfunction findBlockDescriptor(descriptors, keyword) {\n\tif (descriptors === void 0) return void 0;\n\tfor (const value of Object.values(descriptors)) {\n\t\tif (value === void 0) continue;\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tif (value.keyword === keyword) return value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nested = findBlockDescriptor(value, keyword);\n\t\tif (nested !== void 0) return nested;\n\t}\n}\nfunction validateExtensionBlockFromSymbol(input) {\n\tconst refCtx = buildRefResolutionContext(input.symbolTable, input.block);\n\treturn validateExtensionBlock(input.block.block, input.descriptor, input.sourceId, input.codecLookup, refCtx);\n}\nconst ZERO_SPAN = {\n\tstart: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t},\n\tend: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t}\n};\nfunction buildRefResolutionContext(symbolTable, block) {\n\tconst unspecifiedNamespace = makeNamespace(UNSPECIFIED_PSL_NAMESPACE_ID, Object.values(symbolTable.topLevel.models));\n\tconst allNamespaces = [unspecifiedNamespace, ...Object.values(symbolTable.topLevel.namespaces).map((namespace) => makeNamespace(namespace.name, Object.values(namespace.models)))];\n\tconst ownerNamespaceName = findOwnerNamespaceName(symbolTable, block);\n\treturn {\n\t\townerNamespace: allNamespaces.find((namespace) => namespace.name === ownerNamespaceName) ?? unspecifiedNamespace,\n\t\tallNamespaces\n\t};\n}\nfunction makeNamespace(name, models) {\n\treturn makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname,\n\t\tentries: makePslNamespaceEntries(models.map((model) => ({\n\t\t\tkind: \"model\",\n\t\t\tname: model.name,\n\t\t\tfields: [],\n\t\t\tattributes: [],\n\t\t\tspan: ZERO_SPAN\n\t\t})), [], []),\n\t\tspan: ZERO_SPAN\n\t});\n}\nfunction findOwnerNamespaceName(symbolTable, block) {\n\tfor (const namespace of Object.values(symbolTable.topLevel.namespaces)) if (Object.values(namespace.blocks).some((candidate) => candidate === block)) return namespace.name;\n\treturn UNSPECIFIED_PSL_NAMESPACE_ID;\n}\n//#endregion\n//#region src/block-reconstruction.ts\nconst BLOCK_ATTRIBUTE_SOURCE_ID = \"unknown\";\n/**\n* Descriptor-free and unknown parameters become `value` stubs so validation can\n* report them via key-set comparison. Duplicate member names are first-wins.\n*/\nfunction reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {\n\tconst keyword = node.keyword()?.text ?? \"\";\n\tconst blockName = node.name()?.name() ?? \"\";\n\tconst blockAttributes = [];\n\tconst attributes = {};\n\tconst seenAttributeNames = /* @__PURE__ */ new Set();\n\tfor (const attribute of node.attributes()) {\n\t\tconst name = attribute.name()?.path().join(\".\") ?? \"\";\n\t\tconst args = Array.from(attribute.argList()?.args() ?? [], (arg) => {\n\t\t\tconst value = arg.value();\n\t\t\treturn {\n\t\t\t\tkind: \"positional\",\n\t\t\t\tvalue: value === void 0 ? \"\" : printSyntax(value.syntax).trim(),\n\t\t\t\tspan: nodePslSpan(arg.syntax, sourceFile)\n\t\t\t};\n\t\t});\n\t\tconst span = nodePslSpan(attribute.syntax, sourceFile);\n\t\tblockAttributes.push({\n\t\t\tname,\n\t\t\targs,\n\t\t\tspan\n\t\t});\n\t\tif (descriptor === void 0) continue;\n\t\tconst parsed = parseBlockAttribute(attribute, name, span, descriptor, seenAttributeNames, keyword, blockName, sourceFile);\n\t\tif (parsed.ok) attributes[name] = parsed.value;\n\t\telse diagnostics.push(...parsed.diagnostics);\n\t}\n\tconst parameters = {};\n\tfor (const entry of node.entries()) {\n\t\tconst key = entry.key()?.name();\n\t\tif (key === void 0) continue;\n\t\tconst span = nodePslSpan(entry.syntax, sourceFile);\n\t\tif (Object.hasOwn(parameters, key)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_EXTENSION_DUPLICATE_PARAMETER\",\n\t\t\t\tmessage: `Duplicate parameter \"${key}\" in \"${keyword}\" block \"${blockName}\"; first occurrence wins`,\n\t\t\t\trange: {\n\t\t\t\t\tstart: sourceFile.positionAt(entry.syntax.offset),\n\t\t\t\t\tend: sourceFile.positionAt(entry.syntax.offset + entry.syntax.green.textLength)\n\t\t\t\t}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tparameters[key] = reconstructParamValue(entry, descriptor?.parameters[key], span, sourceFile, diagnostics);\n\t}\n\treturn {\n\t\tkind: descriptor?.discriminator ?? keyword,\n\t\tkeyword,\n\t\tname: blockName,\n\t\tparameters,\n\t\tblockAttributes,\n\t\tattributes,\n\t\tspan: nodePslSpan(node.syntax, sourceFile)\n\t};\n}\nfunction parseBlockAttribute(attribute, name, span, descriptor, seenNames, keyword, blockName, sourceFile) {\n\tconst range = pslSpanToRange(span, sourceFile);\n\tconst declared = descriptor.attributes ?? {};\n\tif (!Object.hasOwn(declared, name)) return {\n\t\tok: false,\n\t\tdiagnostics: [{\n\t\t\tcode: \"PSL_EXTENSION_UNKNOWN_BLOCK_ATTRIBUTE\",\n\t\t\tmessage: `Unknown attribute \"@@${name}\" in \"${keyword}\" block \"${blockName}\"`,\n\t\t\trange\n\t\t}]\n\t};\n\tif (seenNames.has(name)) return {\n\t\tok: false,\n\t\tdiagnostics: [{\n\t\t\tcode: \"PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE\",\n\t\t\tmessage: `Duplicate attribute \"@@${name}\" in \"${keyword}\" block \"${blockName}\"; first occurrence wins`,\n\t\t\trange\n\t\t}]\n\t};\n\tseenNames.add(name);\n\tconst result = interpretAttribute(attribute, blindCast(declared[name])(), {\n\t\tsourceId: BLOCK_ATTRIBUTE_SOURCE_ID,\n\t\tsourceFile\n\t});\n\tif (!result.ok) return {\n\t\tok: false,\n\t\tdiagnostics: result.failure.map((diagnostic) => toParseDiagnostic(diagnostic, sourceFile))\n\t};\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\targs: result.value,\n\t\t\tspan\n\t\t}\n\t};\n}\nfunction toParseDiagnostic(diagnostic, sourceFile) {\n\treturn {\n\t\tcode: diagnostic.code,\n\t\tmessage: diagnostic.message,\n\t\trange: pslSpanToRange(diagnostic.span, sourceFile)\n\t};\n}\nfunction pslSpanToRange(span, sourceFile) {\n\treturn {\n\t\tstart: sourceFile.positionAt(span.start.offset),\n\t\tend: sourceFile.positionAt(span.end.offset)\n\t};\n}\nfunction reconstructParamValue(entry, param, span, sourceFile, diagnostics) {\n\tconst value = entry.value();\n\tif (value === void 0) return {\n\t\tkind: \"bare\",\n\t\tspan\n\t};\n\treturn reconstructFromExpression(value, param, span, sourceFile, diagnostics);\n}\nfunction reconstructFromExpression(value, param, span, sourceFile, diagnostics) {\n\tconst raw = printSyntax(value.syntax).trim();\n\tif (param?.kind === \"list\") {\n\t\tconst array = ArrayLiteralAst.cast(value.syntax);\n\t\tif (!array) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `List parameter expects an array literal, got ${raw}`,\n\t\t\t\trange: {\n\t\t\t\t\tstart: sourceFile.positionAt(value.syntax.offset),\n\t\t\t\t\tend: sourceFile.positionAt(value.syntax.offset + value.syntax.green.textLength)\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tkind: \"value\",\n\t\t\t\traw,\n\t\t\t\tspan\n\t\t\t};\n\t\t}\n\t\tconst items = [];\n\t\tfor (const element of array.elements()) items.push(reconstructFromExpression(element, param.of, nodePslSpan(element.syntax, sourceFile), sourceFile, diagnostics));\n\t\treturn {\n\t\t\tkind: \"list\",\n\t\t\titems,\n\t\t\tspan\n\t\t};\n\t}\n\tswitch (param?.kind) {\n\t\tcase \"ref\": return {\n\t\t\tkind: \"ref\",\n\t\t\tidentifier: raw,\n\t\t\tspan\n\t\t};\n\t\tcase \"option\": return {\n\t\t\tkind: \"option\",\n\t\t\ttoken: raw,\n\t\t\tspan\n\t\t};\n\t\tdefault: return {\n\t\t\tkind: \"value\",\n\t\t\traw,\n\t\t\tspan\n\t\t};\n\t}\n}\n//#endregion\n//#region src/symbol-table.ts\n/**\n* Owns duplicate-declaration detection for all PSL scopes; downstream consumers\n* should consume first-wins symbols rather than re-emitting duplicate diagnostics.\n*/\nfunction buildSymbolTable(options) {\n\tconst { document, sourceFile, pslBlockDescriptors } = options;\n\tconst diagnostics = [];\n\tconst namespaces = Object.create(null);\n\tconst namedTypes = {};\n\tconst blocks = {};\n\tconst models = {};\n\tconst compositeTypes = {};\n\tconst topLevelNames = /* @__PURE__ */ new Set();\n\tconst claim = (taken, name) => {\n\t\tconst text = name?.name();\n\t\tif (text === void 0) return void 0;\n\t\tif (taken.has(text)) {\n\t\t\tconst range = nameRange(name, sourceFile);\n\t\t\tif (range) diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\tmessage: `Duplicate declaration of \"${text}\"`,\n\t\t\t\trange\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\ttaken.add(text);\n\t\treturn text;\n\t};\n\tfor (const declaration of document.declarations()) if (declaration instanceof ModelDeclarationAst) {\n\t\tconst name = claim(topLevelNames, declaration.name());\n\t\tif (name !== void 0) models[name] = buildModel(name, declaration, sourceFile, diagnostics);\n\t} else if (declaration instanceof CompositeTypeDeclarationAst) {\n\t\tconst name = claim(topLevelNames, declaration.name());\n\t\tif (name !== void 0) compositeTypes[name] = buildCompositeType(name, declaration, sourceFile, diagnostics);\n\t} else if (declaration instanceof GenericBlockDeclarationAst) {\n\t\tconst name = claim(topLevelNames, declaration.name());\n\t\tif (name !== void 0) blocks[name] = buildBlock(name, declaration, sourceFile, pslBlockDescriptors, diagnostics);\n\t} else if (declaration instanceof NamespaceDeclarationAst) {\n\t\tconst declaredName = declaration.name()?.name();\n\t\tif (declaredName === void 0) continue;\n\t\tlet namespace = namespaces[declaredName];\n\t\tif (namespace === void 0) {\n\t\t\tconst name = claim(topLevelNames, declaration.name());\n\t\t\tif (name === void 0) continue;\n\t\t\tnamespace = {\n\t\t\t\tkind: \"namespace\",\n\t\t\t\tname,\n\t\t\t\tdeclarations: [],\n\t\t\t\tmodels: Object.create(null),\n\t\t\t\tcompositeTypes: Object.create(null),\n\t\t\t\tblocks: Object.create(null)\n\t\t\t};\n\t\t\tnamespaces[name] = namespace;\n\t\t}\n\t\textendNamespace(namespace, declaration, diagnostics, sourceFile, pslBlockDescriptors);\n\t} else if (declaration instanceof TypesBlockAst) for (const binding of declaration.declarations()) {\n\t\tconst name = claim(topLevelNames, binding.name());\n\t\tif (name === void 0) continue;\n\t\tconst resolved = resolveNamedTypeBinding(binding, sourceFile);\n\t\tnamedTypes[name] = {\n\t\t\tkind: \"namedType\",\n\t\t\tname,\n\t\t\tnode: binding,\n\t\t\tspan: nodePslSpan(binding.syntax, sourceFile),\n\t\t\t...resolved\n\t\t};\n\t}\n\treturn {\n\t\ttable: { topLevel: {\n\t\t\tnamespaces,\n\t\t\tnamedTypes,\n\t\t\tblocks,\n\t\t\tmodels,\n\t\t\tcompositeTypes\n\t\t} },\n\t\tdiagnostics\n\t};\n}\nfunction buildModel(name, node, sourceFile, diagnostics) {\n\treturn {\n\t\tkind: \"model\",\n\t\tname,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sourceFile),\n\t\tfields: buildFields(name, node.fields(), sourceFile, diagnostics),\n\t\tattributes: readResolvedAttributes(node.attributes(), sourceFile)\n\t};\n}\nfunction buildCompositeType(name, node, sourceFile, diagnostics) {\n\treturn {\n\t\tkind: \"compositeType\",\n\t\tname,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sourceFile),\n\t\tfields: buildFields(name, node.fields(), sourceFile, diagnostics),\n\t\tattributes: readResolvedAttributes(node.attributes(), sourceFile)\n\t};\n}\nfunction buildBlock(name, node, sourceFile, pslBlockDescriptors, diagnostics) {\n\tconst keyword = node.keyword()?.text ?? \"\";\n\tconst descriptor = findBlockDescriptor(pslBlockDescriptors, keyword);\n\treturn {\n\t\tkind: \"block\",\n\t\tname,\n\t\tkeyword,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sourceFile),\n\t\tblock: reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics)\n\t};\n}\nfunction extendNamespace(namespace, node, diagnostics, sourceFile, pslBlockDescriptors) {\n\tconst { models, compositeTypes, blocks } = namespace;\n\tnamespace.declarations.push({\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sourceFile)\n\t});\n\tfor (const member of node.declarations()) {\n\t\tconst memberName = member.name()?.name();\n\t\tif (memberName === void 0) continue;\n\t\tif (Object.hasOwn(models, memberName) || Object.hasOwn(compositeTypes, memberName) || Object.hasOwn(blocks, memberName)) {\n\t\t\tconst range = nameRange(member.name(), sourceFile);\n\t\t\tif (range) diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\tmessage: `Duplicate declaration of \"${memberName}\"`,\n\t\t\t\trange\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (member instanceof ModelDeclarationAst) models[memberName] = buildModel(memberName, member, sourceFile, diagnostics);\n\t\telse if (member instanceof CompositeTypeDeclarationAst) compositeTypes[memberName] = buildCompositeType(memberName, member, sourceFile, diagnostics);\n\t\telse if (member instanceof GenericBlockDeclarationAst) blocks[memberName] = buildBlock(memberName, member, sourceFile, pslBlockDescriptors, diagnostics);\n\t}\n}\nfunction buildFields(ownerName, fields, sourceFile, diagnostics) {\n\tconst result = {};\n\tfor (const field of fields) {\n\t\tconst nameNode = field.name();\n\t\tconst name = nameNode?.name();\n\t\tif (name === void 0) continue;\n\t\tif (Object.hasOwn(result, name)) {\n\t\t\tconst range = nameRange(nameNode, sourceFile);\n\t\t\tif (range) diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\tmessage: `Duplicate declaration of \"${name}\"`,\n\t\t\t\trange\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tresult[name] = buildField(ownerName, name, field, sourceFile, diagnostics);\n\t}\n\treturn result;\n}\nfunction buildField(ownerName, name, node, sourceFile, diagnostics) {\n\tconst attributes = readResolvedAttributes(node.attributes(), sourceFile);\n\tconst span = nodePslSpan(node.syntax, sourceFile);\n\tconst annotation = node.typeAnnotation();\n\tconst typeName = annotation?.name();\n\tif (typeName?.isOverQualified()) {\n\t\tconst path = typeName.path();\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_INVALID_QUALIFIED_TYPE\",\n\t\t\tmessage: `Field \"${ownerName}.${name}\" has an invalid qualified type \"${path.join(\".\")}\"; use at most one namespace qualifier (e.g. \"ns.TypeName\")`,\n\t\t\trange: nodeRange(typeName.syntax, sourceFile)\n\t\t});\n\t\treturn {\n\t\t\tkind: \"field\",\n\t\t\tname,\n\t\t\tnode,\n\t\t\tspan,\n\t\t\ttypeName: path[path.length - 1] ?? \"\",\n\t\t\toptional: false,\n\t\t\tlist: false,\n\t\t\tmalformedType: true,\n\t\t\tattributes\n\t\t};\n\t}\n\tconst typeConstructor = annotation?.isConstructor() ? readResolvedConstructorCall(annotation, sourceFile) : void 0;\n\tconst typeNamespaceId = typeName?.namespace()?.name();\n\tconst typeContractSpaceId = typeName?.space()?.name();\n\treturn {\n\t\tkind: \"field\",\n\t\tname,\n\t\tnode,\n\t\tspan,\n\t\ttypeName: typeName?.identifier()?.name() ?? \"\",\n\t\t...typeNamespaceId !== void 0 ? { typeNamespaceId } : {},\n\t\t...typeContractSpaceId !== void 0 ? { typeContractSpaceId } : {},\n\t\toptional: annotation?.isOptional() ?? false,\n\t\tlist: annotation?.isList() ?? false,\n\t\t...typeConstructor !== void 0 ? { typeConstructor } : {},\n\t\tattributes\n\t};\n}\nfunction resolveNamedTypeBinding(node, sourceFile) {\n\tconst annotation = node.typeAnnotation();\n\tconst isConstructor = annotation?.isConstructor() ?? false;\n\tconst baseType = annotation?.name()?.identifier()?.name();\n\tconst typeConstructor = readResolvedConstructorCall(annotation, sourceFile);\n\treturn {\n\t\tisConstructor,\n\t\t...!isConstructor && baseType !== void 0 ? { baseType } : {},\n\t\t...typeConstructor !== void 0 ? { typeConstructor } : {},\n\t\tattributes: readResolvedAttributes(node.attributes(), sourceFile)\n\t};\n}\nfunction nameRange(name, sourceFile) {\n\tif (name === void 0) return void 0;\n\tfor (const token of name.syntax.tokens()) if (token.kind === \"Ident\") return {\n\t\tstart: sourceFile.positionAt(token.offset),\n\t\tend: sourceFile.positionAt(token.offset + token.text.length)\n\t};\n}\nfunction nodeRange(node, sourceFile) {\n\tconst start = node.offset;\n\tconst end = start + node.green.textLength;\n\treturn {\n\t\tstart: sourceFile.positionAt(start),\n\t\tend: sourceFile.positionAt(end)\n\t};\n}\n//#endregion\nexport { assembleAttributeSpecs, blockAttribute, bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, json, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, numLiteral, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, referencedFieldRef, str, taggedLiteral, validateExtensionBlockFromSymbol };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,sBAAsB,WAAW,QAAQ,GAAG;CACpD,OAAO,UAAU,KAAK,QAAQ,QAAQ,IAAI,SAAS,YAAY,CAAC,CAAC,MAAM,EAAE;AAC1E;AACA,SAAS,yBAAyB,OAAO;CACxC,MAAM,QAAQ,MAAM,KAAK,CAAC,CAAC,MAAM,gBAAgB;CACjD,IAAI,CAAC,OAAO,OAAO,KAAK;CACxB,OAAO,MAAM,MAAM;AACpB;AAGA,UAAU,0BAA0B,WAAW;CAC9C,KAAK,MAAM,SAAS,OAAO,OAAO,SAAS,GAAG;EAC7C,IAAI,oCAAoC,KAAK,GAAG;GAC/C,MAAM;GACN;EACD;EACA,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,SAAS,uBAAuB,eAAe;CAC9C,MAAM,UAAU,OAAO,QAAQ,cAAc,eAAe,KAAK;CACjE,MAAM,UAAU,IAAI,IAAI,QAAQ,KAAK,CAAC,eAAe,SAAS,CAAC;CAC/D,KAAK,MAAM,cAAc,0BAA0B,cAAc,eAAe,GAAG;EAClF,IAAI,QAAQ,IAAI,WAA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,wBAAwB,KAAK,IAAI,EAAE,oBAAoB,IAAI,CAAC;EAC/D,UAAU,YAAY,WAAW,KAAK;EACtC,MAAM,YAAY,OAAO,KAAK;EAC9B,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;EACvD;CACD;AACD;AACA,SAAS,wBAAwB,MAAM,YAAY;CAClD,MAAM,aAAa,KAAK,eAAe;CACvC,MAAM,gBAAgB,YAAY,cAAc,KAAK;CACrD,MAAM,WAAW,YAAY,KAAK,CAAC,EAAE,WAAW,CAAC,EAAE,KAAK;CACxD,MAAM,kBAAkB,4BAA4B,YAAY,UAAU;CAC1E,OAAO;EACN;EACA,GAAG,CAAC,iBAAiB,aAAa,KAAK,IAAI,EAAE,SAAS,IAAI,CAAC;EAC3D,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;EACvD,YAAY,uBAAuB,KAAK,WAAW,GAAG,UAAU;CACjE;AACD;AACA,SAAS,UAAU,MAAM,YAAY;CACpC,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK;CACjC,KAAK,MAAM,SAAS,KAAK,OAAO,OAAO,GAAG,IAAI,MAAM,SAAS,SAAS,OAAO;EAC5E,OAAO,WAAW,WAAW,MAAM,MAAM;EACzC,KAAK,WAAW,WAAW,MAAM,SAAS,MAAM,KAAK,MAAM;CAC5D;AACD;AACA,SAAS,UAAU,MAAM,YAAY;CACpC,MAAM,QAAQ,KAAK;CACnB,MAAM,MAAM,QAAQ,KAAK,MAAM;CAC/B,OAAO;EACN,OAAO,WAAW,WAAW,KAAK;EAClC,KAAK,WAAW,WAAW,GAAG;CAC/B;AACD"}
|
|
1
|
+
{"version":3,"file":"psl-parser.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/index.mjs"],"sourcesContent":["import { A as printSyntax, S as TaggedLiteralExprAst, T as IdentifierAst, _ as FunctionCallAst, b as ObjectLiteralExprAst, c as NamespaceDeclarationAst, g as BooleanLiteralExprAst, i as GenericBlockDeclarationAst, l as TypesBlockAst, m as ArrayLiteralAst, o as ModelDeclarationAst, t as CompositeTypeDeclarationAst, v as NumberLiteralExprAst, x as StringLiteralExprAst } from \"./declarations-SwNXosDu.mjs\";\nimport { i as mapPslDiagnostics, n as diagnosticFromSpan, r as diagnosticSource, t as createPslDiagnosticCollector } from \"./diagnostic-Esyl8Qw1.mjs\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock } from \"@internal/framework-components/psl-ast\";\nimport { isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/attribute-helpers.ts\nfunction getPositionalArgument(attribute, index = 0) {\n\treturn attribute.args.filter((arg) => arg.kind === \"positional\")[index]?.value;\n}\nfunction parseQuotedStringLiteral(value) {\n\tconst match = value.trim().match(/^(['\"])(.*)\\1$/);\n\tif (!match) return void 0;\n\treturn match[2] ?? \"\";\n}\n//#endregion\n//#region src/attribute-spec/assemble.ts\nfunction* modelAttributeDescriptors(namespace) {\n\tfor (const value of Object.values(namespace)) {\n\t\tif (isAuthoringModelAttributeDescriptor(value)) {\n\t\t\tyield value;\n\t\t\tcontinue;\n\t\t}\n\t\tyield* modelAttributeDescriptors(value);\n\t}\n}\nfunction assembleAttributeSpecs(contributions) {\n\tconst entries = Object.entries(contributions.attributeSpecs.model);\n\tconst claimed = new Set(entries.map(([attribute]) => attribute));\n\tfor (const descriptor of modelAttributeDescriptors(contributions.modelAttributes)) {\n\t\tif (claimed.has(descriptor.attribute)) throw new InternalError(`Duplicate attribute spec registration for \"${descriptor.attribute}\". Each model attribute name may be registered once across family built-ins and model-attribute descriptors.`);\n\t\tclaimed.add(descriptor.attribute);\n\t\tentries.push([descriptor.attribute, descriptor.spec]);\n\t}\n\treturn Object.freeze(blindCast({\n\t\tmodel: Object.freeze(Object.fromEntries(entries)),\n\t\tfield: Object.freeze({ ...contributions.attributeSpecs.field })\n\t}));\n}\n//#endregion\n//#region src/attribute-spec/block-attribute.ts\nfunction blockAttribute(name, config) {\n\treturn {\n\t\tlevel: \"block\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/resolve.ts\nfunction readResolvedAttribute(attribute, sources) {\n\treturn {\n\t\tname: attributeName(attribute.name()),\n\t\targs: readResolvedArgList(attribute.argList(), sources),\n\t\tspan: nodePslSpan(attribute.syntax, sources)\n\t};\n}\nfunction readResolvedAttributes(attributes, sources) {\n\treturn Array.from(attributes, (attribute) => readResolvedAttribute(attribute, sources));\n}\nfunction readResolvedConstructorCall(annotation, sources) {\n\tconst argList = annotation?.argList();\n\tif (annotation === void 0 || argList === void 0) return void 0;\n\treturn {\n\t\tpath: annotation.name()?.path() ?? [],\n\t\targs: readResolvedArgList(argList, sources),\n\t\tspan: nodePslSpan(annotation.syntax, sources)\n\t};\n}\nfunction readResolvedArgList(argList, sources) {\n\tif (argList === void 0) return [];\n\tconst args = [];\n\tfor (const arg of argList.args()) {\n\t\tconst name = arg.name()?.name();\n\t\tconst expression = arg.value();\n\t\targs.push({\n\t\t\tkind: name !== void 0 ? \"named\" : \"positional\",\n\t\t\t...name !== void 0 ? { name } : {},\n\t\t\tvalue: renderExpression(expression),\n\t\t\t...expression !== void 0 ? { expression } : {},\n\t\t\tspan: nodePslSpan(arg.syntax, sources)\n\t\t});\n\t}\n\treturn args;\n}\nfunction attributeName(name) {\n\treturn name?.path().join(\".\") ?? \"\";\n}\nfunction renderExpression(expression) {\n\tif (expression === void 0) return \"\";\n\treturn printSyntax(expression.syntax).trim();\n}\nfunction nodePslSpan(node, sources) {\n\tconst sourceFile = sources.sourceFileFor(node);\n\tconst start = node.offset;\n\tconst end = start + node.green.textLength;\n\treturn {\n\t\tstart: sourceFile.offsetToPslPosition(start),\n\t\tend: sourceFile.offsetToPslPosition(end)\n\t};\n}\n/** Unsupported-top-level-block diagnostics are anchored to the keyword token. */\nfunction keywordPslSpan(node, keyword, sources) {\n\tconst sourceFile = sources.sourceFileFor(node);\n\tconst start = node.offset;\n\tconst end = start + keyword.length;\n\treturn {\n\t\tstart: sourceFile.offsetToPslPosition(start),\n\t\tend: sourceFile.offsetToPslPosition(end)\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/diagnostic.ts\nconst ATTRIBUTE_DIAGNOSTIC_CODE = \"PSL_INVALID_ATTRIBUTE_SYNTAX\";\nfunction leafDiagnostic(ctx, node, message, code = ATTRIBUTE_DIAGNOSTIC_CODE) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...diagnosticSource(ctx.sources, node.syntax).at(nodePslSpan(node.syntax, ctx.sources))\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/bool.ts\nfunction bool() {\n\treturn {\n\t\tkind: \"bool\",\n\t\tlabel: \"boolean\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = BooleanLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst value = literal.value();\n\t\t\t\tif (value !== void 0) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a boolean literal\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/entity-ref.ts\nfunction entityRef() {\n\treturn {\n\t\tkind: \"entityRef\",\n\t\tlabel: \"model name\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst identifier = IdentifierAst.cast(arg.syntax);\n\t\t\tif (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a model name\")]);\n\t\t\tconst name = identifier.name();\n\t\t\tif (name === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a model name\")]);\n\t\t\treturn ok(name);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/field-ref.ts\nfunction parseFieldName(arg, ctx, model) {\n\tconst identifier = IdentifierAst.cast(arg.syntax);\n\tif (identifier === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a field name\")]);\n\tconst name = identifier.name();\n\tif (name === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a field name\")]);\n\tif (model !== void 0 && !Object.hasOwn(model.fields, name)) return notOk([leafDiagnostic(ctx, arg, `Field \"${name}\" does not exist on model \"${model.name}\"`)]);\n\treturn ok(name);\n}\nfunction fieldRef() {\n\treturn {\n\t\tkind: \"fieldRef\",\n\t\tlabel: \"field name\",\n\t\tparse: (arg, ctx) => parseFieldName(arg, ctx, ctx.selfModel)\n\t};\n}\nfunction referencedFieldRef() {\n\treturn {\n\t\tkind: \"referencedFieldRef\",\n\t\tlabel: \"field name\",\n\t\tparse: (arg, ctx) => parseFieldName(arg, ctx, ctx.resolveReferencedModel())\n\t};\n}\n//#endregion\n//#region src/attribute-spec/interpret.ts\nfunction interpretArgs(args, spec, ctx, span, sourceNode) {\n\tconst diagnostics = [];\n\tconst output = {};\n\tconst seen = /* @__PURE__ */ new Set();\n\tlet positionalSlot = 0;\n\tlet reportedExcess = false;\n\tfor (const arg of args) {\n\t\tconst name = arg.name()?.name();\n\t\tlet key;\n\t\tlet param;\n\t\tif (name === void 0) {\n\t\t\tconst posParam = spec.positional[positionalSlot];\n\t\t\tif (posParam === void 0) {\n\t\t\t\tif (!reportedExcess) {\n\t\t\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received too many positional arguments`, ctx, span, sourceNode));\n\t\t\t\t\treportedExcess = true;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpositionalSlot += 1;\n\t\t\tkey = posParam.key;\n\t\t\tparam = posParam.type;\n\t\t} else {\n\t\t\tconst namedParam = Object.hasOwn(spec.named, name) ? spec.named[name] : void 0;\n\t\t\tif (namedParam === void 0) {\n\t\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received unknown argument \"${name}\"`, ctx, nodePslSpan(arg.syntax, ctx.sources), arg.syntax));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tkey = name;\n\t\t\tparam = namedParam.type;\n\t\t}\n\t\tif (seen.has(key)) {\n\t\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" received duplicate argument \"${key}\"`, ctx, nodePslSpan(arg.syntax, ctx.sources), arg.syntax));\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(key);\n\t\tconst result = parseArgValue(arg, param, ctx, diagnostics);\n\t\tif (result.ok) output[key] = result.value;\n\t}\n\tconst finalized = /* @__PURE__ */ new Set();\n\tconst finalizeAbsentKey = (key, positionalParam, namedParam) => {\n\t\tif (finalized.has(key) || seen.has(key)) return;\n\t\tfinalized.add(key);\n\t\tconst effective = namedParam ?? positionalParam;\n\t\tif (effective === void 0) return;\n\t\tif (isOptionalArgType(effective)) {\n\t\t\tif (effective.hasDefault) output[key] = effective.defaultValue;\n\t\t\treturn;\n\t\t}\n\t\tdiagnostics.push(diagnostic(`Attribute \"${spec.name}\" is missing required argument \"${key}\"`, ctx, span, sourceNode));\n\t};\n\tfor (const param of spec.positional) {\n\t\tconst namedParam = Object.hasOwn(spec.named, param.key) ? spec.named[param.key] : void 0;\n\t\tfinalizeAbsentKey(param.key, param.type, namedParam?.type);\n\t}\n\tfor (const key of Object.keys(spec.named)) finalizeAbsentKey(key, void 0, spec.named[key]?.type);\n\tif (diagnostics.length > 0) return notOk(diagnostics);\n\treturn ok(output);\n}\nfunction interpretAttribute(attrNode, spec, ctx) {\n\tconst attributeSpan = nodePslSpan(attrNode.syntax, ctx.sources);\n\tconst bound = interpretArgs(attrNode.argList()?.args() ?? [], spec, ctx, attributeSpan, attrNode.syntax);\n\tif (!bound.ok) return notOk(bound.failure);\n\tconst value = blindCast(bound.value);\n\tif (spec.refine !== void 0) {\n\t\tconst refineDiagnostics = spec.refine(value, ctx, attrNode);\n\t\tif (refineDiagnostics.length > 0) return notOk(refineDiagnostics);\n\t}\n\treturn ok(value);\n}\nfunction parseArgValue(arg, argType, ctx, diagnostics) {\n\tconst value = arg.value();\n\tif (value === void 0) {\n\t\tconst missing = diagnostic(\"Attribute argument is missing a value\", ctx, nodePslSpan(arg.syntax, ctx.sources), arg.syntax);\n\t\tdiagnostics.push(missing);\n\t\treturn notOk([missing]);\n\t}\n\tconst result = argType.parse(value, ctx);\n\tif (!result.ok) for (const failure of result.failure) diagnostics.push(failure);\n\treturn result;\n}\nfunction isOptionalArgType(param) {\n\treturn \"optional\" in param && param.optional === true;\n}\nfunction diagnostic(message, ctx, span, sourceNode) {\n\treturn {\n\t\tcode: ATTRIBUTE_DIAGNOSTIC_CODE,\n\t\tmessage,\n\t\t...diagnosticSource(ctx.sources, sourceNode).at(span)\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/func-call.ts\nfunction funcCall(name, sig) {\n\treturn {\n\t\tkind: \"funcCall\",\n\t\tlabel: `${name}()`,\n\t\tname,\n\t\tsignature: sig,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst guard = matchCallee(arg, name, ctx);\n\t\t\tif (!guard.ok) return guard;\n\t\t\tconst span = nodePslSpan(guard.value.syntax, ctx.sources);\n\t\t\tconst bound = interpretArgs(guard.value.args(), {\n\t\t\t\tname,\n\t\t\t\tpositional: sig.positional ?? [],\n\t\t\t\tnamed: sig.named ?? {}\n\t\t\t}, ctx, span, guard.value.syntax);\n\t\t\tif (!bound.ok) return notOk(bound.failure);\n\t\t\treturn ok({\n\t\t\t\tfn: name,\n\t\t\t\tspan,\n\t\t\t\targs: bound.value\n\t\t\t});\n\t\t}\n\t};\n}\nfunction matchCallee(arg, name, ctx) {\n\tconst call = FunctionCallAst.cast(arg.syntax);\n\tif (call === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tconst qname = call.name();\n\tif (qname === void 0 || qname.dot() !== void 0 || qname.colon() !== void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tconst calleeName = qname.identifier()?.token()?.text;\n\tif (calleeName === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a function call\")]);\n\tif (calleeName !== name) return notOk([leafDiagnostic(ctx, arg, `Expected ${name}()`)]);\n\treturn ok(call);\n}\n//#endregion\n//#region src/attribute-spec/combinators/identifier.ts\nfunction identifier(name, options) {\n\treturn {\n\t\tkind: \"identifier\",\n\t\tlabel: name,\n\t\tname,\n\t\tdocumentation: options.documentation,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst identifier = IdentifierAst.cast(arg.syntax);\n\t\t\tif (identifier !== void 0 && identifier.name() === name) return ok(name);\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${name}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/int.ts\nfunction int(opts) {\n\tconst min = opts?.min;\n\tconst max = opts?.max;\n\treturn {\n\t\tkind: \"int\",\n\t\tlabel: \"integer\",\n\t\t...min === void 0 ? {} : { min },\n\t\t...max === void 0 ? {} : { max },\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst value = literal.value();\n\t\t\t\tif (value !== void 0 && Number.isInteger(value)) {\n\t\t\t\t\tif ((min === void 0 || value >= min) && (max === void 0 || value <= max)) return ok(value);\n\t\t\t\t\treturn notOk([leafDiagnostic(ctx, arg, rangeMessage(min, max))]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected an integer literal\")]);\n\t\t}\n\t};\n}\nfunction rangeMessage(min, max) {\n\tif (min !== void 0 && max !== void 0) return `Expected an integer between ${min} and ${max}`;\n\tif (min !== void 0) return `Expected an integer greater than or equal to ${min}`;\n\treturn `Expected an integer less than or equal to ${max}`;\n}\n//#endregion\n//#region src/attribute-spec/combinators/json.ts\n/**\n* Reads an opaque JSON object from a quoted JSON string — the ADR's one text-encoded surface\n* exception (e.g. an index `filter` / `weights` argument). The string is decoded by the parser,\n* then JSON-parsed; a non-object (array/scalar) or invalid JSON is a diagnostic.\n*/\nfunction json() {\n\treturn {\n\t\tkind: \"json\",\n\t\tlabel: \"JSON object\",\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a JSON object string\")]);\n\t\t\tconst raw = literal.value();\n\t\t\tif (raw !== void 0) try {\n\t\t\t\tconst parsed = JSON.parse(raw);\n\t\t\t\tif (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) return ok(blindCast(parsed));\n\t\t\t} catch {}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a valid JSON object\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/list.ts\nfunction list(of, opts) {\n\tconst allowEmpty = opts?.allowEmpty ?? true;\n\tconst unique = opts?.unique ?? false;\n\treturn {\n\t\tkind: \"list\",\n\t\tlabel: `${of.label}[]`,\n\t\tof,\n\t\tallowEmpty,\n\t\tunique,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = ArrayLiteralAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, `Expected a list of ${of.label}`)]);\n\t\t\tconst diagnostics = [];\n\t\t\tconst parsed = [];\n\t\t\tlet count = 0;\n\t\t\tfor (const element of literal.elements()) {\n\t\t\t\tcount += 1;\n\t\t\t\tconst result = of.parse(element, ctx);\n\t\t\t\tif (result.ok) parsed.push({\n\t\t\t\t\tnode: element,\n\t\t\t\t\tvalue: result.value\n\t\t\t\t});\n\t\t\t\telse diagnostics.push(...result.failure);\n\t\t\t}\n\t\t\tif (!allowEmpty && count === 0) diagnostics.push(leafDiagnostic(ctx, arg, \"Expected a non-empty list\"));\n\t\t\tif (unique) {\n\t\t\t\tconst seen = /* @__PURE__ */ new Set();\n\t\t\t\tfor (const { node, value } of parsed) if (seen.has(value)) diagnostics.push(leafDiagnostic(ctx, node, \"Duplicate list entry\"));\n\t\t\t\telse seen.add(value);\n\t\t\t}\n\t\t\tif (diagnostics.length > 0) return notOk(diagnostics);\n\t\t\treturn ok(parsed.map((entry) => entry.value));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/num.ts\nfunction num(value) {\n\tif (value === void 0) return {\n\t\tkind: \"num\",\n\t\tlabel: \"number\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst parsed = literal.value();\n\t\t\t\tif (parsed !== void 0) return ok(parsed);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a number literal\")]);\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"num\",\n\t\tlabel: String(value),\n\t\tvalue,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = NumberLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tif (literal.value() === value) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${value}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/num-literal.ts\n/** A number literal kept as its source text, for consumers that must not round it through a JS number. */\nfunction numLiteral() {\n\treturn {\n\t\tkind: \"num\",\n\t\tlabel: \"number\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst text = NumberLiteralExprAst.cast(arg.syntax)?.token()?.text;\n\t\t\tif (text !== void 0) return ok({ text });\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a number literal\")]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/one-of.ts\nfunction oneOf(...alts) {\n\tconst label = alts.map((alt) => alt.label).join(\" | \");\n\treturn {\n\t\tkind: \"oneOf\",\n\t\tlabel,\n\t\talternatives: alts,\n\t\tparse: (arg, ctx) => {\n\t\t\tfor (const alt of alts) {\n\t\t\t\tconst result = blindCast(alt.parse)(arg, ctx);\n\t\t\t\tif (result.ok) return ok(blindCast(result.value));\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected one of: ${label}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/record.ts\nfunction record(of) {\n\treturn {\n\t\tkind: \"record\",\n\t\tlabel: `{ [key]: ${of.label} }`,\n\t\tof,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = ObjectLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected an object literal\")]);\n\t\t\tconst diagnostics = [];\n\t\t\tconst entries = [];\n\t\t\tconst keys = /* @__PURE__ */ new Set();\n\t\t\tfor (const field of Array.from(literal.fields())) {\n\t\t\t\tconst key = field.keyName();\n\t\t\t\tif (key === void 0) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, \"Expected a key\"));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst value = field.value();\n\t\t\t\tif (value === void 0) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, `Expected a value for key \"${key}\"`));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst parsed = of.parse(value, ctx);\n\t\t\t\tif (!parsed.ok) {\n\t\t\t\t\tdiagnostics.push(...parsed.failure);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (keys.has(key)) {\n\t\t\t\t\tdiagnostics.push(leafDiagnostic(ctx, field, `Duplicate key \"${key}\"`));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tkeys.add(key);\n\t\t\t\tentries.push([key, parsed.value]);\n\t\t\t}\n\t\t\tif (diagnostics.length > 0) return notOk(diagnostics);\n\t\t\treturn ok(Object.fromEntries(entries));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/str.ts\nfunction str(value) {\n\tif (value === void 0) return {\n\t\tkind: \"str\",\n\t\tlabel: \"string\",\n\t\tvalue: void 0,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tconst parsed = literal.value();\n\t\t\t\tif (parsed !== void 0) return ok(parsed);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, \"Expected a string literal\")]);\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"str\",\n\t\tlabel: JSON.stringify(value),\n\t\tvalue,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = StringLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal !== void 0) {\n\t\t\t\tif (literal.value() === value) return ok(value);\n\t\t\t}\n\t\t\treturn notOk([leafDiagnostic(ctx, arg, `Expected ${JSON.stringify(value)}`)]);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/combinators/tagged-literal.ts\n/**\n* A `` tag`...` ``, `tag\"...\"`, or `tag'...'` argument. `tags` and `documentation` describe the\n* registered tags for tooling; parsing accepts any tag.\n*/\nfunction taggedLiteral(tags, options) {\n\treturn {\n\t\tkind: \"taggedLiteral\",\n\t\tlabel: `${tags[0] ?? \"tag\"}\\`...\\``,\n\t\ttags,\n\t\tdocumentation: options.documentation,\n\t\tparse: (arg, ctx) => {\n\t\t\tconst literal = TaggedLiteralExprAst.cast(arg.syntax);\n\t\t\tif (literal === void 0) return notOk([leafDiagnostic(ctx, arg, \"Expected a tagged literal\")]);\n\t\t\treturn ok({\n\t\t\t\ttag: literal.tagName(),\n\t\t\t\tcanonicalization: literal.canonicalization(),\n\t\t\t\tspan: nodePslSpan(literal.syntax, ctx.sources)\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/field-attribute.ts\nfunction fieldAttribute(name, config) {\n\treturn {\n\t\tlevel: \"field\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/model-attribute.ts\nfunction modelAttribute(name, config) {\n\treturn {\n\t\tlevel: \"model\",\n\t\tname,\n\t\tdocumentation: config.documentation,\n\t\tpositional: config.positional ?? [],\n\t\tnamed: config.named ?? {},\n\t\t...config.refine !== void 0 ? { refine: config.refine } : {}\n\t};\n}\n//#endregion\n//#region src/attribute-spec/optional.ts\nfunction optional(type, ...rest) {\n\tif (rest.length === 0) return {\n\t\t...type,\n\t\toptional: true,\n\t\thasDefault: false\n\t};\n\treturn {\n\t\t...type,\n\t\toptional: true,\n\t\thasDefault: true,\n\t\tdefaultValue: rest[0]\n\t};\n}\n//#endregion\n//#region src/extension-block.ts\nfunction findBlockDescriptor(descriptors, keyword) {\n\tif (descriptors === void 0) return void 0;\n\tfor (const value of Object.values(descriptors)) {\n\t\tif (value === void 0) continue;\n\t\tif (isAuthoringPslBlockDescriptor(value)) {\n\t\t\tif (value.keyword === keyword) return value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst nested = findBlockDescriptor(value, keyword);\n\t\tif (nested !== void 0) return nested;\n\t}\n}\nfunction validateExtensionBlockFromSymbol(input) {\n\tconst refCtx = buildRefResolutionContext(input.symbolTable, input.block);\n\treturn validateExtensionBlock(input.block.block, input.descriptor, input.sources.sourceFileFor(input.block.node.syntax).filename, input.codecLookup, refCtx).map((diagnostic) => diagnosticFromSpan(diagnostic, diagnosticSource(input.sources, input.block.node.syntax)));\n}\nconst ZERO_SPAN = {\n\tstart: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t},\n\tend: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t}\n};\nfunction buildRefResolutionContext(symbolTable, block) {\n\tconst unspecifiedNamespace = makeNamespace(UNSPECIFIED_PSL_NAMESPACE_ID, Object.values(symbolTable.topLevel.models));\n\tconst allNamespaces = [unspecifiedNamespace, ...Object.values(symbolTable.topLevel.namespaces).map((namespace) => makeNamespace(namespace.name, Object.values(namespace.models)))];\n\tconst ownerNamespaceName = findOwnerNamespaceName(symbolTable, block);\n\treturn {\n\t\townerNamespace: allNamespaces.find((namespace) => namespace.name === ownerNamespaceName) ?? unspecifiedNamespace,\n\t\tallNamespaces\n\t};\n}\nfunction makeNamespace(name, models) {\n\treturn makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname,\n\t\tentries: makePslNamespaceEntries(models.map((model) => ({\n\t\t\tkind: \"model\",\n\t\t\tname: model.name,\n\t\t\tfields: [],\n\t\t\tattributes: [],\n\t\t\tspan: ZERO_SPAN\n\t\t})), [], []),\n\t\tspan: ZERO_SPAN\n\t});\n}\nfunction findOwnerNamespaceName(symbolTable, block) {\n\tfor (const namespace of Object.values(symbolTable.topLevel.namespaces)) if (Object.values(namespace.blocks).some((candidate) => candidate === block)) return namespace.name;\n\treturn UNSPECIFIED_PSL_NAMESPACE_ID;\n}\n//#endregion\n//#region src/block-reconstruction.ts\n/**\n* Descriptor-free and unknown parameters become `value` stubs so validation can\n* report them via key-set comparison. Duplicate member names are first-wins.\n*/\nfunction reconstructExtensionBlock(node, descriptor, sources, diagnostics) {\n\tconst sourceFile = sources.sourceFileFor(node.syntax);\n\tconst keyword = node.keyword()?.text ?? \"\";\n\tconst blockName = node.name()?.name() ?? \"\";\n\tconst blockAttributes = [];\n\tconst attributes = {};\n\tconst seenAttributeNames = /* @__PURE__ */ new Set();\n\tfor (const attribute of node.attributes()) {\n\t\tconst name = attribute.name()?.path().join(\".\") ?? \"\";\n\t\tconst args = Array.from(attribute.argList()?.args() ?? [], (arg) => {\n\t\t\tconst value = arg.value();\n\t\t\treturn {\n\t\t\t\tkind: \"positional\",\n\t\t\t\tvalue: value === void 0 ? \"\" : printSyntax(value.syntax).trim(),\n\t\t\t\tspan: nodePslSpan(arg.syntax, sources)\n\t\t\t};\n\t\t});\n\t\tconst span = nodePslSpan(attribute.syntax, sources);\n\t\tblockAttributes.push({\n\t\t\tname,\n\t\t\targs,\n\t\t\tspan\n\t\t});\n\t\tif (descriptor === void 0) continue;\n\t\tconst parsed = parseBlockAttribute(attribute, name, span, descriptor, seenAttributeNames, keyword, blockName, sources);\n\t\tif (parsed.ok) attributes[name] = parsed.value;\n\t\telse diagnostics.push(...parsed.diagnostics);\n\t}\n\tconst parameters = {};\n\tfor (const entry of node.entries()) {\n\t\tconst key = entry.key()?.name();\n\t\tif (key === void 0) continue;\n\t\tconst span = nodePslSpan(entry.syntax, sources);\n\t\tif (Object.hasOwn(parameters, key)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tfilename: sourceFile.filename,\n\t\t\t\tcode: \"PSL_EXTENSION_DUPLICATE_PARAMETER\",\n\t\t\t\tmessage: `Duplicate parameter \"${key}\" in \"${keyword}\" block \"${blockName}\"; first occurrence wins`,\n\t\t\t\trange: {\n\t\t\t\t\tstart: sourceFile.positionAt(entry.syntax.offset),\n\t\t\t\t\tend: sourceFile.positionAt(entry.syntax.offset + entry.syntax.green.textLength)\n\t\t\t\t}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tparameters[key] = reconstructParamValue(entry, descriptor?.parameters[key], span, sources, diagnostics);\n\t}\n\treturn {\n\t\tkind: descriptor?.discriminator ?? keyword,\n\t\tkeyword,\n\t\tname: blockName,\n\t\tparameters,\n\t\tblockAttributes,\n\t\tattributes,\n\t\tspan: nodePslSpan(node.syntax, sources)\n\t};\n}\nfunction parseBlockAttribute(attribute, name, span, descriptor, seenNames, keyword, blockName, sources) {\n\tconst sourceFile = sources.sourceFileFor(attribute.syntax);\n\tconst range = sourceFile.pslSpanToRange(span);\n\tconst declared = descriptor.attributes ?? {};\n\tif (!Object.hasOwn(declared, name)) return {\n\t\tok: false,\n\t\tdiagnostics: [{\n\t\t\tfilename: sourceFile.filename,\n\t\t\tcode: \"PSL_EXTENSION_UNKNOWN_BLOCK_ATTRIBUTE\",\n\t\t\tmessage: `Unknown attribute \"@@${name}\" in \"${keyword}\" block \"${blockName}\"`,\n\t\t\trange\n\t\t}]\n\t};\n\tif (seenNames.has(name)) return {\n\t\tok: false,\n\t\tdiagnostics: [{\n\t\t\tfilename: sourceFile.filename,\n\t\t\tcode: \"PSL_INVALID_EXTENSION_BLOCK_ATTRIBUTE\",\n\t\t\tmessage: `Duplicate attribute \"@@${name}\" in \"${keyword}\" block \"${blockName}\"; first occurrence wins`,\n\t\t\trange\n\t\t}]\n\t};\n\tseenNames.add(name);\n\tconst result = interpretAttribute(attribute, blindCast(declared[name])(), { sources });\n\tif (!result.ok) return {\n\t\tok: false,\n\t\tdiagnostics: result.failure\n\t};\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\targs: result.value,\n\t\t\tspan\n\t\t}\n\t};\n}\nfunction reconstructParamValue(entry, param, span, sources, diagnostics) {\n\tconst value = entry.value();\n\tif (value === void 0) return {\n\t\tkind: \"bare\",\n\t\tspan\n\t};\n\treturn reconstructFromExpression(value, param, span, sources, diagnostics);\n}\nfunction reconstructFromExpression(value, param, span, sources, diagnostics) {\n\tconst raw = printSyntax(value.syntax).trim();\n\tif (param?.kind === \"list\") {\n\t\tconst sourceFile = sources.sourceFileFor(value.syntax);\n\t\tconst array = ArrayLiteralAst.cast(value.syntax);\n\t\tif (!array) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tfilename: sourceFile.filename,\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `List parameter expects an array literal, got ${raw}`,\n\t\t\t\trange: {\n\t\t\t\t\tstart: sourceFile.positionAt(value.syntax.offset),\n\t\t\t\t\tend: sourceFile.positionAt(value.syntax.offset + value.syntax.green.textLength)\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tkind: \"value\",\n\t\t\t\traw,\n\t\t\t\tspan\n\t\t\t};\n\t\t}\n\t\tconst items = [];\n\t\tfor (const element of array.elements()) items.push(reconstructFromExpression(element, param.of, nodePslSpan(element.syntax, sources), sources, diagnostics));\n\t\treturn {\n\t\t\tkind: \"list\",\n\t\t\titems,\n\t\t\tspan\n\t\t};\n\t}\n\tswitch (param?.kind) {\n\t\tcase \"ref\": return {\n\t\t\tkind: \"ref\",\n\t\t\tidentifier: raw,\n\t\t\tspan\n\t\t};\n\t\tcase \"option\": return {\n\t\t\tkind: \"option\",\n\t\t\ttoken: raw,\n\t\t\tspan\n\t\t};\n\t\tdefault: return {\n\t\t\tkind: \"value\",\n\t\t\traw,\n\t\t\tspan\n\t\t};\n\t}\n}\n//#endregion\n//#region src/symbol-table.ts\n/**\n* Owns duplicate-declaration detection for all PSL scopes; downstream consumers\n* should consume first-wins symbols rather than re-emitting duplicate diagnostics.\n*/\nfunction buildSymbolTable(options) {\n\tconst { documents, sources, pslBlockDescriptors } = options;\n\tconst diagnostics = [];\n\tconst namespaces = Object.create(null);\n\tconst namedTypes = {};\n\tconst blocks = {};\n\tconst models = {};\n\tconst compositeTypes = {};\n\tconst topLevelNames = /* @__PURE__ */ new Set();\n\tfor (const document of documents) {\n\t\tconst sourceFile = sources.sourceFileFor(document.syntax);\n\t\tconst claim = (taken, name) => {\n\t\t\tconst text = name?.name();\n\t\t\tif (text === void 0) return void 0;\n\t\t\tif (taken.has(text)) {\n\t\t\t\tconst range = nameRange(name, sources);\n\t\t\t\tif (range) diagnostics.push({\n\t\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\t\tmessage: `Duplicate declaration of \"${text}\"`,\n\t\t\t\t\tfilename: sourceFile.filename,\n\t\t\t\t\trange\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttaken.add(text);\n\t\t\treturn text;\n\t\t};\n\t\tfor (const declaration of document.declarations()) if (declaration instanceof ModelDeclarationAst) {\n\t\t\tconst name = claim(topLevelNames, declaration.name());\n\t\t\tif (name !== void 0) models[name] = buildModel(name, declaration, sources, diagnostics);\n\t\t} else if (declaration instanceof CompositeTypeDeclarationAst) {\n\t\t\tconst name = claim(topLevelNames, declaration.name());\n\t\t\tif (name !== void 0) compositeTypes[name] = buildCompositeType(name, declaration, sources, diagnostics);\n\t\t} else if (declaration instanceof GenericBlockDeclarationAst) {\n\t\t\tconst name = claim(topLevelNames, declaration.name());\n\t\t\tif (name !== void 0) blocks[name] = buildBlock(name, declaration, sources, pslBlockDescriptors, diagnostics);\n\t\t} else if (declaration instanceof NamespaceDeclarationAst) {\n\t\t\tconst declaredName = declaration.name()?.name();\n\t\t\tif (declaredName === void 0) continue;\n\t\t\tlet namespace = namespaces[declaredName];\n\t\t\tif (namespace === void 0) {\n\t\t\t\tconst name = claim(topLevelNames, declaration.name());\n\t\t\t\tif (name === void 0) continue;\n\t\t\t\tnamespace = {\n\t\t\t\t\tkind: \"namespace\",\n\t\t\t\t\tname,\n\t\t\t\t\tdeclarations: [],\n\t\t\t\t\tmodels: Object.create(null),\n\t\t\t\t\tcompositeTypes: Object.create(null),\n\t\t\t\t\tblocks: Object.create(null)\n\t\t\t\t};\n\t\t\t\tnamespaces[name] = namespace;\n\t\t\t}\n\t\t\textendNamespace(namespace, declaration, diagnostics, sources, pslBlockDescriptors);\n\t\t} else if (declaration instanceof TypesBlockAst) for (const binding of declaration.declarations()) {\n\t\t\tconst name = claim(topLevelNames, binding.name());\n\t\t\tif (name === void 0) continue;\n\t\t\tconst resolved = resolveNamedTypeBinding(binding, sources);\n\t\t\tnamedTypes[name] = {\n\t\t\t\tkind: \"namedType\",\n\t\t\t\tname,\n\t\t\t\tnode: binding,\n\t\t\t\tspan: nodePslSpan(binding.syntax, sources),\n\t\t\t\t...resolved\n\t\t\t};\n\t\t}\n\t}\n\treturn {\n\t\tsymbolTable: { topLevel: {\n\t\t\tnamespaces,\n\t\t\tnamedTypes,\n\t\t\tblocks,\n\t\t\tmodels,\n\t\t\tcompositeTypes\n\t\t} },\n\t\tdiagnostics\n\t};\n}\nfunction buildModel(name, node, sources, diagnostics) {\n\treturn {\n\t\tkind: \"model\",\n\t\tname,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sources),\n\t\tfields: buildFields(name, node.fields(), sources, diagnostics),\n\t\tattributes: readResolvedAttributes(node.attributes(), sources)\n\t};\n}\nfunction buildCompositeType(name, node, sources, diagnostics) {\n\treturn {\n\t\tkind: \"compositeType\",\n\t\tname,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sources),\n\t\tfields: buildFields(name, node.fields(), sources, diagnostics),\n\t\tattributes: readResolvedAttributes(node.attributes(), sources)\n\t};\n}\nfunction buildBlock(name, node, sources, pslBlockDescriptors, diagnostics) {\n\tconst keyword = node.keyword()?.text ?? \"\";\n\tconst descriptor = findBlockDescriptor(pslBlockDescriptors, keyword);\n\treturn {\n\t\tkind: \"block\",\n\t\tname,\n\t\tkeyword,\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sources),\n\t\tblock: reconstructExtensionBlock(node, descriptor, sources, diagnostics)\n\t};\n}\nfunction extendNamespace(namespace, node, diagnostics, sources, pslBlockDescriptors) {\n\tconst { models, compositeTypes, blocks } = namespace;\n\tnamespace.declarations.push({\n\t\tnode,\n\t\tspan: nodePslSpan(node.syntax, sources)\n\t});\n\tfor (const member of node.declarations()) {\n\t\tconst memberName = member.name()?.name();\n\t\tif (memberName === void 0) continue;\n\t\tif (Object.hasOwn(models, memberName) || Object.hasOwn(compositeTypes, memberName) || Object.hasOwn(blocks, memberName)) {\n\t\t\tconst range = nameRange(member.name(), sources);\n\t\t\tif (range) diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\tmessage: `Duplicate declaration of \"${memberName}\"`,\n\t\t\t\tfilename: sources.sourceFileFor(member.syntax).filename,\n\t\t\t\trange\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (member instanceof ModelDeclarationAst) models[memberName] = buildModel(memberName, member, sources, diagnostics);\n\t\telse if (member instanceof CompositeTypeDeclarationAst) compositeTypes[memberName] = buildCompositeType(memberName, member, sources, diagnostics);\n\t\telse if (member instanceof GenericBlockDeclarationAst) blocks[memberName] = buildBlock(memberName, member, sources, pslBlockDescriptors, diagnostics);\n\t}\n}\nfunction buildFields(ownerName, fields, sources, diagnostics) {\n\tconst result = {};\n\tfor (const field of fields) {\n\t\tconst nameNode = field.name();\n\t\tconst name = nameNode?.name();\n\t\tif (name === void 0) continue;\n\t\tif (Object.hasOwn(result, name)) {\n\t\t\tconst range = nameRange(nameNode, sources);\n\t\t\tif (range) diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_DECLARATION\",\n\t\t\t\tmessage: `Duplicate declaration of \"${name}\"`,\n\t\t\t\tfilename: sources.sourceFileFor(field.syntax).filename,\n\t\t\t\trange\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tresult[name] = buildField(ownerName, name, field, sources, diagnostics);\n\t}\n\treturn result;\n}\nfunction buildField(ownerName, name, node, sources, diagnostics) {\n\tconst attributes = readResolvedAttributes(node.attributes(), sources);\n\tconst span = nodePslSpan(node.syntax, sources);\n\tconst annotation = node.typeAnnotation();\n\tconst typeName = annotation?.name();\n\tif (typeName?.isOverQualified()) {\n\t\tconst path = typeName.path();\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_INVALID_QUALIFIED_TYPE\",\n\t\t\tmessage: `Field \"${ownerName}.${name}\" has an invalid qualified type \"${path.join(\".\")}\"; use at most one namespace qualifier (e.g. \"ns.TypeName\")`,\n\t\t\tfilename: sources.sourceFileFor(typeName.syntax).filename,\n\t\t\trange: nodeRange(typeName.syntax, sources)\n\t\t});\n\t\treturn {\n\t\t\tkind: \"field\",\n\t\t\tname,\n\t\t\tnode,\n\t\t\tspan,\n\t\t\ttypeName: path[path.length - 1] ?? \"\",\n\t\t\toptional: false,\n\t\t\tlist: false,\n\t\t\tmalformedType: true,\n\t\t\tattributes\n\t\t};\n\t}\n\tconst typeConstructor = annotation?.isConstructor() ? readResolvedConstructorCall(annotation, sources) : void 0;\n\tconst typeNamespaceId = typeName?.namespace()?.name();\n\tconst typeContractSpaceId = typeName?.space()?.name();\n\treturn {\n\t\tkind: \"field\",\n\t\tname,\n\t\tnode,\n\t\tspan,\n\t\ttypeName: typeName?.identifier()?.name() ?? \"\",\n\t\t...typeNamespaceId !== void 0 ? { typeNamespaceId } : {},\n\t\t...typeContractSpaceId !== void 0 ? { typeContractSpaceId } : {},\n\t\toptional: annotation?.isOptional() ?? false,\n\t\tlist: annotation?.isList() ?? false,\n\t\t...typeConstructor !== void 0 ? { typeConstructor } : {},\n\t\tattributes\n\t};\n}\nfunction resolveNamedTypeBinding(node, sources) {\n\tconst annotation = node.typeAnnotation();\n\tconst isConstructor = annotation?.isConstructor() ?? false;\n\tconst baseType = annotation?.name()?.identifier()?.name();\n\tconst typeConstructor = readResolvedConstructorCall(annotation, sources);\n\treturn {\n\t\tisConstructor,\n\t\t...!isConstructor && baseType !== void 0 ? { baseType } : {},\n\t\t...typeConstructor !== void 0 ? { typeConstructor } : {},\n\t\tattributes: readResolvedAttributes(node.attributes(), sources)\n\t};\n}\nfunction nameRange(name, sources) {\n\tif (name === void 0) return void 0;\n\tconst sourceFile = sources.sourceFileFor(name.syntax);\n\tfor (const token of name.syntax.tokens()) if (token.kind === \"Ident\") return {\n\t\tstart: sourceFile.positionAt(token.offset),\n\t\tend: sourceFile.positionAt(token.offset + token.text.length)\n\t};\n}\nfunction nodeRange(node, sources) {\n\tconst sourceFile = sources.sourceFileFor(node);\n\tconst start = node.offset;\n\tconst end = start + node.green.textLength;\n\treturn {\n\t\tstart: sourceFile.positionAt(start),\n\t\tend: sourceFile.positionAt(end)\n\t};\n}\n//#endregion\nexport { assembleAttributeSpecs, blockAttribute, bool, buildSymbolTable, createPslDiagnosticCollector, diagnosticFromSpan, diagnosticSource, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, json, keywordPslSpan, leafDiagnostic, list, mapPslDiagnostics, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, numLiteral, oneOf, optional, parseQuotedStringLiteral, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, referencedFieldRef, str, taggedLiteral, validateExtensionBlockFromSymbol };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,sBAAsB,WAAW,QAAQ,GAAG;CACpD,OAAO,UAAU,KAAK,QAAQ,QAAQ,IAAI,SAAS,YAAY,CAAC,CAAC,MAAM,EAAE;AAC1E;AACA,SAAS,yBAAyB,OAAO;CACxC,MAAM,QAAQ,MAAM,KAAK,CAAC,CAAC,MAAM,gBAAgB;CACjD,IAAI,CAAC,OAAO,OAAO,KAAK;CACxB,OAAO,MAAM,MAAM;AACpB;AAGA,UAAU,0BAA0B,WAAW;CAC9C,KAAK,MAAM,SAAS,OAAO,OAAO,SAAS,GAAG;EAC7C,IAAI,oCAAoC,KAAK,GAAG;GAC/C,MAAM;GACN;EACD;EACA,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,SAAS,uBAAuB,eAAe;CAC9C,MAAM,UAAU,OAAO,QAAQ,cAAc,eAAe,KAAK;CACjE,MAAM,UAAU,IAAI,IAAI,QAAQ,KAAK,CAAC,eAAe,SAAS,CAAC;CAC/D,KAAK,MAAM,cAAc,0BAA0B,cAAc,eAAe,GAAG;EAClF,IAAI,QAAQ,IAAI,WAAW,SAAS,GAAG,MAAM,IAAI,cAAc,8CAA8C,WAAW,UAAU,6GAA6G;EAC/O,QAAQ,IAAI,WAAW,SAAS;EAChC,QAAQ,KAAK,CAAC,WAAW,WAAW,WAAW,IAAI,CAAC;CACrD;CACA,OAAO,OAAO,OAAO,UAAU;EAC9B,OAAO,OAAO,OAAO,OAAO,YAAY,OAAO,CAAC;EAChD,OAAO,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/D,UAAU,YAAY,WAAW,KAAK;EACtC,MAAM,YAAY,OAAO,KAAK;EAC9B,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;EACvD;CACD;AACD;AACA,SAAS,wBAAwB,MAAM,SAAS;CAC/C,MAAM,aAAa,KAAK,eAAe;CACvC,MAAM,gBAAgB,YAAY,cAAc,KAAK;CACrD,MAAM,WAAW,YAAY,KAAK,CAAC,EAAE,WAAW,CAAC,EAAE,KAAK;CACxD,MAAM,kBAAkB,4BAA4B,YAAY,OAAO;CACvE,OAAO;EACN;EACA,GAAG,CAAC,iBAAiB,aAAa,KAAK,IAAI,EAAE,SAAS,IAAI,CAAC;EAC3D,GAAG,oBAAoB,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC;EACvD,YAAY,uBAAuB,KAAK,WAAW,GAAG,OAAO;CAC9D;AACD;AACA,SAAS,UAAU,MAAM,SAAS;CACjC,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK;CACjC,MAAM,aAAa,QAAQ,cAAc,KAAK,MAAM;CACpD,KAAK,MAAM,SAAS,KAAK,OAAO,OAAO,GAAG,IAAI,MAAM,SAAS,SAAS,OAAO;EAC5E,OAAO,WAAW,WAAW,MAAM,MAAM;EACzC,KAAK,WAAW,WAAW,MAAM,SAAS,MAAM,KAAK,MAAM;CAC5D;AACD;AACA,SAAS,UAAU,MAAM,SAAS;CACjC,MAAM,aAAa,QAAQ,cAAc,IAAI;CAC7C,MAAM,QAAQ,KAAK;CACnB,MAAM,MAAM,QAAQ,KAAK,MAAM;CAC/B,OAAO;EACN,OAAO,WAAW,WAAW,KAAK;EAClC,KAAK,WAAW,WAAW,GAAG;CAC/B;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as structuredError } from "./structured-error-BXbihKQ-.mjs";
|
|
2
2
|
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
3
|
-
import { D as TypesBlockAst, S as SyntaxNode, a as CompositeTypeDeclarationAst, c as FieldDeclarationAst, f as KeyValuePairAst, g as NamespaceDeclarationAst, h as NamedTypeDeclarationAst, m as ModelDeclarationAst, p as ModelAttributeAst, u as GenericBlockDeclarationAst } from "./declarations-
|
|
4
|
-
import {
|
|
3
|
+
import { D as TypesBlockAst, S as SyntaxNode, a as CompositeTypeDeclarationAst, c as FieldDeclarationAst, f as KeyValuePairAst, g as NamespaceDeclarationAst, h as NamedTypeDeclarationAst, m as ModelDeclarationAst, p as ModelAttributeAst, u as GenericBlockDeclarationAst } from "./declarations-SwNXosDu-D39d5EQ-.mjs";
|
|
4
|
+
import { o as parse } from "./parse-Cu6B62PC-BAPPRuso.mjs";
|
|
5
5
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/format.mjs
|
|
6
6
|
function emitDocument(document, indentUnit, newline) {
|
|
7
7
|
const writer = new LineWriter(indentUnit, newline);
|
|
@@ -132,22 +132,22 @@ function streamNode(writer, node, padTo) {
|
|
|
132
132
|
function closeContinuation(writer, count) {
|
|
133
133
|
for (let i = 0; i < count; i++) writer.unindent();
|
|
134
134
|
}
|
|
135
|
-
function emitField(writer, field,
|
|
136
|
-
return streamRow(writer, field.syntax,
|
|
135
|
+
function emitField(writer, field, alignmentColumns) {
|
|
136
|
+
return streamRow(writer, field.syntax, alignmentColumns);
|
|
137
137
|
}
|
|
138
138
|
function emitNamedType(writer, decl) {
|
|
139
139
|
return streamRow(writer, decl.syntax, void 0);
|
|
140
140
|
}
|
|
141
|
-
function streamRow(writer, row,
|
|
141
|
+
function streamRow(writer, row, alignmentColumns) {
|
|
142
142
|
let continuation = 0;
|
|
143
143
|
let sawAttribute = false;
|
|
144
144
|
for (const child of row.children()) {
|
|
145
145
|
if (child instanceof SyntaxNode) {
|
|
146
146
|
let padTo;
|
|
147
|
-
if (child.kind === "TypeAnnotation" && continuation === 0) padTo =
|
|
147
|
+
if (child.kind === "TypeAnnotation" && continuation === 0) padTo = alignmentColumns?.typeColumn;
|
|
148
148
|
else if (child.kind === "FieldAttribute") {
|
|
149
149
|
if (continuation > 0) writer.newline();
|
|
150
|
-
else if (!sawAttribute) padTo =
|
|
150
|
+
else if (!sawAttribute) padTo = alignmentColumns?.attributeColumn;
|
|
151
151
|
sawAttribute = true;
|
|
152
152
|
}
|
|
153
153
|
continuation += streamNode(writer, child, padTo);
|
|
@@ -184,19 +184,19 @@ function leafMember(writer, category, print, keepsSourceLine = false) {
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
function emitModel(writer, model, trailing) {
|
|
187
|
-
const
|
|
187
|
+
const alignmentColumns = alignmentMap(model.syntax);
|
|
188
188
|
emitBlockBody(writer, model.syntax, trailing, (node) => {
|
|
189
189
|
const field = FieldDeclarationAst.cast(node);
|
|
190
|
-
if (field) return leafMember(writer, "regular", () => emitField(writer, field,
|
|
190
|
+
if (field) return leafMember(writer, "regular", () => emitField(writer, field, alignmentColumns));
|
|
191
191
|
const attribute = ModelAttributeAst.cast(node);
|
|
192
192
|
if (attribute) return leafMember(writer, "blockAttribute", () => emitBlockAttribute(writer, attribute));
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
function emitCompositeType(writer, composite, trailing) {
|
|
196
|
-
const
|
|
196
|
+
const alignmentColumns = alignmentMap(composite.syntax);
|
|
197
197
|
emitBlockBody(writer, composite.syntax, trailing, (node) => {
|
|
198
198
|
const field = FieldDeclarationAst.cast(node);
|
|
199
|
-
if (field) return leafMember(writer, "regular", () => emitField(writer, field,
|
|
199
|
+
if (field) return leafMember(writer, "regular", () => emitField(writer, field, alignmentColumns));
|
|
200
200
|
const attribute = ModelAttributeAst.cast(node);
|
|
201
201
|
if (attribute) return leafMember(writer, "blockAttribute", () => emitBlockAttribute(writer, attribute));
|
|
202
202
|
});
|
|
@@ -477,7 +477,7 @@ function resolveFormatOptions(options) {
|
|
|
477
477
|
}
|
|
478
478
|
function format(source, options) {
|
|
479
479
|
const resolved = resolveFormatOptions(options);
|
|
480
|
-
const { document, diagnostics } = parse(source);
|
|
480
|
+
const { document, diagnostics } = parse(source, "<format-input>.psl");
|
|
481
481
|
if (diagnostics.length > 0) throw pslError("PSL.PARSE_FAILED", `Cannot format PSL with parse errors: ${diagnostics[0]?.message ?? "unknown parse error"}${diagnostics.length > 1 ? ` (and ${diagnostics.length - 1} more)` : ""}`, { meta: { diagnostics } });
|
|
482
482
|
return emitDocument(document, resolved.indentUnit, resolved.newline);
|
|
483
483
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser__format.mjs","names":["#indentUnit","#newline","#depth","#lastWasBlank","#lineOpen","#prevKind","#out","#line","#hasContent"],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/format.mjs"],"sourcesContent":["import { a as KeyValuePairAst, c as NamespaceDeclarationAst, i as GenericBlockDeclarationAst, j as SyntaxNode, l as TypesBlockAst, o as ModelDeclarationAst, p as ModelAttributeAst, r as FieldDeclarationAst, s as NamedTypeDeclarationAst, t as CompositeTypeDeclarationAst } from \"./declarations-DU8tJk4J.mjs\";\nimport { t as parse } from \"./parse-B4QY6R0c.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/format/emit.ts\nfunction emitDocument(document, indentUnit, newline) {\n\tconst writer = new LineWriter(indentUnit, newline);\n\temitTopLevel(writer, document);\n\treturn writer.finish();\n}\nvar LineWriter = class {\n\t#indentUnit;\n\t#newline;\n\t#out = [];\n\t#depth = 0;\n\t#line = \"\";\n\t#lineOpen = false;\n\t#prevKind;\n\t#lastWasBlank = false;\n\t#hasContent = false;\n\tconstructor(indentUnit, newline) {\n\t\tthis.#indentUnit = indentUnit;\n\t\tthis.#newline = newline;\n\t}\n\tindent() {\n\t\tthis.#depth += 1;\n\t}\n\tunindent() {\n\t\tthis.#depth = Math.max(0, this.#depth - 1);\n\t}\n\tlastIsBlank() {\n\t\treturn this.#lastWasBlank;\n\t}\n\tlineOpen() {\n\t\treturn this.#lineOpen;\n\t}\n\tprevKind() {\n\t\treturn this.#prevKind;\n\t}\n\tnewline() {\n\t\tif (!this.#lineOpen) return;\n\t\tthis.#out.push(`${this.#indentUnit.repeat(this.#depth)}${this.#line}`);\n\t\tthis.#line = \"\";\n\t\tthis.#lineOpen = false;\n\t\tthis.#prevKind = void 0;\n\t\tthis.#lastWasBlank = false;\n\t\tthis.#hasContent = true;\n\t}\n\tblank() {\n\t\tthis.newline();\n\t\tif (!this.#hasContent || this.#lastWasBlank) return;\n\t\tthis.#out.push(\"\");\n\t\tthis.#lastWasBlank = true;\n\t}\n\twrite(token, space, padTo) {\n\t\tif (this.#lineOpen && padTo !== void 0) this.#line = this.#line.padEnd(padTo);\n\t\telse if (this.#lineOpen && space) this.#line += \" \";\n\t\tthis.#line += token.text;\n\t\tthis.#lineOpen = true;\n\t\tthis.#prevKind = token.kind;\n\t}\n\twriteRaw(text) {\n\t\tthis.#line += text;\n\t\tthis.#lineOpen = true;\n\t}\n\tcomment(text) {\n\t\tif (this.#lineOpen) this.#line += ` ${text}`;\n\t\telse this.#line = text;\n\t\tthis.#lineOpen = true;\n\t\tthis.newline();\n\t}\n\tfinish() {\n\t\tthis.newline();\n\t\tconst body = this.#out.join(this.#newline);\n\t\treturn body.length > 0 ? `${body}${this.#newline}` : \"\";\n\t}\n};\nfunction spaceBetween(prev, cur, inQualifiedName) {\n\tif (prev === void 0) return false;\n\tif (inQualifiedName) return false;\n\tif (prev === \"Ident\" && cur === \"StringLiteral\") return false;\n\tswitch (cur) {\n\t\tcase \"LParen\":\n\t\tcase \"LBracket\":\n\t\tcase \"RParen\":\n\t\tcase \"RBracket\":\n\t\tcase \"Comma\":\n\t\tcase \"Question\":\n\t\tcase \"Dot\":\n\t\tcase \"Colon\": return false;\n\t\tcase \"RBrace\": return prev !== \"LBrace\";\n\t\tdefault: break;\n\t}\n\tswitch (prev) {\n\t\tcase \"LParen\":\n\t\tcase \"LBracket\":\n\t\tcase \"Dot\":\n\t\tcase \"At\":\n\t\tcase \"DoubleAt\": return false;\n\t\tdefault: return true;\n\t}\n}\nfunction streamNode(writer, node, padTo) {\n\tlet continuation = 0;\n\tlet first = true;\n\tlet prevQualified = false;\n\tconst walk = (parent, qualified) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child, qualified || child.kind === \"QualifiedName\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") continue;\n\t\t\tif (child.kind === \"Comment\") {\n\t\t\t\twriter.comment(child.text);\n\t\t\t\twriter.indent();\n\t\t\t\tcontinuation += 1;\n\t\t\t\tprevQualified = false;\n\t\t\t\tfirst = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pad = first ? padTo : void 0;\n\t\t\tconst space = spaceBetween(writer.prevKind(), child.kind, qualified && prevQualified);\n\t\t\twriter.write(child, space, writer.lineOpen() ? pad : void 0);\n\t\t\tprevQualified = qualified;\n\t\t\tfirst = false;\n\t\t}\n\t};\n\twalk(node, false);\n\treturn continuation;\n}\nfunction closeContinuation(writer, count) {\n\tfor (let i = 0; i < count; i++) writer.unindent();\n}\nfunction emitField(writer, field, columns) {\n\treturn streamRow(writer, field.syntax, columns);\n}\nfunction emitNamedType(writer, decl) {\n\treturn streamRow(writer, decl.syntax, void 0);\n}\nfunction streamRow(writer, row, columns) {\n\tlet continuation = 0;\n\tlet sawAttribute = false;\n\tfor (const child of row.children()) {\n\t\tif (child instanceof SyntaxNode) {\n\t\t\tlet padTo;\n\t\t\tif (child.kind === \"TypeAnnotation\" && continuation === 0) padTo = columns?.typeColumn;\n\t\t\telse if (child.kind === \"FieldAttribute\") {\n\t\t\t\tif (continuation > 0) writer.newline();\n\t\t\t\telse if (!sawAttribute) padTo = columns?.attributeColumn;\n\t\t\t\tsawAttribute = true;\n\t\t\t}\n\t\t\tcontinuation += streamNode(writer, child, padTo);\n\t\t\tcontinue;\n\t\t}\n\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") continue;\n\t\tif (child.kind === \"Comment\") {\n\t\t\twriter.comment(child.text);\n\t\t\twriter.indent();\n\t\t\tcontinuation += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst space = spaceBetween(writer.prevKind(), child.kind, false);\n\t\twriter.write(child, space);\n\t}\n\treturn continuation;\n}\nfunction emitBlockAttribute(writer, attribute) {\n\treturn streamNode(writer, attribute.syntax);\n}\nfunction emitKeyValue(writer, pair) {\n\treturn streamNode(writer, pair.syntax);\n}\nfunction leafMember(writer, category, print, keepsSourceLine = false) {\n\treturn {\n\t\tcategory,\n\t\tkeepsSourceLine,\n\t\temit(trailing, endLine) {\n\t\t\tconst continuation = print();\n\t\t\tif (trailing !== void 0) writer.comment(trailing);\n\t\t\telse if (endLine) writer.newline();\n\t\t\treturn continuation;\n\t\t}\n\t};\n}\nfunction emitModel(writer, model, trailing) {\n\tconst columns = alignmentMap(model.syntax);\n\temitBlockBody(writer, model.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, columns));\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\nfunction emitCompositeType(writer, composite, trailing) {\n\tconst columns = alignmentMap(composite.syntax);\n\temitBlockBody(writer, composite.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, columns));\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\n/**\n* With the `prisma7` grammar a `view` body holds `FieldDeclaration` members, so they print through\n* the model field path. With the `psl` grammar the same source line reads as several entries with\n* no `=`; those entries keep the source line they share, so `id Int` does not become two lines.\n*/\nfunction emitGenericBlock(writer, block, trailing) {\n\tconst alignment = alignmentMap(block.syntax);\n\temitBlockBody(writer, block.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, alignment));\n\t\tconst entry = KeyValuePairAst.cast(node);\n\t\tif (entry) return leafMember(writer, \"regular\", () => emitKeyValue(writer, entry), entry.equals() === void 0);\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\nfunction emitNamespace(writer, namespace, trailing) {\n\temitBlockBody(writer, namespace.syntax, trailing, (node) => {\n\t\tconst declaration = castBlockDeclaration(node);\n\t\tif (declaration) return nestedBlockMember(writer, declaration);\n\t});\n}\nfunction emitTypesBlock(writer, block, trailing) {\n\temitBlockBody(writer, block.syntax, trailing, (node) => {\n\t\tconst named = NamedTypeDeclarationAst.cast(node);\n\t\tif (named) return leafMember(writer, \"regular\", () => emitNamedType(writer, named));\n\t});\n}\nfunction emitTopLevel(writer, document) {\n\twalkRegion(writer, Array.from(document.syntax.children()), void 0, (node) => {\n\t\tconst declaration = castTopLevelDeclaration(node);\n\t\tif (declaration) return nestedBlockMember(writer, declaration);\n\t});\n}\nfunction nestedBlockMember(writer, block) {\n\treturn {\n\t\tcategory: \"nestedBlock\",\n\t\tkeepsSourceLine: false,\n\t\temit(trailing) {\n\t\t\tblock(writer, trailing);\n\t\t\treturn 0;\n\t\t}\n\t};\n}\nfunction castBlockDeclaration(node) {\n\tconst model = ModelDeclarationAst.cast(node);\n\tif (model) return (writer, trailing) => emitModel(writer, model, trailing);\n\tconst composite = CompositeTypeDeclarationAst.cast(node);\n\tif (composite) return (writer, trailing) => emitCompositeType(writer, composite, trailing);\n\tconst generic = GenericBlockDeclarationAst.cast(node);\n\tif (generic) return (writer, trailing) => emitGenericBlock(writer, generic, trailing);\n}\nfunction castTopLevelDeclaration(node) {\n\tconst block = castBlockDeclaration(node);\n\tif (block) return block;\n\tconst namespace = NamespaceDeclarationAst.cast(node);\n\tif (namespace) return (writer, trailing) => emitNamespace(writer, namespace, trailing);\n\tconst types = TypesBlockAst.cast(node);\n\tif (types) return (writer, trailing) => emitTypesBlock(writer, types, trailing);\n}\nfunction emitBlockBody(writer, node, closingTrailing, classify) {\n\tconst children = Array.from(node.children());\n\tconst openIndex = children.findIndex((el) => !(el instanceof SyntaxNode) && el.kind === \"LBrace\");\n\tstreamHeader(writer, node);\n\tconst headerComment = sameLineCommentAfter(children, openIndex);\n\tif (headerComment !== void 0) writer.comment(headerComment);\n\telse writer.newline();\n\twriter.indent();\n\twalkRegion(writer, children, \"RBrace\", classify);\n\twriter.unindent();\n\twriter.writeRaw(\"}\");\n\tif (closingTrailing !== void 0) writer.comment(closingTrailing);\n\telse writer.newline();\n}\nfunction streamHeader(writer, node) {\n\tlet done = false;\n\tconst walk = (parent) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (done) return;\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\" || child.kind === \"Comment\") continue;\n\t\t\tconst space = spaceBetween(writer.prevKind(), child.kind, false);\n\t\t\twriter.write(child, space);\n\t\t\tif (child.kind === \"LBrace\") {\n\t\t\t\tdone = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\twalk(node);\n}\nfunction walkRegion(writer, elements, closeKind, classify) {\n\tlet sawOpenBrace = closeKind === void 0;\n\tlet sawContent = false;\n\tlet lastWasRegular = false;\n\tlet ledByComment = false;\n\tlet newlines = 0;\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) {\n\t\t\tif (!sawOpenBrace) continue;\n\t\t\tconst member = classify(element);\n\t\t\tif (member === void 0) throw new InternalError(`Formatter has no rule for a ${element.kind} node at offset ${element.offset}; formatting would drop its text`);\n\t\t\tif (!ledByComment) {\n\t\t\t\tif (newlines >= 2 && sawContent && !writer.lastIsBlank()) writer.blank();\n\t\t\t\telse if (separationBlankWanted(writer, member.category, sawContent, lastWasRegular)) writer.blank();\n\t\t\t}\n\t\t\tconst trailing = sameLineTrailingComment(elements, i);\n\t\t\tconst endLine = !member.keepsSourceLine || !memberFollowsOnSameLine(elements, i);\n\t\t\tcloseContinuation(writer, member.emit(trailing.text, endLine));\n\t\t\tif (trailing.index !== void 0) i = trailing.index;\n\t\t\tsawContent = true;\n\t\t\tlastWasRegular = member.category !== \"blockAttribute\";\n\t\t\tledByComment = false;\n\t\t\tnewlines = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (element.kind === \"LBrace\" && closeKind === \"RBrace\" && !sawOpenBrace) {\n\t\t\tsawOpenBrace = true;\n\t\t\tnewlines = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!sawOpenBrace) continue;\n\t\tif (closeKind === \"RBrace\" && element.kind === \"RBrace\") break;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\tif (element.kind === \"Newline\") {\n\t\t\tnewlines += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (element.kind === \"Comment\") {\n\t\t\tif (closeKind === \"RBrace\" && newlines === 0 && !sawContent) continue;\n\t\t\tif (newlines >= 2 && sawContent && !writer.lastIsBlank()) writer.blank();\n\t\t\telse if (!ledByComment) {\n\t\t\t\tconst led = leadingMemberAfter(elements, i, classify);\n\t\t\t\tif (led && separationBlankWanted(writer, led, sawContent, lastWasRegular)) writer.blank();\n\t\t\t}\n\t\t\twriter.writeRaw(element.text);\n\t\t\twriter.newline();\n\t\t\tsawContent = true;\n\t\t\tledByComment = true;\n\t\t\tnewlines = 0;\n\t\t}\n\t}\n}\nfunction memberFollowsOnSameLine(elements, memberIndex) {\n\tfor (let i = memberIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) return true;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\treturn false;\n\t}\n\treturn false;\n}\nfunction separationBlankWanted(writer, category, sawContent, lastWasRegular) {\n\tif (!sawContent || writer.lastIsBlank()) return false;\n\tif (category === \"nestedBlock\") return true;\n\treturn category === \"blockAttribute\" && lastWasRegular;\n}\nfunction leadingMemberAfter(elements, commentIndex, classify) {\n\tfor (let i = commentIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) return classify(element)?.category;\n\t\tif (element.kind === \"RBrace\") return void 0;\n\t}\n}\nfunction sameLineTrailingComment(elements, memberIndex) {\n\tfor (let i = memberIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) break;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\tif (element.kind === \"Comment\") return {\n\t\t\ttext: element.text,\n\t\t\tindex: i\n\t\t};\n\t\tbreak;\n\t}\n\treturn {\n\t\ttext: void 0,\n\t\tindex: void 0\n\t};\n}\nfunction sameLineCommentAfter(children, openIndex) {\n\tfor (let i = openIndex + 1; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (child === void 0) continue;\n\t\tif (child instanceof SyntaxNode) return void 0;\n\t\tif (child.kind === \"Whitespace\") continue;\n\t\tif (child.kind === \"Comment\") return child.text;\n\t\treturn;\n\t}\n}\nfunction alignmentMap(block) {\n\tconst fields = [];\n\tfor (const element of block.children()) {\n\t\tif (!(element instanceof SyntaxNode)) continue;\n\t\tif (FieldDeclarationAst.cast(element) === void 0) continue;\n\t\tif (hasInteriorComment(element)) continue;\n\t\tfields.push(element);\n\t}\n\tif (fields.length === 0) return void 0;\n\treturn alignmentColumns(fields);\n}\nfunction alignmentColumns(rows) {\n\tlet nameWidth = 0;\n\tfor (const row of rows) {\n\t\tconst field = FieldDeclarationAst.cast(row);\n\t\tif (!field) continue;\n\t\tnameWidth = Math.max(nameWidth, renderTokens(field.name()?.syntax).length);\n\t}\n\tconst typeColumn = nameWidth + 1;\n\tlet cellEnd = 0;\n\tfor (const row of rows) {\n\t\tconst field = FieldDeclarationAst.cast(row);\n\t\tif (!field) continue;\n\t\tconst name = renderTokens(field.name()?.syntax);\n\t\tconst type = renderTokens(field.typeAnnotation()?.syntax);\n\t\tcellEnd = Math.max(cellEnd, type.length > 0 ? typeColumn + type.length : name.length);\n\t}\n\treturn {\n\t\ttypeColumn,\n\t\tattributeColumn: cellEnd + 1\n\t};\n}\nfunction hasInteriorComment(node) {\n\tfor (const token of node.tokens()) if (token.kind === \"Comment\") return true;\n\treturn false;\n}\nfunction renderTokens(node) {\n\tif (!node) return \"\";\n\tlet out = \"\";\n\tlet prev;\n\tlet prevQualified = false;\n\tconst walk = (parent, qualified) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child, qualified || child.kind === \"QualifiedName\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\" || child.kind === \"Comment\") continue;\n\t\t\tif (spaceBetween(prev, child.kind, qualified && prevQualified)) out += \" \";\n\t\t\tout += child.text;\n\t\t\tprev = child.kind;\n\t\t\tprevQualified = qualified;\n\t\t}\n\t};\n\twalk(node, false);\n\treturn out;\n}\n//#endregion\n//#region src/format/error.ts\nfunction pslError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/format/options.ts\nfunction resolveFormatOptions(options) {\n\tconst indent = options?.indent ?? 2;\n\tif (indent !== \"tab\" && (typeof indent !== \"number\" || !Number.isInteger(indent) || indent < 1)) throw pslError(\"PSL.FORMAT_OPTION_INVALID\", `Invalid format options: indent must be a positive integer or 'tab', got ${String(indent)}`, { meta: {\n\t\toption: \"indent\",\n\t\treceived: String(indent)\n\t} });\n\tconst newline = options?.newline ?? \"LF\";\n\tif (newline !== \"LF\" && newline !== \"CRLF\") throw pslError(\"PSL.FORMAT_OPTION_INVALID\", `Invalid format options: newline must be 'LF' or 'CRLF', got ${String(newline)}`, { meta: {\n\t\toption: \"newline\",\n\t\treceived: String(newline)\n\t} });\n\treturn {\n\t\tindentUnit: indent === \"tab\" ? \"\t\" : \" \".repeat(indent),\n\t\tnewline: newline === \"CRLF\" ? \"\\r\\n\" : \"\\n\"\n\t};\n}\n//#endregion\n//#region src/format/format.ts\nfunction format(source, options) {\n\tconst resolved = resolveFormatOptions(options);\n\tconst { document, diagnostics } = parse(source);\n\tif (diagnostics.length > 0) throw pslError(\"PSL.PARSE_FAILED\", `Cannot format PSL with parse errors: ${diagnostics[0]?.message ?? \"unknown parse error\"}${diagnostics.length > 1 ? ` (and ${diagnostics.length - 1} more)` : \"\"}`, { meta: { diagnostics } });\n\treturn emitDocument(document, resolved.indentUnit, resolved.newline);\n}\n//#endregion\nexport { format };\n\n//# sourceMappingURL=format.mjs.map"],"mappings":";;;;;AAKA,SAAS,aAAa,UAAU,YAAY,SAAS;CACpD,MAAM,SAAS,IAAI,WAAW,YAAY,OAAO;CACjD,aAAa,QAAQ,QAAQ;CAC7B,OAAO,OAAO,OAAO;AACtB;AACA,IAAI,aAAa,MAAM;CACtB;CACA;CACA,OAAO,CAAC;CACR,SAAS;CACT,QAAQ;CACR,YAAY;CACZ;CACA,gBAAgB;CAChB,cAAc;CACd,YAAY,YAAY,SAAS;EAChC,KAAKA,cAAc;EACnB,KAAKC,WAAW;CACjB;CACA,SAAS;EACR,KAAKC,UAAU;CAChB;CACA,WAAW;EACV,KAAKA,SAAS,KAAK,IAAI,GAAG,KAAKA,SAAS,CAAC;CAC1C;CACA,cAAc;EACb,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKC;CACb;CACA,UAAU;EACT,IAAI,CAAC,KAAKD,WAAW;EACrB,KAAKE,KAAK,KAAK,GAAG,KAAKN,YAAY,OAAO,KAAKE,MAAM,IAAI,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,OAAO;AACR;AAGA,SAAS,SAAS,MAAM,SAAS,SAAS;CACzC,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qBAAqB,SAAS;CACtC,MAAM,SAAS,SAAS,UAAU;CAClC,IAAI,WAAW,UAAU,OAAO,WAAW,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,IAAI,MAAM,SAAS,6BAA6B,2EAA2E,OAAO,MAAM,KAAK,EAAE,MAAM;EACjP,QAAQ;EACR,UAAU,OAAO,MAAM;CACxB,EAAE,CAAC;CACH,MAAM,UAAU,SAAS,WAAW;CACpC,IAAI,YAAY,QAAQ,YAAY,QAAQ,MAAM,SAAS,6BAA6B,+DAA+D,OAAO,OAAO,KAAK,EAAE,MAAM;EACjL,QAAQ;EACR,UAAU,OAAO,OAAO;CACzB,EAAE,CAAC;CACH,OAAO;EACN,YAAY,WAAW,QAAQ,MAAM,IAAI,OAAO,MAAM;EACtD,SAAS,YAAY,SAAS,SAAS;CACxC;AACD;AAGA,SAAS,OAAO,QAAQ,SAAS;CAChC,MAAM,WAAW,qBAAqB,OAAO;CAC7C,MAAM,EAAE,UAAU,gBAAgB,MAAM,MAAM;CAC9C,IAAI,YAAY,SAAS,GAAG,MAAM,SAAS,oBAAoB,wCAAwC,YAAY,EAAE,EAAE,WAAW,wBAAwB,YAAY,SAAS,IAAI,SAAS,YAAY,SAAS,EAAE,UAAU,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;CAC5P,OAAO,aAAa,UAAU,SAAS,YAAY,SAAS,OAAO;AACpE"}
|
|
1
|
+
{"version":3,"file":"psl-parser__format.mjs","names":["#indentUnit","#newline","#depth","#lastWasBlank","#lineOpen","#prevKind","#out","#line","#hasContent"],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/format.mjs"],"sourcesContent":["import { a as KeyValuePairAst, c as NamespaceDeclarationAst, i as GenericBlockDeclarationAst, j as SyntaxNode, l as TypesBlockAst, o as ModelDeclarationAst, p as ModelAttributeAst, r as FieldDeclarationAst, s as NamedTypeDeclarationAst, t as CompositeTypeDeclarationAst } from \"./declarations-SwNXosDu.mjs\";\nimport { t as parse } from \"./parse-Cu6B62PC.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/format/emit.ts\nfunction emitDocument(document, indentUnit, newline) {\n\tconst writer = new LineWriter(indentUnit, newline);\n\temitTopLevel(writer, document);\n\treturn writer.finish();\n}\nvar LineWriter = class {\n\t#indentUnit;\n\t#newline;\n\t#out = [];\n\t#depth = 0;\n\t#line = \"\";\n\t#lineOpen = false;\n\t#prevKind;\n\t#lastWasBlank = false;\n\t#hasContent = false;\n\tconstructor(indentUnit, newline) {\n\t\tthis.#indentUnit = indentUnit;\n\t\tthis.#newline = newline;\n\t}\n\tindent() {\n\t\tthis.#depth += 1;\n\t}\n\tunindent() {\n\t\tthis.#depth = Math.max(0, this.#depth - 1);\n\t}\n\tlastIsBlank() {\n\t\treturn this.#lastWasBlank;\n\t}\n\tlineOpen() {\n\t\treturn this.#lineOpen;\n\t}\n\tprevKind() {\n\t\treturn this.#prevKind;\n\t}\n\tnewline() {\n\t\tif (!this.#lineOpen) return;\n\t\tthis.#out.push(`${this.#indentUnit.repeat(this.#depth)}${this.#line}`);\n\t\tthis.#line = \"\";\n\t\tthis.#lineOpen = false;\n\t\tthis.#prevKind = void 0;\n\t\tthis.#lastWasBlank = false;\n\t\tthis.#hasContent = true;\n\t}\n\tblank() {\n\t\tthis.newline();\n\t\tif (!this.#hasContent || this.#lastWasBlank) return;\n\t\tthis.#out.push(\"\");\n\t\tthis.#lastWasBlank = true;\n\t}\n\twrite(token, space, padTo) {\n\t\tif (this.#lineOpen && padTo !== void 0) this.#line = this.#line.padEnd(padTo);\n\t\telse if (this.#lineOpen && space) this.#line += \" \";\n\t\tthis.#line += token.text;\n\t\tthis.#lineOpen = true;\n\t\tthis.#prevKind = token.kind;\n\t}\n\twriteRaw(text) {\n\t\tthis.#line += text;\n\t\tthis.#lineOpen = true;\n\t}\n\tcomment(text) {\n\t\tif (this.#lineOpen) this.#line += ` ${text}`;\n\t\telse this.#line = text;\n\t\tthis.#lineOpen = true;\n\t\tthis.newline();\n\t}\n\tfinish() {\n\t\tthis.newline();\n\t\tconst body = this.#out.join(this.#newline);\n\t\treturn body.length > 0 ? `${body}${this.#newline}` : \"\";\n\t}\n};\nfunction spaceBetween(prev, cur, inQualifiedName) {\n\tif (prev === void 0) return false;\n\tif (inQualifiedName) return false;\n\tif (prev === \"Ident\" && cur === \"StringLiteral\") return false;\n\tswitch (cur) {\n\t\tcase \"LParen\":\n\t\tcase \"LBracket\":\n\t\tcase \"RParen\":\n\t\tcase \"RBracket\":\n\t\tcase \"Comma\":\n\t\tcase \"Question\":\n\t\tcase \"Dot\":\n\t\tcase \"Colon\": return false;\n\t\tcase \"RBrace\": return prev !== \"LBrace\";\n\t\tdefault: break;\n\t}\n\tswitch (prev) {\n\t\tcase \"LParen\":\n\t\tcase \"LBracket\":\n\t\tcase \"Dot\":\n\t\tcase \"At\":\n\t\tcase \"DoubleAt\": return false;\n\t\tdefault: return true;\n\t}\n}\nfunction streamNode(writer, node, padTo) {\n\tlet continuation = 0;\n\tlet first = true;\n\tlet prevQualified = false;\n\tconst walk = (parent, qualified) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child, qualified || child.kind === \"QualifiedName\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") continue;\n\t\t\tif (child.kind === \"Comment\") {\n\t\t\t\twriter.comment(child.text);\n\t\t\t\twriter.indent();\n\t\t\t\tcontinuation += 1;\n\t\t\t\tprevQualified = false;\n\t\t\t\tfirst = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst pad = first ? padTo : void 0;\n\t\t\tconst space = spaceBetween(writer.prevKind(), child.kind, qualified && prevQualified);\n\t\t\twriter.write(child, space, writer.lineOpen() ? pad : void 0);\n\t\t\tprevQualified = qualified;\n\t\t\tfirst = false;\n\t\t}\n\t};\n\twalk(node, false);\n\treturn continuation;\n}\nfunction closeContinuation(writer, count) {\n\tfor (let i = 0; i < count; i++) writer.unindent();\n}\nfunction emitField(writer, field, alignmentColumns) {\n\treturn streamRow(writer, field.syntax, alignmentColumns);\n}\nfunction emitNamedType(writer, decl) {\n\treturn streamRow(writer, decl.syntax, void 0);\n}\nfunction streamRow(writer, row, alignmentColumns) {\n\tlet continuation = 0;\n\tlet sawAttribute = false;\n\tfor (const child of row.children()) {\n\t\tif (child instanceof SyntaxNode) {\n\t\t\tlet padTo;\n\t\t\tif (child.kind === \"TypeAnnotation\" && continuation === 0) padTo = alignmentColumns?.typeColumn;\n\t\t\telse if (child.kind === \"FieldAttribute\") {\n\t\t\t\tif (continuation > 0) writer.newline();\n\t\t\t\telse if (!sawAttribute) padTo = alignmentColumns?.attributeColumn;\n\t\t\t\tsawAttribute = true;\n\t\t\t}\n\t\t\tcontinuation += streamNode(writer, child, padTo);\n\t\t\tcontinue;\n\t\t}\n\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") continue;\n\t\tif (child.kind === \"Comment\") {\n\t\t\twriter.comment(child.text);\n\t\t\twriter.indent();\n\t\t\tcontinuation += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tconst space = spaceBetween(writer.prevKind(), child.kind, false);\n\t\twriter.write(child, space);\n\t}\n\treturn continuation;\n}\nfunction emitBlockAttribute(writer, attribute) {\n\treturn streamNode(writer, attribute.syntax);\n}\nfunction emitKeyValue(writer, pair) {\n\treturn streamNode(writer, pair.syntax);\n}\nfunction leafMember(writer, category, print, keepsSourceLine = false) {\n\treturn {\n\t\tcategory,\n\t\tkeepsSourceLine,\n\t\temit(trailing, endLine) {\n\t\t\tconst continuation = print();\n\t\t\tif (trailing !== void 0) writer.comment(trailing);\n\t\t\telse if (endLine) writer.newline();\n\t\t\treturn continuation;\n\t\t}\n\t};\n}\nfunction emitModel(writer, model, trailing) {\n\tconst alignmentColumns = alignmentMap(model.syntax);\n\temitBlockBody(writer, model.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, alignmentColumns));\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\nfunction emitCompositeType(writer, composite, trailing) {\n\tconst alignmentColumns = alignmentMap(composite.syntax);\n\temitBlockBody(writer, composite.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, alignmentColumns));\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\n/**\n* With the `prisma7` grammar a `view` body holds `FieldDeclaration` members, so they print through\n* the model field path. With the `psl` grammar the same source line reads as several entries with\n* no `=`; those entries keep the source line they share, so `id Int` does not become two lines.\n*/\nfunction emitGenericBlock(writer, block, trailing) {\n\tconst alignment = alignmentMap(block.syntax);\n\temitBlockBody(writer, block.syntax, trailing, (node) => {\n\t\tconst field = FieldDeclarationAst.cast(node);\n\t\tif (field) return leafMember(writer, \"regular\", () => emitField(writer, field, alignment));\n\t\tconst entry = KeyValuePairAst.cast(node);\n\t\tif (entry) return leafMember(writer, \"regular\", () => emitKeyValue(writer, entry), entry.equals() === void 0);\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t});\n}\nfunction emitNamespace(writer, namespace, trailing) {\n\temitBlockBody(writer, namespace.syntax, trailing, (node) => {\n\t\tconst declaration = castBlockDeclaration(node);\n\t\tif (declaration) return nestedBlockMember(writer, declaration);\n\t});\n}\nfunction emitTypesBlock(writer, block, trailing) {\n\temitBlockBody(writer, block.syntax, trailing, (node) => {\n\t\tconst named = NamedTypeDeclarationAst.cast(node);\n\t\tif (named) return leafMember(writer, \"regular\", () => emitNamedType(writer, named));\n\t});\n}\nfunction emitTopLevel(writer, document) {\n\twalkRegion(writer, Array.from(document.syntax.children()), void 0, (node) => {\n\t\tconst declaration = castTopLevelDeclaration(node);\n\t\tif (declaration) return nestedBlockMember(writer, declaration);\n\t});\n}\nfunction nestedBlockMember(writer, block) {\n\treturn {\n\t\tcategory: \"nestedBlock\",\n\t\tkeepsSourceLine: false,\n\t\temit(trailing) {\n\t\t\tblock(writer, trailing);\n\t\t\treturn 0;\n\t\t}\n\t};\n}\nfunction castBlockDeclaration(node) {\n\tconst model = ModelDeclarationAst.cast(node);\n\tif (model) return (writer, trailing) => emitModel(writer, model, trailing);\n\tconst composite = CompositeTypeDeclarationAst.cast(node);\n\tif (composite) return (writer, trailing) => emitCompositeType(writer, composite, trailing);\n\tconst generic = GenericBlockDeclarationAst.cast(node);\n\tif (generic) return (writer, trailing) => emitGenericBlock(writer, generic, trailing);\n}\nfunction castTopLevelDeclaration(node) {\n\tconst block = castBlockDeclaration(node);\n\tif (block) return block;\n\tconst namespace = NamespaceDeclarationAst.cast(node);\n\tif (namespace) return (writer, trailing) => emitNamespace(writer, namespace, trailing);\n\tconst types = TypesBlockAst.cast(node);\n\tif (types) return (writer, trailing) => emitTypesBlock(writer, types, trailing);\n}\nfunction emitBlockBody(writer, node, closingTrailing, classify) {\n\tconst children = Array.from(node.children());\n\tconst openIndex = children.findIndex((el) => !(el instanceof SyntaxNode) && el.kind === \"LBrace\");\n\tstreamHeader(writer, node);\n\tconst headerComment = sameLineCommentAfter(children, openIndex);\n\tif (headerComment !== void 0) writer.comment(headerComment);\n\telse writer.newline();\n\twriter.indent();\n\twalkRegion(writer, children, \"RBrace\", classify);\n\twriter.unindent();\n\twriter.writeRaw(\"}\");\n\tif (closingTrailing !== void 0) writer.comment(closingTrailing);\n\telse writer.newline();\n}\nfunction streamHeader(writer, node) {\n\tlet done = false;\n\tconst walk = (parent) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (done) return;\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\" || child.kind === \"Comment\") continue;\n\t\t\tconst space = spaceBetween(writer.prevKind(), child.kind, false);\n\t\t\twriter.write(child, space);\n\t\t\tif (child.kind === \"LBrace\") {\n\t\t\t\tdone = true;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n\twalk(node);\n}\nfunction walkRegion(writer, elements, closeKind, classify) {\n\tlet sawOpenBrace = closeKind === void 0;\n\tlet sawContent = false;\n\tlet lastWasRegular = false;\n\tlet ledByComment = false;\n\tlet newlines = 0;\n\tfor (let i = 0; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) {\n\t\t\tif (!sawOpenBrace) continue;\n\t\t\tconst member = classify(element);\n\t\t\tif (member === void 0) throw new InternalError(`Formatter has no rule for a ${element.kind} node at offset ${element.offset}; formatting would drop its text`);\n\t\t\tif (!ledByComment) {\n\t\t\t\tif (newlines >= 2 && sawContent && !writer.lastIsBlank()) writer.blank();\n\t\t\t\telse if (separationBlankWanted(writer, member.category, sawContent, lastWasRegular)) writer.blank();\n\t\t\t}\n\t\t\tconst trailing = sameLineTrailingComment(elements, i);\n\t\t\tconst endLine = !member.keepsSourceLine || !memberFollowsOnSameLine(elements, i);\n\t\t\tcloseContinuation(writer, member.emit(trailing.text, endLine));\n\t\t\tif (trailing.index !== void 0) i = trailing.index;\n\t\t\tsawContent = true;\n\t\t\tlastWasRegular = member.category !== \"blockAttribute\";\n\t\t\tledByComment = false;\n\t\t\tnewlines = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (element.kind === \"LBrace\" && closeKind === \"RBrace\" && !sawOpenBrace) {\n\t\t\tsawOpenBrace = true;\n\t\t\tnewlines = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!sawOpenBrace) continue;\n\t\tif (closeKind === \"RBrace\" && element.kind === \"RBrace\") break;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\tif (element.kind === \"Newline\") {\n\t\t\tnewlines += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (element.kind === \"Comment\") {\n\t\t\tif (closeKind === \"RBrace\" && newlines === 0 && !sawContent) continue;\n\t\t\tif (newlines >= 2 && sawContent && !writer.lastIsBlank()) writer.blank();\n\t\t\telse if (!ledByComment) {\n\t\t\t\tconst led = leadingMemberAfter(elements, i, classify);\n\t\t\t\tif (led && separationBlankWanted(writer, led, sawContent, lastWasRegular)) writer.blank();\n\t\t\t}\n\t\t\twriter.writeRaw(element.text);\n\t\t\twriter.newline();\n\t\t\tsawContent = true;\n\t\t\tledByComment = true;\n\t\t\tnewlines = 0;\n\t\t}\n\t}\n}\nfunction memberFollowsOnSameLine(elements, memberIndex) {\n\tfor (let i = memberIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) return true;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\treturn false;\n\t}\n\treturn false;\n}\nfunction separationBlankWanted(writer, category, sawContent, lastWasRegular) {\n\tif (!sawContent || writer.lastIsBlank()) return false;\n\tif (category === \"nestedBlock\") return true;\n\treturn category === \"blockAttribute\" && lastWasRegular;\n}\nfunction leadingMemberAfter(elements, commentIndex, classify) {\n\tfor (let i = commentIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) return classify(element)?.category;\n\t\tif (element.kind === \"RBrace\") return void 0;\n\t}\n}\nfunction sameLineTrailingComment(elements, memberIndex) {\n\tfor (let i = memberIndex + 1; i < elements.length; i++) {\n\t\tconst element = elements[i];\n\t\tif (element === void 0) continue;\n\t\tif (element instanceof SyntaxNode) break;\n\t\tif (element.kind === \"Whitespace\") continue;\n\t\tif (element.kind === \"Comment\") return {\n\t\t\ttext: element.text,\n\t\t\tindex: i\n\t\t};\n\t\tbreak;\n\t}\n\treturn {\n\t\ttext: void 0,\n\t\tindex: void 0\n\t};\n}\nfunction sameLineCommentAfter(children, openIndex) {\n\tfor (let i = openIndex + 1; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (child === void 0) continue;\n\t\tif (child instanceof SyntaxNode) return void 0;\n\t\tif (child.kind === \"Whitespace\") continue;\n\t\tif (child.kind === \"Comment\") return child.text;\n\t\treturn;\n\t}\n}\nfunction alignmentMap(block) {\n\tconst fields = [];\n\tfor (const element of block.children()) {\n\t\tif (!(element instanceof SyntaxNode)) continue;\n\t\tif (FieldDeclarationAst.cast(element) === void 0) continue;\n\t\tif (hasInteriorComment(element)) continue;\n\t\tfields.push(element);\n\t}\n\tif (fields.length === 0) return void 0;\n\treturn alignmentColumns(fields);\n}\nfunction alignmentColumns(rows) {\n\tlet nameWidth = 0;\n\tfor (const row of rows) {\n\t\tconst field = FieldDeclarationAst.cast(row);\n\t\tif (!field) continue;\n\t\tnameWidth = Math.max(nameWidth, renderTokens(field.name()?.syntax).length);\n\t}\n\tconst typeColumn = nameWidth + 1;\n\tlet cellEnd = 0;\n\tfor (const row of rows) {\n\t\tconst field = FieldDeclarationAst.cast(row);\n\t\tif (!field) continue;\n\t\tconst name = renderTokens(field.name()?.syntax);\n\t\tconst type = renderTokens(field.typeAnnotation()?.syntax);\n\t\tcellEnd = Math.max(cellEnd, type.length > 0 ? typeColumn + type.length : name.length);\n\t}\n\treturn {\n\t\ttypeColumn,\n\t\tattributeColumn: cellEnd + 1\n\t};\n}\nfunction hasInteriorComment(node) {\n\tfor (const token of node.tokens()) if (token.kind === \"Comment\") return true;\n\treturn false;\n}\nfunction renderTokens(node) {\n\tif (!node) return \"\";\n\tlet out = \"\";\n\tlet prev;\n\tlet prevQualified = false;\n\tconst walk = (parent, qualified) => {\n\t\tfor (const child of parent.children()) {\n\t\t\tif (child instanceof SyntaxNode) {\n\t\t\t\twalk(child, qualified || child.kind === \"QualifiedName\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\" || child.kind === \"Comment\") continue;\n\t\t\tif (spaceBetween(prev, child.kind, qualified && prevQualified)) out += \" \";\n\t\t\tout += child.text;\n\t\t\tprev = child.kind;\n\t\t\tprevQualified = qualified;\n\t\t}\n\t};\n\twalk(node, false);\n\treturn out;\n}\n//#endregion\n//#region src/format/error.ts\nfunction pslError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/format/options.ts\nfunction resolveFormatOptions(options) {\n\tconst indent = options?.indent ?? 2;\n\tif (indent !== \"tab\" && (typeof indent !== \"number\" || !Number.isInteger(indent) || indent < 1)) throw pslError(\"PSL.FORMAT_OPTION_INVALID\", `Invalid format options: indent must be a positive integer or 'tab', got ${String(indent)}`, { meta: {\n\t\toption: \"indent\",\n\t\treceived: String(indent)\n\t} });\n\tconst newline = options?.newline ?? \"LF\";\n\tif (newline !== \"LF\" && newline !== \"CRLF\") throw pslError(\"PSL.FORMAT_OPTION_INVALID\", `Invalid format options: newline must be 'LF' or 'CRLF', got ${String(newline)}`, { meta: {\n\t\toption: \"newline\",\n\t\treceived: String(newline)\n\t} });\n\treturn {\n\t\tindentUnit: indent === \"tab\" ? \"\t\" : \" \".repeat(indent),\n\t\tnewline: newline === \"CRLF\" ? \"\\r\\n\" : \"\\n\"\n\t};\n}\n//#endregion\n//#region src/format/format.ts\nfunction format(source, options) {\n\tconst resolved = resolveFormatOptions(options);\n\tconst { document, diagnostics } = parse(source, \"<format-input>.psl\");\n\tif (diagnostics.length > 0) throw pslError(\"PSL.PARSE_FAILED\", `Cannot format PSL with parse errors: ${diagnostics[0]?.message ?? \"unknown parse error\"}${diagnostics.length > 1 ? ` (and ${diagnostics.length - 1} more)` : \"\"}`, { meta: { diagnostics } });\n\treturn emitDocument(document, resolved.indentUnit, resolved.newline);\n}\n//#endregion\nexport { format };\n\n//# sourceMappingURL=format.mjs.map"],"mappings":";;;;;AAKA,SAAS,aAAa,UAAU,YAAY,SAAS;CACpD,MAAM,SAAS,IAAI,WAAW,YAAY,OAAO;CACjD,aAAa,QAAQ,QAAQ;CAC7B,OAAO,OAAO,OAAO;AACtB;AACA,IAAI,aAAa,MAAM;CACtB;CACA;CACA,OAAO,CAAC;CACR,SAAS;CACT,QAAQ;CACR,YAAY;CACZ;CACA,gBAAgB;CAChB,cAAc;CACd,YAAY,YAAY,SAAS;EAChC,KAAKA,cAAc;EACnB,KAAKC,WAAW;CACjB;CACA,SAAS;EACR,KAAKC,UAAU;CAChB;CACA,WAAW;EACV,KAAKA,SAAS,KAAK,IAAI,GAAG,KAAKA,SAAS,CAAC;CAC1C;CACA,cAAc;EACb,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKC;CACb;CACA,UAAU;EACT,IAAI,CAAC,KAAKD,WAAW;EACrB,KAAKE,KAAK,KAAK,GAAG,KAAKN,YAAY,OAAO,KAAKE,MAAM,IAAI,KAAKK,OAAO;EACrE,KAAKA,QAAQ;EACb,KAAKH,YAAY;EACjB,KAAKC,YAAY,KAAK;EACtB,KAAKF,gBAAgB;EACrB,KAAKK,cAAc;CACpB;CACA,QAAQ;EACP,KAAK,QAAQ;EACb,IAAI,CAAC,KAAKA,eAAe,KAAKL,eAAe;EAC7C,KAAKG,KAAK,KAAK,EAAE;EACjB,KAAKH,gBAAgB;CACtB;CACA,MAAM,OAAO,OAAO,OAAO;EAC1B,IAAI,KAAKC,aAAa,UAAU,KAAK,GAAG,KAAKG,QAAQ,KAAKA,MAAM,OAAO,KAAK;OACvE,IAAI,KAAKH,aAAa,OAAO,KAAKG,SAAS;EAChD,KAAKA,SAAS,MAAM;EACpB,KAAKH,YAAY;EACjB,KAAKC,YAAY,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,EAAE,MAAM;EACjL,QAAQ;EACR,UAAU,OAAO,OAAO;CACzB,EAAE,CAAC;CACH,OAAO;EACN,YAAY,WAAW,QAAQ,MAAM,IAAI,OAAO,MAAM;EACtD,SAAS,YAAY,SAAS,SAAS;CACxC;AACD;AAGA,SAAS,OAAO,QAAQ,SAAS;CAChC,MAAM,WAAW,qBAAqB,OAAO;CAC7C,MAAM,EAAE,UAAU,gBAAgB,MAAM,QAAQ,oBAAoB;CACpE,IAAI,YAAY,SAAS,GAAG,MAAM,SAAS,oBAAoB,wCAAwC,YAAY,EAAE,EAAE,WAAW,wBAAwB,YAAY,SAAS,IAAI,SAAS,YAAY,SAAS,EAAE,UAAU,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;CAC5P,OAAO,aAAa,UAAU,SAAS,YAAY,SAAS,OAAO;AACpE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as Contract } from "./contract-types-Bje5yT4f-0D1Z41Lq.mjs";
|
|
2
2
|
import { r as Result } from "./result-Bpupv5vO.mjs";
|
|
3
|
-
import { c as ContractSourceProvider, m as PslContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, r as ContractSourceDiagnostic } from "./config-types-
|
|
4
|
-
import {
|
|
5
|
-
import { f as SymbolTable, i as FieldSymbol } from "./symbol-table-
|
|
3
|
+
import { c as ContractSourceProvider, m as PslContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, r as ContractSourceDiagnostic } from "./config-types-BKMblqZR.mjs";
|
|
4
|
+
import { I as PslDiagnostic, R as PslSources, f as DocumentAst } from "./parse-5HXALb4y-RUSJB688.mjs";
|
|
5
|
+
import { f as SymbolTable, i as FieldSymbol } from "./symbol-table-CDtpZvfM-DSP_8jbB.mjs";
|
|
6
6
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts
|
|
7
7
|
//#region src/interpret.d.ts
|
|
8
8
|
/**
|
|
@@ -12,12 +12,11 @@ import { f as SymbolTable, i as FieldSymbol } from "./symbol-table-ajt1Djeq-ByUe
|
|
|
12
12
|
*/
|
|
13
13
|
interface PslInterpretInput {
|
|
14
14
|
readonly document: DocumentAst;
|
|
15
|
-
readonly
|
|
15
|
+
readonly sources: PslSources;
|
|
16
16
|
readonly symbolTable: SymbolTable;
|
|
17
|
-
readonly sourceId: string;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
|
-
* Declared here — the authoring layer that owns `DocumentAst` / `
|
|
19
|
+
* Declared here — the authoring layer that owns `DocumentAst` / `PslSources` /
|
|
21
20
|
* `SymbolTable` — because `@internal/config` (core) cannot name authoring
|
|
22
21
|
* types. `interpret` must not read disk or `context.resolvedInputs` — those
|
|
23
22
|
* are load-path concerns.
|
|
@@ -58,9 +57,9 @@ declare function requiredOneToOneBackrelationDiagnostic(input: {
|
|
|
58
57
|
readonly modelName: string;
|
|
59
58
|
readonly field: FieldSymbol;
|
|
60
59
|
readonly targetModelName: string;
|
|
61
|
-
readonly
|
|
60
|
+
readonly sources: PslSources;
|
|
62
61
|
readonly recordNoun: 'row' | 'document';
|
|
63
|
-
}):
|
|
62
|
+
}): PslDiagnostic;
|
|
64
63
|
//#endregion
|
|
65
64
|
export { type InvalidFkPairing, type PslInterpretCapable, type PslInterpretInput, consumeInvalidFkPairing, fkRelationPairKey, hasPslInterpreter, requiredOneToOneBackrelationDiagnostic, withSeedDiagnostics };
|
|
66
65
|
//# sourceMappingURL=psl-parser__interpret.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;;;UAWU;WACC,UAAU;WACV,
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;;;UAWU;WACC,UAAU;WACV,SAAS;WACT,aAAa;;;;;;;;UAQd,4BAA4B;EACpC,UAAU,OAAO,mBAAmB,SAAS,wBAAwB,OAAO,UAAU;;;;;;;;iBAQvE,oBAAoB,QAAQ,OAAO,UAAU,4BAA4B,0BAA0B,6BAA6B,OAAO,UAAU;;iBAEjJ,kBAAkB,QAAQ,yBAAyB,UAAU;;;;;;;;KAQzE;WACM;WACA;;iBAEM,kBAAkB,4BAA4B;;;;;;iBAM9C,wBAAwB;WAC9B;GACR,iBAAiB,mBAAmB;iBACtB,uCAAuC;WAC7C;WACA,OAAO;WACP;WACA,SAAS;WACT;IACP"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as notOk } from "./result-C0NUq1Ok.mjs";
|
|
2
|
+
import { r as diagnosticSource } from "./diagnostic-Esyl8Qw1-Cd6SnWPN.mjs";
|
|
2
3
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs
|
|
3
4
|
/**
|
|
4
5
|
* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an
|
|
@@ -34,12 +35,11 @@ function consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings) {
|
|
|
34
35
|
return true;
|
|
35
36
|
}
|
|
36
37
|
function requiredOneToOneBackrelationDiagnostic(input) {
|
|
37
|
-
const { modelName, field, targetModelName,
|
|
38
|
+
const { modelName, field, targetModelName, sources, recordNoun } = input;
|
|
38
39
|
return {
|
|
39
40
|
code: "PSL_REQUIRED_ONE_TO_ONE_BACKRELATION",
|
|
40
41
|
message: `Backrelation field "${modelName}.${field.name}" is required, but "${targetModelName}" holds the relation fields, so nothing in storage guarantees a "${targetModelName}" ${recordNoun} exists. Make it optional: "${field.name} ${targetModelName}?".`,
|
|
41
|
-
|
|
42
|
-
span: field.span
|
|
42
|
+
...diagnosticSource(sources, field.node.syntax).at(field.span)
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|