@cratis/screenplay-language 4.126.0 → 4.127.1

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.
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"../Parsing/SourceLineSplitter.js";import{expandSpecificationExamples as t}from"../Parsing/SpecificationCommandExamples.js";import{validateResponses as n}from"../Parsing/ResponseValidator.js";import{validateSpecificationCases as r}from"../Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as i}from"../Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as a}from"../Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as o}from"../Dependencies/DeclaredDependencyTargets.js";import{LineReader as s}from"../Parsing/LineReader.js";import{ParserContext as c}from"../Parsing/ParserContext.js";import"./AuthoredOrder.js";import{DeclaredDependencies as l}from"../Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as u}from"../Parsing/PublicEventUsageValidator.js";import{validateInlineEvents as d}from"../Parsing/InlineEventValidator.js";import{validateOperations as f}from"../Parsing/OperationValidator.js";import{CommandStreamCandidates as p}from"../Parsing/CommandStreamCandidates.js";import{validateEventSources as m}from"../Parsing/EventSourceValidator.js";import{validateProjectionTargets as h}from"../Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as g}from"../Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as _}from"../Parsing/EventSubjectValidator.js";import{validateReactionRefusals as v}from"../Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as y}from"../Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as b}from"../Parsing/GuardedActionValidator.js";import{validatePersonaCallers as x}from"../Parsing/PersonaCallerValidator.js";import{validatePurposes as S}from"../Parsing/PurposeValidator.js";import"./TimelineOrder.js";import{parseForAuthoring as C}from"../ScreenplayCompiler.js";import{EventSourceReadConfidence as w}from"../Syntax/EventSourceReadConfidence.js";import"./OrderingRoot.js";import{mergeDocuments as T}from"./PlayFolderMerge.js";import"./PlayImports.js";function parsePlacedDocuments(e,t){return parsePlacedDocumentsWithSyntax(e,t).result}function parsePlacedDocumentsWithSyntax(E,D){let O=p.capturePlaced(E.filter(e=>e.isPlacementResolved!==!1).map(t=>({lines:e(t.source,!1,t.path),placement:t.placement})),D),k=E.map(e=>C(e.source,e.path,e.isPlacementResolved===!1?[]:e.placement,!1,O,D)),A=k.flatMap((e,t)=>(e.value.eventSources??[]).map(e=>({source:e,placementResolved:E[t].isPlacementResolved!==!1}))),j=E.every(e=>e.isPlacementResolved!==!1)&&k.every(e=>!w.hasUnknownExtent(e.diagnostics)),M=k.map((e,t)=>E[t].isPlacementResolved===!1?{...e,value:{...e.value,eventSources:[]}}:e),N=T(M),P=new c(new s([]),void 0,D);N.value.sourceOptions!==void 0&&(P.sourceOptions=N.value.sourceOptions),r(N.value,P);let F=t(N.value);m(N.value,P),f(N.value,P),u(N.value,P),d(N.value,P),a(N.value,P),n(F,P,M.flatMap(e=>e.inputUses)),h(N.value,P),g(F,P),_(N.value,P),v(N.value,P),y(N.value,P),b(N.value,P),x(N.value,P),S(N.value,P);let I=o(N.value,P);l.validate(I,P);for(let e of i(I))P.information(e.code,e.message,e.location);let L=N.diagnostics,R=new Set(L.map(diagnosticKey)),z=[...L,...P.diagnostics.filter(e=>!R.has(diagnosticKey(e)))];return{result:{...N,value:I,diagnostics:z,success:!z.some(e=>e.severity===`error`),physicalEventSources:A,sourceInventoryComplete:j},syntax:new Map(M.map((e,t)=>[E[t].path,e.value]))}}function diagnosticKey(e){return JSON.stringify([e.code,e.location.path,e.location.line,e.location.column])}export{parsePlacedDocuments};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"../Parsing/SourceLineSplitter.js";import{expandSpecificationExamples as t}from"../Parsing/SpecificationCommandExamples.js";import{validateResponses as n}from"../Parsing/ResponseValidator.js";import{validateSpecificationCases as r}from"../Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as i}from"../Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as a}from"../Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as o}from"../Dependencies/DeclaredDependencyTargets.js";import{LineReader as s}from"../Parsing/LineReader.js";import{ParserContext as c}from"../Parsing/ParserContext.js";import"./AuthoredOrder.js";import{DeclaredDependencies as l}from"../Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as u}from"../Parsing/PublicEventUsageValidator.js";import{validateInlineEvents as d}from"../Parsing/InlineEventValidator.js";import{validateOperations as f}from"../Parsing/OperationValidator.js";import{CommandStreamCandidates as p}from"../Parsing/CommandStreamCandidates.js";import{validateEventSources as m}from"../Parsing/EventSourceValidator.js";import{validateProjectionTargets as h}from"../Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as g}from"../Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as _}from"../Parsing/EventSubjectValidator.js";import{validateReactionRefusals as v}from"../Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as y}from"../Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as b}from"../Parsing/GuardedActionValidator.js";import{validatePersonaCallers as x}from"../Parsing/PersonaCallerValidator.js";import{validatePurposes as S}from"../Parsing/PurposeValidator.js";import"./TimelineOrder.js";import{parseForAuthoring as C}from"../ScreenplayCompiler.js";import{EventSourceReadConfidence as w}from"../Syntax/EventSourceReadConfidence.js";import"./OrderingRoot.js";import{mergeDocuments as T}from"./PlayFolderMerge.js";import"./PlayImports.js";function parsePlacedDocuments(e,t){return parsePlacedDocumentsWithSyntax(e,t).result}function parsePlacedDocumentsWithSyntax(E,D){let O=p.capturePlaced(E.filter(e=>e.isPlacementResolved!==!1).map(t=>({lines:e(t.source,!1,t.path),placement:t.placement})),D),k=E.map(e=>C(e.source,e.path,e.isPlacementResolved===!1?[]:e.placement,!1,O,D)),A=k.flatMap((e,t)=>(e.value.eventSources??[]).map(e=>({source:e,placementResolved:E[t].isPlacementResolved!==!1}))),j=E.every(e=>e.isPlacementResolved!==!1)&&k.every(e=>!w.hasUnknownExtent(e.diagnostics)),M=k.map((e,t)=>E[t].isPlacementResolved===!1?{...e,value:{...e.value,eventSources:[]}}:e),N=T(M),P=new c(new s([]),void 0,D);N.value.sourceOptions!==void 0&&(P.sourceOptions=N.value.sourceOptions),P.guardedInteractions.push(...M.flatMap(e=>e.guardedInteractions)),r(N.value,P);let F=t(N.value);m(N.value,P),f(N.value,P),u(N.value,P),d(N.value,P),a(N.value,P),n(F,P,M.flatMap(e=>e.inputUses)),h(N.value,P),g(F,P),_(N.value,P),v(N.value,P),y(N.value,P),b(N.value,P),x(N.value,P),S(N.value,P);let I=o(N.value,P);l.validate(I,P);for(let e of i(I))P.information(e.code,e.message,e.location);let L=N.diagnostics,R=new Set(L.map(diagnosticKey)),z=[...L,...P.diagnostics.filter(e=>!R.has(diagnosticKey(e)))];return{result:{...N,value:I,diagnostics:z,success:!z.some(e=>e.severity===`error`),physicalEventSources:A,sourceInventoryComplete:j},syntax:new Map(M.map((e,t)=>[E[t].path,e.value]))}}function diagnosticKey(e){return JSON.stringify([e.code,e.location.path,e.location.line,e.location.column])}export{parsePlacedDocuments};
2
2
  //# sourceMappingURL=PlayApplicationAssembly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayApplicationAssembly.js","names":["documents","languages","candidates","CommandStreamCandidates","document","splitLines","physical","parseForAuthoring","physicalEventSources","result","index","sourceInventoryComplete","EventSourceReadConfidence","parsed","merged","mergeDocuments","context","ParserContext","LineReader","validateSpecificationCases","effective","expandSpecificationExamples","validateEventSources","validateOperations","validatePublicEventUsage","validateInlineEvents","validateConstraintProperties","validateResponses","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validatePurposes","value","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","existing","reported","all"],"sources":["../../../../../../Compiler/Files/PlayApplicationAssembly.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n validateSpecificationCases(merged.value, context);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n"],"mappings":"4nEAoEA,SAAgB,qBAAqB,EAA0C,EAG7E,CACE,OAAO,+BAA+BA,EAAWC,CAAS,CAAC,CAAC,MAChE,CAEA,SAAS,+BAA+B,EAA0C,EAAiC,CAC/G,IAAMC,EAAaC,EAAwB,cAAcH,EAAU,OAAO,GAAYI,EAAS,sBAAwB,EAAK,CAAC,CAAC,IAAI,IAAa,CAAE,MAAOC,EAAWD,EAAS,OAAQ,GAAOA,EAAS,IAAI,EAAG,UAAWA,EAAS,SAAU,EAAE,EAA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,MAAOE,CAAO,EAC9CgB,EAAgClB,EAAO,MAAOE,CAAO,EACrDiB,EAAuBnB,EAAO,MAAOE,CAAO,EAC5CkB,EAAuBpB,EAAO,MAAOE,CAAO,EAC5CmB,EAAiBrB,EAAO,MAAOE,CAAO,EACtC,IAAMoB,EAAQC,EAA+BvB,EAAO,MAAOE,CAAO,EAClEsB,EAAqB,SAASF,EAAOpB,CAAO,EAC5C,IAAK,IAAMuB,KAAcC,EAAiCJ,CAAK,EAAGpB,EAAQ,YAAYuB,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC9I,IAAME,EAAW3B,EAAO,YAClB4B,EAAW,IAAI,IAAID,EAAS,IAAI,aAAa,CAAC,EAC9CE,EAAM,CAAC,GAAGF,EAAU,GAAGzB,EAAQ,YAAY,OAAO,GAAc,CAAC0B,EAAS,IAAI,cAAcH,CAAU,CAAC,CAAC,CAAC,EAC/G,MAAO,CACH,OAAQ,CAAE,GAAGzB,EAAQ,QAAO,YAAa6B,EAAK,QAAS,CAACA,EAAI,KAAK,GAAcJ,EAAW,WAAa,OAAO,EAAG,uBAAsB,yBAAwB,EAC/J,OAAQ,IAAI,IAAI1B,EAAO,KAAK,EAAQ,IAAU,CAACb,EAAUU,EAAM,CAAC,KAAMD,EAAO,KAAK,CAAC,CAAC,CACxF,CACJ,CAEA,SAAS,cAAc,EAAgC,CACnD,OAAO,KAAK,UAAU,CAAC8B,EAAW,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,MAAM,CAAC,CAC3H"}
