@cratis/screenplay-language 5.3.0 → 5.3.2
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/TypeReferenceSymbol.js.map +1 -1
- package/dist/bundles/action-subject-authoring.js.map +1 -1
- package/dist/bundles/bmp-word-characters.js.map +1 -1
- package/dist/bundles/case-authoring.js +1 -1
- package/dist/bundles/case-authoring.js.map +1 -1
- package/dist/bundles/code-actions.js.map +1 -1
- package/dist/bundles/command-read-completions.js.map +1 -1
- package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
- package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
- package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
- package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
- package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
- package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
- package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
- package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
- package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
- package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
- package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
- package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
- package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
- package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
- package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
- package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayImports.js +1 -1
- package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
- package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
- package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
- package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
- package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
- package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
- package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
- package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
- package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
- package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
- package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
- package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
- package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
- package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
- package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
- package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
- package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
- package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
- package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
- package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
- package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
- package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
- package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
- package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
- package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
- package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
- package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
- package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
- package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
- package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
- package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
- package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
- package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
- package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ScreenParser.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/SeedParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationExampleParser.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/Parsing/SpecificationRedeliveryValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
- package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
- package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
- package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
- package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
- package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
- package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
- package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
- package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
- package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
- package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
- package/dist/bundles/compiler/ScreenActionSubjects.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/ActionSubjectInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
- package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
- package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
- package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
- package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
- package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
- package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
- package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
- package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
- package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
- package/dist/bundles/compiler/Syntax/index.js +1 -1
- package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
- package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
- package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
- package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
- package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
- package/dist/bundles/compiler/Text/patterns.js.map +1 -1
- package/dist/bundles/compiler/index.js +1 -1
- package/dist/bundles/completion-items.js +4 -4
- 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/completions.js +1 -1
- package/dist/bundles/completions.js.map +1 -1
- package/dist/bundles/continuation-responses.js +1 -1
- package/dist/bundles/continuation-responses.js.map +1 -1
- package/dist/bundles/declarations.js.map +1 -1
- package/dist/bundles/dependency-completions.js.map +1 -1
- package/dist/bundles/dependency-target-analysis.js.map +1 -1
- package/dist/bundles/diagnostic-codes.js +1 -1
- package/dist/bundles/diagnostic-codes.js.map +1 -1
- package/dist/bundles/diagnostics.js +1 -1
- package/dist/bundles/diagnostics.js.map +1 -1
- package/dist/bundles/document-context.js.map +1 -1
- package/dist/bundles/documentation-item.js.map +1 -1
- package/dist/bundles/event-analysis-source.js.map +1 -1
- package/dist/bundles/event-context-catalog.js.map +1 -1
- package/dist/bundles/event-context.js.map +1 -1
- package/dist/bundles/event-source-authoring.js +11 -11
- package/dist/bundles/event-source-authoring.js.map +1 -1
- package/dist/bundles/example-analysis.js +2 -2
- package/dist/bundles/example-analysis.js.map +1 -1
- package/dist/bundles/example-authoring.js +2 -2
- package/dist/bundles/example-authoring.js.map +1 -1
- package/dist/bundles/example-declaration-items.js.map +1 -1
- package/dist/bundles/example-values.js.map +1 -1
- package/dist/bundles/file-imports.js.map +1 -1
- package/dist/bundles/file-references.js.map +1 -1
- package/dist/bundles/generation-completions.js.map +1 -1
- package/dist/bundles/hover-content.js +5 -5
- package/dist/bundles/hover-content.js.map +1 -1
- package/dist/bundles/hover.js.map +1 -1
- package/dist/bundles/index.js +1 -1
- package/dist/bundles/index.js.map +1 -1
- package/dist/bundles/inlay-hints.js.map +1 -1
- package/dist/bundles/inline-completions.js +1 -1
- package/dist/bundles/inline-completions.js.map +1 -1
- package/dist/bundles/inline-event-validation.js +1 -1
- package/dist/bundles/inline-event-validation.js.map +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/language.js.map +1 -1
- package/dist/bundles/named-rule-context.js.map +1 -1
- package/dist/bundles/operation-authoring.js +6 -6
- package/dist/bundles/operation-authoring.js.map +1 -1
- package/dist/bundles/persona-analysis.js +1 -1
- package/dist/bundles/persona-analysis.js.map +1 -1
- package/dist/bundles/production-destinations.js +1 -1
- package/dist/bundles/production-destinations.js.map +1 -1
- package/dist/bundles/purpose-items.js.map +1 -1
- package/dist/bundles/reaction-authoring.js +3 -3
- package/dist/bundles/reaction-authoring.js.map +1 -1
- package/dist/bundles/read-model-key-completions.js +1 -1
- package/dist/bundles/read-model-key-completions.js.map +1 -1
- package/dist/bundles/refusal-context.js.map +1 -1
- package/dist/bundles/response-analysis.js.map +1 -1
- package/dist/bundles/response-completions.js +1 -1
- package/dist/bundles/response-completions.js.map +1 -1
- package/dist/bundles/response-tokens.js +2 -2
- package/dist/bundles/response-tokens.js.map +1 -1
- package/dist/bundles/scope-items.js +3 -3
- package/dist/bundles/scope-items.js.map +1 -1
- package/dist/bundles/structure-completions.js.map +1 -1
- package/dist/bundles/sub-language-registry.js.map +1 -1
- package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
- package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
- package/dist/bundles/sub-languages/capture/index.js.map +1 -1
- package/dist/bundles/sub-languages/capture/language.js.map +1 -1
- package/dist/bundles/sub-languages/cdl.js.map +1 -1
- package/dist/bundles/sub-languages/pdl.js.map +1 -1
- package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
- package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
- package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
- package/dist/bundles/sub-languages/projection/index.js.map +1 -1
- package/dist/bundles/sub-languages/projection/language.js.map +1 -1
- package/dist/bundles/symbols.js +2 -2
- package/dist/bundles/symbols.js.map +1 -1
- package/dist/bundles/themes/screenplay-dark.js.map +1 -1
- package/dist/bundles/themes/screenplay-light.js.map +1 -1
- package/dist/bundles/tokens.js.map +1 -1
- package/dist/bundles/validation.js +2 -2
- package/dist/bundles/validation.js.map +1 -1
- package/dist/diagnostic-codes.d.ts +1 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseValidator.js","names":["bareName","nativePattern","primitiveTypes","context","effectiveCommand","specificationCommandExamples","application","slices","scope","parent","feature","slice","child","module","commands","properties","responseFields","command","entries","resolve","responseCommandResolver","concepts","conceptNames","concept","composites","name","type","readModels","entry","model","commandProperties","property","declared","DiagnosticCodes","production","event","reaction","trigger","source","explicit","response","names","field","action","specification","input","identifiers","fixture","expectation","fields","asserted","contract","use","failed","inputs","result","duplicates","item","items","value","member","primitive","exactIsIntegral","responseDateValue","uuidValuePattern","text"],"sources":["../../../../../../Compiler/Parsing/ResponseValidator.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 { nativePattern } from '../Text/patterns';\nimport { exactIsIntegral } from '../Syntax/ExactMathFacts';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConceptSyntax, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { PropertyResponseSourceSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { InputUse } from './InputUses';\nimport { ParserContext } from './ParserContext';\nimport { responseCommandResolver } from './ResponseCommandResolver';\nimport { responseDateValue } from './ResponseDateValues';\nimport { specificationCommandExamples } from './SpecificationCommandExamples';\n\nconst bareName = nativePattern(/^[A-Za-z_]\\w*$/.source);\nconst primitiveTypes = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\ninterface ScopedCommand { command: CommandSyntax; scope: readonly string[] }\n\nexport function validateResponses(application: ApplicationSyntax, context: ParserContext, inputs: readonly InputUse[] = context.inputUses): void {\n const effectiveCommand = specificationCommandExamples(application);\n const slices: { slice: SliceSyntax; scope: readonly string[] }[] = [];\n const collect = (feature: FeatureSyntax, parent: readonly string[]): void => {\n const scope = [...parent, feature.name];\n feature.slices.forEach(slice => slices.push({ slice, scope: [...scope, slice.name] }));\n feature.features.forEach(child => collect(child, scope));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, [module.name])));\n const commands = new Map<string, ScopedCommand[]>();\n const properties = new Map<CommandSyntax, Map<string, PropertySyntax>>();\n const responseFields = new Map<CommandSyntax, Map<string, ResponseFieldSyntax>>();\n for (const { slice, scope } of slices) {\n for (const command of slice.commands) {\n const entries = commands.get(command.name) ?? [];\n entries.push({ command, scope });\n commands.set(command.name, entries);\n properties.set(command, uniqueByName(command.properties));\n if (command.response?.kind === 'RecordCommandResponseSyntax') responseFields.set(command, uniqueByName(command.response.fields));\n }\n }\n const resolve = responseCommandResolver([...commands.values()].flat(), application.imports);\n const concepts = uniqueByName(application.concepts);\n const conceptNames = new Set(application.concepts.map(concept => concept.name));\n const composites = new Map([...uniqueByName(application.types)].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const readModels = new Set(slices.flatMap(entry => entry.slice.readModels.map(model => model.name)));\n const commandProperties = new Set([...properties.keys()].flatMap(command => [...command.properties]));\n const checkDeclarations = (declared: readonly PropertySyntax[]): void => {\n for (const property of declared) {\n if (property.isGenerated && !commandProperties.has(property)) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n }\n };\n // Only these typed declarations carry PropertySyntax. Do not pull the complete extensible walker\n // into every browser parser just to inspect their generated flags.\n const checkFeature = (feature: FeatureSyntax): void => {\n feature.features.forEach(checkFeature);\n for (const slice of feature.slices) {\n for (const command of slice.commands) {\n for (const production of command.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n slice.events.forEach(event => checkDeclarations(event.properties));\n slice.readModels.forEach(model => checkDeclarations(model.properties));\n for (const reaction of slice.reactions) {\n for (const trigger of reaction.triggers) {\n for (const production of trigger.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n }\n }\n };\n application.types.forEach(type => checkDeclarations(type.properties));\n application.modules.forEach(module => module.features.forEach(checkFeature));\n const validateSource = (source: PropertyResponseSourceSyntax, explicit: TypeRefSyntax | null, command: CommandSyntax): void => {\n const property = properties.get(command)!.get(source.property);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidResponseSource, `Response source '${source.property}' must reference one direct command property.`, source.location);\n return;\n }\n const type = property.type;\n if (type.isCollection || readModels.has(type.name)) context.error(DiagnosticCodes.InvalidResponseShape, 'Collection and whole-read-model responses are not supported.', source.location);\n if (explicit !== null && (explicit.name !== type.name || explicit.isCollection !== type.isCollection || explicit.isOptional !== type.isOptional)) context.error(DiagnosticCodes.InvalidResponseShape, \"An explicit response field type must match its source's declared type, collection shape and optionality.\", explicit.location);\n };\n for (const command of properties.keys()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const concept = concepts.get(property.type.name);\n if (property.type.isOptional || property.type.isCollection || (concept === undefined ? primitiveTypes.has(property.type.name) || composites.has(property.type.name) || conceptNames.has(property.type.name) || readModels.has(property.type.name) : concept.type !== 'Uuid' && concept.generation == null)) context.error(DiagnosticCodes.InvalidGeneratedType, 'A generated property must be a required, noncollection generatable concept.', property.location);\n }\n const response = command.response;\n if (response?.kind === 'ScalarCommandResponseSyntax') validateSource(response.source, null, command);\n else if (response?.kind === 'RecordCommandResponseSyntax') {\n if (response.fields.length === 0) context.error(DiagnosticCodes.InvalidCommandResponse, 'A response block requires at least one field.', response.location);\n const names = new Set<string>();\n for (const field of response.fields) {\n if (names.has(field.name)) context.error(DiagnosticCodes.DuplicateResponseField, `Duplicate response field '${field.name}'.`, field.location);\n names.add(field.name);\n validateSource(field.source, field.type, command);\n }\n }\n }\n const validateSpecification = (specification: SpecificationSyntax, scope: readonly string[]): void => {\n const action = effectiveCommand(specification.when, scope);\n const command = action === null ? null : resolve(action.commandType, scope);\n if (action !== null && command !== null) {\n const declared = properties.get(command)!;\n for (const input of action.values) {\n if (declared.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n const identifiers = [...declared.values()].filter(property => property.isIdentifier);\n if (action.for !== null && identifiers.length === 1 && identifiers[0].isGenerated) {\n const type = identifiers[0].type;\n const known = primitiveTypes.has(type.name) || concepts.has(type.name) || composites.has(type.name);\n if (known && (type.isOptional || type.isCollection || !['Uuid', 'String'].includes(concepts.get(type.name)?.type ?? '') || !compatibleValue(action.for, type, concepts, composites))) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"A generated identifier fixture must supply one compatible concrete UUID value through 'for'.\", action.for.location);\n }\n }\n const names = new Set<string>();\n for (const fixture of action.generatedValues ?? []) {\n const property = declared.get(fixture.property);\n if (names.has(fixture.property) || property === undefined || !property.isGenerated || property.isIdentifier || !compatibleValue(fixture.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A generated fixture must uniquely supply a compatible value for a nonidentifier generated command property.', fixture.location);\n names.add(fixture.property);\n }\n }\n const expectation = specification.thenReturns;\n if (expectation == null) return;\n if (action === null || specification.thenErrors.length > 0 || specification.thenDenied != null) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return expectation requires a command action and cannot accompany an error or denial.', expectation.location);\n if (command === null) return;\n const response = command.response;\n const declared = properties.get(command)!;\n if (expectation.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax' && declared.has(response.source.property)) {\n if (!compatibleValue(expectation.value, declared.get(response.source.property)!.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, \"The expected return value must match the response source's type.\", expectation.location);\n } else if (expectation.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n if (expectation.fields.length === 0) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A record return expectation requires at least one field.', expectation.location);\n const fields = responseFields.get(command)!;\n const asserted = new Set<string>();\n for (const field of expectation.fields) {\n const contract = fields.get(field.property);\n const property = contract === undefined ? undefined : declared.get(contract.source.property);\n if (asserted.has(field.property) || property === undefined || !compatibleValue(field.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return assertion must uniquely name a response field and supply a compatible concrete value.', field.location);\n asserted.add(field.property);\n }\n } else {\n context.error(DiagnosticCodes.InvalidReturnExpectation, \"The return expectation must match the command's scalar or record response shape.\", expectation.location);\n }\n };\n for (const { slice, scope } of slices) slice.specifications.forEach(specification => validateSpecification(specification, scope));\n const returned = (command: CommandSyntax, name: string): boolean => command.response?.kind === 'ScalarCommandResponseSyntax'\n ? command.response.source.property === name : responseFields.get(command)?.has(name) === true;\n for (const use of context.continuationValues) {\n if (!bareName.test(use.text) || use.locals.includes(use.text)) continue;\n const scopedCommands = (names: readonly string[]): CommandSyntax[] => names.filter(name => !use.parameters.includes(name)).flatMap(name => {\n const command = resolve(name, use.scope);\n return command === null ? [] : [command];\n });\n if (scopedCommands(use.success).some(command => returned(command, use.text))) continue;\n const failed = scopedCommands(use.failure).reverse().find(command => returned(command, use.text));\n if (failed) context.error(DiagnosticCodes.ResponseNameUsedOnFailure, `'${use.text}' is returned by '${failed.name}' only on success`, use.location);\n }\n for (const input of inputs) {\n if (input.isParameter === true) continue;\n const command = resolve(input.command, input.scope);\n if (command !== null && properties.get(command)!.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n}\n\nexport function uniqueByName<T extends { readonly name: string }>(items: readonly T[]): Map<string, T> {\n const result = new Map<string, T>();\n const duplicates = new Set<string>();\n for (const item of items) {\n if (result.has(item.name)) duplicates.add(item.name);\n result.set(item.name, item);\n }\n duplicates.forEach(name => result.delete(name));\n return result;\n}\n\nexport function compatibleValue(value: ExpressionSyntax, type: TypeRefSyntax, concepts: ReadonlyMap<string, ConceptSyntax>, composites: ReadonlyMap<string, ReadonlyMap<string, PropertySyntax>>): boolean {\n if (value.kind === 'LiteralExpressionSyntax' && value.value === null) return type.isOptional;\n if (type.isCollection) return value.kind === 'ListExpressionSyntax' && value.items.every(item => compatibleValue(item, { ...type, isCollection: false, isOptional: false }, concepts, composites));\n const properties = composites.get(type.name);\n if (properties !== undefined) return value.kind === 'ObjectExpressionSyntax' && value.members.every(member => {\n const property = properties.get(member.name);\n return property !== undefined && compatibleValue(member.value, property.type, concepts, composites);\n });\n const concept = concepts.get(type.name);\n const primitive = concept?.type ?? type.name;\n if (concept?.type === 'Enum') return value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' && concept.values.includes(value.value);\n if (value.kind === 'LiteralExpressionSyntax') {\n switch (primitive) {\n case 'Uuid': return typeof value.value === 'string' && uuidValue(value.value);\n case 'String': return typeof value.value === 'string';\n case 'Bool': return typeof value.value === 'boolean';\n case 'Int': return typeof value.value === 'number' ? Number.isFinite(value.value) && Number.isInteger(value.value) : typeof value.value === 'object' && value.value !== null && exactIsIntegral(value.value);\n case 'Decimal': return typeof value.value === 'number' ? Number.isFinite(value.value) : typeof value.value === 'object' && value.value !== null && value.value.literalType === 'ExactNumber';\n case 'Date': return typeof value.value === 'string' && responseDateValue(value.value, false);\n case 'DateTime': return typeof value.value === 'string' && responseDateValue(value.value, true);\n default: return !primitiveTypes.has(primitive);\n }\n }\n return !primitiveTypes.has(primitive) && concept === undefined;\n}\n\n// Shared with ResponseValueTypes.cs: 32 hex digits (N), hyphenated UUIDs (D), or D wrapped in\n// braces (B) / parentheses (P). Hex is case-insensitive; whitespace and X initializer notation\n// are not admitted in response/fixture values. The lookahead requires the true end, even after a newline.\nconst uuidValuePattern = /^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\}|\\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\))(?![\\s\\S])/i;\n\nfunction uuidValue(text: string): boolean {\n return uuidValuePattern.test(text);\n}\n"],"mappings":"+bAkBA,MAAMA,EAAWC,EAAc,iBAAuB,EAChDC,kBAAiB,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG/F,SAAgB,kBAAkB,EAAgC,EAAwB,EAA8BC,EAAQ,UAAiB,CAC7I,IAAMC,EAAmBC,EAA6BC,CAAW,EAC3DC,EAA6D,CAAC,EAC9D,SAAW,EAAwB,IAAoC,CACzE,IAAMC,EAAQ,CAAC,GAAGC,EAAQC,EAAQ,IAAI,EACtCA,EAAQ,OAAO,QAAQ,GAASH,EAAO,KAAK,CAAE,QAAO,MAAO,CAAC,GAAGC,EAAOG,EAAM,IAAI,CAAE,CAAC,CAAC,EACrFD,EAAQ,SAAS,QAAQ,GAAS,QAAQE,EAAOJ,CAAK,CAAC,CAC3D,EACAF,EAAY,QAAQ,QAAQ,GAAUO,EAAO,SAAS,QAAQ,GAAW,QAAQH,EAAS,CAACG,EAAO,IAAI,CAAC,CAAC,CAAC,EACzG,IAAMC,kBAAW,IAAI,IACfC,kBAAa,IAAI,IACjBC,kBAAiB,IAAI,IAC3B,IAAK,GAAM,CAAE,QAAO,WAAWT,EAC3B,IAAK,IAAMU,KAAWN,EAAM,SAAU,CAClC,IAAMO,EAAUJ,EAAS,IAAIG,EAAQ,IAAI,GAAK,CAAC,EAC/CC,EAAQ,KAAK,CAAE,UAAS,OAAM,CAAC,EAC/BJ,EAAS,IAAIG,EAAQ,KAAMC,CA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AO,EAAI,EAC9F,QAAS,MAAO,CAACzD,EAAe,IAAI2D,CAAS,CACjD,CAEJ,MAAO,CAAC3D,EAAe,IAAI2D,CAAS,GAAKtC,IAAY,IAAA,EACzD,CAKA,MAAMyC,EAAmB,2KAEzB,SAAS,UAAU,EAAuB,CACtC,OAAOA,EAAiB,KAAKC,CAAI,CACrC"}
|
|
1
|
+
{"version":3,"file":"ResponseValidator.js","names":["bareName","nativePattern","primitiveTypes","context","effectiveCommand","specificationCommandExamples","application","slices","scope","parent","feature","slice","child","module","commands","properties","responseFields","command","entries","resolve","responseCommandResolver","concepts","conceptNames","concept","composites","name","type","readModels","entry","model","commandProperties","property","declared","DiagnosticCodes","production","event","reaction","trigger","source","explicit","response","names","field","action","specification","input","identifiers","fixture","expectation","fields","asserted","contract","use","failed","inputs","result","duplicates","item","items","value","member","primitive","exactIsIntegral","responseDateValue","uuidValuePattern","text"],"sources":["../../../../../../Compiler/Parsing/ResponseValidator.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 { nativePattern } from '../Text/patterns';\nimport { exactIsIntegral } from '../Syntax/ExactMathFacts';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConceptSyntax, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { PropertyResponseSourceSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { InputUse } from './InputUses';\nimport { ParserContext } from './ParserContext';\nimport { responseCommandResolver } from './ResponseCommandResolver';\nimport { responseDateValue } from './ResponseDateValues';\nimport { specificationCommandExamples } from './SpecificationCommandExamples';\n\nconst bareName = nativePattern(/^[A-Za-z_]\\w*$/.source);\nconst primitiveTypes = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\ninterface ScopedCommand { command: CommandSyntax; scope: readonly string[] }\n\nexport function validateResponses(application: ApplicationSyntax, context: ParserContext, inputs: readonly InputUse[] = context.inputUses): void {\n const effectiveCommand = specificationCommandExamples(application);\n const slices: { slice: SliceSyntax; scope: readonly string[] }[] = [];\n const collect = (feature: FeatureSyntax, parent: readonly string[]): void => {\n const scope = [...parent, feature.name];\n feature.slices.forEach(slice => slices.push({ slice, scope: [...scope, slice.name] }));\n feature.features.forEach(child => collect(child, scope));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, [module.name])));\n const commands = new Map<string, ScopedCommand[]>();\n const properties = new Map<CommandSyntax, Map<string, PropertySyntax>>();\n const responseFields = new Map<CommandSyntax, Map<string, ResponseFieldSyntax>>();\n for (const { slice, scope } of slices) {\n for (const command of slice.commands) {\n const entries = commands.get(command.name) ?? [];\n entries.push({ command, scope });\n commands.set(command.name, entries);\n properties.set(command, uniqueByName(command.properties));\n if (command.response?.kind === 'RecordCommandResponseSyntax') responseFields.set(command, uniqueByName(command.response.fields));\n }\n }\n const resolve = responseCommandResolver([...commands.values()].flat(), application.imports);\n const concepts = uniqueByName(application.concepts);\n const conceptNames = new Set(application.concepts.map(concept => concept.name));\n const composites = new Map([...uniqueByName(application.types)].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const readModels = new Set(slices.flatMap(entry => entry.slice.readModels.map(model => model.name)));\n const commandProperties = new Set([...properties.keys()].flatMap(command => [...command.properties]));\n const checkDeclarations = (declared: readonly PropertySyntax[]): void => {\n for (const property of declared) {\n if (property.isGenerated && !commandProperties.has(property)) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n }\n };\n // Only these typed declarations carry PropertySyntax. Do not pull the complete extensible walker\n // into every browser parser just to inspect their generated flags.\n const checkFeature = (feature: FeatureSyntax): void => {\n feature.features.forEach(checkFeature);\n for (const slice of feature.slices) {\n for (const command of slice.commands) {\n for (const production of command.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n slice.events.forEach(event => checkDeclarations(event.properties));\n slice.readModels.forEach(model => checkDeclarations(model.properties));\n for (const reaction of slice.reactions) {\n for (const trigger of reaction.triggers) {\n for (const production of trigger.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n }\n }\n };\n application.types.forEach(type => checkDeclarations(type.properties));\n application.modules.forEach(module => module.features.forEach(checkFeature));\n const validateSource = (source: PropertyResponseSourceSyntax, explicit: TypeRefSyntax | null, command: CommandSyntax): void => {\n const property = properties.get(command)!.get(source.property);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidResponseSource, `Response source '${source.property}' must reference one direct command property.`, source.location);\n return;\n }\n const type = property.type;\n if (type.isCollection || readModels.has(type.name)) context.error(DiagnosticCodes.InvalidResponseShape, 'Collection and whole-read-model responses are not supported.', source.location);\n if (explicit !== null && (explicit.name !== type.name || explicit.isCollection !== type.isCollection || explicit.isOptional !== type.isOptional)) context.error(DiagnosticCodes.InvalidResponseShape, \"An explicit response field type must match its source's declared type, collection shape and optionality.\", explicit.location);\n };\n for (const command of properties.keys()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const concept = concepts.get(property.type.name);\n if (property.type.isOptional || property.type.isCollection || (concept === undefined ? primitiveTypes.has(property.type.name) || composites.has(property.type.name) || conceptNames.has(property.type.name) || readModels.has(property.type.name) : concept.type !== 'Uuid' && concept.generation == null)) context.error(DiagnosticCodes.InvalidGeneratedType, 'A generated property must be a required, noncollection generatable concept.', property.location);\n }\n const response = command.response;\n if (response?.kind === 'ScalarCommandResponseSyntax') validateSource(response.source, null, command);\n else if (response?.kind === 'RecordCommandResponseSyntax') {\n if (response.fields.length === 0) context.error(DiagnosticCodes.InvalidCommandResponse, 'A response block requires at least one field.', response.location);\n const names = new Set<string>();\n for (const field of response.fields) {\n if (names.has(field.name)) context.error(DiagnosticCodes.DuplicateResponseField, `Duplicate response field '${field.name}'.`, field.location);\n names.add(field.name);\n validateSource(field.source, field.type, command);\n }\n }\n }\n const validateSpecification = (specification: SpecificationSyntax, scope: readonly string[]): void => {\n const action = effectiveCommand(specification.when, scope);\n const command = action === null ? null : resolve(action.commandType, scope);\n if (action !== null && command !== null) {\n const declared = properties.get(command)!;\n for (const input of action.values) {\n if (declared.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n const identifiers = [...declared.values()].filter(property => property.isIdentifier);\n if (action.for !== null && identifiers.length === 1 && identifiers[0].isGenerated) {\n const type = identifiers[0].type;\n const known = primitiveTypes.has(type.name) || concepts.has(type.name) || composites.has(type.name);\n if (known && (type.isOptional || type.isCollection || !['Uuid', 'String'].includes(concepts.get(type.name)?.type ?? '') || !compatibleValue(action.for, type, concepts, composites))) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"A generated identifier fixture must supply one compatible concrete UUID value through 'for'.\", action.for.location);\n }\n }\n const names = new Set<string>();\n for (const fixture of action.generatedValues ?? []) {\n const property = declared.get(fixture.property);\n if (names.has(fixture.property) || property === undefined || !property.isGenerated || property.isIdentifier || !compatibleValue(fixture.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A generated fixture must uniquely supply a compatible value for a nonidentifier generated command property.', fixture.location);\n names.add(fixture.property);\n }\n }\n const expectation = specification.thenReturns;\n if (expectation == null) return;\n if (action === null || specification.thenErrors.length > 0 || specification.thenDenied != null) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return expectation requires a command action and cannot accompany an error or denial.', expectation.location);\n if (command === null) return;\n const response = command.response;\n const declared = properties.get(command)!;\n if (expectation.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax' && declared.has(response.source.property)) {\n if (!compatibleValue(expectation.value, declared.get(response.source.property)!.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, \"The expected return value must match the response source's type.\", expectation.location);\n } else if (expectation.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n if (expectation.fields.length === 0) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A record return expectation requires at least one field.', expectation.location);\n const fields = responseFields.get(command)!;\n const asserted = new Set<string>();\n for (const field of expectation.fields) {\n const contract = fields.get(field.property);\n const property = contract === undefined ? undefined : declared.get(contract.source.property);\n if (asserted.has(field.property) || property === undefined || !compatibleValue(field.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return assertion must uniquely name a response field and supply a compatible concrete value.', field.location);\n asserted.add(field.property);\n }\n } else {\n context.error(DiagnosticCodes.InvalidReturnExpectation, \"The return expectation must match the command's scalar or record response shape.\", expectation.location);\n }\n };\n for (const { slice, scope } of slices) slice.specifications.forEach(specification => validateSpecification(specification, scope));\n const returned = (command: CommandSyntax, name: string): boolean => command.response?.kind === 'ScalarCommandResponseSyntax'\n ? command.response.source.property === name : responseFields.get(command)?.has(name) === true;\n for (const use of context.continuationValues) {\n if (!bareName.test(use.text) || use.locals.includes(use.text)) continue;\n const scopedCommands = (names: readonly string[]): CommandSyntax[] => names.filter(name => !use.parameters.includes(name)).flatMap(name => {\n const command = resolve(name, use.scope);\n return command === null ? [] : [command];\n });\n if (scopedCommands(use.success).some(command => returned(command, use.text))) continue;\n const failed = scopedCommands(use.failure).reverse().find(command => returned(command, use.text));\n if (failed) context.error(DiagnosticCodes.ResponseNameUsedOnFailure, `'${use.text}' is returned by '${failed.name}' only on success`, use.location);\n }\n for (const input of inputs) {\n if (input.isParameter === true) continue;\n const command = resolve(input.command, input.scope);\n if (command !== null && properties.get(command)!.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n}\n\nexport function uniqueByName<T extends { readonly name: string }>(items: readonly T[]): Map<string, T> {\n const result = new Map<string, T>();\n const duplicates = new Set<string>();\n for (const item of items) {\n if (result.has(item.name)) duplicates.add(item.name);\n result.set(item.name, item);\n }\n duplicates.forEach(name => result.delete(name));\n return result;\n}\n\nexport function compatibleValue(value: ExpressionSyntax, type: TypeRefSyntax, concepts: ReadonlyMap<string, ConceptSyntax>, composites: ReadonlyMap<string, ReadonlyMap<string, PropertySyntax>>): boolean {\n if (value.kind === 'LiteralExpressionSyntax' && value.value === null) return type.isOptional;\n if (type.isCollection) return value.kind === 'ListExpressionSyntax' && value.items.every(item => compatibleValue(item, { ...type, isCollection: false, isOptional: false }, concepts, composites));\n const properties = composites.get(type.name);\n if (properties !== undefined) return value.kind === 'ObjectExpressionSyntax' && value.members.every(member => {\n const property = properties.get(member.name);\n return property !== undefined && compatibleValue(member.value, property.type, concepts, composites);\n });\n const concept = concepts.get(type.name);\n const primitive = concept?.type ?? type.name;\n if (concept?.type === 'Enum') return value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' && concept.values.includes(value.value);\n if (value.kind === 'LiteralExpressionSyntax') {\n switch (primitive) {\n case 'Uuid': return typeof value.value === 'string' && uuidValue(value.value);\n case 'String': return typeof value.value === 'string';\n case 'Bool': return typeof value.value === 'boolean';\n case 'Int': return typeof value.value === 'number' ? Number.isFinite(value.value) && Number.isInteger(value.value) : typeof value.value === 'object' && value.value !== null && exactIsIntegral(value.value);\n case 'Decimal': return typeof value.value === 'number' ? Number.isFinite(value.value) : typeof value.value === 'object' && value.value !== null && value.value.literalType === 'ExactNumber';\n case 'Date': return typeof value.value === 'string' && responseDateValue(value.value, false);\n case 'DateTime': return typeof value.value === 'string' && responseDateValue(value.value, true);\n default: return !primitiveTypes.has(primitive);\n }\n }\n return !primitiveTypes.has(primitive) && concept === undefined;\n}\n\n// Shared with ResponseValueTypes.cs: 32 hex digits (N), hyphenated UUIDs (D), or D wrapped in\n// braces (B) / parentheses (P). Hex is case-insensitive; whitespace and X initializer notation\n// are not admitted in response/fixture values. The lookahead requires the true end, even after a newline.\nconst uuidValuePattern = /^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\}|\\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\))(?![\\s\\S])/i;\n\nfunction uuidValue(text: string): boolean {\n return uuidValuePattern.test(text);\n}\n"],"mappings":"A,+bAkBA,MAAMA,EAAWC,EAAc,iBAAuB,EAChDC,kBAAiB,IAAI,IAAI,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,CAAC,EAG/F,SAAgB,kBAAkB,EAAgC,EAAwB,EAA8BC,EAAQ,UAAiB,CAC7I,IAAMC,EAAmBC,EAA6BC,CAAW,EAC3DC,EAA6D,CAAC,EAC9D,SAAW,EAAwB,IAAoC,CACzE,IAAMC,EAAQ,CAAC,GAAGC,EAAQC,EAAQ,IAAI,EACtCA,EAAQ,OAAO,QAAQ,GAASH,EAAO,KAAK,CAAE,QAAO,MAAO,CAAC,GAAGC,EAAOG,EAAM,IAAI,CAAE,CAAC,CAAC,EACrFD,EAAQ,SAAS,QAAQ,GAAS,QAAQE,EAAOJ,CAAK,CAAC,CAC3D,EACAF,EAAY,QAAQ,QAAQ,GAAUO,EAAO,SAAS,QAAQ,GAAW,QAAQH,EAAS,CAACG,EAAO,IAAI,CAAC,CAAC,CAAC,EACzG,IAAMC,kBAAW,IAAI,IACfC,kBAAa,IAAI,IACjBC,kBAAiB,IAAI,IAC3B,IAAK,GAAM,CAAE,QAAO,WAAWT,EAC3B,IAAK,IAAMU,KAAWN,EAAM,SAAU,CAClC,IAAMO,EAAUJ,EAAS,IAAIG,EAAQ,IAAI,GAAK,CAAC,EAC/CC,EAAQ,KAAK,CAAE,UAAS,OAAM,CAAC,EAC/BJ,EAAS,IAAIG,EAAQ,KAAMC,CAAO,EAClCH,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AC9F,QAAS,MAAO,CAACzD,EAAe,IAAI2D,CAAS,CACjD,CAEJ,MAAO,CAAC3D,EAAe,IAAI2D,CAAS,GAAKtC,IAAY,IAAA,EACzD,CAKA,MAAMyC,EAAmB,2KAEzB,SAAS,UAAU,EAAuB,CACtC,OAAOA,EAAiB,KAAKC,CAAI,CACrC,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{locationOf as i}from"./SourceLine.js";import{parseAuthorize as a}from"./AuthorizeParser.js";import{parseMappingSource as o}from"./ExpressionParser.js";import{firstWord as s}from"./LineText.js";import{parseTypeRef as c}from"./PropertyLineParser.js";import{parseStructuredValue as l}from"./StructuredBlockParser.js";import{parseFencedText as u}from"./CodeBlockParser.js";import{parseDescription as d}from"./DescriptionParser.js";import{parseGuardedAction as f}from"./GuardedActionParser.js";import{collectInputUses as p}from"./InputUses.js";import{isFileDirective as m}from"./FileReferences.js";import{parsePlainActionInput as h,parseSubjectClause as g}from"./ActionSubjectClause.js";import{isValidTemplateVersionRange as _,parseBlueprintReference as v,startsBlueprintReference as y}from"./TemplateReferenceText.js";import{parseFromClause as b,parseFromClauseOn as x}from"./UiBindingParser.js";const S=`(?:"(${t})"|(\\$strings\\.\\w+(?:\\.\\w+)*))`,C=r(`^screen\\s+([A-Za-z_]\\w*)$`),w=r(`^data\\s+([\\w.]+(?:\\[\\])?)\\s+via\\s+query\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),T=r(`^action\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),E=r(`^label\\s+${S}$`),D=r(`^action\\s+${S}$`),O=r(`^navigate\\s+to\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),k=r(`^route\\s+${S}$`),A=r(`^outlet\\s+([A-Za-z_]\\w*)$`),j=r(`^contribute\\s+to\\s+([A-Za-z_]\\w*)(?:\\s+order\\s+(-?\\d+))?$`),M=r(`^parameter\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),N=r(`^component\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)\\s+([A-Za-z_]\\w*)$`),P=r(`^id\\s+(?:"(${t})"|(\\S+))$`),F=r(`^property\\s+([\\w.]+)\\s+from\\s+(.+)$`),I=r(`^property\\s+([\\w.]+)\\s*=\\s+(.+)$`),L=r(`^property\\s+([\\w.]+)(?:\\s+(none|empty))?$`),R=r(`^exposes\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),z=r(`^presentation\\s+([A-Za-z_]\\w*)\\s+${S}$`),B=r(`^confirm\\s+${S}$`),V=r(`^item\\s+([A-Za-z_]\\w*)\\s+(action|navigate|dialog)(?:\\s+to)?\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),H=r(`^button\\s+(?:"(${t})"|([A-Za-z_][\\w-]*))(?:\\s+(.*))?$`),U=new RegExp(r(`\\s*(title|slice|emphasis|icon)\\s+(?:"(${t})"|(\\$strings\\.\\w+(?:\\.\\w+)*)|([A-Za-z_][\\w.-]*))(?=\\s|$)`).source,`uy`),W=r(`^[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*$`),G=r(`^[a-z_]\\w*$`),K=r(`^title\\s+${S}$`),q=r(`^column\\s+([\\w.]+)(?:\\s+label\\s+${S})?$`),J=r(`^on\\s+row-click\\s+(navigate\\s+to\\s+.+)$`),Y=r(`^field\\s+([\\w.]+)\\s+label\\s+${S}$`),operandText=(e,t)=>e[t]===void 0?e[t+1]:n(e[t]),isInteraction=e=>[`on`,`uses`].includes(s(e.content)),isCodeLine=(e,t)=>t.content.startsWith("```")||e.languages.has(t.content);function parseScreen(t,n){let r=C.exec(n.content);r===null&&t.error(e.InvalidScreenDeclaration,`Invalid screen declaration '${n.content}' - expected 'screen <Name>'`,i(n));let a=[],o=[],c=null;for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),s(e.content)===`contribute`){let n=parseScreenContribution(t,e);n!==void 0&&o.push(n)}else s(e.content)===`description`?c=d(t,e,c,`Screen '${r?.[1]??``}'`):m(e)||pushDirective(t,e,a);return{kind:`ScreenSyntax`,name:r?.[1]??``,directives:a,description:c,...o.length>0?{contributions:o}:{},location:i(n)}}function parseScreenContribution(t,n){let r=j.exec(n.content);if(r===null)t.error(e.UnknownScreenDirective,`Invalid screen contribution '${n.content}' - expected 'contribute to <Point> [order <n>]'`,i(n)),t.skipBlock(n.indent);else return{kind:`ScreenContributionSyntax`,contributionPoint:r[1],order:r[2]===void 0?null:Number(r[2]),directives:parseDirectives(t,n),location:i(n)}}function pushDirective(e,t,n){let r=parseDirective(e,t);r!==void 0&&n.push(r)}function parseDirectives(e,t){let n=[];for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),pushDirective(e,r,n);return n}function parseDirective(t,n){switch(validateNonActionSubjectClause(t,n),s(n.content)){case`data`:return parseData(t,n);case`action`:return parseAction(t,n);case`template`:return parseTemplateReference(t,n);case`section`:return parseSection(t,n);case`title`:return parseTitle(t,n);case`table`:return parseTable(t,n);case`summary`:return parseSummary(t,n);case`component`:return parseComponent(t,n);case`toolbar`:return parseToolbar(t,n);case`navigate`:return parseNavigate(t,n.content,n);case`on`:return p(t,n),{kind:`ScreenBehaviorSyntax`,location:i(n)};case`uses`:return p(t,n),{kind:`ScreenUsesBehaviorSyntax`,location:i(n)};default:if(isCodeLine(t,n))return parseCode(t,n);t.error(e.UnknownScreenDirective,`Unexpected '${n.content}' in screen body`,i(n)),t.skipBlock(n.indent);return}}function parseData(t,n){let r=w.exec(n.content);if(r===null)t.error(e.InvalidDataDirective,`Invalid data directive '${n.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`,i(n));else return{kind:`ScreenDataSyntax`,type:c(r[1],i(n)),query:r[2],by:r[3]??null,location:i(n)}}function validateNonActionSubjectClause(e,t){let n=(/* @__PURE__ */ new Map([[`data`,w],[`navigate`,O],[`component`,N],[`title`,K]])).get(s(t.content));n!==void 0&&g(e,t,!1,e=>n.test(e))}function parseAction(e,t){let n=g(e,t,!0,e=>T.test(e)||D.test(e)),r=parseActionHeader(e,t,n);return r===void 0||n.subject===void 0?r:{...r,subject:n.subject}}function parseActionHeader(t,n,r){let a=D.exec(r.header);if(a!==null)return f(t,n,operandText(a,1),parseNavigate);let o=T.exec(r.header);if(o===null){t.error(e.InvalidActionDirective,`Invalid action directive '${n.content}' - expected 'action <Command>'`,i(n)),t.skipBlock(n.indent);return}let c=r.label??null,l=null,u=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=E.exec(r.content);n===null?s(r.content)===`navigate`?l=parseNavigate(t,r.content,r)??null:s(r.content)===`with`?addPlainActionInput(t,r,u):t.error(e.UnknownActionDirective,`Unexpected '${r.content}' in action - expected 'label "..."' or 'navigate to ...'`,i(r)):c=operandText(n,1)}return{kind:`ScreenActionSyntax`,command:o[1],label:c,navigate:l,...u.length===0?{}:{inputs:u},location:i(n)}}function addPlainActionInput(e,t,n){let r=h(e,t,n);r!==void 0&&n.push(r)}function parseNavigate(t,n,r){let a=O.exec(n);if(a===null){t.error(e.InvalidNavigation,`Invalid navigation '${n}' - expected 'navigate to <Screen> [by <param>]'`,i(r));return}let o=[],s=null,c=null;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){t.reader.takeSignificant();let r=M.exec(n.content);if(r!==null){o.push({kind:`ScreenNavigationParameterSyntax`,name:r[1],binding:x(t,r[2],n),location:i(n)});continue}let a=k.exec(n.content);if(a!==null){s=operandText(a,1);continue}let l=A.exec(n.content);l===null?t.error(e.InvalidNavigation,`Unexpected '${n.content}' in navigation - expected 'route "..."', 'outlet <name>' or 'parameter <name> from <binding>'`,i(n)):c=l[1]}return{kind:`ScreenNavigateSyntax`,screen:a[1],by:a[2]??null,route:s,...c===null?{}:{outlet:c},parameters:o,location:i(r)}}function parseTemplateReference(t,n){let r=n.content.substring(8).trim(),a=null,o=null;if(y(r)){let s=v(r);s===void 0?t.error(e.UnknownLayoutDirective,`Invalid template reference '${n.content}' - expected 'template <Name>' or 'template blueprint <Blueprint> <Name> [version "<range>"]'`,i(n)):({blueprint:a,name:r,version:o}=s,o!==null&&!_(o)&&t.error(e.InvalidTemplateVersionRange,`The template version range '${o}' is not one Scene understands - use '*', an exact version or a ^, ~, >=, >, <= or < range such as "^1.2"`,i(n)))}let s=[];for(let a=t.peekChild(n.indent);a!==void 0;a=t.peekChild(n.indent))t.reader.takeSignificant(),G.test(a.content)?s.push({kind:`ScreenSlotSyntax`,name:a.content,directives:parseDirectives(t,a),location:i(a)}):(t.error(e.InvalidScreenLayoutSlot,`Expected a slot name in template '${r}', got '${a.content}'`,i(a)),t.skipBlock(a.indent));return{kind:`ScreenTemplateReferenceSyntax`,name:r,slots:s,...a===null?{}:{blueprint:a},...o===null?{}:{version:o},location:i(n)}}function parseSection(e,t){return{kind:`ScreenSectionSyntax`,name:t.content.substring(7).trim(),directives:parseDirectives(e,t),location:i(t)}}function parseTitle(t,n){let r=K.exec(n.content);return r===null?(t.error(e.InvalidTitleDirective,`Invalid title directive '${n.content}' - expected 'title "..."'`,i(n)),{kind:`ScreenTitleSyntax`,text:``,location:i(n)}):{kind:`ScreenTitleSyntax`,text:operandText(r,1),location:i(n)}}function parseTable(t,n){let r=n.content.substring(5).trim(),a=[],o=null;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=q.exec(r.content),c=J.exec(r.content);if(n!==null){let e=n[2]!==void 0||n[3]!==void 0;a.push({kind:`ScreenColumnSyntax`,property:n[1],label:e?operandText(n,2):null,location:i(r)})}else c===null?s(r.content)===`on`||isInteraction(r)?p(t,r):t.error(e.UnknownTableDirective,`Unexpected '${r.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`,i(r)):o=parseNavigate(t,c[1],r)??null}return{kind:`ScreenTableSyntax`,target:r,columns:a,rowClick:o,location:i(n)}}function parseSummary(t,n){let r=n.content.substring(7).trim(),a=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=Y.exec(r.content);n===null?t.error(e.UnknownSummaryDirective,`Unexpected '${r.content}' in summary - expected 'field <property> label "..."'`,i(r)):a.push({kind:`ScreenFieldSyntax`,property:n[1],label:operandText(n,2),location:i(r)})}return{kind:`ScreenSummarySyntax`,target:r,fields:a,location:i(n)}}function parseComponent(t,n){let r=N.exec(n.content);if(r===null){t.error(e.UnknownScreenDirective,`Invalid component directive '${n.content}' - expected 'component <Package.Component> <name>'`,i(n)),t.skipBlock(n.indent);return}let a=null,o=null,c=null,l=[],u=[],d=[],f=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))switch(t.reader.takeSignificant(),s(r.content)){case`context`:a=parseUiContext(t,r);break;case`id`:o=parseStableId(t,r);break;case`property`:parseComponentProperty(t,r,l);break;case`icon`:c=r.content.substring(4).trim();break;case`presentation`:parsePresentationValue(t,r,d);break;case`exposes`:parseExposedValue(t,r,u);break;case`outlet`:f.push({kind:`ComponentOutletSyntax`,name:r.content.substring(6).trim(),directives:parseDirectives(t,r),location:i(r)});break;case`on`:p(t,r);break;case`uses`:p(t,r);break;default:t.error(e.UnknownScreenDirective,`Unexpected '${r.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`,i(r)),t.skipBlock(r.indent)}return{kind:`ScreenComponentSyntax`,component:r[1],name:r[2],stableId:o,context:a,properties:l,exposes:u,presentation:d,icon:c,outlets:f,location:i(n)}}function parseUiContext(e,t){return parseUiBindingValue(e,t.content.substring(7).trim(),t)}function parseComponentProperty(t,n,r){let a=F.exec(n.content);if(a!==null){r.push({kind:`ComponentPropertySyntax`,property:a[1],binding:x(t,a[2],n),value:null,location:i(n)});return}let s=I.exec(n.content);if(s!==null){r.push({kind:`ComponentPropertySyntax`,property:s[1],binding:null,value:o(s[2],i(n),t),location:i(n)});return}let c=L.exec(n.content);c===null?t.error(e.UnknownScreenDirective,`Invalid component property '${n.content}' - expected 'property <path> from <binding>', 'property <path> = <literal>', or 'property <path>' with the object or list as an indented block`,i(n)):r.push({kind:`ComponentPropertySyntax`,property:c[1],binding:null,value:l(t,n,c[2]),location:i(n)})}function parseStableId(t,n){let r=P.exec(n.content);return r===null?(t.error(e.UnknownScreenDirective,`Invalid component id '${n.content}' - expected 'id "stable-id"'`,i(n)),null):operandText(r,1)}function parseExposedValue(t,n,r){let a=R.exec(n.content);a===null?t.error(e.UnknownScreenDirective,`Invalid exposed value '${n.content}' - expected 'exposes <name> from <binding>'`,i(n)):r.push({kind:`ComponentExposedValueSyntax`,name:a[1],binding:x(t,a[2],n),location:i(n)})}function parsePresentationValue(t,n,r){let a=z.exec(n.content);a===null?t.error(e.UnknownScreenDirective,`Invalid presentation value '${n.content}' - expected 'presentation <key> "value"'`,i(n)):r.push({kind:`PresentationValueSyntax`,name:a[1],value:operandText(a,2),location:i(n)})}function parseToolbar(e,t){let n=t.content.substring(7).trim(),r=[],a=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){if(e.reader.takeSignificant(),s(n.content)===`button`){let t=parseToolbarButton(e,n);t!==void 0&&a.push(t);continue}let t=parseToolbarItem(e,n);t!==void 0&&r.push(t)}return{kind:`ScreenToolbarSyntax`,name:n,items:r,...a.length>0?{buttons:a}:{},location:i(t)}}const X=`button <id> title "<text>" [slice <Module>.<Feature>.<Slice>] [emphasis primary|secondary|quiet] [icon <name>]`;function parseToolbarButton(t,r){let o=H.exec(r.content);if(o===null){t.error(e.InvalidToolbarButton,`Invalid toolbar button '${r.content}' - expected ${X}`,i(r)),t.skipBlock(r.indent);return}let c=o[1]===void 0?o[2]:n(o[1]),l=o[3]??``,u,d,f,p,m=!0,h=0;for(;h<l.length;){U.lastIndex=h;let a=U.exec(l);if(a===null){t.error(e.InvalidToolbarButton,`Invalid toolbar button '${r.content}' - unexpected '${l.substring(h).trim()}'; expected ${X}`,i(r)),m=!1;break}h=a.index+a[0].length;let o=a[1],s=a[2]!==void 0,g=a[3]!==void 0,_=s?n(a[2]):g?a[3]:a[4];(o===`title`?u!==void 0:o===`slice`?d!==void 0:o===`icon`?f!==void 0:p!==void 0)?t.error(e.InvalidToolbarButton,`Toolbar button '${c}' states '${o}' more than once`,i(r)):o===`title`?s||g?u=_:(t.error(e.InvalidToolbarButton,`Invalid title '${_}' on toolbar button '${c}' - expected a quoted string or a $strings.<key> token`,i(r)),m=!1):o===`slice`?!s&&!g&&W.test(_)?d=_:(t.error(e.InvalidToolbarButton,`Invalid slice '${_}' on toolbar button '${c}' - expected <Module>.<Feature>.<Slice>`,i(r)),m=!1):o===`emphasis`?!s&&!g&&[`primary`,`secondary`,`quiet`].includes(_)?p=_===`primary`?`Primary`:_===`secondary`?`Secondary`:`Quiet`:(t.error(e.InvalidToolbarButton,`Invalid emphasis '${_}' on toolbar button '${c}' - expected primary, secondary or quiet`,i(r)),m=!1):f=_}u===void 0&&m&&t.error(e.InvalidToolbarButton,`Toolbar button '${c}' has no title - expected 'button ${c} title "<text>"'`,i(r));let g=null,_;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){if(t.reader.takeSignificant(),s(n.content)===`authorize`&&g===null){g=a(t,n);continue}let r=_===void 0?B.exec(n.content):null;r===null?(t.error(e.InvalidToolbarButton,`Unexpected '${n.content}' under toolbar button '${c}' - a button takes one 'authorize' line, one 'confirm' line and nothing else`,i(n)),t.skipBlock(n.indent)):_=operandText(r,1)}return{kind:`ToolbarButtonSyntax`,id:c,title:u??``,...d===void 0?{}:{slice:d},...p===void 0?{}:{emphasis:p},...f===void 0?{}:{icon:f},...g===null?{}:{authorize:g},..._===void 0?{}:{confirm:_},location:i(r)}}function parseToolbarItem(t,n){let r=g(t,n,/^item\s+\S+\s+action\s/u.test(n.content),e=>V.test(e)),a=V.exec(r.header);if(a===null){t.error(e.UnknownScreenDirective,`Invalid toolbar item '${n.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>', 'item <name> dialog <DialogTemplate>' or 'button <id> title "<text>" slice <Slice>'`,i(n)),t.skipBlock(n.indent);return}let o=r.label??null,c=null,l,u=[],d=[];for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent)){t.reader.takeSignificant();let n=E.exec(e.content);if(n!==null){o=operandText(n,1);continue}let r=B.exec(e.content);if(r!==null){l=operandText(r,1);continue}let a=M.exec(e.content);a===null?s(e.content)===`icon`?c=e.content.substring(4).trim():parsePresentationValue(t,e,d):u.push({kind:`ScreenNavigationParameterSyntax`,name:a[1],binding:x(t,a[2],e),location:i(e)})}let f=a[2]===`navigate`?`Navigate`:a[2]===`dialog`?`Dialog`:`Action`;return{kind:`ToolbarItemSyntax`,name:a[1],syntaxKind:f,target:a[3],label:o,icon:c,...r.subject===void 0?{}:{subject:r.subject},...l===void 0?{}:{confirm:l},parameters:u,presentation:d,location:i(n)}}function parseUiBindingValue(e,t,n){return b(e,t,i(n))}function parseCode(t,n){let r=n.content.startsWith("```")?n.content.substring(3):n.content;if(!t.languages.has(r)){t.error(e.ExpectedCodeFence,`Expected a registered language on the opening fence, not '${n.content}'`,i(n));return}n.content.startsWith("```")||t.warning(e.LegacyInlineCodeFence,`'${r}' on its own line is deprecated - use '\`\`\`${r}' instead`,i(n));let a=u(t,r,n);return a===null?void 0:{kind:`ScreenCodeSyntax`,code:{kind:`CodeBlockSyntax`,language:r,code:a,location:i(n)},location:i(n)}}export{parseScreen,parseToolbar};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{parseAuthorize as i}from"./AuthorizeParser.js";import{parsePlainActionInput as a,parseSubjectClause as o}from"./ActionSubjectClause.js";import{parseFencedText as s}from"./CodeBlockParser.js";import{parseMappingSource as c}from"./ExpressionParser.js";import{parseDescription as l}from"./DescriptionParser.js";import{isFileDirective as u}from"./FileReferences.js";import{parseGuardedAction as d}from"./GuardedActionParser.js";import{collectInputUses as f}from"./InputUses.js";import{firstWord as p}from"./LineText.js";import{isValidTemplateVersionRange as m,parseBlueprintReference as h,startsBlueprintReference as g}from"./TemplateReferenceText.js";import{parseTypeRef as _}from"./PropertyLineParser.js";import{parseFromClause as v,parseFromClauseOn as y}from"./UiBindingParser.js";import{locationOf as b}from"./SourceLine.js";import{parseStructuredValue as x}from"./StructuredBlockParser.js";const S=`(?:"(${t})"|(\\$strings\\.\\w+(?:\\.\\w+)*))`,C=r(`^screen\\s+([A-Za-z_]\\w*)$`),w=r(`^data\\s+([\\w.]+(?:\\[\\])?)\\s+via\\s+query\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),T=r(`^action\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),E=r(`^label\\s+${S}$`),D=r(`^action\\s+${S}$`),O=r(`^navigate\\s+to\\s+(\\w+(?:\\.\\w+)*)(?:\\s+by\\s+(\\w+))?$`),k=r(`^route\\s+${S}$`),A=r(`^outlet\\s+([A-Za-z_]\\w*)$`),j=r(`^contribute\\s+to\\s+([A-Za-z_]\\w*)(?:\\s+order\\s+(-?\\d+))?$`),M=r(`^parameter\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),N=r(`^component\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)\\s+([A-Za-z_]\\w*)$`),P=r(`^id\\s+(?:"(${t})"|(\\S+))$`),F=r(`^property\\s+([\\w.]+)\\s+from\\s+(.+)$`),I=r(`^property\\s+([\\w.]+)\\s*=\\s+(.+)$`),L=r(`^property\\s+([\\w.]+)(?:\\s+(none|empty))?$`),R=r(`^exposes\\s+([A-Za-z_]\\w*)\\s+from\\s+(.+)$`),z=r(`^presentation\\s+([A-Za-z_]\\w*)\\s+${S}$`),B=r(`^confirm\\s+${S}$`),V=r(`^item\\s+([A-Za-z_]\\w*)\\s+(action|navigate|dialog)(?:\\s+to)?\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),H=r(`^button\\s+(?:"(${t})"|([A-Za-z_][\\w-]*))(?:\\s+(.*))?$`),U=new RegExp(r(`\\s*(title|slice|emphasis|icon)\\s+(?:"(${t})"|(\\$strings\\.\\w+(?:\\.\\w+)*)|([A-Za-z_][\\w.-]*))(?=\\s|$)`).source,`uy`),W=r(`^[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*$`),G=r(`^[a-z_]\\w*$`),K=r(`^title\\s+${S}$`),q=r(`^column\\s+([\\w.]+)(?:\\s+label\\s+${S})?$`),J=r(`^on\\s+row-click\\s+(navigate\\s+to\\s+.+)$`),Y=r(`^field\\s+([\\w.]+)\\s+label\\s+${S}$`),operandText=(e,t)=>e[t]===void 0?e[t+1]:n(e[t]),isInteraction=e=>[`on`,`uses`].includes(p(e.content)),isCodeLine=(e,t)=>t.content.startsWith("```")||e.languages.has(t.content);function parseScreen(t,n){let r=C.exec(n.content);r===null&&t.error(e.InvalidScreenDeclaration,`Invalid screen declaration '${n.content}' - expected 'screen <Name>'`,b(n));let i=[],a=[],o=null;for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent))if(t.reader.takeSignificant(),p(e.content)===`contribute`){let n=parseScreenContribution(t,e);n!==void 0&&a.push(n)}else p(e.content)===`description`?o=l(t,e,o,`Screen '${r?.[1]??``}'`):u(e)||pushDirective(t,e,i);return{kind:`ScreenSyntax`,name:r?.[1]??``,directives:i,description:o,...a.length>0?{contributions:a}:{},location:b(n)}}function parseScreenContribution(t,n){let r=j.exec(n.content);if(r===null)t.error(e.UnknownScreenDirective,`Invalid screen contribution '${n.content}' - expected 'contribute to <Point> [order <n>]'`,b(n)),t.skipBlock(n.indent);else return{kind:`ScreenContributionSyntax`,contributionPoint:r[1],order:r[2]===void 0?null:Number(r[2]),directives:parseDirectives(t,n),location:b(n)}}function pushDirective(e,t,n){let r=parseDirective(e,t);r!==void 0&&n.push(r)}function parseDirectives(e,t){let n=[];for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),pushDirective(e,r,n);return n}function parseDirective(t,n){switch(validateNonActionSubjectClause(t,n),p(n.content)){case`data`:return parseData(t,n);case`action`:return parseAction(t,n);case`template`:return parseTemplateReference(t,n);case`section`:return parseSection(t,n);case`title`:return parseTitle(t,n);case`table`:return parseTable(t,n);case`summary`:return parseSummary(t,n);case`component`:return parseComponent(t,n);case`toolbar`:return parseToolbar(t,n);case`navigate`:return parseNavigate(t,n.content,n);case`on`:return f(t,n),{kind:`ScreenBehaviorSyntax`,location:b(n)};case`uses`:return f(t,n),{kind:`ScreenUsesBehaviorSyntax`,location:b(n)};default:if(isCodeLine(t,n))return parseCode(t,n);t.error(e.UnknownScreenDirective,`Unexpected '${n.content}' in screen body`,b(n)),t.skipBlock(n.indent);return}}function parseData(t,n){let r=w.exec(n.content);if(r===null)t.error(e.InvalidDataDirective,`Invalid data directive '${n.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`,b(n));else return{kind:`ScreenDataSyntax`,type:_(r[1],b(n)),query:r[2],by:r[3]??null,location:b(n)}}function validateNonActionSubjectClause(e,t){let n=(/* @__PURE__ */ new Map([[`data`,w],[`navigate`,O],[`component`,N],[`title`,K]])).get(p(t.content));n!==void 0&&o(e,t,!1,e=>n.test(e))}function parseAction(e,t){let n=o(e,t,!0,e=>T.test(e)||D.test(e)),r=parseActionHeader(e,t,n);return r===void 0||n.subject===void 0?r:{...r,subject:n.subject}}function parseActionHeader(t,n,r){let i=D.exec(r.header);if(i!==null)return d(t,n,operandText(i,1),parseNavigate);let a=T.exec(r.header);if(a===null){t.error(e.InvalidActionDirective,`Invalid action directive '${n.content}' - expected 'action <Command>'`,b(n)),t.skipBlock(n.indent);return}let o=r.label??null,s=null,c=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=E.exec(r.content);n===null?p(r.content)===`navigate`?s=parseNavigate(t,r.content,r)??null:p(r.content)===`with`?addPlainActionInput(t,r,c):t.error(e.UnknownActionDirective,`Unexpected '${r.content}' in action - expected 'label "..."' or 'navigate to ...'`,b(r)):o=operandText(n,1)}return{kind:`ScreenActionSyntax`,command:a[1],label:o,navigate:s,...c.length===0?{}:{inputs:c},location:b(n)}}function addPlainActionInput(e,t,n){let r=a(e,t,n);r!==void 0&&n.push(r)}function parseNavigate(t,n,r){let i=O.exec(n);if(i===null){t.error(e.InvalidNavigation,`Invalid navigation '${n}' - expected 'navigate to <Screen> [by <param>]'`,b(r));return}let a=[],o=null,s=null;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){t.reader.takeSignificant();let r=M.exec(n.content);if(r!==null){a.push({kind:`ScreenNavigationParameterSyntax`,name:r[1],binding:y(t,r[2],n),location:b(n)});continue}let i=k.exec(n.content);if(i!==null){o=operandText(i,1);continue}let c=A.exec(n.content);c===null?t.error(e.InvalidNavigation,`Unexpected '${n.content}' in navigation - expected 'route "..."', 'outlet <name>' or 'parameter <name> from <binding>'`,b(n)):s=c[1]}return{kind:`ScreenNavigateSyntax`,screen:i[1],by:i[2]??null,route:o,...s===null?{}:{outlet:s},parameters:a,location:b(r)}}function parseTemplateReference(t,n){let r=n.content.substring(8).trim(),i=null,a=null;if(g(r)){let o=h(r);o===void 0?t.error(e.UnknownLayoutDirective,`Invalid template reference '${n.content}' - expected 'template <Name>' or 'template blueprint <Blueprint> <Name> [version "<range>"]'`,b(n)):({blueprint:i,name:r,version:a}=o,a!==null&&!m(a)&&t.error(e.InvalidTemplateVersionRange,`The template version range '${a}' is not one Scene understands - use '*', an exact version or a ^, ~, >=, >, <= or < range such as "^1.2"`,b(n)))}let o=[];for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent))t.reader.takeSignificant(),G.test(i.content)?o.push({kind:`ScreenSlotSyntax`,name:i.content,directives:parseDirectives(t,i),location:b(i)}):(t.error(e.InvalidScreenLayoutSlot,`Expected a slot name in template '${r}', got '${i.content}'`,b(i)),t.skipBlock(i.indent));return{kind:`ScreenTemplateReferenceSyntax`,name:r,slots:o,...i===null?{}:{blueprint:i},...a===null?{}:{version:a},location:b(n)}}function parseSection(e,t){return{kind:`ScreenSectionSyntax`,name:t.content.substring(7).trim(),directives:parseDirectives(e,t),location:b(t)}}function parseTitle(t,n){let r=K.exec(n.content);return r===null?(t.error(e.InvalidTitleDirective,`Invalid title directive '${n.content}' - expected 'title "..."'`,b(n)),{kind:`ScreenTitleSyntax`,text:``,location:b(n)}):{kind:`ScreenTitleSyntax`,text:operandText(r,1),location:b(n)}}function parseTable(t,n){let r=n.content.substring(5).trim(),i=[],a=null;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=q.exec(r.content),o=J.exec(r.content);if(n!==null){let e=n[2]!==void 0||n[3]!==void 0;i.push({kind:`ScreenColumnSyntax`,property:n[1],label:e?operandText(n,2):null,location:b(r)})}else o===null?p(r.content)===`on`||isInteraction(r)?f(t,r):t.error(e.UnknownTableDirective,`Unexpected '${r.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`,b(r)):a=parseNavigate(t,o[1],r)??null}return{kind:`ScreenTableSyntax`,target:r,columns:i,rowClick:a,location:b(n)}}function parseSummary(t,n){let r=n.content.substring(7).trim(),i=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=Y.exec(r.content);n===null?t.error(e.UnknownSummaryDirective,`Unexpected '${r.content}' in summary - expected 'field <property> label "..."'`,b(r)):i.push({kind:`ScreenFieldSyntax`,property:n[1],label:operandText(n,2),location:b(r)})}return{kind:`ScreenSummarySyntax`,target:r,fields:i,location:b(n)}}function parseComponent(t,n){let r=N.exec(n.content);if(r===null){t.error(e.UnknownScreenDirective,`Invalid component directive '${n.content}' - expected 'component <Package.Component> <name>'`,b(n)),t.skipBlock(n.indent);return}let i=null,a=null,o=null,s=[],c=[],l=[],u=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))switch(t.reader.takeSignificant(),p(r.content)){case`context`:i=parseUiContext(t,r);break;case`id`:a=parseStableId(t,r);break;case`property`:parseComponentProperty(t,r,s);break;case`icon`:o=r.content.substring(4).trim();break;case`presentation`:parsePresentationValue(t,r,l);break;case`exposes`:parseExposedValue(t,r,c);break;case`outlet`:u.push({kind:`ComponentOutletSyntax`,name:r.content.substring(6).trim(),directives:parseDirectives(t,r),location:b(r)});break;case`on`:f(t,r);break;case`uses`:f(t,r);break;default:t.error(e.UnknownScreenDirective,`Unexpected '${r.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`,b(r)),t.skipBlock(r.indent)}return{kind:`ScreenComponentSyntax`,component:r[1],name:r[2],stableId:a,context:i,properties:s,exposes:c,presentation:l,icon:o,outlets:u,location:b(n)}}function parseUiContext(e,t){return parseUiBindingValue(e,t.content.substring(7).trim(),t)}function parseComponentProperty(t,n,r){let i=F.exec(n.content);if(i!==null){r.push({kind:`ComponentPropertySyntax`,property:i[1],binding:y(t,i[2],n),value:null,location:b(n)});return}let a=I.exec(n.content);if(a!==null){r.push({kind:`ComponentPropertySyntax`,property:a[1],binding:null,value:c(a[2],b(n),t),location:b(n)});return}let o=L.exec(n.content);o===null?t.error(e.UnknownScreenDirective,`Invalid component property '${n.content}' - expected 'property <path> from <binding>', 'property <path> = <literal>', or 'property <path>' with the object or list as an indented block`,b(n)):r.push({kind:`ComponentPropertySyntax`,property:o[1],binding:null,value:x(t,n,o[2]),location:b(n)})}function parseStableId(t,n){let r=P.exec(n.content);return r===null?(t.error(e.UnknownScreenDirective,`Invalid component id '${n.content}' - expected 'id "stable-id"'`,b(n)),null):operandText(r,1)}function parseExposedValue(t,n,r){let i=R.exec(n.content);i===null?t.error(e.UnknownScreenDirective,`Invalid exposed value '${n.content}' - expected 'exposes <name> from <binding>'`,b(n)):r.push({kind:`ComponentExposedValueSyntax`,name:i[1],binding:y(t,i[2],n),location:b(n)})}function parsePresentationValue(t,n,r){let i=z.exec(n.content);i===null?t.error(e.UnknownScreenDirective,`Invalid presentation value '${n.content}' - expected 'presentation <key> "value"'`,b(n)):r.push({kind:`PresentationValueSyntax`,name:i[1],value:operandText(i,2),location:b(n)})}function parseToolbar(e,t){let n=t.content.substring(7).trim(),r=[],i=[];for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){if(e.reader.takeSignificant(),p(n.content)===`button`){let t=parseToolbarButton(e,n);t!==void 0&&i.push(t);continue}let t=parseToolbarItem(e,n);t!==void 0&&r.push(t)}return{kind:`ScreenToolbarSyntax`,name:n,items:r,...i.length>0?{buttons:i}:{},location:b(t)}}const X=`button <id> title "<text>" [slice <Module>.<Feature>.<Slice>] [emphasis primary|secondary|quiet] [icon <name>]`;function parseToolbarButton(t,r){let a=H.exec(r.content);if(a===null){t.error(e.InvalidToolbarButton,`Invalid toolbar button '${r.content}' - expected ${X}`,b(r)),t.skipBlock(r.indent);return}let o=a[1]===void 0?a[2]:n(a[1]),s=a[3]??``,c,l,u,d,f=!0,m=0;for(;m<s.length;){U.lastIndex=m;let i=U.exec(s);if(i===null){t.error(e.InvalidToolbarButton,`Invalid toolbar button '${r.content}' - unexpected '${s.substring(m).trim()}'; expected ${X}`,b(r)),f=!1;break}m=i.index+i[0].length;let a=i[1],p=i[2]!==void 0,h=i[3]!==void 0,g=p?n(i[2]):h?i[3]:i[4];(a===`title`?c!==void 0:a===`slice`?l!==void 0:a===`icon`?u!==void 0:d!==void 0)?t.error(e.InvalidToolbarButton,`Toolbar button '${o}' states '${a}' more than once`,b(r)):a===`title`?p||h?c=g:(t.error(e.InvalidToolbarButton,`Invalid title '${g}' on toolbar button '${o}' - expected a quoted string or a $strings.<key> token`,b(r)),f=!1):a===`slice`?!p&&!h&&W.test(g)?l=g:(t.error(e.InvalidToolbarButton,`Invalid slice '${g}' on toolbar button '${o}' - expected <Module>.<Feature>.<Slice>`,b(r)),f=!1):a===`emphasis`?!p&&!h&&[`primary`,`secondary`,`quiet`].includes(g)?d=g===`primary`?`Primary`:g===`secondary`?`Secondary`:`Quiet`:(t.error(e.InvalidToolbarButton,`Invalid emphasis '${g}' on toolbar button '${o}' - expected primary, secondary or quiet`,b(r)),f=!1):u=g}c===void 0&&f&&t.error(e.InvalidToolbarButton,`Toolbar button '${o}' has no title - expected 'button ${o} title "<text>"'`,b(r));let h=null,g;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){if(t.reader.takeSignificant(),p(n.content)===`authorize`&&h===null){h=i(t,n);continue}let r=g===void 0?B.exec(n.content):null;r===null?(t.error(e.InvalidToolbarButton,`Unexpected '${n.content}' under toolbar button '${o}' - a button takes one 'authorize' line, one 'confirm' line and nothing else`,b(n)),t.skipBlock(n.indent)):g=operandText(r,1)}return{kind:`ToolbarButtonSyntax`,id:o,title:c??``,...l===void 0?{}:{slice:l},...d===void 0?{}:{emphasis:d},...u===void 0?{}:{icon:u},...h===null?{}:{authorize:h},...g===void 0?{}:{confirm:g},location:b(r)}}function parseToolbarItem(t,n){let r=o(t,n,/^item\s+\S+\s+action\s/u.test(n.content),e=>V.test(e)),i=V.exec(r.header);if(i===null){t.error(e.UnknownScreenDirective,`Invalid toolbar item '${n.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>', 'item <name> dialog <DialogTemplate>' or 'button <id> title "<text>" slice <Slice>'`,b(n)),t.skipBlock(n.indent);return}let a=r.label??null,s=null,c,l=[],u=[];for(let e=t.peekChild(n.indent);e!==void 0;e=t.peekChild(n.indent)){t.reader.takeSignificant();let n=E.exec(e.content);if(n!==null){a=operandText(n,1);continue}let r=B.exec(e.content);if(r!==null){c=operandText(r,1);continue}let i=M.exec(e.content);i===null?p(e.content)===`icon`?s=e.content.substring(4).trim():parsePresentationValue(t,e,u):l.push({kind:`ScreenNavigationParameterSyntax`,name:i[1],binding:y(t,i[2],e),location:b(e)})}let d=i[2]===`navigate`?`Navigate`:i[2]===`dialog`?`Dialog`:`Action`;return{kind:`ToolbarItemSyntax`,name:i[1],syntaxKind:d,target:i[3],label:a,icon:s,...r.subject===void 0?{}:{subject:r.subject},...c===void 0?{}:{confirm:c},parameters:l,presentation:u,location:b(n)}}function parseUiBindingValue(e,t,n){return v(e,t,b(n))}function parseCode(t,n){let r=n.content.startsWith("```")?n.content.substring(3):n.content;if(!t.languages.has(r)){t.error(e.ExpectedCodeFence,`Expected a registered language on the opening fence, not '${n.content}'`,b(n));return}n.content.startsWith("```")||t.warning(e.LegacyInlineCodeFence,`'${r}' on its own line is deprecated - use '\`\`\`${r}' instead`,b(n));let i=s(t,r,n);return i===null?void 0:{kind:`ScreenCodeSyntax`,code:{kind:`CodeBlockSyntax`,language:r,code:i,location:b(n)},location:b(n)}}export{parseScreen,parseToolbar};
|
|
2
2
|
//# sourceMappingURL=ScreenParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenParser.js","names":["operand","stringBodyPattern","header","pattern","data","action","label","guardedAction","navigate","route","outletPattern","contributionPattern","parameter","component","stableId","componentPropertyBinding","componentPropertyLiteral","componentPropertyBlock","exposes","presentation","confirmPattern","toolbarItem","toolbarButton","toolbarButtonPart","toolbarSlicePath","slot","title","column","rowClick","field","match","quotedGroup","unescapeString","firstWord","line","context","DiagnosticCodes","locationOf","directives","contributions","description","child","parsed","parseDescription","isFileDirective","directive","parent","collectInputUses","parseTypeRef","grammar","parseSubjectClause","content","result","guarded","parseGuardedAction","text","target","inputs","labelMatch","input","parsePlainActionInput","parameters","routeValue","outletValue","parameterMatch","parseFromClauseOn","routeMatch","outletMatch","name","blueprint","version","startsBlueprintReference","reference","parseBlueprintReference","isValidTemplateVersionRange","slots","columns","click","columnMatch","clickMatch","labelled","fields","dataContext","componentStableId","icon","properties","exposedValues","presentationValues","outlets","bound","literal","parseMappingSource","structured","parseStructuredValue","values","items","buttons","button","item","toolbarButtonExpected","head","id","rest","buttonTitle","slice","emphasis","valid","position","part","key","quoted","localized","value","authorize","buttonConfirm","parseAuthorize","confirmMatch","itemLabel","itemConfirm","syntaxKind","parseFromClause","language","code","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/ScreenParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarButtonSyntax, ToolbarEmphasis, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseAuthorize } from './AuthorizeParser';\nimport { parsePlainActionInput, parseSubjectClause } from './ActionSubjectClause';\nimport { InteractionArgumentSyntax } from '../Syntax/Screens';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { isValidTemplateVersionRange, parseBlueprintReference, startsBlueprintReference } from './TemplateReferenceText';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause, parseFromClauseOn } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseStructuredValue, StructuredMarker } from './StructuredBlockParser';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction bodies remain opaque in the AST, but 'on' alternatives\n// are checked for structure, condition operands and shadowing; 'uses' attachments are recognized.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst componentPropertyBlock = pattern('^property\\\\s+([\\\\w.]+)(?:\\\\s+(none|empty))?$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst confirmPattern = pattern(`^confirm\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst toolbarButton = pattern(`^button\\\\s+(?:\"(${stringBodyPattern})\"|([A-Za-z_][\\\\w-]*))(?:\\\\s+(.*))?$`);\nconst toolbarButtonPart = new RegExp(pattern(`\\\\s*(title|slice|emphasis|icon)\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*)|([A-Za-z_][\\\\w.-]*))(?=\\\\s|$)`).source, 'uy');\nconst toolbarSlicePath = pattern('^[A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n validateNonActionSubjectClause(context, line);\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n collectInputUses(context, line);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction validateNonActionSubjectClause(context: ParserContext, line: SourceLine): void {\n const grammar = new Map([['data', data], ['navigate', navigate], ['component', component], ['title', title]]).get(firstWord(line.content));\n // Expressions, code and open-ended template references belong to their own parsers.\n if (grammar !== undefined) parseSubjectClause(context, line, false, content => grammar.test(content));\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const parsed = parseSubjectClause(context, line, true, content => action.test(content) || guardedAction.test(content));\n const result = parseActionHeader(context, line, parsed);\n if (result === undefined || parsed.subject === undefined) return result;\n return { ...result, subject: parsed.subject };\n}\n\nfunction parseActionHeader(context: ParserContext, line: SourceLine, parsed: ReturnType<typeof parseSubjectClause>): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(parsed.header);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(parsed.header);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = parsed.label ?? null;\n let target: ScreenNavigateSyntax | null = null;\n const inputs: InteractionArgumentSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else if (firstWord(child.content) === 'with') {\n addPlainActionInput(context, child, inputs);\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, ...(inputs.length === 0 ? {} : { inputs }), location: locationOf(line) };\n}\n\nfunction addPlainActionInput(context: ParserContext, line: SourceLine, inputs: InteractionArgumentSyntax[]): void {\n const input = parsePlainActionInput(context, line, inputs);\n if (input !== undefined) inputs.push(input);\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClauseOn(context, parameterMatch[2], child), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n let name = line.content.substring('template'.length).trim();\n let blueprint: string | null = null;\n let version: string | null = null;\n if (startsBlueprintReference(name)) {\n const reference = parseBlueprintReference(name);\n if (reference === undefined) {\n context.error(DiagnosticCodes.UnknownLayoutDirective, `Invalid template reference '${line.content}' - expected 'template <Name>' or 'template blueprint <Blueprint> <Name> [version \"<range>\"]'`, locationOf(line));\n } else {\n ({ blueprint, name, version } = reference);\n if (version !== null && !isValidTemplateVersionRange(version)) {\n context.error(DiagnosticCodes.InvalidTemplateVersionRange, `The template version range '${version}' is not one Scene understands - use '*', an exact version or a ^, ~, >=, >, <= or < range such as \"^1.2\"`, locationOf(line));\n }\n }\n }\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, ...(blueprint === null ? {} : { blueprint }), ...(version === null ? {} : { version }), location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n collectInputUses(context, child);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n collectInputUses(context, child);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClauseOn(context, bound[2], line), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n const structured = componentPropertyBlock.exec(line.content);\n if (structured !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: structured[1], binding: null, value: parseStructuredValue(context, line, structured[2] as StructuredMarker), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>', 'property <path> = <literal>', or 'property <path>' with the object or list as an indented block`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClauseOn(context, match[2], line), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nexport function parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n const buttons: ToolbarButtonSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'button') {\n const button = parseToolbarButton(context, child);\n if (button !== undefined) buttons.push(button);\n continue;\n }\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, ...(buttons.length > 0 ? { buttons } : {}), location: locationOf(line) };\n}\n\nconst toolbarButtonExpected = 'button <id> title \"<text>\" [slice <Module>.<Feature>.<Slice>] [emphasis primary|secondary|quiet] [icon <name>]';\n\n// A button is one line; the C# compiler checks what it names (PLAY0761-PLAY0765), this one reads its grammar.\nfunction parseToolbarButton(context: ParserContext, line: SourceLine): ToolbarButtonSyntax | undefined {\n const head = toolbarButton.exec(line.content);\n if (head === null) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid toolbar button '${line.content}' - expected ${toolbarButtonExpected}`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const id = head[1] !== undefined ? unescapeString(head[1]) : head[2];\n const rest = head[3] ?? '';\n let buttonTitle: string | undefined;\n let slice: string | undefined;\n let icon: string | undefined;\n let emphasis: ToolbarEmphasis | undefined;\n let valid = true;\n let position = 0;\n while (position < rest.length) {\n toolbarButtonPart.lastIndex = position;\n const part = toolbarButtonPart.exec(rest);\n if (part === null) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid toolbar button '${line.content}' - unexpected '${rest.substring(position).trim()}'; expected ${toolbarButtonExpected}`, locationOf(line));\n valid = false;\n break;\n }\n position = part.index + part[0].length;\n const key = part[1];\n const quoted = part[2] !== undefined;\n const localized = part[3] !== undefined;\n const value = quoted ? unescapeString(part[2]) : localized ? part[3] : part[4];\n const repeated = key === 'title' ? buttonTitle !== undefined : key === 'slice' ? slice !== undefined : key === 'icon' ? icon !== undefined : emphasis !== undefined;\n if (repeated) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Toolbar button '${id}' states '${key}' more than once`, locationOf(line));\n continue;\n }\n if (key === 'title') {\n if (quoted || localized) buttonTitle = value;\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid title '${value}' on toolbar button '${id}' - expected a quoted string or a $strings.<key> token`, locationOf(line));\n valid = false;\n }\n } else if (key === 'slice') {\n if (!quoted && !localized && toolbarSlicePath.test(value)) slice = value;\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid slice '${value}' on toolbar button '${id}' - expected <Module>.<Feature>.<Slice>`, locationOf(line));\n valid = false;\n }\n } else if (key === 'emphasis') {\n if (!quoted && !localized && ['primary', 'secondary', 'quiet'].includes(value)) emphasis = value === 'primary' ? 'Primary' : value === 'secondary' ? 'Secondary' : 'Quiet';\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid emphasis '${value}' on toolbar button '${id}' - expected primary, secondary or quiet`, locationOf(line));\n valid = false;\n }\n } else {\n icon = value;\n }\n }\n if (buttonTitle === undefined && valid) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Toolbar button '${id}' has no title - expected 'button ${id} title \"<text>\"'`, locationOf(line));\n }\n let authorize: AuthorizeSyntax | null = null;\n let buttonConfirm: string | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'authorize' && authorize === null) {\n authorize = parseAuthorize(context, child);\n continue;\n }\n const confirmMatch = buttonConfirm === undefined ? confirmPattern.exec(child.content) : null;\n if (confirmMatch !== null) {\n buttonConfirm = operandText(confirmMatch, 1);\n continue;\n }\n context.error(DiagnosticCodes.InvalidToolbarButton, `Unexpected '${child.content}' under toolbar button '${id}' - a button takes one 'authorize' line, one 'confirm' line and nothing else`, locationOf(child));\n context.skipBlock(child.indent);\n }\n return {\n kind: 'ToolbarButtonSyntax', id, title: buttonTitle ?? '',\n ...(slice !== undefined ? { slice } : {}), ...(emphasis !== undefined ? { emphasis } : {}), ...(icon !== undefined ? { icon } : {}), ...(authorize !== null ? { authorize } : {}), ...(buttonConfirm !== undefined ? { confirm: buttonConfirm } : {}),\n location: locationOf(line),\n };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const parsed = parseSubjectClause(context, line, /^item\\s+\\S+\\s+action\\s/u.test(line.content), content => toolbarItem.test(content));\n const match = toolbarItem.exec(parsed.header);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>', 'item <name> dialog <DialogTemplate>' or 'button <id> title \"<text>\" slice <Slice>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel: string | null = parsed.label ?? null;\n let icon = null;\n let itemConfirm: string | undefined;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const confirmMatch = confirmPattern.exec(child.content);\n if (confirmMatch !== null) {\n itemConfirm = operandText(confirmMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClauseOn(context, parameterMatch[2], child), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, ...(parsed.subject === undefined ? {} : { subject: parsed.subject }), ...(itemConfirm !== undefined ? { confirm: itemConfirm } : {}), parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n"],"mappings":"2nCAmCA,MAAMA,EAAU,QAAQC,EAAkB,qCACpCC,EAASC,EAAQ,6BAA6B,EAC9CC,EAAOD,EAAQ,2FAA2F,EAC1GE,EAASF,EAA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,"file":"ScreenParser.js","names":["operand","stringBodyPattern","header","pattern","data","action","label","guardedAction","navigate","route","outletPattern","contributionPattern","parameter","component","stableId","componentPropertyBinding","componentPropertyLiteral","componentPropertyBlock","exposes","presentation","confirmPattern","toolbarItem","toolbarButton","toolbarButtonPart","toolbarSlicePath","slot","title","column","rowClick","field","match","quotedGroup","unescapeString","firstWord","line","context","DiagnosticCodes","locationOf","directives","contributions","description","child","parsed","parseDescription","isFileDirective","directive","parent","collectInputUses","parseTypeRef","grammar","parseSubjectClause","content","result","guarded","parseGuardedAction","text","target","inputs","labelMatch","input","parsePlainActionInput","parameters","routeValue","outletValue","parameterMatch","parseFromClauseOn","routeMatch","outletMatch","name","blueprint","version","startsBlueprintReference","reference","parseBlueprintReference","isValidTemplateVersionRange","slots","columns","click","columnMatch","clickMatch","labelled","fields","dataContext","componentStableId","icon","properties","exposedValues","presentationValues","outlets","bound","literal","parseMappingSource","structured","parseStructuredValue","values","items","buttons","button","item","toolbarButtonExpected","head","id","rest","buttonTitle","slice","emphasis","valid","position","part","key","quoted","localized","value","authorize","buttonConfirm","parseAuthorize","confirmMatch","itemLabel","itemConfirm","syntaxKind","parseFromClause","language","code","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/ScreenParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarButtonSyntax, ToolbarEmphasis, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseAuthorize } from './AuthorizeParser';\nimport { parsePlainActionInput, parseSubjectClause } from './ActionSubjectClause';\nimport { InteractionArgumentSyntax } from '../Syntax/Screens';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { isValidTemplateVersionRange, parseBlueprintReference, startsBlueprintReference } from './TemplateReferenceText';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause, parseFromClauseOn } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseStructuredValue, StructuredMarker } from './StructuredBlockParser';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction bodies remain opaque in the AST, but 'on' alternatives\n// are checked for structure, condition operands and shadowing; 'uses' attachments are recognized.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst componentPropertyBlock = pattern('^property\\\\s+([\\\\w.]+)(?:\\\\s+(none|empty))?$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst confirmPattern = pattern(`^confirm\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst toolbarButton = pattern(`^button\\\\s+(?:\"(${stringBodyPattern})\"|([A-Za-z_][\\\\w-]*))(?:\\\\s+(.*))?$`);\nconst toolbarButtonPart = new RegExp(pattern(`\\\\s*(title|slice|emphasis|icon)\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*)|([A-Za-z_][\\\\w.-]*))(?=\\\\s|$)`).source, 'uy');\nconst toolbarSlicePath = pattern('^[A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n validateNonActionSubjectClause(context, line);\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n collectInputUses(context, line);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction validateNonActionSubjectClause(context: ParserContext, line: SourceLine): void {\n const grammar = new Map([['data', data], ['navigate', navigate], ['component', component], ['title', title]]).get(firstWord(line.content));\n // Expressions, code and open-ended template references belong to their own parsers.\n if (grammar !== undefined) parseSubjectClause(context, line, false, content => grammar.test(content));\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const parsed = parseSubjectClause(context, line, true, content => action.test(content) || guardedAction.test(content));\n const result = parseActionHeader(context, line, parsed);\n if (result === undefined || parsed.subject === undefined) return result;\n return { ...result, subject: parsed.subject };\n}\n\nfunction parseActionHeader(context: ParserContext, line: SourceLine, parsed: ReturnType<typeof parseSubjectClause>): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(parsed.header);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(parsed.header);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = parsed.label ?? null;\n let target: ScreenNavigateSyntax | null = null;\n const inputs: InteractionArgumentSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else if (firstWord(child.content) === 'with') {\n addPlainActionInput(context, child, inputs);\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, ...(inputs.length === 0 ? {} : { inputs }), location: locationOf(line) };\n}\n\nfunction addPlainActionInput(context: ParserContext, line: SourceLine, inputs: InteractionArgumentSyntax[]): void {\n const input = parsePlainActionInput(context, line, inputs);\n if (input !== undefined) inputs.push(input);\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClauseOn(context, parameterMatch[2], child), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n let name = line.content.substring('template'.length).trim();\n let blueprint: string | null = null;\n let version: string | null = null;\n if (startsBlueprintReference(name)) {\n const reference = parseBlueprintReference(name);\n if (reference === undefined) {\n context.error(DiagnosticCodes.UnknownLayoutDirective, `Invalid template reference '${line.content}' - expected 'template <Name>' or 'template blueprint <Blueprint> <Name> [version \"<range>\"]'`, locationOf(line));\n } else {\n ({ blueprint, name, version } = reference);\n if (version !== null && !isValidTemplateVersionRange(version)) {\n context.error(DiagnosticCodes.InvalidTemplateVersionRange, `The template version range '${version}' is not one Scene understands - use '*', an exact version or a ^, ~, >=, >, <= or < range such as \"^1.2\"`, locationOf(line));\n }\n }\n }\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, ...(blueprint === null ? {} : { blueprint }), ...(version === null ? {} : { version }), location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n collectInputUses(context, child);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n collectInputUses(context, child);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClauseOn(context, bound[2], line), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n const structured = componentPropertyBlock.exec(line.content);\n if (structured !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: structured[1], binding: null, value: parseStructuredValue(context, line, structured[2] as StructuredMarker), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>', 'property <path> = <literal>', or 'property <path>' with the object or list as an indented block`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClauseOn(context, match[2], line), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nexport function parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n const buttons: ToolbarButtonSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'button') {\n const button = parseToolbarButton(context, child);\n if (button !== undefined) buttons.push(button);\n continue;\n }\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, ...(buttons.length > 0 ? { buttons } : {}), location: locationOf(line) };\n}\n\nconst toolbarButtonExpected = 'button <id> title \"<text>\" [slice <Module>.<Feature>.<Slice>] [emphasis primary|secondary|quiet] [icon <name>]';\n\n// A button is one line; the C# compiler checks what it names (PLAY0761-PLAY0765), this one reads its grammar.\nfunction parseToolbarButton(context: ParserContext, line: SourceLine): ToolbarButtonSyntax | undefined {\n const head = toolbarButton.exec(line.content);\n if (head === null) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid toolbar button '${line.content}' - expected ${toolbarButtonExpected}`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const id = head[1] !== undefined ? unescapeString(head[1]) : head[2];\n const rest = head[3] ?? '';\n let buttonTitle: string | undefined;\n let slice: string | undefined;\n let icon: string | undefined;\n let emphasis: ToolbarEmphasis | undefined;\n let valid = true;\n let position = 0;\n while (position < rest.length) {\n toolbarButtonPart.lastIndex = position;\n const part = toolbarButtonPart.exec(rest);\n if (part === null) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid toolbar button '${line.content}' - unexpected '${rest.substring(position).trim()}'; expected ${toolbarButtonExpected}`, locationOf(line));\n valid = false;\n break;\n }\n position = part.index + part[0].length;\n const key = part[1];\n const quoted = part[2] !== undefined;\n const localized = part[3] !== undefined;\n const value = quoted ? unescapeString(part[2]) : localized ? part[3] : part[4];\n const repeated = key === 'title' ? buttonTitle !== undefined : key === 'slice' ? slice !== undefined : key === 'icon' ? icon !== undefined : emphasis !== undefined;\n if (repeated) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Toolbar button '${id}' states '${key}' more than once`, locationOf(line));\n continue;\n }\n if (key === 'title') {\n if (quoted || localized) buttonTitle = value;\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid title '${value}' on toolbar button '${id}' - expected a quoted string or a $strings.<key> token`, locationOf(line));\n valid = false;\n }\n } else if (key === 'slice') {\n if (!quoted && !localized && toolbarSlicePath.test(value)) slice = value;\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid slice '${value}' on toolbar button '${id}' - expected <Module>.<Feature>.<Slice>`, locationOf(line));\n valid = false;\n }\n } else if (key === 'emphasis') {\n if (!quoted && !localized && ['primary', 'secondary', 'quiet'].includes(value)) emphasis = value === 'primary' ? 'Primary' : value === 'secondary' ? 'Secondary' : 'Quiet';\n else {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Invalid emphasis '${value}' on toolbar button '${id}' - expected primary, secondary or quiet`, locationOf(line));\n valid = false;\n }\n } else {\n icon = value;\n }\n }\n if (buttonTitle === undefined && valid) {\n context.error(DiagnosticCodes.InvalidToolbarButton, `Toolbar button '${id}' has no title - expected 'button ${id} title \"<text>\"'`, locationOf(line));\n }\n let authorize: AuthorizeSyntax | null = null;\n let buttonConfirm: string | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'authorize' && authorize === null) {\n authorize = parseAuthorize(context, child);\n continue;\n }\n const confirmMatch = buttonConfirm === undefined ? confirmPattern.exec(child.content) : null;\n if (confirmMatch !== null) {\n buttonConfirm = operandText(confirmMatch, 1);\n continue;\n }\n context.error(DiagnosticCodes.InvalidToolbarButton, `Unexpected '${child.content}' under toolbar button '${id}' - a button takes one 'authorize' line, one 'confirm' line and nothing else`, locationOf(child));\n context.skipBlock(child.indent);\n }\n return {\n kind: 'ToolbarButtonSyntax', id, title: buttonTitle ?? '',\n ...(slice !== undefined ? { slice } : {}), ...(emphasis !== undefined ? { emphasis } : {}), ...(icon !== undefined ? { icon } : {}), ...(authorize !== null ? { authorize } : {}), ...(buttonConfirm !== undefined ? { confirm: buttonConfirm } : {}),\n location: locationOf(line),\n };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const parsed = parseSubjectClause(context, line, /^item\\s+\\S+\\s+action\\s/u.test(line.content), content => toolbarItem.test(content));\n const match = toolbarItem.exec(parsed.header);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>', 'item <name> dialog <DialogTemplate>' or 'button <id> title \"<text>\" slice <Slice>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel: string | null = parsed.label ?? null;\n let icon = null;\n let itemConfirm: string | undefined;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const confirmMatch = confirmPattern.exec(child.content);\n if (confirmMatch !== null) {\n itemConfirm = operandText(confirmMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClauseOn(context, parameterMatch[2], child), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, ...(parsed.subject === undefined ? {} : { subject: parsed.subject }), ...(itemConfirm !== undefined ? { confirm: itemConfirm } : {}), parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n"],"mappings":"A,2nCAmCA,MAAMA,EAAU,QAAQC,EAAkB,qCACpCC,EAASC,EAAQ,6BAA6B,EAC9CC,EAAOD,EAAQ,2FAA2F,EAC1GE,EAASF,EAAQ,yCAAyC,EAC1DG,EAAQH,EAAQ,aAAaH,EAAQ,EAAE,EACvCO,EAAgBJ,EAAQ,cAAcH,EAAQ,EAAE,EAChDQ,EAAWL,EAAQ,6DAA6D,EAChFM,EAAQN,EAAQ,aAAaH,EAAQ,EAAE,EACvCU,EAAgBP,EAAQ,6BAA6B,EACrDQ,EAAsBR,EAAQ,iEAAiE,EAC/FS,EAAYT,EAAQ,gDAAgD,EACpEU,EAAYV,EAAQ,wEAAwE,EAC5FW,EAAWX,EAAQ,eAAeF,EAAkB,YAAY,EAChEc,EAA2BZ,EAAQ,yCAAyC,EAC5Ea,EAA2Bb,EAAQ,sCAAsC,EACzEc,EAAyBd,EAAQ,8CAA8C,EAC/Ee,EAAUf,EAAQ,8CAA8C,EAChEgB,EAAehB,EAAQ,uCAAuCH,EAAQ,EAAE,EACxEoB,EAAiBjB,EAAQ,eAAeH,EAAQ,EAAE,EAClDqB,EAAclB,EAAQ,iGAAiG,EACvHmB,EAAgBnB,EAAQ,mBAAmBF,EAAkB,qCAAqC,EAClGsB,EAAoB,IAAI,OAAOpB,EAAQ,2CAA2CF,EAAkB,iEAAiE,CAAC,CAAC,OAAQ,IAAI,EACnLuB,EAAmBrB,EA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Q,EAAG,CAClCtF,EAAQ,MAAMC,EAAgB,kBAAmB,6DAA6DF,EAAK,QAAQ,GAAIG,EAAWH,CAAI,CAAC,EAC/I,MACJ,CACKA,EAAK,QAAQ,WAAW,KAAK,GAC9BC,EAAQ,QAAQC,EAAgB,sBAAuB,IAAIqF,EAAS,+CAA+CA,EAAS,WAAYpF,EAAWH,CAAI,CAAC,EAE5J,IAAMwF,EAAOC,EAAgBxF,EAASsF,EAAUvF,CAAI,EACpD,OAAOwF,IAAS,KAAO,IAAA,GAAY,CAC/B,KAAM,mBACN,KAAM,CAAE,KAAM,kBAAmB,WAAU,OAAM,SAAUrF,EAAWH,CAAI,CAAE,EAC5E,SAAUG,EAAWH,CAAI,CAC7B,CACJ,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{pattern as r}from"../Text/patterns.js";import{locationOf as i,startOf as a}from"./SourceLine.js";import{parseComplianceDirective as o,parseComplianceMarkers as s}from"./ConceptComplianceParser.js";import{firstWord as c,unescapeIdentifier as l}from"./LineText.js";import{describePlacement as u,documentPlacement as d,isDocumentPlacement as f}from"../Files/PlayPlacement.js";import{parseDescription as p}from"./DescriptionParser.js";import{parsePurpose as m}from"./PurposeParser.js";import{isFileImport as h,parseFileImport as g}from"./FileImportParser.js";import{recordAuthoredDocument as _}from"../Syntax/SourceOptions.js";import{collectInputUses as v}from"./InputUses.js";import{misplacedReactionIdentity as y}from"./ReactionIdentityParser.js";import{parseCanvasPair as b}from"./CanvasPlacement.js";import{parseEventSource as ee}from"./EventSourceParser.js";import{isFileDirective as x}from"./FileReferences.js";import{isBlankPublicEventOrigin as te}from"../Syntax/PublicEventInvariants.js";import{parseType as ne}from"./DeclarationParsers.js";import{parseSystem as re}from"./OperationParser.js";import{parseExample as ie}from"./SpecificationExampleParser.js";import{parseValidate as S}from"./CommandParser.js";import{parseTriggerDeclaration as ae}from"./TriggerDataParser.js";import{FeatureBody as C,featureBodyExpected as w}from"./FeatureBody.js";import{ModuleBody as oe,moduleBodyExpected as T,modulePattern as E,parseModule as D}from"./ModuleBody.js";import{EnumerationMembers as O}from"./EnumerationMembers.js";import{parseGeneration as k}from"./GenerationParser.js";import{parseIdentity as se}from"./IdentityParser.js";import{parseApplicationContext as ce}from"./ApplicationContextParser.js";import{parsePolicy as le}from"./PolicyParser.js";import{parseSeed as ue}from"./SeedParser.js";import{parseStateMachine as de}from"./StateMachineParser.js";import{parseWorkflow as fe}from"./WorkflowParser.js";import{parseExposure as A,parseInstance as j}from"./CompositionParser.js";import{parseUiProfile as M}from"./UiProfileLegacyLayout.js";const N=r(`^domain\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),pe=r(`^time\\s+zone\\s+(configurable\\s+default\\s+)?"(${t})"$`),P=r(`^import\\s+([\\w.]+)(?:\\s+from\\s+"(?<origin>${t})")?$`),F=r(`^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@?\\w+)*)$`),I=r(`^@?[a-z_]\\w*$`),L=r(`^persona\\s+([A-Za-z_]\\w*)$`),R=r(`^policy\\s+([A-Za-z_]\\w*)$`),z=r(`^goal\\s+"(${t})"$`),B=r(`^sticky\\s+note\\s+on\\s+(personas|eventsources|givencontexts|seeddata)$`),V=r(`^colour\\s+(yellow|pink|green|blue)$`),H=/^[ ]*\t/,U=[`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`],W=/* @__PURE__ */ new Set([`policy`,`authentication`,`onboarding`,`seed`,`ui`,`theme`,`trigger`,`layout`,`behavior`,`sample`]),G=/* @__PURE__ */ new Set([`slice`,`feature`,`description`,`documentation`,`authorize`,`screen`,`dialog`,`form`,`contribute`,`on`,`uses`]);function parseApplication(t,r,a=d){t.deferIdentityValidation=!0,warnOnTabIndentation(t,r);let o=a.length===1?new oe(a[0]):void 0,s=a.length>1?new C(a[a.length-1]):void 0,l=o??s,u=null,p=null,b=null,x=!1,S=null,w=null,T=!1,E=!1,O=null,k=[],N=[],F=[],I=[],L=[],R=[],z=[],B=[],V=[],H=[],U=[],G=[],K=[],q=[],J=[],Y=[],X=[],Z=[],Q=!1;for(let r=t.reader.peekSignificant();r!==void 0;r=t.reader.peekSignificant()){t.reader.takeSignificant();let s=c(r.content);if(s===`command`&&/^command\s+reads(?:\s|$)/.test(r.content))E||!f(a)||!/^command\s+reads\s+protected$/.test(r.content)?t.error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,i(r)):S=`Protected`,E=!0;else if(s===`time`&&/^time\s+zone(?:\s|$)/.test(r.content)){let o=pe.exec(r.content);t.skipBlock(r.indent),T||!f(a)||o===null?t.error(e.InvalidTimeZoneDeclaration,`Declare 'time zone "<id>"' or 'time zone configurable default "<id>"' once at the application root.`,i(r)):w={kind:`TimeZoneSyntax`,id:n(o[2]),configurable:o[1]!==void 0,location:i(r)},T=!0}else if(s===`reaction`)x||!f(a)||!/^reaction\s+batches\s+atomic$/.test(r.content)?t.error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,i(r)):b=`Atomic`,x=!0;else if(s===`runs`)y(t,r);else if(s===`domain`)t.authoredDeclarations=!0,O=parseDomain(t,r,O,Q);else if(Q||=declaresConstruct(s,r,a),t.authoredDeclarations||=s!==`import`&&declaresConstruct(s,r,a),s===`import`&&h(r.content))l===void 0?g(t,r,N):l.tryParse(t,r);else if(s===`import`){let a=P.exec(r.content);if(a===null)t.error(e.InvalidImportDeclaration,`Invalid import '${r.content}' - expected 'import <Qualified.Name> [from "<origin>"]'`,i(r));else{let o=a.groups?.origin===void 0?null:n(a.groups.origin);o!==null&&te(o)&&t.error(e.InvalidImportDeclaration,`An import origin must be a nonblank quoted string`,i(r)),k.push({kind:`ImportSyntax`,qualifiedName:a[1],origin:o,visibility:o===null?`Private`:`Public`,location:i(r)})}}else if(s===`example`)l===void 0?J.push(ie(t,r)):l.tryParse(t,r);else if(s===`eventsource`)B.push(ee(t,r));else if(s===`system`)L.push(re(t,r));else if(s===`statemachine`)R.push(de(t,r));else if(s===`workflow`)z.push(fe(t,r));else if(s===`concept`)F.push(parseConcept(t,r));else if(s===`type`)I.push(ne(t,r));else if(s===`module`&&!f(a))parseModuleInPlacedFile(t,r,a,o);else if(s===`module`)V.push(D(t,r));else if(s===`persona`)H.push(parsePersona(t,r));else if(s===`sticky`){let e=parseStickyNote(t,r);e!==null&&U.push(e)}else if(s===`seed`)q.push(ue(t.valueContext,r));else if(s===`purpose`&&l!==void 0)l.tryParse(t,r);else if(s===`purpose`)K.push(m(t,r));else if(s===`context`)p=ce(t,r,p,a);else if(s===`identity`)u=se(t,r,u);else if(s===`policy`){let n=le(t,r);G.some(e=>e.name===n.name)&&t.error(e.DuplicateDeclaration,`Duplicate declaration of policy '${n.name}' - policy names must be unique`,n.location),G.push(n)}else if(s===`exposure`)X.push(A(t,r));else if(s===`instance`)Z.push(j(t,r));else if(s===`trigger`){let e=ae(t,r),n=/^trigger\s+([A-Za-z_]\w*)$/.exec(r.content)?.[1];n!==void 0&&Y.push({name:n,data:e})}else W.has(s)?s===`behavior`||s===`layout`?v(t,r):s===`ui`?M(t,r):t.skipOpaqueBlock(r.indent):l?.tryParse(t,r)!==!0&&reportUnexpectedTopLevel(t,r,a)}o===void 0?s!==void 0&&V.unshift(place(a,s.build(t.start,!0),t.start)):V.unshift(o.build(t.start,!0));let $={kind:`ApplicationSyntax`,...S===null?{}:{commandReadMode:S},...w===null?{}:{timeZone:w},...p===null?{}:{context:p},...b===null?{}:{reactionProductionMode:b},...u===null?{}:{identity:u},sourceOptions:t.sourceOptions,domain:O,imports:k,concepts:F,types:I,systems:L,...R.length>0?{stateMachines:R}:{},...z.length>0?{workflows:z}:{},eventSources:B,examples:J,modules:V,personas:H,policies:G,purposes:K,seeds:q,declaredTriggers:Y,fileImports:N,...X.length>0?{exposures:X}:{},...U.length>0?{stickyNotes:U}:{},...Z.length>0?{instanceContributions:Z}:{},location:t.start};return t.authoredDeclarations&&_($),$}function declaresConstruct(e,t,n){return e===`import`?P.test(t.content):e===`module`?f(n):e===`identity`?t.content===`identity`:e===`context`?t.content===`context`:e===`purpose`||e===`example`||e===`exposure`||e===`instance`||e===`eventsource`||e===`system`||e===`statemachine`||e===`workflow`||e===`concept`||e===`type`||e===`persona`||e===`sticky`||W.has(e)}function parseModuleInPlacedFile(t,n,r,a){let o=E.exec(n.content)?.[1]??``;a!==void 0&&o===r[0]?(t.authoredDeclarations=!0,a.parseChildren(t,n)):(t.error(e.ModuleInPlacedFile,`This file is imported into ${u(r)}, so it cannot declare module '${o}' - import it at the top level of a document instead`,i(n)),t.skipBlock(n.indent))}function reportUnexpectedTopLevel(t,n,r){let a=c(n.content);if(f(r)){let r=G.has(a)?` - '${a}' belongs in a module or feature; wrap it in one, or import this file from inside one`:` - expected domain, import, concept, type, policy, persona, sticky note, authentication, onboarding, identity, context, module, seed, trigger, behavior, ui profile, theme, sample data or layout`;t.error(e.UnknownTopLevelConstruct,`Unexpected '${a}' at the top level${r}`,i(n))}else{let o=r.length===1?T:w;t.error(e.UnexpectedInPlacedFile,`Unexpected '${a}' in a file imported into ${u(r)} - expected an application declaration or ${o}`,i(n))}t.skipBlock(n.indent)}function place(e,t,n){let r=t;for(let t=e.length-2;t>=1;t--)r={kind:`FeatureSyntax`,name:e[t],description:null,authorize:null,features:[r],slices:[],fileImports:[],isPlacement:!0,location:n};return{kind:`ModuleSyntax`,name:e[0],description:null,authorize:null,features:[r],fileImports:[],isPlacement:!0,location:n}}function parseDomain(t,n,r,a){let o=N.exec(n.content);return o===null?(t.error(e.InvalidDomainDeclaration,`Invalid domain declaration '${n.content}' - expected 'domain <Qualified.Name>'`,i(n)),r):r===null?(a&&t.error(e.DomainNotFirst,`'domain' must be declared before any other construct`,i(n)),{kind:`DomainSyntax`,name:o[1],location:i(n)}):(t.error(e.DuplicateDomain,`The document already declares a domain - a document can have at most one`,i(n)),r)}function warnOnTabIndentation(t,n){let r=!1;for(let i of n)i.raw.trimStart().startsWith("```")?r=!r:!r&&H.test(i.raw)&&t.warning(e.TabIndentation,`Screenplay is indentation based - use spaces, not tabs`,a(i))}function parseConcept(t,n){let r=F.exec(n.content);if(r===null)return t.error(e.InvalidConceptDeclaration,`Invalid concept declaration '${n.content}' - expected 'concept <Name> : <Type>'`,i(n)),t.skipBlock(n.indent),{kind:`ConceptSyntax`,name:c(n.content),type:``,attributes:[],values:[],location:i(n)};let[,a,u,d]=r,f=s(t,n,a,d);u!==`Enum`&&!U.includes(u)&&t.error(e.UnknownPrimitiveType,`Unknown primitive type '${u}' - expected ${U.join(`, `)} or Enum`,i(n));let m=[],h=new O,g=null,_=!1,v=null,y=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=u===`Enum`?h.tryNumbered(t,r):void 0;if(n!==void 0)m.push(n);else if(c(r.content)===`description`&&(u!==`Enum`||r.content!==`description`||t.peekChild(r.indent)?.content.startsWith("```")===!0))v=p(t,r,v,`Concept '${a}'`);else if(x(r))continue;else if(c(r.content)===`validate`){u===`Enum`&&r.content===`validate`&&t.peekChild(r.indent)===void 0&&t.warning(e.ValidateReadAsEnumerationBlock,`'validate' in enumeration concept '${a}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,i(r));let n=S(t,r,`concept`,a);n!==void 0&&y.push(n)}else if(c(r.content)===`generate`&&(u!==`Enum`||r.content!==`generate`)){_&&t.error(e.DuplicateGeneration,`Concept '${a}' declares generation more than once.`,i(r));let n=k(t,r,u);_||(g=n),_=!0}else o(t,r,a,f)||(u===`Enum`&&I.test(r.content)?m.push(l(r.content)):u===`Enum`?t.error(e.InvalidEnumerationValue,`Invalid enum value '${r.content}' - expected an identifier`,i(r)):(t.error(e.UnknownConceptDirective,`Unexpected '${r.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason "<text>"'`,i(r)),t.skipBlock(r.indent)))}let b=h.finish(t,n,m.length);return{kind:`ConceptSyntax`,name:a,type:u,attributes:f,values:m,validations:y,description:v,...g===null?{}:{generation:g},...b===void 0?{}:{valueNumbers:b},location:i(n)}}function parsePersona(t,r){let a=L.exec(r.content)?.[1]??``;a===``&&t.error(e.InvalidPersonaDeclaration,`Invalid persona declaration '${r.content}' - expected 'persona <Name>'`,i(r));let o=null,s=[],l=[],u=null,d=null;for(let f=t.peekChild(r.indent);f!==void 0;f=t.peekChild(r.indent)){t.reader.takeSignificant();let r=c(f.content);if(r===`description`)o=p(t,f,o,`Persona '${a}'`);else if(r===`goal`){let r=z.exec(f.content);r===null?t.error(e.InvalidPersonaDeclaration,`Invalid goal '${f.content}' - expected 'goal "<text>"'`,i(f)):l.push(n(r[1]))}else if(r===`position`)u=b(t,f,`position`,`x`,`y`,u,!0)??u;else if(r===`size`)d=b(t,f,`size`,`width`,`height`,d,!1)??d;else if(r===`policy`){let n=R.exec(f.content);n===null?t.error(e.InvalidPersonaPolicyReference,`Invalid policy reference '${f.content}' - expected 'policy <Name>'`,i(f)):s.push(n[1])}else t.error(e.UnknownPersonaDirective,`Unexpected '${r}' in persona body - expected description, goal, policy, position or size`,i(f)),t.skipBlock(f.indent)}return{kind:`PersonaSyntax`,name:a,description:o,policies:s,...l.length>0?{goals:l}:{},...u===null?{}:{x:u[0],y:u[1]},...d===null?{}:{width:d[0],height:d[1]},location:i(r)}}function parseStickyNote(t,n){let r=B.exec(n.content);if(r===null)return t.error(e.InvalidPersonaDeclaration,`Invalid sticky note declaration '${n.content}' - expected 'sticky note on personas', 'sticky note on eventsources', 'sticky note on givencontexts' or 'sticky note on seeddata'`,i(n)),t.skipBlock(n.indent),null;let a=null,o=null,s=null,l=null;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=c(r.content);if(n===`description`)a=p(t,r,a,`A sticky note`);else if(n===`colour`){let n=V.exec(r.content);n===null?t.error(e.InvalidPersonaDeclaration,`Invalid colour '${r.content}' - expected 'colour yellow', 'colour pink', 'colour green' or 'colour blue'`,i(r)):o=n[1]}else n===`position`?s=b(t,r,`position`,`x`,`y`,s,!0)??s:n===`size`?l=b(t,r,`size`,`width`,`height`,l,!1)??l:(t.error(e.UnknownPersonaDirective,`Unexpected '${n}' in sticky note body - expected description, colour, position or size`,i(r)),t.skipBlock(r.indent))}return a===null||s===null?(t.error(e.InvalidPersonaDeclaration,`A sticky note needs a description (the text on it) and a position`,i(n)),null):{kind:`StickyNoteSyntax`,canvas:r[1],text:a,colour:o,x:s[0],y:s[1],width:l===null?null:l[0],height:l===null?null:l[1],location:i(n)}}export{parseApplication};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{EnumerationMembers as e}from"./EnumerationMembers.js";import{parseGeneration as t}from"./GenerationParser.js";import{parseIdentity as n}from"./IdentityParser.js";import{parseApplicationContext as r}from"./ApplicationContextParser.js";import{misplacedReactionIdentity as i}from"./ReactionIdentityParser.js";import{DiagnosticCodes as a}from"../Diagnostics/DiagnosticCodes.js";import{recordAuthoredDocument as o}from"../Syntax/SourceOptions.js";import{describePlacement as s,documentPlacement as c,isDocumentPlacement as l}from"../Files/PlayPlacement.js";import{parseTriggerDeclaration as u}from"./TriggerDataParser.js";import{pattern as d}from"../Text/patterns.js";import{parseComplianceDirective as f,parseComplianceMarkers as p}from"./ConceptComplianceParser.js";import{parseType as m}from"./DeclarationParsers.js";import{parseValidate as h}from"./CommandParser.js";import{parseDescription as g}from"./DescriptionParser.js";import{FeatureBody as _,featureBodyExpected as v}from"./FeatureBody.js";import{isFileImport as y,parseFileImport as b}from"./FileImportParser.js";import{isFileDirective as x}from"./FileReferences.js";import{collectInputUses as ee}from"./InputUses.js";import{firstWord as S,unescapeIdentifier as C}from"./LineText.js";import{ModuleBody as te,moduleBodyExpected as w,modulePattern as T,parseModule as ne}from"./ModuleBody.js";import{parsePolicy as re}from"./PolicyParser.js";import{parsePurpose as E}from"./PurposeParser.js";import{parseSeed as D}from"./SeedParser.js";import{parseSystem as ie}from"./OperationParser.js";import{parseStateMachine as ae}from"./StateMachineParser.js";import{parseWorkflow as oe}from"./WorkflowParser.js";import{isBlankPublicEventOrigin as se}from"../Syntax/PublicEventInvariants.js";import{stringBodyPattern as O,unescapeString as k}from"../Text/StringLiteral.js";import{parseCanvasPair as A}from"./CanvasPlacement.js";import{parseEventSource as ce}from"./EventSourceParser.js";import{parseExposure as le,parseInstance as ue}from"./CompositionParser.js";import{parseExample as de}from"./SpecificationExampleParser.js";import{parseUiProfile as fe}from"./UiProfileLegacyLayout.js";import{locationOf as j,startOf as M}from"./SourceLine.js";const N=d(`^domain\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)$`),pe=d(`^time\\s+zone\\s+(configurable\\s+default\\s+)?"(${O})"$`),P=d(`^import\\s+([\\w.]+)(?:\\s+from\\s+"(?<origin>${O})")?$`),F=d(`^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@?\\w+)*)$`),I=d(`^@?[a-z_]\\w*$`),L=d(`^persona\\s+([A-Za-z_]\\w*)$`),R=d(`^policy\\s+([A-Za-z_]\\w*)$`),z=d(`^goal\\s+"(${O})"$`),B=d(`^sticky\\s+note\\s+on\\s+(personas|eventsources|givencontexts|seeddata)$`),V=d(`^colour\\s+(yellow|pink|green|blue)$`),H=/^[ ]*\t/,U=[`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`],W=/* @__PURE__ */ new Set([`policy`,`authentication`,`onboarding`,`seed`,`ui`,`theme`,`trigger`,`layout`,`behavior`,`sample`]),G=/* @__PURE__ */ new Set([`slice`,`feature`,`description`,`documentation`,`authorize`,`screen`,`dialog`,`form`,`contribute`,`on`,`uses`]);function parseApplication(e,t,s=c){e.deferIdentityValidation=!0,warnOnTabIndentation(e,t);let d=s.length===1?new te(s[0]):void 0,f=s.length>1?new _(s[s.length-1]):void 0,p=d??f,h=null,g=null,v=null,x=!1,C=null,w=null,T=!1,O=!1,A=null,M=[],N=[],F=[],I=[],L=[],R=[],z=[],B=[],V=[],H=[],U=[],G=[],K=[],q=[],J=[],Y=[],X=[],Z=[],Q=!1;for(let t=e.reader.peekSignificant();t!==void 0;t=e.reader.peekSignificant()){e.reader.takeSignificant();let o=S(t.content);if(o===`command`&&/^command\s+reads(?:\s|$)/.test(t.content))O||!l(s)||!/^command\s+reads\s+protected$/.test(t.content)?e.error(a.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,j(t)):C=`Protected`,O=!0;else if(o===`time`&&/^time\s+zone(?:\s|$)/.test(t.content)){let n=pe.exec(t.content);e.skipBlock(t.indent),T||!l(s)||n===null?e.error(a.InvalidTimeZoneDeclaration,`Declare 'time zone "<id>"' or 'time zone configurable default "<id>"' once at the application root.`,j(t)):w={kind:`TimeZoneSyntax`,id:k(n[2]),configurable:n[1]!==void 0,location:j(t)},T=!0}else if(o===`reaction`)x||!l(s)||!/^reaction\s+batches\s+atomic$/.test(t.content)?e.error(a.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,j(t)):v=`Atomic`,x=!0;else if(o===`runs`)i(e,t);else if(o===`domain`)e.authoredDeclarations=!0,A=parseDomain(e,t,A,Q);else if(Q||=declaresConstruct(o,t,s),e.authoredDeclarations||=o!==`import`&&declaresConstruct(o,t,s),o===`import`&&y(t.content))p===void 0?b(e,t,N):p.tryParse(e,t);else if(o===`import`){let n=P.exec(t.content);if(n===null)e.error(a.InvalidImportDeclaration,`Invalid import '${t.content}' - expected 'import <Qualified.Name> [from "<origin>"]'`,j(t));else{let r=n.groups?.origin===void 0?null:k(n.groups.origin);r!==null&&se(r)&&e.error(a.InvalidImportDeclaration,`An import origin must be a nonblank quoted string`,j(t)),M.push({kind:`ImportSyntax`,qualifiedName:n[1],origin:r,visibility:r===null?`Private`:`Public`,location:j(t)})}}else if(o===`example`)p===void 0?J.push(de(e,t)):p.tryParse(e,t);else if(o===`eventsource`)B.push(ce(e,t));else if(o===`system`)L.push(ie(e,t));else if(o===`statemachine`)R.push(ae(e,t));else if(o===`workflow`)z.push(oe(e,t));else if(o===`concept`)F.push(parseConcept(e,t));else if(o===`type`)I.push(m(e,t));else if(o===`module`&&!l(s))parseModuleInPlacedFile(e,t,s,d);else if(o===`module`)V.push(ne(e,t));else if(o===`persona`)H.push(parsePersona(e,t));else if(o===`sticky`){let n=parseStickyNote(e,t);n!==null&&U.push(n)}else if(o===`seed`)q.push(D(e.valueContext,t));else if(o===`purpose`&&p!==void 0)p.tryParse(e,t);else if(o===`purpose`)K.push(E(e,t));else if(o===`context`)g=r(e,t,g,s);else if(o===`identity`)h=n(e,t,h);else if(o===`policy`){let n=re(e,t);G.some(e=>e.name===n.name)&&e.error(a.DuplicateDeclaration,`Duplicate declaration of policy '${n.name}' - policy names must be unique`,n.location),G.push(n)}else if(o===`exposure`)X.push(le(e,t));else if(o===`instance`)Z.push(ue(e,t));else if(o===`trigger`){let n=u(e,t),r=/^trigger\s+([A-Za-z_]\w*)$/.exec(t.content)?.[1];r!==void 0&&Y.push({name:r,data:n})}else W.has(o)?o===`behavior`||o===`layout`?ee(e,t):o===`ui`?fe(e,t):e.skipOpaqueBlock(t.indent):p?.tryParse(e,t)!==!0&&reportUnexpectedTopLevel(e,t,s)}d===void 0?f!==void 0&&V.unshift(place(s,f.build(e.start,!0),e.start)):V.unshift(d.build(e.start,!0));let $={kind:`ApplicationSyntax`,...C===null?{}:{commandReadMode:C},...w===null?{}:{timeZone:w},...g===null?{}:{context:g},...v===null?{}:{reactionProductionMode:v},...h===null?{}:{identity:h},sourceOptions:e.sourceOptions,domain:A,imports:M,concepts:F,types:I,systems:L,...R.length>0?{stateMachines:R}:{},...z.length>0?{workflows:z}:{},eventSources:B,examples:J,modules:V,personas:H,policies:G,purposes:K,seeds:q,declaredTriggers:Y,fileImports:N,...X.length>0?{exposures:X}:{},...U.length>0?{stickyNotes:U}:{},...Z.length>0?{instanceContributions:Z}:{},location:e.start};return e.authoredDeclarations&&o($),$}function declaresConstruct(e,t,n){return e===`import`?P.test(t.content):e===`module`?l(n):e===`identity`?t.content===`identity`:e===`context`?t.content===`context`:e===`purpose`||e===`example`||e===`exposure`||e===`instance`||e===`eventsource`||e===`system`||e===`statemachine`||e===`workflow`||e===`concept`||e===`type`||e===`persona`||e===`sticky`||W.has(e)}function parseModuleInPlacedFile(e,t,n,r){let i=T.exec(t.content)?.[1]??``;r!==void 0&&i===n[0]?(e.authoredDeclarations=!0,r.parseChildren(e,t)):(e.error(a.ModuleInPlacedFile,`This file is imported into ${s(n)}, so it cannot declare module '${i}' - import it at the top level of a document instead`,j(t)),e.skipBlock(t.indent))}function reportUnexpectedTopLevel(e,t,n){let r=S(t.content);if(l(n)){let n=G.has(r)?` - '${r}' belongs in a module or feature; wrap it in one, or import this file from inside one`:` - expected domain, import, concept, type, policy, persona, sticky note, authentication, onboarding, identity, context, module, seed, trigger, behavior, ui profile, theme, sample data or layout`;e.error(a.UnknownTopLevelConstruct,`Unexpected '${r}' at the top level${n}`,j(t))}else{let i=n.length===1?w:v;e.error(a.UnexpectedInPlacedFile,`Unexpected '${r}' in a file imported into ${s(n)} - expected an application declaration or ${i}`,j(t))}e.skipBlock(t.indent)}function place(e,t,n){let r=t;for(let t=e.length-2;t>=1;t--)r={kind:`FeatureSyntax`,name:e[t],description:null,authorize:null,features:[r],slices:[],fileImports:[],isPlacement:!0,location:n};return{kind:`ModuleSyntax`,name:e[0],description:null,authorize:null,features:[r],fileImports:[],isPlacement:!0,location:n}}function parseDomain(e,t,n,r){let i=N.exec(t.content);return i===null?(e.error(a.InvalidDomainDeclaration,`Invalid domain declaration '${t.content}' - expected 'domain <Qualified.Name>'`,j(t)),n):n===null?(r&&e.error(a.DomainNotFirst,`'domain' must be declared before any other construct`,j(t)),{kind:`DomainSyntax`,name:i[1],location:j(t)}):(e.error(a.DuplicateDomain,`The document already declares a domain - a document can have at most one`,j(t)),n)}function warnOnTabIndentation(e,t){let n=!1;for(let r of t)r.raw.trimStart().startsWith("```")?n=!n:!n&&H.test(r.raw)&&e.warning(a.TabIndentation,`Screenplay is indentation based - use spaces, not tabs`,M(r))}function parseConcept(n,r){let i=F.exec(r.content);if(i===null)return n.error(a.InvalidConceptDeclaration,`Invalid concept declaration '${r.content}' - expected 'concept <Name> : <Type>'`,j(r)),n.skipBlock(r.indent),{kind:`ConceptSyntax`,name:S(r.content),type:``,attributes:[],values:[],location:j(r)};let[,o,s,c]=i,l=p(n,r,o,c);s!==`Enum`&&!U.includes(s)&&n.error(a.UnknownPrimitiveType,`Unknown primitive type '${s}' - expected ${U.join(`, `)} or Enum`,j(r));let u=[],d=new e,m=null,_=!1,v=null,y=[];for(let e=n.peekChild(r.indent);e!==void 0;e=n.peekChild(r.indent)){n.reader.takeSignificant();let r=s===`Enum`?d.tryNumbered(n,e):void 0;if(r!==void 0)u.push(r);else if(S(e.content)===`description`&&(s!==`Enum`||e.content!==`description`||n.peekChild(e.indent)?.content.startsWith("```")===!0))v=g(n,e,v,`Concept '${o}'`);else if(x(e))continue;else if(S(e.content)===`validate`){s===`Enum`&&e.content===`validate`&&n.peekChild(e.indent)===void 0&&n.warning(a.ValidateReadAsEnumerationBlock,`'validate' in enumeration concept '${o}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,j(e));let t=h(n,e,`concept`,o);t!==void 0&&y.push(t)}else if(S(e.content)===`generate`&&(s!==`Enum`||e.content!==`generate`)){_&&n.error(a.DuplicateGeneration,`Concept '${o}' declares generation more than once.`,j(e));let r=t(n,e,s);_||(m=r),_=!0}else f(n,e,o,l)||(s===`Enum`&&I.test(e.content)?u.push(C(e.content)):s===`Enum`?n.error(a.InvalidEnumerationValue,`Invalid enum value '${e.content}' - expected an identifier`,j(e)):(n.error(a.UnknownConceptDirective,`Unexpected '${e.content}' in concept body - expected validate, generate, 'file <path>' or '<attribute> reason "<text>"'`,j(e)),n.skipBlock(e.indent)))}let b=d.finish(n,r,u.length);return{kind:`ConceptSyntax`,name:o,type:s,attributes:l,values:u,validations:y,description:v,...m===null?{}:{generation:m},...b===void 0?{}:{valueNumbers:b},location:j(r)}}function parsePersona(e,t){let n=L.exec(t.content)?.[1]??``;n===``&&e.error(a.InvalidPersonaDeclaration,`Invalid persona declaration '${t.content}' - expected 'persona <Name>'`,j(t));let r=null,i=[],o=[],s=null,c=null;for(let l=e.peekChild(t.indent);l!==void 0;l=e.peekChild(t.indent)){e.reader.takeSignificant();let t=S(l.content);if(t===`description`)r=g(e,l,r,`Persona '${n}'`);else if(t===`goal`){let t=z.exec(l.content);t===null?e.error(a.InvalidPersonaDeclaration,`Invalid goal '${l.content}' - expected 'goal "<text>"'`,j(l)):o.push(k(t[1]))}else if(t===`position`)s=A(e,l,`position`,`x`,`y`,s,!0)??s;else if(t===`size`)c=A(e,l,`size`,`width`,`height`,c,!1)??c;else if(t===`policy`){let t=R.exec(l.content);t===null?e.error(a.InvalidPersonaPolicyReference,`Invalid policy reference '${l.content}' - expected 'policy <Name>'`,j(l)):i.push(t[1])}else e.error(a.UnknownPersonaDirective,`Unexpected '${t}' in persona body - expected description, goal, policy, position or size`,j(l)),e.skipBlock(l.indent)}return{kind:`PersonaSyntax`,name:n,description:r,policies:i,...o.length>0?{goals:o}:{},...s===null?{}:{x:s[0],y:s[1]},...c===null?{}:{width:c[0],height:c[1]},location:j(t)}}function parseStickyNote(e,t){let n=B.exec(t.content);if(n===null)return e.error(a.InvalidPersonaDeclaration,`Invalid sticky note declaration '${t.content}' - expected 'sticky note on personas', 'sticky note on eventsources', 'sticky note on givencontexts' or 'sticky note on seeddata'`,j(t)),e.skipBlock(t.indent),null;let r=null,i=null,o=null,s=null;for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent)){e.reader.takeSignificant();let t=S(n.content);if(t===`description`)r=g(e,n,r,`A sticky note`);else if(t===`colour`){let t=V.exec(n.content);t===null?e.error(a.InvalidPersonaDeclaration,`Invalid colour '${n.content}' - expected 'colour yellow', 'colour pink', 'colour green' or 'colour blue'`,j(n)):i=t[1]}else t===`position`?o=A(e,n,`position`,`x`,`y`,o,!0)??o:t===`size`?s=A(e,n,`size`,`width`,`height`,s,!1)??s:(e.error(a.UnknownPersonaDirective,`Unexpected '${t}' in sticky note body - expected description, colour, position or size`,j(n)),e.skipBlock(n.indent))}return r===null||o===null?(e.error(a.InvalidPersonaDeclaration,`A sticky note needs a description (the text on it) and a position`,j(t)),null):{kind:`StickyNoteSyntax`,canvas:n[1],text:r,colour:i,x:o[0],y:o[1],width:s===null?null:s[0],height:s===null?null:s[1],location:j(t)}}export{parseApplication};
|
|
2
2
|
//# sourceMappingURL=ScreenplayParser.js.map
|