@prisma/orm-framework 8.0.0-rc.17-dev.19 → 8.0.0-rc.17-dev.21
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/{binder-C7GnHWyT-D-CMg2qt.d.mts → binder-BUBLuGg4-CQbIZyym.d.mts} +3 -3
- package/dist/{binder-C7GnHWyT-D-CMg2qt.d.mts.map → binder-BUBLuGg4-CQbIZyym.d.mts.map} +1 -1
- package/dist/{declarations-DosoNVo9-qtyHBZ2H.mjs → declarations-CTFzoo9j-BaCuW9E2.mjs} +108 -6
- package/dist/declarations-CTFzoo9j-BaCuW9E2.mjs.map +1 -0
- package/dist/{parse-Dz0FUoAQ-CKj_IY0g.d.mts → parse-By_H285C-2bZhTomA.d.mts} +36 -9
- package/dist/{parse-Dz0FUoAQ-CKj_IY0g.d.mts.map → parse-By_H285C-2bZhTomA.d.mts.map} +1 -1
- package/dist/{parse-CKPyOsa_-D_c5ZPeY.mjs → parse-pRqRBDoL-BFDjYuLU.mjs} +89 -11
- package/dist/parse-pRqRBDoL-BFDjYuLU.mjs.map +1 -0
- package/dist/psl-parser.d.mts +3 -3
- package/dist/psl-parser.mjs +43 -3
- package/dist/psl-parser.mjs.map +1 -1
- package/dist/psl-parser__format.mjs +34 -19
- package/dist/psl-parser__format.mjs.map +1 -1
- package/dist/psl-parser__interpret.d.mts +2 -2
- package/dist/psl-parser__interpret.mjs +2 -2
- package/dist/psl-parser__interpret.mjs.map +1 -1
- package/dist/psl-parser__syntax.d.mts +3 -3
- package/dist/psl-parser__syntax.mjs +3 -43
- package/dist/psl-parser__tokenizer.d.mts +1 -1
- package/dist/psl-parser__tokenizer.mjs +1 -1
- package/dist/{tokenizer-BMz7z2KR-J0yZ4im3.mjs → tokenizer-C-GTKKjR-B1vOzJy0.mjs} +5 -4
- package/dist/tokenizer-C-GTKKjR-B1vOzJy0.mjs.map +1 -0
- package/dist/{tokenizer-DW30uwhx-BHsWTwYk.d.mts → tokenizer-i8RaVWVa-7fRwlCPP.d.mts} +3 -3
- package/dist/tokenizer-i8RaVWVa-7fRwlCPP.d.mts.map +1 -0
- package/package.json +15 -15
- package/dist/declarations-DosoNVo9-qtyHBZ2H.mjs.map +0 -1
- package/dist/parse-CKPyOsa_-D_c5ZPeY.mjs.map +0 -1
- package/dist/psl-parser__syntax.mjs.map +0 -1
- package/dist/tokenizer-BMz7z2KR-J0yZ4im3.mjs.map +0 -1
- package/dist/tokenizer-DW30uwhx-BHsWTwYk.d.mts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as structuredError } from "./structured-error-BXbihKQ-.mjs";
|
|
2
2
|
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
3
3
|
import { t as SyntaxNode } from "./ast-helpers-CzydMPdh-Mi0SrZRa.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { o as parse } from "./parse-
|
|
4
|
+
import { D as TypesBlockAst, _ as NamedTypeDeclarationAst, a as CompositeTypeDeclarationAst, c as FieldDeclarationAst, f as KeyValuePairAst, g as ModelDeclarationAst, h as ModelAttributeAst, m as MixinInclusionAst, p as MixinDeclarationAst, u as GenericBlockDeclarationAst, v as NamespaceDeclarationAst } from "./declarations-CTFzoo9j-BaCuW9E2.mjs";
|
|
5
|
+
import { o as parse } from "./parse-pRqRBDoL-BFDjYuLU.mjs";
|
|
6
6
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/format.mjs
|
|
7
7
|
function emitDocument(document, indentUnit, newline) {
|
|
8
8
|
const writer = new LineWriter(indentUnit, newline);
|
|
@@ -97,7 +97,8 @@ function spaceBetween(prev, cur, inQualifiedName) {
|
|
|
97
97
|
case "LBracket":
|
|
98
98
|
case "Dot":
|
|
99
99
|
case "At":
|
|
100
|
-
case "DoubleAt":
|
|
100
|
+
case "DoubleAt":
|
|
101
|
+
case "Plus": return false;
|
|
101
102
|
default: return true;
|
|
102
103
|
}
|
|
103
104
|
}
|
|
@@ -183,34 +184,46 @@ function leafMember(writer, category, print) {
|
|
|
183
184
|
}
|
|
184
185
|
};
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (field) return leafMember(writer, "regular", () => emitField(writer, field, alignmentColumns));
|
|
191
|
-
const attribute = ModelAttributeAst.cast(node);
|
|
192
|
-
if (attribute) return leafMember(writer, "blockAttribute", () => emitBlockAttribute(writer, attribute));
|
|
193
|
-
});
|
|
187
|
+
function inclusionMember(writer, node) {
|
|
188
|
+
const inclusion = MixinInclusionAst.cast(node);
|
|
189
|
+
if (inclusion === void 0) return void 0;
|
|
190
|
+
return leafMember(writer, "regular", () => streamNode(writer, inclusion.syntax));
|
|
194
191
|
}
|
|
195
|
-
function
|
|
196
|
-
const alignmentColumns = alignmentMap(
|
|
197
|
-
|
|
192
|
+
function fieldBodyMembers(writer, block) {
|
|
193
|
+
const alignmentColumns = alignmentMap(block);
|
|
194
|
+
return (node) => {
|
|
198
195
|
const field = FieldDeclarationAst.cast(node);
|
|
199
196
|
if (field) return leafMember(writer, "regular", () => emitField(writer, field, alignmentColumns));
|
|
200
197
|
const attribute = ModelAttributeAst.cast(node);
|
|
201
198
|
if (attribute) return leafMember(writer, "blockAttribute", () => emitBlockAttribute(writer, attribute));
|
|
202
|
-
|
|
199
|
+
return inclusionMember(writer, node);
|
|
200
|
+
};
|
|
203
201
|
}
|
|
204
|
-
function
|
|
205
|
-
const alignment = alignmentMap(block
|
|
206
|
-
|
|
202
|
+
function entryBodyMembers(writer, block) {
|
|
203
|
+
const alignment = alignmentMap(block);
|
|
204
|
+
return (node) => {
|
|
207
205
|
const field = FieldDeclarationAst.cast(node);
|
|
208
206
|
if (field) return leafMember(writer, "regular", () => emitField(writer, field, alignment));
|
|
209
207
|
const entry = KeyValuePairAst.cast(node);
|
|
210
208
|
if (entry) return leafMember(writer, "regular", () => emitKeyValue(writer, entry));
|
|
211
209
|
const attribute = ModelAttributeAst.cast(node);
|
|
212
210
|
if (attribute) return leafMember(writer, "blockAttribute", () => emitBlockAttribute(writer, attribute));
|
|
213
|
-
|
|
211
|
+
return inclusionMember(writer, node);
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function emitModel(writer, model, trailing) {
|
|
215
|
+
emitBlockBody(writer, model.syntax, trailing, fieldBodyMembers(writer, model.syntax));
|
|
216
|
+
}
|
|
217
|
+
function emitCompositeType(writer, composite, trailing) {
|
|
218
|
+
emitBlockBody(writer, composite.syntax, trailing, fieldBodyMembers(writer, composite.syntax));
|
|
219
|
+
}
|
|
220
|
+
function emitGenericBlock(writer, block, trailing) {
|
|
221
|
+
emitBlockBody(writer, block.syntax, trailing, entryBodyMembers(writer, block.syntax));
|
|
222
|
+
}
|
|
223
|
+
const FIELD_BODY_KEYWORDS = /* @__PURE__ */ new Set(["model", "type"]);
|
|
224
|
+
function emitMixinDeclaration(writer, mixin, trailing) {
|
|
225
|
+
const members = FIELD_BODY_KEYWORDS.has(mixin.keyword()?.text ?? "") ? fieldBodyMembers(writer, mixin.syntax) : entryBodyMembers(writer, mixin.syntax);
|
|
226
|
+
emitBlockBody(writer, mixin.syntax, trailing, members);
|
|
214
227
|
}
|
|
215
228
|
function emitNamespace(writer, namespace, trailing) {
|
|
216
229
|
emitBlockBody(writer, namespace.syntax, trailing, (node) => {
|
|
@@ -246,6 +259,8 @@ function castBlockDeclaration(node) {
|
|
|
246
259
|
if (composite) return (writer, trailing) => emitCompositeType(writer, composite, trailing);
|
|
247
260
|
const generic = GenericBlockDeclarationAst.cast(node);
|
|
248
261
|
if (generic) return (writer, trailing) => emitGenericBlock(writer, generic, trailing);
|
|
262
|
+
const mixin = MixinDeclarationAst.cast(node);
|
|
263
|
+
if (mixin) return (writer, trailing) => emitMixinDeclaration(writer, mixin, trailing);
|
|
249
264
|
}
|
|
250
265
|
function castTopLevelDeclaration(node) {
|
|
251
266
|
const block = castBlockDeclaration(node);
|
|
@@ -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 { s as SyntaxNode } from \"./ast-helpers-CzydMPdh.mjs\";\nimport { a as KeyValuePairAst, c as NamespaceDeclarationAst, i as GenericBlockDeclarationAst, l as TypesBlockAst, o as ModelDeclarationAst, p as ModelAttributeAst, r as FieldDeclarationAst, s as NamedTypeDeclarationAst, t as CompositeTypeDeclarationAst } from \"./declarations-DosoNVo9.mjs\";\nimport { t as parse } from \"./parse-CKPyOsa_.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 \"LBracket\": return prev === \"Colon\" || prev === \"Comma\" || prev === \"Equals\";\n\t\tcase \"LParen\":\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) {\n\treturn {\n\t\tcategory,\n\t\temit(trailing) {\n\t\t\tconst continuation = print();\n\t\t\tif (trailing !== void 0) writer.comment(trailing);\n\t\t\telse 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}\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));\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\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\tconst headerComments = streamHeader(writer, node);\n\tconst openingComment = sameLineCommentAfter(children, openIndex);\n\tif (openingComment !== void 0) headerComments.push(openingComment);\n\tconst [firstComment, ...otherComments] = headerComments;\n\tif (firstComment !== void 0) writer.comment(firstComment);\n\telse writer.newline();\n\twriter.indent();\n\tfor (const comment of otherComments) writer.comment(comment);\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}\n/** Writes the block header through `{` and returns the source comments found before the `{`. */\nfunction streamHeader(writer, node) {\n\tconst comments = [];\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 === \"Comment\") {\n\t\t\t\tcomments.push(child.text);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") 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\treturn comments;\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\tcloseContinuation(writer, member.emit(trailing.text));\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 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, parserOptions = {}) {\n\tconst resolved = resolveFormatOptions(options);\n\tconst { document, diagnostics } = parse(source, \"<format-input>.psl\", parserOptions);\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, resolveFormatOptions };\n\n//# sourceMappingURL=format.mjs.map"],"mappings":";;;;;;AAMA,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,K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,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,gBAAgB,CAAC,GAAG;CACpD,MAAM,WAAW,qBAAqB,OAAO;CAC7C,MAAM,EAAE,UAAU,gBAAgB,MAAM,QAAQ,sBAAsB,aAAa;CACnF,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 { s as SyntaxNode } from \"./ast-helpers-CzydMPdh.mjs\";\nimport { a as KeyValuePairAst, c as ModelDeclarationAst, d as TypesBlockAst, h as ModelAttributeAst, i as GenericBlockDeclarationAst, l as NamedTypeDeclarationAst, o as MixinDeclarationAst, r as FieldDeclarationAst, s as MixinInclusionAst, t as CompositeTypeDeclarationAst, u as NamespaceDeclarationAst } from \"./declarations-CTFzoo9j.mjs\";\nimport { t as parse } from \"./parse-pRqRBDoL.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 \"LBracket\": return prev === \"Colon\" || prev === \"Comma\" || prev === \"Equals\";\n\t\tcase \"LParen\":\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\":\n\t\tcase \"Plus\": 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) {\n\treturn {\n\t\tcategory,\n\t\temit(trailing) {\n\t\t\tconst continuation = print();\n\t\t\tif (trailing !== void 0) writer.comment(trailing);\n\t\t\telse writer.newline();\n\t\t\treturn continuation;\n\t\t}\n\t};\n}\nfunction inclusionMember(writer, node) {\n\tconst inclusion = MixinInclusionAst.cast(node);\n\tif (inclusion === void 0) return void 0;\n\treturn leafMember(writer, \"regular\", () => streamNode(writer, inclusion.syntax));\n}\nfunction fieldBodyMembers(writer, block) {\n\tconst alignmentColumns = alignmentMap(block);\n\treturn (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\treturn inclusionMember(writer, node);\n\t};\n}\nfunction entryBodyMembers(writer, block) {\n\tconst alignment = alignmentMap(block);\n\treturn (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));\n\t\tconst attribute = ModelAttributeAst.cast(node);\n\t\tif (attribute) return leafMember(writer, \"blockAttribute\", () => emitBlockAttribute(writer, attribute));\n\t\treturn inclusionMember(writer, node);\n\t};\n}\nfunction emitModel(writer, model, trailing) {\n\temitBlockBody(writer, model.syntax, trailing, fieldBodyMembers(writer, model.syntax));\n}\nfunction emitCompositeType(writer, composite, trailing) {\n\temitBlockBody(writer, composite.syntax, trailing, fieldBodyMembers(writer, composite.syntax));\n}\nfunction emitGenericBlock(writer, block, trailing) {\n\temitBlockBody(writer, block.syntax, trailing, entryBodyMembers(writer, block.syntax));\n}\nconst FIELD_BODY_KEYWORDS = /* @__PURE__ */ new Set([\"model\", \"type\"]);\nfunction emitMixinDeclaration(writer, mixin, trailing) {\n\tconst members = FIELD_BODY_KEYWORDS.has(mixin.keyword()?.text ?? \"\") ? fieldBodyMembers(writer, mixin.syntax) : entryBodyMembers(writer, mixin.syntax);\n\temitBlockBody(writer, mixin.syntax, trailing, members);\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\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\tconst mixin = MixinDeclarationAst.cast(node);\n\tif (mixin) return (writer, trailing) => emitMixinDeclaration(writer, mixin, 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\tconst headerComments = streamHeader(writer, node);\n\tconst openingComment = sameLineCommentAfter(children, openIndex);\n\tif (openingComment !== void 0) headerComments.push(openingComment);\n\tconst [firstComment, ...otherComments] = headerComments;\n\tif (firstComment !== void 0) writer.comment(firstComment);\n\telse writer.newline();\n\twriter.indent();\n\tfor (const comment of otherComments) writer.comment(comment);\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}\n/** Writes the block header through `{` and returns the source comments found before the `{`. */\nfunction streamHeader(writer, node) {\n\tconst comments = [];\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 === \"Comment\") {\n\t\t\t\tcomments.push(child.text);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (child.kind === \"Whitespace\" || child.kind === \"Newline\") 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\treturn comments;\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\tcloseContinuation(writer, member.emit(trailing.text));\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 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, parserOptions = {}) {\n\tconst resolved = resolveFormatOptions(options);\n\tconst { document, diagnostics } = parse(source, \"<format-input>.psl\", parserOptions);\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, resolveFormatOptions };\n\n//# sourceMappingURL=format.mjs.map"],"mappings":";;;;;;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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,gBAAgB,CAAC,GAAG;CACpD,MAAM,WAAW,qBAAqB,OAAO;CAC7C,MAAM,EAAE,UAAU,gBAAgB,MAAM,QAAQ,sBAAsB,aAAa;CACnF,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"}
|
|
@@ -4,8 +4,8 @@ import { r as Result } from "./result-BYCOANWy.mjs";
|
|
|
4
4
|
import "./authoring-Cdm02TLT.mjs";
|
|
5
5
|
import "./psl-ast-DqB4Tq08.mjs";
|
|
6
6
|
import { c as ContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, p as PslContractSourceProvider, r as ContractSourceDiagnostic } from "./config-types-DDmOiupw.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { L as FieldSymbol, Ot as SymbolTable, St as ResolvedAttributeArg, Tt as ResolvedTypeConstructorCall, l as Binder, p as BlockSymbol } from "./binder-
|
|
7
|
+
import { B as PslDiagnosticCollector, V as PslSources, d as DiagnosticSource, f as DocumentAst, z as PslDiagnostic } from "./parse-By_H285C-2bZhTomA.mjs";
|
|
8
|
+
import { L as FieldSymbol, Ot as SymbolTable, St as ResolvedAttributeArg, Tt as ResolvedTypeConstructorCall, l as Binder, p as BlockSymbol } from "./binder-BUBLuGg4-CQbIZyym.mjs";
|
|
9
9
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts
|
|
10
10
|
//#region src/authoring-arguments.d.ts
|
|
11
11
|
/**
|
|
@@ -81,7 +81,7 @@ function parseJsLikeLiteral(value) {
|
|
|
81
81
|
return INVALID_AUTHORING_ARGUMENT;
|
|
82
82
|
}
|
|
83
83
|
function parseNumber() {
|
|
84
|
-
const raw = value.slice(index).match(
|
|
84
|
+
const raw = value.slice(index).match(/^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/)?.[0];
|
|
85
85
|
if (!raw) return INVALID_AUTHORING_ARGUMENT;
|
|
86
86
|
const parsed = Number(raw);
|
|
87
87
|
if (!Number.isFinite(parsed)) return INVALID_AUTHORING_ARGUMENT;
|
|
@@ -154,7 +154,7 @@ function parseJsLikeLiteral(value) {
|
|
|
154
154
|
if (character === "{") return parseObject();
|
|
155
155
|
if (character === "[") return parseArray();
|
|
156
156
|
if (character === "\"" || character === "'") return parseString();
|
|
157
|
-
if (character === "-" || /\d/.test(character ?? "")) return parseNumber();
|
|
157
|
+
if (character === "-" || character === "+" || /\d/.test(character ?? "")) return parseNumber();
|
|
158
158
|
const identifier = parseIdentifier();
|
|
159
159
|
if (identifier === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
160
160
|
if (identifier === "true") return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser__interpret.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs"],"sourcesContent":["import { c as diagnosticSource, n as nodePslSpan, t as keywordPslSpan } from \"./resolve-C8PUf8zv.mjs\";\nimport { instantiateAuthoringFieldPreset, isAuthoringPslBlockDescriptor, validateAuthoringHelperArguments } from \"@internal/framework-components/authoring\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/authoring-arguments.ts\nfunction unquoteStringLiteral(value) {\n\tconst trimmed = value.trim();\n\tconst match = trimmed.match(/^(['\"])(.*)\\1$/);\n\tif (!match) return trimmed;\n\treturn match[2] ?? \"\";\n}\nconst INVALID_AUTHORING_ARGUMENT = Symbol(\"invalidAuthoringArgument\");\nfunction isIdentifierStartCharacter(character) {\n\treturn character !== void 0 && /[A-Za-z_$]/.test(character);\n}\nfunction isIdentifierCharacter(character) {\n\treturn character !== void 0 && /[A-Za-z0-9_$]/.test(character);\n}\nfunction parseJsLikeLiteral(value) {\n\tlet index = 0;\n\tfunction skipWhitespace() {\n\t\twhile (/\\s/.test(value[index] ?? \"\")) index += 1;\n\t}\n\tfunction parseIdentifier() {\n\t\tconst first = value[index];\n\t\tif (!isIdentifierStartCharacter(first)) return INVALID_AUTHORING_ARGUMENT;\n\t\tlet end = index + 1;\n\t\twhile (isIdentifierCharacter(value[end])) end += 1;\n\t\tconst identifier = value.slice(index, end);\n\t\tindex = end;\n\t\treturn identifier;\n\t}\n\tfunction parseString() {\n\t\tconst quote = value[index];\n\t\tif (quote !== \"\\\"\" && quote !== \"'\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tlet result = \"\";\n\t\twhile (index < value.length) {\n\t\t\tconst character = value[index];\n\t\t\tindex += 1;\n\t\t\tif (character === void 0) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tif (character === quote) return result;\n\t\t\tif (character !== \"\\\\\") {\n\t\t\t\tresult += character;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst escaped = value[index];\n\t\t\tindex += 1;\n\t\t\tif (escaped === void 0) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tswitch (escaped) {\n\t\t\t\tcase \"'\":\n\t\t\t\tcase \"\\\"\":\n\t\t\t\tcase \"\\\\\":\n\t\t\t\tcase \"/\":\n\t\t\t\t\tresult += escaped;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"b\":\n\t\t\t\t\tresult += \"\\b\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"f\":\n\t\t\t\t\tresult += \"\\f\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"n\":\n\t\t\t\t\tresult += \"\\n\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"r\":\n\t\t\t\t\tresult += \"\\r\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"t\":\n\t\t\t\t\tresult += \"\t\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"u\": {\n\t\t\t\t\tconst hex = value.slice(index, index + 4);\n\t\t\t\t\tif (!/^[0-9A-Fa-f]{4}$/.test(hex)) return INVALID_AUTHORING_ARGUMENT;\n\t\t\t\t\tresult += String.fromCharCode(Number.parseInt(hex, 16));\n\t\t\t\t\tindex += 4;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: return INVALID_AUTHORING_ARGUMENT;\n\t\t\t}\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseNumber() {\n\t\tconst raw = value.slice(index).match(/^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/)?.[0];\n\t\tif (!raw) return INVALID_AUTHORING_ARGUMENT;\n\t\tconst parsed = Number(raw);\n\t\tif (!Number.isFinite(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += raw.length;\n\t\treturn parsed;\n\t}\n\tfunction parseArray() {\n\t\tif (value[index] !== \"[\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tconst result = [];\n\t\tskipWhitespace();\n\t\tif (value[index] === \"]\") {\n\t\t\tindex += 1;\n\t\t\treturn result;\n\t\t}\n\t\twhile (index < value.length) {\n\t\t\tconst entry = parseValue();\n\t\t\tif (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tresult.push(entry);\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] === \",\") {\n\t\t\t\tindex += 1;\n\t\t\t\tskipWhitespace();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (value[index] === \"]\") {\n\t\t\t\tindex += 1;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseObject() {\n\t\tif (value[index] !== \"{\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tconst result = {};\n\t\tskipWhitespace();\n\t\tif (value[index] === \"}\") {\n\t\t\tindex += 1;\n\t\t\treturn result;\n\t\t}\n\t\twhile (index < value.length) {\n\t\t\tskipWhitespace();\n\t\t\tconst key = value[index] === \"\\\"\" || value[index] === \"'\" ? parseString() : parseIdentifier();\n\t\t\tif (key === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] !== \":\") return INVALID_AUTHORING_ARGUMENT;\n\t\t\tindex += 1;\n\t\t\tconst entry = parseValue();\n\t\t\tif (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tresult[key] = entry;\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] === \",\") {\n\t\t\t\tindex += 1;\n\t\t\t\tskipWhitespace();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (value[index] === \"}\") {\n\t\t\t\tindex += 1;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseValue() {\n\t\tskipWhitespace();\n\t\tconst character = value[index];\n\t\tif (character === \"{\") return parseObject();\n\t\tif (character === \"[\") return parseArray();\n\t\tif (character === \"\\\"\" || character === \"'\") return parseString();\n\t\tif (character === \"-\" || /\\d/.test(character ?? \"\")) return parseNumber();\n\t\tconst identifier = parseIdentifier();\n\t\tif (identifier === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\tif (identifier === \"true\") return true;\n\t\tif (identifier === \"false\") return false;\n\t\tif (identifier === \"null\") return null;\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tskipWhitespace();\n\tconst parsed = parseValue();\n\tif (parsed === INVALID_AUTHORING_ARGUMENT) return parsed;\n\tskipWhitespace();\n\treturn index === value.length ? parsed : INVALID_AUTHORING_ARGUMENT;\n}\nfunction parseStringArrayLiteral(value) {\n\tconst parsed = parseJsLikeLiteral(value);\n\tif (parsed === INVALID_AUTHORING_ARGUMENT || !Array.isArray(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\tif (!parsed.every((item) => typeof item === \"string\")) return INVALID_AUTHORING_ARGUMENT;\n\treturn parsed;\n}\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction parsePslObjectLiteral(value) {\n\tconst trimmed = value.trim();\n\tif (!trimmed.startsWith(\"{\") || !trimmed.endsWith(\"}\")) return INVALID_AUTHORING_ARGUMENT;\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(trimmed);\n\t} catch {\n\t\tparsed = parseJsLikeLiteral(trimmed);\n\t\tif (parsed === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t}\n\tif (!isPlainObject(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\treturn parsed;\n}\nfunction parsePslAuthoringArgumentValue(descriptor, rawValue) {\n\tswitch (descriptor.kind) {\n\t\tcase \"string\": return unquoteStringLiteral(rawValue);\n\t\tcase \"boolean\": {\n\t\t\tconst trimmed = rawValue.trim();\n\t\t\tif (trimmed === \"true\") return true;\n\t\t\tif (trimmed === \"false\") return false;\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst parsed = Number(unquoteStringLiteral(rawValue));\n\t\t\treturn Number.isNaN(parsed) ? INVALID_AUTHORING_ARGUMENT : parsed;\n\t\t}\n\t\tcase \"stringArray\": return parseStringArrayLiteral(rawValue);\n\t\tcase \"object\": return parsePslObjectLiteral(rawValue);\n\t\tcase \"option\": {\n\t\t\tconst trimmed = rawValue.trim();\n\t\t\treturn /^[A-Za-z_][A-Za-z0-9_]*$/.test(trimmed) ? trimmed : INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\tdefault: return INVALID_AUTHORING_ARGUMENT;\n\t}\n}\nfunction pushInvalidPslHelperArgument(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\tmessage: `${input.entityLabel} ${input.helperLabel} ${input.message}`,\n\t\t...input.source.at(input.span)\n\t});\n}\n/**\n* The values of positional PSL arguments, each written as its PSL text in `rawArgs`, read as `descriptors` say, as the PSL reader reads a type constructor call. `undefined` when there are more arguments than descriptors or one does not parse.\n*/\nfunction parsePslPositionalArgs(descriptors, rawArgs) {\n\tif (rawArgs.length > descriptors.length) return void 0;\n\tconst values = [];\n\tfor (const [index, rawArg] of rawArgs.entries()) {\n\t\tconst descriptor = descriptors[index];\n\t\tif (descriptor === void 0) return void 0;\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, rawArg);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return void 0;\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\nfunction mapPslHelperArgs(input) {\n\tconst mappedArgs = input.descriptors.map(() => void 0);\n\tconst positionalArgs = input.args.filter((arg) => arg.kind === \"positional\");\n\tconst namedArgs = input.args.filter((arg) => arg.kind === \"named\");\n\tif (positionalArgs.length > input.descriptors.length) return pushInvalidPslHelperArgument({\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tspan: input.span,\n\t\tentityLabel: input.entityLabel,\n\t\thelperLabel: input.helperLabel,\n\t\tmessage: `accepts at most ${input.descriptors.length} argument(s), received ${positionalArgs.length}.`\n\t});\n\tfor (const [index, argument] of positionalArgs.entries()) {\n\t\tconst descriptor = input.descriptors[index];\n\t\tif (!descriptor) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `does not define positional argument #${index + 1}.`\n\t\t});\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, argument.value);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `cannot parse argument #${index + 1} for descriptor kind \"${descriptor.kind}\".`\n\t\t});\n\t\tmappedArgs[index] = value;\n\t}\n\tfor (const argument of namedArgs) {\n\t\tconst descriptorIndex = input.descriptors.findIndex((descriptor) => descriptor.name === argument.name);\n\t\tif (descriptorIndex < 0) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `received unknown named argument \"${argument.name}\".`\n\t\t});\n\t\tif (mappedArgs[descriptorIndex] !== void 0) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `received duplicate value for argument \"${argument.name}\".`\n\t\t});\n\t\tconst descriptor = input.descriptors[descriptorIndex];\n\t\tif (!descriptor) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `does not define named argument \"${argument.name}\".`\n\t\t});\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, argument.value);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `cannot parse named argument \"${argument.name}\" for descriptor kind \"${descriptor.kind}\".`\n\t\t});\n\t\tmappedArgs[descriptorIndex] = value;\n\t}\n\treturn mappedArgs;\n}\n//#endregion\n//#region src/enum-member-attributes.ts\nfunction enumMemberAttributeDiagnostics(enumBlock, sources) {\n\tconst source = diagnosticSource(sources, enumBlock.node.syntax);\n\treturn enumBlock.entries.flatMap((member) => Array.from(member.attributes(), (attribute) => ({\n\t\tcode: \"PSL_UNSUPPORTED_ENUM_MEMBER_ATTRIBUTE\",\n\t\tmessage: `enum \"${enumBlock.name}\": member \"${member.key()?.name() ?? \"?\"}\" carries @${attribute.name()?.path().join(\".\") ?? \"?\"}, but an enum member takes no attributes`,\n\t\t...source.at(nodePslSpan(attribute.syntax, sources))\n\t})));\n}\n//#endregion\n//#region src/field-presets.ts\nfunction reportPresetNotCalled(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_PRESET_NOT_CALLED\",\n\t\tmessage: `${input.entityLabel} uses field preset \"${input.presetPath}\" without calling it. Write ${input.presetPath}().`,\n\t\t...input.source.at(input.span)\n\t});\n}\n/**\n* Instantiates a field-preset call against its descriptor, coercing PSL AST arguments into the descriptor's typed argument shape and returning the preset's full set of contract contributions.\n*\n* PSL → typed-args coercion happens here (via `mapPslHelperArgs`) so that `instantiateAuthoringFieldPreset` itself stays typed-input-only and TS keeps its zero-runtime-validation cost.\n*/\nfunction instantiatePslFieldPreset(input) {\n\tconst helperPath = input.call.path.join(\".\");\n\tconst args = mapPslHelperArgs({\n\t\targs: input.call.args,\n\t\tdescriptors: input.descriptor.args ?? [],\n\t\thelperLabel: `preset \"${helperPath}\"`,\n\t\tspan: input.call.span,\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tentityLabel: input.entityLabel\n\t});\n\tif (!args) return;\n\ttry {\n\t\tvalidateAuthoringHelperArguments(helperPath, input.descriptor.args, args);\n\t\treturn instantiateAuthoringFieldPreset(input.descriptor, args);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${input.entityLabel}: ${message}`,\n\t\t\t...input.source.at(input.call.span)\n\t\t});\n\t\treturn;\n\t}\n}\n//#endregion\n//#region src/interpret.ts\n/**\n* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n* interpretation result. The authored headline is deliberately uniform — it\n* reports how many errors the schema has, never which pipeline stage found\n* them.\n*/\nfunction withSeedDiagnostics(result, seedDiagnostics) {\n\tif (seedDiagnostics.length === 0) return result;\n\tconst diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];\n\treturn notOk({\n\t\tsummary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? \"\" : \"s\"}`,\n\t\tdiagnostics,\n\t\t...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }\n\t});\n}\n/** The single seam that narrows a contract source to the interpret capability. */\nfunction hasPslInterpreter(source) {\n\treturn source.format === \"psl\" && \"interpret\" in source && typeof source.interpret === \"function\";\n}\n//#endregion\n//#region src/relation-backrelations.ts\nfunction fkRelationPairKey(declaringModelName, targetModelName) {\n\treturn `${declaringModelName}::${targetModelName}`;\n}\n/**\n* Claims the one rejected FK side that pairs with this back-relation candidate: same model pair\n* and the same relation name, where an unnamed candidate pairs only with an unnamed FK side.\n* A claimed pairing is removed, so a second candidate on the same pair reports its own problem.\n*/\nfunction consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings) {\n\tconst index = invalidFkPairings.findIndex((pairing) => pairing.pairKey === pairKey && pairing.relationName === candidate.relationName);\n\tif (index === -1) return false;\n\tinvalidFkPairings.splice(index, 1);\n\treturn true;\n}\nfunction requiredOneToOneBackrelationDiagnostic(input) {\n\tconst { modelName, field, targetModelName, sources, recordNoun } = input;\n\treturn {\n\t\tcode: \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\",\n\t\tmessage: `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}?\".`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\n//#endregion\n//#region src/type-constructor-calls.ts\nfunction isBareTypeConstructor(descriptor) {\n\treturn descriptor.entityRefArg === void 0 && (descriptor.args ?? []).every((arg) => arg.optional === true);\n}\nfunction argumentSpelling(descriptor) {\n\tconst args = descriptor.args ?? [];\n\tconst reference = descriptor.entityRefArg;\n\tconst count = Math.max(args.length, (reference?.index ?? -1) + 1);\n\tconst names = [];\n\tfor (let index = 0; index < count; index++) {\n\t\tconst arg = args[index];\n\t\tif (index === reference?.index) names.push(reference.entityKind);\n\t\telse if (arg !== void 0 && arg.optional !== true) names.push(arg.name ?? `argument${index + 1}`);\n\t}\n\treturn names.join(\", \");\n}\nfunction reportTypeConstructorNotCalled(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_TYPE_CONSTRUCTOR_NOT_CALLED\",\n\t\tmessage: `${input.entityLabel} uses type constructor \"${input.path}\" without arguments. Write ${input.path}(${argumentSpelling(input.descriptor)}).`,\n\t\t...input.source.at(input.span)\n\t});\n}\n//#endregion\n//#region src/unclaimed-blocks.ts\n/** A generic block is read only when a composed descriptor claims its keyword. */\nfunction claimedBlockKeywords(descriptors) {\n\tconst keywords = /* @__PURE__ */ new Set();\n\tfor (const [keyword, value] of Object.entries(descriptors ?? {})) if (isAuthoringPslBlockDescriptor(value)) keywords.add(keyword);\n\treturn keywords;\n}\nfunction unsupportedBlockDiagnostic(block, sources) {\n\treturn {\n\t\tcode: \"PSL_UNSUPPORTED_TOP_LEVEL_BLOCK\",\n\t\tmessage: `Unsupported top-level block \"${block.keyword}\"`,\n\t\t...diagnosticSource(sources, block.node.syntax).at(keywordPslSpan(block.node.syntax, block.keyword, sources))\n\t};\n}\n//#endregion\nexport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, instantiatePslFieldPreset, isBareTypeConstructor, mapPslHelperArgs, parsePslPositionalArgs, reportPresetNotCalled, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };\n\n//# sourceMappingURL=interpret.mjs.map"],"mappings":";;;;AAIA,SAAS,qBAAqB,OAAO;CACpC,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,MAAM,gBAAgB;CAC5C,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO,MAAM,MAAM;AACpB;AACA,MAAM,6BAA6B,OAAO,0BAA0B;AACpE,SAAS,2BAA2B,WAAW;CAC9C,OAAO,cAAc,KAAK,KAAK,aAAa,KAAK,SAAS;AAC3D;AACA,SAAS,sBAAsB,WAAW;CACzC,OAAO,cAAc,KAAK,KAAK,gBAAgB,KAAK,SAAS;AAC9D;AACA,SAAS,mBAAmB,OAAO;CAClC,IAAI,QAAQ;CACZ,SAAS,iBAAiB;EACzB,OAAO,KAAK,KAAK,MAAM,UAAU,EAAE,GAAG,SAAS;CAChD;CACA,SAAS,kBAAkB;EAC1B,MAAM,QAAQ,MAAM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AAM,KAAK,QAAQ,MAAM,SAAS,OAAO,CAAC;CAC7G;AACD"}
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs"],"sourcesContent":["import { c as diagnosticSource, n as nodePslSpan, t as keywordPslSpan } from \"./resolve-C8PUf8zv.mjs\";\nimport { instantiateAuthoringFieldPreset, isAuthoringPslBlockDescriptor, validateAuthoringHelperArguments } from \"@internal/framework-components/authoring\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/authoring-arguments.ts\nfunction unquoteStringLiteral(value) {\n\tconst trimmed = value.trim();\n\tconst match = trimmed.match(/^(['\"])(.*)\\1$/);\n\tif (!match) return trimmed;\n\treturn match[2] ?? \"\";\n}\nconst INVALID_AUTHORING_ARGUMENT = Symbol(\"invalidAuthoringArgument\");\nfunction isIdentifierStartCharacter(character) {\n\treturn character !== void 0 && /[A-Za-z_$]/.test(character);\n}\nfunction isIdentifierCharacter(character) {\n\treturn character !== void 0 && /[A-Za-z0-9_$]/.test(character);\n}\nfunction parseJsLikeLiteral(value) {\n\tlet index = 0;\n\tfunction skipWhitespace() {\n\t\twhile (/\\s/.test(value[index] ?? \"\")) index += 1;\n\t}\n\tfunction parseIdentifier() {\n\t\tconst first = value[index];\n\t\tif (!isIdentifierStartCharacter(first)) return INVALID_AUTHORING_ARGUMENT;\n\t\tlet end = index + 1;\n\t\twhile (isIdentifierCharacter(value[end])) end += 1;\n\t\tconst identifier = value.slice(index, end);\n\t\tindex = end;\n\t\treturn identifier;\n\t}\n\tfunction parseString() {\n\t\tconst quote = value[index];\n\t\tif (quote !== \"\\\"\" && quote !== \"'\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tlet result = \"\";\n\t\twhile (index < value.length) {\n\t\t\tconst character = value[index];\n\t\t\tindex += 1;\n\t\t\tif (character === void 0) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tif (character === quote) return result;\n\t\t\tif (character !== \"\\\\\") {\n\t\t\t\tresult += character;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst escaped = value[index];\n\t\t\tindex += 1;\n\t\t\tif (escaped === void 0) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tswitch (escaped) {\n\t\t\t\tcase \"'\":\n\t\t\t\tcase \"\\\"\":\n\t\t\t\tcase \"\\\\\":\n\t\t\t\tcase \"/\":\n\t\t\t\t\tresult += escaped;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"b\":\n\t\t\t\t\tresult += \"\\b\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"f\":\n\t\t\t\t\tresult += \"\\f\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"n\":\n\t\t\t\t\tresult += \"\\n\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"r\":\n\t\t\t\t\tresult += \"\\r\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"t\":\n\t\t\t\t\tresult += \"\t\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"u\": {\n\t\t\t\t\tconst hex = value.slice(index, index + 4);\n\t\t\t\t\tif (!/^[0-9A-Fa-f]{4}$/.test(hex)) return INVALID_AUTHORING_ARGUMENT;\n\t\t\t\t\tresult += String.fromCharCode(Number.parseInt(hex, 16));\n\t\t\t\t\tindex += 4;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: return INVALID_AUTHORING_ARGUMENT;\n\t\t\t}\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseNumber() {\n\t\tconst raw = value.slice(index).match(/^[+-]?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/)?.[0];\n\t\tif (!raw) return INVALID_AUTHORING_ARGUMENT;\n\t\tconst parsed = Number(raw);\n\t\tif (!Number.isFinite(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += raw.length;\n\t\treturn parsed;\n\t}\n\tfunction parseArray() {\n\t\tif (value[index] !== \"[\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tconst result = [];\n\t\tskipWhitespace();\n\t\tif (value[index] === \"]\") {\n\t\t\tindex += 1;\n\t\t\treturn result;\n\t\t}\n\t\twhile (index < value.length) {\n\t\t\tconst entry = parseValue();\n\t\t\tif (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tresult.push(entry);\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] === \",\") {\n\t\t\t\tindex += 1;\n\t\t\t\tskipWhitespace();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (value[index] === \"]\") {\n\t\t\t\tindex += 1;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseObject() {\n\t\tif (value[index] !== \"{\") return INVALID_AUTHORING_ARGUMENT;\n\t\tindex += 1;\n\t\tconst result = {};\n\t\tskipWhitespace();\n\t\tif (value[index] === \"}\") {\n\t\t\tindex += 1;\n\t\t\treturn result;\n\t\t}\n\t\twhile (index < value.length) {\n\t\t\tskipWhitespace();\n\t\t\tconst key = value[index] === \"\\\"\" || value[index] === \"'\" ? parseString() : parseIdentifier();\n\t\t\tif (key === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] !== \":\") return INVALID_AUTHORING_ARGUMENT;\n\t\t\tindex += 1;\n\t\t\tconst entry = parseValue();\n\t\t\tif (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\t\tresult[key] = entry;\n\t\t\tskipWhitespace();\n\t\t\tif (value[index] === \",\") {\n\t\t\t\tindex += 1;\n\t\t\t\tskipWhitespace();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (value[index] === \"}\") {\n\t\t\t\tindex += 1;\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tfunction parseValue() {\n\t\tskipWhitespace();\n\t\tconst character = value[index];\n\t\tif (character === \"{\") return parseObject();\n\t\tif (character === \"[\") return parseArray();\n\t\tif (character === \"\\\"\" || character === \"'\") return parseString();\n\t\tif (character === \"-\" || character === \"+\" || /\\d/.test(character ?? \"\")) return parseNumber();\n\t\tconst identifier = parseIdentifier();\n\t\tif (identifier === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t\tif (identifier === \"true\") return true;\n\t\tif (identifier === \"false\") return false;\n\t\tif (identifier === \"null\") return null;\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tskipWhitespace();\n\tconst parsed = parseValue();\n\tif (parsed === INVALID_AUTHORING_ARGUMENT) return parsed;\n\tskipWhitespace();\n\treturn index === value.length ? parsed : INVALID_AUTHORING_ARGUMENT;\n}\nfunction parseStringArrayLiteral(value) {\n\tconst parsed = parseJsLikeLiteral(value);\n\tif (parsed === INVALID_AUTHORING_ARGUMENT || !Array.isArray(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\tif (!parsed.every((item) => typeof item === \"string\")) return INVALID_AUTHORING_ARGUMENT;\n\treturn parsed;\n}\nfunction isPlainObject(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction parsePslObjectLiteral(value) {\n\tconst trimmed = value.trim();\n\tif (!trimmed.startsWith(\"{\") || !trimmed.endsWith(\"}\")) return INVALID_AUTHORING_ARGUMENT;\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(trimmed);\n\t} catch {\n\t\tparsed = parseJsLikeLiteral(trimmed);\n\t\tif (parsed === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;\n\t}\n\tif (!isPlainObject(parsed)) return INVALID_AUTHORING_ARGUMENT;\n\treturn parsed;\n}\nfunction parsePslAuthoringArgumentValue(descriptor, rawValue) {\n\tswitch (descriptor.kind) {\n\t\tcase \"string\": return unquoteStringLiteral(rawValue);\n\t\tcase \"boolean\": {\n\t\t\tconst trimmed = rawValue.trim();\n\t\t\tif (trimmed === \"true\") return true;\n\t\t\tif (trimmed === \"false\") return false;\n\t\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\tcase \"number\": {\n\t\t\tconst parsed = Number(unquoteStringLiteral(rawValue));\n\t\t\treturn Number.isNaN(parsed) ? INVALID_AUTHORING_ARGUMENT : parsed;\n\t\t}\n\t\tcase \"stringArray\": return parseStringArrayLiteral(rawValue);\n\t\tcase \"object\": return parsePslObjectLiteral(rawValue);\n\t\tcase \"option\": {\n\t\t\tconst trimmed = rawValue.trim();\n\t\t\treturn /^[A-Za-z_][A-Za-z0-9_]*$/.test(trimmed) ? trimmed : INVALID_AUTHORING_ARGUMENT;\n\t\t}\n\t\tdefault: return INVALID_AUTHORING_ARGUMENT;\n\t}\n}\nfunction pushInvalidPslHelperArgument(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\tmessage: `${input.entityLabel} ${input.helperLabel} ${input.message}`,\n\t\t...input.source.at(input.span)\n\t});\n}\n/**\n* The values of positional PSL arguments, each written as its PSL text in `rawArgs`, read as `descriptors` say, as the PSL reader reads a type constructor call. `undefined` when there are more arguments than descriptors or one does not parse.\n*/\nfunction parsePslPositionalArgs(descriptors, rawArgs) {\n\tif (rawArgs.length > descriptors.length) return void 0;\n\tconst values = [];\n\tfor (const [index, rawArg] of rawArgs.entries()) {\n\t\tconst descriptor = descriptors[index];\n\t\tif (descriptor === void 0) return void 0;\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, rawArg);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return void 0;\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\nfunction mapPslHelperArgs(input) {\n\tconst mappedArgs = input.descriptors.map(() => void 0);\n\tconst positionalArgs = input.args.filter((arg) => arg.kind === \"positional\");\n\tconst namedArgs = input.args.filter((arg) => arg.kind === \"named\");\n\tif (positionalArgs.length > input.descriptors.length) return pushInvalidPslHelperArgument({\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tspan: input.span,\n\t\tentityLabel: input.entityLabel,\n\t\thelperLabel: input.helperLabel,\n\t\tmessage: `accepts at most ${input.descriptors.length} argument(s), received ${positionalArgs.length}.`\n\t});\n\tfor (const [index, argument] of positionalArgs.entries()) {\n\t\tconst descriptor = input.descriptors[index];\n\t\tif (!descriptor) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `does not define positional argument #${index + 1}.`\n\t\t});\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, argument.value);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `cannot parse argument #${index + 1} for descriptor kind \"${descriptor.kind}\".`\n\t\t});\n\t\tmappedArgs[index] = value;\n\t}\n\tfor (const argument of namedArgs) {\n\t\tconst descriptorIndex = input.descriptors.findIndex((descriptor) => descriptor.name === argument.name);\n\t\tif (descriptorIndex < 0) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `received unknown named argument \"${argument.name}\".`\n\t\t});\n\t\tif (mappedArgs[descriptorIndex] !== void 0) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `received duplicate value for argument \"${argument.name}\".`\n\t\t});\n\t\tconst descriptor = input.descriptors[descriptorIndex];\n\t\tif (!descriptor) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `does not define named argument \"${argument.name}\".`\n\t\t});\n\t\tconst value = parsePslAuthoringArgumentValue(descriptor, argument.value);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return pushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `cannot parse named argument \"${argument.name}\" for descriptor kind \"${descriptor.kind}\".`\n\t\t});\n\t\tmappedArgs[descriptorIndex] = value;\n\t}\n\treturn mappedArgs;\n}\n//#endregion\n//#region src/enum-member-attributes.ts\nfunction enumMemberAttributeDiagnostics(enumBlock, sources) {\n\tconst source = diagnosticSource(sources, enumBlock.node.syntax);\n\treturn enumBlock.entries.flatMap((member) => Array.from(member.attributes(), (attribute) => ({\n\t\tcode: \"PSL_UNSUPPORTED_ENUM_MEMBER_ATTRIBUTE\",\n\t\tmessage: `enum \"${enumBlock.name}\": member \"${member.key()?.name() ?? \"?\"}\" carries @${attribute.name()?.path().join(\".\") ?? \"?\"}, but an enum member takes no attributes`,\n\t\t...source.at(nodePslSpan(attribute.syntax, sources))\n\t})));\n}\n//#endregion\n//#region src/field-presets.ts\nfunction reportPresetNotCalled(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_PRESET_NOT_CALLED\",\n\t\tmessage: `${input.entityLabel} uses field preset \"${input.presetPath}\" without calling it. Write ${input.presetPath}().`,\n\t\t...input.source.at(input.span)\n\t});\n}\n/**\n* Instantiates a field-preset call against its descriptor, coercing PSL AST arguments into the descriptor's typed argument shape and returning the preset's full set of contract contributions.\n*\n* PSL → typed-args coercion happens here (via `mapPslHelperArgs`) so that `instantiateAuthoringFieldPreset` itself stays typed-input-only and TS keeps its zero-runtime-validation cost.\n*/\nfunction instantiatePslFieldPreset(input) {\n\tconst helperPath = input.call.path.join(\".\");\n\tconst args = mapPslHelperArgs({\n\t\targs: input.call.args,\n\t\tdescriptors: input.descriptor.args ?? [],\n\t\thelperLabel: `preset \"${helperPath}\"`,\n\t\tspan: input.call.span,\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tentityLabel: input.entityLabel\n\t});\n\tif (!args) return;\n\ttry {\n\t\tvalidateAuthoringHelperArguments(helperPath, input.descriptor.args, args);\n\t\treturn instantiateAuthoringFieldPreset(input.descriptor, args);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${input.entityLabel}: ${message}`,\n\t\t\t...input.source.at(input.call.span)\n\t\t});\n\t\treturn;\n\t}\n}\n//#endregion\n//#region src/interpret.ts\n/**\n* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n* interpretation result. The authored headline is deliberately uniform — it\n* reports how many errors the schema has, never which pipeline stage found\n* them.\n*/\nfunction withSeedDiagnostics(result, seedDiagnostics) {\n\tif (seedDiagnostics.length === 0) return result;\n\tconst diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];\n\treturn notOk({\n\t\tsummary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? \"\" : \"s\"}`,\n\t\tdiagnostics,\n\t\t...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }\n\t});\n}\n/** The single seam that narrows a contract source to the interpret capability. */\nfunction hasPslInterpreter(source) {\n\treturn source.format === \"psl\" && \"interpret\" in source && typeof source.interpret === \"function\";\n}\n//#endregion\n//#region src/relation-backrelations.ts\nfunction fkRelationPairKey(declaringModelName, targetModelName) {\n\treturn `${declaringModelName}::${targetModelName}`;\n}\n/**\n* Claims the one rejected FK side that pairs with this back-relation candidate: same model pair\n* and the same relation name, where an unnamed candidate pairs only with an unnamed FK side.\n* A claimed pairing is removed, so a second candidate on the same pair reports its own problem.\n*/\nfunction consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings) {\n\tconst index = invalidFkPairings.findIndex((pairing) => pairing.pairKey === pairKey && pairing.relationName === candidate.relationName);\n\tif (index === -1) return false;\n\tinvalidFkPairings.splice(index, 1);\n\treturn true;\n}\nfunction requiredOneToOneBackrelationDiagnostic(input) {\n\tconst { modelName, field, targetModelName, sources, recordNoun } = input;\n\treturn {\n\t\tcode: \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\",\n\t\tmessage: `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}?\".`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\n//#endregion\n//#region src/type-constructor-calls.ts\nfunction isBareTypeConstructor(descriptor) {\n\treturn descriptor.entityRefArg === void 0 && (descriptor.args ?? []).every((arg) => arg.optional === true);\n}\nfunction argumentSpelling(descriptor) {\n\tconst args = descriptor.args ?? [];\n\tconst reference = descriptor.entityRefArg;\n\tconst count = Math.max(args.length, (reference?.index ?? -1) + 1);\n\tconst names = [];\n\tfor (let index = 0; index < count; index++) {\n\t\tconst arg = args[index];\n\t\tif (index === reference?.index) names.push(reference.entityKind);\n\t\telse if (arg !== void 0 && arg.optional !== true) names.push(arg.name ?? `argument${index + 1}`);\n\t}\n\treturn names.join(\", \");\n}\nfunction reportTypeConstructorNotCalled(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_TYPE_CONSTRUCTOR_NOT_CALLED\",\n\t\tmessage: `${input.entityLabel} uses type constructor \"${input.path}\" without arguments. Write ${input.path}(${argumentSpelling(input.descriptor)}).`,\n\t\t...input.source.at(input.span)\n\t});\n}\n//#endregion\n//#region src/unclaimed-blocks.ts\n/** A generic block is read only when a composed descriptor claims its keyword. */\nfunction claimedBlockKeywords(descriptors) {\n\tconst keywords = /* @__PURE__ */ new Set();\n\tfor (const [keyword, value] of Object.entries(descriptors ?? {})) if (isAuthoringPslBlockDescriptor(value)) keywords.add(keyword);\n\treturn keywords;\n}\nfunction unsupportedBlockDiagnostic(block, sources) {\n\treturn {\n\t\tcode: \"PSL_UNSUPPORTED_TOP_LEVEL_BLOCK\",\n\t\tmessage: `Unsupported top-level block \"${block.keyword}\"`,\n\t\t...diagnosticSource(sources, block.node.syntax).at(keywordPslSpan(block.node.syntax, block.keyword, sources))\n\t};\n}\n//#endregion\nexport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, instantiatePslFieldPreset, isBareTypeConstructor, mapPslHelperArgs, parsePslPositionalArgs, reportPresetNotCalled, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };\n\n//# sourceMappingURL=interpret.mjs.map"],"mappings":";;;;AAIA,SAAS,qBAAqB,OAAO;CACpC,MAAM,UAAU,MAAM,KAAK;CAC3B,MAAM,QAAQ,QAAQ,MAAM,gBAAgB;CAC5C,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO,MAAM,MAAM;AACpB;AACA,MAAM,6BAA6B,OAAO,0BAA0B;AACpE,SAAS,2BAA2B,WAAW;CAC9C,OAAO,cAAc,KAAK,KAAK,aAAa,KAAK,SAAS;AAC3D;AACA,SAAS,sBAAsB,WAAW;CACzC,OAAO,cAAc,KAAK,KAAK,gBAAgB,KAAK,SAA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G,SAAS,IAAI,OAAO;CAChI,OAAO;AACR;AACA,SAAS,2BAA2B,OAAO,SAAS;CACnD,OAAO;EACN,MAAM;EACN,SAAS,gCAAgC,MAAM,QAAQ;EACvD,GAAG,iBAAiB,SAAS,MAAM,KAAK,MAAM,CAAC,CAAC,GAAG,eAAe,MAAM,KAAK,QAAQ,MAAM,SAAS,OAAO,CAAC;CAC7G;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as TokenKind } from "./tokenizer-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { n as TokenKind } from "./tokenizer-i8RaVWVa-7fRwlCPP.mjs";
|
|
2
|
+
import { $ as TypeAnnotationAst, A as NamespaceDeclarationAst, C as IdentifierAst, D as ModelAttributeAst, E as MixinInclusionAst, F as ParseDiagnostic, G as StringLiteralExprAst, H as QualifiedNameAst, I as ParseResult, J as SyntaxKind, K as StringLiteralQuote, L as PathExprAst, M as NumberLiteralExprAst, N as ObjectFieldAst, O as ModelDeclarationAst, P as ObjectLiteralExprAst, Q as TokenAtOffset, R as Position, S as HasDocComment, T as MixinDeclarationAst, U as Range, V as PslSources, W as SourceFile, X as SyntaxToken, Y as SyntaxNode, Z as TaggedLiteralExprAst, _ as GenericBlockDeclarationAst, a as AttributeAst, b as GreenNode, c as BracedBlock, ct as filterChildren, dt as greenNode, et as TypesBlockAst, f as DocumentAst, ft as greenToken, g as FunctionCallAst, h as FieldDeclarationAst, ht as printSyntax, i as AttributeArgListAst, it as createSyntaxTree, j as NamespaceMemberAst, k as NamedTypeDeclarationAst, l as CompositeTypeDeclarationAst, lt as findChildToken, m as FieldAttributeAst, mt as parse, n as AstNode, nt as castExpression, o as BlockMemberAst, p as ExpressionAst, q as SyntaxElement, r as AttributeArgAst, s as BooleanLiteralExprAst, st as dottedPathsIn, t as ArrayLiteralAst, tt as any, u as DeclarationAst, ut as findFirstChild, v as GenericBlockMemberAst, w as KeyValuePairAst, x as GreenToken, y as GreenElement } from "./parse-By_H285C-2bZhTomA.mjs";
|
|
3
3
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/syntax.d.mts
|
|
4
4
|
//#region src/syntax/green-builder.d.ts
|
|
5
5
|
declare class GreenNodeBuilder {
|
|
@@ -27,5 +27,5 @@ declare function skipTriviaToken(token: SyntaxToken, direction: Direction): Synt
|
|
|
27
27
|
*/
|
|
28
28
|
declare function nonTriviaSibling(element: SyntaxElement, direction: Direction): SyntaxElement | undefined;
|
|
29
29
|
//#endregion
|
|
30
|
-
export { ArrayLiteralAst, type AstNode, AttributeArgAst, AttributeArgListAst, type AttributeAst, type BlockMemberAst, BooleanLiteralExprAst, type BracedBlock, CompositeTypeDeclarationAst, type DeclarationAst, type Direction, DocumentAst, type ExpressionAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, type GenericBlockMemberAst, type GreenElement, type GreenNode, GreenNodeBuilder, type GreenToken, type HasDocComment, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, type NamespaceMemberAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, type ParseDiagnostic, type ParseResult, PathExprAst, type Position, PslSources, QualifiedNameAst, type Range, SourceFile, StringLiteralExprAst, type StringLiteralQuote, type SyntaxElement, type SyntaxKind, SyntaxNode, SyntaxToken, TaggedLiteralExprAst, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, dottedPathsIn, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
30
|
+
export { ArrayLiteralAst, type AstNode, AttributeArgAst, AttributeArgListAst, type AttributeAst, type BlockMemberAst, BooleanLiteralExprAst, type BracedBlock, CompositeTypeDeclarationAst, type DeclarationAst, type Direction, DocumentAst, type ExpressionAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, type GenericBlockMemberAst, type GreenElement, type GreenNode, GreenNodeBuilder, type GreenToken, type HasDocComment, IdentifierAst, KeyValuePairAst, MixinDeclarationAst, MixinInclusionAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, type NamespaceMemberAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, type ParseDiagnostic, type ParseResult, PathExprAst, type Position, PslSources, QualifiedNameAst, type Range, SourceFile, StringLiteralExprAst, type StringLiteralQuote, type SyntaxElement, type SyntaxKind, SyntaxNode, SyntaxToken, TaggedLiteralExprAst, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, dottedPathsIn, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
31
31
|
//# sourceMappingURL=psl-parser__syntax.d.mts.map
|
|
@@ -1,44 +1,4 @@
|
|
|
1
1
|
import { a as createSyntaxTree, c as findFirstChild, i as any, l as printSyntax, n as SyntaxToken, o as filterChildren, r as TokenAtOffset, s as findChildToken, t as SyntaxNode } from "./ast-helpers-CzydMPdh-Mi0SrZRa.mjs";
|
|
2
|
-
import { C as
|
|
3
|
-
import { a as greenToken, i as greenNode, n as PslSources, o as parse, r as SourceFile, t as GreenNodeBuilder } from "./parse-
|
|
4
|
-
|
|
5
|
-
const TRIVIA_KINDS = /* @__PURE__ */ new Set([
|
|
6
|
-
"Whitespace",
|
|
7
|
-
"Newline",
|
|
8
|
-
"Comment"
|
|
9
|
-
]);
|
|
10
|
-
/** Whether a token kind is trivia (whitespace, newline, or comment). */
|
|
11
|
-
function isTriviaKind(kind) {
|
|
12
|
-
return TRIVIA_KINDS.has(kind);
|
|
13
|
-
}
|
|
14
|
-
/** Whether a token is trivia. */
|
|
15
|
-
function isTrivia(token) {
|
|
16
|
-
return isTriviaKind(token.kind);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The first non-trivia token at or beyond `token` in `direction`. Returns
|
|
20
|
-
* `token` itself when it is already significant.
|
|
21
|
-
*/
|
|
22
|
-
function skipTriviaToken(token, direction) {
|
|
23
|
-
let current = token;
|
|
24
|
-
while (current !== void 0 && isTrivia(current)) current = direction === "next" ? current.nextToken : current.prevToken;
|
|
25
|
-
return current;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The nearest sibling of `element` (within the same parent) in `direction` that
|
|
29
|
-
* is not a trivia token. Nodes are always significant.
|
|
30
|
-
*/
|
|
31
|
-
function nonTriviaSibling(element, direction) {
|
|
32
|
-
let sibling = step(element, direction);
|
|
33
|
-
while (sibling !== void 0) {
|
|
34
|
-
if (!(sibling instanceof SyntaxToken) || !isTrivia(sibling)) return sibling;
|
|
35
|
-
sibling = step(sibling, direction);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function step(element, direction) {
|
|
39
|
-
return direction === "next" ? element.nextSiblingOrToken : element.prevSiblingOrToken;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { ArrayLiteralAst, AttributeArgAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, DocumentAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, GreenNodeBuilder, IdentifierAst, KeyValuePairAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, PathExprAst, PslSources, QualifiedNameAst, SourceFile, StringLiteralExprAst, SyntaxNode, SyntaxToken, TaggedLiteralExprAst, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, dottedPathsIn, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=psl-parser__syntax.mjs.map
|
|
2
|
+
import { A as isTrivia, C as QualifiedNameAst, D as TypesBlockAst, E as TypeAnnotationAst, M as nonTriviaSibling, N as skipTriviaToken, O as castExpression, S as PathExprAst, T as TaggedLiteralExprAst, _ as NamedTypeDeclarationAst, a as CompositeTypeDeclarationAst, b as ObjectFieldAst, c as FieldDeclarationAst, d as IdentifierAst, f as KeyValuePairAst, g as ModelDeclarationAst, h as ModelAttributeAst, i as BooleanLiteralExprAst, j as isTriviaKind, k as dottedPathsIn, l as FunctionCallAst, m as MixinInclusionAst, n as AttributeArgAst, o as DocumentAst, p as MixinDeclarationAst, r as AttributeArgListAst, s as FieldAttributeAst, t as ArrayLiteralAst, u as GenericBlockDeclarationAst, v as NamespaceDeclarationAst, w as StringLiteralExprAst, x as ObjectLiteralExprAst, y as NumberLiteralExprAst } from "./declarations-CTFzoo9j-BaCuW9E2.mjs";
|
|
3
|
+
import { a as greenToken, i as greenNode, n as PslSources, o as parse, r as SourceFile, t as GreenNodeBuilder } from "./parse-pRqRBDoL-BFDjYuLU.mjs";
|
|
4
|
+
export { ArrayLiteralAst, AttributeArgAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, DocumentAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, GreenNodeBuilder, IdentifierAst, KeyValuePairAst, MixinDeclarationAst, MixinInclusionAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, PathExprAst, PslSources, QualifiedNameAst, SourceFile, StringLiteralExprAst, SyntaxNode, SyntaxToken, TaggedLiteralExprAst, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, dottedPathsIn, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TokenKind, r as Tokenizer, t as Token } from "./tokenizer-
|
|
1
|
+
import { n as TokenKind, r as Tokenizer, t as Token } from "./tokenizer-i8RaVWVa-7fRwlCPP.mjs";
|
|
2
2
|
export { type Token, type TokenKind, Tokenizer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Tokenizer } from "./tokenizer-
|
|
1
|
+
import { t as Tokenizer } from "./tokenizer-C-GTKKjR-B1vOzJy0.mjs";
|
|
2
2
|
export { Tokenizer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
|
|
2
|
-
//#region ../../../1-framework/2-authoring/psl-parser/dist/tokenizer-
|
|
2
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/tokenizer-C-GTKKjR.mjs
|
|
3
3
|
var Tokenizer = class {
|
|
4
4
|
#source;
|
|
5
5
|
#pos;
|
|
@@ -134,7 +134,7 @@ function scanKeywordNumber(source, pos) {
|
|
|
134
134
|
}
|
|
135
135
|
function scanNumber(source, pos) {
|
|
136
136
|
let end = pos;
|
|
137
|
-
if (source.charAt(end) === "-") {
|
|
137
|
+
if (source.charAt(end) === "-" || source.charAt(end) === "+") {
|
|
138
138
|
if (end + 1 >= source.length || !isDigit(source.charAt(end + 1))) return void 0;
|
|
139
139
|
end++;
|
|
140
140
|
} else if (!isDigit(source.charAt(end))) return;
|
|
@@ -263,9 +263,10 @@ const PUNCTUATION = {
|
|
|
263
263
|
"?": "Question",
|
|
264
264
|
".": "Dot",
|
|
265
265
|
",": "Comma",
|
|
266
|
-
":": "Colon"
|
|
266
|
+
":": "Colon",
|
|
267
|
+
"+": "Plus"
|
|
267
268
|
};
|
|
268
269
|
//#endregion
|
|
269
270
|
export { isPslIdentifier as n, isTerminatedStringLiteral as r, Tokenizer as t };
|
|
270
271
|
|
|
271
|
-
//# sourceMappingURL=tokenizer-
|
|
272
|
+
//# sourceMappingURL=tokenizer-C-GTKKjR-B1vOzJy0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenizer-C-GTKKjR-B1vOzJy0.mjs","names":["#source","#pos","#buffer","#scanNext"],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/tokenizer-C-GTKKjR.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\n//#region src/tokenizer.ts\nvar Tokenizer = class {\n\t#source;\n\t#pos;\n\t#buffer;\n\tconstructor(source) {\n\t\tthis.#source = source;\n\t\tthis.#pos = 0;\n\t\tthis.#buffer = [];\n\t}\n\tnext() {\n\t\tconst next = this.#buffer.shift();\n\t\tif (next) return next;\n\t\treturn this.#scanNext();\n\t}\n\tpeek(offset = 0) {\n\t\tif (offset > this.#buffer.length) {\n\t\t\tconst last = this.#buffer.at(-1);\n\t\t\tif (last?.kind === \"Eof\") return last;\n\t\t}\n\t\tconst token = this.#buffer[offset];\n\t\tif (token) return token;\n\t\twhile (this.#buffer.length <= offset) {\n\t\t\tconst token = this.#scanNext();\n\t\t\tif (token.kind === \"Eof\") return token;\n\t\t\tthis.#buffer.push(token);\n\t\t}\n\t\treturn blindCast(this.#buffer[offset]);\n\t}\n\t#scanNext() {\n\t\tconst token = scan(this.#source, this.#pos);\n\t\tthis.#pos += token.text.length;\n\t\treturn token;\n\t}\n};\n/**\n* Whether the tokenizer reads `text` as one identifier: a letter or `_`, then letters, `_`, ASCII\n* digits or `-`, and not one of the number words `NaN` and `Infinity`.\n*/\nfunction isPslIdentifier(text) {\n\tconst token = scan(text, 0);\n\treturn token.kind === \"Ident\" && token.text === text;\n}\nfunction scan(source, pos) {\n\tif (pos >= source.length) return {\n\t\tkind: \"Eof\",\n\t\ttext: \"\"\n\t};\n\treturn scanNewline(source, pos) ?? scanWhitespace(source, pos) ?? scanComment(source, pos) ?? scanAt(source, pos) ?? scanKeywordNumber(source, pos) ?? scanIdent(source, pos) ?? scanNumber(source, pos) ?? scanString(source, pos) ?? scanPunctuation(source, pos) ?? {\n\t\tkind: \"Invalid\",\n\t\ttext: readChar(source, pos)\n\t};\n}\nfunction scanNewline(source, pos) {\n\tconst ch = source.charAt(pos);\n\tif (ch !== \"\\r\" && ch !== \"\\n\") return void 0;\n\tif (ch === \"\\r\" && source.charAt(pos + 1) === \"\\n\") return {\n\t\tkind: \"Newline\",\n\t\ttext: \"\\r\\n\"\n\t};\n\treturn {\n\t\tkind: \"Newline\",\n\t\ttext: ch\n\t};\n}\nfunction scanWhitespace(source, pos) {\n\tconst ch = source.charAt(pos);\n\tif (ch !== \" \" && ch !== \"\t\") return void 0;\n\tlet end = pos + 1;\n\twhile (end < source.length) {\n\t\tconst c = source.charAt(end);\n\t\tif (c !== \" \" && c !== \"\t\") break;\n\t\tend++;\n\t}\n\treturn {\n\t\tkind: \"Whitespace\",\n\t\ttext: source.slice(pos, end)\n\t};\n}\nfunction scanComment(source, pos) {\n\tif (source.charAt(pos) !== \"/\" || source.charAt(pos + 1) !== \"/\") return void 0;\n\tlet end = pos + 2;\n\twhile (end < source.length) {\n\t\tconst c = source.charAt(end);\n\t\tif (c === \"\\n\" || c === \"\\r\") break;\n\t\tend++;\n\t}\n\treturn {\n\t\tkind: \"Comment\",\n\t\ttext: source.slice(pos, end)\n\t};\n}\nfunction scanAt(source, pos) {\n\tif (source.charAt(pos) !== \"@\") return void 0;\n\tif (source.charAt(pos + 1) === \"@\") return {\n\t\tkind: \"DoubleAt\",\n\t\ttext: \"@@\"\n\t};\n\treturn {\n\t\tkind: \"At\",\n\t\ttext: \"@\"\n\t};\n}\nfunction scanIdent(source, pos) {\n\tconst ch = readChar(source, pos);\n\tif (!isIdentStart(ch)) return void 0;\n\tlet end = pos + ch.length;\n\twhile (end < source.length) {\n\t\tconst c = readChar(source, end);\n\t\tif (isIdentPart(c)) end += c.length;\n\t\telse break;\n\t}\n\treturn {\n\t\tkind: \"Ident\",\n\t\ttext: source.slice(pos, end)\n\t};\n}\nconst KEYWORD_NUMBERS = [\n\t\"-Infinity\",\n\t\"Infinity\",\n\t\"NaN\"\n];\nfunction scanKeywordNumber(source, pos) {\n\tfor (const word of KEYWORD_NUMBERS) {\n\t\tif (!source.startsWith(word, pos)) continue;\n\t\tconst after = readChar(source, pos + word.length);\n\t\tif (after !== \"\" && isIdentPart(after)) return void 0;\n\t\treturn {\n\t\t\tkind: \"NumberLiteral\",\n\t\t\ttext: word\n\t\t};\n\t}\n}\nfunction scanNumber(source, pos) {\n\tlet end = pos;\n\tif (source.charAt(end) === \"-\" || source.charAt(end) === \"+\") {\n\t\tif (end + 1 >= source.length || !isDigit(source.charAt(end + 1))) return void 0;\n\t\tend++;\n\t} else if (!isDigit(source.charAt(end))) return;\n\tend++;\n\twhile (end < source.length && isDigit(source.charAt(end))) end++;\n\tif (source.charAt(end) === \".\" && end + 1 < source.length && isDigit(source.charAt(end + 1))) {\n\t\tend++;\n\t\twhile (end < source.length && isDigit(source.charAt(end))) end++;\n\t}\n\treturn {\n\t\tkind: \"NumberLiteral\",\n\t\ttext: source.slice(pos, end)\n\t};\n}\nconst QUOTES = /* @__PURE__ */ new Set([\n\t\"\\\"\",\n\t\"'\",\n\t\"`\"\n]);\n/**\n* A string in any of the three quote styles. A backslash escapes the next\n* character, so it never closes the string. A `\"` or `'` string ends at the\n* end of its line when unterminated. A backtick string may span lines; when\n* unterminated it ends before the first later line whose first non-blank\n* character is `}`, so the parser resumes at the block's closing brace, or at\n* the end of the input. That recovery only applies when no later backtick\n* exists: a later backtick closes the string first.\n*/\nfunction scanString(source, pos) {\n\tconst quote = source.charAt(pos);\n\tif (!QUOTES.has(quote)) return void 0;\n\tconst multiline = quote === \"`\";\n\tlet end = pos + 1;\n\twhile (end < source.length) {\n\t\tconst c = source.charAt(end);\n\t\tif (c === \"\\\\\" && end + 1 < source.length) {\n\t\t\tend += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (c === quote) {\n\t\t\tend++;\n\t\t\treturn {\n\t\t\t\tkind: \"StringLiteral\",\n\t\t\t\ttext: source.slice(pos, end)\n\t\t\t};\n\t\t}\n\t\tif (!multiline && (c === \"\\n\" || c === \"\\r\")) return {\n\t\t\tkind: \"StringLiteral\",\n\t\t\ttext: source.slice(pos, end)\n\t\t};\n\t\tend++;\n\t}\n\tconst unterminatedEnd = multiline ? unterminatedBacktickStringEnd(source, pos + 1) : end;\n\treturn {\n\t\tkind: \"StringLiteral\",\n\t\ttext: source.slice(pos, unterminatedEnd)\n\t};\n}\nfunction unterminatedBacktickStringEnd(source, from) {\n\tlet lineStart = nextLineStart(source, from);\n\twhile (lineStart !== void 0) {\n\t\tlet cursor = lineStart;\n\t\twhile (source.charAt(cursor) === \" \" || source.charAt(cursor) === \"\t\") cursor++;\n\t\tif (source.charAt(cursor) === \"}\") return lineStart;\n\t\tlineStart = nextLineStart(source, cursor);\n\t}\n\treturn source.length;\n}\n/** The offset just past the next `\\r\\n`, `\\r`, or `\\n` at or after `from`. */\nfunction nextLineStart(source, from) {\n\tfor (let index = from; index < source.length; index++) {\n\t\tconst c = source.charAt(index);\n\t\tif (c === \"\\n\") return index + 1;\n\t\tif (c === \"\\r\") return source.charAt(index + 1) === \"\\n\" ? index + 2 : index + 1;\n\t}\n}\n/**\n* `scanString` emits the same `StringLiteral` kind for well-formed and\n* unterminated strings, so callers ask here to tell them apart.\n*\n* The closing quote is unescaped iff an **even** number of backslashes precede\n* it (each `\\\\` pair cancels; an odd run leaves the final `\\` escaping the\n* quote), so counting the trailing backslash run suffices — no full re-scan:\n*\n* - `\"ok\"` → 0 backslashes (even) → terminated\n* - `'a\\'` → 1 backslash (odd) → the quote is escaped → unterminated\n* - `\"a\\\\\"` → 2 backslashes (even) → escaped `\\`, real `\"` → terminated\n*/\nfunction isTerminatedStringLiteral(text) {\n\tconst quote = text.charAt(0);\n\tif (!QUOTES.has(quote)) return false;\n\tif (text.length < 2 || text.charAt(text.length - 1) !== quote) return false;\n\tlet backslashes = 0;\n\tfor (let i = text.length - 2; i >= 1 && text.charAt(i) === \"\\\\\"; i--) backslashes++;\n\treturn backslashes % 2 === 0;\n}\nfunction scanPunctuation(source, pos) {\n\tconst kind = PUNCTUATION[source.charAt(pos)];\n\tif (kind === void 0) return void 0;\n\treturn {\n\t\tkind,\n\t\ttext: source.charAt(pos)\n\t};\n}\nfunction readChar(source, pos) {\n\tconst cp = source.codePointAt(pos);\n\treturn cp !== void 0 ? String.fromCodePoint(cp) : \"\";\n}\nfunction isIdentStart(ch) {\n\treturn /\\p{L}/u.test(ch) || ch === \"_\";\n}\nfunction isIdentPart(ch) {\n\treturn isIdentStart(ch) || isDigit(ch) || ch === \"-\";\n}\nfunction isDigit(ch) {\n\treturn ch >= \"0\" && ch <= \"9\";\n}\nconst PUNCTUATION = {\n\t\"{\": \"LBrace\",\n\t\"}\": \"RBrace\",\n\t\"(\": \"LParen\",\n\t\")\": \"RParen\",\n\t\"[\": \"LBracket\",\n\t\"]\": \"RBracket\",\n\t\"=\": \"Equals\",\n\t\"?\": \"Question\",\n\t\".\": \"Dot\",\n\t\",\": \"Comma\",\n\t\":\": \"Colon\",\n\t\"+\": \"Plus\"\n};\n//#endregion\nexport { isPslIdentifier as n, isTerminatedStringLiteral as r, Tokenizer as t };\n\n//# sourceMappingURL=tokenizer-C-GTKKjR.mjs.map"],"mappings":";;AAEA,IAAI,YAAY,MAAM;CACrB;CACA;CACA;CACA,YAAY,QAAQ;EACnB,KAAKA,UAAU;EACf,KAAKC,OAAO;EACZ,KAAKC,UAAU,CAAC;CACjB;CACA,OAAO;EACN,MAAM,OAAO,KAAKA,QAAQ,MAAM;EAChC,IAAI,MAAM,OAAO;EACjB,OAAO,KAAKC,UAAU;CACvB;CACA,KAAK,SAAS,GAAG;EAChB,IAAI,SAAS,KAAKD,QAAQ,QAAQ;GACjC,MAAM,OAAO,KAAKA,QAAQ,GAAG,EAAE;GAC/B,IAAI,MAAM,SAAS,OAAO,OAAO;EAClC;EACA,MAAM,QAAQ,KAAKA,QAAQ;EAC3B,IAAI,OAAO,OAAO;EAClB,OAAO,KAAKA,QAAQ,UAAU,QAAQ;GACrC,MAAM,QAAQ,KA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ACA,MAAM,OAAO,OAAO,GAAG;CACxB;AACD;AACA,SAAS,SAAS,QAAQ,KAAK;CAC9B,MAAM,KAAK,OAAO,YAAY,GAAG;CACjC,OAAO,OAAO,KAAK,IAAI,OAAO,cAAc,EAAE,IAAI;AACnD;AACA,SAAS,aAAa,IAAI;CACzB,OAAO,SAAS,KAAK,EAAE,KAAK,OAAO;AACpC;AACA,SAAS,YAAY,IAAI;CACxB,OAAO,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO;AAClD;AACA,SAAS,QAAQ,IAAI;CACpB,OAAO,MAAM,OAAO,MAAM;AAC3B;AACA,MAAM,cAAc;CACnB,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//#region ../../../1-framework/2-authoring/psl-parser/dist/tokenizer-
|
|
1
|
+
//#region ../../../1-framework/2-authoring/psl-parser/dist/tokenizer-i8RaVWVa.d.mts
|
|
2
2
|
//#region src/tokenizer.d.ts
|
|
3
|
-
type TokenKind = 'Ident' | 'StringLiteral' | 'NumberLiteral' | 'At' | 'DoubleAt' | 'LBrace' | 'RBrace' | 'LParen' | 'RParen' | 'LBracket' | 'RBracket' | 'Equals' | 'Question' | 'Dot' | 'Comma' | 'Colon' | 'Whitespace' | 'Newline' | 'Comment' | 'Invalid' | 'Eof';
|
|
3
|
+
type TokenKind = 'Ident' | 'StringLiteral' | 'NumberLiteral' | 'At' | 'DoubleAt' | 'LBrace' | 'RBrace' | 'LParen' | 'RParen' | 'LBracket' | 'RBracket' | 'Equals' | 'Question' | 'Dot' | 'Comma' | 'Colon' | 'Plus' | 'Whitespace' | 'Newline' | 'Comment' | 'Invalid' | 'Eof';
|
|
4
4
|
interface Token {
|
|
5
5
|
readonly kind: TokenKind;
|
|
6
6
|
readonly text: string;
|
|
@@ -18,4 +18,4 @@ declare class Tokenizer {
|
|
|
18
18
|
declare function isPslIdentifier(text: string): boolean;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { isPslIdentifier as i, TokenKind as n, Tokenizer as r, Token as t };
|
|
21
|
-
//# sourceMappingURL=tokenizer-
|
|
21
|
+
//# sourceMappingURL=tokenizer-i8RaVWVa-7fRwlCPP.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenizer-i8RaVWVa-7fRwlCPP.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/tokenizer-i8RaVWVa.d.mts"],"mappings":";;KACK;UACK;WACC,MAAM;WACN;;cAEG;;EAEZ,YAAY;EACZ,QAAQ;EACR,KAAK,kBAAkB;;;;;;iBAMR,gBAAgB"}
|