1
+ {"version":3,"file":"PlayApplicationAssembly.js","names":["documents","languages","candidates","CommandStreamCandidates","document","splitLines","physical","parseForAuthoring","physicalEventSources","result","index","sourceInventoryComplete","EventSourceReadConfidence","parsed","merged","mergeDocuments","context","ParserContext","LineReader","validateSpecificationCases","effective","expandSpecificationExamples","validateEventSources","validateOperations","validatePublicEventUsage","validateInlineEvents","validateConstraintProperties","validateResponses","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validatePurposes","value","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","existing","reported","all"],"sources":["../../../../../../Compiler/Files/PlayApplicationAssembly.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n context.guardedInteractions.push(...parsed.flatMap(document => document.guardedInteractions));\n validateSpecificationCases(merged.value, context);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n"],"mappings":"4nEAoEA,SAAgB,qBAAqB,EAA0C,EAG7E,CACE,OAAO,+BAA+BA,EAAWC,CAAS,CAAC,CAAC,MAChE,CAEA,SAAS,+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AAM,CAAC,CAC3H"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";function validateGuardedActionShadowing(t,n){let r=[];for(let i of t.alternatives){let t=normalize(i.condition);t!==null&&(t.length>0&&t.every(e=>r.some(t=>[...t].every(t=>e.has(t))))&&n.warning(e.UnreachableActionAlternative,`Alternative executing '${i.command}' is shadowed by earlier alternatives in this action`,i.location),r.push(...t))}}function normalize(e){if(e.kind===`ComparisonConditionSyntax`){if(e.right.kind!==`LiteralExpressionSyntax`)return null;let t=e.right.value,n=JSON.stringify([e.left,e.operator,typeof t,typeof t==`object`&&t?t.value:typeof t==`number`?String(t):t]);return[/* @__PURE__ */ new Set([n])]}let t=normalize(e.left),n=normalize(e.right);return t===null||n===null?null:e.operator===`Or`?t.length+n.length>64?null:[...t,...n]:t.length*n.length>64?null:t.flatMap(e=>n.map(t=>/* @__PURE__ */ new Set([...e,...t])))}export{validateGuardedActionShadowing};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";function validateGuardedActionShadowing(e,t){validateAlternativeShadowing(e.alternatives.map(e=>({...e,message:`Alternative executing '${e.command}' is shadowed by earlier alternatives in this action`})),t)}function validateAlternativeShadowing(t,n){let r=[];for(let i of t){let t=normalize(i.condition);t!==null&&(t.length>0&&t.every(e=>r.some(t=>[...t].every(t=>e.has(t))))&&n.warning(e.UnreachableActionAlternative,i.message,i.location),r.push(...t))}}function normalize(e){if(e.kind===`ComparisonConditionSyntax`){if(e.right.kind!==`LiteralExpressionSyntax`)return null;let t=e.right.value,n=JSON.stringify([e.left,e.operator,typeof t,typeof t==`object`&&t?t.value:typeof t==`number`?String(t):t]);return[/* @__PURE__ */ new Set([n])]}let t=normalize(e.left),n=normalize(e.right);return t===null||n===null?null:e.operator===`Or`?t.length+n.length>64?null:[...t,...n]:t.length*n.length>64?null:t.flatMap(e=>n.map(t=>/* @__PURE__ */ new Set([...e,...t])))}export{validateAlternativeShadowing,validateGuardedActionShadowing};
2
2
  //# sourceMappingURL=GuardedActionShadowing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuardedActionShadowing.js","names":["earlier","alternative","action","terms","previous","term","comparison","context","DiagnosticCodes","condition","value","left","right","first","second"],"sources":["../../../../../../Compiler/Parsing/GuardedActionShadowing.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ParserContext } from './ParserContext';\n\nconst maximumDisjuncts = 64;\n\n// Proves shadowing by comparison-set inclusion, bounding each DNF expansion to 64 disjuncts.\nexport function validateGuardedActionShadowing(action: ScreenGuardedActionSyntax, context: ParserContext): void {\n const earlier: ReadonlySet<string>[] = [];\n for (const alternative of action.alternatives) {\n const terms = normalize(alternative.condition);\n if (terms === null) continue;\n if (terms.length > 0 && terms.every(term => earlier.some(previous => [...previous].every(comparison => term.has(comparison))))) {\n context.warning(DiagnosticCodes.UnreachableActionAlternative, `Alternative executing '${alternative.command}' is shadowed by earlier alternatives in this action`, alternative.location);\n }\n earlier.push(...terms);\n }\n}\n\nfunction normalize(condition: ConditionSyntax): ReadonlySet<string>[] | null {\n if (condition.kind === 'ComparisonConditionSyntax') {\n if (condition.right.kind !== 'LiteralExpressionSyntax') return null;\n const value = condition.right.value;\n // Preserve literal type as well as value (null, text, Boolean, Double or exact Decimal).\n const comparison = JSON.stringify([condition.left, condition.operator, typeof value, value !== null && typeof value === 'object' ? value.value : typeof value === 'number' ? String(value) : value]);\n return [new Set([comparison])];\n }\n const left = normalize(condition.left);\n const right = normalize(condition.right);\n if (left === null || right === null) return null;\n if (condition.operator === 'Or') return left.length + right.length > maximumDisjuncts ? null : [...left, ...right];\n if (left.length * right.length > maximumDisjuncts) return null;\n return left.flatMap(first => right.map(second => new Set([...first, ...second])));\n}\n"],"mappings":"yHAWA,SAAgB,+BAA+B,EAAmC,EAA8B,CAC5G,IAAMA,EAAiC,CAAC,EACxC,IAAK,IAAMC,KAAeC,EAAO,aAAc,CAC3C,IAAMC,EAAQ,UAAUF,EAAY,SAAS,EACzCE,IAAU,OACVA,EAAM,OAAS,GAAKA,EAAM,MAAM,GAAQH,EAAQ,KAAK,GAAY,CAAC,GAAGI,CAAQ,CAAC,CAAC,MAAM,GAAcC,EAAK,IAAIC,CAAU,CAAC,CAAC,CAAC,GACzHC,EAAQ,QAAQC,EAAgB,6BAA8B,0BAA0BP,EAAY,QAAQ,sDAAuDA,EAAY,QAAQ,EAE3LD,EAAQ,KAAK,GAAGG,CAAK,EACzB,CACJ,CAEA,SAAS,UAAU,EAA0D,CACzE,GAAIM,EAAU,OAAS,4BAA6B,CAChD,GAAIA,EAAU,MAAM,OAAS,0BAA2B,OAAO,KAC/D,IAAMC,EAAQD,EAAU,MAAM,MAExBH,EAAa,KAAK,UAAU,CAACG,EAAU,KAAMA,EAAU,SAAU,OAAOC,EAAyB,OAAOA,GAAU,UAAnCA,EAA8CA,EAAM,MAAQ,OAAOA,GAAU,SAAW,OAAOA,CAAK,EAAIA,CAAK,CAAC,EACnM,MAAO,iBAAC,IAAI,IAAI,CAACJ,CAAU,CAAC,CAAC,CACjC,CACA,IAAMK,EAAO,UAAUF,EAAU,IAAI,EAC/BG,EAAQ,UAAUH,EAAU,KAAK,EAIvC,OAHIE,IAAS,MAAQC,IAAU,KAAa,KACxCH,EAAU,WAAa,KAAaE,EAAK,OAASC,EAAM,OAAS,GAAmB,KAAO,CAAC,GAAGD,EAAM,GAAGC,CAAK,EAC7GD,EAAK,OAASC,EAAM,OAAS,GAAyB,KACnDD,EAAK,QAAQ,GAASC,EAAM,IAAI,mBAAU,IAAI,IAAI,CAAC,GAAGC,EAAO,GAAGC,CAAM,CAAC,CAAC,CAAC,CACpF"}
1
+ {"version":3,"file":"GuardedActionShadowing.js","names":["action","alternative","context","earlier","alternatives","terms","previous","term","comparison","DiagnosticCodes","condition","value","left","right","first","second"],"sources":["../../../../../../Compiler/Parsing/GuardedActionShadowing.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ParserContext } from './ParserContext';\n\nconst maximumDisjuncts = 64;\n\nexport interface ShadowingAlternative {\n readonly condition: ConditionSyntax;\n readonly location: SourceLocation;\n readonly message: string;\n}\n\nexport function validateGuardedActionShadowing(action: ScreenGuardedActionSyntax, context: ParserContext): void {\n validateAlternativeShadowing(action.alternatives.map(alternative => ({ ...alternative, message: `Alternative executing '${alternative.command}' is shadowed by earlier alternatives in this action` })), context);\n}\n\n// Proves shadowing by comparison-set inclusion, bounding each DNF expansion to 64 disjuncts.\nexport function validateAlternativeShadowing(alternatives: readonly ShadowingAlternative[], context: ParserContext): void {\n const earlier: ReadonlySet<string>[] = [];\n for (const alternative of alternatives) {\n const terms = normalize(alternative.condition);\n if (terms === null) continue;\n if (terms.length > 0 && terms.every(term => earlier.some(previous => [...previous].every(comparison => term.has(comparison))))) {\n context.warning(DiagnosticCodes.UnreachableActionAlternative, alternative.message, alternative.location);\n }\n earlier.push(...terms);\n }\n}\n\nfunction normalize(condition: ConditionSyntax): ReadonlySet<string>[] | null {\n if (condition.kind === 'ComparisonConditionSyntax') {\n if (condition.right.kind !== 'LiteralExpressionSyntax') return null;\n const value = condition.right.value;\n // Preserve literal type as well as value (null, text, Boolean, Double or exact Decimal).\n const comparison = JSON.stringify([condition.left, condition.operator, typeof value, value !== null && typeof value === 'object' ? value.value : typeof value === 'number' ? String(value) : value]);\n return [new Set([comparison])];\n }\n const left = normalize(condition.left);\n const right = normalize(condition.right);\n if (left === null || right === null) return null;\n if (condition.operator === 'Or') return left.length + right.length > maximumDisjuncts ? null : [...left, ...right];\n if (left.length * right.length > maximumDisjuncts) return null;\n return left.flatMap(first => right.map(second => new Set([...first, ...second])));\n}\n"],"mappings":"yHAiBA,SAAgB,+BAA+B,EAAmC,EAA8B,CAC5G,6BAA6BA,EAAO,aAAa,IAAI,IAAgB,CAAE,GAAGC,EAAa,QAAS,0BAA0BA,EAAY,QAAQ,qDAAsD,EAAE,EAAGC,CAAO,CACpN,CAGA,SAAgB,6BAA6B,EAA+C,EAA8B,CACtH,IAAMC,EAAiC,CAAC,EACxC,IAAK,IAAMF,KAAeG,EAAc,CACpC,IAAMC,EAAQ,UAAUJ,EAAY,SAAS,EACzCI,IAAU,OACVA,EAAM,OAAS,GAAKA,EAAM,MAAM,GAAQF,EAAQ,KAAK,GAAY,CAAC,GAAGG,CAAQ,CAAC,CAAC,MAAM,GAAcC,EAAK,IAAIC,CAAU,CAAC,CAAC,CAAC,GACzHN,EAAQ,QAAQO,EAAgB,6BAA8BR,EAAY,QAASA,EAAY,QAAQ,EAE3GE,EAAQ,KAAK,GAAGE,CAAK,EACzB,CACJ,CAEA,SAAS,UAAU,EAA0D,CACzE,GAAIK,EAAU,OAAS,4BAA6B,CAChD,GAAIA,EAAU,MAAM,OAAS,0BAA2B,OAAO,KAC/D,IAAMC,EAAQD,EAAU,MAAM,MAExBF,EAAa,KAAK,UAAU,CAACE,EAAU,KAAMA,EAAU,SAAU,OAAOC,EAAyB,OAAOA,GAAU,UAAnCA,EAA8CA,EAAM,MAAQ,OAAOA,GAAU,SAAW,OAAOA,CAAK,EAAIA,CAAK,CAAC,EACnM,MAAO,iBAAC,IAAI,IAAI,CAACH,CAAU,CAAC,CAAC,CACjC,CACA,IAAMI,EAAO,UAAUF,EAAU,IAAI,EAC/BG,EAAQ,UAAUH,EAAU,KAAK,EAIvC,OAHIE,IAAS,MAAQC,IAAU,KAAa,KACxCH,EAAU,WAAa,KAAaE,EAAK,OAASC,EAAM,OAAS,GAAmB,KAAO,CAAC,GAAGD,EAAM,GAAGC,CAAK,EAC7GD,EAAK,OAASC,EAAM,OAAS,GAAyB,KACnDD,EAAK,QAAQ,GAASC,EAAM,IAAI,mBAAU,IAAI,IAAI,CAAC,GAAGC,EAAO,GAAGC,CAAM,CAAC,CAAC,CAAC,CACpF"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{RefusalDeclarations as t}from"./RefusalDeclarations.js";import{validateGuardedActionShadowing as n}from"./GuardedActionShadowing.js";const r=/* @__PURE__ */ new Set([`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`]);function validateGuardedActions(e,n){let r=new t(e);for(let{slice:e}of r.slices)for(let t of e.screens)validateContainer(t.directives,[],e,r,n)}function validateContainer(e,t,n,r,i){let a=e.filter(e=>e.kind===`ScreenDataSyntax`),o=a.length===0?t:a;for(let t of e)switch(t.kind){case`ScreenGuardedActionSyntax`:validateAction(t,o,n,r,i);break;case`ScreenSectionSyntax`:validateContainer(t.directives,o,n,r,i);break;case`ScreenTemplateReferenceSyntax`:for(let e of t.slots)validateContainer(e.directives,o,n,r,i)}}function viewProperties(e,t,n){return n.resolve(e,t,e=>e.readModels)?.node.properties??null}function validateAction(t,r,i,a,o){let s=r.length===1?viewProperties(r[0].type.name,i,a):null;r.length!==1&&o.warning(e.UnresolvedActionSubject,`A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved`,t.location);for(let e of t.alternatives){for(let t of comparisons(e.condition))validateItemPath(t.left,t.location,s,i,a,o);validateArguments(e.command,e.arguments,s,i,a,o)}t.otherwise?.command!=null&&validateArguments(t.otherwise.command,t.otherwise.arguments,s,i,a,o),n(t,o)}function validateArguments(t,n,r,i,a,o){let s=a.resolve(t,i,e=>e.commands)?.node;for(let c of n){let n=s?.properties.filter(e=>e.name===c.name);n?.length===0&&o.warning(e.UnknownActionArgumentProperty,`Command '${t}' has no argument property '${c.name}'`,c.location);let l=validateItemPath(c.binding,c.location,r,i,a,o,!0);n?.length===1&&l!==null&&n[0].type.isCollection!==l.type.isCollection&&o.warning(e.UnknownActionArgumentProperty,`Command argument '${t}.${c.name}' and subject field '${c.binding}' must have matching collection cardinality`,c.location)}}function validateItemPath(t,n,i,a,o,s,c=!1){if(!t.startsWith(`item.`)||i===null)return null;let l=t.substring(5).split(`.`);for(let[u,d]of l.entries()){let f=i.filter(e=>e.name===d);if(f.length===0||f.length===1&&f[0].type.isCollection&&(!c||u<l.length-1))return s.warning(e.UnknownActionSubjectField,`Unknown or collection-valued subject field '${t}' - guarded actions require an item field path`,n),null;if(f.length!==1)return null;if(u===l.length-1)return f[0];let p=f[0].type;if(i=o.types.get(p.name)?.properties??viewProperties(p.name,a,o),i===null)return(r.has(p.name)||o.application.concepts.some(e=>e.name===p.name)&&!o.application.types.some(e=>e.name===p.name))&&s.warning(e.UnknownActionSubjectField,`Subject field '${t}' continues past scalar '${d}'`,n),null}return null}function comparisons(e){return e.kind===`ComparisonConditionSyntax`?[e]:[...comparisons(e.left),...comparisons(e.right)]}export{validateGuardedActions};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{RefusalDeclarations as t}from"./RefusalDeclarations.js";import{validateAlternativeShadowing as n,validateGuardedActionShadowing as r}from"./GuardedActionShadowing.js";const i=/* @__PURE__ */ new Set([`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`]);function validateGuardedActions(e,r){let i=new t(e),a=r.guardedInteractions.filter(e=>!e.ancestors.some(e=>e.keyword===`screen`));for(let e of orderStructuralInteractions(a))n(e.alternatives,r);for(let{slice:e}of i.slices)for(let t of e.screens)validateContainer(t.directives,[],e,i,r)}function validateContainer(e,t,n,r,i){let a=e.filter(e=>e.kind===`ScreenDataSyntax`),o=a.length===0?t:a;for(let t of e)switch(t.kind){case`ScreenGuardedActionSyntax`:validateAction(t,o,n,r,i);break;case`ScreenBehaviorSyntax`:validateInteractionAt(t.location,i);break;case`ScreenTableSyntax`:case`ScreenComponentSyntax`:validateInteractionDirectives([t],i);break;case`ScreenSectionSyntax`:validateContainer(t.directives,o,n,r,i);break;case`ScreenTemplateReferenceSyntax`:for(let e of t.slots)validateContainer(e.directives,o,n,r,i)}}const a={application:[`behavior`,`layout`,`module`],module:[`screen template`,`dialog`,`form`,`contribute`,`feature`,`on`],feature:[`feature`,`slice`,`contribute`,`on`],layout:[`slot`,`arrangement`,`on`],"screen template":[`slot`,`arrangement`,`on`],dialog:[`slot`,`arrangement`,`on`]};function orderStructuralInteractions(e){let children=(e,t,n)=>{let r=/* @__PURE__ */ new Map;for(let n of e){let e=n.ancestors[t]??{keyword:`on`,location:n.location},i=JSON.stringify(e.location);r.has(i)||r.set(i,{ancestor:e,bindings:[]}),r.get(i).bindings.push(n)}let i=a[n]??[],rank=e=>i.includes(e)?i.indexOf(e):i.length;return[...r.values()].sort((e,t)=>rank(e.ancestor.keyword)-rank(t.ancestor.keyword)).flatMap(e=>e.ancestor.keyword===`on`?e.bindings:children(e.bindings,t+1,e.ancestor.keyword))};return children(e,0,`application`)}function sameLocation(e,t){return e.path===t.path&&e.line===t.line&&e.column===t.column}function validateInteractionAt(e,t,r=!1){for(let i of t.guardedInteractions){let a=r?i.ancestors.at(-1)?.location:i.location;a!==void 0&&sameLocation(a,e)&&n(i.alternatives,t)}}function validateInteractionDirectives(e,t){for(let n of e)switch(n.kind){case`ScreenBehaviorSyntax`:validateInteractionAt(n.location,t);break;case`ScreenTableSyntax`:validateInteractionAt(n.location,t,!0);break;case`ScreenComponentSyntax`:validateInteractionAt(n.location,t,!0);for(let e of n.outlets)validateInteractionDirectives(e.directives,t);break;case`ScreenSectionSyntax`:validateInteractionDirectives(n.directives,t);break;case`ScreenTemplateReferenceSyntax`:for(let e of n.slots)validateInteractionDirectives(e.directives,t)}}function viewProperties(e,t,n){return n.resolve(e,t,e=>e.readModels)?.node.properties??null}function validateAction(t,n,i,a,o){let s=n.length===1?viewProperties(n[0].type.name,i,a):null;n.length!==1&&o.warning(e.UnresolvedActionSubject,`A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved`,t.location);for(let e of t.alternatives){for(let t of comparisons(e.condition))validateItemPath(t.left,t.location,s,i,a,o);validateArguments(e.command,e.arguments,s,i,a,o)}t.otherwise?.command!=null&&validateArguments(t.otherwise.command,t.otherwise.arguments,s,i,a,o),r(t,o)}function validateArguments(t,n,r,i,a,o){let s=a.resolve(t,i,e=>e.commands)?.node;for(let c of n){let n=s?.properties.filter(e=>e.name===c.name);n?.length===0&&o.warning(e.UnknownActionArgumentProperty,`Command '${t}' has no argument property '${c.name}'`,c.location);let l=validateItemPath(c.binding,c.location,r,i,a,o,!0);n?.length===1&&l!==null&&n[0].type.isCollection!==l.type.isCollection&&o.warning(e.UnknownActionArgumentProperty,`Command argument '${t}.${c.name}' and subject field '${c.binding}' must have matching collection cardinality`,c.location)}}function validateItemPath(t,n,r,a,o,s,c=!1){if(!t.startsWith(`item.`)||r===null)return null;let l=t.substring(5).split(`.`);for(let[u,d]of l.entries()){let f=r.filter(e=>e.name===d);if(f.length===0||f.length===1&&f[0].type.isCollection&&(!c||u<l.length-1))return s.warning(e.UnknownActionSubjectField,`Unknown or collection-valued subject field '${t}' - guarded actions require an item field path`,n),null;if(f.length!==1)return null;if(u===l.length-1)return f[0];let p=f[0].type;if(r=o.types.get(p.name)?.properties??viewProperties(p.name,a,o),r===null)return(i.has(p.name)||o.application.concepts.some(e=>e.name===p.name)&&!o.application.types.some(e=>e.name===p.name))&&s.warning(e.UnknownActionSubjectField,`Subject field '${t}' continues past scalar '${d}'`,n),null}return null}function comparisons(e){return e.kind===`ComparisonConditionSyntax`?[e]:[...comparisons(e.left),...comparisons(e.right)]}export{validateGuardedActions};
2
2
  //# sourceMappingURL=GuardedActionValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuardedActionValidator.js","names":["primitives","declarations","RefusalDeclarations","application","screen","slice","context","local","directives","directive","subjects","inherited","slot","name","candidate","properties","DiagnosticCodes","action","alternative","comparison","validateGuardedActionShadowing","command","commandName","argument","arguments_","inputs","property","subjectProperty","path","segments","index","segment","matches","allowTerminalCollection","location","type","concept","composite","condition"],"sources":["../../../../../../Compiler/Parsing/GuardedActionValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ComparisonConditionSyntax, ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { InteractionArgumentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { validateGuardedActionShadowing } from './GuardedActionShadowing';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nconst primitives = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// Resolves known subject and input shapes without guessing imported or ambiguous declarations.\nexport function validateGuardedActions(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(application);\n for (const { slice } of declarations.slices) {\n for (const screen of slice.screens) validateContainer(screen.directives, [], slice, declarations, context);\n }\n}\n\nfunction validateContainer(directives: readonly ScreenDirectiveSyntax[], inherited: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const local = directives.filter(directive => directive.kind === 'ScreenDataSyntax');\n const subjects = local.length === 0 ? inherited : local;\n for (const directive of directives) {\n switch (directive.kind) {\n case 'ScreenGuardedActionSyntax':\n validateAction(directive, subjects, slice, declarations, context);\n break;\n case 'ScreenSectionSyntax':\n validateContainer(directive.directives, subjects, slice, declarations, context);\n break;\n case 'ScreenTemplateReferenceSyntax':\n for (const slot of directive.slots) validateContainer(slot.directives, subjects, slice, declarations, context);\n break;\n }\n }\n}\n\nfunction viewProperties(name: string, slice: SliceSyntax, declarations: RefusalDeclarations): readonly PropertySyntax[] | null {\n return declarations.resolve(name, slice, candidate => candidate.readModels)?.node.properties ?? null;\n}\n\nfunction validateAction(action: ScreenGuardedActionSyntax, subjects: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const properties = subjects.length === 1 ? viewProperties(subjects[0].type.name, slice, declarations) : null;\n if (subjects.length !== 1) {\n context.warning(DiagnosticCodes.UnresolvedActionSubject, \"A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved\", action.location);\n }\n for (const alternative of action.alternatives) {\n for (const comparison of comparisons(alternative.condition)) validateItemPath(comparison.left, comparison.location, properties, slice, declarations, context);\n validateArguments(alternative.command, alternative.arguments, properties, slice, declarations, context);\n }\n if (action.otherwise?.command != null) validateArguments(action.otherwise.command, action.otherwise.arguments, properties, slice, declarations, context);\n validateGuardedActionShadowing(action, context);\n}\n\nfunction validateArguments(commandName: string, arguments_: readonly InteractionArgumentSyntax[], properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const command = declarations.resolve(commandName, slice, candidate => candidate.commands)?.node;\n for (const argument of arguments_) {\n const inputs = command?.properties.filter(property => property.name === argument.name);\n if (inputs?.length === 0) context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command '${commandName}' has no argument property '${argument.name}'`, argument.location);\n const subjectProperty = validateItemPath(argument.binding, argument.location, properties, slice, declarations, context, true);\n if (inputs?.length === 1 && subjectProperty !== null && inputs[0].type.isCollection !== subjectProperty.type.isCollection) {\n context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command argument '${commandName}.${argument.name}' and subject field '${argument.binding}' must have matching collection cardinality`, argument.location);\n }\n }\n}\n\nfunction validateItemPath(path: string, location: SourceLocation, properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext, allowTerminalCollection = false): PropertySyntax | null {\n if (!path.startsWith('item.') || properties === null) return null;\n const segments = path.substring('item.'.length).split('.');\n for (const [index, segment] of segments.entries()) {\n const matches: readonly PropertySyntax[] = properties.filter(property => property.name === segment);\n if (matches.length === 0 || (matches.length === 1 && matches[0].type.isCollection && (!allowTerminalCollection || index < segments.length - 1))) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Unknown or collection-valued subject field '${path}' - guarded actions require an item field path`, location);\n return null;\n }\n if (matches.length !== 1) return null;\n if (index === segments.length - 1) return matches[0];\n const type = matches[0].type;\n properties = declarations.types.get(type.name)?.properties ?? viewProperties(type.name, slice, declarations);\n if (properties === null) {\n if (primitives.has(type.name) || declarations.application.concepts.some(concept => concept.name === type.name) && !declarations.application.types.some(composite => composite.name === type.name)) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Subject field '${path}' continues past scalar '${segment}'`, location);\n }\n return null;\n }\n }\n return null;\n}\n\nfunction comparisons(condition: ConditionSyntax): readonly ComparisonConditionSyntax[] {\n return condition.kind === 'ComparisonConditionSyntax' ? [condition] : [...comparisons(condition.left), ...comparisons(condition.right)];\n}\n"],"mappings":"qQAaA,MAAMA,kBAAa,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG3F,SAAgB,uBAAuB,EAAgC,EAA8B,CACjG,IAAMC,EAAe,IAAIC,EAAoBC,CAAW,EACxD,IAAK,GAAM,CAAE,WAAWF,EAAa,OACjC,IAAK,IAAMG,KAAUC,EAAM,QAAS,kBAAkBD,EAAO,WAAY,CAAC,EAAGC,EAAOJ,EAAcK,CAAO,CAEjH,CAEA,SAAS,kBAAkB,EAA8C,EAAwC,EAAoB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G,EAAOH,EAAQ,EAAE,CAAC,KAExB,GADA,EAAa/B,EAAa,MAAM,IAAIkC,EAAK,IAAI,CAAC,EAAE,YAAc,eAAeA,EAAK,KAAM9B,EAAOJ,CAAY,EACvGc,IAAe,KAIf,OAHIf,EAAW,IAAImC,EAAK,IAAI,GAAKlC,EAAa,YAAY,SAAS,KAAK,GAAWmC,EAAQ,OAASD,EAAK,IAAI,GAAK,CAAClC,EAAa,YAAY,MAAM,KAAK,GAAaoC,EAAU,OAASF,EAAK,IAAI,IAC5L7B,EAAQ,QAAQU,EAAgB,0BAA2B,kBAAkBY,EAAK,2BAA2BG,EAAQ,GAAIG,CAAQ,EAE9H,IAEf,CACA,OAAO,IACX,CAEA,SAAS,YAAY,EAAkE,CACnF,OAAOI,EAAU,OAAS,4BAA8B,CAACA,CAAS,EAAI,CAAC,GAAG,YAAYA,EAAU,IAAI,EAAG,GAAG,YAAYA,EAAU,KAAK,CAAC,CAC1I"}
1
+ {"version":3,"file":"GuardedActionValidator.js","names":["primitives","declarations","RefusalDeclarations","application","structural","context","binding","ancestor","validateAlternativeShadowing","screen","slice","local","directives","directive","subjects","inherited","slot","structuralChildren","groups","group","depth","key","order","parent","keyword","first","second","entry","bindings","attachment","container","location","outlet","name","candidate","properties","DiagnosticCodes","action","alternative","comparison","validateGuardedActionShadowing","command","commandName","argument","arguments_","inputs","property","subjectProperty","path","segments","index","segment","matches","allowTerminalCollection","type","concept","composite","condition"],"sources":["../../../../../../Compiler/Parsing/GuardedActionValidator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ComparisonConditionSyntax, ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { InteractionArgumentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { validateAlternativeShadowing, validateGuardedActionShadowing } from './GuardedActionShadowing';\nimport { GuardedInteractionBinding, InteractionAncestor } from './InteractionAlternatives';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nconst primitives = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// Resolves known subject and input shapes without guessing imported or ambiguous declarations.\nexport function validateGuardedActions(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(application);\n // C# walks structural attachments (including named behaviors) before screen directives.\n const structural = context.guardedInteractions.filter(binding => !binding.ancestors.some(ancestor => ancestor.keyword === 'screen'));\n for (const binding of orderStructuralInteractions(structural)) validateAlternativeShadowing(binding.alternatives, context);\n for (const { slice } of declarations.slices) {\n for (const screen of slice.screens) validateContainer(screen.directives, [], slice, declarations, context);\n }\n}\n\nfunction validateContainer(directives: readonly ScreenDirectiveSyntax[], inherited: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const local = directives.filter(directive => directive.kind === 'ScreenDataSyntax');\n const subjects = local.length === 0 ? inherited : local;\n for (const directive of directives) {\n switch (directive.kind) {\n case 'ScreenGuardedActionSyntax':\n validateAction(directive, subjects, slice, declarations, context);\n break;\n case 'ScreenBehaviorSyntax':\n validateInteractionAt(directive.location, context);\n break;\n case 'ScreenTableSyntax':\n case 'ScreenComponentSyntax':\n validateInteractionDirectives([directive], context);\n break;\n case 'ScreenSectionSyntax':\n validateContainer(directive.directives, subjects, slice, declarations, context);\n break;\n case 'ScreenTemplateReferenceSyntax':\n for (const slot of directive.slots) validateContainer(slot.directives, subjects, slice, declarations, context);\n break;\n }\n }\n}\n\n// Match the C# walker's child-collection order, not the source order of opaque attachments.\nconst structuralChildren: Readonly<Record<string, readonly string[]>> = {\n application: ['behavior', 'layout', 'module'],\n module: ['screen template', 'dialog', 'form', 'contribute', 'feature', 'on'],\n feature: ['feature', 'slice', 'contribute', 'on'],\n layout: ['slot', 'arrangement', 'on'],\n 'screen template': ['slot', 'arrangement', 'on'],\n dialog: ['slot', 'arrangement', 'on'],\n};\n\nfunction orderStructuralInteractions(bindings: readonly GuardedInteractionBinding[]): readonly GuardedInteractionBinding[] {\n const children = (group: readonly GuardedInteractionBinding[], depth: number, parent: string): GuardedInteractionBinding[] => {\n const groups = new Map<string, { ancestor: InteractionAncestor; bindings: GuardedInteractionBinding[] }>();\n for (const binding of group) {\n const ancestor = binding.ancestors[depth] ?? { keyword: 'on', location: binding.location };\n const key = JSON.stringify(ancestor.location);\n if (!groups.has(key)) groups.set(key, { ancestor, bindings: [] });\n groups.get(key)!.bindings.push(binding);\n }\n const order = structuralChildren[parent] ?? [];\n const rank = (keyword: string) => order.includes(keyword) ? order.indexOf(keyword) : order.length;\n return [...groups.values()].sort((first, second) => rank(first.ancestor.keyword) - rank(second.ancestor.keyword))\n .flatMap(entry => entry.ancestor.keyword === 'on' ? entry.bindings : children(entry.bindings, depth + 1, entry.ancestor.keyword));\n };\n return children(bindings, 0, 'application');\n}\n\nfunction sameLocation(first: SourceLocation, second: SourceLocation): boolean {\n return first.path === second.path && first.line === second.line && first.column === second.column;\n}\n\nfunction validateInteractionAt(location: SourceLocation, context: ParserContext, container = false): void {\n for (const binding of context.guardedInteractions) {\n const attachment = container ? binding.ancestors.at(-1)?.location : binding.location;\n if (attachment !== undefined && sameLocation(attachment, location)) validateAlternativeShadowing(binding.alternatives, context);\n }\n}\n\n// Components validate their attached bindings before their outlets, regardless of authored order.\n// Do not extend the existing guarded-action subject/path checks into previously opaque attachments.\nfunction validateInteractionDirectives(directives: readonly ScreenDirectiveSyntax[], context: ParserContext): void {\n for (const directive of directives) {\n switch (directive.kind) {\n case 'ScreenBehaviorSyntax':\n validateInteractionAt(directive.location, context);\n break;\n case 'ScreenTableSyntax':\n validateInteractionAt(directive.location, context, true);\n break;\n case 'ScreenComponentSyntax':\n validateInteractionAt(directive.location, context, true);\n for (const outlet of directive.outlets) validateInteractionDirectives(outlet.directives, context);\n break;\n case 'ScreenSectionSyntax':\n validateInteractionDirectives(directive.directives, context);\n break;\n case 'ScreenTemplateReferenceSyntax':\n for (const slot of directive.slots) validateInteractionDirectives(slot.directives, context);\n break;\n }\n }\n}\n\nfunction viewProperties(name: string, slice: SliceSyntax, declarations: RefusalDeclarations): readonly PropertySyntax[] | null {\n return declarations.resolve(name, slice, candidate => candidate.readModels)?.node.properties ?? null;\n}\n\nfunction validateAction(action: ScreenGuardedActionSyntax, subjects: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const properties = subjects.length === 1 ? viewProperties(subjects[0].type.name, slice, declarations) : null;\n if (subjects.length !== 1) {\n context.warning(DiagnosticCodes.UnresolvedActionSubject, \"A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved\", action.location);\n }\n for (const alternative of action.alternatives) {\n for (const comparison of comparisons(alternative.condition)) validateItemPath(comparison.left, comparison.location, properties, slice, declarations, context);\n validateArguments(alternative.command, alternative.arguments, properties, slice, declarations, context);\n }\n if (action.otherwise?.command != null) validateArguments(action.otherwise.command, action.otherwise.arguments, properties, slice, declarations, context);\n validateGuardedActionShadowing(action, context);\n}\n\nfunction validateArguments(commandName: string, arguments_: readonly InteractionArgumentSyntax[], properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const command = declarations.resolve(commandName, slice, candidate => candidate.commands)?.node;\n for (const argument of arguments_) {\n const inputs = command?.properties.filter(property => property.name === argument.name);\n if (inputs?.length === 0) context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command '${commandName}' has no argument property '${argument.name}'`, argument.location);\n const subjectProperty = validateItemPath(argument.binding, argument.location, properties, slice, declarations, context, true);\n if (inputs?.length === 1 && subjectProperty !== null && inputs[0].type.isCollection !== subjectProperty.type.isCollection) {\n context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command argument '${commandName}.${argument.name}' and subject field '${argument.binding}' must have matching collection cardinality`, argument.location);\n }\n }\n}\n\nfunction validateItemPath(path: string, location: SourceLocation, properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext, allowTerminalCollection = false): PropertySyntax | null {\n if (!path.startsWith('item.') || properties === null) return null;\n const segments = path.substring('item.'.length).split('.');\n for (const [index, segment] of segments.entries()) {\n const matches: readonly PropertySyntax[] = properties.filter(property => property.name === segment);\n if (matches.length === 0 || (matches.length === 1 && matches[0].type.isCollection && (!allowTerminalCollection || index < segments.length - 1))) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Unknown or collection-valued subject field '${path}' - guarded actions require an item field path`, location);\n return null;\n }\n if (matches.length !== 1) return null;\n if (index === segments.length - 1) return matches[0];\n const type = matches[0].type;\n properties = declarations.types.get(type.name)?.properties ?? viewProperties(type.name, slice, declarations);\n if (properties === null) {\n if (primitives.has(type.name) || declarations.application.concepts.some(concept => concept.name === type.name) && !declarations.application.types.some(composite => composite.name === type.name)) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Subject field '${path}' continues past scalar '${segment}'`, location);\n }\n return null;\n }\n }\n return null;\n}\n\nfunction comparisons(condition: ConditionSyntax): readonly ComparisonConditionSyntax[] {\n return condition.kind === 'ComparisonConditionSyntax' ? [condition] : [...comparisons(condition.left), ...comparisons(condition.right)];\n}\n"],"mappings":"uSAcA,MAAMA,kBAAa,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG3F,SAAgB,uBAAuB,EAAgC,EAA8B,CACjG,IAAMC,EAAe,IAAIC,EAAoBC,CAAW,EAElDC,EAAaC,EAAQ,oBAAoB,OAAO,GAAW,CAACC,EAAQ,UAAU,KAAK,GAAYC,EAAS,UAAY,QAAQ,CAAC,EACnI,IAAK,IAAMD,KAAW,4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c,eAAeA,EAAK,KAAM5C,EAAOT,CAAY,EACvGkC,IAAe,KAIf,OAHInC,EAAW,IAAIsD,EAAK,IAAI,GAAKrD,EAAa,YAAY,SAAS,KAAK,GAAWsD,EAAQ,OAASD,EAAK,IAAI,GAAK,CAACrD,EAAa,YAAY,MAAM,KAAK,GAAauD,EAAU,OAASF,EAAK,IAAI,IAC5LjD,EAAQ,QAAQ+B,EAAgB,0BAA2B,kBAAkBY,EAAK,2BAA2BG,EAAQ,GAAIpB,CAAQ,EAE9H,IAEf,CACA,OAAO,IACX,CAEA,SAAS,YAAY,EAAkE,CACnF,OAAO0B,EAAU,OAAS,4BAA8B,CAACA,CAAS,EAAI,CAAC,GAAG,YAAYA,EAAU,IAAI,EAAG,GAAG,YAAYA,EAAU,KAAK,CAAC,CAC1I"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{firstWord as i}from"./LineText.js";import{parseCondition as a}from"./ConditionParser.js";import{validateCondition as o}from"./GuardedActionParser.js";import{LineReader as s}from"./LineReader.js";import{ParserContext as c}from"./ParserContext.js";const l=n(`^when${t}+([^\\n]+)${t}+execute${t}+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),u=n(`^on${t}+([^\\n]+)$`),d=n(`^where${t}+([^\\n]+)$`),f=/* @__PURE__ */ new Set([`execute`,`navigate`,`open`,`close`,`refresh`,`set`,`notify`,`confirm`,`raise`]);function validateInteractionBodies(t,n){for(let s=0;s<n.length;s++){let c=n[s],p=u.exec(c.content);if(p===null||p[1].startsWith(`row-click `))continue;let m=[];for(let e=s+1;e<n.length&&n[e].indent>c.indent;e++)m.push(n[e]);let h=m.filter(e=>e.indent===m[0]?.indent),g=h.filter(e=>[`when`,`otherwise`].includes(i(e.content))),_=[`click`,`double click`,`select`].includes(p[1].trim()),v=h.filter(e=>d.test(e.content)),y=!1;for(let n of g){let s=i(n.content)===`when`,c=s?l.exec(n.content):null;if(s){y&&t.error(e.MisplacedActionOtherwise,`A 'when' alternative must precede 'otherwise'`,r(n));let i=a(t,c?.[1]??n.content.slice(4).trim(),r(n),!0);i!==null&&o(t,i),c!==null&&t.error(e.InlineInteractionAlternative,`Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'`,r(n))}else(y||n.content!==`otherwise`)&&t.error(e.MisplacedActionOtherwise,`An interaction permits one final block-form 'otherwise'`,r(n)),y=!0;let u=m[m.indexOf(n)+1];c===null&&(u===void 0||u.indent<=n.indent||!f.has(i(u.content)))&&t.error(e.InteractionAlternativeWithoutActions,`An interaction alternative requires a non-empty action list`,r(n))}if(g.length>0&&(_||t.error(e.UnsupportedInteractionAlternatives,`Interaction alternatives are only supported on click, double click and select`,r(c)),(v.length>0||h.some(e=>f.has(i(e.content))))&&t.error(e.MixedInteractionAlternatives,`Interaction alternatives cannot mix with plain actions or 'where'`,r(c)),g.some(e=>i(e.content)===`when`)||t.error(e.GuardedActionWithoutAlternatives,`A guarded interaction requires at least one 'when' alternative`,r(c))),_)for(let e of v)deprecateWhere(t,e)}}function deprecateWhere(t,n){let i=new c(new s([]));i.sourceOptions=t.sourceOptions;let l=a(i,d.exec(n.content)[1].trim(),r(n),!0);l!==null&&o(i,l);let u=`Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions`;l!==null&&i.diagnostics.length===0?t.warning(e.LegacyInteractionWhere,u,r(n)):t.information(e.LegacyInteractionWhere,u,r(n))}export{validateInteractionBodies};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{firstWord as i}from"./LineText.js";import{parseCondition as a}from"./ConditionParser.js";import{validateCondition as o}from"./GuardedActionParser.js";import{LineReader as s}from"./LineReader.js";import{ParserContext as c}from"./ParserContext.js";const l=n(`^screen${t}+template(?:${t}|$)`);function interactionAncestry(e){let t=/* @__PURE__ */ new Map,n=[],a=!1;for(let o of e)if(o.content.startsWith("```"))a=!a;else if(!(a||o.content.length===0||o.content.startsWith(`//`))){for(;n.length>0&&n[n.length-1].indent>=o.indent;)n.pop();i(o.content)===`on`&&t.set(o.number,n.map(e=>({keyword:l.test(e.content)?`screen template`:i(e.content),location:r(e)}))),n.push(o)}return t}const u=n(`^when${t}+([^\\n]+)${t}+execute${t}+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),d=n(`^on${t}+([^\\n]+)$`),f=n(`^where${t}+([^\\n]+)$`),p=/* @__PURE__ */ new Set([`execute`,`navigate`,`open`,`close`,`refresh`,`set`,`notify`,`confirm`,`raise`]);function validateInteractionBodies(t,n){for(let s=0;s<n.length;s++){let c=n[s],l=d.exec(c.content);if(l===null||l[1].startsWith(`row-click `))continue;let m=[];for(let e=s+1;e<n.length&&n[e].indent>c.indent;e++)m.push(n[e]);let h=m.filter(e=>e.indent===m[0]?.indent),g=h.filter(e=>[`when`,`otherwise`].includes(i(e.content))),_=[`click`,`double click`,`select`].includes(l[1].trim()),v=h.filter(e=>f.test(e.content)),y=[],b=!1;for(let n of g){let s=i(n.content)===`when`,c=s?u.exec(n.content):null;if(s){b&&t.error(e.MisplacedActionOtherwise,`A 'when' alternative must precede 'otherwise'`,r(n));let i=a(t,c?.[1]??n.content.slice(4).trim(),r(n),!0);i!==null&&(o(t,i),y.push({condition:i,location:r(n),message:`This 'when' alternative is shadowed by earlier alternatives in this interaction`})),c!==null&&t.error(e.InlineInteractionAlternative,`Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'`,r(n))}else(b||n.content!==`otherwise`)&&t.error(e.MisplacedActionOtherwise,`An interaction permits one final block-form 'otherwise'`,r(n)),b=!0;let l=m[m.indexOf(n)+1];c===null&&(l===void 0||l.indent<=n.indent||!p.has(i(l.content)))&&t.error(e.InteractionAlternativeWithoutActions,`An interaction alternative requires a non-empty action list`,r(n))}if(g.length>0&&(_||t.error(e.UnsupportedInteractionAlternatives,`Interaction alternatives are only supported on click, double click and select`,r(c)),(v.length>0||h.some(e=>p.has(i(e.content))))&&t.error(e.MixedInteractionAlternatives,`Interaction alternatives cannot mix with plain actions or 'where'`,r(c)),g.some(e=>i(e.content)===`when`)||t.error(e.GuardedActionWithoutAlternatives,`A guarded interaction requires at least one 'when' alternative`,r(c))),_)for(let e of v)deprecateWhere(t,e);y.length>0&&t.guardedInteractions.push({location:r(c),ancestors:t.interactionAncestors.get(c.number)??[],alternatives:y})}}function deprecateWhere(t,n){let i=new c(new s([]));i.sourceOptions=t.sourceOptions;let l=a(i,f.exec(n.content)[1].trim(),r(n),!0);l!==null&&o(i,l);let u=`Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions`;l!==null&&i.diagnostics.length===0?t.warning(e.LegacyInteractionWhere,u,r(n)):t.information(e.LegacyInteractionWhere,u,r(n))}export{interactionAncestry,validateInteractionBodies};
2
2
  //# sourceMappingURL=InteractionAlternatives.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InteractionAlternatives.js","names":["inline","pattern","dotNetWhitespace","trigger","where","actions","index","lines","header","on","body","child","children","line","branches","firstWord","supported","guards","sawOtherwise","branch","isWhen","match","context","DiagnosticCodes","locationOf","condition","parseCondition","validateCondition","nested","guard","probe","ParserContext","LineReader","message"],"sources":["../../../../../../Compiler/Parsing/InteractionAlternatives.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { validateCondition } from './GuardedActionParser';\nimport { firstWord } from './LineText';\nimport { LineReader } from './LineReader';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst inline = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst trigger = pattern(`^on${dotNetWhitespace}+([^\\\\n]+)$`);\nconst where = pattern(`^where${dotNetWhitespace}+([^\\\\n]+)$`);\nconst actions = new Set(['execute', 'navigate', 'open', 'close', 'refresh', 'set', 'notify', 'confirm', 'raise']);\n\n// Interaction bodies remain opaque in the TS AST. Check their structure instead of silently accepting\n// alternatives the C# compiler refuses. Input collection supplies only significant, non-fenced lines.\nexport function validateInteractionBodies(context: ParserContext, lines: readonly SourceLine[]): void {\n for (let index = 0; index < lines.length; index++) {\n const header = lines[index];\n const on = trigger.exec(header.content);\n if (on === null || on[1].startsWith('row-click ')) continue;\n const body: SourceLine[] = [];\n for (let child = index + 1; child < lines.length && lines[child].indent > header.indent; child++) body.push(lines[child]);\n const children = body.filter(line => line.indent === body[0]?.indent);\n const branches = children.filter(line => ['when', 'otherwise'].includes(firstWord(line.content)));\n const supported = ['click', 'double click', 'select'].includes(on[1].trim());\n const guards = children.filter(line => where.test(line.content));\n let sawOtherwise = false;\n for (const branch of branches) {\n const isWhen = firstWord(branch.content) === 'when';\n const match = isWhen ? inline.exec(branch.content) : null;\n if (isWhen) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(branch));\n const condition = parseCondition(context, match?.[1] ?? branch.content.slice(4).trim(), locationOf(branch), true);\n if (condition !== null) validateCondition(context, condition);\n if (match !== null) context.error(DiagnosticCodes.InlineInteractionAlternative, \"Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'\", locationOf(branch));\n } else {\n if (sawOtherwise || branch.content !== 'otherwise') context.error(DiagnosticCodes.MisplacedActionOtherwise, \"An interaction permits one final block-form 'otherwise'\", locationOf(branch));\n sawOtherwise = true;\n }\n const position = body.indexOf(branch);\n const nested = body[position + 1];\n if (match === null && (nested === undefined || nested.indent <= branch.indent || !actions.has(firstWord(nested.content)))) {\n context.error(DiagnosticCodes.InteractionAlternativeWithoutActions, 'An interaction alternative requires a non-empty action list', locationOf(branch));\n }\n }\n if (branches.length > 0) {\n if (!supported) context.error(DiagnosticCodes.UnsupportedInteractionAlternatives, 'Interaction alternatives are only supported on click, double click and select', locationOf(header));\n if (guards.length > 0 || children.some(line => actions.has(firstWord(line.content)))) {\n context.error(DiagnosticCodes.MixedInteractionAlternatives, \"Interaction alternatives cannot mix with plain actions or 'where'\", locationOf(header));\n }\n if (!branches.some(line => firstWord(line.content) === 'when')) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded interaction requires at least one 'when' alternative\", locationOf(header));\n }\n if (supported) for (const guard of guards) deprecateWhere(context, guard);\n }\n}\n\nfunction deprecateWhere(context: ParserContext, line: SourceLine): void {\n const probe = new ParserContext(new LineReader([]));\n probe.sourceOptions = context.sourceOptions;\n const condition = parseCondition(probe, where.exec(line.content)![1].trim(), locationOf(line), true);\n if (condition !== null) validateCondition(probe, condition);\n const message = \"Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions\";\n if (condition !== null && probe.diagnostics.length === 0) context.warning(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n else context.information(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n}\n"],"mappings":"ueAYA,MAAMA,EAASC,EAAQ,QAAQC,EAAiB,YAAYA,EAAiB,UAAUA,EAAiB,8BAA8B,EAChIC,EAAUF,EAAQ,MAAMC,EAAiB,YAAY,EACrDE,EAAQH,EAAQ,SAASC,EAAiB,YAAY,EACtDG,kBAAU,IAAI,IAAI,CAAC,UAAW,WAAY,OAAQ,QAAS,UAAW,MAAO,SAAU,UAAW,OAAO,CAAC,EAIhH,SAAgB,0BAA0B,EAAwB,EAAoC,CAClG,IAAK,IAAIC,EAAQ,EAAGA,EAAQC,EAAM,OAAQ,IAAS,CAC/C,IAAMC,EAASD,EAAMD,GACfG,EAAKN,EAAQ,KAAKK,EAA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OAASO,IAAW,IAAA,IAAaA,EAAO,QAAUT,EAAO,QAAU,CAACd,EAAQ,IAAIU,EAAUa,EAAO,OAAO,CAAC,IACnHN,EAAQ,MAAMC,EAAgB,qCAAsC,8DAA+DC,EAAWL,CAAM,CAAC,CAE7J,CAQA,GAPIL,EAAS,OAAS,IACbE,GAAWM,EAAQ,MAAMC,EAAgB,mCAAoC,gFAAiFC,EAAWhB,CAAM,CAAC,GACjLS,EAAO,OAAS,GAAKL,EAAS,KAAK,GAAQP,EAAQ,IAAIU,EAAUF,EAAK,OAAO,CAAC,CAAC,IAC/ES,EAAQ,MAAMC,EAAgB,6BAA8B,oEAAqEC,EAAWhB,CAAM,CAAC,EAElJM,EAAS,KAAK,GAAQC,EAAUF,EAAK,OAAO,IAAM,MAAM,GAAGS,EAAQ,MAAMC,EAAgB,iCAAkC,iEAAkEC,EAAWhB,CAAM,CAAC,GAEpNQ,EAAW,IAAK,IAAMa,KAASZ,EAAQ,eAAeK,EAASO,CAAK,CAC5E,CACJ,CAEA,SAAS,eAAe,EAAwB,EAAwB,CACpE,IAAMC,EAAQ,IAAIC,EAAc,IAAIC,EAAW,CAAC,CAAC,CAAC,EAClD,EAAM,cAAgBV,EAAQ,cAC9B,IAAMG,EAAYC,EAAeI,EAAO1B,EAAM,KAAKS,EAAK,OAAO,CAAC,CAAE,EAAE,CAAC,KAAK,EAAGW,EAAWX,CAAI,EAAG,EAAI,EAC/FY,IAAc,MAAME,EAAkBG,EAAOL,CAAS,EAC1D,IAAMQ,EAAU,wGACZR,IAAc,MAAQK,EAAM,YAAY,SAAW,EAAGR,EAAQ,QAAQC,EAAgB,uBAAwBU,EAAST,EAAWX,CAAI,CAAC,EACtIS,EAAQ,YAAYC,EAAgB,uBAAwBU,EAAST,EAAWX,CAAI,CAAC,CAC9F"}
1
+ {"version":3,"file":"InteractionAlternatives.js","names":["screenTemplate","pattern","dotNetWhitespace","result","ancestors","fenced","line","lines","firstWord","ancestor","locationOf","inline","trigger","where","actions","index","header","on","body","child","children","branches","supported","guards","alternatives","sawOtherwise","branch","isWhen","match","context","DiagnosticCodes","condition","parseCondition","validateCondition","nested","guard","probe","ParserContext","LineReader","message"],"sources":["../../../../../../Compiler/Parsing/InteractionAlternatives.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ShadowingAlternative } from './GuardedActionShadowing';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { validateCondition } from './GuardedActionParser';\nimport { firstWord } from './LineText';\nimport { LineReader } from './LineReader';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Authoring facts only: interaction bodies are still opaque in the serialized TS AST.\nexport interface InteractionAncestor {\n readonly keyword: string;\n readonly location: SourceLocation;\n}\n\nexport interface GuardedInteractionBinding {\n readonly location: SourceLocation;\n readonly ancestors: readonly InteractionAncestor[];\n readonly alternatives: readonly ShadowingAlternative[];\n}\n\nconst screenTemplate = pattern(`^screen${dotNetWhitespace}+template(?:${dotNetWhitespace}|$)`);\n\n// Capture attachment ancestry before parsing consumes opaque bodies. Fenced code is not Screenplay.\nexport function interactionAncestry(lines: readonly SourceLine[]): ReadonlyMap<number, readonly InteractionAncestor[]> {\n const result = new Map<number, readonly InteractionAncestor[]>();\n const ancestors: SourceLine[] = [];\n let fenced = false;\n for (const line of lines) {\n if (line.content.startsWith('```')) {\n fenced = !fenced;\n continue;\n }\n if (fenced || line.content.length === 0 || line.content.startsWith('//')) continue;\n while (ancestors.length > 0 && ancestors[ancestors.length - 1].indent >= line.indent) ancestors.pop();\n if (firstWord(line.content) === 'on') result.set(line.number, ancestors.map(ancestor => ({ keyword: screenTemplate.test(ancestor.content) ? 'screen template' : firstWord(ancestor.content), location: locationOf(ancestor) })));\n ancestors.push(line);\n }\n return result;\n}\n\nconst inline = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst trigger = pattern(`^on${dotNetWhitespace}+([^\\\\n]+)$`);\nconst where = pattern(`^where${dotNetWhitespace}+([^\\\\n]+)$`);\nconst actions = new Set(['execute', 'navigate', 'open', 'close', 'refresh', 'set', 'notify', 'confirm', 'raise']);\n\n// Interaction bodies remain opaque in the TS AST. Check their structure instead of silently accepting\n// alternatives the C# compiler refuses. Input collection supplies only significant, non-fenced lines.\nexport function validateInteractionBodies(context: ParserContext, lines: readonly SourceLine[]): void {\n for (let index = 0; index < lines.length; index++) {\n const header = lines[index];\n const on = trigger.exec(header.content);\n if (on === null || on[1].startsWith('row-click ')) continue;\n const body: SourceLine[] = [];\n for (let child = index + 1; child < lines.length && lines[child].indent > header.indent; child++) body.push(lines[child]);\n const children = body.filter(line => line.indent === body[0]?.indent);\n const branches = children.filter(line => ['when', 'otherwise'].includes(firstWord(line.content)));\n const supported = ['click', 'double click', 'select'].includes(on[1].trim());\n const guards = children.filter(line => where.test(line.content));\n const alternatives: ShadowingAlternative[] = [];\n let sawOtherwise = false;\n for (const branch of branches) {\n const isWhen = firstWord(branch.content) === 'when';\n const match = isWhen ? inline.exec(branch.content) : null;\n if (isWhen) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(branch));\n const condition = parseCondition(context, match?.[1] ?? branch.content.slice(4).trim(), locationOf(branch), true);\n if (condition !== null) {\n validateCondition(context, condition);\n alternatives.push({ condition, location: locationOf(branch), message: \"This 'when' alternative is shadowed by earlier alternatives in this interaction\" });\n }\n if (match !== null) context.error(DiagnosticCodes.InlineInteractionAlternative, \"Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'\", locationOf(branch));\n } else {\n if (sawOtherwise || branch.content !== 'otherwise') context.error(DiagnosticCodes.MisplacedActionOtherwise, \"An interaction permits one final block-form 'otherwise'\", locationOf(branch));\n sawOtherwise = true;\n }\n const position = body.indexOf(branch);\n const nested = body[position + 1];\n if (match === null && (nested === undefined || nested.indent <= branch.indent || !actions.has(firstWord(nested.content)))) {\n context.error(DiagnosticCodes.InteractionAlternativeWithoutActions, 'An interaction alternative requires a non-empty action list', locationOf(branch));\n }\n }\n if (branches.length > 0) {\n if (!supported) context.error(DiagnosticCodes.UnsupportedInteractionAlternatives, 'Interaction alternatives are only supported on click, double click and select', locationOf(header));\n if (guards.length > 0 || children.some(line => actions.has(firstWord(line.content)))) {\n context.error(DiagnosticCodes.MixedInteractionAlternatives, \"Interaction alternatives cannot mix with plain actions or 'where'\", locationOf(header));\n }\n if (!branches.some(line => firstWord(line.content) === 'when')) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded interaction requires at least one 'when' alternative\", locationOf(header));\n }\n if (supported) for (const guard of guards) deprecateWhere(context, guard);\n if (alternatives.length > 0) context.guardedInteractions.push({ location: locationOf(header), ancestors: context.interactionAncestors.get(header.number) ?? [], alternatives });\n }\n}\n\nfunction deprecateWhere(context: ParserContext, line: SourceLine): void {\n const probe = new ParserContext(new LineReader([]));\n probe.sourceOptions = context.sourceOptions;\n const condition = parseCondition(probe, where.exec(line.content)![1].trim(), locationOf(line), true);\n if (condition !== null) validateCondition(probe, condition);\n const message = \"Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions\";\n if (condition !== null && probe.diagnostics.length === 0) context.warning(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n else context.information(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n}\n"],"mappings":"ueA0BA,MAAMA,EAAiBC,EAAQ,UAAUC,EAAiB,cAAcA,EAAiB,IAAI,EAG7F,SAAgB,oBAAoB,EAAmF,CACnH,IAAMC,kBAAS,IAAI,IACbC,EAA0B,CAAC,EAC7BC,EAAS,GACb,IAAK,IAAMC,KAAQC,EACf,G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C,EAAgB,mCAAoC,gFAAiFpB,EAAWM,CAAM,CAAC,GACjLO,EAAO,OAAS,GAAKH,EAAS,KAAK,GAAQN,EAAQ,IAAIN,EAAUF,EAAK,OAAO,CAAC,CAAC,IAC/EuB,EAAQ,MAAMC,EAAgB,6BAA8B,oEAAqEpB,EAAWM,CAAM,CAAC,EAElJK,EAAS,KAAK,GAAQb,EAAUF,EAAK,OAAO,IAAM,MAAM,GAAGuB,EAAQ,MAAMC,EAAgB,iCAAkC,iEAAkEpB,EAAWM,CAAM,CAAC,GAEpNM,EAAW,IAAK,IAAMa,KAASZ,EAAQ,eAAeM,EAASM,CAAK,EACpEX,EAAa,OAAS,GAAGK,EAAQ,oBAAoB,KAAK,CAAE,SAAUnB,EAAWM,CAAM,EAAG,UAAWa,EAAQ,qBAAqB,IAAIb,EAAO,MAAM,GAAK,CAAC,EAAG,cAAa,CAAC,CAClL,CACJ,CAEA,SAAS,eAAe,EAAwB,EAAwB,CACpE,IAAMoB,EAAQ,IAAIC,EAAc,IAAIC,EAAW,CAAC,CAAC,CAAC,EAClD,EAAM,cAAgBT,EAAQ,cAC9B,IAAME,EAAYC,EAAeI,EAAOvB,EAAM,KAAKP,EAAK,OAAO,CAAC,CAAE,EAAE,CAAC,KAAK,EAAGI,EAAWJ,CAAI,EAAG,EAAI,EAC/FyB,IAAc,MAAME,EAAkBG,EAAOL,CAAS,EAC1D,IAAMQ,EAAU,wGACZR,IAAc,MAAQK,EAAM,YAAY,SAAW,EAAGP,EAAQ,QAAQC,EAAgB,uBAAwBS,EAAS7B,EAAWJ,CAAI,CAAC,EACtIuB,EAAQ,YAAYC,EAAgB,uBAAwBS,EAAS7B,EAAWJ,CAAI,CAAC,CAC9F"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{sourceLocation as e}from"../Diagnostics/SourceLocation.js";import{legacySourceOptions as t}from"../Syntax/SourceOptions.js";var n=class ParserContext{reader;path;#e=[];triggerData=[];inputUses=[];scope=[];languages;sourceOptions=t;authoredDeclarations=!1;deferIdentityValidation=!1;streamCandidates;get valueContext(){if(this.sourceOptions.numericMode===`exact`)return this;let e=new ParserContext(this.reader,this.path,this.languages);return e.sourceOptions=this.sourceOptions,e}constructor(e,t,n=/* @__PURE__ */ new Set([`csharp`,`typescript`,`react`,`html`,`sql`])){this.reader=e,this.path=t,this.languages=n}get start(){return e(1,1,this.path)}get diagnostics(){return this.nestedNumericDirectives.size>0&&this.sourceOptions.numericMode!==`legacy`&&this.reader.atEnd&&(this.#e.push(...[...this.nestedNumericDirectives].sort((e,t)=>e[0]-t[0]).map(e=>e[1])),this.nestedNumericDirectives.clear()),this.#e}nestedNumericDirectives=/* @__PURE__ */ new Map;claimField(e){this.nestedNumericDirectives.delete(e.number)}information(e,t,n){this.#e.push({severity:`information`,code:e,message:t,location:n})}error(e,t,n){this.#e.push({severity:`error`,code:e,message:t,location:n})}warning(e,t,n){this.#e.push({severity:`warning`,code:e,message:t,location:n})}peekChild(e){let t=this.reader.peekSignificant();return t!==void 0&&t.indent>e?t:void 0}skipBlock(e){for(;this.peekChild(e)!==void 0;)this.reader.takeSignificant()}skipOpaqueBlock(e){let t=this.peekChild(e);for(;t!==void 0;)this.reader.takeSignificant(),t.content.startsWith("```")&&this.skipFencedBody(),t=this.peekChild(e)}skipFencedBody(){for(let e=this.reader.takeRaw();e!==void 0;e=this.reader.takeRaw())if(e.raw.trim()==="```")return}};export{n as ParserContext};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{sourceLocation as e}from"../Diagnostics/SourceLocation.js";import{legacySourceOptions as t}from"../Syntax/SourceOptions.js";var n=class ParserContext{reader;path;#e=[];triggerData=[];inputUses=[];guardedInteractions=[];interactionAncestors=/* @__PURE__ */ new Map;scope=[];languages;sourceOptions=t;authoredDeclarations=!1;deferIdentityValidation=!1;streamCandidates;get valueContext(){if(this.sourceOptions.numericMode===`exact`)return this;let e=new ParserContext(this.reader,this.path,this.languages);return e.sourceOptions=this.sourceOptions,e}constructor(e,t,n=/* @__PURE__ */ new Set([`csharp`,`typescript`,`react`,`html`,`sql`])){this.reader=e,this.path=t,this.languages=n}get start(){return e(1,1,this.path)}get diagnostics(){return this.nestedNumericDirectives.size>0&&this.sourceOptions.numericMode!==`legacy`&&this.reader.atEnd&&(this.#e.push(...[...this.nestedNumericDirectives].sort((e,t)=>e[0]-t[0]).map(e=>e[1])),this.nestedNumericDirectives.clear()),this.#e}nestedNumericDirectives=/* @__PURE__ */ new Map;claimField(e){this.nestedNumericDirectives.delete(e.number)}information(e,t,n){this.#e.push({severity:`information`,code:e,message:t,location:n})}error(e,t,n){this.#e.push({severity:`error`,code:e,message:t,location:n})}warning(e,t,n){this.#e.push({severity:`warning`,code:e,message:t,location:n})}peekChild(e){let t=this.reader.peekSignificant();return t!==void 0&&t.indent>e?t:void 0}skipBlock(e){for(;this.peekChild(e)!==void 0;)this.reader.takeSignificant()}skipOpaqueBlock(e){let t=this.peekChild(e);for(;t!==void 0;)this.reader.takeSignificant(),t.content.startsWith("```")&&this.skipFencedBody(),t=this.peekChild(e)}skipFencedBody(){for(let e=this.reader.takeRaw();e!==void 0;e=this.reader.takeRaw())if(e.raw.trim()==="```")return}};export{n as ParserContext};
2
2
  //# sourceMappingURL=ParserContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ParserContext.js","names":["ParserContext","legacySourceOptions","context","reader","path","languages","sourceLocation","#diagnostics","first","second","entry","line","parentIndent","child"],"sources":["../../../../../../Compiler/Parsing/ParserContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { CommandStreamCandidates } from './CommandStreamCandidates';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { legacySourceOptions, SourceOptions } from '../Syntax/SourceOptions';\nimport { InputUse } from './InputUses';\nimport { LineReader } from './LineReader';\nimport { SourceLine } from './SourceLine';\n\n// What every parser shares while it reads one document: the line reader, the diagnostics found so far and\n// the file the document came from.\nexport class ParserContext {\n readonly #diagnostics: Diagnostic[] = [];\n // Authoring verification needs these committed values even though SyntaxJson omits them.\n readonly triggerData: PropertySyntax[] = [];\n readonly inputUses: InputUse[] = [];\n scope: readonly string[] = [];\n readonly languages: ReadonlySet<string>;\n sourceOptions: SourceOptions = legacySourceOptions;\n authoredDeclarations = false;\n deferIdentityValidation = false;\n streamCandidates?: CommandStreamCandidates;\n\n // Structural enrichment of formerly opaque Legacy fields must not add diagnostics. Exact operands\n // use the owning context so representability failures cannot turn into successful opaque syntax.\n get valueContext(): ParserContext {\n if (this.sourceOptions.numericMode === 'exact') return this;\n const context = new ParserContext(this.reader, this.path, this.languages);\n context.sourceOptions = this.sourceOptions;\n return context;\n }\n\n constructor(readonly reader: LineReader, readonly path?: string, languages: ReadonlySet<string> = new Set(['csharp', 'typescript', 'react', 'html', 'sql'])) {\n this.languages = languages;\n }\n\n get start(): SourceLocation {\n return sourceLocation(1, 1, this.path);\n }\n\n get diagnostics(): readonly Diagnostic[] {\n // Directive-shaped lines nobody claimed as a field are errors, wherever they sit.\n if (this.nestedNumericDirectives.size > 0 && this.sourceOptions.numericMode !== 'legacy' && this.reader.atEnd) {\n this.#diagnostics.push(...[...this.nestedNumericDirectives].sort((first, second) => first[0] - second[0]).map(entry => entry[1]));\n this.nestedNumericDirectives.clear();\n }\n return this.#diagnostics;\n }\n\n // Directive-shaped lines below the top level, keyed by line number, still unclaimed as a field.\n nestedNumericDirectives = new Map<number, Diagnostic>();\n\n claimField(line: SourceLine): void {\n this.nestedNumericDirectives.delete(line.number);\n }\n\n information(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'information', code, message, location });\n }\n\n error(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'error', code, message, location });\n }\n\n warning(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'warning', code, message, location });\n }\n\n // The next significant line when it is indented deeper than its parent - that is, when it belongs to\n // the parent's body under the offside rule.\n peekChild(parentIndent: number): SourceLine | undefined {\n const line = this.reader.peekSignificant();\n return line !== undefined && line.indent > parentIndent ? line : undefined;\n }\n\n // Skips the body of a construct, the way the C# parser does after reporting it.\n skipBlock(parentIndent: number): void {\n while (this.peekChild(parentIndent) !== undefined) {\n this.reader.takeSignificant();\n }\n }\n\n // Skips the body of a construct this compiler deliberately does not model. Unlike skipBlock it steps\n // over fenced code blocks whole, because a fenced line may be indented less than the block it is in -\n // reading it as significant would end the skip early and misread the code as Screenplay.\n skipOpaqueBlock(parentIndent: number): void {\n let child = this.peekChild(parentIndent);\n while (child !== undefined) {\n this.reader.takeSignificant();\n if (child.content.startsWith('```')) {\n this.skipFencedBody();\n }\n child = this.peekChild(parentIndent);\n }\n }\n\n // Takes the raw lines of a fenced block up to and including its closing fence.\n skipFencedBody(): void {\n for (let line = this.reader.takeRaw(); line !== undefined; line = this.reader.takeRaw()) {\n if (line.raw.trim() === '```') {\n return;\n }\n }\n }\n}\n"],"mappings":"wLAcA,IAAaA,EAAb,MAAa,aAAc,CAqBF,OAA6B,KApBlD,GAAsC,CAAC,EAEvC,YAAyC,CAAC,EAC1C,UAAiC,CAAC,EAClC,MAA2B,CAAC,EAC5B,UACA,cAA+BC,EAC/B,qBAAuB,GACvB,wBAA0B,GAC1B,iBAIA,IAAI,cAA8B,CAC9B,GAAI,KAAK,cAAc,cAAgB,QAAS,OAAO,KACvD,IAAMC,EAAU,IAAI,cAAc,KAAK,OAAQ,KAAK,KAAM,KAAK,SAAS,EAExE,MADA,GAAQ,cAAgB,KAAK,cACtBA,CACX,CAEA,YAAY,EAA6B,EAAwB,kBAAiC,IAAI,IAAI,CAAC,SAAU,aAAc,QAAS,OAAQ,KAAK,CAAC,EAAG,CAAxI,KAAA,OAAAC,EAA6B,KAAA,KAAAC,EAC9C,KAAK,UAAYC,CACrB,CAEA,IAAI,OAAw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K,OAAO,QAAQ,EAAGA,IAAS,IAAA,GAAW,EAAO,KAAK,OAAO,QAAQ,EAClF,GAAIA,EAAK,IAAI,KAAK,IAAM,MACpB,MAGZ,CACJ"}
1
+ {"version":3,"file":"ParserContext.js","names":["ParserContext","legacySourceOptions","context","reader","path","languages","sourceLocation","#diagnostics","first","second","entry","line","parentIndent","child"],"sources":["../../../../../../Compiler/Parsing/ParserContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { CommandStreamCandidates } from './CommandStreamCandidates';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { legacySourceOptions, SourceOptions } from '../Syntax/SourceOptions';\nimport { InputUse } from './InputUses';\nimport { GuardedInteractionBinding, InteractionAncestor } from './InteractionAlternatives';\nimport { LineReader } from './LineReader';\nimport { SourceLine } from './SourceLine';\n\n// What every parser shares while it reads one document: the line reader, the diagnostics found so far and\n// the file the document came from.\nexport class ParserContext {\n readonly #diagnostics: Diagnostic[] = [];\n // Authoring verification needs these committed values even though SyntaxJson omits them.\n readonly triggerData: PropertySyntax[] = [];\n readonly inputUses: InputUse[] = [];\n readonly guardedInteractions: GuardedInteractionBinding[] = [];\n interactionAncestors: ReadonlyMap<number, readonly InteractionAncestor[]> = new Map();\n scope: readonly string[] = [];\n readonly languages: ReadonlySet<string>;\n sourceOptions: SourceOptions = legacySourceOptions;\n authoredDeclarations = false;\n deferIdentityValidation = false;\n streamCandidates?: CommandStreamCandidates;\n\n // Structural enrichment of formerly opaque Legacy fields must not add diagnostics. Exact operands\n // use the owning context so representability failures cannot turn into successful opaque syntax.\n get valueContext(): ParserContext {\n if (this.sourceOptions.numericMode === 'exact') return this;\n const context = new ParserContext(this.reader, this.path, this.languages);\n context.sourceOptions = this.sourceOptions;\n return context;\n }\n\n constructor(readonly reader: LineReader, readonly path?: string, languages: ReadonlySet<string> = new Set(['csharp', 'typescript', 'react', 'html', 'sql'])) {\n this.languages = languages;\n }\n\n get start(): SourceLocation {\n return sourceLocation(1, 1, this.path);\n }\n\n get diagnostics(): readonly Diagnostic[] {\n // Directive-shaped lines nobody claimed as a field are errors, wherever they sit.\n if (this.nestedNumericDirectives.size > 0 && this.sourceOptions.numericMode !== 'legacy' && this.reader.atEnd) {\n this.#diagnostics.push(...[...this.nestedNumericDirectives].sort((first, second) => first[0] - second[0]).map(entry => entry[1]));\n this.nestedNumericDirectives.clear();\n }\n return this.#diagnostics;\n }\n\n // Directive-shaped lines below the top level, keyed by line number, still unclaimed as a field.\n nestedNumericDirectives = new Map<number, Diagnostic>();\n\n claimField(line: SourceLine): void {\n this.nestedNumericDirectives.delete(line.number);\n }\n\n information(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'information', code, message, location });\n }\n\n error(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'error', code, message, location });\n }\n\n warning(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'warning', code, message, location });\n }\n\n // The next significant line when it is indented deeper than its parent - that is, when it belongs to\n // the parent's body under the offside rule.\n peekChild(parentIndent: number): SourceLine | undefined {\n const line = this.reader.peekSignificant();\n return line !== undefined && line.indent > parentIndent ? line : undefined;\n }\n\n // Skips the body of a construct, the way the C# parser does after reporting it.\n skipBlock(parentIndent: number): void {\n while (this.peekChild(parentIndent) !== undefined) {\n this.reader.takeSignificant();\n }\n }\n\n // Skips the body of a construct this compiler deliberately does not model. Unlike skipBlock it steps\n // over fenced code blocks whole, because a fenced line may be indented less than the block it is in -\n // reading it as significant would end the skip early and misread the code as Screenplay.\n skipOpaqueBlock(parentIndent: number): void {\n let child = this.peekChild(parentIndent);\n while (child !== undefined) {\n this.reader.takeSignificant();\n if (child.content.startsWith('```')) {\n this.skipFencedBody();\n }\n child = this.peekChild(parentIndent);\n }\n }\n\n // Takes the raw lines of a fenced block up to and including its closing fence.\n skipFencedBody(): void {\n for (let line = this.reader.takeRaw(); line !== undefined; line = this.reader.takeRaw()) {\n if (line.raw.trim() === '```') {\n return;\n }\n }\n }\n}\n"],"mappings":"wLAeA,IAAaA,EAAb,MAAa,aAAc,CAuBF,OAA6B,KAtBlD,GAAsC,CAAC,EAEvC,YAAyC,CAAC,EAC1C,UAAiC,CAAC,EAClC,oBAA4D,CAAC,EAC7D,qCAA4E,IAAI,IAChF,MAA2B,CAAC,EAC5B,UACA,cAA+BC,EAC/B,qBAAuB,GACvB,wBAA0B,GAC1B,iBAIA,IAAI,cAA8B,CAC9B,GAAI,KAAK,cAAc,cAAgB,QAAS,OAAO,KACvD,IAAMC,EAAU,IAAI,cAAc,KAAK,OAAQ,KAAK,KAAM,KAAK,SAAS,EAExE,MADA,GAAQ,cAAgB,KAAK,cACtBA,CACX,CAEA,YAAY,EAA6B,EAAwB,kBAAiC,IAAI,IAAI,CAAC,SAAU,aAAc,QAAS,OAAQ,KAAK,CAAC,EAAG,CAAxI,KAAA,OAAAC,EAA6B,KAAA,KAAAC,EAC9C,KAAK,UAAYC,CACrB,CAEA,IAAI,OAAwB,CACxB,OAAOC,EAAe,EAAG,EAAG,KAAK,IAAI,CACzC,CAEA,IAAI,aAAqC,CAMrC,OAJI,KAAK,wBAAwB,KAAO,GAAK,KAAK,cAAc,cAAgB,UAAY,KAAK,OAAO,QACpG,KAAKC,GAAa,KAAK,GAAG,CAAC,GAAG,KAAK,uBAAuB,CAAC,CAAC,MAAM,EAAO,IAAWC,EAAM,GAAKC,EAAO,EAAE,CAAC,CAAC,IAAI,GAASC,EAAM,EAAE,CAAC,EAChI,KAAK,wBAAwB,MAAM,GAEhC,KAAKH,EAChB,CAGA,wCAA0B,IAAI,IAE9B,WAAW,EAAwB,CAC/B,KAAK,wBAAwB,OAAOI,EAAK,MAAM,CACnD,CAEA,YAAY,EAAc,EAAiB,EAAgC,CACvE,KAAKJ,GAAa,KAAK,CAAE,SAAU,cAAe,OAAM,UAAS,UAAS,CAAC,CAC/E,CAEA,MAAM,EAAc,EAAiB,EAAgC,CACjE,KAAKA,GAAa,KAAK,CAAE,SAAU,QAAS,OAAM,UAAS,UAAS,CAAC,CACzE,CAEA,QAAQ,EAAc,EAAiB,EAAgC,CACnE,KAAKA,GAAa,KAAK,CAAE,SAAU,UAAW,OAAM,UAAS,UAAS,CAAC,CAC3E,CAIA,UAAU,EAA8C,CACpD,IAAMI,EAAO,KAAK,OAAO,gBAAgB,EACzC,OAAOA,IAAS,IAAA,IAAaA,EAAK,OAASC,EAAeD,EAAO,IAAA,EACrE,CAGA,UAAU,EAA4B,CAClC,KAAO,KAAK,UAAUC,CAAY,IAAM,IAAA,IACpC,KAAK,OAAO,gBAAgB,CAEpC,CAKA,gBAAgB,EAA4B,CACxC,IAAIC,EAAQ,KAAK,UAAUD,CAAY,EACvC,KAAOC,IAAU,IAAA,IACb,KAAK,OAAO,gBAAgB,EACxBA,EAAM,QAAQ,WAAW,KAAK,GAC9B,KAAK,eAAe,EAExB,EAAQ,KAAK,UAAUD,CAAY,CAE3C,CAGA,gBAAuB,CACnB,IAAK,IAAID,EAAO,KAAK,OAAO,QAAQ,EAAGA,IAAS,IAAA,GAAW,EAAO,KAAK,OAAO,QAAQ,EAClF,GAAIA,EAAK,IAAI,KAAK,IAAM,MACpB,MAGZ,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenParser.js","names":["operand","stringBodyPattern","header","pattern","data","action","label","guardedAction","navigate","route","outletPattern","contributionPattern","parameter","component","stableId","componentPropertyBinding","componentPropertyLiteral","exposes","presentation","toolbarItem","slot","title","column","rowClick","field","match","quotedGroup","unescapeString","firstWord","line","context","DiagnosticCodes","locationOf","directives","contributions","description","child","parsed","parseDescription","isFileDirective","directive","parent","collectInputUses","parseTypeRef","guarded","parseGuardedAction","text","target","labelMatch","parameters","routeValue","outletValue","parameterMatch","parseFromClause","routeMatch","outletMatch","name","slots","columns","click","columnMatch","clickMatch","labelled","fields","dataContext","componentStableId","icon","properties","exposedValues","presentationValues","outlets","bound","literal","parseMappingSource","values","items","item","itemLabel","syntaxKind","language","code","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/ScreenParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction ('on' and 'uses') is recognized but not modeled.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n context.skipOpaqueBlock(line.indent);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(line.content);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = null;\n let target: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, location: locationOf(line) };\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n const name = line.content.substring('template'.length).trim();\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n context.skipOpaqueBlock(child.indent);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n context.skipOpaqueBlock(child.indent);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClause(context, bound[2], locationOf(line)), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>' or 'property <path> = <literal|object|array|null>'`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClause(context, match[2], locationOf(line)), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nfunction parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, location: locationOf(line) };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const match = toolbarItem.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>' or 'item <name> dialog <DialogTemplate>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel = null;\n let icon = null;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n"],"mappings":"+wBA4BA,MAAMA,EAAU,QAAQC,EAAkB,qCACpCC,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B,KAAMA,EAAM,GAAI,aAAY,OAAQA,EAAM,GAAI,MAAOoD,EAAW,OAAM,aAAY,aAAcR,EAAoB,SAAUrC,EAAWH,CAAI,CAAE,CACvL,CAEA,SAAS,oBAAoB,EAAwB,EAAc,EAAkB,CACjF,OAAOwB,EAAgBvB,EAASgB,EAAMd,EAAWH,CAAI,CAAC,CAC1D,CAEA,SAAS,UAAU,EAAwB,EAAgD,CACvF,IAAMkD,EAAWlD,EAAK,QAAQ,WAAW,KAAK,EAAIA,EAAK,QAAQ,UAAU,CAAC,EAAIA,EAAK,QACnF,GAAI,CAACC,EAAQ,UAAU,IAAIiD,CAAQ,EAAG,CAClCjD,EAAQ,MAAMC,EAAgB,kBAAmB,6DAA6DF,EAAK,QAAQ,GAAIG,EAAWH,CAAI,CAAC,EAC/I,MACJ,CACKA,EAAK,QAAQ,WAAW,KAAK,GAC9BC,EAAQ,QAAQC,EAAgB,sBAAuB,IAAIgD,EAAS,+CAA+CA,EAAS,WAAY/C,EAAWH,CAAI,CAAC,EAE5J,IAAMmD,EAAOC,EAAgBnD,EAASiD,EAAUlD,CAAI,EACpD,OAAOmD,IAAS,KAAO,IAAA,GAAY,CAC/B,KAAM,mBACN,KAAM,CAAE,KAAM,kBAAmB,WAAU,OAAM,SAAUhD,EAAWH,CAAI,CAAE,EAC5E,SAAUG,EAAWH,CAAI,CAC7B,CACJ"}
1
+ {"version":3,"file":"ScreenParser.js","names":["operand","stringBodyPattern","header","pattern","data","action","label","guardedAction","navigate","route","outletPattern","contributionPattern","parameter","component","stableId","componentPropertyBinding","componentPropertyLiteral","exposes","presentation","toolbarItem","slot","title","column","rowClick","field","match","quotedGroup","unescapeString","firstWord","line","context","DiagnosticCodes","locationOf","directives","contributions","description","child","parsed","parseDescription","isFileDirective","directive","parent","collectInputUses","parseTypeRef","guarded","parseGuardedAction","text","target","labelMatch","parameters","routeValue","outletValue","parameterMatch","parseFromClause","routeMatch","outletMatch","name","slots","columns","click","columnMatch","clickMatch","labelled","fields","dataContext","componentStableId","icon","properties","exposedValues","presentationValues","outlets","bound","literal","parseMappingSource","values","items","item","itemLabel","syntaxKind","language","code","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/ScreenParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction bodies remain opaque in the AST, but 'on' alternatives\n// are checked for structure, condition operands and shadowing; 'uses' attachments are recognized.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n context.skipOpaqueBlock(line.indent);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(line.content);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = null;\n let target: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, location: locationOf(line) };\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n const name = line.content.substring('template'.length).trim();\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n context.skipOpaqueBlock(child.indent);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n context.skipOpaqueBlock(child.indent);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClause(context, bound[2], locationOf(line)), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>' or 'property <path> = <literal|object|array|null>'`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClause(context, match[2], locationOf(line)), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nfunction parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, location: locationOf(line) };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const match = toolbarItem.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>' or 'item <name> dialog <DialogTemplate>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel = null;\n let icon = null;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n"],"mappings":"+wBA6BA,MA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W,SAC9G,MAAO,CAAE,KAAM,oBAAqB,KAAMA,EAAM,GAAI,aAAY,OAAQA,EAAM,GAAI,MAAOoD,EAAW,OAAM,aAAY,aAAcR,EAAoB,SAAUrC,EAAWH,CAAI,CAAE,CACvL,CAEA,SAAS,oBAAoB,EAAwB,EAAc,EAAkB,CACjF,OAAOwB,EAAgBvB,EAASgB,EAAMd,EAAWH,CAAI,CAAC,CAC1D,CAEA,SAAS,UAAU,EAAwB,EAAgD,CACvF,IAAMkD,EAAWlD,EAAK,QAAQ,WAAW,KAAK,EAAIA,EAAK,QAAQ,UAAU,CAAC,EAAIA,EAAK,QACnF,GAAI,CAACC,EAAQ,UAAU,IAAIiD,CAAQ,EAAG,CAClCjD,EAAQ,MAAMC,EAAgB,kBAAmB,6DAA6DF,EAAK,QAAQ,GAAIG,EAAWH,CAAI,CAAC,EAC/I,MACJ,CACKA,EAAK,QAAQ,WAAW,KAAK,GAC9BC,EAAQ,QAAQC,EAAgB,sBAAuB,IAAIgD,EAAS,+CAA+CA,EAAS,WAAY/C,EAAWH,CAAI,CAAC,EAE5J,IAAMmD,EAAOC,EAAgBnD,EAASiD,EAAUlD,CAAI,EACpD,OAAOmD,IAAS,KAAO,IAAA,GAAY,CAC/B,KAAM,mBACN,KAAM,CAAE,KAAM,kBAAmB,WAAU,OAAM,SAAUhD,EAAWH,CAAI,CAAE,EAC5E,SAAUG,EAAWH,CAAI,CAC7B,CACJ"}
@@ -1,2 +1,2 @@
1
- import"../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"./Parsing/SourceLineSplitter.js";import{validateIdentity as t}from"./Parsing/IdentityValidator.js";import{expandSpecificationExamples as n}from"./Parsing/SpecificationCommandExamples.js";import{validateResponses as r}from"./Parsing/ResponseValidator.js";import{validateSpecificationCases as i}from"./Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as a}from"./Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as o}from"./Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as s}from"./Dependencies/DeclaredDependencyTargets.js";import{documentPlacement as c}from"./Files/PlayPlacement.js";import"./Parsing/SpecificationParser.js";import"./Parsing/SpecificationExampleParser.js";import"./Parsing/CaptureParser.js";import"./Parsing/ProjectionParser.js";import"./Parsing/ImportDiscovery.js";import{DeclaredDependencies as l}from"./Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as u}from"./Parsing/PublicEventUsageValidator.js";import{sourceContext as d}from"./Parsing/SourceOptionsParser.js";import{validateInlineEvents as f}from"./Parsing/InlineEventValidator.js";import{validateOperations as p}from"./Parsing/OperationValidator.js";import{parseApplication as m}from"./Parsing/ScreenplayParser.js";import{CommandStreamCandidates as h}from"./Parsing/CommandStreamCandidates.js";import{validateEventSources as g}from"./Parsing/EventSourceValidator.js";import{validateProjectionTargets as _}from"./Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as v}from"./Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as y}from"./Parsing/EventSubjectValidator.js";import{validateReactionRefusals as b}from"./Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as x}from"./Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as S}from"./Parsing/GuardedActionValidator.js";import{validatePersonaCallers as C}from"./Parsing/PersonaCallerValidator.js";import{validatePurposes as w}from"./Parsing/PurposeValidator.js";import{timelineOrderDiagnostics as T}from"./Files/TimelineOrder.js";function parseForAuthoring(E,D,O=c,k=!0,A,j){let M=e(E,!1,D),N=d(M,D,j);N.scope=O,N.streamCandidates=A??h.capture([M],O,j);let P=m(N,M,O);if(k){t(P,N),w(P,N),f(P,N),o(P,N),p(P,N),u(P,N),i(P,N);let e=n(P);r(e,N),g(P,N),_(P,N),v(e,N),y(P,N),b(P,N),x(P,N),S(P,N),C(P,N),P=s(P,N),l.validate(P,N);for(let e of a(P))N.information(e.code,e.message,e.location);for(let e of T(P))N.information(e.code,e.message,e.location)}return{value:P,diagnostics:N.diagnostics,triggerData:N.triggerData,inputUses:N.inputUses,success:!N.diagnostics.some(e=>e.severity===`error`)}}export{parseForAuthoring};
1
+ import"../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"./Parsing/SourceLineSplitter.js";import{validateIdentity as t}from"./Parsing/IdentityValidator.js";import{expandSpecificationExamples as n}from"./Parsing/SpecificationCommandExamples.js";import{validateResponses as r}from"./Parsing/ResponseValidator.js";import{validateSpecificationCases as i}from"./Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as a}from"./Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as o}from"./Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as s}from"./Dependencies/DeclaredDependencyTargets.js";import{documentPlacement as c}from"./Files/PlayPlacement.js";import{interactionAncestry as l}from"./Parsing/InteractionAlternatives.js";import"./Parsing/SpecificationParser.js";import"./Parsing/SpecificationExampleParser.js";import"./Parsing/CaptureParser.js";import"./Parsing/ProjectionParser.js";import"./Parsing/ImportDiscovery.js";import{DeclaredDependencies as u}from"./Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as d}from"./Parsing/PublicEventUsageValidator.js";import{sourceContext as f}from"./Parsing/SourceOptionsParser.js";import{validateInlineEvents as p}from"./Parsing/InlineEventValidator.js";import{validateOperations as m}from"./Parsing/OperationValidator.js";import{parseApplication as h}from"./Parsing/ScreenplayParser.js";import{CommandStreamCandidates as g}from"./Parsing/CommandStreamCandidates.js";import{validateEventSources as _}from"./Parsing/EventSourceValidator.js";import{validateProjectionTargets as v}from"./Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as y}from"./Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as b}from"./Parsing/EventSubjectValidator.js";import{validateReactionRefusals as x}from"./Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as S}from"./Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as C}from"./Parsing/GuardedActionValidator.js";import{validatePersonaCallers as w}from"./Parsing/PersonaCallerValidator.js";import{validatePurposes as T}from"./Parsing/PurposeValidator.js";import{timelineOrderDiagnostics as E}from"./Files/TimelineOrder.js";function parseForAuthoring(D,O,k=c,A=!0,j,M){let N=e(D,!1,O),P=f(N,O,M);P.scope=k,P.interactionAncestors=l(N),P.streamCandidates=j??g.capture([N],k,M);let F=h(P,N,k);if(A){t(F,P),T(F,P),p(F,P),o(F,P),m(F,P),d(F,P),i(F,P);let e=n(F);r(e,P),_(F,P),v(F,P),y(e,P),b(F,P),x(F,P),S(F,P),C(F,P),w(F,P),F=s(F,P),u.validate(F,P);for(let e of a(F))P.information(e.code,e.message,e.location);for(let e of E(F))P.information(e.code,e.message,e.location)}return{value:F,diagnostics:P.diagnostics,triggerData:P.triggerData,inputUses:P.inputUses,guardedInteractions:P.guardedInteractions,success:!P.diagnostics.some(e=>e.severity===`error`)}}export{parseForAuthoring};
2
2
  //# sourceMappingURL=ScreenplayCompiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenplayCompiler.js","names":["documentPlacement","lines","splitLines","source","path","context","sourceContext","languages","placement","streamCandidates","CommandStreamCandidates","value","parseApplication","validateResponseContracts","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { InputUse } from './Parsing/InputUses';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity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A,EAAQ,UACnB,QAAS,CAACA,EAAQ,YAAY,KAAK,GAAc6B,EAAW,WAAa,OAAO,CACpF,CACJ"}
