@cratis/screenplay-language 5.3.2 → 5.5.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/Parsing/CommandParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MisplacedRuleHint.js +2 -0
- package/dist/bundles/compiler/Parsing/MisplacedRuleHint.js.map +1 -0
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.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/Parsing/SpecificationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
- package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
- package/dist/bundles/compiler/ScreenplayCompiler.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/compiler/index.js +1 -1
- package/dist/bundles/completion-items.js +19 -18
- package/dist/bundles/completion-items.js.map +1 -1
- package/dist/bundles/completion-planner.js +2 -2
- package/dist/bundles/completion-planner.js.map +1 -1
- package/dist/bundles/hover-content.js +4 -4
- package/dist/bundles/hover-content.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 +2 -2
- package/dist/bundles/scope-items.js.map +1 -1
- package/dist/bundles/tokens.js +1 -1
- package/dist/bundles/tokens.js.map +1 -1
- package/dist/completion-items.d.ts +2 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.d.ts.map +1 -1
- package/dist/hover-content.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/scope-items.d.ts +1 -0
- package/dist/scope-items.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","specificationHeader","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenTimeZonePrefix","givenTimeZonePattern","givenClockPrefix","givenCapturePrefix","thenInvokesPrefix","thenInvokesPattern","givenGeneratedPrefix","givenGeneratedPattern","givenGeneratedBlockPattern","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","action","query","outcome","match","values","value","parseConcreteMapping","rejectOperationChildren","unescapeString","pinned","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","invocation","caseValue","parseSpecificationValue","error","absent","parseStructuredValue","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","block","location","source","parseConcrete","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","structured","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","tryParseStructuredMapping","diagnosticText","streamId","streamIdParts","directiveLocations","parseRouteParts","part","nativeIdentifiers","queryArgumentsContext","existing","lifecycleWhenStart","lifecycleOutcome","lifecycleThen","word","given","whenAppended","whenStarted","whenDeclared","outcomes","then","fact","start","index","sourceLocation"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.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 { parseRouteParts } from './EventSourceParser';\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationTimeZoneSyntax, SpecificationGeneratedValueSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { LifecycleExpectationKind, LifecycleExpectationSyntax, LifecycleOutcomeSyntax, LifecycleSpecificationSyntax } from '../Syntax/Lifecycles';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationInvocationSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\nimport { parseStructuredValue, StructuredMarker, tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst specificationHeader = header;\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenTimeZonePrefix = pattern('^given\\\\s+time\\\\s+zone\\\\b');\nconst givenTimeZonePattern = pattern(`^given\\\\s+time\\\\s+zone\\\\s+\"(${stringBodyPattern})\"$`);\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst thenInvokesPrefix = pattern('^then\\\\s+invokes\\\\b');\nconst thenInvokesPattern = pattern('^then\\\\s+invokes\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst givenGeneratedPrefix = pattern('^given\\\\s+generated\\\\b');\nconst givenGeneratedPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenGeneratedBlockPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)(?:\\\\s+(none|empty))?$');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for(?:\\\\s+(.+))?$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenTimeZone: SpecificationTimeZoneSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n givenGenerated?: SpecificationGeneratedValueSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n thenInvocations?: SpecificationInvocationSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenTimeZone: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n validateQueryRejection(context, line, body);\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction validateQueryRejection(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (!isQueryRejectionCandidate(body) || isWellFormedQueryRejection(body)) return;\n context.error(DiagnosticCodes.MismatchedSpecificationQueryResult,\n \"A query rejection requires exactly one query and one 'then error', no action, and no other outcomes\", locationOf(line));\n}\n\nfunction isQueryRejectionCandidate(body: SpecificationBody): boolean {\n return body.thenErrors.length > 0 && queriedCallCount(body) > 0 && (body.whenQuery !== null || !hasAction(body));\n}\n\nfunction isWellFormedQueryRejection(body: SpecificationBody): boolean {\n return !hasAction(body) && hasOneQueryAndOneError(body) && !hasOtherOutcome(body);\n}\n\nfunction hasOneQueryAndOneError(body: SpecificationBody): boolean {\n return queriedCallCount(body) === 1 && body.thenErrors.length === 1;\n}\n\nfunction hasAction(body: SpecificationBody): boolean {\n return [body.when, body.whenAppended, body.whenClock, body.whenTrigger, body.whenCapture, body.whenRedelivered].some(action => action !== null);\n}\n\nfunction queriedCallCount(body: SpecificationBody): number {\n return body.thenQueries.length + (body.whenQuery === null ? 0 : 1);\n}\n\nfunction hasOtherOutcome(body: SpecificationBody): boolean {\n return [\n body.thenResults.length > 0,\n body.thenNoResult !== null,\n body.thenDenied !== null,\n body.thenEvents.length > 0,\n body.thenNoEvents,\n body.thenEventsInAnyOrder,\n body.thenReadModels.length > 0,\n body.thenAbsentReadModels.length > 0,\n body.thenReturns !== null,\n body.thenQueries.some(query => query.results.length > 0)\n ].some(outcome => outcome);\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenTimeZonePrefix.test(line.content)) {\n const match = givenTimeZonePattern.exec(line.content);\n skipBody(context, line.indent);\n if (body.givenTimeZone !== null || match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationTimeZone, \"A specification states its time zone at most once, as 'given time zone \\\"<id>\\\"'.\", locationOf(line));\n } else {\n body.givenTimeZone = { kind: 'SpecificationTimeZoneSyntax', id: unescapeString(match[1]), location: locationOf(line) };\n }\n } else if (givenGeneratedPrefix.test(line.content)) {\n const pinned = parseGivenGenerated(context, line);\n if (pinned !== null) {\n (body.givenGenerated ??= []).push(pinned);\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenInvokesPrefix.test(line.content)) {\n const invocation = parseNamedStep(context, line, thenInvokesPattern, DiagnosticCodes.InvalidSpecificationInvocation, 'then invokes', 'then invokes <Command>',\n (command, values): SpecificationInvocationSyntax => ({ kind: 'SpecificationInvocationSyntax', command, values, location: locationOf(line) }));\n if (invocation !== null) (body.thenInvocations ??= []).push(invocation);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n // 'for' ending the line opens the key's members as an indented block.\n body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context.valueContext, line, undefined), location: locationOf(line) });\n return;\n }\n if (match !== null && match[2] !== undefined && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n return { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context, line, undefined), location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n }\n if (match === null || match[2] === undefined || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseGivenGenerated(context: ParserContext, line: SourceLine): SpecificationGeneratedValueSyntax | null {\n const match = givenGeneratedPattern.exec(line.content);\n const block = match === null ? givenGeneratedBlockPattern.exec(line.content) : null;\n if (block !== null) {\n return { kind: 'SpecificationGeneratedValueSyntax', command: block[1], property: block[2], source: parseStructuredValue(context, line, block[3] as StructuredMarker), location: locationOf(line) };\n }\n if (match === null) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n const location = locationOf(line);\n const source = parseConcrete(context, match[3], { ...location, column: location.column + line.content.indexOf(match[3], line.content.indexOf('=') + 1) }, DiagnosticCodes.InvalidGeneratedFixture);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A pinned generated value cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'SpecificationGeneratedValueSyntax', command: match[1], property: match[2], source, location };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n let structured: PropertyMappingSyntax | undefined;\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else if ((structured = tryParseStructuredMapping(context, child)) !== undefined) {\n addFixtureValue(context, values, structured);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n const structured = mapping === null ? tryParseStructuredMapping(context, child) : undefined;\n if (mapping === null && structured === undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n continue;\n }\n const value = structured ?? mappingOf(context, child, mapping!, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location, diagnosticText('argument', value.property));\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n\nconst lifecycleWhenStart = pattern('^when\\\\s+start\\\\s+(.+)$');\nconst lifecycleOutcome = pattern('^outcome\\\\s+([A-Za-z_]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst lifecycleThen = pattern('^then\\\\s+(is|sends|starts|completes|fails\\\\s+at|waits\\\\s+at)(?:\\\\s+([A-Za-z_]\\\\w*))?$');\n\nfunction lifecycleExpectation(line: SourceLine): LifecycleExpectationSyntax | undefined {\n const match = lifecycleThen.exec(line.content);\n if (match === null) return undefined;\n const word = match[1].replace(/\\s+/g, ' ');\n const expectation: LifecycleExpectationKind = word === 'is' ? 'State' : word === 'sends' ? 'Sends' : word === 'starts' ? 'Starts' : word === 'completes' ? 'Completes' : word === 'fails at' ? 'Fails' : 'Waits';\n if ((match[2] !== undefined) === (expectation === 'Completes')) return undefined;\n return { kind: 'LifecycleExpectationSyntax', expectation, target: match[2] ?? null, location: locationOf(line) };\n}\n\n// A specification written inside a statemachine or a workflow - the port of C# SpecificationParser.ParseLifecycle.\nexport function parseLifecycleSpecification(context: ParserContext, header: SourceLine, code: string): LifecycleSpecificationSyntax {\n const match = specificationHeader.exec(header.content);\n if (match === null) {\n context.error(code, `Invalid specification '${header.content}' - expected 'specification <Name>'.`, locationOf(header));\n skipBody(context, header.indent);\n return { kind: 'LifecycleSpecificationSyntax', name: '', description: null, given: [], whenAppended: null, whenStarted: null, outcomes: [], then: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n const given: SpecificationEventSyntax[] = [];\n let whenAppended: SpecificationEventSyntax | null = null;\n let whenStarted: ExpressionSyntax | null = null;\n let whenDeclared = false;\n const outcomes: LifecycleOutcomeSyntax[] = [];\n const then: LifecycleExpectationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Specification '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'given') {\n const fact = parseEventStep(context, line, givenPattern, 'given');\n if (fact !== undefined) given.push(fact);\n } else if (keyword === 'when') {\n if (whenDeclared) {\n context.error(code, `Specification '${name}' already declares a 'when'.`, locationOf(line));\n skipBody(context, line.indent);\n continue;\n }\n whenDeclared = true;\n const start = lifecycleWhenStart.exec(line.content);\n if (start !== null) {\n const index = line.content.indexOf(start[1], 'when start'.length);\n whenStarted = parseMappingSource(start[1].trim(), sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1 + index, line.path), context);\n } else if (line.content.startsWith('when append')) whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n else {\n context.error(code, `Invalid '${line.content}' - expected 'when append <Event>' or 'when start <key>'.`, locationOf(line));\n skipBody(context, line.indent);\n }\n } else if (keyword === 'outcome') {\n const outcome = lifecycleOutcome.exec(line.content);\n if (outcome !== null) outcomes.push({ kind: 'LifecycleOutcomeSyntax', node: outcome[1], outlet: outcome[2], location: locationOf(line) });\n else context.error(code, `Invalid outcome '${line.content}' - expected 'outcome <Node> <outlet>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'An outcome cannot have children.');\n } else if (keyword === 'then') {\n const expectation = lifecycleExpectation(line);\n if (expectation !== undefined) then.push(expectation);\n else context.error(code, `Invalid '${line.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'A then line cannot have children.');\n } else {\n context.error(code, `Unexpected '${line.content}' in specification '${name}' - expected description, given, when, outcome or then.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'LifecycleSpecificationSyntax', name, description, given, whenAppended, whenStarted, outcomes, then, location: locationOf(header), directiveLocations };\n}\n"],"mappings":"A,wzCA8BA,MAAMC,GAAsBC,EAAQ,oEAAoE,EAClGC,GAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAsBD,EACtBE,EAAuBJ,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeK,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,EAChDC,EAAc,YAAY,MAAM,EAChCC,EAAmB,YAAY,MAAM,EACrCC,EAAkBb,EAAQ,mBAAmB,EAC7Cc,EAAkBd,EAAQ,iCAAiC,EAC3De,EAAwB,YAAY,oBAAoB,EACxDC,EAAuB,YAAY,oBAAqB,0BAA0B,EAClFC,EAAejB,EAAQ,gBAAgB,EACvCkB,EAAmBlB,EAAQ,uBAAuBmB,EAAkB,IAAI,EACxEC,EAAiBpB,EAAQ,iCAAiC,EAC1DqB,EAAuBhB,EAAc,iCAAiC,EACtEiB,EAAsBtB,EAAQ,2BAA2B,EACzDuB,EAAuBvB,EAAQ,+BAA+BmB,EAAkB,IAAI,EACpFK,EAAmBxB,EAAQ,oBAAoB,EAC/CyB,EAAqBzB,EAAQ,sBAAsB,EACnD0B,EAAoB1B,EAAQ,qBAAqB,EACjD2B,EAAqB3B,EAAQ,2DAA2D,EACxF4B,EAAuB5B,EAAQ,wBAAwB,EACvD6B,EAAwB7B,EAAQ,wEAAwE,EACxG8B,GAA6B9B,EAA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,EAAe,eAAeC,EAASD,EAAMvC,EAAmB,aAAa,GAAK,MAEjIwC,EAAQ,MAAM2C,EAAM,YAAY5C,EAAK,QAAQ,2DAA4DG,EAAWH,CAAI,CAAC,EACzH,SAASC,EAASD,EAAK,MAAM,EAErC,MAAO,GAAIU,IAAY,UAAW,CAC9B,IAAMc,EAAUgF,GAAiB,KAAKxG,EAAK,OAAO,EAC9CwB,IAAY,KACXvB,EAAQ,MAAM2C,EAAM,oBAAoB5C,EAAK,QAAQ,yCAA0CG,EAAWH,CAAI,CAAC,EAD9F+G,EAAS,KAAK,CAAE,KAAM,yBAA0B,KAAMvF,EAAQ,GAAI,OAAQA,EAAQ,GAAI,SAAUrB,EAAWH,CAAI,CAAE,CAAC,EAExI6B,EAAwB5B,EAASD,EAAM4C,EAAM,kCAAkC,CACnF,MAAO,GAAIlC,IAAY,OAAQ,CAC3B,IAAMqC,EAAc,qBAAqB/C,CAAI,EACzC+C,IAAgB,IAAA,GACf9C,EAAQ,MAAM2C,EAAM,YAAY5C,EAAK,QAAQ,uJAAwJG,EAAWH,CAAI,CAAC,EAD3LgH,EAAK,KAAKjE,CAAW,EAEpDlB,EAAwB5B,EAASD,EAAM4C,EAAM,mCAAmC,CACpF,MACI3C,EAAQ,MAAM2C,EAAM,eAAe5C,EAAK,QAAQ,sBAAsBD,EAAK,yDAA0DI,EAAWH,CAAI,CAAC,EACrJC,EAAQ,UAAUD,EAAK,MAAM,CAErC,CACA,MAAO,CAAE,KAAM,+BAAgC,OAAM,cAAa,QAAO,eAAc,cAAa,WAAU,OAAM,SAAUG,EAAWlD,CAAM,EAAG,oBAAmB,CACzK,C"}
|
|
1
|
+
{"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","specificationHeader","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenTimeZonePrefix","givenTimeZonePattern","givenClockPrefix","givenCapturePrefix","thenInvokesPrefix","thenInvokesPattern","givenGeneratedPrefix","givenGeneratedPattern","givenGeneratedBlockPattern","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","action","query","outcome","match","values","value","parseConcreteMapping","rejectOperationChildren","givenRules","rule","state","unescapeString","pinned","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","invocation","caseValue","parseSpecificationValue","error","absent","parseStructuredValue","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","block","location","source","parseConcrete","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","structured","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","tryParseStructuredMapping","diagnosticText","streamId","streamIdParts","directiveLocations","parseRouteParts","part","nativeIdentifiers","queryArgumentsContext","existing","lifecycleWhenStart","lifecycleOutcome","lifecycleThen","word","given","whenAppended","whenStarted","whenDeclared","outcomes","then","fact","start","index","sourceLocation"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.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 { parseRouteParts } from './EventSourceParser';\nimport { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationTimeZoneSyntax, SpecificationGeneratedValueSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { LifecycleExpectationKind, LifecycleExpectationSyntax, LifecycleOutcomeSyntax, LifecycleSpecificationSyntax } from '../Syntax/Lifecycles';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationInvocationSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\nimport { parseStructuredValue, StructuredMarker, tryParseStructuredMapping } from './StructuredBlockParser';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst specificationHeader = header;\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenTimeZonePrefix = pattern('^given\\\\s+time\\\\s+zone\\\\b');\nconst givenTimeZonePattern = pattern(`^given\\\\s+time\\\\s+zone\\\\s+\"(${stringBodyPattern})\"$`);\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst thenInvokesPrefix = pattern('^then\\\\s+invokes\\\\b');\nconst thenInvokesPattern = pattern('^then\\\\s+invokes\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst givenGeneratedPrefix = pattern('^given\\\\s+generated\\\\b');\nconst givenGeneratedPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenGeneratedBlockPattern = pattern('^given\\\\s+generated\\\\s+([A-Z]\\\\w*)\\\\.([a-z_]\\\\w*)(?:\\\\s+(none|empty))?$');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for(?:\\\\s+(.+))?$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenTimeZone: SpecificationTimeZoneSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n givenGenerated?: SpecificationGeneratedValueSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n thenInvocations?: SpecificationInvocationSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenTimeZone: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n validateQueryRejection(context, line, body);\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction validateQueryRejection(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (!isQueryRejectionCandidate(body) || isWellFormedQueryRejection(body)) return;\n context.error(DiagnosticCodes.MismatchedSpecificationQueryResult,\n \"A query rejection requires exactly one query and one 'then error', no action, and no other outcomes\", locationOf(line));\n}\n\nfunction isQueryRejectionCandidate(body: SpecificationBody): boolean {\n return body.thenErrors.length > 0 && queriedCallCount(body) > 0 && (body.whenQuery !== null || !hasAction(body));\n}\n\nfunction isWellFormedQueryRejection(body: SpecificationBody): boolean {\n return !hasAction(body) && hasOneQueryAndOneError(body) && !hasOtherOutcome(body);\n}\n\nfunction hasOneQueryAndOneError(body: SpecificationBody): boolean {\n return queriedCallCount(body) === 1 && body.thenErrors.length === 1;\n}\n\nfunction hasAction(body: SpecificationBody): boolean {\n return [body.when, body.whenAppended, body.whenClock, body.whenTrigger, body.whenCapture, body.whenRedelivered].some(action => action !== null);\n}\n\nfunction queriedCallCount(body: SpecificationBody): number {\n return body.thenQueries.length + (body.whenQuery === null ? 0 : 1);\n}\n\nfunction hasOtherOutcome(body: SpecificationBody): boolean {\n return [\n body.thenResults.length > 0,\n body.thenNoResult !== null,\n body.thenDenied !== null,\n body.thenEvents.length > 0,\n body.thenNoEvents,\n body.thenEventsInAnyOrder,\n body.thenReadModels.length > 0,\n body.thenAbsentReadModels.length > 0,\n body.thenReturns !== null,\n body.thenQueries.some(query => query.results.length > 0)\n ].some(outcome => outcome);\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\n// The Given state the rules read and write: a narrow view of the specification body, so null versus undefined and lazy initialization stay the body's own.\ntype GivenState = Pick<SpecificationBody, 'given' | 'givenReadModels' | 'givenClock' | 'givenTimeZone' | 'givenCaptures' | 'givenGenerated' | 'givenCaller' | 'givenCallerPersona'>;\n\ninterface GivenRule {\n readonly matches: (line: SourceLine) => boolean;\n readonly parse: (context: ParserContext, line: SourceLine, state: GivenState) => void;\n}\n\n// Tried in order; the first match handles the line. The event rule matches everything, so a malformed Given keeps the event parser's diagnostics and recovery.\nconst givenRules: readonly GivenRule[] = [\n { matches: line => givenClockPrefix.test(line.content), parse: parseGivenClock },\n { matches: line => givenTimeZonePrefix.test(line.content), parse: parseGivenTimeZone },\n { matches: line => givenGeneratedPrefix.test(line.content), parse: parseGivenGeneratedValue },\n { matches: line => givenCapturePrefix.test(line.content), parse: parseGivenCapture },\n { matches: line => line.content.startsWith('given caller'), parse: parseGivenCaller },\n { matches: line => readModelPrefix.test(line.content), parse: parseGivenReadModel },\n { matches: () => true, parse: parseGivenEvent },\n];\n\nfunction parseGiven(context: ParserContext, line: SourceLine, state: GivenState): void {\n for (const rule of givenRules) {\n if (rule.matches(line)) {\n rule.parse(context, line, state);\n return;\n }\n }\n}\n\nfunction parseGivenClock(context: ParserContext, line: SourceLine, state: GivenState): void {\n if (state.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n state.givenClock = parseClock(context, line, 'given');\n }\n}\n\nfunction parseGivenTimeZone(context: ParserContext, line: SourceLine, state: GivenState): void {\n const match = givenTimeZonePattern.exec(line.content);\n skipBody(context, line.indent);\n if (state.givenTimeZone !== null || match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationTimeZone, \"A specification states its time zone at most once, as 'given time zone \\\"<id>\\\"'.\", locationOf(line));\n } else {\n state.givenTimeZone = { kind: 'SpecificationTimeZoneSyntax', id: unescapeString(match[1]), location: locationOf(line) };\n }\n}\n\nfunction parseGivenGeneratedValue(context: ParserContext, line: SourceLine, state: GivenState): void {\n const pinned = parseGivenGenerated(context, line);\n if (pinned !== null) {\n (state.givenGenerated ??= []).push(pinned);\n }\n}\n\nfunction parseGivenCapture(context: ParserContext, line: SourceLine, state: GivenState): void {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n state.givenCaptures.push(capture);\n }\n}\n\nfunction parseGivenCaller(context: ParserContext, line: SourceLine, state: GivenState): void {\n if (state.givenCaller !== null || state.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n parseGivenCallerPersona(context, line, state);\n } else {\n state.givenCaller = parseCaller(context, line);\n }\n}\n\nfunction parseGivenCallerPersona(context: ParserContext, line: SourceLine, state: GivenState): void {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) state.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n}\n\nfunction parseGivenReadModel(context: ParserContext, line: SourceLine, state: GivenState): void {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n state.givenReadModels.push(readModel);\n }\n}\n\nfunction parseGivenEvent(context: ParserContext, line: SourceLine, state: GivenState): void {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n state.given.push(event);\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenInvokesPrefix.test(line.content)) {\n const invocation = parseNamedStep(context, line, thenInvokesPattern, DiagnosticCodes.InvalidSpecificationInvocation, 'then invokes', 'then invokes <Command>',\n (command, values): SpecificationInvocationSyntax => ({ kind: 'SpecificationInvocationSyntax', command, values, location: locationOf(line) }));\n if (invocation !== null) (body.thenInvocations ??= []).push(invocation);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n // 'for' ending the line opens the key's members as an indented block.\n body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context.valueContext, line, undefined), location: locationOf(line) });\n return;\n }\n if (match !== null && match[2] !== undefined && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && match[2] === undefined && context.peekChild(line.indent) !== undefined) {\n return { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key: parseStructuredValue(context, line, undefined), location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n }\n if (match === null || match[2] === undefined || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseGivenGenerated(context: ParserContext, line: SourceLine): SpecificationGeneratedValueSyntax | null {\n const match = givenGeneratedPattern.exec(line.content);\n const block = match === null ? givenGeneratedBlockPattern.exec(line.content) : null;\n if (block !== null) {\n return { kind: 'SpecificationGeneratedValueSyntax', command: block[1], property: block[2], source: parseStructuredValue(context, line, block[3] as StructuredMarker), location: locationOf(line) };\n }\n if (match === null) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"Expected 'given generated <Command>.<property> = <value>' with exactly one concrete value.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n const location = locationOf(line);\n const source = parseConcrete(context, match[3], { ...location, column: location.column + line.content.indexOf(match[3], line.content.indexOf('=') + 1) }, DiagnosticCodes.InvalidGeneratedFixture);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A pinned generated value cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'SpecificationGeneratedValueSyntax', command: match[1], property: match[2], source, location };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n let structured: PropertyMappingSyntax | undefined;\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else if ((structured = tryParseStructuredMapping(context, child)) !== undefined) {\n addFixtureValue(context, values, structured);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n const structured = mapping === null ? tryParseStructuredMapping(context, child) : undefined;\n if (mapping === null && structured === undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child), diagnosticText('text', child.content));\n continue;\n }\n const value = structured ?? mappingOf(context, child, mapping!, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location, diagnosticText('argument', value.property));\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n\nconst lifecycleWhenStart = pattern('^when\\\\s+start\\\\s+(.+)$');\nconst lifecycleOutcome = pattern('^outcome\\\\s+([A-Za-z_]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst lifecycleThen = pattern('^then\\\\s+(is|sends|starts|completes|fails\\\\s+at|waits\\\\s+at)(?:\\\\s+([A-Za-z_]\\\\w*))?$');\n\nfunction lifecycleExpectation(line: SourceLine): LifecycleExpectationSyntax | undefined {\n const match = lifecycleThen.exec(line.content);\n if (match === null) return undefined;\n const word = match[1].replace(/\\s+/g, ' ');\n const expectation: LifecycleExpectationKind = word === 'is' ? 'State' : word === 'sends' ? 'Sends' : word === 'starts' ? 'Starts' : word === 'completes' ? 'Completes' : word === 'fails at' ? 'Fails' : 'Waits';\n if ((match[2] !== undefined) === (expectation === 'Completes')) return undefined;\n return { kind: 'LifecycleExpectationSyntax', expectation, target: match[2] ?? null, location: locationOf(line) };\n}\n\n// A specification written inside a statemachine or a workflow - the port of C# SpecificationParser.ParseLifecycle.\nexport function parseLifecycleSpecification(context: ParserContext, header: SourceLine, code: string): LifecycleSpecificationSyntax {\n const match = specificationHeader.exec(header.content);\n if (match === null) {\n context.error(code, `Invalid specification '${header.content}' - expected 'specification <Name>'.`, locationOf(header));\n skipBody(context, header.indent);\n return { kind: 'LifecycleSpecificationSyntax', name: '', description: null, given: [], whenAppended: null, whenStarted: null, outcomes: [], then: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n const given: SpecificationEventSyntax[] = [];\n let whenAppended: SpecificationEventSyntax | null = null;\n let whenStarted: ExpressionSyntax | null = null;\n let whenDeclared = false;\n const outcomes: LifecycleOutcomeSyntax[] = [];\n const then: LifecycleExpectationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Specification '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'given') {\n const fact = parseEventStep(context, line, givenPattern, 'given');\n if (fact !== undefined) given.push(fact);\n } else if (keyword === 'when') {\n if (whenDeclared) {\n context.error(code, `Specification '${name}' already declares a 'when'.`, locationOf(line));\n skipBody(context, line.indent);\n continue;\n }\n whenDeclared = true;\n const start = lifecycleWhenStart.exec(line.content);\n if (start !== null) {\n const index = line.content.indexOf(start[1], 'when start'.length);\n whenStarted = parseMappingSource(start[1].trim(), sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1 + index, line.path), context);\n } else if (line.content.startsWith('when append')) whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n else {\n context.error(code, `Invalid '${line.content}' - expected 'when append <Event>' or 'when start <key>'.`, locationOf(line));\n skipBody(context, line.indent);\n }\n } else if (keyword === 'outcome') {\n const outcome = lifecycleOutcome.exec(line.content);\n if (outcome !== null) outcomes.push({ kind: 'LifecycleOutcomeSyntax', node: outcome[1], outlet: outcome[2], location: locationOf(line) });\n else context.error(code, `Invalid outcome '${line.content}' - expected 'outcome <Node> <outlet>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'An outcome cannot have children.');\n } else if (keyword === 'then') {\n const expectation = lifecycleExpectation(line);\n if (expectation !== undefined) then.push(expectation);\n else context.error(code, `Invalid '${line.content}' - expected 'then is <State>', 'then sends <Command>', 'then starts <Workflow>', 'then completes', 'then fails at <Node>' or 'then waits at <Node>'.`, locationOf(line));\n rejectOperationChildren(context, line, code, 'A then line cannot have children.');\n } else {\n context.error(code, `Unexpected '${line.content}' in specification '${name}' - expected description, given, when, outcome or then.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'LifecycleSpecificationSyntax', name, description, given, whenAppended, whenStarted, outcomes, then, location: locationOf(header), directiveLocations };\n}\n"],"mappings":"A,wzCA8BA,MAAMC,GAAsBC,EAAQ,oEAAoE,EAClGC,GAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAsBD,EACtBE,EAAuBJ,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeK,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,E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lers as t}from"./Parsing/CommandHandlerValidator.js";import{recordStructuralInteractions as n}from"./Parsing/StructuralInteractionSites.js";import{validateSpecificationCases as r}from"./Parsing/SpecificationCaseValidator.js";import{expandSpecificationExamples as i,validateSpecificationExampleTypes as a}from"./Parsing/SpecificationCommandExamples.js";import{productionDestinationDiagnostics as o}from"./Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as s}from"./Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as c}from"./Dependencies/DeclaredDependencyTargets.js";import{DeclaredDependencies as l}from"./Dependencies/DeclaredDependencies.js";import{documentPlacement as u}from"./Files/PlayPlacement.js";import{discoverImports as d}from"./Parsing/ImportDiscovery.js";import{interactionAncestry as f}from"./Parsing/InteractionAlternatives.js";import{validateResponses as p}from"./Parsing/ResponseValidator.js";import{validatePublicEventUsage as m}from"./Parsing/PublicEventUsageValidator.js";import{sourceContext as h}from"./Parsing/SourceOptionsParser.js";import{validateInlineEvents as g}from"./Parsing/InlineEventValidator.js";import{validateOperations as _}from"./Parsing/OperationValidator.js";import{CommandStreamCandidates as v}from"./Parsing/CommandStreamCandidates.js";import{validateEventSources as y}from"./Parsing/EventSourceValidator.js";import{validateProjectionTargets as b}from"./Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as x}from"./Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as S}from"./Parsing/EventSubjectValidator.js";import{validateReadModelKeys as C}from"./Parsing/ReadModelKeyValidator.js";import{validateReadModelMemberTypes as w}from"./Parsing/ReadModelMemberTypeValidator.js";import{validateReactionRefusals as T}from"./Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as E}from"./Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as D}from"./Parsing/GuardedActionValidator.js";import{validatePersonaCallers as O}from"./Parsing/PersonaCallerValidator.js";import{validatePurposes as k}from"./Parsing/PurposeValidator.js";import{parseApplication as A}from"./Parsing/ScreenplayParser.js";import{splitLines as j}from"./Parsing/SourceLineSplitter.js";import"./Parsing/ProjectionParser.js";import"./Parsing/CaptureParser.js";import"./Parsing/SpecificationParser.js";import"./Parsing/SpecificationExampleParser.js";import{timelineOrderDiagnostics as M}from"./Files/TimelineOrder.js";function parseForAuthoring(d,N,P=u,F=!0,I,L){let R=j(d,!1,N),z=h(R,N,L);z.scope=P,z.interactionAncestors=f(R),z.streamCandidates=I??v.capture([R],P,L);let B=A(z,R,P);if(n(B,z),F){t(B,z),e(B,z),k(B,z),g(B,z),s(B,z),_(B,z),m(B,z),r(B,z),a(B,z,!0);let n=i(B);p(n,z),y(B,z),b(B,z),x(n,z),S(B,z),C(B,z),w(B,z),T(B,z),E(B,z),D(B,z),O(B,z),B=c(B,z),l.validate(B,z);for(let e of o(B))z.information(e.code,e.message,e.location);for(let e of M(B))z.information(e.code,e.message,e.location)}return{value:B,diagnostics:z.diagnostics,triggerData:z.triggerData,inputUses:z.inputUses,continuationValues:z.continuationValues,guardedInteractions:z.guardedInteractions,interactionBehaviors:z.interactionBehaviors,interactionUses:z.interactionUses,success:!z.diagnostics.some(e=>e.severity===`error`)}}function discoverImports(e,t,n){let r=j(e,!1,t);return d(h(r,t,n))}export{discoverImports,parseForAuthoring};
|
|
1
|
+
import"../_virtual/_virtual/_rolldown/runtime.js";import{validateIdentity as e}from"./Parsing/IdentityValidator.js";import{validateApplicationHandlers as t}from"./Parsing/CommandHandlerValidator.js";import{recordStructuralInteractions as n}from"./Parsing/StructuralInteractionSites.js";import{validateSpecificationCases as r}from"./Parsing/SpecificationCaseValidator.js";import{expandSpecificationExamples as i,validateSpecificationExampleTypes as a}from"./Parsing/SpecificationCommandExamples.js";import{productionDestinationDiagnostics as o}from"./Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as s}from"./Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as c}from"./Dependencies/DeclaredDependencyTargets.js";import{DeclaredDependencies as l}from"./Dependencies/DeclaredDependencies.js";import{documentPlacement as u}from"./Files/PlayPlacement.js";import{discoverImports as d}from"./Parsing/ImportDiscovery.js";import{interactionAncestry as f}from"./Parsing/InteractionAlternatives.js";import{validateResponses as p}from"./Parsing/ResponseValidator.js";import{validatePublicEventUsage as m}from"./Parsing/PublicEventUsageValidator.js";import{sourceContext as h}from"./Parsing/SourceOptionsParser.js";import{validateInlineEvents as g}from"./Parsing/InlineEventValidator.js";import{validateOperations as _}from"./Parsing/OperationValidator.js";import{CommandStreamCandidates as v}from"./Parsing/CommandStreamCandidates.js";import{validateEventSources as y}from"./Parsing/EventSourceValidator.js";import{validateProjectionTargets as b}from"./Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as x}from"./Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as S}from"./Parsing/EventSubjectValidator.js";import{validateReadModelKeys as C}from"./Parsing/ReadModelKeyValidator.js";import{validateReadModelMemberTypes as w}from"./Parsing/ReadModelMemberTypeValidator.js";import{validateReactionRefusals as T}from"./Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as E}from"./Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as D}from"./Parsing/GuardedActionValidator.js";import{validatePersonaCallers as O}from"./Parsing/PersonaCallerValidator.js";import{validatePurposes as k}from"./Parsing/PurposeValidator.js";import{parseApplication as A}from"./Parsing/ScreenplayParser.js";import{splitLines as j}from"./Parsing/SourceLineSplitter.js";import"./Parsing/ProjectionParser.js";import"./Parsing/CaptureParser.js";import"./Parsing/SpecificationParser.js";import"./Parsing/SpecificationExampleParser.js";import{timelineOrderDiagnostics as M}from"./Files/TimelineOrder.js";function parse(e,t,n=u){let{value:r,diagnostics:i,success:a}=parseForAuthoring(e,t,n);return{value:r,diagnostics:i,success:a}}function parseForAuthoring(d,N,P=u,F=!0,I,L){let R=j(d,!1,N),z=h(R,N,L);z.scope=P,z.interactionAncestors=f(R),z.streamCandidates=I??v.capture([R],P,L);let B=A(z,R,P);if(n(B,z),F){t(B,z),e(B,z),k(B,z),g(B,z),s(B,z),_(B,z),m(B,z),r(B,z),a(B,z,!0);let n=i(B);p(n,z),y(B,z),b(B,z),x(n,z),S(B,z),C(B,z),w(B,z),T(B,z),E(B,z),D(B,z),O(B,z),B=c(B,z),l.validate(B,z);for(let e of o(B))z.information(e.code,e.message,e.location);for(let e of M(B))z.information(e.code,e.message,e.location)}return{value:B,diagnostics:z.diagnostics,triggerData:z.triggerData,inputUses:z.inputUses,continuationValues:z.continuationValues,guardedInteractions:z.guardedInteractions,interactionBehaviors:z.interactionBehaviors,interactionUses:z.interactionUses,success:!z.diagnostics.some(e=>e.severity===`error`)}}function discoverImports(e,t,n){let r=j(e,!1,t);return d(h(r,t,n))}export{discoverImports,parse,parseForAuthoring};
|
|
2
2
|
//# sourceMappingURL=ScreenplayCompiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenplayCompiler.js","names":["discoverImportsIn","discoverImports$1","documentPlacement","lines","splitLines","source","path","context","sourceContext","languages","placement","interactionAncestry","streamCandidates","CommandStreamCandidates","value","parseApplication","recordStructuralInteractions","validateResponseContracts","validateApplicationHandlers","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReadModelMemberTypes","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from './Parsing/CommandHandlerValidator';\nimport { recordStructuralInteractions } from './Parsing/StructuralInteractionSites';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { ContinuationValueUse } from './Parsing/ContinuationValueUse';\nimport { InputUse } from './Parsing/InputUses';\nimport { GuardedInteractionBinding, interactionAncestry } from './Parsing/InteractionAlternatives';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from './Parsing/ReadModelKeyValidator';\nimport { validateReadModelMemberTypes } from './Parsing/ReadModelMemberTypeValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[]; readonly continuationValues: readonly ContinuationValueUse[]; readonly guardedInteractions: readonly GuardedInteractionBinding[]; readonly interactionBehaviors: ParserContext['interactionBehaviors']; readonly interactionUses: ParserContext['interactionUses'] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.interactionAncestors = interactionAncestry(lines);\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n recordStructuralInteractions(value, context);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateApplicationHandlers(value, context);\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n validateSpecificationExampleTypes(value, context, true);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReadModelKeys(value, context);\n validateReadModelMemberTypes(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n continuationValues: context.continuationValues,\n guardedInteractions: context.guardedInteractions,\n interactionBehaviors: context.interactionBehaviors,\n interactionUses: context.interactionUses,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"A,yqFAyEA,SAAgB,kBAAkB,EAAgB,EAAe,EAA2BE,EAAmB,EAA4B,GAAM,EAA4C,EAA0a,CACnmB,IAAMC,EAAQC,EAAWC,EAAQ,GAAOC,CAAI,EACtCC,EAAUC,EAAcL,EAAOG,EAAMG,CAAS,EACpD,EAAQ,MAAQC,EAChB,EAAQ,qBAAuBC,EAAoBR,CAAK,EACxD,EAAQ,iBAAmBS,GAAoBC,EAAwB,QAAQ,CAACV,CAAK,EAAGO,EAAWD,CAAS,EAC5G,IAAIK,EAAQC,EAAiBR,EAASJ,EAAOO,CAAS,EAGtD,GAFAM,EAA6BF,EAAOP,CAAO,EAEvCU,EAA2B,CAC3BC,EAA4BJ,EAAOP,CAAO,EAC1CY,EAAiBL,EAAOP,CAAO,EAC/Ba,EAAiBN,EAAOP,CAAO,EAC/Bc,EAAqBP,EAAOP,CAAO,EACnCe,EAA6BR,EAAOP,C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
{"version":3,"file":"ScreenplayCompiler.js","names":["discoverImportsIn","discoverImports$1","documentPlacement","source","path","placement","lines","splitLines","context","sourceContext","languages","interactionAncestry","streamCandidates","CommandStreamCandidates","value","parseApplication","recordStructuralInteractions","validateResponseContracts","validateApplicationHandlers","validateIdentity","validatePurposes","validateInlineEvents","validateConstraintProperties","validateOperations","validatePublicEventUsage","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateResponses","validateEventSources","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReadModelMemberTypes","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validateDependencyDeclarations","DeclaredDependencies","diagnostic","productionDestinationDiagnostics","timelineOrderDiagnostics"],"sources":["../../../../../Compiler/ScreenplayCompiler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from './Parsing/CommandHandlerValidator';\nimport { recordStructuralInteractions } from './Parsing/StructuralInteractionSites';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { ContinuationValueUse } from './Parsing/ContinuationValueUse';\nimport { InputUse } from './Parsing/InputUses';\nimport { GuardedInteractionBinding, interactionAncestry } from './Parsing/InteractionAlternatives';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from './Parsing/ReadModelKeyValidator';\nimport { validateReadModelMemberTypes } from './Parsing/ReadModelMemberTypeValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[]; readonly continuationValues: readonly ContinuationValueUse[]; readonly guardedInteractions: readonly GuardedInteractionBinding[]; readonly interactionBehaviors: ParserContext['interactionBehaviors']; readonly interactionUses: ParserContext['interactionUses'] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.interactionAncestors = interactionAncestry(lines);\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n recordStructuralInteractions(value, context);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateApplicationHandlers(value, context);\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n validateSpecificationExampleTypes(value, context, true);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReadModelKeys(value, context);\n validateReadModelMemberTypes(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n continuationValues: context.continuationValues,\n guardedInteractions: context.guardedInteractions,\n interactionBehaviors: context.interactionBehaviors,\n interactionUses: context.interactionUses,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n"],"mappings":"A,yqFAmEA,SAAgB,MAAM,EAAgB,EAAe,EAA2BE,EAAyD,CACrI,GAAM,CAAE,QAAO,cAAa,WAAY,kBAAkBC,EAAQC,EAAMC,CAAS,EACjF,MAAO,CAAE,QAAO,cAAa,SAAQ,CACzC,CAGA,SAAgB,kBAAkB,EAAgB,EAAe,EAA2BH,EAAmB,EAA4B,GAAM,EAA4C,EAA0a,CACnmB,IAAMI,EAAQC,EAAWJ,EAAQ,GAAOC,CAAI,EACtCI,EAAUC,EAAcH,EAAOF,EAAMM,CAAS,EACpD,EAAQ,MAAQL,EAChB,EAAQ,qBAAuBM,EAAoBL,CAAK,EACxD,EAAQ,iBAAmBM,GAAoBC,EAAwB,QAAQ,CAACP,CAAK,EAAGD,EAAWK,CAAS,EAC5G,IAAII,EAAQC,EAAiBP,EAASF,EAAOD,CAAS,EAGtD,GAFAW,EAA6BF,EAAON,CAAO,EAEvCS,EAA2B,CAC3BC,EAA4BJ,EAAON,CAAO,EAC1CW,EAAiBL,EAAON,CAAO,EAC/BY,EAAiBN,EAAON,CAAO,EAC/Ba,EAAqBP,EAAON,CAAO,EACnCc,EAA6BR,EAAON,CAAO,EAC3Ce,EAAmBT,EAAON,CAAO,EACjCgB,EAAyBV,EAAON,CAAO,EACvCiB,EAA2BX,EAAON,CAAO,EACzCkB,EAAkCZ,EAAON,EAAS,EAAI,EACtD,IAAMmB,EAAYC,EAA4Bd,CAAK,EACnDe,EAAkBF,EAAWnB,CAAO,EACpCsB,EAAqBhB,EAAON,CAAO,EACnCuB,EAA0BjB,EAAON,CAAO,EACxCwB,EAA6BL,EAAWnB,CAAO,EAC/CyB,EAAsBnB,EAAON,CAAO,EACpC0B,EAAsBpB,EAAON,CAAO,EACpC2B,E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