@cratis/screenplay-language 4.238.0 → 4.239.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
- package/dist/bundles/completion-items.js +1 -1
- package/dist/bundles/completion-items.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/language.js +1 -1
- package/dist/bundles/language.js.map +1 -1
- package/dist/bundles/scope-items.js +1 -1
- package/dist/bundles/scope-items.js.map +1 -1
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/scope-items.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{validateIdentity as t}from"../Parsing/IdentityValidator.js";import{validateApplicationHandlers as n}from"../Parsing/CommandHandlerValidator.js";import{mergeStructuralInteractions as r}from"../Parsing/StructuralInteractionSites.js";import{combineAuthorize as i}from"../Parsing/AuthorizeParser.js";import{LineReader as a}from"../Parsing/LineReader.js";import{InvalidSyntaxJson as o}from"../Syntax/InvalidSyntaxJson.js";import{invalidSourceOptions as s,isAuthoredDocument as c,legacySourceOptions as l,validatedSourceOptions as u}from"../Syntax/SourceOptions.js";import{ParserContext as d}from"../Parsing/ParserContext.js";import{toSyntaxJson as f}from"../Syntax/SyntaxJson.js";function mergeDocuments(i){let c=[],f=i.map(e=>e.value),p=/* @__PURE__ */ new Map,m=!1;for(let t of f)try{p.set(t,Object.hasOwn(t,`sourceOptions`)?u(t.sourceOptions):l)}catch(n){if(!(n instanceof o))throw n;m=!0,c.push(error(e.IncompatibleNumericSource,n.message,t.location))}let h=f.filter(e=>p.get(e)?.numericMode===`exact`||hasDeclarations(e)),g=p.get(h[0])??l;for(let t of h.slice(1))p.get(t)?.numericMode!==g.numericMode&&(m=!0,c.push(error(e.MixedNumericModes,`Declaration-bearing documents and marked import barrels must independently select the same numeric mode.`,t.location)));m&&(g=s);let _=/* @__PURE__ */ new Map,v=declaredInOneFile(f.flatMap(e=>e.concepts),`declaration of`,c,void 0,_),y=declaredInOneFile(f.flatMap(e=>e.types),`declaration of`,c,void 0,_),b=f.flatMap(e=>e.identity==null?[]:[e.identity]);for(let t of b.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares an identity block in '${describe(b[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let x=f.filter(e=>e.commandReadMode!=null);for(let t of x.slice(1))c.push(error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,t.location));let S=f.filter(e=>e.reactionProductionMode!=null);for(let t of S.slice(1))c.push(error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,t.location));let C=f.map(e=>e.domain).filter(e=>e!==null);for(let t of C.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a domain in '${describe(C[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let w=mergeModules(f.flatMap(e=>e.modules),c),T=declaredInOneFile(f.flatMap(e=>e.personas),`persona`,c),E=f.flatMap(e=>e.policies??[]),D=declaredInOneFile(E,`policy`,c),O=E.filter(e=>!D.includes(e)).map(e=>e.location),k={kind:`ApplicationSyntax`,sourceOptions:g,...S.length===0?{}:{reactionProductionMode:S[0].reactionProductionMode},...x.length===0?{}:{commandReadMode:x[0].commandReadMode},...b.length===0?{}:{identity:b[0]},domain:C[0]??null,imports:firstOfEach(f.flatMap(e=>e.imports),e=>e.qualifiedName),concepts:v,types:y,examples:f.flatMap(e=>e.examples??[]),systems:f.flatMap(e=>e.systems??[]),purposes:declaredInOneFile(f.flatMap(e=>e.purposes??[]),`purpose`,c),eventSources:f.flatMap(e=>e.eventSources??[]),declaredTriggers:f.flatMap(e=>e.declaredTriggers??[]),modules:w,personas:T,policies:D,seeds:f.flatMap(e=>e.seeds??[]),fileImports:f.flatMap(e=>e.fileImports),...presentOnly(`exposures`,f.flatMap(e=>e.exposures??[])),...presentOnly(`instanceContributions`,f.flatMap(e=>e.instanceContributions??[])),location:f[0]?.location??{line:1,column:1}};r(k,f);let A=new d(new a([]));n(k,A),t(k,A),c.push(...A.diagnostics);let j=[...i.flatMap(e=>e.diagnostics).filter(t=>t.code!==e.DuplicateDeclaration||!O.some(e=>sameLocation(e,t.location))),...c];return{value:k,diagnostics:j,success:!j.some(e=>e.severity===`error`)}}function hasDeclarations(e){if(c(e)||e.identity!=null||e.domain!==null||e.concepts.length>0||e.types.length>0||e.personas.length>0||(e.policies?.length??0)>0||(e.purposes?.length??0)>0||(e.seeds?.length??0)>0||(e.systems?.length??0)>0||(e.eventSources?.length??0)>0||(e.examples?.length??0)>0)return!0;let feature=e=>!e.isPlacement||(e.examples?.length??0)>0||e.slices.length>0||e.features.some(feature);return e.modules.some(e=>!e.isPlacement||(e.examples?.length??0)>0||e.features.some(feature))}function mergeModules(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return r({...e[0],isPlacement:!1,features:e[0].features.map(unplaced)},e);let n=r({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`module '${e[0].name}'`,t),documentation:firstDocumentation(e,`module '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`module '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return r({...n,features:mergeFeatures(e.flatMap(e=>e.features),t)},[n])})}function mergeFeatures(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return unplaced(e[0]);let n=r({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`feature '${e[0].name}'`,t),documentation:firstDocumentation(e,`feature '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`feature '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return r({...n,features:mergeFeatures(e.flatMap(e=>e.features),t),slices:declaredInOneFile(e.flatMap(e=>e.slices),`slice`,t,`feature '${e[0].name}'`)},[n])})}function groupDependencies(e){return[...e].sort((e,t)=>(e.location.path??``)<(t.location.path??``)?-1:+((e.location.path??``)>(t.location.path??``))).flatMap(e=>e.dependsOn??[])}function placedLast(e){return[...e.filter(e=>!e.isPlacement),...e.filter(e=>e.isPlacement)]}function unplaced(e){return r({...e,isPlacement:!1,features:e.features.map(unplaced)},[e])}function combineAuthorization(t,n,r){let a=[];for(let i of t.filter(e=>e!==null)){let t=a.find(e=>e.location.path!==i.location.path&&JSON.stringify(f(e))===JSON.stringify(f(i)));t===void 0?a.push(i):r.push(warning(e.DuplicateAuthorizationAcrossFiles,`An identical authorization is already declared on the ${n} in '${describe(t.location.path)}' - this repeated gate is ignored`,i.location))}return a.reduce((e,t)=>i(e,t),null)}function firstOfEach(e,t){let n=/* @__PURE__ */ new Set;return e.filter(e=>!n.has(t(e))&&n.add(t(e))!==void 0)}function groupByName(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,[...t.get(n.name)??[],n]);return[...t.values()]}function firstDocumentation(t,n,r){let i=t.filter(e=>e.documentation!=null);for(let t of i.slice(1).filter(e=>e.documentation!==i[0].documentation))r.push(warning(e.ConflictingDocumentationAcrossFiles,`The ${n} is already documented in '${describe(i[0].location.path)}' - keeping that documentation`,t.location));return i[0]?.documentation??null}function firstDescription(t,n,r){let i=t.filter(e=>e.description!==null);for(let t of i.slice(1).filter(e=>e.description!==i[0].description))r.push(warning(e.ConflictingDescriptionAcrossFiles,`The ${n} is already described in '${describe(i[0].location.path)}' - keeping that description`,t.location));return i[0]?.description??null}function declaredInOneFile(t,n,r,i,a=/* @__PURE__ */ new Map){let o=[];for(let s of t){let t=a.get(s.name);t!==void 0&&t.path!==s.location.path?r.push(error(e.RepeatedDeclarationAcrossFiles,`Duplicate ${n} '${s.name}'${i===void 0?``:` in ${i}`} - already declared in '${describe(t.path)}'`,s.location)):(t===void 0&&a.set(s.name,s.location),o.push(s))}return o}const describe=e=>e??`another file`,sameLocation=(e,t)=>e.path===t.path&&e.line===t.line&&e.column===t.column,error=(e,t,n)=>({severity:`error`,code:e,message:t,location:n}),warning=(e,t,n)=>({severity:`warning`,code:e,message:t,location:n});function presentOnly(e,t){return t.length===0?{}:{[e]:t}}export{mergeDocuments};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{validateIdentity as t}from"../Parsing/IdentityValidator.js";import{validateApplicationHandlers as n}from"../Parsing/CommandHandlerValidator.js";import{mergeStructuralInteractions as r}from"../Parsing/StructuralInteractionSites.js";import{combineAuthorize as i}from"../Parsing/AuthorizeParser.js";import{LineReader as a}from"../Parsing/LineReader.js";import{InvalidSyntaxJson as o}from"../Syntax/InvalidSyntaxJson.js";import{invalidSourceOptions as s,isAuthoredDocument as c,legacySourceOptions as l,validatedSourceOptions as u}from"../Syntax/SourceOptions.js";import{ParserContext as d}from"../Parsing/ParserContext.js";import{toSyntaxJson as f}from"../Syntax/SyntaxJson.js";function mergeDocuments(i){let c=[],f=i.map(e=>e.value),p=/* @__PURE__ */ new Map,m=!1;for(let t of f)try{p.set(t,Object.hasOwn(t,`sourceOptions`)?u(t.sourceOptions):l)}catch(n){if(!(n instanceof o))throw n;m=!0,c.push(error(e.IncompatibleNumericSource,n.message,t.location))}let h=f.filter(e=>p.get(e)?.numericMode===`exact`||hasDeclarations(e)),g=p.get(h[0])??l;for(let t of h.slice(1))p.get(t)?.numericMode!==g.numericMode&&(m=!0,c.push(error(e.MixedNumericModes,`Declaration-bearing documents and marked import barrels must independently select the same numeric mode.`,t.location)));m&&(g=s);let _=/* @__PURE__ */ new Map,v=declaredInOneFile(f.flatMap(e=>e.concepts),`declaration of`,c,void 0,_),y=declaredInOneFile(f.flatMap(e=>e.types),`declaration of`,c,void 0,_),b=f.flatMap(e=>e.identity==null?[]:[e.identity]);for(let t of b.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares an identity block in '${describe(b[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let x=f.filter(e=>e.commandReadMode!=null);for(let t of x.slice(1))c.push(error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,t.location));let S=f.filter(e=>e.reactionProductionMode!=null);for(let t of S.slice(1))c.push(error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,t.location));let C=f.map(e=>e.domain).filter(e=>e!==null);for(let t of C.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a domain in '${describe(C[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let w=mergeModules(f.flatMap(e=>e.modules),c),T=declaredInOneFile(f.flatMap(e=>e.personas),`persona`,c),E=f.flatMap(e=>e.policies??[]),D=declaredInOneFile(E,`policy`,c),O=E.filter(e=>!D.includes(e)).map(e=>e.location),k={kind:`ApplicationSyntax`,sourceOptions:g,...S.length===0?{}:{reactionProductionMode:S[0].reactionProductionMode},...x.length===0?{}:{commandReadMode:x[0].commandReadMode},...b.length===0?{}:{identity:b[0]},domain:C[0]??null,imports:firstOfEach(f.flatMap(e=>e.imports),e=>e.qualifiedName),concepts:v,types:y,examples:f.flatMap(e=>e.examples??[]),systems:f.flatMap(e=>e.systems??[]),purposes:declaredInOneFile(f.flatMap(e=>e.purposes??[]),`purpose`,c),eventSources:f.flatMap(e=>e.eventSources??[]),declaredTriggers:f.flatMap(e=>e.declaredTriggers??[]),modules:w,personas:T,policies:D,seeds:f.flatMap(e=>e.seeds??[]),fileImports:f.flatMap(e=>e.fileImports),...presentOnly(`stickyNotes`,f.flatMap(e=>e.stickyNotes??[])),...presentOnly(`exposures`,f.flatMap(e=>e.exposures??[])),...presentOnly(`instanceContributions`,f.flatMap(e=>e.instanceContributions??[])),location:f[0]?.location??{line:1,column:1}};r(k,f);let A=new d(new a([]));n(k,A),t(k,A),c.push(...A.diagnostics);let j=[...i.flatMap(e=>e.diagnostics).filter(t=>t.code!==e.DuplicateDeclaration||!O.some(e=>sameLocation(e,t.location))),...c];return{value:k,diagnostics:j,success:!j.some(e=>e.severity===`error`)}}function hasDeclarations(e){if(c(e)||e.identity!=null||e.domain!==null||e.concepts.length>0||e.types.length>0||e.personas.length>0||(e.policies?.length??0)>0||(e.purposes?.length??0)>0||(e.seeds?.length??0)>0||(e.systems?.length??0)>0||(e.eventSources?.length??0)>0||(e.examples?.length??0)>0||(e.stickyNotes?.length??0)>0)return!0;let feature=e=>!e.isPlacement||(e.examples?.length??0)>0||e.slices.length>0||e.features.some(feature);return e.modules.some(e=>!e.isPlacement||(e.examples?.length??0)>0||e.features.some(feature))}function mergeModules(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return r({...e[0],isPlacement:!1,features:e[0].features.map(unplaced)},e);let n=r({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`module '${e[0].name}'`,t),documentation:firstDocumentation(e,`module '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`module '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return r({...n,features:mergeFeatures(e.flatMap(e=>e.features),t)},[n])})}function mergeFeatures(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return unplaced(e[0]);let n=r({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`feature '${e[0].name}'`,t),documentation:firstDocumentation(e,`feature '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`feature '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return r({...n,features:mergeFeatures(e.flatMap(e=>e.features),t),slices:declaredInOneFile(e.flatMap(e=>e.slices),`slice`,t,`feature '${e[0].name}'`)},[n])})}function groupDependencies(e){return[...e].sort((e,t)=>(e.location.path??``)<(t.location.path??``)?-1:+((e.location.path??``)>(t.location.path??``))).flatMap(e=>e.dependsOn??[])}function placedLast(e){return[...e.filter(e=>!e.isPlacement),...e.filter(e=>e.isPlacement)]}function unplaced(e){return r({...e,isPlacement:!1,features:e.features.map(unplaced)},[e])}function combineAuthorization(t,n,r){let a=[];for(let i of t.filter(e=>e!==null)){let t=a.find(e=>e.location.path!==i.location.path&&JSON.stringify(f(e))===JSON.stringify(f(i)));t===void 0?a.push(i):r.push(warning(e.DuplicateAuthorizationAcrossFiles,`An identical authorization is already declared on the ${n} in '${describe(t.location.path)}' - this repeated gate is ignored`,i.location))}return a.reduce((e,t)=>i(e,t),null)}function firstOfEach(e,t){let n=/* @__PURE__ */ new Set;return e.filter(e=>!n.has(t(e))&&n.add(t(e))!==void 0)}function groupByName(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,[...t.get(n.name)??[],n]);return[...t.values()]}function firstDocumentation(t,n,r){let i=t.filter(e=>e.documentation!=null);for(let t of i.slice(1).filter(e=>e.documentation!==i[0].documentation))r.push(warning(e.ConflictingDocumentationAcrossFiles,`The ${n} is already documented in '${describe(i[0].location.path)}' - keeping that documentation`,t.location));return i[0]?.documentation??null}function firstDescription(t,n,r){let i=t.filter(e=>e.description!==null);for(let t of i.slice(1).filter(e=>e.description!==i[0].description))r.push(warning(e.ConflictingDescriptionAcrossFiles,`The ${n} is already described in '${describe(i[0].location.path)}' - keeping that description`,t.location));return i[0]?.description??null}function declaredInOneFile(t,n,r,i,a=/* @__PURE__ */ new Map){let o=[];for(let s of t){let t=a.get(s.name);t!==void 0&&t.path!==s.location.path?r.push(error(e.RepeatedDeclarationAcrossFiles,`Duplicate ${n} '${s.name}'${i===void 0?``:` in ${i}`} - already declared in '${describe(t.path)}'`,s.location)):(t===void 0&&a.set(s.name,s.location),o.push(s))}return o}const describe=e=>e??`another file`,sameLocation=(e,t)=>e.path===t.path&&e.line===t.line&&e.column===t.column,error=(e,t,n)=>({severity:`error`,code:e,message:t,location:n}),warning=(e,t,n)=>({severity:`warning`,code:e,message:t,location:n});function presentOnly(e,t){return t.length===0?{}:{[e]:t}}export{mergeDocuments};
|
|
2
2
|
//# sourceMappingURL=PlayFolderMerge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayFolderMerge.js","names":["diagnostics","applications","documents","document","options","invalid","application","validatedSourceOptions","legacySourceOptions","failure","InvalidSyntaxJson","DiagnosticCodes","asserted","sourceOptions","invalidSourceOptions","named","concepts","types","identities","extra","readModes","modes","domains","domain","modules","personas","declaredPolicies","policies","droppedPolicies","policy","value","item","mergeStructuralInteractions","identityContext","ParserContext","LineReader","validateApplicationHandlers","validateIdentity","all","diagnostic","location","isAuthoredDocument","node","module","parts","owner","part","reference","features","left","right","feature","kept","authorization","declarations","declaration","first","earlier","toSyntaxJson","combineAuthorize","combined","next","seen","items","key","groups","documented","disagreeing","described","claimed","keyword","within","path","values"],"sources":["../../../../../../Compiler/Files/PlayFolderMerge.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 { mergeStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateIdentity } from '../Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from '../Parsing/CommandHandlerValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const readModes = applications.filter(application => application.commandReadMode != null);\n for (const extra of readModes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidCommandReadsDeclaration,\n \"Declare 'command reads protected' once at the application root.\", extra.location));\n const modes = applications.filter(application => application.reactionProductionMode != null);\n for (const extra of modes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidReactionBatchesDeclaration,\n \"Declare 'reaction batches atomic' once at the application root.\", extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const declaredPolicies = applications.flatMap(application => application.policies ?? []);\n const policies = declaredInOneFile(declaredPolicies, 'policy', diagnostics);\n // Like the C# merge, a policy dropped as repeated across files is not also reported as repeated within its file.\n const droppedPolicies = declaredPolicies.filter(policy => !policies.includes(policy)).map(policy => policy.location);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(modes.length === 0 ? {} : { reactionProductionMode: modes[0].reactionProductionMode }),\n ...(readModes.length === 0 ? {} : { commandReadMode: readModes[0].commandReadMode }),\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies,\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n mergeStructuralInteractions(value, applications);\n const identityContext = new ParserContext(new LineReader([]));\n validateApplicationHandlers(value, identityContext);\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const documentDiagnostics = documents.flatMap(document => document.diagnostics).filter(diagnostic =>\n diagnostic.code !== DiagnosticCodes.DuplicateDeclaration || !droppedPolicies.some(location => sameLocation(location, diagnostic.location)));\n const all = [...documentDiagnostics, ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => {\n if (parts.length === 1) return mergeStructuralInteractions({ ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) }, parts);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner, features: mergeFeatures(parts.flatMap(part => part.features), diagnostics) }, [owner]);\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => {\n if (parts.length === 1) return unplaced(parts[0]);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner,\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n }, [owner]);\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return mergeStructuralInteractions({ ...feature, isPlacement: false, features: feature.features.map(unplaced) }, [feature]);\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && JSON.stringify(toSyntaxJson(earlier)) === JSON.stringify(toSyntaxJson(authorization)));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n return kept.reduce<AuthorizeSyntax | null>((combined, next) => combineAuthorize(combined, next), null);\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst sameLocation = (left: SourceLocation, right: SourceLocation): boolean => left.path === right.path && left.line === right.line && left.column === right.column;\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n"],"mappings":"myBAuBA,SAAgB,eAAe,EAAkG,CAC7H,IAAMA,EAA4B,CAAC,EAC7BC,EAAeC,EAAU,IAAI,GAAYC,EAAS,KAAK,EACvDC,kBAAU,IAAI,IAChBC,EAAU,GACd,IAAK,IAAMC,KAAeL,EACtB,GAAI,CACAG,EAAQ,IAAIE,EAAa,OAAO,OAAOA,EAAa,eAAe,EAAIC,EAAuBD,EAAY,aAAa,EAAIE,CAAmB,CAClJ,OAASC,EAAS,CACd,GAAI,EAAEA,aAAmBC,GAAoB,MAAMD,EACnD,EAAU,GACVT,EAAY,KAAK,MAAMW,EAAgB,0BAA2BF,EAAQ,QAASH,EAAY,QAAQ,CAAC,CAC5G,CAEJ,IAAMM,EAAWX,EAAa,OAAO,GAAeG,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgB,SAAW,gBAAgBA,CAAW,CAAC,EACjIO,EAAgBT,EAAQ,IAAIQ,EAAS,EAAE,GAAKJ,EAChD,IAAK,IAAMF,KAAeM,EAAS,MAAM,CAAC,EAClCR,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgBO,EAAc,cACxD,EAAU,GACVb,EAAY,KAAK,MA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AAK,OAASC,EAAM,MAAQD,EAAK,OAASC,EAAM,MAAQD,EAAK,SAAWC,EAAM,OACvJ,OAAS,EAAc,EAAiB,KAA0C,CAAE,SAAU,QAAS,OAAM,UAAS,UAAS,GAC/H,SAAW,EAAc,EAAiB,KAA0C,CAAE,SAAU,UAAW,OAAM,UAAS,UAAS,GAGzI,SAAS,YAAyC,EAAW,EAAqE,CAC9H,OAAOuB,EAAO,SAAW,EAAI,CAAC,EAAI,EAAGT,GAAMS,CAAO,CACtD"}
|
|
1
|
+
{"version":3,"file":"PlayFolderMerge.js","names":["diagnostics","applications","documents","document","options","invalid","application","validatedSourceOptions","legacySourceOptions","failure","InvalidSyntaxJson","DiagnosticCodes","asserted","sourceOptions","invalidSourceOptions","named","concepts","types","identities","extra","readModes","modes","domains","domain","modules","personas","declaredPolicies","policies","droppedPolicies","policy","value","item","mergeStructuralInteractions","identityContext","ParserContext","LineReader","validateApplicationHandlers","validateIdentity","all","diagnostic","location","isAuthoredDocument","node","module","parts","owner","part","reference","features","left","right","feature","kept","authorization","declarations","declaration","first","earlier","toSyntaxJson","combineAuthorize","combined","next","seen","items","key","groups","documented","disagreeing","described","claimed","keyword","within","path","values"],"sources":["../../../../../../Compiler/Files/PlayFolderMerge.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 { mergeStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateIdentity } from '../Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from '../Parsing/CommandHandlerValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const readModes = applications.filter(application => application.commandReadMode != null);\n for (const extra of readModes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidCommandReadsDeclaration,\n \"Declare 'command reads protected' once at the application root.\", extra.location));\n const modes = applications.filter(application => application.reactionProductionMode != null);\n for (const extra of modes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidReactionBatchesDeclaration,\n \"Declare 'reaction batches atomic' once at the application root.\", extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const declaredPolicies = applications.flatMap(application => application.policies ?? []);\n const policies = declaredInOneFile(declaredPolicies, 'policy', diagnostics);\n // Like the C# merge, a policy dropped as repeated across files is not also reported as repeated within its file.\n const droppedPolicies = declaredPolicies.filter(policy => !policies.includes(policy)).map(policy => policy.location);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(modes.length === 0 ? {} : { reactionProductionMode: modes[0].reactionProductionMode }),\n ...(readModes.length === 0 ? {} : { commandReadMode: readModes[0].commandReadMode }),\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies,\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('stickyNotes', applications.flatMap(application => application.stickyNotes ?? [])),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n mergeStructuralInteractions(value, applications);\n const identityContext = new ParserContext(new LineReader([]));\n validateApplicationHandlers(value, identityContext);\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const documentDiagnostics = documents.flatMap(document => document.diagnostics).filter(diagnostic =>\n diagnostic.code !== DiagnosticCodes.DuplicateDeclaration || !droppedPolicies.some(location => sameLocation(location, diagnostic.location)));\n const all = [...documentDiagnostics, ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0 || (application.stickyNotes?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => {\n if (parts.length === 1) return mergeStructuralInteractions({ ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) }, parts);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner, features: mergeFeatures(parts.flatMap(part => part.features), diagnostics) }, [owner]);\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => {\n if (parts.length === 1) return unplaced(parts[0]);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner,\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n }, [owner]);\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return mergeStructuralInteractions({ ...feature, isPlacement: false, features: feature.features.map(unplaced) }, [feature]);\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && JSON.stringify(toSyntaxJson(earlier)) === JSON.stringify(toSyntaxJson(authorization)));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n return kept.reduce<AuthorizeSyntax | null>((combined, next) => combineAuthorize(combined, next), null);\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst sameLocation = (left: SourceLocation, right: SourceLocation): boolean => left.path === right.path && left.line === right.line && left.column === right.column;\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n"],"mappings":"myBAuBA,SAAgB,eAAe,EAAkG,CAC7H,IAAMA,EAA4B,CAAC,EAC7BC,EAAeC,EAAU,IAAI,GAAYC,EAAS,KAAK,EACvDC,kBAAU,IAAI,IAChBC,EAAU,GACd,IAAK,IAAMC,KAAeL,EACtB,GAAI,CACAG,EAAQ,IAAIE,EAAa,OAAO,OAAOA,EAAa,eAAe,EAAIC,EAAuBD,EAAY,aAAa,EAAIE,CAAmB,CAClJ,OAASC,EAAS,CACd,GAAI,EAAEA,aAAmBC,GAAoB,MAAMD,EACnD,EAAU,GACVT,EAAY,KAAK,MAAMW,EAAgB,0BAA2BF,EAAQ,QAASH,EAAY,QAAQ,CAAC,CAC5G,CAEJ,IAAMM,EAAWX,EAAa,OAAO,GAAeG,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgB,SAAW,gBAAgBA,CAAW,CAAC,EACjIO,EAAgBT,EAAQ,IAAIQ,EAAS,EAAE,GAAKJ,EAChD,IAAK,IAAMF,KAAeM,EAAS,MAAM,CAAC,EAClCR,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgBO,EAAc,cACxD,EAAU,GACVb,EAAY,KAAK,MAAMW,EAAgB,kBAAmB,2GAA4GL,EAAY,QAAQ,CAAC,GAG/LD,IAAS,EAAgBS,GAC7B,IAAMC,kBAAQ,IAAI,IACZC,EAAW,kBAAiCf,EAAa,QAAQ,GAAeK,EAAY,QAAQ,EAAG,iBAAkBN,EAAa,IAAA,GAAWe,CAAK,EACtJE,EAAQ,kBAA8BhB,EAAa,QAAQ,GAAeK,EAAY,KAAK,EAAG,iBAAkBN,EAAa,IAAA,GAAWe,CAAK,EAC7IG,EAAajB,EAAa,QAAQ,GAAeK,EAAY,UAAY,KAAO,CAAC,EAAI,CAACA,EAAY,QAAQ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AI,CAAC,EAAI,EAAGT,GAAMS,CAAO,CACtD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{locationOf as i,startOf as a}from"./SourceLine.js";import{parseComplianceDirective as o,parseComplianceMarkers as s}from"./ConceptComplianceParser.js";import{firstWord as c,unescapeIdentifier as l}from"./LineText.js";import{describePlacement as u,documentPlacement as d,isDocumentPlacement as f}from"../Files/PlayPlacement.js";import{parseDescription as p}from"./DescriptionParser.js";import{parsePurpose as m}from"./PurposeParser.js";import{isFileImport as h,parseFileImport as g}from"./FileImportParser.js";import{recordAuthoredDocument as _}from"../Syntax/SourceOptions.js";import{collectInputUses as v}from"./InputUses.js";import{misplacedReactionIdentity as y}from"./ReactionIdentityParser.js";import{parseEventSource as b}from"./EventSourceParser.js";import{isFileDirective as x}from"./FileReferences.js";import{parseSystem as S}from"./OperationParser.js";import{parseExample as C}from"./SpecificationExampleParser.js";import{isBlankPublicEventOrigin as w}from"../Syntax/PublicEventInvariants.js";import{parseType as ee}from"./DeclarationParsers.js";import{parseValidate as T}from"./CommandParser.js";import{parseTriggerDeclaration as te}from"./TriggerDataParser.js";import{FeatureBody as ne,featureBodyExpected as E}from"./FeatureBody.js";import{ModuleBody as D,moduleBodyExpected as O,modulePattern as k,parseModule as re}from"./ModuleBody.js";import{EnumerationMembers as A}from"./EnumerationMembers.js";import{parseGeneration as j}from"./GenerationParser.js";import{parseIdentity as M}from"./IdentityParser.js";import{parsePolicy as N}from"./PolicyParser.js";import{parseSeed as P}from"./SeedParser.js";import{parseExposure as F,parseInstance as I}from"./CompositionParser.js";import{parseUiProfile as L}from"./UiProfileLegacyLayout.js";const R=r(`^domain\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),z=r(`^import\\s+([\\w.]+)(?:\\s+from\\s+"(?<origin>${t})")?$`),B=r(`^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@?\\w+)*)$`),V=r(`^@?[a-z_]\\w*$`),H=r(`^persona\\s+([A-Za-z_]\\w*)$`),U=r(`^policy\\s+([A-Za-z_]\\w*)$`),W=/^[ ]*\t/,G=[`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`],K=/* @__PURE__ */ new Set([`policy`,`authentication`,`seed`,`ui`,`theme`,`trigger`,`layout`,`behavior`,`sample`]),q=/* @__PURE__ */ new Set([`slice`,`feature`,`description`,`documentation`,`authorize`,`screen`,`dialog`,`form`,`contribute`,`on`,`uses`]);function parseApplication(t,r,a=d){t.deferIdentityValidation=!0,warnOnTabIndentation(t,r);let o=a.length===1?new D(a[0]):void 0,s=a.length>1?new ne(a[a.length-1]):void 0,l=o??s,u=null,p=null,x=!1,T=null,E=!1,O=null,k=[],A=[],j=[],R=[],B=[],V=[],H=[],U=[],W=[],G=[],q=[],J=[],Y=[],X=[],Z=[],Q=!1;for(let r=t.reader.peekSignificant();r!==void 0;r=t.reader.peekSignificant()){t.reader.takeSignificant();let s=c(r.content);if(s===`command`&&/^command\s+reads(?:\s|$)/.test(r.content))E||!f(a)||!/^command\s+reads\s+protected$/.test(r.content)?t.error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,i(r)):T=`Protected`,E=!0;else if(s===`reaction`)x||!f(a)||!/^reaction\s+batches\s+atomic$/.test(r.content)?t.error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,i(r)):p=`Atomic`,x=!0;else if(s===`runs`)y(t,r);else if(s===`domain`)t.authoredDeclarations=!0,O=parseDomain(t,r,O,Q);else if(Q||=declaresConstruct(s,r,a),t.authoredDeclarations||=s!==`import`&&declaresConstruct(s,r,a),s===`import`&&h(r.content))l===void 0?g(t,r,A):l.tryParse(t,r);else if(s===`import`){let a=z.exec(r.content);if(a===null)t.error(e.InvalidImportDeclaration,`Invalid import '${r.content}' - expected 'import <Qualified.Name> [from "<origin>"]'`,i(r));else{let o=a.groups?.origin===void 0?null:n(a.groups.origin);o!==null&&w(o)&&t.error(e.InvalidImportDeclaration,`An import origin must be a nonblank quoted string`,i(r)),k.push({kind:`ImportSyntax`,qualifiedName:a[1],origin:o,visibility:o===null?`Private`:`Public`,location:i(r)})}}else if(s===`example`)l===void 0?J.push(C(t,r)):l.tryParse(t,r);else if(s===`eventsource`)V.push(b(t,r));else if(s===`system`)B.push(S(t,r));else if(s===`concept`)j.push(parseConcept(t,r));else if(s===`type`)R.push(ee(t,r));else if(s===`module`&&!f(a))parseModuleInPlacedFile(t,r,a,o);else if(s===`module`)H.push(re(t,r));else if(s===`persona`)U.push(parsePersona(t,r));else if(s===`seed`)q.push(P(t.valueContext,r));else if(s===`purpose`&&l!==void 0)l.tryParse(t,r);else if(s===`purpose`)G.push(m(t,r));else if(s===`identity`)u=M(t,r,u);else if(s===`policy`){let n=N(t,r);W.some(e=>e.name===n.name)&&t.error(e.DuplicateDeclaration,`Duplicate declaration of policy '${n.name}' - policy names must be unique`,n.location),W.push(n)}else if(s===`exposure`)X.push(F(t,r));else if(s===`instance`)Z.push(I(t,r));else if(s===`trigger`){let e=te(t,r),n=/^trigger\s+([A-Za-z_]\w*)$/.exec(r.content)?.[1];n!==void 0&&Y.push({name:n,data:e})}else K.has(s)?s===`behavior`||s===`layout`?v(t,r):s===`ui`?L(t,r):t.skipOpaqueBlock(r.indent):l?.tryParse(t,r)!==!0&&reportUnexpectedTopLevel(t,r,a)}o===void 0?s!==void 0&&H.unshift(place(a,s.build(t.start,!0),t.start)):H.unshift(o.build(t.start,!0));let $={kind:`ApplicationSyntax`,...T===null?{}:{commandReadMode:T},...p===null?{}:{reactionProductionMode:p},...u===null?{}:{identity:u},sourceOptions:t.sourceOptions,domain:O,imports:k,concepts:j,types:R,systems:B,eventSources:V,examples:J,modules:H,personas:U,policies:W,purposes:G,seeds:q,declaredTriggers:Y,fileImports:A,...X.length>0?{exposures:X}:{},...Z.length>0?{instanceContributions:Z}:{},location:t.start};return t.authoredDeclarations&&_($),$}function declaresConstruct(e,t,n){return e===`import`?z.test(t.content):e===`module`?f(n):e===`identity`?t.content===`identity`:e===`purpose`||e===`example`||e===`exposure`||e===`instance`||e===`eventsource`||e===`system`||e===`concept`||e===`type`||e===`persona`||K.has(e)}function parseModuleInPlacedFile(t,n,r,a){let o=k.exec(n.content)?.[1]??``;a!==void 0&&o===r[0]?(t.authoredDeclarations=!0,a.parseChildren(t,n)):(t.error(e.ModuleInPlacedFile,`This file is imported into ${u(r)}, so it cannot declare module '${o}' - import it at the top level of a document instead`,i(n)),t.skipBlock(n.indent))}function reportUnexpectedTopLevel(t,n,r){let a=c(n.content);if(f(r)){let r=q.has(a)?` - '${a}' belongs in a module or feature; wrap it in one, or import this file from inside one`:` - expected domain, import, concept, type, policy, persona, authentication, identity, module, seed, trigger, behavior, ui profile, theme, sample data or layout`;t.error(e.UnknownTopLevelConstruct,`Unexpected '${a}' at the top level${r}`,i(n))}else{let o=r.length===1?O:E;t.error(e.UnexpectedInPlacedFile,`Unexpected '${a}' in a file imported into ${u(r)} - expected an application declaration or ${o}`,i(n))}t.skipBlock(n.indent)}function place(e,t,n){let r=t;for(let t=e.length-2;t>=1;t--)r={kind:`FeatureSyntax`,name:e[t],description:null,authorize:null,features:[r],slices:[],fileImports:[],isPlacement:!0,location:n};return{kind:`ModuleSyntax`,name:e[0],description:null,authorize:null,features:[r],fileImports:[],isPlacement:!0,location:n}}function parseDomain(t,n,r,a){let o=R.exec(n.content);return o===null?(t.error(e.InvalidDomainDeclaration,`Invalid domain declaration '${n.content}' - expected 'domain <Qualified.Name>'`,i(n)),r):r===null?(a&&t.error(e.DomainNotFirst,`'domain' must be declared before any other construct`,i(n)),{kind:`DomainSyntax`,name:o[1],location:i(n)}):(t.error(e.DuplicateDomain,`The document already declares a domain - a document can have at most one`,i(n)),r)}function warnOnTabIndentation(t,n){let r=!1;for(let i of n)i.raw.trimStart().startsWith("```")?r=!r:!r&&W.test(i.raw)&&t.warning(e.TabIndentation,`Screenplay is indentation based - use spaces, not tabs`,a(i))}function parseConcept(t,n){let r=B.exec(n.content);if(r===null)return t.error(e.InvalidConceptDeclaration,`Invalid concept declaration '${n.content}' - expected 'concept <Name> : <Type>'`,i(n)),t.skipBlock(n.indent),{kind:`ConceptSyntax`,name:c(n.content),type:``,attributes:[],values:[],location:i(n)};let[,a,u,d]=r,f=s(t,n,a,d);u!==`Enum`&&!G.includes(u)&&t.error(e.UnknownPrimitiveType,`Unknown primitive type '${u}' - expected ${G.join(`, `)} or Enum`,i(n));let m=[],h=new A,g=null,_=!1,v=null,y=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=u===`Enum`?h.tryNumbered(t,r):void 0;if(n!==void 0)m.push(n);else if(c(r.content)===`description`&&(u!==`Enum`||r.content!==`description`||t.peekChild(r.indent)?.content.startsWith("```")===!0))v=p(t,r,v,`Concept '${a}'`);else if(x(r))continue;else if(c(r.content)===`validate`){u===`Enum`&&r.content===`validate`&&t.peekChild(r.indent)===void 0&&t.warning(e.ValidateReadAsEnumerationBlock,`'validate' in enumeration concept '${a}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,i(r));let n=T(t,r,`concept`,a);n!==void 0&&y.push(n)}else if(c(r.content)===`generate`&&(u!==`Enum`||r.content!==`generate`)){_&&t.error(e.DuplicateGeneration,`Concept '${a}' declares generation more than once.`,i(r));let n=j(t,r,u);_||(g=n),_=!0}else o(t,r,a,f)||(u===`Enum`&&V.test(r.content)?m.push(l(r.content)):u===`Enum`?t.error(e.InvalidEnumerationValue,`Invalid enum value '${r.content}' - expected an identifier`,i(r)):(t.error(e.UnknownConceptDirective,`Unexpected '${r.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason "<text>"'`,i(r)),t.skipBlock(r.indent)))}let b=h.finish(t,n,m.length);return{kind:`ConceptSyntax`,name:a,type:u,attributes:f,values:m,validations:y,description:v,...g===null?{}:{generation:g},...b===void 0?{}:{valueNumbers:b},location:i(n)}}function parsePersona(t,n){let r=H.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidPersonaDeclaration,`Invalid persona declaration '${n.content}' - expected 'persona <Name>'`,i(n));let a=null,o=[];for(let s=t.peekChild(n.indent);s!==void 0;s=t.peekChild(n.indent)){t.reader.takeSignificant();let n=c(s.content);if(n===`description`)a=p(t,s,a,`Persona '${r}'`);else if(n===`policy`){let n=U.exec(s.content);n===null?t.error(e.InvalidPersonaPolicyReference,`Invalid policy reference '${s.content}' - expected 'policy <Name>'`,i(s)):o.push(n[1])}else t.error(e.UnknownPersonaDirective,`Unexpected '${n}' in persona body - expected description or policy`,i(s)),t.skipBlock(s.indent)}return{kind:`PersonaSyntax`,name:r,description:a,policies:o,location:i(n)}}export{parseApplication};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{locationOf as i,startOf as a}from"./SourceLine.js";import{parseComplianceDirective as o,parseComplianceMarkers as s}from"./ConceptComplianceParser.js";import{firstWord as c,unescapeIdentifier as l}from"./LineText.js";import{describePlacement as u,documentPlacement as d,isDocumentPlacement as f}from"../Files/PlayPlacement.js";import{parseDescription as p}from"./DescriptionParser.js";import{parsePurpose as m}from"./PurposeParser.js";import{isFileImport as h,parseFileImport as g}from"./FileImportParser.js";import{recordAuthoredDocument as _}from"../Syntax/SourceOptions.js";import{collectInputUses as v}from"./InputUses.js";import{misplacedReactionIdentity as y}from"./ReactionIdentityParser.js";import{parseEventSource as b}from"./EventSourceParser.js";import{isFileDirective as x}from"./FileReferences.js";import{parseSystem as S}from"./OperationParser.js";import{parseExample as ee}from"./SpecificationExampleParser.js";import{isBlankPublicEventOrigin as te}from"../Syntax/PublicEventInvariants.js";import{parseType as ne}from"./DeclarationParsers.js";import{parseValidate as C}from"./CommandParser.js";import{parseTriggerDeclaration as w}from"./TriggerDataParser.js";import{FeatureBody as T,featureBodyExpected as E}from"./FeatureBody.js";import{ModuleBody as D,moduleBodyExpected as O,modulePattern as k,parseModule as A}from"./ModuleBody.js";import{EnumerationMembers as j}from"./EnumerationMembers.js";import{parseGeneration as M}from"./GenerationParser.js";import{parseIdentity as N}from"./IdentityParser.js";import{parsePolicy as P}from"./PolicyParser.js";import{parseSeed as F}from"./SeedParser.js";import{parseExposure as I,parseInstance as re}from"./CompositionParser.js";import{parseUiProfile as ie}from"./UiProfileLegacyLayout.js";const L=r(`^domain\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),R=r(`^import\\s+([\\w.]+)(?:\\s+from\\s+"(?<origin>${t})")?$`),z=r(`^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@?\\w+)*)$`),B=r(`^@?[a-z_]\\w*$`),V=r(`^persona\\s+([A-Za-z_]\\w*)$`),H=r(`^policy\\s+([A-Za-z_]\\w*)$`),U=r(`^goal\\s+"(${t})"$`),W=r(`^sticky\\s+note\\s+on\\s+personas$`),G=r(`^colour\\s+(yellow|pink|green|blue)$`),K=r(`^(position|size)\\s+(-?\\d+)\\s+(-?\\d+)$`),q=/^[ ]*\t/,J=[`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`],Y=/* @__PURE__ */ new Set([`policy`,`authentication`,`seed`,`ui`,`theme`,`trigger`,`layout`,`behavior`,`sample`]),X=/* @__PURE__ */ new Set([`slice`,`feature`,`description`,`documentation`,`authorize`,`screen`,`dialog`,`form`,`contribute`,`on`,`uses`]);function parseApplication(t,r,a=d){t.deferIdentityValidation=!0,warnOnTabIndentation(t,r);let o=a.length===1?new D(a[0]):void 0,s=a.length>1?new T(a[a.length-1]):void 0,l=o??s,u=null,p=null,x=!1,C=null,E=!1,O=null,k=[],j=[],M=[],L=[],z=[],B=[],V=[],H=[],U=[],W=[],G=[],K=[],q=[],J=[],X=[],Z=[],Q=!1;for(let r=t.reader.peekSignificant();r!==void 0;r=t.reader.peekSignificant()){t.reader.takeSignificant();let s=c(r.content);if(s===`command`&&/^command\s+reads(?:\s|$)/.test(r.content))E||!f(a)||!/^command\s+reads\s+protected$/.test(r.content)?t.error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,i(r)):C=`Protected`,E=!0;else if(s===`reaction`)x||!f(a)||!/^reaction\s+batches\s+atomic$/.test(r.content)?t.error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,i(r)):p=`Atomic`,x=!0;else if(s===`runs`)y(t,r);else if(s===`domain`)t.authoredDeclarations=!0,O=parseDomain(t,r,O,Q);else if(Q||=declaresConstruct(s,r,a),t.authoredDeclarations||=s!==`import`&&declaresConstruct(s,r,a),s===`import`&&h(r.content))l===void 0?g(t,r,j):l.tryParse(t,r);else if(s===`import`){let a=R.exec(r.content);if(a===null)t.error(e.InvalidImportDeclaration,`Invalid import '${r.content}' - expected 'import <Qualified.Name> [from "<origin>"]'`,i(r));else{let o=a.groups?.origin===void 0?null:n(a.groups.origin);o!==null&&te(o)&&t.error(e.InvalidImportDeclaration,`An import origin must be a nonblank quoted string`,i(r)),k.push({kind:`ImportSyntax`,qualifiedName:a[1],origin:o,visibility:o===null?`Private`:`Public`,location:i(r)})}}else if(s===`example`)l===void 0?q.push(ee(t,r)):l.tryParse(t,r);else if(s===`eventsource`)B.push(b(t,r));else if(s===`system`)z.push(S(t,r));else if(s===`concept`)M.push(parseConcept(t,r));else if(s===`type`)L.push(ne(t,r));else if(s===`module`&&!f(a))parseModuleInPlacedFile(t,r,a,o);else if(s===`module`)V.push(A(t,r));else if(s===`persona`)H.push(parsePersona(t,r));else if(s===`sticky`){let e=parseStickyNote(t,r);e!==null&&U.push(e)}else if(s===`seed`)K.push(F(t.valueContext,r));else if(s===`purpose`&&l!==void 0)l.tryParse(t,r);else if(s===`purpose`)G.push(m(t,r));else if(s===`identity`)u=N(t,r,u);else if(s===`policy`){let n=P(t,r);W.some(e=>e.name===n.name)&&t.error(e.DuplicateDeclaration,`Duplicate declaration of policy '${n.name}' - policy names must be unique`,n.location),W.push(n)}else if(s===`exposure`)X.push(I(t,r));else if(s===`instance`)Z.push(re(t,r));else if(s===`trigger`){let e=w(t,r),n=/^trigger\s+([A-Za-z_]\w*)$/.exec(r.content)?.[1];n!==void 0&&J.push({name:n,data:e})}else Y.has(s)?s===`behavior`||s===`layout`?v(t,r):s===`ui`?ie(t,r):t.skipOpaqueBlock(r.indent):l?.tryParse(t,r)!==!0&&reportUnexpectedTopLevel(t,r,a)}o===void 0?s!==void 0&&V.unshift(place(a,s.build(t.start,!0),t.start)):V.unshift(o.build(t.start,!0));let $={kind:`ApplicationSyntax`,...C===null?{}:{commandReadMode:C},...p===null?{}:{reactionProductionMode:p},...u===null?{}:{identity:u},sourceOptions:t.sourceOptions,domain:O,imports:k,concepts:M,types:L,systems:z,eventSources:B,examples:q,modules:V,personas:H,policies:W,purposes:G,seeds:K,declaredTriggers:J,fileImports:j,...X.length>0?{exposures:X}:{},...U.length>0?{stickyNotes:U}:{},...Z.length>0?{instanceContributions:Z}:{},location:t.start};return t.authoredDeclarations&&_($),$}function declaresConstruct(e,t,n){return e===`import`?R.test(t.content):e===`module`?f(n):e===`identity`?t.content===`identity`:e===`purpose`||e===`example`||e===`exposure`||e===`instance`||e===`eventsource`||e===`system`||e===`concept`||e===`type`||e===`persona`||e===`sticky`||Y.has(e)}function parseModuleInPlacedFile(t,n,r,a){let o=k.exec(n.content)?.[1]??``;a!==void 0&&o===r[0]?(t.authoredDeclarations=!0,a.parseChildren(t,n)):(t.error(e.ModuleInPlacedFile,`This file is imported into ${u(r)}, so it cannot declare module '${o}' - import it at the top level of a document instead`,i(n)),t.skipBlock(n.indent))}function reportUnexpectedTopLevel(t,n,r){let a=c(n.content);if(f(r)){let r=X.has(a)?` - '${a}' belongs in a module or feature; wrap it in one, or import this file from inside one`:` - expected domain, import, concept, type, policy, persona, sticky note on personas, authentication, identity, module, seed, trigger, behavior, ui profile, theme, sample data or layout`;t.error(e.UnknownTopLevelConstruct,`Unexpected '${a}' at the top level${r}`,i(n))}else{let o=r.length===1?O:E;t.error(e.UnexpectedInPlacedFile,`Unexpected '${a}' in a file imported into ${u(r)} - expected an application declaration or ${o}`,i(n))}t.skipBlock(n.indent)}function place(e,t,n){let r=t;for(let t=e.length-2;t>=1;t--)r={kind:`FeatureSyntax`,name:e[t],description:null,authorize:null,features:[r],slices:[],fileImports:[],isPlacement:!0,location:n};return{kind:`ModuleSyntax`,name:e[0],description:null,authorize:null,features:[r],fileImports:[],isPlacement:!0,location:n}}function parseDomain(t,n,r,a){let o=L.exec(n.content);return o===null?(t.error(e.InvalidDomainDeclaration,`Invalid domain declaration '${n.content}' - expected 'domain <Qualified.Name>'`,i(n)),r):r===null?(a&&t.error(e.DomainNotFirst,`'domain' must be declared before any other construct`,i(n)),{kind:`DomainSyntax`,name:o[1],location:i(n)}):(t.error(e.DuplicateDomain,`The document already declares a domain - a document can have at most one`,i(n)),r)}function warnOnTabIndentation(t,n){let r=!1;for(let i of n)i.raw.trimStart().startsWith("```")?r=!r:!r&&q.test(i.raw)&&t.warning(e.TabIndentation,`Screenplay is indentation based - use spaces, not tabs`,a(i))}function parseConcept(t,n){let r=z.exec(n.content);if(r===null)return t.error(e.InvalidConceptDeclaration,`Invalid concept declaration '${n.content}' - expected 'concept <Name> : <Type>'`,i(n)),t.skipBlock(n.indent),{kind:`ConceptSyntax`,name:c(n.content),type:``,attributes:[],values:[],location:i(n)};let[,a,u,d]=r,f=s(t,n,a,d);u!==`Enum`&&!J.includes(u)&&t.error(e.UnknownPrimitiveType,`Unknown primitive type '${u}' - expected ${J.join(`, `)} or Enum`,i(n));let m=[],h=new j,g=null,_=!1,v=null,y=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=u===`Enum`?h.tryNumbered(t,r):void 0;if(n!==void 0)m.push(n);else if(c(r.content)===`description`&&(u!==`Enum`||r.content!==`description`||t.peekChild(r.indent)?.content.startsWith("```")===!0))v=p(t,r,v,`Concept '${a}'`);else if(x(r))continue;else if(c(r.content)===`validate`){u===`Enum`&&r.content===`validate`&&t.peekChild(r.indent)===void 0&&t.warning(e.ValidateReadAsEnumerationBlock,`'validate' in enumeration concept '${a}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,i(r));let n=C(t,r,`concept`,a);n!==void 0&&y.push(n)}else if(c(r.content)===`generate`&&(u!==`Enum`||r.content!==`generate`)){_&&t.error(e.DuplicateGeneration,`Concept '${a}' declares generation more than once.`,i(r));let n=M(t,r,u);_||(g=n),_=!0}else o(t,r,a,f)||(u===`Enum`&&B.test(r.content)?m.push(l(r.content)):u===`Enum`?t.error(e.InvalidEnumerationValue,`Invalid enum value '${r.content}' - expected an identifier`,i(r)):(t.error(e.UnknownConceptDirective,`Unexpected '${r.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason "<text>"'`,i(r)),t.skipBlock(r.indent)))}let b=h.finish(t,n,m.length);return{kind:`ConceptSyntax`,name:a,type:u,attributes:f,values:m,validations:y,description:v,...g===null?{}:{generation:g},...b===void 0?{}:{valueNumbers:b},location:i(n)}}function parsePersona(t,r){let a=V.exec(r.content)?.[1]??``;a===``&&t.error(e.InvalidPersonaDeclaration,`Invalid persona declaration '${r.content}' - expected 'persona <Name>'`,i(r));let o=null,s=[],l=[],u=null,d=null;for(let f=t.peekChild(r.indent);f!==void 0;f=t.peekChild(r.indent)){t.reader.takeSignificant();let r=c(f.content);if(r===`description`)o=p(t,f,o,`Persona '${a}'`);else if(r===`goal`){let r=U.exec(f.content);r===null?t.error(e.InvalidPersonaDeclaration,`Invalid goal '${f.content}' - expected 'goal "<text>"'`,i(f)):l.push(n(r[1]))}else if(r===`position`)u=parseCanvasPair(t,f,`position`,`x`,`y`,u,!0)??u;else if(r===`size`)d=parseCanvasPair(t,f,`size`,`width`,`height`,d,!1)??d;else if(r===`policy`){let n=H.exec(f.content);n===null?t.error(e.InvalidPersonaPolicyReference,`Invalid policy reference '${f.content}' - expected 'policy <Name>'`,i(f)):s.push(n[1])}else t.error(e.UnknownPersonaDirective,`Unexpected '${r}' in persona body - expected description, goal, policy, position or size`,i(f)),t.skipBlock(f.indent)}return{kind:`PersonaSyntax`,name:a,description:o,policies:s,...l.length>0?{goals:l}:{},...u===null?{}:{x:u[0],y:u[1]},...d===null?{}:{width:d[0],height:d[1]},location:i(r)}}function parseStickyNote(t,n){if(!W.test(n.content))return t.error(e.InvalidPersonaDeclaration,`Invalid sticky note declaration '${n.content}' - expected 'sticky note on personas'`,i(n)),t.skipBlock(n.indent),null;let r=null,a=null,o=null,s=null;for(let l=t.peekChild(n.indent);l!==void 0;l=t.peekChild(n.indent)){t.reader.takeSignificant();let n=c(l.content);if(n===`description`)r=p(t,l,r,`A sticky note`);else if(n===`colour`){let n=G.exec(l.content);n===null?t.error(e.InvalidPersonaDeclaration,`Invalid colour '${l.content}' - expected 'colour yellow', 'colour pink', 'colour green' or 'colour blue'`,i(l)):a=n[1]}else n===`position`?o=parseCanvasPair(t,l,`position`,`x`,`y`,o,!0)??o:n===`size`?s=parseCanvasPair(t,l,`size`,`width`,`height`,s,!1)??s:(t.error(e.UnknownPersonaDirective,`Unexpected '${n}' in sticky note body - expected description, colour, position or size`,i(l)),t.skipBlock(l.indent))}return r===null||o===null?(t.error(e.InvalidPersonaDeclaration,`A sticky note needs a description (the text on it) and a position`,i(n)),null):{kind:`StickyNoteSyntax`,text:r,colour:a,x:o[0],y:o[1],width:s===null?null:s[0],height:s===null?null:s[1],location:i(n)}}function parseCanvasPair(t,n,r,a,o,s,c){let l=K.exec(n.content),u=l===null?NaN:Number.parseInt(l[2],10),d=l===null?NaN:Number.parseInt(l[3],10);return l!==null&&l[1]===r&&Number.isSafeInteger(u)&&Number.isSafeInteger(d)&&u>=-2147483648&&u<=2147483647&&d>=-2147483648&&d<=2147483647&&(c||u>=0&&d>=0)?s===null?[u,d]:(t.error(e.InvalidPersonaDeclaration,`The ${r} is already declared - at most one is allowed`,i(n)),null):(t.error(e.InvalidPersonaDeclaration,`Invalid ${r} '${n.content}' - expected '${r} <${a}> <${o}>' with whole numbers${c?``:` that are not negative`}`,i(n)),null)}export{parseApplication};
|
|
2
2
|
//# sourceMappingURL=ScreenplayParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenplayParser.js","names":["domainPattern","pattern","importPattern","stringBodyPattern","conceptPattern","enumValuePattern","personaPattern","personaPolicyPattern","tabIndentPattern","primitiveTypes","opaqueTopLevel","bodyKeywords","documentPlacement","context","lines","moduleBody","placement","ModuleBody","featureBody","FeatureBody","placedBody","identity","reactionProductionMode","sawReactionBatches","commandReadMode","sawCommandReads","domain","imports","fileImports","concepts","types","systems","eventSources","modules","personas","policies","purposes","seeds","examples","declaredTriggers","exposures","instanceContributions","sawOtherConstruct","line","keyword","firstWord","isDocumentPlacement","DiagnosticCodes","locationOf","misplacedReactionIdentity","isFileImport","parseFileImport","match","origin","unescapeString","isBlankPublicEventOrigin","parseExample","parseEventSource","parseSystem","parseType","parseModule","parseSeed","parsePurpose","parseIdentity","policy","parsePolicy","previous","parseExposure","parseInstance","data","parseTriggerDeclaration","name","collectInputUses","parseUiProfile","root","recordAuthoredDocument","modulePattern","describePlacement","word","hint","expected","moduleBodyExpected","featureBodyExpected","feature","innermost","index","start","existing","inFence","startOf","type","attributeText","attributes","parseComplianceMarkers","values","members","EnumerationMembers","generation","declaredGeneration","description","validations","child","memberName","parseDescription","isFileDirective","parsed","parseValidate","parseGeneration","parseComplianceDirective","unescapeIdentifier","valueNumbers"],"sources":["../../../../../../Compiler/Parsing/ScreenplayParser.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 { CommandReadMode } from '../Syntax/CommandReadMode';\nimport { ReactionProductionMode } from '../Syntax/ReactionProductionMode';\nimport { EnumerationMembers } from './EnumerationMembers';\nimport { GenerationSyntax } from '../Syntax/GenerationSyntax';\nimport { parseGeneration } from './GenerationParser';\nimport { IdentitySyntax } from '../Syntax/IdentitySyntax';\nimport { parseIdentity } from './IdentityParser';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { recordAuthoredDocument } from '../Syntax/SourceOptions';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { describePlacement, documentPlacement, isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, DomainSyntax, ImportSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { parseTriggerDeclaration } from './TriggerDataParser';\nimport { pattern } from '../Text/patterns';\nimport { parseComplianceDirective, parseComplianceMarkers } from './ConceptComplianceParser';\nimport { parseType } from './DeclarationParsers';\nimport { ValidateSyntax } from '../Syntax/Commands';\nimport { parseValidate } from './CommandParser';\nimport { parseDescription } from './DescriptionParser';\nimport { FeatureBody, featureBodyExpected } from './FeatureBody';\nimport { isFileImport, parseFileImport } from './FileImportParser';\nimport { isFileDirective } from './FileReferences';\nimport { collectInputUses } from './InputUses';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ModuleBody, moduleBodyExpected, modulePattern, parseModule } from './ModuleBody';\nimport { ParserContext } from './ParserContext';\nimport { PolicySyntax } from '../Syntax/Policies';\nimport { parsePolicy } from './PolicyParser';\nimport { PurposeSyntax } from '../Syntax/Purposes';\nimport { parsePurpose } from './PurposeParser';\nimport { SeedSyntax } from '../Syntax/Seeds';\nimport { parseSeed } from './SeedParser';\nimport { parseSystem } from './OperationParser';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { SystemSyntax } from '../Syntax/Operations';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { parseEventSource } from './EventSourceParser';\nimport { parseExposure, parseInstance } from './CompositionParser';\nimport { ExposureSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseUiProfile } from './UiProfileLegacyLayout';\nimport { locationOf, SourceLine, startOf } from './SourceLine';\n\nconst domainPattern = pattern('^domain\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst importPattern = pattern(`^import\\\\s+([\\\\w.]+)(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst conceptPattern = pattern('^concept\\\\s+(\\\\w+)\\\\s*:\\\\s*(\\\\w+)((?:\\\\s+@?\\\\w+)*)$');\nconst enumValuePattern = pattern('^@?[a-z_]\\\\w*$');\nconst personaPattern = pattern('^persona\\\\s+([A-Za-z_]\\\\w*)$');\nconst personaPolicyPattern = pattern('^policy\\\\s+([A-Za-z_]\\\\w*)$');\nconst tabIndentPattern = /^[ ]*\\t/;\nconst primitiveTypes = ['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'];\n\n// Top-level, module and feature constructs the C# compiler knows that this compiler does not model. They\n// are skipped whole, not reported.\nconst opaqueTopLevel = new Set(['policy', 'authentication', 'seed', 'ui', 'theme', 'trigger', 'layout', 'behavior', 'sample']);\n\n// What belongs in a module or feature body; at the top level of a whole document it gets a hint saying so.\nconst bodyKeywords = new Set(['slice', 'feature', 'description', 'documentation', 'authorize', 'screen', 'dialog', 'form', 'contribute', 'on', 'uses']);\n\n// Parses one document into its application syntax - the port of the C# ScreenplayParser. The placement says\n// where the document's top level belongs: the application, unless an import placed it in a module or feature.\nexport function parseApplication(context: ParserContext, lines: readonly SourceLine[], placement: PlayPlacement = documentPlacement): ApplicationSyntax {\n context.deferIdentityValidation = true;\n warnOnTabIndentation(context, lines);\n const moduleBody = placement.length === 1 ? new ModuleBody(placement[0]) : undefined;\n const featureBody = placement.length > 1 ? new FeatureBody(placement[placement.length - 1]) : undefined;\n const placedBody = moduleBody ?? featureBody;\n let identity: IdentitySyntax | null = null;\n let reactionProductionMode: ReactionProductionMode | null = null;\n let sawReactionBatches = false;\n let commandReadMode: CommandReadMode | null = null;\n let sawCommandReads = false;\n let domain: DomainSyntax | null = null;\n const imports: ImportSyntax[] = [];\n const fileImports: FileImportSyntax[] = [];\n const concepts: ConceptSyntax[] = [];\n const types: TypeSyntax[] = [];\n const systems: SystemSyntax[] = [];\n const eventSources: EventSourceSyntax[] = [];\n const modules: ModuleSyntax[] = [];\n const personas: PersonaSyntax[] = [];\n const policies: PolicySyntax[] = [];\n const purposes: PurposeSyntax[] = [];\n const seeds: SeedSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const declaredTriggers: NonNullable<ApplicationSyntax['declaredTriggers']>[number][] = [];\n const exposures: ExposureSyntax[] = [];\n const instanceContributions: InstanceContributionsSyntax[] = [];\n let sawOtherConstruct = false;\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'command' && /^command\\s+reads(?:\\s|$)/.test(line.content)) {\n if (sawCommandReads || !isDocumentPlacement(placement) || !/^command\\s+reads\\s+protected$/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidCommandReadsDeclaration, \"Declare 'command reads protected' once at the application root.\", locationOf(line));\n } else {\n commandReadMode = CommandReadMode.Protected;\n }\n sawCommandReads = true;\n continue;\n }\n if (keyword === 'reaction') {\n if (sawReactionBatches || !isDocumentPlacement(placement) || !/^reaction\\s+batches\\s+atomic$/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidReactionBatchesDeclaration, \"Declare 'reaction batches atomic' once at the application root.\", locationOf(line));\n } else {\n reactionProductionMode = ReactionProductionMode.Atomic;\n }\n sawReactionBatches = true;\n continue;\n }\n if (keyword === 'runs') {\n misplacedReactionIdentity(context, line);\n continue;\n }\n if (keyword === 'domain') {\n context.authoredDeclarations = true;\n domain = parseDomain(context, line, domain, sawOtherConstruct);\n continue;\n }\n // The C# parser asks whether anything was declared before the domain, so an import it rejected,\n // a file import and an unknown construct do not count.\n sawOtherConstruct ||= declaresConstruct(keyword, line, placement);\n context.authoredDeclarations ||= keyword !== 'import' && declaresConstruct(keyword, line, placement);\n if (keyword === 'import' && isFileImport(line.content)) {\n // A top level import belongs to whatever the document's top level is - the application, or the\n // module or feature the document was itself imported into.\n if (placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else {\n parseFileImport(context, line, fileImports);\n }\n } else if (keyword === 'import') {\n const match = importPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, `Invalid import '${line.content}' - expected 'import <Qualified.Name> [from \"<origin>\"]'`, locationOf(line));\n } else {\n const origin = match.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, 'An import origin must be a nonblank quoted string', locationOf(line));\n }\n imports.push({ kind: 'ImportSyntax', qualifiedName: match[1], origin, visibility: origin === null ? EventVisibility.Private : EventVisibility.Public, location: locationOf(line) });\n }\n } else if (keyword === 'example') {\n if (placedBody !== undefined) placedBody.tryParse(context, line);\n else examples.push(parseExample(context, line));\n } else if (keyword === 'eventsource') {\n eventSources.push(parseEventSource(context, line));\n } else if (keyword === 'system') {\n systems.push(parseSystem(context, line));\n } else if (keyword === 'concept') {\n concepts.push(parseConcept(context, line));\n } else if (keyword === 'type') {\n types.push(parseType(context, line));\n } else if (keyword === 'module' && !isDocumentPlacement(placement)) {\n parseModuleInPlacedFile(context, line, placement, moduleBody);\n } else if (keyword === 'module') {\n modules.push(parseModule(context, line));\n } else if (keyword === 'persona') {\n personas.push(parsePersona(context, line));\n } else if (keyword === 'seed') {\n seeds.push(parseSeed(context.valueContext, line));\n } else if (keyword === 'purpose' && placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else if (keyword === 'purpose') {\n purposes.push(parsePurpose(context, line));\n } else if (keyword === 'identity') {\n identity = parseIdentity(context, line, identity);\n } else if (keyword === 'policy') {\n const policy = parsePolicy(context, line);\n if (policies.some(previous => previous.name === policy.name)) {\n context.error(DiagnosticCodes.DuplicateDeclaration, `Duplicate declaration of policy '${policy.name}' - policy names must be unique`, policy.location);\n }\n policies.push(policy);\n } else if (keyword === 'exposure') {\n exposures.push(parseExposure(context, line));\n } else if (keyword === 'instance') {\n instanceContributions.push(parseInstance(context, line));\n } else if (keyword === 'trigger') {\n const data = parseTriggerDeclaration(context, line);\n const name = /^trigger\\s+([A-Za-z_]\\w*)$/.exec(line.content)?.[1];\n if (name !== undefined) declaredTriggers.push({ name, data });\n } else if (opaqueTopLevel.has(keyword)) {\n if (keyword === 'behavior' || keyword === 'layout') collectInputUses(context, line);\n else if (keyword === 'ui') parseUiProfile(context, line);\n else context.skipOpaqueBlock(line.indent);\n } else if (placedBody?.tryParse(context, line) !== true) {\n reportUnexpectedTopLevel(context, line, placement);\n }\n }\n if (moduleBody !== undefined) {\n modules.unshift(moduleBody.build(context.start, true));\n } else if (featureBody !== undefined) {\n modules.unshift(place(placement, featureBody.build(context.start, true), context.start));\n }\n const root: ApplicationSyntax = { kind: 'ApplicationSyntax', ...(commandReadMode === null ? {} : { commandReadMode }), ...(reactionProductionMode === null ? {} : { reactionProductionMode }), ...(identity === null ? {} : { identity }), sourceOptions: context.sourceOptions, domain, imports, concepts, types, systems, eventSources, examples, modules, personas, policies, purposes, seeds, declaredTriggers, fileImports, ...(exposures.length > 0 ? { exposures } : {}), ...(instanceContributions.length > 0 ? { instanceContributions } : {}), location: context.start };\n if (context.authoredDeclarations) recordAuthoredDocument(root);\n return root;\n}\n\nfunction declaresConstruct(keyword: string, line: SourceLine, placement: PlayPlacement): boolean {\n if (keyword === 'import') {\n return importPattern.test(line.content);\n }\n if (keyword === 'module') {\n return isDocumentPlacement(placement);\n }\n if (keyword === 'identity') return line.content === 'identity';\n return keyword === 'purpose' || keyword === 'example' || keyword === 'exposure' || keyword === 'instance' || keyword === 'eventsource' || keyword === 'system' || keyword === 'concept' || keyword === 'type' || keyword === 'persona' || opaqueTopLevel.has(keyword);\n}\n\nfunction parseModuleInPlacedFile(context: ParserContext, line: SourceLine, placement: PlayPlacement, moduleBody: ModuleBody | undefined): void {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n\n // Restating the module a file is placed in says nothing new, so its body simply joins the placement.\n if (moduleBody !== undefined && name === placement[0]) {\n context.authoredDeclarations = true;\n moduleBody.parseChildren(context, line);\n return;\n }\n context.error(DiagnosticCodes.ModuleInPlacedFile,\n `This file is imported into ${describePlacement(placement)}, so it cannot declare module '${name}' - import it at the top level of a document instead`, locationOf(line));\n context.skipBlock(line.indent);\n}\n\nfunction reportUnexpectedTopLevel(context: ParserContext, line: SourceLine, placement: PlayPlacement): void {\n const word = firstWord(line.content);\n if (!isDocumentPlacement(placement)) {\n const expected = placement.length === 1 ? moduleBodyExpected : featureBodyExpected;\n context.error(DiagnosticCodes.UnexpectedInPlacedFile,\n `Unexpected '${word}' in a file imported into ${describePlacement(placement)} - expected an application declaration or ${expected}`, locationOf(line));\n } else {\n const hint = bodyKeywords.has(word)\n ? ` - '${word}' belongs in a module or feature; wrap it in one, or import this file from inside one`\n : ' - expected domain, import, concept, type, policy, persona, authentication, identity, module, seed, trigger, behavior, ui profile, theme, sample data or layout';\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Unexpected '${word}' at the top level${hint}`, locationOf(line));\n }\n context.skipBlock(line.indent);\n}\n\n// Wraps the feature a file is placed in in the features and module around it, each marked as a placement.\nfunction place(placement: PlayPlacement, innermost: FeatureSyntax, start: SourceLocation): ModuleSyntax {\n let feature = innermost;\n for (let index = placement.length - 2; index >= 1; index--) {\n feature = {\n kind: 'FeatureSyntax', name: placement[index], description: null, authorize: null,\n features: [feature], slices: [], fileImports: [], isPlacement: true, location: start,\n };\n }\n return {\n kind: 'ModuleSyntax', name: placement[0], description: null, authorize: null,\n features: [feature], fileImports: [], isPlacement: true, location: start,\n };\n}\n\nfunction parseDomain(context: ParserContext, line: SourceLine, existing: DomainSyntax | null, sawOtherConstruct: boolean): DomainSyntax | null {\n const match = domainPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDomainDeclaration, `Invalid domain declaration '${line.content}' - expected 'domain <Qualified.Name>'`, locationOf(line));\n return existing;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDomain, 'The document already declares a domain - a document can have at most one', locationOf(line));\n return existing;\n }\n if (sawOtherConstruct) {\n context.error(DiagnosticCodes.DomainNotFirst, '\\'domain\\' must be declared before any other construct', locationOf(line));\n }\n return { kind: 'DomainSyntax', name: match[1], location: locationOf(line) };\n}\n\nfunction warnOnTabIndentation(context: ParserContext, lines: readonly SourceLine[]): void {\n let inFence = false;\n for (const line of lines) {\n if (line.raw.trimStart().startsWith('```')) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && tabIndentPattern.test(line.raw)) {\n context.warning(DiagnosticCodes.TabIndentation, 'Screenplay is indentation based - use spaces, not tabs', startOf(line));\n }\n }\n}\n\nfunction parseConcept(context: ParserContext, line: SourceLine): ConceptSyntax {\n const match = conceptPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidConceptDeclaration, `Invalid concept declaration '${line.content}' - expected 'concept <Name> : <Type>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ConceptSyntax', name: firstWord(line.content), type: '', attributes: [], values: [], location: locationOf(line) };\n }\n const [, name, type, attributeText] = match;\n const attributes = parseComplianceMarkers(context, line, name, attributeText);\n if (type !== 'Enum' && !primitiveTypes.includes(type)) {\n context.error(DiagnosticCodes.UnknownPrimitiveType, `Unknown primitive type '${type}' - expected ${primitiveTypes.join(', ')} or Enum`, locationOf(line));\n }\n const values: string[] = [];\n const members = new EnumerationMembers();\n let generation: GenerationSyntax | null = null;\n let declaredGeneration = false;\n let description: string | null = null;\n const validations: ValidateSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const memberName = type === 'Enum' ? members.tryNumbered(context, child) : undefined;\n if (memberName !== undefined) {\n values.push(memberName);\n } else if (firstWord(child.content) === 'description' && (type !== 'Enum' || child.content !== 'description' || context.peekChild(child.indent)?.content.startsWith('```') === true)) {\n description = parseDescription(context, child, description, `Concept '${name}'`);\n } else if (isFileDirective(child)) {\n continue;\n } else if (firstWord(child.content) === 'validate') {\n if (type === 'Enum' && child.content === 'validate' && context.peekChild(child.indent) === undefined) {\n context.warning(DiagnosticCodes.ValidateReadAsEnumerationBlock,\n `'validate' in enumeration concept '${name}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,\n locationOf(child));\n }\n const parsed = parseValidate(context, child, 'concept', name);\n if (parsed !== undefined) validations.push(parsed);\n } else if (firstWord(child.content) === 'generate' && !(type === 'Enum' && child.content === 'generate')) {\n if (declaredGeneration) context.error(DiagnosticCodes.DuplicateGeneration, `Concept '${name}' declares generation more than once.`, locationOf(child));\n const parsed = parseGeneration(context, child, type);\n if (!declaredGeneration) generation = parsed;\n declaredGeneration = true;\n } else if (parseComplianceDirective(context, child, name, attributes)) {\n // Compliance directives are modeled by their original concept marker.\n } else if (type === 'Enum' && enumValuePattern.test(child.content)) {\n values.push(unescapeIdentifier(child.content));\n } else if (type === 'Enum') {\n context.error(DiagnosticCodes.InvalidEnumerationValue, `Invalid enum value '${child.content}' - expected an identifier`, locationOf(child));\n } else {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Unexpected '${child.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason \"<text>\"'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const valueNumbers = members.finish(context, line, values.length);\n return { kind: 'ConceptSyntax', name, type, attributes, values, validations, description, ...(generation === null ? {} : { generation }), ...(valueNumbers === undefined ? {} : { valueNumbers }), location: locationOf(line) };\n}\n\n// 'persona <Name>' with an optional description and the policies it holds - the port of the C# ParsePersona.\nfunction parsePersona(context: ParserContext, line: SourceLine): PersonaSyntax {\n const name = personaPattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid persona declaration '${line.content}' - expected 'persona <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const policies: string[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Persona '${name}'`);\n } else if (keyword === 'policy') {\n const policy = personaPolicyPattern.exec(child.content);\n if (policy === null) {\n context.error(DiagnosticCodes.InvalidPersonaPolicyReference, `Invalid policy reference '${child.content}' - expected 'policy <Name>'`, locationOf(child));\n } else {\n policies.push(policy[1]);\n }\n } else {\n context.error(DiagnosticCodes.UnknownPersonaDirective, `Unexpected '${keyword}' in persona body - expected description or policy`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'PersonaSyntax', name, description, policies, location: locationOf(line) };\n}\n"],"mappings":"k9DAoDA,MAAMA,EAAgBC,EAAQ,kDAAkD,EAC1EC,EAAgBD,EAAQ,iDAAiDE,EAAkB,MAAM,EACjGC,EAAiBH,EAAQ,qDAAqD,EAC9EI,EAAmBJ,EAAQ,gBAAgB,EAC3CK,EAAiBL,EAAQ,8BAA8B,EACvDM,EAAuBN,EAAQ,6BAA6B,EAC5DO,EAAmB,UACnBC,EAAiB,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,EAIhFC,kBAAiB,IAAI,IAAI,CAAC,SAAU,iBAAkB,OAAQ,KAAM,QAAS,UAAW,SA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EAAOjE,EAAe,KAAKqC,EAAK,OAAO,CAAC,GAAG,IAAM,GACnD4B,IAAS,IACT1D,EAAQ,MAAMkC,EAAgB,0BAA2B,gCAAgCJ,EAAK,QAAQ,+BAAgCK,EAAWL,CAAI,CAAC,EAE1J,IAAIwD,EAA6B,KAC3BhE,EAAqB,CAAC,EAC5B,IAAK,IAAIkE,EAAQxF,EAAQ,UAAU8B,EAAK,MAAM,EAAG0D,IAAU,IAAA,GAAW,EAAQxF,EAAQ,UAAU8B,EAAK,MAAM,EAAG,CAC1G9B,EAAQ,OAAO,gBAAgB,EAC/B,IAAM+B,EAAUC,EAAUwD,EAAM,OAAO,EACvC,GAAIzD,IAAY,cACZ,EAAc2D,EAAiB1F,EAASwF,EAAOF,EAAa,YAAY5B,EAAK,EAAE,OAC5E,GAAI3B,IAAY,SAAU,CAC7B,IAAMoB,EAASzD,EAAqB,KAAK8F,EAAM,OAAO,EAClDrC,IAAW,KACXnD,EAAQ,MAAMkC,EAAgB,8BAA+B,6BAA6BsD,EAAM,QAAQ,8BAA+BrD,EAAWqD,CAAK,CAAC,EAExJlE,EAAS,KAAK6B,EAAO,EAAE,CAE/B,MACInD,EAAQ,MAAMkC,EAAgB,wBAAyB,eAAeH,EAAQ,oDAAqDI,EAAWqD,CAAK,CAAC,EACpJxF,EAAQ,UAAUwF,EAAM,MAAM,CAEtC,CACA,MAAO,CAAE,KAAM,gBAAiB,OAAM,cAAa,WAAU,SAAUrD,EAAWL,CAAI,CAAE,CAC5F"}
|
|
1
|
+
{"version":3,"file":"ScreenplayParser.js","names":["domainPattern","pattern","importPattern","stringBodyPattern","conceptPattern","enumValuePattern","personaPattern","personaPolicyPattern","personaGoalPattern","stickyNotePattern","stickyNoteColourPattern","canvasPairPattern","tabIndentPattern","primitiveTypes","opaqueTopLevel","bodyKeywords","documentPlacement","context","lines","moduleBody","placement","ModuleBody","featureBody","FeatureBody","placedBody","identity","reactionProductionMode","sawReactionBatches","commandReadMode","sawCommandReads","domain","imports","fileImports","concepts","types","systems","eventSources","modules","personas","stickyNotes","policies","purposes","seeds","examples","declaredTriggers","exposures","instanceContributions","sawOtherConstruct","line","keyword","firstWord","isDocumentPlacement","DiagnosticCodes","locationOf","misplacedReactionIdentity","isFileImport","parseFileImport","match","origin","unescapeString","isBlankPublicEventOrigin","parseExample","parseEventSource","parseSystem","parseType","parseModule","stickyNote","parseSeed","parsePurpose","parseIdentity","policy","parsePolicy","previous","parseExposure","parseInstance","data","parseTriggerDeclaration","name","collectInputUses","parseUiProfile","root","recordAuthoredDocument","modulePattern","describePlacement","word","hint","expected","moduleBodyExpected","featureBodyExpected","feature","innermost","index","start","existing","inFence","startOf","type","attributeText","attributes","parseComplianceMarkers","values","members","EnumerationMembers","generation","declaredGeneration","description","validations","child","memberName","parseDescription","isFileDirective","parsed","parseValidate","parseGeneration","parseComplianceDirective","unescapeIdentifier","valueNumbers","goals","position","size","goal","text","colour","firstValue","secondValue","allowNegative","first","second"],"sources":["../../../../../../Compiler/Parsing/ScreenplayParser.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 { CommandReadMode } from '../Syntax/CommandReadMode';\nimport { ReactionProductionMode } from '../Syntax/ReactionProductionMode';\nimport { EnumerationMembers } from './EnumerationMembers';\nimport { GenerationSyntax } from '../Syntax/GenerationSyntax';\nimport { parseGeneration } from './GenerationParser';\nimport { IdentitySyntax } from '../Syntax/IdentitySyntax';\nimport { parseIdentity } from './IdentityParser';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { recordAuthoredDocument } from '../Syntax/SourceOptions';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { describePlacement, documentPlacement, isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { PersonaSyntax, StickyNoteSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, DomainSyntax, ImportSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { parseTriggerDeclaration } from './TriggerDataParser';\nimport { pattern } from '../Text/patterns';\nimport { parseComplianceDirective, parseComplianceMarkers } from './ConceptComplianceParser';\nimport { parseType } from './DeclarationParsers';\nimport { ValidateSyntax } from '../Syntax/Commands';\nimport { parseValidate } from './CommandParser';\nimport { parseDescription } from './DescriptionParser';\nimport { FeatureBody, featureBodyExpected } from './FeatureBody';\nimport { isFileImport, parseFileImport } from './FileImportParser';\nimport { isFileDirective } from './FileReferences';\nimport { collectInputUses } from './InputUses';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ModuleBody, moduleBodyExpected, modulePattern, parseModule } from './ModuleBody';\nimport { ParserContext } from './ParserContext';\nimport { PolicySyntax } from '../Syntax/Policies';\nimport { parsePolicy } from './PolicyParser';\nimport { PurposeSyntax } from '../Syntax/Purposes';\nimport { parsePurpose } from './PurposeParser';\nimport { SeedSyntax } from '../Syntax/Seeds';\nimport { parseSeed } from './SeedParser';\nimport { parseSystem } from './OperationParser';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { SystemSyntax } from '../Syntax/Operations';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { parseEventSource } from './EventSourceParser';\nimport { parseExposure, parseInstance } from './CompositionParser';\nimport { ExposureSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseUiProfile } from './UiProfileLegacyLayout';\nimport { locationOf, SourceLine, startOf } from './SourceLine';\n\nconst domainPattern = pattern('^domain\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst importPattern = pattern(`^import\\\\s+([\\\\w.]+)(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst conceptPattern = pattern('^concept\\\\s+(\\\\w+)\\\\s*:\\\\s*(\\\\w+)((?:\\\\s+@?\\\\w+)*)$');\nconst enumValuePattern = pattern('^@?[a-z_]\\\\w*$');\nconst personaPattern = pattern('^persona\\\\s+([A-Za-z_]\\\\w*)$');\nconst personaPolicyPattern = pattern('^policy\\\\s+([A-Za-z_]\\\\w*)$');\nconst personaGoalPattern = pattern(`^goal\\\\s+\"(${stringBodyPattern})\"$`);\nconst stickyNotePattern = pattern('^sticky\\\\s+note\\\\s+on\\\\s+personas$');\nconst stickyNoteColourPattern = pattern('^colour\\\\s+(yellow|pink|green|blue)$');\nconst canvasPairPattern = pattern('^(position|size)\\\\s+(-?\\\\d+)\\\\s+(-?\\\\d+)$');\nconst tabIndentPattern = /^[ ]*\\t/;\nconst primitiveTypes = ['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'];\n\n// Top-level, module and feature constructs the C# compiler knows that this compiler does not model. They\n// are skipped whole, not reported.\nconst opaqueTopLevel = new Set(['policy', 'authentication', 'seed', 'ui', 'theme', 'trigger', 'layout', 'behavior', 'sample']);\n\n// What belongs in a module or feature body; at the top level of a whole document it gets a hint saying so.\nconst bodyKeywords = new Set(['slice', 'feature', 'description', 'documentation', 'authorize', 'screen', 'dialog', 'form', 'contribute', 'on', 'uses']);\n\n// Parses one document into its application syntax - the port of the C# ScreenplayParser. The placement says\n// where the document's top level belongs: the application, unless an import placed it in a module or feature.\nexport function parseApplication(context: ParserContext, lines: readonly SourceLine[], placement: PlayPlacement = documentPlacement): ApplicationSyntax {\n context.deferIdentityValidation = true;\n warnOnTabIndentation(context, lines);\n const moduleBody = placement.length === 1 ? new ModuleBody(placement[0]) : undefined;\n const featureBody = placement.length > 1 ? new FeatureBody(placement[placement.length - 1]) : undefined;\n const placedBody = moduleBody ?? featureBody;\n let identity: IdentitySyntax | null = null;\n let reactionProductionMode: ReactionProductionMode | null = null;\n let sawReactionBatches = false;\n let commandReadMode: CommandReadMode | null = null;\n let sawCommandReads = false;\n let domain: DomainSyntax | null = null;\n const imports: ImportSyntax[] = [];\n const fileImports: FileImportSyntax[] = [];\n const concepts: ConceptSyntax[] = [];\n const types: TypeSyntax[] = [];\n const systems: SystemSyntax[] = [];\n const eventSources: EventSourceSyntax[] = [];\n const modules: ModuleSyntax[] = [];\n const personas: PersonaSyntax[] = [];\n const stickyNotes: StickyNoteSyntax[] = [];\n const policies: PolicySyntax[] = [];\n const purposes: PurposeSyntax[] = [];\n const seeds: SeedSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const declaredTriggers: NonNullable<ApplicationSyntax['declaredTriggers']>[number][] = [];\n const exposures: ExposureSyntax[] = [];\n const instanceContributions: InstanceContributionsSyntax[] = [];\n let sawOtherConstruct = false;\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'command' && /^command\\s+reads(?:\\s|$)/.test(line.content)) {\n if (sawCommandReads || !isDocumentPlacement(placement) || !/^command\\s+reads\\s+protected$/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidCommandReadsDeclaration, \"Declare 'command reads protected' once at the application root.\", locationOf(line));\n } else {\n commandReadMode = CommandReadMode.Protected;\n }\n sawCommandReads = true;\n continue;\n }\n if (keyword === 'reaction') {\n if (sawReactionBatches || !isDocumentPlacement(placement) || !/^reaction\\s+batches\\s+atomic$/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidReactionBatchesDeclaration, \"Declare 'reaction batches atomic' once at the application root.\", locationOf(line));\n } else {\n reactionProductionMode = ReactionProductionMode.Atomic;\n }\n sawReactionBatches = true;\n continue;\n }\n if (keyword === 'runs') {\n misplacedReactionIdentity(context, line);\n continue;\n }\n if (keyword === 'domain') {\n context.authoredDeclarations = true;\n domain = parseDomain(context, line, domain, sawOtherConstruct);\n continue;\n }\n // The C# parser asks whether anything was declared before the domain, so an import it rejected,\n // a file import and an unknown construct do not count.\n sawOtherConstruct ||= declaresConstruct(keyword, line, placement);\n context.authoredDeclarations ||= keyword !== 'import' && declaresConstruct(keyword, line, placement);\n if (keyword === 'import' && isFileImport(line.content)) {\n // A top level import belongs to whatever the document's top level is - the application, or the\n // module or feature the document was itself imported into.\n if (placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else {\n parseFileImport(context, line, fileImports);\n }\n } else if (keyword === 'import') {\n const match = importPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, `Invalid import '${line.content}' - expected 'import <Qualified.Name> [from \"<origin>\"]'`, locationOf(line));\n } else {\n const origin = match.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, 'An import origin must be a nonblank quoted string', locationOf(line));\n }\n imports.push({ kind: 'ImportSyntax', qualifiedName: match[1], origin, visibility: origin === null ? EventVisibility.Private : EventVisibility.Public, location: locationOf(line) });\n }\n } else if (keyword === 'example') {\n if (placedBody !== undefined) placedBody.tryParse(context, line);\n else examples.push(parseExample(context, line));\n } else if (keyword === 'eventsource') {\n eventSources.push(parseEventSource(context, line));\n } else if (keyword === 'system') {\n systems.push(parseSystem(context, line));\n } else if (keyword === 'concept') {\n concepts.push(parseConcept(context, line));\n } else if (keyword === 'type') {\n types.push(parseType(context, line));\n } else if (keyword === 'module' && !isDocumentPlacement(placement)) {\n parseModuleInPlacedFile(context, line, placement, moduleBody);\n } else if (keyword === 'module') {\n modules.push(parseModule(context, line));\n } else if (keyword === 'persona') {\n personas.push(parsePersona(context, line));\n } else if (keyword === 'sticky') {\n const stickyNote = parseStickyNote(context, line);\n if (stickyNote !== null) stickyNotes.push(stickyNote);\n } else if (keyword === 'seed') {\n seeds.push(parseSeed(context.valueContext, line));\n } else if (keyword === 'purpose' && placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else if (keyword === 'purpose') {\n purposes.push(parsePurpose(context, line));\n } else if (keyword === 'identity') {\n identity = parseIdentity(context, line, identity);\n } else if (keyword === 'policy') {\n const policy = parsePolicy(context, line);\n if (policies.some(previous => previous.name === policy.name)) {\n context.error(DiagnosticCodes.DuplicateDeclaration, `Duplicate declaration of policy '${policy.name}' - policy names must be unique`, policy.location);\n }\n policies.push(policy);\n } else if (keyword === 'exposure') {\n exposures.push(parseExposure(context, line));\n } else if (keyword === 'instance') {\n instanceContributions.push(parseInstance(context, line));\n } else if (keyword === 'trigger') {\n const data = parseTriggerDeclaration(context, line);\n const name = /^trigger\\s+([A-Za-z_]\\w*)$/.exec(line.content)?.[1];\n if (name !== undefined) declaredTriggers.push({ name, data });\n } else if (opaqueTopLevel.has(keyword)) {\n if (keyword === 'behavior' || keyword === 'layout') collectInputUses(context, line);\n else if (keyword === 'ui') parseUiProfile(context, line);\n else context.skipOpaqueBlock(line.indent);\n } else if (placedBody?.tryParse(context, line) !== true) {\n reportUnexpectedTopLevel(context, line, placement);\n }\n }\n if (moduleBody !== undefined) {\n modules.unshift(moduleBody.build(context.start, true));\n } else if (featureBody !== undefined) {\n modules.unshift(place(placement, featureBody.build(context.start, true), context.start));\n }\n const root: ApplicationSyntax = { kind: 'ApplicationSyntax', ...(commandReadMode === null ? {} : { commandReadMode }), ...(reactionProductionMode === null ? {} : { reactionProductionMode }), ...(identity === null ? {} : { identity }), sourceOptions: context.sourceOptions, domain, imports, concepts, types, systems, eventSources, examples, modules, personas, policies, purposes, seeds, declaredTriggers, fileImports, ...(exposures.length > 0 ? { exposures } : {}), ...(stickyNotes.length > 0 ? { stickyNotes } : {}), ...(instanceContributions.length > 0 ? { instanceContributions } : {}), location: context.start };\n if (context.authoredDeclarations) recordAuthoredDocument(root);\n return root;\n}\n\nfunction declaresConstruct(keyword: string, line: SourceLine, placement: PlayPlacement): boolean {\n if (keyword === 'import') {\n return importPattern.test(line.content);\n }\n if (keyword === 'module') {\n return isDocumentPlacement(placement);\n }\n if (keyword === 'identity') return line.content === 'identity';\n return keyword === 'purpose' || keyword === 'example' || keyword === 'exposure' || keyword === 'instance' || keyword === 'eventsource' || keyword === 'system' || keyword === 'concept' || keyword === 'type' || keyword === 'persona' || keyword === 'sticky' || opaqueTopLevel.has(keyword);\n}\n\nfunction parseModuleInPlacedFile(context: ParserContext, line: SourceLine, placement: PlayPlacement, moduleBody: ModuleBody | undefined): void {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n\n // Restating the module a file is placed in says nothing new, so its body simply joins the placement.\n if (moduleBody !== undefined && name === placement[0]) {\n context.authoredDeclarations = true;\n moduleBody.parseChildren(context, line);\n return;\n }\n context.error(DiagnosticCodes.ModuleInPlacedFile,\n `This file is imported into ${describePlacement(placement)}, so it cannot declare module '${name}' - import it at the top level of a document instead`, locationOf(line));\n context.skipBlock(line.indent);\n}\n\nfunction reportUnexpectedTopLevel(context: ParserContext, line: SourceLine, placement: PlayPlacement): void {\n const word = firstWord(line.content);\n if (!isDocumentPlacement(placement)) {\n const expected = placement.length === 1 ? moduleBodyExpected : featureBodyExpected;\n context.error(DiagnosticCodes.UnexpectedInPlacedFile,\n `Unexpected '${word}' in a file imported into ${describePlacement(placement)} - expected an application declaration or ${expected}`, locationOf(line));\n } else {\n const hint = bodyKeywords.has(word)\n ? ` - '${word}' belongs in a module or feature; wrap it in one, or import this file from inside one`\n : ' - expected domain, import, concept, type, policy, persona, sticky note on personas, authentication, identity, module, seed, trigger, behavior, ui profile, theme, sample data or layout';\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Unexpected '${word}' at the top level${hint}`, locationOf(line));\n }\n context.skipBlock(line.indent);\n}\n\n// Wraps the feature a file is placed in in the features and module around it, each marked as a placement.\nfunction place(placement: PlayPlacement, innermost: FeatureSyntax, start: SourceLocation): ModuleSyntax {\n let feature = innermost;\n for (let index = placement.length - 2; index >= 1; index--) {\n feature = {\n kind: 'FeatureSyntax', name: placement[index], description: null, authorize: null,\n features: [feature], slices: [], fileImports: [], isPlacement: true, location: start,\n };\n }\n return {\n kind: 'ModuleSyntax', name: placement[0], description: null, authorize: null,\n features: [feature], fileImports: [], isPlacement: true, location: start,\n };\n}\n\nfunction parseDomain(context: ParserContext, line: SourceLine, existing: DomainSyntax | null, sawOtherConstruct: boolean): DomainSyntax | null {\n const match = domainPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDomainDeclaration, `Invalid domain declaration '${line.content}' - expected 'domain <Qualified.Name>'`, locationOf(line));\n return existing;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDomain, 'The document already declares a domain - a document can have at most one', locationOf(line));\n return existing;\n }\n if (sawOtherConstruct) {\n context.error(DiagnosticCodes.DomainNotFirst, '\\'domain\\' must be declared before any other construct', locationOf(line));\n }\n return { kind: 'DomainSyntax', name: match[1], location: locationOf(line) };\n}\n\nfunction warnOnTabIndentation(context: ParserContext, lines: readonly SourceLine[]): void {\n let inFence = false;\n for (const line of lines) {\n if (line.raw.trimStart().startsWith('```')) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && tabIndentPattern.test(line.raw)) {\n context.warning(DiagnosticCodes.TabIndentation, 'Screenplay is indentation based - use spaces, not tabs', startOf(line));\n }\n }\n}\n\nfunction parseConcept(context: ParserContext, line: SourceLine): ConceptSyntax {\n const match = conceptPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidConceptDeclaration, `Invalid concept declaration '${line.content}' - expected 'concept <Name> : <Type>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ConceptSyntax', name: firstWord(line.content), type: '', attributes: [], values: [], location: locationOf(line) };\n }\n const [, name, type, attributeText] = match;\n const attributes = parseComplianceMarkers(context, line, name, attributeText);\n if (type !== 'Enum' && !primitiveTypes.includes(type)) {\n context.error(DiagnosticCodes.UnknownPrimitiveType, `Unknown primitive type '${type}' - expected ${primitiveTypes.join(', ')} or Enum`, locationOf(line));\n }\n const values: string[] = [];\n const members = new EnumerationMembers();\n let generation: GenerationSyntax | null = null;\n let declaredGeneration = false;\n let description: string | null = null;\n const validations: ValidateSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const memberName = type === 'Enum' ? members.tryNumbered(context, child) : undefined;\n if (memberName !== undefined) {\n values.push(memberName);\n } else if (firstWord(child.content) === 'description' && (type !== 'Enum' || child.content !== 'description' || context.peekChild(child.indent)?.content.startsWith('```') === true)) {\n description = parseDescription(context, child, description, `Concept '${name}'`);\n } else if (isFileDirective(child)) {\n continue;\n } else if (firstWord(child.content) === 'validate') {\n if (type === 'Enum' && child.content === 'validate' && context.peekChild(child.indent) === undefined) {\n context.warning(DiagnosticCodes.ValidateReadAsEnumerationBlock,\n `'validate' in enumeration concept '${name}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,\n locationOf(child));\n }\n const parsed = parseValidate(context, child, 'concept', name);\n if (parsed !== undefined) validations.push(parsed);\n } else if (firstWord(child.content) === 'generate' && !(type === 'Enum' && child.content === 'generate')) {\n if (declaredGeneration) context.error(DiagnosticCodes.DuplicateGeneration, `Concept '${name}' declares generation more than once.`, locationOf(child));\n const parsed = parseGeneration(context, child, type);\n if (!declaredGeneration) generation = parsed;\n declaredGeneration = true;\n } else if (parseComplianceDirective(context, child, name, attributes)) {\n // Compliance directives are modeled by their original concept marker.\n } else if (type === 'Enum' && enumValuePattern.test(child.content)) {\n values.push(unescapeIdentifier(child.content));\n } else if (type === 'Enum') {\n context.error(DiagnosticCodes.InvalidEnumerationValue, `Invalid enum value '${child.content}' - expected an identifier`, locationOf(child));\n } else {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Unexpected '${child.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason \"<text>\"'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const valueNumbers = members.finish(context, line, values.length);\n return { kind: 'ConceptSyntax', name, type, attributes, values, validations, description, ...(generation === null ? {} : { generation }), ...(valueNumbers === undefined ? {} : { valueNumbers }), location: locationOf(line) };\n}\n\n// 'persona <Name>' with an optional description and the policies it holds - the port of the C# ParsePersona.\nfunction parsePersona(context: ParserContext, line: SourceLine): PersonaSyntax {\n const name = personaPattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid persona declaration '${line.content}' - expected 'persona <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const policies: string[] = [];\n const goals: string[] = [];\n let position: readonly [number, number] | null = null;\n let size: readonly [number, number] | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Persona '${name}'`);\n } else if (keyword === 'goal') {\n const goal = personaGoalPattern.exec(child.content);\n if (goal === null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid goal '${child.content}' - expected 'goal \"<text>\"'`, locationOf(child));\n } else {\n goals.push(unescapeString(goal[1]));\n }\n } else if (keyword === 'position') {\n position = parseCanvasPair(context, child, 'position', 'x', 'y', position, true) ?? position;\n } else if (keyword === 'size') {\n size = parseCanvasPair(context, child, 'size', 'width', 'height', size, false) ?? size;\n } else if (keyword === 'policy') {\n const policy = personaPolicyPattern.exec(child.content);\n if (policy === null) {\n context.error(DiagnosticCodes.InvalidPersonaPolicyReference, `Invalid policy reference '${child.content}' - expected 'policy <Name>'`, locationOf(child));\n } else {\n policies.push(policy[1]);\n }\n } else {\n context.error(DiagnosticCodes.UnknownPersonaDirective, `Unexpected '${keyword}' in persona body - expected description, goal, policy, position or size`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return {\n kind: 'PersonaSyntax', name, description, policies,\n ...(goals.length > 0 ? { goals } : {}),\n ...(position === null ? {} : { x: position[0], y: position[1] }),\n ...(size === null ? {} : { width: size[0], height: size[1] }),\n location: locationOf(line),\n };\n}\n\n// 'sticky note on personas' with the text it carries, an optional colour and where it sits on the personas canvas - the port of the C# ParseStickyNote.\nfunction parseStickyNote(context: ParserContext, line: SourceLine): StickyNoteSyntax | null {\n if (!stickyNotePattern.test(line.content)) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid sticky note declaration '${line.content}' - expected 'sticky note on personas'`, locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let text: string | null = null;\n let colour: string | null = null;\n let position: readonly [number, number] | null = null;\n let size: readonly [number, number] | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n text = parseDescription(context, child, text, 'A sticky note');\n } else if (keyword === 'colour') {\n const match = stickyNoteColourPattern.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid colour '${child.content}' - expected 'colour yellow', 'colour pink', 'colour green' or 'colour blue'`, locationOf(child));\n } else {\n colour = match[1];\n }\n } else if (keyword === 'position') {\n position = parseCanvasPair(context, child, 'position', 'x', 'y', position, true) ?? position;\n } else if (keyword === 'size') {\n size = parseCanvasPair(context, child, 'size', 'width', 'height', size, false) ?? size;\n } else {\n context.error(DiagnosticCodes.UnknownPersonaDirective, `Unexpected '${keyword}' in sticky note body - expected description, colour, position or size`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (text === null || position === null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, 'A sticky note needs a description (the text on it) and a position', locationOf(line));\n return null;\n }\n return { kind: 'StickyNoteSyntax', text, colour, x: position[0], y: position[1], width: size === null ? null : size[0], height: size === null ? null : size[1], location: locationOf(line) };\n}\n\n// 'position <x> <y>' or 'size <width> <height>' - two whole numbers in canvas units; a second line is a mistake.\nfunction parseCanvasPair(context: ParserContext, line: SourceLine, keyword: string, first: string, second: string, existing: readonly [number, number] | null, allowNegative: boolean): readonly [number, number] | null {\n const match = canvasPairPattern.exec(line.content);\n const firstValue = match === null ? Number.NaN : Number.parseInt(match[2], 10);\n const secondValue = match === null ? Number.NaN : Number.parseInt(match[3], 10);\n const valid = match !== null && match[1] === keyword && Number.isSafeInteger(firstValue) && Number.isSafeInteger(secondValue)\n && firstValue >= -2147483648 && firstValue <= 2147483647 && secondValue >= -2147483648 && secondValue <= 2147483647\n && (allowNegative || (firstValue >= 0 && secondValue >= 0));\n if (!valid) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid ${keyword} '${line.content}' - expected '${keyword} <${first}> <${second}>' with whole numbers${allowNegative ? '' : ' that are not negative'}`, locationOf(line));\n return null;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `The ${keyword} is already declared - at most one is allowed`, locationOf(line));\n return null;\n }\n return [firstValue, secondValue];\n}\n"],"mappings":"m9DAoDA,MAAMA,EAAgBC,EAAQ,kDAAkD,EAC1EC,EAAgBD,EAAQ,iDAAiDE,EAAkB,MAAM,EACjGC,EAAiBH,EAAQ,qDAAqD,EAC9EI,EAAmBJ,EAAQ,gBAAgB,EAC3CK,EAAiBL,EAAQ,8BAA8B,EACvDM,EAAuBN,EAAQ,6BAA6B,EAC5DO,EAAqBP,EAAQ,cAAcE,EAAkB,IAAI,EACjEM,EAAoBR,EAAQ,oCAAoC,EAChES,EAA0BT,EAAQ,sCAAsC,EACxEU,EAAoBV,EAAQ,2CAA2C,EACvEW,EAAmB,UACnBC,EAAiB,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,EAIhFC,kBAAiB,IAAI,IAAI,CAAC,SAAU,iBAAkB,OAAQ,KAAM,QAAS,UAAW,SAAU,WAAY,QAAQ,CAAC,EAGvHC,kBAAe,IAAI,IAAI,CAAC,QAAS,UAAW,cAAe,gBAAiB,YAAa,SAAU,SAAU,OAAQ,aAAc,KAAM,MAAM,CAAC,EAItJ,SAAgB,iBAAiB,EAAwB,EAA8B,EAA2BC,EAAsC,CACpJ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AAK,QAAQ,gBAAgBC,EAAQ,IAAI6E,EAAM,KAAKC,EAAO,uBAAuBF,EAAgB,GAAK,2BAA4BxE,EAAWL,CAAI,CAAC,EAC5N,KAOf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";var ScreenplaySyntaxWalker=class{visitNode(e){}visitApplication(e){this.visitNode(e),e.domain!==null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e),e.file&&this.visitFileReference(e.file),e.code&&this.visitCodeBlock(e.code)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.toolbars?.forEach(e=>this.visitScreenDirective(e)),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e)),e.toolbars?.forEach(e=>this.visitScreenDirective(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.partsKey!=null&&this.visitKey(e.partsKey),e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))}),(e.buttons??[]).forEach(e=>this.visitNode(e));break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.givenGenerated?.forEach(e=>this.visitSpecificationGeneratedValue(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationGeneratedValue(e){this.visitNode(e),this.visitExpression(e.source)}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";var ScreenplaySyntaxWalker=class{visitNode(e){}visitApplication(e){this.visitNode(e),e.domain!==null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.stickyNotes?.forEach(e=>this.visitStickyNote(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitStickyNote(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e),e.file&&this.visitFileReference(e.file),e.code&&this.visitCodeBlock(e.code)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.toolbars?.forEach(e=>this.visitScreenDirective(e)),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e)),e.toolbars?.forEach(e=>this.visitScreenDirective(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.partsKey!=null&&this.visitKey(e.partsKey),e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))}),(e.buttons??[]).forEach(e=>this.visitNode(e));break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.givenGenerated?.forEach(e=>this.visitSpecificationGeneratedValue(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationGeneratedValue(e){this.visitNode(e),this.visitExpression(e.source)}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
|
|
2
2
|
//# sourceMappingURL=ScreenplaySyntaxWalker.js.map
|