1
+ {"version":3,"file":"ScreenplayCompiler.js","names":["documentPlacement","lines","splitLines","source","path","context","sourceContext","languages","placement","interactionAncestry","streamCandidates","CommandStreamCandidates","value","parseApplication","validateResponseContracts","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { InputUse } from './Parsing/InputUses';\nimport { GuardedInteractionBinding, interactionAncestry } from './Parsing/InteractionAlternatives';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[]; readonly guardedInteractions: readonly GuardedInteractionBinding[] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.interactionAncestors = interactionAncestry(lines);\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n guardedInteractions: context.guardedInteractions,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"0xEAoEA,SAAgB,kBAAkB,EAAgB,EAAe,EAA2BA,EAAmB,EAA4B,GAAM,EAA4C,EAA0O,CACna,IAAMC,EAAQC,EAAWC,EAAQ,GAAOC,CAAI,EACtCC,EAAUC,EAAcL,EAAOG,EAAMG,CAAS,EACpD,EAAQ,MAAQC,EAChB,EAAQ,qBAAuBC,EAAoBR,CAAK,EACxD,EAAQ,iBAAmBS,GAAoBC,EAAwB,QAAQ,CAACV,CAAK,EAAGO,EAAWD,CAAS,EAC5G,IAAIK,EAAQC,EAAiBR,EAASJ,EAAOO,CAAS,EAEtD,GAAIM,EAA2B,CAC3BC,EAAiBH,EAAOP,CAAO,EAC/BW,EAAiBJ,EAAOP,CAAO,EAC/BY,EAAqBL,EAAOP,CAAO,EACnCa,EAA6BN,EAAOP,CAAO,EAC3Cc,EAAmBP,EAAOP,CAAO,EACjCe,EAAyBR,EAAOP,CAAO,EACvCgB,EAA2BT,EAAOP,CAAO,EACzC,IAAMiB,EAAYC,EAA4BX,CAAK,EACnDY,EAAkBF,EAAWjB,CAAO,EACpCoB,EAAqBb,EAAOP,CAAO,EACnCqB,EAA0Bd,EAAOP,CAAO,EACxCsB,EAA6BL,EAAWjB,CAAO,EAC/CuB,EAAsBhB,EAAOP,CAAO,EACpCwB,EAAyBjB,EAAOP,CAAO,EACvCyB,EAAgClB,EAAOP,CAAO,EAC9C0B,EAAuBnB,EAAOP,CAAO,EACrC2B,EAAuBpB,EAAOP,CAAO,EACrC,EAAQ4B,EAA+BrB,EAAOP,CAAO,EACrD6B,EAAqB,SAAStB,EAAOP,CAAO,EAC5C,IAAK,IAAM8B,KAAcC,EAAiCxB,CAAK,EAAGP,EAAQ,YAAY8B,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC9I,IAAK,IAAMA,KAAcE,EAAyBzB,CAAK,EAAGP,EAAQ,YAAY8B,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,CAC1I,CACA,MAAO,CACH,QACA,YAAa9B,EAAQ,YACrB,YAAaA,EAAQ,YACrB,UAAWA,EAAQ,UACnB,oBAAqBA,EAAQ,oBAC7B,QAAS,CAACA,EAAQ,YAAY,KAAK,GAAc8B,EAAW,WAAa,OAAO,CACpF,CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/screenplay-language",
3
- "version": "4.126.0",
3
+ "version": "4.127.1",
4
4
  "description": "Monaco language service for the Cratis Screenplay DSL — syntax highlighting, IntelliSense, hover and diagnostics for .play files",
5
5
  "keywords": [
6
6
  "cratis",