@cratis/screenplay-language 4.186.0 → 4.188.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.
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{combineAuthorize as i,parseAuthorize as a}from"./AuthorizeParser.js";import{parseDescription as o}from"./DescriptionParser.js";import{parsePurposeReference as s}from"./PurposeParser.js";import{parseDocumentation as c}from"./DocumentationParser.js";import{parseDependsOn as l}from"./DependsOnParser.js";import{parseFileImport as u}from"./FileImportParser.js";import{collectInputUses as d}from"./InputUses.js";import{misplacedReactionIdentity as f}from"./ReactionIdentityParser.js";import{parseExample as p}from"./SpecificationExampleParser.js";import{parseSlice as m}from"./SliceParser.js";const h=t(`^feature\\s+([A-Za-z_]\\w*)$`),g=/* @__PURE__ */ new Set([`on`,`uses`,`contribute`]),_=`description, documentation, depends on <Name>, authorize, import, feature, slice, contribute, example, 'on <trigger>' or 'uses <Behavior>'`;var FeatureBody=class{name;#e=[];#t=[];#n=[];#r=[];#i=[];#a=[];#o=null;#s=null;#c=null;constructor(e){this.name=e}tryParse(t,n){let h=r(n.content);switch(h){case`runs`:return f(t,n),!0;case`description`:return this.#o=o(t,n,this.#o,`Feature '${this.name}'`),!0;case`documentation`:return this.#s=c(t,n,this.#s,`Feature '${this.name}'`),!0;case`depends`:return l(t,n,this.#i,e.UnknownFeatureDirective),!0;case`purpose`:return s(t,n,this.#a),!0;case`authorize`:return this.#c=i(this.#c,a(t,n)),!0;case`import`:return u(t,n,this.#r),!0;case`feature`:return this.#e.push(parseFeature(t,n)),!0;case`example`:return this.#n.push(p(t,n)),!0;case`slice`:return this.#t.push(m(t,n)),!0;default:return g.has(h)?(d(t,n),!0):!1}}build(e,t=!1){return{kind:`FeatureSyntax`,name:this.name,description:this.#o,documentation:this.#s,authorize:this.#c,dependsOn:this.#i,purposes:this.#a,features:this.#e,slices:this.#t,examples:this.#n,fileImports:this.#r,isPlacement:t,location:e}}};function parseFeature(t,i){let a=h.exec(i.content)?.[1]??``;a===``&&t.error(e.InvalidFeatureDeclaration,`Invalid feature declaration '${i.content}' - expected 'feature <Name>'`,n(i));let o=new FeatureBody(a),s=t.scope;t.scope=[...s,a];for(let a=t.peekChild(i.indent);a!==void 0;a=t.peekChild(i.indent))t.reader.takeSignificant(),o.tryParse(t,a)||(t.error(e.UnknownFeatureDirective,`Unexpected '${r(a.content)}' in feature body - expected ${_}`,n(a)),t.skipBlock(a.indent));return t.scope=s,o.build(n(i))}export{FeatureBody,_ as featureBodyExpected,parseFeature};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{combineAuthorize as i,parseAuthorize as a}from"./AuthorizeParser.js";import{parseDescription as o}from"./DescriptionParser.js";import{parsePurposeReference as s}from"./PurposeParser.js";import{parseDocumentation as c}from"./DocumentationParser.js";import{parseDependsOn as l}from"./DependsOnParser.js";import{parseFileImport as u}from"./FileImportParser.js";import{collectInputUses as d}from"./InputUses.js";import{misplacedReactionIdentity as f}from"./ReactionIdentityParser.js";import{parseExample as p}from"./SpecificationExampleParser.js";import{parseSlice as m}from"./SliceParser.js";const h=t(`^feature\\s+([A-Za-z_]\\w*)$`),g=/* @__PURE__ */ new Set([`on`,`uses`,`contribute`,`template`]),_=`description, documentation, depends on <Name>, authorize, import, feature, slice, contribute, example, 'on <trigger>' or 'uses <Behavior>'`;var FeatureBody=class{name;#e=[];#t=[];#n=[];#r=[];#i=[];#a=[];#o=null;#s=null;#c=null;constructor(e){this.name=e}tryParse(t,n){let h=r(n.content);switch(h){case`runs`:return f(t,n),!0;case`description`:return this.#o=o(t,n,this.#o,`Feature '${this.name}'`),!0;case`documentation`:return this.#s=c(t,n,this.#s,`Feature '${this.name}'`),!0;case`depends`:return l(t,n,this.#i,e.UnknownFeatureDirective),!0;case`purpose`:return s(t,n,this.#a),!0;case`authorize`:return this.#c=i(this.#c,a(t,n)),!0;case`import`:return u(t,n,this.#r),!0;case`feature`:return this.#e.push(parseFeature(t,n)),!0;case`example`:return this.#n.push(p(t,n)),!0;case`slice`:return this.#t.push(m(t,n)),!0;default:return g.has(h)?(d(t,n),!0):!1}}build(e,t=!1){return{kind:`FeatureSyntax`,name:this.name,description:this.#o,documentation:this.#s,authorize:this.#c,dependsOn:this.#i,purposes:this.#a,features:this.#e,slices:this.#t,examples:this.#n,fileImports:this.#r,isPlacement:t,location:e}}};function parseFeature(t,i){let a=h.exec(i.content)?.[1]??``;a===``&&t.error(e.InvalidFeatureDeclaration,`Invalid feature declaration '${i.content}' - expected 'feature <Name>'`,n(i));let o=new FeatureBody(a),s=t.scope;t.scope=[...s,a];for(let a=t.peekChild(i.indent);a!==void 0;a=t.peekChild(i.indent))t.reader.takeSignificant(),o.tryParse(t,a)||(t.error(e.UnknownFeatureDirective,`Unexpected '${r(a.content)}' in feature body - expected ${_}`,n(a)),t.skipBlock(a.indent));return t.scope=s,o.build(n(i))}export{FeatureBody,_ as featureBodyExpected,parseFeature};
2
2
  //# sourceMappingURL=FeatureBody.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureBody.js","names":["featurePattern","pattern","opaqueFeatureMembers","featureBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","#authorize","combineAuthorize","parseAuthorize","parseFileImport","#fileImports","#features","#examples","parseExample","#slices","parseSlice","collectInputUses","locationOf","body","previous","child"],"sources":["../../../../../../Compiler/Parsing/FeatureBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseSlice } from './SliceParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst featurePattern = pattern('^feature\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Feature members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueFeatureMembers = new Set(['on', 'uses', 'contribute']);\n\n// What a feature body may hold, as it reads in a diagnostic.\nexport const featureBodyExpected = 'description, documentation, depends on <Name>, authorize, import, feature, slice, contribute, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a feature - written beneath a 'feature' header, or at the top level of a file imported\n// into the feature. The port of the C# FeatureBody.\nexport class FeatureBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #slices: SliceSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a feature body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Feature '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Feature '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownFeatureDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'slice':\n this.#slices.push(parseSlice(context, line));\n return true;\n default:\n if (opaqueFeatureMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Builds the feature, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): FeatureSyntax {\n return {\n kind: 'FeatureSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n slices: this.#slices,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a feature from its already consumed header line.\nexport function parseFeature(context: ParserContext, line: SourceLine): FeatureSyntax {\n const name = featurePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidFeatureDeclaration, `Invalid feature declaration '${line.content}' - expected 'feature <Name>'`, locationOf(line));\n }\n const body = new FeatureBody(name);\n const previous = context.scope;\n context.scope = [...previous, name];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!body.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownFeatureDirective, `Unexpected '${firstWord(child.content)}' in feature body - expected ${featureBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"k1BAwBA,MAAMA,EAAiBC,EAAQ,8BAA8B,EAGvDC,kBAAuB,IAAI,IAAI,CAAC,KAAM,OAAQ,YAAY,CAAC,EAGpDC,EAAsB,6IAInC,IAAa,YAAb,KAAyB,CAWA,KAVrB,GAAsC,CAAC,EACvC,GAAkC,CAAC,EACnC,GAAmD,CAAC,EACpD,GAA4C,CAAC,EAC7C,GAAyC,CAAC,EAC1C,GAA+C,CAAC,EAChD,GAA8B,KAC9B,GAAgC,KAChC,GAAqC,KAErC,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAIpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAUC,EAAUC,EAAK,OAAO,EACtC,OAAQF,EAAR,CACI,IAAK,OAED,OADAG,EAA0BC,EAASF,CAAI,EAChC,GACX,IAAK,cAED,MADA,MAAKG,GAAeC,EAAiBF,EAASF,EAAM,KAAKG,GAAc,YAAY,KAAK,KAAK,EAAE,EACxF,GACX,IAAK,gBAED,MADA,MAAKE,GAAiBC,EAAmBJ,EAASF,EAAM,KAAKK,GAAgB,YAAY,KAAK,KAAK,EAAE,EAC9F,GACX,IAAK,UAED,OADAE,EAAeL,EAASF,EAAM,KAAKQ,GAAYC,EAAgB,uBAAuB,EAC/E,GACX,IAAK,UAED,OADAC,EAAsBR,EAASF,EAAM,KAAKW,EAAS,EAC5C,GACX,IAAK,YAED,MADA,MAAKC,GAAaC,EAAiB,KAAKD,GAAYE,EAAeZ,EAASF,CAAI,CAAC,EAC1E,GACX,IAAK,SAED,OADAe,EAAgBb,EAASF,EAAM,KAAKgB,EAAY,EACzC,GACX,IAAK,UAED,OADA,KAAKC,GA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ACTD,EAAK,MAAMD,EAAWvB,CAAI,CAAC,CACtC"}
1
+ {"version":3,"file":"FeatureBody.js","names":["featurePattern","pattern","opaqueFeatureMembers","featureBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","#authorize","combineAuthorize","parseAuthorize","parseFileImport","#fileImports","#features","#examples","parseExample","#slices","parseSlice","collectInputUses","locationOf","body","previous","child"],"sources":["../../../../../../Compiler/Parsing/FeatureBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseSlice } from './SliceParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst featurePattern = pattern('^feature\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Feature members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueFeatureMembers = new Set(['on', 'uses', 'contribute', 'template']);\n\n// What a feature body may hold, as it reads in a diagnostic.\nexport const featureBodyExpected = 'description, documentation, depends on <Name>, authorize, import, feature, slice, contribute, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a feature - written beneath a 'feature' header, or at the top level of a file imported\n// into the feature. The port of the C# FeatureBody.\nexport class FeatureBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #slices: SliceSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a feature body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Feature '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Feature '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownFeatureDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'slice':\n this.#slices.push(parseSlice(context, line));\n return true;\n default:\n if (opaqueFeatureMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Builds the feature, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): FeatureSyntax {\n return {\n kind: 'FeatureSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n slices: this.#slices,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a feature from its already consumed header line.\nexport function parseFeature(context: ParserContext, line: SourceLine): FeatureSyntax {\n const name = featurePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidFeatureDeclaration, `Invalid feature declaration '${line.content}' - expected 'feature <Name>'`, locationOf(line));\n }\n const body = new FeatureBody(name);\n const previous = context.scope;\n context.scope = [...previous, name];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!body.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownFeatureDirective, `Unexpected '${firstWord(child.content)}' in feature body - expected ${featureBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"k1BAwBA,MAAMA,EAAiBC,EAAQ,8BAA8B,EAGvDC,kBAAuB,IAAI,IAAI,CAAC,KAAM,OAAQ,aAAc,UAAU,CAAC,EAGhEC,EAAsB,6IAInC,IAAa,YAAb,KAAyB,CAWA,KAVrB,GAAsC,CAAC,EACvC,GAAkC,CAAC,EACnC,GAAmD,CAAC,EACpD,GAA4C,CAAC,EAC7C,GAAyC,CAAC,EAC1C,GAA+C,CAAC,EAChD,GAA8B,KAC9B,GAAgC,KAChC,GAAqC,KAErC,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAIpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAUC,EAAUC,EAAK,OAAO,EACtC,OAAQF,EAAR,CACI,IAAK,OAED,OADAG,EAA0BC,EAASF,CAAI,EAChC,GACX,IAAK,cAED,MADA,MAAKG,GAAeC,EAAiBF,EAASF,EAAM,KAAKG,GAAc,YAAY,KAAK,KAAK,EAAE,EACxF,GACX,IAAK,gBAED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EAAQ,MACzB,EAAQ,MAAQ,CAAC,GAAGuB,EAAU5B,CAAI,EAClC,IAAK,IAAI6B,EAAQxB,EAAQ,UAAUF,EAAK,MAAM,EAAG0B,IAAU,IAAA,GAAW,EAAQxB,EAAQ,UAAUF,EAAK,MAAM,EACvGE,EAAQ,OAAO,gBAAgB,EAC1BsB,EAAK,SAAStB,EAASwB,CAAK,IAC7BxB,EAAQ,MAAMO,EAAgB,wBAAyB,eAAeV,EAAU2B,EAAM,OAAO,EAAE,+BAA+B9B,IAAuB2B,EAAWG,CAAK,CAAC,EACtKxB,EAAQ,UAAUwB,EAAM,MAAM,GAItC,MADA,GAAQ,MAAQD,EACTD,EAAK,MAAMD,EAAWvB,CAAI,CAAC,CACtC"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{combineAuthorize as i,parseAuthorize as a}from"./AuthorizeParser.js";import{parseDescription as o}from"./DescriptionParser.js";import{parsePurposeReference as s}from"./PurposeParser.js";import{parseDocumentation as c}from"./DocumentationParser.js";import{parseDependsOn as l}from"./DependsOnParser.js";import{parseFileImport as u}from"./FileImportParser.js";import{collectInputUses as d}from"./InputUses.js";import{misplacedReactionIdentity as f}from"./ReactionIdentityParser.js";import{parseExample as p}from"./SpecificationExampleParser.js";import{parseFeature as m}from"./FeatureBody.js";const h=t(`^module\\s+([A-Za-z_]\\w*)$`),g=/* @__PURE__ */ new Set([`on`,`uses`,`screen`,`dialog`,`form`,`contribute`,`navigation`]),_=`description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, navigation, feature, example, 'on <trigger>' or 'uses <Behavior>'`;var ModuleBody=class{name;#e=[];#t=[];#n=[];#r=[];#i=[];#a=null;#o=null;#s=null;constructor(e){this.name=e}tryParse(t,n){let h=r(n.content);switch(h){case`runs`:return f(t,n),!0;case`description`:return this.#a=o(t,n,this.#a,`Module '${this.name}'`),!0;case`documentation`:return this.#o=c(t,n,this.#o,`Module '${this.name}'`),!0;case`depends`:return l(t,n,this.#r,e.UnknownModuleDirective),!0;case`purpose`:return s(t,n,this.#i),!0;case`authorize`:return this.#s=i(this.#s,a(t,n)),!0;case`import`:return u(t,n,this.#n),!0;case`example`:return this.#t.push(p(t,n)),!0;case`feature`:return this.#e.push(m(t,n)),!0;default:return g.has(h)?(d(t,n),!0):!1}}parseChildren(t,i){for(let a=t.peekChild(i.indent);a!==void 0;a=t.peekChild(i.indent))t.reader.takeSignificant(),this.tryParse(t,a)||(t.error(e.UnknownModuleDirective,`Unexpected '${r(a.content)}' in module body - expected ${_}`,n(a)),t.skipBlock(a.indent))}build(e,t=!1){return{kind:`ModuleSyntax`,name:this.name,description:this.#a,documentation:this.#o,authorize:this.#s,dependsOn:this.#r,purposes:this.#i,features:this.#e,examples:this.#t,fileImports:this.#n,isPlacement:t,location:e}}};function parseModule(t,r){let i=h.exec(r.content)?.[1]??``;i===``&&t.error(e.InvalidModuleDeclaration,`Invalid module declaration '${r.content}' - expected 'module <Name>'`,n(r));let a=new ModuleBody(i),o=t.scope;return t.scope=[i],a.parseChildren(t,r),t.scope=o,a.build(n(r))}export{ModuleBody,_ as moduleBodyExpected,h as modulePattern,parseModule};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{combineAuthorize as i,parseAuthorize as a}from"./AuthorizeParser.js";import{parseDescription as o}from"./DescriptionParser.js";import{parsePurposeReference as s}from"./PurposeParser.js";import{parseDocumentation as c}from"./DocumentationParser.js";import{parseDependsOn as l}from"./DependsOnParser.js";import{parseFileImport as u}from"./FileImportParser.js";import{collectInputUses as d}from"./InputUses.js";import{misplacedReactionIdentity as f}from"./ReactionIdentityParser.js";import{parseExample as p}from"./SpecificationExampleParser.js";import{parseFeature as m}from"./FeatureBody.js";const h=t(`^module\\s+([A-Za-z_]\\w*)$`),g=/* @__PURE__ */ new Set([`on`,`uses`,`screen`,`dialog`,`form`,`contribute`,`navigation`,`template`]),_=`description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, navigation, feature, example, 'on <trigger>' or 'uses <Behavior>'`;var ModuleBody=class{name;#e=[];#t=[];#n=[];#r=[];#i=[];#a=null;#o=null;#s=null;constructor(e){this.name=e}tryParse(t,n){let h=r(n.content);switch(h){case`runs`:return f(t,n),!0;case`description`:return this.#a=o(t,n,this.#a,`Module '${this.name}'`),!0;case`documentation`:return this.#o=c(t,n,this.#o,`Module '${this.name}'`),!0;case`depends`:return l(t,n,this.#r,e.UnknownModuleDirective),!0;case`purpose`:return s(t,n,this.#i),!0;case`authorize`:return this.#s=i(this.#s,a(t,n)),!0;case`import`:return u(t,n,this.#n),!0;case`example`:return this.#t.push(p(t,n)),!0;case`feature`:return this.#e.push(m(t,n)),!0;default:return g.has(h)?(d(t,n),!0):!1}}parseChildren(t,i){for(let a=t.peekChild(i.indent);a!==void 0;a=t.peekChild(i.indent))t.reader.takeSignificant(),this.tryParse(t,a)||(t.error(e.UnknownModuleDirective,`Unexpected '${r(a.content)}' in module body - expected ${_}`,n(a)),t.skipBlock(a.indent))}build(e,t=!1){return{kind:`ModuleSyntax`,name:this.name,description:this.#a,documentation:this.#o,authorize:this.#s,dependsOn:this.#r,purposes:this.#i,features:this.#e,examples:this.#t,fileImports:this.#n,isPlacement:t,location:e}}};function parseModule(t,r){let i=h.exec(r.content)?.[1]??``;i===``&&t.error(e.InvalidModuleDeclaration,`Invalid module declaration '${r.content}' - expected 'module <Name>'`,n(r));let a=new ModuleBody(i),o=t.scope;return t.scope=[i],a.parseChildren(t,r),t.scope=o,a.build(n(r))}export{ModuleBody,_ as moduleBodyExpected,h as modulePattern,parseModule};
2
2
  //# sourceMappingURL=ModuleBody.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleBody.js","names":["modulePattern","pattern","opaqueModuleMembers","moduleBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","#authorize","combineAuthorize","parseAuthorize","parseFileImport","#fileImports","#examples","parseExample","#features","parseFeature","collectInputUses","child","locationOf","body","previous"],"sources":["../../../../../../Compiler/Parsing/ModuleBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFeature } from './FeatureBody';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { parseExample } from './SpecificationExampleParser';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const modulePattern = pattern('^module\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Module members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueModuleMembers = new Set(['on', 'uses', 'screen', 'dialog', 'form', 'contribute', 'navigation']);\n\n// What a module body may hold, as it reads in a diagnostic.\nexport const moduleBodyExpected = 'description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, navigation, feature, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a module - written beneath a 'module' header, or at the top level of a file imported\n// into the module. The port of the C# ModuleBody.\nexport class ModuleBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a module body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Module '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Module '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownModuleDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n default:\n if (opaqueModuleMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Parses the children of a header line into this body, reporting what does not belong in a module.\n parseChildren(context: ParserContext, line: SourceLine): void {\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!this.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownModuleDirective, `Unexpected '${firstWord(child.content)}' in module body - expected ${moduleBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n }\n\n // Builds the module, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): ModuleSyntax {\n return {\n kind: 'ModuleSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a module from its already consumed header line.\nexport function parseModule(context: ParserContext, line: SourceLine): ModuleSyntax {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidModuleDeclaration, `Invalid module declaration '${line.content}' - expected 'module <Name>'`, locationOf(line));\n }\n const body = new ModuleBody(name);\n const previous = context.scope;\n context.scope = [name];\n body.parseChildren(context, line);\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"o1BAwBA,MAAaA,EAAgBC,EAAQ,6BAA6B,EAG5DC,kBAAsB,IAAI,IAAI,CAAC,KAAM,OAAQ,SAAU,SAAU,OAAQ,aAAc,YAAY,CAAC,EAG7FC,EAAqB,0LAIlC,IAAa,WAAb,KAAwB,CAUC,KATrB,GAAsC,CAAC,EACvC,GAAmD,CAAC,EACpD,GAA4C,CAAC,EAC7C,GAAyC,CAAC,EAC1C,GAA+C,CAAC,EAChD,GAA8B,KAC9B,GAAgC,KAChC,GAAqC,KAErC,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAIpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAUC,EAAUC,EAAK,OAAO,EACtC,OAAQF,EAAR,CACI,IAAK,OAED,OADAG,EAA0BC,EAASF,CAAI,EAChC,GACX,IAAK,cAED,MADA,MAAKG,GAAeC,EAAiBF,EAASF,EAAM,KAAKG,GAAc,WAAW,KAAK,KAAK,EAAE,EACvF,GACX,IAAK,gBAED,MADA,MAAKE,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,SAAgB,YAAY,EAAwB,EAAgC,CAChF,IAAMnB,EAAOJ,EAAc,KAAKO,EAAK,OAAO,CAAC,GAAG,IAAM,GAClDH,IAAS,IACTK,EAAQ,MAAMO,EAAgB,yBAA0B,+BAA+BT,EAAK,QAAQ,8BAA+BuB,EAAWvB,CAAI,CAAC,EAEvJ,IAAMwB,EAAO,IAAI,WAAW3B,CAAI,EAC1B4B,EAAWvB,EAAQ,MAIzB,MAHA,GAAQ,MAAQ,CAACL,CAAI,EACrB2B,EAAK,cAActB,EAASF,CAAI,EAChC,EAAQ,MAAQyB,EACTD,EAAK,MAAMD,EAAWvB,CAAI,CAAC,CACtC"}
1
+ {"version":3,"file":"ModuleBody.js","names":["modulePattern","pattern","opaqueModuleMembers","moduleBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","#authorize","combineAuthorize","parseAuthorize","parseFileImport","#fileImports","#examples","parseExample","#features","parseFeature","collectInputUses","child","locationOf","body","previous"],"sources":["../../../../../../Compiler/Parsing/ModuleBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFeature } from './FeatureBody';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { parseExample } from './SpecificationExampleParser';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const modulePattern = pattern('^module\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Module members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueModuleMembers = new Set(['on', 'uses', 'screen', 'dialog', 'form', 'contribute', 'navigation', 'template']);\n\n// What a module body may hold, as it reads in a diagnostic.\nexport const moduleBodyExpected = 'description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, navigation, feature, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a module - written beneath a 'module' header, or at the top level of a file imported\n// into the module. The port of the C# ModuleBody.\nexport class ModuleBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a module body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Module '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Module '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownModuleDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n default:\n if (opaqueModuleMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Parses the children of a header line into this body, reporting what does not belong in a module.\n parseChildren(context: ParserContext, line: SourceLine): void {\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!this.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownModuleDirective, `Unexpected '${firstWord(child.content)}' in module body - expected ${moduleBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n }\n\n // Builds the module, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): ModuleSyntax {\n return {\n kind: 'ModuleSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a module from its already consumed header line.\nexport function parseModule(context: ParserContext, line: SourceLine): ModuleSyntax {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidModuleDeclaration, `Invalid module declaration '${line.content}' - expected 'module <Name>'`, locationOf(line));\n }\n const body = new ModuleBody(name);\n const previous = context.scope;\n context.scope = [name];\n body.parseChildren(context, line);\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"o1BAwBA,MAAaA,EAAgBC,EAAQ,6BAA6B,EAG5DC,kBAAsB,IAAI,IAAI,CAAC,KAAM,OAAQ,SAAU,SAAU,OAAQ,aAAc,aAAc,UAAU,CAAC,EAGzGC,EAAqB,0LAIlC,IAAa,WAAb,KAAwB,CAUC,KATrB,GAAsC,CAAC,EACvC,GAAmD,CAAC,EACpD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Q,MAAMO,EAAgB,uBAAwB,eAAeV,EAAUuB,EAAM,OAAO,EAAE,8BAA8B1B,IAAsB2B,EAAWD,CAAK,CAAC,EACnKpB,EAAQ,UAAUoB,EAAM,MAAM,EAG1C,CAGA,MAAM,EAA0B,EAAc,GAAqB,CAC/D,MAAO,CACH,KAAM,eACN,KAAM,KAAK,KACX,YAAa,KAAKnB,GAClB,cAAe,KAAKE,GACpB,UAAW,KAAKO,GAChB,UAAW,KAAKJ,GAChB,SAAU,KAAKG,GACf,SAAU,KAAKQ,GACf,SAAU,KAAKF,GACf,YAAa,KAAKD,GAClB,cACA,UACJ,CACJ,CACJ,EAGA,SAAgB,YAAY,EAAwB,EAAgC,CAChF,IAAMnB,EAAOJ,EAAc,KAAKO,EAAK,OAAO,CAAC,GAAG,IAAM,GAClDH,IAAS,IACTK,EAAQ,MAAMO,EAAgB,yBAA0B,+BAA+BT,EAAK,QAAQ,8BAA+BuB,EAAWvB,CAAI,CAAC,EAEvJ,IAAMwB,EAAO,IAAI,WAAW3B,CAAI,EAC1B4B,EAAWvB,EAAQ,MAIzB,MAHA,GAAQ,MAAQ,CAACL,CAAI,EACrB2B,EAAK,cAActB,EAASF,CAAI,EAChC,EAAQ,MAAQyB,EACTD,EAAK,MAAMD,EAAWvB,CAAI,CAAC,CACtC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/screenplay-language",
3
- "version": "4.186.0",
3
+ "version": "4.188.0",
4
4
  "description": "Monaco language service for the Cratis Screenplay DSL — syntax highlighting, IntelliSense, hover and diagnostics for .play files",
5
5
  "keywords": [
6
6
  "cratis",