@cratis/screenplay-language 5.2.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -0
- package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -0
- 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 +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 +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 +18 -17
- 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 +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/language.js +1 -1
- package/dist/bundles/language.js.map +1 -1
- package/dist/bundles/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 +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 +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/completion-items.d.ts +1 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +6 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/scope-items.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchAmbiguityCharacters.js","names":["ordered","ranges","left","right","result","next","first","last","token","offset","negated","end","character","escape","width","code"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityCharacters.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\nfunction complement(ranges: [number, number][]): [number, number][] {\n const ordered = [...ranges].sort((left, right) => left[0] - right[0]);\n const result: [number, number][] = [];\n let next = 0;\n for (const [first, last] of ordered) {\n if (next < first) result.push([next, first - 1]);\n next = Math.max(next, last + 1);\n }\n if (next <= 65535) result.push([next, 65535]);\n return result;\n}\n\n/** UTF-16 sets for already-admitted literal, escape, dot and class tokens. */\nexport function matchAmbiguityCharacters(token: string): [number, number][] {\n if (token === '.') return complement([[10, 10], [13, 13], [0x2028, 0x2029]]);\n let offset = token[0] === '[' ? 1 : 0;\n const negated = offset === 1 && token[offset] === '^';\n if (negated) offset++;\n const end = token[0] === '[' ? token.length - 1 : token.length;\n function item(): [number, number][] {\n const character = token[offset++];\n if (character !== '\\\\') return [[character.charCodeAt(0), character.charCodeAt(0)]];\n const escape = token[offset++];\n if ('dDwWsS'.includes(escape)) {\n const ranges: [number, number][] = escape.toLowerCase() === 'd' ? [[48, 57]] : escape.toLowerCase() === 'w' ? [[48, 57], [65, 90], [95, 95], [97, 122]] : [[9, 13], [32, 32], [160, 160], [0x1680, 0x1680], [0x2000, 0x200a], [0x2028, 0x2029], [0x202f, 0x202f], [0x205f, 0x205f], [0x3000, 0x3000], [0xfeff, 0xfeff]];\n return escape === escape.toUpperCase() ? complement(ranges) : ranges;\n }\n if (escape === 'x' || escape === 'u') {\n const width = escape === 'x' ? 2 : 4;\n const code = parseInt(token.slice(offset, offset + width), 16);\n offset += width;\n return [[code, code]];\n }\n const literals: Record<string, number> = { t: 9, n: 10, r: 13, f: 12, v: 11, '0': 0 };\n const code = literals[escape] ?? escape.charCodeAt(0);\n return [[code, code]];\n }\n const ranges: [number, number][] = [];\n while (offset < end) {\n let left = item();\n if (token[0] === '[' && token[offset] === '-' && offset + 1 < end) {\n offset++;\n left = [[left[0][0], item()[0][0]]];\n }\n ranges.push(...left);\n }\n return negated ? complement(ranges) : ranges;\n}\n"],"mappings":"qDAGA,SAAS,WAAW,EAAgD,CAChE,IAAMA,EAAU,CAAC,GAAGC,CAAM,CAAC,CAAC,MAAM,EAAM,IAAUC,EAAK,GAAKC,EAAM,EAAE,EAC9DC,EAA6B,CAAC,EAChCC,EAAO,EACX,IAAK,GAAM,CAACC,EAAOC,KAASP,EACpBK,EAAOC,GAAOF,EAAO,KAAK,CAACC,EAAMC,EAAQ,CAAC,CAAC,EAC/C,EAAO,KAAK,IAAID,EAAME,EAAO,CAAC,EAGlC,OADIF,GAAQ,OAAOD,EAAO,KAAK,CAACC,EAAM,KAAK,CAAC,EACrCD,CACX,CAGA,SAAgB,yBAAyB,EAAmC,CACxE,GAAII,IAAU,IAAK,OAAO,WAAW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AI,EAAG,GAAI,EAAG,GAAI,EAAG,GAAI,EAAK,CAC9D,EAAEF,IAAWA,EAAO,WAAW,CAAC,EACpD,MAAO,CAAC,CAACE,EAAMA,CAAI,CAAC,CACxB,CACA,IAAMd,EAA6B,CAAC,EACpC,KAAOQ,EAASE,GAAK,CACjB,IAAIT,EAAO,KAAK,EACZM,EAAM,KAAO,KAAOA,EAAMC,KAAY,KAAOA,EAAS,EAAIE,IAC1D,IACA,EAAO,CAAC,CAACT,EAAK,EAAE,CAAC,GAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAEtCD,EAAO,KAAK,GAAGC,CAAI,CACvB,CACA,OAAOQ,EAAU,WAAWT,CAAM,EAAIA,CAC1C"}
|
|
1
|
+
{"version":3,"file":"MatchAmbiguityCharacters.js","names":["ordered","ranges","left","right","result","next","first","last","token","offset","negated","end","character","escape","width","code"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityCharacters.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\nfunction complement(ranges: [number, number][]): [number, number][] {\n const ordered = [...ranges].sort((left, right) => left[0] - right[0]);\n const result: [number, number][] = [];\n let next = 0;\n for (const [first, last] of ordered) {\n if (next < first) result.push([next, first - 1]);\n next = Math.max(next, last + 1);\n }\n if (next <= 65535) result.push([next, 65535]);\n return result;\n}\n\n/** UTF-16 sets for already-admitted literal, escape, dot and class tokens. */\nexport function matchAmbiguityCharacters(token: string): [number, number][] {\n if (token === '.') return complement([[10, 10], [13, 13], [0x2028, 0x2029]]);\n let offset = token[0] === '[' ? 1 : 0;\n const negated = offset === 1 && token[offset] === '^';\n if (negated) offset++;\n const end = token[0] === '[' ? token.length - 1 : token.length;\n function item(): [number, number][] {\n const character = token[offset++];\n if (character !== '\\\\') return [[character.charCodeAt(0), character.charCodeAt(0)]];\n const escape = token[offset++];\n if ('dDwWsS'.includes(escape)) {\n const ranges: [number, number][] = escape.toLowerCase() === 'd' ? [[48, 57]] : escape.toLowerCase() === 'w' ? [[48, 57], [65, 90], [95, 95], [97, 122]] : [[9, 13], [32, 32], [160, 160], [0x1680, 0x1680], [0x2000, 0x200a], [0x2028, 0x2029], [0x202f, 0x202f], [0x205f, 0x205f], [0x3000, 0x3000], [0xfeff, 0xfeff]];\n return escape === escape.toUpperCase() ? complement(ranges) : ranges;\n }\n if (escape === 'x' || escape === 'u') {\n const width = escape === 'x' ? 2 : 4;\n const code = parseInt(token.slice(offset, offset + width), 16);\n offset += width;\n return [[code, code]];\n }\n const literals: Record<string, number> = { t: 9, n: 10, r: 13, f: 12, v: 11, '0': 0 };\n const code = literals[escape] ?? escape.charCodeAt(0);\n return [[code, code]];\n }\n const ranges: [number, number][] = [];\n while (offset < end) {\n let left = item();\n if (token[0] === '[' && token[offset] === '-' && offset + 1 < end) {\n offset++;\n left = [[left[0][0], item()[0][0]]];\n }\n ranges.push(...left);\n }\n return negated ? complement(ranges) : ranges;\n}\n"],"mappings":"A,qDAGA,SAAS,WAAW,EAAgD,CAChE,IAAMA,EAAU,CAAC,GAAGC,CAAM,CAAC,CAAC,MAAM,EAAM,IAAUC,EAAK,GAAKC,EAAM,EAAE,EAC9DC,EAA6B,CAAC,EAChCC,EAAO,EACX,IAAK,GAAM,CAACC,EAAOC,KAASP,EACpBK,EAAOC,GAAOF,EAAO,KAAK,CAACC,EAAMC,EAAQ,CAAC,CAAC,EAC/C,EAAO,KAAK,IAAID,EAAME,EAAO,CAAC,EAGlC,OADIF,GAAQ,OAAOD,EAAO,KAAK,CAACC,EAAM,KAAK,CAAC,EACrCD,CACX,CAGA,SAAgB,yBAAyB,EAAmC,CACxE,GAAII,IAAU,IAAK,OAAO,WAAW,CAAC,CAAC,GAAI,EAAE,EAAG,CAAC,GAAI,EAAE,EAAG,CAAC,KAAQ,IAAM,CAAC,CAAC,EAC3E,IAAIC,EAAS,IAAM,KAAO,KACpBC,EAAUD,IAAW,GAAKD,EAAMC,KAAY,IAC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C,KAAOQ,EAASE,GAAK,CACjB,IAAIT,EAAO,KAAK,EACZM,EAAM,KAAO,KAAOA,EAAMC,KAAY,KAAOA,EAAS,EAAIE,IAC1D,IACA,EAAO,CAAC,CAACT,EAAK,EAAE,CAAC,GAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAEtCD,EAAO,KAAK,GAAGC,CAAI,CACvB,CACA,OAAOQ,EAAU,WAAWT,CAAM,EAAIA,CAC1C,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchAmbiguityGraph.js","names":["matchAmbiguityWorkLimit","left","right","result","scale","position","count","expression","node","child","part","index","tail","maximum","required","body","origin","source","firstCount","target","lastCount"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityGraph.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 { MatchAmbiguityNode } from './MatchAmbiguityNode';\nimport { MatchAmbiguityPositions } from './MatchAmbiguityPositions';\n\nexport const matchAmbiguityPositionLimit = 256;\nexport const matchAmbiguityWorkLimit = 500000;\nconst empty = (nullable = 1): MatchAmbiguityPositions => ({ nullable, first: new Map(), last: new Map() });\nconst add = (left: number, right: number) => Math.min(2, left + right);\nfunction sum(left: Map<number, number>, right: Map<number, number>, scale = 1): Map<number, number> {\n const result = new Map(left);\n if (scale > 0) for (const [position, count] of right) result.set(position, add(result.get(position) ?? 0, count * scale));\n return result;\n}\n\n/** Position multigraph, with derivation counts saturated at two. Never used for execution. */\nexport class MatchAmbiguityGraph {\n readonly positions: MatchAmbiguityNode[] = [{ kind: 'empty', offset: 0, length: 0, children: [], minimum: 0, maximum: 0, characters: [] }];\n readonly edges: { source: number; target: number; count: number; origin: MatchAmbiguityNode }[] = [];\n readonly root: MatchAmbiguityPositions;\n exhausted = false;\n work = 0;\n constructor(expression: MatchAmbiguityNode) { this.root = this.build(expression); }\n private build(node: MatchAmbiguityNode): MatchAmbiguityPositions {\n if (this.exhausted) return empty(0);\n if (++this.work > matchAmbiguityWorkLimit) { this.exhausted = true; return empty(0); }\n if (['characters', 'start', 'end'].includes(node.kind)) {\n if (this.positions.length > matchAmbiguityPositionLimit) { this.exhausted = true; return empty(0); }\n const position = this.positions.length;\n this.positions.push(node);\n return { nullable: 0, first: new Map([[position, 1]]), last: new Map([[position, 1]]) };\n }\n if (node.kind === 'group') return this.build(node.children[0]);\n if (node.kind === 'repeat') return this.repeat(node);\n let result = empty(node.kind === 'alternate' ? 0 : 1);\n for (const child of node.children) {\n const part = this.build(child);\n result = node.kind === 'alternate' ? { nullable: add(result.nullable, part.nullable), first: sum(result.first, part.first), last: sum(result.last, part.last) } : this.concat(result, part, node);\n }\n return result;\n }\n private repeat(node: MatchAmbiguityNode): MatchAmbiguityPositions {\n if (node.maximum !== null) return this.boundedRepeat(node, node.maximum);\n let result = empty();\n for (let index = 0; index < node.minimum && !this.exhausted; index++) {\n result = this.concat(result, this.iteration(node, true), node);\n }\n const tail = this.iteration(node, false);\n this.connect(tail.last, tail.first, node);\n return this.concat(result, { ...tail, nullable: 1 }, node);\n }\n private boundedRepeat(node: MatchAmbiguityNode, maximum: number): MatchAmbiguityPositions {\n let result = empty();\n // A prefix-closed suffix gives each count one path: b{0,2} is (b(b)?)?.\n for (let index = maximum - 1; index >= 0 && !this.exhausted; index--) {\n const required = index < node.minimum;\n result = this.concat(this.iteration(node, required), result, node);\n if (!required) result = { ...result, nullable: 1 };\n }\n return result;\n }\n private iteration(node: MatchAmbiguityNode, required: boolean): MatchAmbiguityPositions {\n const body = this.build(node.children[0]);\n // RepeatMatcher permits empty mandatory iterations, but rejects them once min is zero.\n // Preserve nonempty derivations (including empty prefixes); only the wrapper may skip.\n return required ? body : { ...body, nullable: 0 };\n }\n private concat(left: MatchAmbiguityPositions, right: MatchAmbiguityPositions, origin: MatchAmbiguityNode): MatchAmbiguityPositions {\n this.connect(left.last, right.first, origin);\n return { nullable: Math.min(2, left.nullable * right.nullable), first: sum(left.first, right.first, left.nullable), last: sum(right.last, left.last, right.nullable) };\n }\n private connect(left: Map<number, number>, right: Map<number, number>, origin: MatchAmbiguityNode): void {\n for (const [source, firstCount] of left) for (const [target, lastCount] of right) {\n if (++this.work > matchAmbiguityWorkLimit) { this.exhausted = true; return; }\n this.edges.push({ source, target, count: Math.min(2, firstCount * lastCount), origin });\n }\n }\n}\n"],"mappings":"qDAOA,MAAaA,EAA0B,IACjC,OAAS,EAAW,KAAgC,CAAE,WAAU,sBAAO,IAAI,IAAO,qBAAM,IAAI,GAAM,GAClG,KAAO,EAAc,IAAkB,KAAK,IAAI,EAAGC,EAAOC,CAAK,EACrE,SAAS,IAAI,EAA2B,EAA4B,EAAQ,EAAwB,CAChG,IAAMC,EAAS,IAAI,IAAIF,CAAI,EAC3B,GAAIG,EAAQ,EAAG,IAAK,GAAM,CAACC,EAAUC,KAAUJ,EAAOC,EAAO,IAAIE,EAAU,IAAIF,EAAO,IAAIE,CAAQ,GAAK,EAAGC,EAAQF,CAAK,CAAC,EACxH,OAAOD,CACX,CAGA,IAAa,oBAAb,KAAiC,CAC7B,UAA2C,CAAC,CAAE,KAAM,QAAS,OAAQ,EAAG,OAAQ,EAAG,SAAU,CAAC,EAAG,QAAS,EAAG,QAAS,EAAG,WAAY,CAAC,CAAE,CAAC,EACzI,MAAkG,CAAC,EACnG,KACA,UAAY,GACZ,KAAO,EACP,YAAY,EAAgC,CAAE,KAAK,KAAO,KAAK,MAAMI,CAAU,CAAG,CAClF,MAAc,EAAmD,CAC7D,GAAI,KAAK,UAAW,OAAO,MAAM,CAAC,EAClC,GAAI,EAAE,KAAK,KAAA,IAAyD,MAAvB,MAAK,UAAY,GAAa,MAAM,CAAC,EAClF,GAAI,CAAC,aAAc,QAAS,KAAK,CAAC,CAAC,SAASC,EAAK,IAAI,EAAG,CACpD,GAAI,KAAK,UAAU,OAAA,IAA+D,MAAvB,MAAK,UAAY,GAAa,MAAM,CAAC,EAChG,IAAMH,EAAW,KAAK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,GAAK,CAAC,KAAK,UAAW,IAAS,CAClE,IAAMG,EAAWH,EAAQH,EAAK,QAC9B,EAAS,KAAK,OAAO,KAAK,UAAUA,EAAMM,CAAQ,EAAGX,EAAQK,CAAI,EAC5DM,IAAU,EAAS,CAAE,GAAGX,EAAQ,SAAU,CAAE,EACrD,CACA,OAAOA,CACX,CACA,UAAkB,EAA0B,EAA4C,CACpF,IAAMY,EAAO,KAAK,MAAMP,EAAK,SAAS,EAAE,EAGxC,OAAOM,EAAWC,EAAO,CAAE,GAAGA,EAAM,SAAU,CAAE,CACpD,CACA,OAAe,EAA+B,EAAgC,EAAqD,CAE/H,OADA,KAAK,QAAQd,EAAK,KAAMC,EAAM,MAAOc,CAAM,EACpC,CAAE,SAAU,KAAK,IAAI,EAAGf,EAAK,SAAWC,EAAM,QAAQ,EAAG,MAAO,IAAID,EAAK,MAAOC,EAAM,MAAOD,EAAK,QAAQ,EAAG,KAAM,IAAIC,EAAM,KAAMD,EAAK,KAAMC,EAAM,QAAQ,CAAE,CACzK,CACA,QAAgB,EAA2B,EAA4B,EAAkC,CACrG,IAAK,GAAM,CAACe,EAAQC,KAAejB,EAAM,IAAK,GAAM,CAACkB,EAAQC,KAAclB,EAAO,CAC9E,GAAI,EAAE,KAAK,KAAA,IAAgC,CAAE,KAAK,UAAY,GAAM,MAAQ,CAC5E,KAAK,MAAM,KAAK,CAAE,SAAQ,SAAQ,MAAO,KAAK,IAAI,EAAGgB,EAAaE,CAAS,EAAG,QAAO,CAAC,CAC1F,CACJ,CACJ"}
|
|
1
|
+
{"version":3,"file":"MatchAmbiguityGraph.js","names":["matchAmbiguityWorkLimit","left","right","result","scale","position","count","expression","node","child","part","index","tail","maximum","required","body","origin","source","firstCount","target","lastCount"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityGraph.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 { MatchAmbiguityNode } from './MatchAmbiguityNode';\nimport { MatchAmbiguityPositions } from './MatchAmbiguityPositions';\n\nexport const matchAmbiguityPositionLimit = 256;\nexport const matchAmbiguityWorkLimit = 500000;\nconst empty = (nullable = 1): MatchAmbiguityPositions => ({ nullable, first: new Map(), last: new Map() });\nconst add = (left: number, right: number) => Math.min(2, left + right);\nfunction sum(left: Map<number, number>, right: Map<number, number>, scale = 1): Map<number, number> {\n const result = new Map(left);\n if (scale > 0) for (const [position, count] of right) result.set(position, add(result.get(position) ?? 0, count * scale));\n return result;\n}\n\n/** Position multigraph, with derivation counts saturated at two. Never used for execution. */\nexport class MatchAmbiguityGraph {\n readonly positions: MatchAmbiguityNode[] = [{ kind: 'empty', offset: 0, length: 0, children: [], minimum: 0, maximum: 0, characters: [] }];\n readonly edges: { source: number; target: number; count: number; origin: MatchAmbiguityNode }[] = [];\n readonly root: MatchAmbiguityPositions;\n exhausted = false;\n work = 0;\n constructor(expression: MatchAmbiguityNode) { this.root = this.build(expression); }\n private build(node: MatchAmbiguityNode): MatchAmbiguityPositions {\n if (this.exhausted) return empty(0);\n if (++this.work > matchAmbiguityWorkLimit) { this.exhausted = true; return empty(0); }\n if (['characters', 'start', 'end'].includes(node.kind)) {\n if (this.positions.length > matchAmbiguityPositionLimit) { this.exhausted = true; return empty(0); }\n const position = this.positions.length;\n this.positions.push(node);\n return { nullable: 0, first: new Map([[position, 1]]), last: new Map([[position, 1]]) };\n }\n if (node.kind === 'group') return this.build(node.children[0]);\n if (node.kind === 'repeat') return this.repeat(node);\n let result = empty(node.kind === 'alternate' ? 0 : 1);\n for (const child of node.children) {\n const part = this.build(child);\n result = node.kind === 'alternate' ? { nullable: add(result.nullable, part.nullable), first: sum(result.first, part.first), last: sum(result.last, part.last) } : this.concat(result, part, node);\n }\n return result;\n }\n private repeat(node: MatchAmbiguityNode): MatchAmbiguityPositions {\n if (node.maximum !== null) return this.boundedRepeat(node, node.maximum);\n let result = empty();\n for (let index = 0; index < node.minimum && !this.exhausted; index++) {\n result = this.concat(result, this.iteration(node, true), node);\n }\n const tail = this.iteration(node, false);\n this.connect(tail.last, tail.first, node);\n return this.concat(result, { ...tail, nullable: 1 }, node);\n }\n private boundedRepeat(node: MatchAmbiguityNode, maximum: number): MatchAmbiguityPositions {\n let result = empty();\n // A prefix-closed suffix gives each count one path: b{0,2} is (b(b)?)?.\n for (let index = maximum - 1; index >= 0 && !this.exhausted; index--) {\n const required = index < node.minimum;\n result = this.concat(this.iteration(node, required), result, node);\n if (!required) result = { ...result, nullable: 1 };\n }\n return result;\n }\n private iteration(node: MatchAmbiguityNode, required: boolean): MatchAmbiguityPositions {\n const body = this.build(node.children[0]);\n // RepeatMatcher permits empty mandatory iterations, but rejects them once min is zero.\n // Preserve nonempty derivations (including empty prefixes); only the wrapper may skip.\n return required ? body : { ...body, nullable: 0 };\n }\n private concat(left: MatchAmbiguityPositions, right: MatchAmbiguityPositions, origin: MatchAmbiguityNode): MatchAmbiguityPositions {\n this.connect(left.last, right.first, origin);\n return { nullable: Math.min(2, left.nullable * right.nullable), first: sum(left.first, right.first, left.nullable), last: sum(right.last, left.last, right.nullable) };\n }\n private connect(left: Map<number, number>, right: Map<number, number>, origin: MatchAmbiguityNode): void {\n for (const [source, firstCount] of left) for (const [target, lastCount] of right) {\n if (++this.work > matchAmbiguityWorkLimit) { this.exhausted = true; return; }\n this.edges.push({ source, target, count: Math.min(2, firstCount * lastCount), origin });\n }\n }\n}\n"],"mappings":"A,qDAOA,MAAaA,EAA0B,IACjC,OAAS,EAAW,KAAgC,CAAE,WAAU,sBAAO,IAAI,IAAO,qBAAM,IAAI,GAAM,GAClG,KAAO,EAAc,IAAkB,KAAK,IAAI,EAAGC,EAAOC,CAAK,EACrE,SAAS,IAAI,EAA2B,EAA4B,EAAQ,EAAwB,CAChG,IAAMC,EAAS,IAAI,IAAIF,CAAI,EAC3B,GAAIG,EAAQ,EAAG,IAAK,GAAM,CAACC,EAAUC,KAAUJ,EAAOC,EAAO,IAAIE,EAAU,IAAIF,EAAO,IA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AAMD,EAAK,KAAMC,EAAM,QAAQ,CAAE,CACzK,CACA,QAAgB,EAA2B,EAA4B,EAAkC,CACrG,IAAK,GAAM,CAACe,EAAQC,KAAejB,EAAM,IAAK,GAAM,CAACkB,EAAQC,KAAclB,EAAO,CAC9E,GAAI,EAAE,KAAK,KAAA,IAAgC,CAAE,KAAK,UAAY,GAAM,MAAQ,CAC5E,KAAK,MAAM,KAAK,CAAE,SAAQ,SAAQ,MAAO,KAAK,IAAI,EAAGgB,EAAaE,CAAS,EAAG,QAAO,CAAC,CAC1F,CACJ,CACJ,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchAmbiguityParser.js","names":["pattern","start","alternatives","children","atom","minimum","maximum","character","body","escape","matchAmbiguityCharacters","value"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityParser.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 { matchAmbiguityCharacters } from './MatchAmbiguityCharacters';\nimport { MatchAmbiguityNode } from './MatchAmbiguityNode';\n\n/** Reads only admitted patterns; PortableMatchPattern remains the dialect authority. */\nexport class MatchAmbiguityParser {\n private offset = 0;\n constructor(private readonly pattern: string) { }\n parse(): MatchAmbiguityNode { return this.expression(); }\n private node(kind: string, start: number, children: MatchAmbiguityNode[] = []): MatchAmbiguityNode {\n return { kind, offset: start, length: this.offset - start, children, minimum: 0, maximum: 0, characters: [] };\n }\n private expression(): MatchAmbiguityNode {\n const start = this.offset;\n const alternatives = [this.sequence()];\n while (this.take('|')) alternatives.push(this.sequence());\n return this.node('alternate', start, alternatives);\n }\n private sequence(): MatchAmbiguityNode {\n const start = this.offset;\n const children: MatchAmbiguityNode[] = [];\n while (this.offset < this.pattern.length && !')|'.includes(this.pattern[this.offset])) children.push(this.quantified());\n return this.node('concat', start, children);\n }\n private quantified(): MatchAmbiguityNode {\n const start = this.offset;\n const atom = this.atom();\n let minimum = 0;\n let maximum: number | null = null;\n if (this.take('*')) { /* Zero or more. */ }\n else if (this.take('+')) minimum = 1;\n else if (this.take('?')) maximum = 1;\n else if (this.take('{')) {\n minimum = this.number();\n maximum = minimum;\n if (this.take(',')) maximum = this.pattern[this.offset] === '}' ? null : this.number();\n this.take('}');\n } else return atom;\n this.take('?');\n return { ...this.node('repeat', start, [atom]), minimum, maximum };\n }\n private atom(): MatchAmbiguityNode {\n const start = this.offset;\n const character = this.pattern[this.offset++];\n if (character === '(') {\n if (this.take('?') && !this.take(':')) while (this.pattern[this.offset++] !== '>') { /* Admitted group name. */ }\n const body = this.expression();\n this.take(')');\n return this.node('group', start, [body]);\n }\n if (character === '[') {\n while (this.pattern[this.offset] !== ']') if (this.pattern[this.offset++] === '\\\\') this.offset++;\n this.offset++;\n } else if (character === '\\\\') {\n const escape = this.pattern[this.offset++];\n this.offset += escape === 'x' ? 2 : escape === 'u' ? 4 : 0;\n }\n if (character === '^' || character === '$') return this.node(character === '^' ? 'start' : 'end', start);\n return { ...this.node('characters', start), characters: matchAmbiguityCharacters(this.pattern.slice(start, this.offset)) };\n }\n private number(): number {\n let value = 0;\n while (this.offset < this.pattern.length && this.pattern[this.offset] >= '0' && this.pattern[this.offset] <= '9') value = Math.min(3001, value * 10 + Number(this.pattern[this.offset++]));\n return value;\n }\n private take(character: string): boolean {\n if (this.offset === this.pattern.length || this.pattern[this.offset] !== character) return false;\n this.offset++;\n return true;\n }\n}\n"],"mappings":"8HAOA,IAAa,qBAAb,KAAkC,CAED,QAD7B,OAAiB,EACjB,YAAY,EAAkC,CAAjB,KAAA,QAAAA,CAAmB,CAChD,OAA4B,CAAE,OAAO,KAAK,WAAW,CAAG,CACxD,KAAa,EAAc,EAAe,EAAiC,CAAC,EAAuB,CAC/F,MAAO,CAAE,OAAM,OAAQC,EAAO,OAAQ,KAAK,OAASA,EAAO,WAAU,QAAS,EAAG,QAAS,EAAG,WAAY,CAAC,CAAE,CAChH,CACA,YAAyC,CACrC,IAAMA,EAAQ,KA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c,IAAK,CACnB,KAAO,KAAK,QAAQ,KAAK,UAAY,KAAS,KAAK,QAAQ,KAAK,YAAc,MAAM,KAAK,SACzF,KAAK,QACT,MAAO,GAAIA,IAAc,KAAM,CAC3B,IAAME,EAAS,KAAK,QAAQ,KAAK,UACjC,KAAK,QAAUA,IAAW,IAAM,EAAIA,IAAW,IAAM,EAAI,CAC7D,CAEA,OADIF,IAAc,KAAOA,IAAc,IAAY,KAAK,KAAKA,IAAc,IAAM,QAAU,MAAON,CAAK,EAChG,CAAE,GAAG,KAAK,KAAK,aAAcA,CAAK,EAAG,WAAYS,EAAyB,KAAK,QAAQ,MAAMT,EAAO,KAAK,MAAM,CAAC,CAAE,CAC7H,CACA,QAAyB,CACrB,IAAIU,EAAQ,EACZ,KAAO,KAAK,OAAS,KAAK,QAAQ,QAAU,KAAK,QAAQ,KAAK,SAAW,KAAO,KAAK,QAAQ,KAAK,SAAW,KAAK,EAAQ,KAAK,IAAI,KAAMA,EAAQ,GAAK,OAAO,KAAK,QAAQ,KAAK,SAAS,CAAC,EACzL,OAAOA,CACX,CACA,KAAa,EAA4B,CAGrC,OAFI,KAAK,SAAW,KAAK,QAAQ,QAAU,KAAK,QAAQ,KAAK,UAAYJ,EAAkB,IAC3F,KAAK,SACE,GACX,CACJ"}
|
|
1
|
+
{"version":3,"file":"MatchAmbiguityParser.js","names":["pattern","start","alternatives","children","atom","minimum","maximum","character","body","escape","matchAmbiguityCharacters","value"],"sources":["../../../../../../Compiler/Parsing/MatchAmbiguityParser.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 { matchAmbiguityCharacters } from './MatchAmbiguityCharacters';\nimport { MatchAmbiguityNode } from './MatchAmbiguityNode';\n\n/** Reads only admitted patterns; PortableMatchPattern remains the dialect authority. */\nexport class MatchAmbiguityParser {\n private offset = 0;\n constructor(private readonly pattern: string) { }\n parse(): MatchAmbiguityNode { return this.expression(); }\n private node(kind: string, start: number, children: MatchAmbiguityNode[] = []): MatchAmbiguityNode {\n return { kind, offset: start, length: this.offset - start, children, minimum: 0, maximum: 0, characters: [] };\n }\n private expression(): MatchAmbiguityNode {\n const start = this.offset;\n const alternatives = [this.sequence()];\n while (this.take('|')) alternatives.push(this.sequence());\n return this.node('alternate', start, alternatives);\n }\n private sequence(): MatchAmbiguityNode {\n const start = this.offset;\n const children: MatchAmbiguityNode[] = [];\n while (this.offset < this.pattern.length && !')|'.includes(this.pattern[this.offset])) children.push(this.quantified());\n return this.node('concat', start, children);\n }\n private quantified(): MatchAmbiguityNode {\n const start = this.offset;\n const atom = this.atom();\n let minimum = 0;\n let maximum: number | null = null;\n if (this.take('*')) { /* Zero or more. */ }\n else if (this.take('+')) minimum = 1;\n else if (this.take('?')) maximum = 1;\n else if (this.take('{')) {\n minimum = this.number();\n maximum = minimum;\n if (this.take(',')) maximum = this.pattern[this.offset] === '}' ? null : this.number();\n this.take('}');\n } else return atom;\n this.take('?');\n return { ...this.node('repeat', start, [atom]), minimum, maximum };\n }\n private atom(): MatchAmbiguityNode {\n const start = this.offset;\n const character = this.pattern[this.offset++];\n if (character === '(') {\n if (this.take('?') && !this.take(':')) while (this.pattern[this.offset++] !== '>') { /* Admitted group name. */ }\n const body = this.expression();\n this.take(')');\n return this.node('group', start, [body]);\n }\n if (character === '[') {\n while (this.pattern[this.offset] !== ']') if (this.pattern[this.offset++] === '\\\\') this.offset++;\n this.offset++;\n } else if (character === '\\\\') {\n const escape = this.pattern[this.offset++];\n this.offset += escape === 'x' ? 2 : escape === 'u' ? 4 : 0;\n }\n if (character === '^' || character === '$') return this.node(character === '^' ? 'start' : 'end', start);\n return { ...this.node('characters', start), characters: matchAmbiguityCharacters(this.pattern.slice(start, this.offset)) };\n }\n private number(): number {\n let value = 0;\n while (this.offset < this.pattern.length && this.pattern[this.offset] >= '0' && this.pattern[this.offset] <= '9') value = Math.min(3001, value * 10 + Number(this.pattern[this.offset++]));\n return value;\n }\n private take(character: string): boolean {\n if (this.offset === this.pattern.length || this.pattern[this.offset] !== character) return false;\n this.offset++;\n return true;\n }\n}\n"],"mappings":"A,8HAOA,IAAa,qBAAb,KAAkC,CAED,QAD7B,OAAiB,EACjB,YAAY,EAAkC,CAAjB,KAAA,QAAAA,CAAmB,CAChD,OAA4B,CAAE,OAAO,KAAK,WAAW,CAAG,CACxD,KAAa,EAAc,EAAe,EAAiC,CAAC,EAAuB,CAC/F,MAAO,CAAE,OAAM,OAAQC,EAAO,OAAQ,KAAK,OAASA,EAAO,WAAU,QAAS,EAAG,QAAS,EAAG,WAAY,CAAC,CAAE,CAChH,CACA,YAAyC,CACrC,IAAMA,EAAQ,KAAK,OACbC,EAAe,CAAC,KAAK,SAAS,CAAC,EACrC,KAAO,KAAK,KAAK,GAAG,GAAGA,EAAa,KAAK,KAAK,SAAS,CAAC,EACxD,OAAO,KAAK,KAAK,YAAaD,EAAOC,CAAY,CACrD,CACA,UAAuC,CACnC,IAAMD,EAAQ,KAAK,OACbE,EAAiC,CAAC,EACxC,KAAO,KAAK,OAAS,KAAK,QAAQ,QAAU,CAAC,KAAK,SAAS,KAAK,QAAQ,KAAK,OAAO,GAAGA,EAAS,KAAK,KAAK,WAAW,CAAC,EACtH,OAAO,KAAK,KAAK,SAAUF,EAAOE,CAAQ,CAC9C,CACA,YAAyC,CACrC,IAAMF,EAAQ,KAAK,OACbG,EAAO,KAAK,KAAK,EACnBC,EAAU,EACVC,EAAyB,KAC7B,GAAI,MAAK,KAAK,GAAG,EACZ,IAAI,KAAK,KAAK,GAAG,EAAG,EAAU,OAC9B,GAAI,KAAK,KAAK,GAAG,EAAG,EAAU,OAC9B,GAAI,KAAK,KAAK,GAAG,EAClB,EAAU,KAAK,OAAO,EACtB,EAAUD,EACN,KAAK,KAAK,GAAG,IAAG,EAAU,KAAK,QAAQ,KAAK,UAAY,IAAM,KAAO,KAAK,OAAO,GACrF,KAAK,KAAK,GAAG,OACV,OAAOD,CAAA,CAEd,OADA,KAAK,KAA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 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{MatchAmbiguity as t}from"./MatchAmbiguity.js";import{checkPortableMatchPattern as n}from"./checkPortableMatchPattern.js";import{emailMatchPattern as r,validateMatchPattern as i}from"./PortableMatchPattern.js";function matchSubject(e,t,n,r){return t===`command`?{owner:{kind:`declaration`,value:{kind:`command`,path:[...e.scope,n]}},property:r}:{owner:{kind:`declaration`,value:{kind:`concept`,path:[n]}}}}function matchArguments(e,t,n){return{subject:e.owner,...e.property===void 0?{}:{property:{kind:`text`,value:e.property}},pattern:{kind:`text`,value:t},...n===void 0?{}:{offset:{kind:`index`,value:n}}}}function validateMatchOperand(a,o,s,c,l){if(o.kind===`PathExpressionSyntax`&&o.path!==`email`){a.error(e.UnknownMatchPattern,`Named match pattern '${o.path}' is not defined; use 'email' or a quoted portable regular expression.`,s);return}let u=o.kind===`LiteralExpressionSyntax`&&typeof o.value==`string`?o.value:o.kind===`PathExpressionSyntax`?r:void 0;if(u===void 0)return;let d=n(u);if(d.replacement!==void 0){a.warning(e.DeprecatedStudioTextRulePattern,d.description,s,matchArguments(l,u));return}let f=i(u);if(f===void 0){let n=t.find(u);n!==void 0&&a.warning(e.AmbiguousMatchPattern,n.description,patternLocation(c,s,n.offset),matchArguments(l,u,n.offset));return}let p=`${f.construct} at offset ${f.offset}. ${f.suggestion??``}`.trimEnd();a.error(f.invalid?e.InvalidMatchPattern:e.PatternOutsidePortableMatchDialect,`Match pattern: ${p}`,patternLocation(c,s,f.offset),matchArguments(l,u,f.offset))}function patternLocation(e,t,n){let r=e.indexOf(`"`,t.column-1);if(r<0)return t;let i=r+1;for(let t=0;t<n&&i<e.length;t++,i++)e[i]===`\\`&&`\\"nrt`.includes(e[i+1]??`\0`)&&i++;return{...t,column:i+1}}export{matchSubject,validateMatchOperand};
|
|
2
2
|
//# sourceMappingURL=MatchOperandValidation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchOperandValidation.js","names":["owner","context","name","subject","pattern","offset","value","DiagnosticCodes","location","emailMatchPattern","check","checkPortableMatchPattern","issue","validateMatchPattern","ambiguity","MatchAmbiguity","raw","description","quote","decoded","patternOffset"],"sources":["../../../../../../Compiler/Parsing/MatchOperandValidation.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 { DiagnosticArgument } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticArgumentKind } from '../Diagnostics/DiagnosticArgumentKind';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ParserContext } from './ParserContext';\nimport { MatchAmbiguity } from './MatchAmbiguity';\nimport { checkPortableMatchPattern } from './checkPortableMatchPattern';\nimport { emailMatchPattern, validateMatchPattern } from './PortableMatchPattern';\n\nexport interface MatchSubject {\n readonly owner: DiagnosticArgument;\n readonly property?: string;\n}\n\n// The command (module, features, slice, command) or concept that owns a match rule, as the C# binder names it.\nexport function matchSubject(context: ParserContext, owner: 'command' | 'concept', name: string, property: string): MatchSubject {\n return owner === 'command'\n ? { owner: { kind: DiagnosticArgumentKind.Declaration, value: { kind: 'command', path: [...context.scope, name] } }, property }\n : { owner: { kind: DiagnosticArgumentKind.Declaration, value: { kind: 'concept', path: [name] } } };\n}\n\nfunction matchArguments(subject: MatchSubject, pattern: string, offset?: number): Readonly<Record<string, DiagnosticArgument>> {\n return {\n subject: subject.owner,\n ...(subject.property === undefined ? {} : { property: { kind: DiagnosticArgumentKind.Text, value: subject.property } }),\n pattern: { kind: DiagnosticArgumentKind.Text, value: pattern },\n ...(offset === undefined ? {} : { offset: { kind: DiagnosticArgumentKind.Index, value: offset } }),\n };\n}\n\nexport function validateMatchOperand(context: ParserContext, value: ExpressionSyntax, location: SourceLocation, raw: string, subject: MatchSubject): void {\n if (value.kind === 'PathExpressionSyntax' && value.path !== 'email') {\n context.error(DiagnosticCodes.UnknownMatchPattern, `Named match pattern '${value.path}' is not defined; use 'email' or a quoted portable regular expression.`, location);\n return;\n }\n const pattern = value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' ? value.value : value.kind === 'PathExpressionSyntax' ? emailMatchPattern : undefined;\n if (pattern === undefined) return;\n const check = checkPortableMatchPattern(pattern);\n if (check.replacement !== undefined) {\n context.warning(DiagnosticCodes.DeprecatedStudioTextRulePattern, check.description, location, matchArguments(subject, pattern));\n return;\n }\n const issue = validateMatchPattern(pattern);\n if (issue === undefined) {\n const ambiguity = MatchAmbiguity.find(pattern);\n if (ambiguity !== undefined) context.warning(DiagnosticCodes.AmbiguousMatchPattern, ambiguity.description, patternLocation(raw, location, ambiguity.offset), matchArguments(subject, pattern, ambiguity.offset));\n return;\n }\n const description = `${issue.construct} at offset ${issue.offset}. ${issue.suggestion ?? ''}`.trimEnd();\n context.error(issue.invalid ? DiagnosticCodes.InvalidMatchPattern : DiagnosticCodes.PatternOutsidePortableMatchDialect, `Match pattern: ${description}`, patternLocation(raw, location, issue.offset), matchArguments(subject, pattern, issue.offset));\n}\n\nfunction patternLocation(raw: string, location: SourceLocation, patternOffset: number): SourceLocation {\n const quote = raw.indexOf('\"', location.column - 1);\n if (quote < 0) return location;\n let offset = quote + 1;\n for (let decoded = 0; decoded < patternOffset && offset < raw.length; decoded++, offset++) {\n if (raw[offset] === '\\\\' && '\\\\\"nrt'.includes(raw[offset + 1] ?? '\\0')) offset++;\n }\n return { ...location, column: offset + 1 };\n}\n"],"mappings":"iVAmBA,SAAgB,aAAa,EAAwB,EAA8B,EAAc,EAAgC,CAC7H,OAAOA,IAAU,UACX,CAAE,MAAO,CAAE,KAAA,cAA0C,MAAO,CAAE,KAAM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U,MAAM,EAAG,eAAeX,EAASC,EAASU,EAAU,MAAM,CAAC,EAC/M,MACJ,CACA,IAAMG,EAAc,GAAGL,EAAM,UAAU,aAAaA,EAAM,OAAO,IAAIA,EAAM,YAAc,KAAK,QAAQ,EACtGX,EAAQ,MAAMW,EAAM,QAAUL,EAAgB,oBAAsBA,EAAgB,mCAAoC,kBAAkBU,IAAe,gBAAgBD,EAAKR,EAAUI,EAAM,MAAM,EAAG,eAAeT,EAASC,EAASQ,EAAM,MAAM,CAAC,CACzP,CAEA,SAAS,gBAAgB,EAAa,EAA0B,EAAuC,CACnG,IAAMM,EAAQF,EAAI,QAAQ,IAAKR,EAAS,OAAS,CAAC,EAClD,GAAIU,EAAQ,EAAG,OAAOV,EACtB,IAAIH,EAASa,EAAQ,EACrB,IAAK,IAAIC,EAAU,EAAGA,EAAUC,GAAiBf,EAASW,EAAI,OAAQ,IAAW,IACzEA,EAAIX,KAAY,MAAQ,SAAS,SAASW,EAAIX,EAAS,IAAM,IAAI,GAAG,IAE5E,MAAO,CAAE,GAAGG,EAAU,OAAQH,EAAS,CAAE,CAC7C"}
|
|
1
|
+
{"version":3,"file":"MatchOperandValidation.js","names":["owner","context","name","subject","pattern","offset","value","DiagnosticCodes","location","emailMatchPattern","check","checkPortableMatchPattern","issue","validateMatchPattern","ambiguity","MatchAmbiguity","raw","description","quote","decoded","patternOffset"],"sources":["../../../../../../Compiler/Parsing/MatchOperandValidation.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 { DiagnosticArgument } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticArgumentKind } from '../Diagnostics/DiagnosticArgumentKind';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ParserContext } from './ParserContext';\nimport { MatchAmbiguity } from './MatchAmbiguity';\nimport { checkPortableMatchPattern } from './checkPortableMatchPattern';\nimport { emailMatchPattern, validateMatchPattern } from './PortableMatchPattern';\n\nexport interface MatchSubject {\n readonly owner: DiagnosticArgument;\n readonly property?: string;\n}\n\n// The command (module, features, slice, command) or concept that owns a match rule, as the C# binder names it.\nexport function matchSubject(context: ParserContext, owner: 'command' | 'concept', name: string, property: string): MatchSubject {\n return owner === 'command'\n ? { owner: { kind: DiagnosticArgumentKind.Declaration, value: { kind: 'command', path: [...context.scope, name] } }, property }\n : { owner: { kind: DiagnosticArgumentKind.Declaration, value: { kind: 'concept', path: [name] } } };\n}\n\nfunction matchArguments(subject: MatchSubject, pattern: string, offset?: number): Readonly<Record<string, DiagnosticArgument>> {\n return {\n subject: subject.owner,\n ...(subject.property === undefined ? {} : { property: { kind: DiagnosticArgumentKind.Text, value: subject.property } }),\n pattern: { kind: DiagnosticArgumentKind.Text, value: pattern },\n ...(offset === undefined ? {} : { offset: { kind: DiagnosticArgumentKind.Index, value: offset } }),\n };\n}\n\nexport function validateMatchOperand(context: ParserContext, value: ExpressionSyntax, location: SourceLocation, raw: string, subject: MatchSubject): void {\n if (value.kind === 'PathExpressionSyntax' && value.path !== 'email') {\n context.error(DiagnosticCodes.UnknownMatchPattern, `Named match pattern '${value.path}' is not defined; use 'email' or a quoted portable regular expression.`, location);\n return;\n }\n const pattern = value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' ? value.value : value.kind === 'PathExpressionSyntax' ? emailMatchPattern : undefined;\n if (pattern === undefined) return;\n const check = checkPortableMatchPattern(pattern);\n if (check.replacement !== undefined) {\n context.warning(DiagnosticCodes.DeprecatedStudioTextRulePattern, check.description, location, matchArguments(subject, pattern));\n return;\n }\n const issue = validateMatchPattern(pattern);\n if (issue === undefined) {\n const ambiguity = MatchAmbiguity.find(pattern);\n if (ambiguity !== undefined) context.warning(DiagnosticCodes.AmbiguousMatchPattern, ambiguity.description, patternLocation(raw, location, ambiguity.offset), matchArguments(subject, pattern, ambiguity.offset));\n return;\n }\n const description = `${issue.construct} at offset ${issue.offset}. ${issue.suggestion ?? ''}`.trimEnd();\n context.error(issue.invalid ? DiagnosticCodes.InvalidMatchPattern : DiagnosticCodes.PatternOutsidePortableMatchDialect, `Match pattern: ${description}`, patternLocation(raw, location, issue.offset), matchArguments(subject, pattern, issue.offset));\n}\n\nfunction patternLocation(raw: string, location: SourceLocation, patternOffset: number): SourceLocation {\n const quote = raw.indexOf('\"', location.column - 1);\n if (quote < 0) return location;\n let offset = quote + 1;\n for (let decoded = 0; decoded < patternOffset && offset < raw.length; decoded++, offset++) {\n if (raw[offset] === '\\\\' && '\\\\\"nrt'.includes(raw[offset + 1] ?? '\\0')) offset++;\n }\n return { ...location, column: offset + 1 };\n}\n"],"mappings":"A,iVAmBA,SAAgB,aAAa,EAAwB,EAA8B,EAAc,EAAgC,CAC7H,OAAOA,IAAU,UACX,CAAE,MAAO,CAAE,KAAA,cAA0C,MAAO,CAAE,KAAM,UAAW,KAAM,CAAC,GAAGC,EAAQ,MAAOC,CAAI,CAAE,CAAE,EAAG,UAAS,EAC5H,CAAE,MAAO,CAAE,KAAA,cAA0C,MAAO,CAAE,KAAM,UAAW,KAAM,CAACA,CAAI,CAAE,CAAE,CAAE,CAC1G,CAEA,SAAS,eAAe,EAAuB,EAAiB,EAA+D,CAC3H,MAAO,CACH,QAASC,EAAQ,MACjB,GAAIA,EAAQ,WAAa,IAAA,GAAY,CAAC,EAAI,CAAE,SAAU,CAAE,KAAA,OAAmC,MAAOA,EAAQ,QAAS,CAAE,EACrH,QAAS,CAAE,KAAA,OAAmC,MAAOC,CAAQ,EAC7D,GAAIC,IAAW,IAAA,GAAY,CAAC,EAAI,CAAE,OAAQ,CAAE,KAAA,QAAoC,MAAOA,CAAO,CAAE,CACpG,CACJ,CAEA,SAAgB,qBAAqB,EAAwB,EAAyB,EAA0B,EAAa,EAA6B,CACtJ,GAAIC,EAAM,OAAS,wBAA0BA,EAAM,OAAS,QAAS,CACjEL,EAAQ,MAAMM,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AAE,GAAGG,EAAU,OAAQH,EAAS,CAAE,CAC7C,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{combineAuthorize as n,parseAuthorize as r,recordAuthorizationRefusal as i}from"./AuthorizeParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{parsePurposeReference as o}from"./PurposeParser.js";import{parseDocumentation as s}from"./DocumentationParser.js";import{parseDependsOn as c}from"./DependsOnParser.js";import{parseFeature as l}from"./FeatureBody.js";import{parseFileImport as u}from"./FileImportParser.js";import{parseToolbar as d}from"./ScreenParser.js";import{collectInputUses as f}from"./InputUses.js";import{firstWord as p}from"./LineText.js";import{parseExample as m}from"./SpecificationExampleParser.js";import{misplacedReactionIdentity as h}from"./ReactionIdentityParser.js";import{locationOf as g}from"./SourceLine.js";const _=t(`^module\\s+([A-Za-z_]\\w*)$`),v=/* @__PURE__ */ new Set([`on`,`uses`,`screen`,`dialog`,`form`,`contribute`,`navigation`,`template`]),y=`description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, toolbar, navigation, feature, example, 'on <trigger>' or 'uses <Behavior>'`;var ModuleBody=class{name;#e=[];#t=[];#n=[];#r=[];#i=[];#a=[];#o=null;#s=null;#c=null;#l=!1;constructor(e){this.name=e}tryParse(t,g){let _=p(g.content);switch(_){case`runs`:return h(t,g),!0;case`description`:return this.#o=a(t,g,this.#o,`Module '${this.name}'`),!0;case`documentation`:return this.#s=s(t,g,this.#s,`Module '${this.name}'`),!0;case`depends`:return c(t,g,this.#r,e.UnknownModuleDirective),!0;case`purpose`:return o(t,g,this.#i),!0;case`authorize`:{let a=t.diagnostics.length,o=r(t,g);if(o===null&&t.diagnostics.slice(a).some(t=>t.code===e.ConditionDepthExceeded)&&(this.#c=null,this.#l=!0),!this.#l){let e=this.#c;this.#c=n(this.#c,o,t),this.#l=e!==null&&this.#c===null}return this.#l&&i(this.#n),!0}case`import`:return u(t,g,this.#n),!0;case`example`:return this.#t.push(m(t,g)),!0;case`toolbar`:return this.#a.push(d(t,g)),!0;case`feature`:return this.#e.push(l(t,g)),!0;default:return v.has(_)?(f(t,g),!0):!1}}parseChildren(t,n){for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),this.tryParse(t,r)||(t.error(e.UnknownModuleDirective,`Unexpected '${p(r.content)}' in module body - expected ${y}`,g(r)),t.skipBlock(r.indent))}build(e,t=!1){return{kind:`ModuleSyntax`,name:this.name,description:this.#o,documentation:this.#s,authorize:this.#c,dependsOn:this.#r,purposes:this.#i,...this.#a.length>0?{toolbars:this.#a}:{},features:this.#e,examples:this.#t,fileImports:this.#n,isPlacement:t,location:e}}};function parseModule(t,n){let r=_.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidModuleDeclaration,`Invalid module declaration '${n.content}' - expected 'module <Name>'`,g(n));let i=new ModuleBody(r),a=t.scope;return t.scope=[r],i.parseChildren(t,n),t.scope=a,i.build(g(n))}export{ModuleBody,y as moduleBodyExpected,_ as modulePattern,parseModule};
|
|
2
2
|
//# sourceMappingURL=ModuleBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleBody.js","names":["modulePattern","pattern","opaqueModuleMembers","moduleBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","#authorize","combineAuthorize","parseAuthorize","parseFileImport","#fileImports","#examples","parseExample","#toolbars","parseToolbar","#features","parseFeature","collectInputUses","child","locationOf","body","previous"],"sources":["../../../../../../Compiler/Parsing/ModuleBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { ScreenToolbarSyntax } from '../Syntax/Screens';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFeature } from './FeatureBody';\nimport { parseFileImport } from './FileImportParser';\nimport { parseToolbar } from './ScreenParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { parseExample } from './SpecificationExampleParser';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const modulePattern = pattern('^module\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Module members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueModuleMembers = new Set(['on', 'uses', 'screen', 'dialog', 'form', 'contribute', 'navigation', 'template']);\n\n// What a module body may hold, as it reads in a diagnostic.\nexport const moduleBodyExpected = 'description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, toolbar, navigation, feature, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a module - written beneath a 'module' header, or at the top level of a file imported\n// into the module. The port of the C# ModuleBody.\nexport class ModuleBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n readonly #toolbars: ScreenToolbarSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a module body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Module '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Module '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownModuleDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'toolbar':\n this.#toolbars.push(parseToolbar(context, line));\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n default:\n if (opaqueModuleMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Parses the children of a header line into this body, reporting what does not belong in a module.\n parseChildren(context: ParserContext, line: SourceLine): void {\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!this.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownModuleDirective, `Unexpected '${firstWord(child.content)}' in module body - expected ${moduleBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n }\n\n // Builds the module, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): ModuleSyntax {\n return {\n kind: 'ModuleSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n ...(this.#toolbars.length > 0 ? { toolbars: this.#toolbars } : {}),\n features: this.#features,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a module from its already consumed header line.\nexport function parseModule(context: ParserContext, line: SourceLine): ModuleSyntax {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidModuleDeclaration, `Invalid module declaration '${line.content}' - expected 'module <Name>'`, locationOf(line));\n }\n const body = new ModuleBody(name);\n const previous = context.scope;\n context.scope = [name];\n body.parseChildren(context, line);\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"q4BA0BA,MAAaA,EAAgBC,EAAQ,6BAA6B,EAG5DC,kBAAsB,IAAI,IAAI,CAAC,KAAM,OAAQ,SAAU,SAAU,OAAQ,aAAc,aAAc,UAAU,CAAC,EAGzGC,EAAqB,mMAIlC,IAAa,WAAb,KAAwB,CAWC,KAVrB,GAAsC,CAAC,EACvC,GAAmD,CAAC,EACpD,GAA4C,CAAC,EAC7C,GAAyC,CAAC,EAC1C,GAA+C,CAAC,EAChD,GAA4C,CAAC,EAC7C,GAA8B,KAC9B,GAAgC,KAChC,GAAqC,KAErC,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAIpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAUC,EAAUC,EAAK,OAAO,EACtC,OAAQF,EAAR,CACI,IAAK,OAED,OADAG,EAA0BC,EAASF,CAAI,EAChC,GACX,IAAK,cAED,MADA,MAAKG,GAAeC,EAAiBF,EAASF,EAAM,KAAKG,GAAc,WAAW,KAAK,KAAK,EAAE,EACvF,GACX,IAAK,gBAED,MADA,MAAKE,GAAiBC,EAAmBJ,EAASF,EAAM,KAAKK,GAAgB,WAAW,KAAK,KAAK,EAAE,EAC7F,GACX,IAAK,UAED,OADAE,EAAeL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AAa,KAAKD,GAClB,cACA,UACJ,CACJ,CACJ,EAGA,SAAgB,YAAY,EAAwB,EAAgC,CAChF,IAAMnB,EAAOJ,EAAc,KAAKO,EAAK,OAAO,CAAC,GAAG,IAAM,GAClDH,IAAS,IACTK,EAAQ,MAAMO,EAAgB,yBAA0B,+BAA+BT,EAAK,QAAQ,8BAA+ByB,EAAWzB,CAAI,CAAC,EAEvJ,IAAM0B,EAAO,IAAI,WAAW7B,CAAI,EAC1B8B,EAAWzB,EAAQ,MAIzB,MAHA,GAAQ,MAAQ,CAACL,CAAI,EACrB6B,EAAK,cAAcxB,EAASF,CAAI,EAChC,EAAQ,MAAQ2B,EACTD,EAAK,MAAMD,EAAWzB,CAAI,CAAC,CACtC"}
|
|
1
|
+
{"version":3,"file":"ModuleBody.js","names":["modulePattern","pattern","opaqueModuleMembers","moduleBodyExpected","name","keyword","firstWord","line","misplacedReactionIdentity","context","#description","parseDescription","#documentation","parseDocumentation","parseDependsOn","#dependsOn","DiagnosticCodes","parsePurposeReference","#purposes","diagnosticCount","next","parseAuthorize","diagnostic","#authorize","#authorizationDepthExceeded","previous","combineAuthorize","recordAuthorizationRefusal","#fileImports","parseFileImport","#examples","parseExample","#toolbars","parseToolbar","#features","parseFeature","collectInputUses","child","locationOf","body"],"sources":["../../../../../../Compiler/Parsing/ModuleBody.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { ScreenToolbarSyntax } from '../Syntax/Screens';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize, recordAuthorizationRefusal } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFeature } from './FeatureBody';\nimport { parseFileImport } from './FileImportParser';\nimport { parseToolbar } from './ScreenParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { parseExample } from './SpecificationExampleParser';\nimport { ParserContext } from './ParserContext';\nimport { misplacedReactionIdentity } from './ReactionIdentityParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const modulePattern = pattern('^module\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Module members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueModuleMembers = new Set(['on', 'uses', 'screen', 'dialog', 'form', 'contribute', 'navigation', 'template']);\n\n// What a module body may hold, as it reads in a diagnostic.\nexport const moduleBodyExpected = 'description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, toolbar, navigation, feature, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a module - written beneath a 'module' header, or at the top level of a file imported\n// into the module. The port of the C# ModuleBody.\nexport class ModuleBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n readonly #toolbars: ScreenToolbarSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n #authorizationDepthExceeded = false;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a module body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'runs':\n misplacedReactionIdentity(context, line);\n return true;\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Module '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Module '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownModuleDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize': {\n const diagnosticCount = context.diagnostics.length;\n const next = parseAuthorize(context, line);\n if (next === null && context.diagnostics.slice(diagnosticCount).some(diagnostic => diagnostic.code === DiagnosticCodes.ConditionDepthExceeded)) {\n this.#authorize = null;\n this.#authorizationDepthExceeded = true;\n }\n if (!this.#authorizationDepthExceeded) {\n const previous = this.#authorize;\n this.#authorize = combineAuthorize(this.#authorize, next, context);\n this.#authorizationDepthExceeded = previous !== null && this.#authorize === null;\n }\n if (this.#authorizationDepthExceeded) recordAuthorizationRefusal(this.#fileImports);\n return true;\n }\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'toolbar':\n this.#toolbars.push(parseToolbar(context, line));\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n default:\n if (opaqueModuleMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Parses the children of a header line into this body, reporting what does not belong in a module.\n parseChildren(context: ParserContext, line: SourceLine): void {\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!this.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownModuleDirective, `Unexpected '${firstWord(child.content)}' in module body - expected ${moduleBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n }\n\n // Builds the module, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): ModuleSyntax {\n return {\n kind: 'ModuleSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n ...(this.#toolbars.length > 0 ? { toolbars: this.#toolbars } : {}),\n features: this.#features,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a module from its already consumed header line.\nexport function parseModule(context: ParserContext, line: SourceLine): ModuleSyntax {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidModuleDeclaration, `Invalid module declaration '${line.content}' - expected 'module <Name>'`, locationOf(line));\n }\n const body = new ModuleBody(name);\n const previous = context.scope;\n context.scope = [name];\n body.parseChildren(context, line);\n context.scope = previous;\n return body.build(locationOf(line));\n}\n"],"mappings":"A,q6BA0BA,MAAaA,EAAgBC,EAAQ,6BAA6B,EAG5DC,kBAAsB,IAAI,IAAI,CAAC,KAAM,OAAQ,SAAU,SAAU,OAAQ,aAAc,aAAc,UAAU,CAAC,EAGzGC,EAAqB,mMAIlC,IAAa,WAAb,KAAwB,CAYC,KAXrB,GAAsC,CAAC,EACvC,GAAmD,CAAC,EACpD,GAA4C,CAAC,EAC7C,GAAyC,CAAC,EAC1C,GAA+C,CAAC,EAChD,GAA4C,CAAC,EAC7C,GAA8B,KAC9B,GAAgC,KAChC,GAAqC,KACrC,GAA8B,GAE9B,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAIpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAUC,EAAUC,EAAK,OAAO,EACtC,OAAQF,EAAR,CACI,IAAK,OAED,OADAG,EAA0BC,EAASF,CAAI,EAChC,GACX,IAAK,cAED,MADA,MAAKG,GAAeC,EAAiBF,EAASF,EAAM,KAAKG,GAAc,WAAW,KAAK,KAAK,EAAE,EACvF,GACX,IAAK,gBAED,MADA,MAAKE,GAAiBC,EAAmBJ,EAASF,EAAM,KAAKK,GAAgB,WAAW,KAAK,KAAK,EAAE,EAC7F,GACX,IAAK,UAED,OADAE,EAAeL,EAASF,EAAM,KAAKQ,GAAYC,EAAgB,sBAAsB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5B,EAAQ,UAAU4B,EAAM,MAAM,EAG1C,CAGA,MAAM,EAA0B,EAAc,GAAqB,CAC/D,MAAO,CACH,KAAM,eACN,KAAM,KAAK,KACX,YAAa,KAAK3B,GAClB,cAAe,KAAKE,GACpB,UAAW,KAAKW,GAChB,UAAW,KAAKR,GAChB,SAAU,KAAKG,GACf,GAAI,KAAKc,GAAU,OAAS,EAAI,CAAE,SAAU,KAAKA,EAAU,EAAI,CAAC,EAChE,SAAU,KAAKE,GACf,SAAU,KAAKJ,GACf,YAAa,KAAKF,GAClB,cACA,UACJ,CACJ,CACJ,EAGA,SAAgB,YAAY,EAAwB,EAAgC,CAChF,IAAMxB,EAAOJ,EAAc,KAAKO,EAAK,OAAO,CAAC,GAAG,IAAM,GAClDH,IAAS,IACTK,EAAQ,MAAMO,EAAgB,yBAA0B,+BAA+BT,EAAK,QAAQ,8BAA+B+B,EAAW/B,CAAI,CAAC,EAEvJ,IAAMgC,EAAO,IAAI,WAAWnC,CAAI,EAC1BqB,EAAWhB,EAAQ,MAIzB,MAHA,GAAQ,MAAQ,CAACL,CAAI,EACrBmC,EAAK,cAAc9B,EAASF,CAAI,EAChC,EAAQ,MAAQkB,EACTc,EAAK,MAAMD,EAAW/B,CAAI,CAAC,CACtC,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{sourceStreamPattern as t}from"../Text/SourceStreamNames.js";import{locationOf as n}from"./SourceLine.js";const r=t(`^from\\s+([A-Za-z_]\\w*)(?:\\.([A-Za-z_]\\w*))?$`);function parseObserverFilter(t,i,a){let o=r.exec(i.content);o===null||a!==null?t.error(e.InvalidObserverFilter,`Declare at most one 'from <Source>[.<Stream>]' observer filter.`,n(i)):a={kind:`ObserverFilterSyntax`,eventSource:o[1],stream:o[2]??null,location:n(i)};let s=t.peekChild(i.indent);return s!==void 0&&(t.error(e.InvalidObserverFilter,`An observer filter cannot have children or filter stream ids.`,n(s)),t.skipBlock(i.indent)),a}export{parseObserverFilter};
|
|
2
2
|
//# sourceMappingURL=ObserverFilterParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserverFilterParser.js","names":["header","sourceStreamPattern","match","line","previous","context","DiagnosticCodes","locationOf","child"],"sources":["../../../../../../Compiler/Parsing/ObserverFilterParser.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 { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = sourceStreamPattern('^from\\\\s+([A-Za-z_]\\\\w*)(?:\\\\.([A-Za-z_]\\\\w*))?$');\n\nexport function parseObserverFilter(context: ParserContext, line: SourceLine, previous: ObserverFilterSyntax | null): ObserverFilterSyntax | null {\n const match = header.exec(line.content);\n if (match === null || previous !== null) {\n context.error(DiagnosticCodes.InvalidObserverFilter, \"Declare at most one 'from <Source>[.<Stream>]' observer filter.\", locationOf(line));\n } else {\n previous = { kind: 'ObserverFilterSyntax', eventSource: match[1], stream: match[2] ?? null, location: locationOf(line) };\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidObserverFilter, 'An observer filter cannot have children or filter stream ids.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return previous;\n}\n"],"mappings":"yOASA,MAAMA,EAASC,EAAoB,kDAAkD,EAErF,SAAgB,oBAAoB,EAAwB,EAAkB,EAAoE,CAC9I,IAAMC,EAAQF,EAAO,KAAKG,EAAK,OAAO,EAClCD,IAAU,MAAQE,IAAa,KAC/BC,EAAQ,MAAMC,EAAgB,sBAAuB,kEAAmEC,EAAWJ,CAAI,CAAC,EAExI,EAAW,CAAE,KAAM,uBAAwB,YAAaD,EAAM,GAAI,OAAQA,EAAM,IAAM,KAAM,SAAUK,EAAWJ,CAAI,CAAE,EAE3H,IAAMK,EAAQH,EAAQ,UAAUF,EAAK,MAAM,EAK3C,OAJIK,IAAU,IAAA,KACVH,EAAQ,MAAMC,EAAgB,sBAAuB,gEAAiEC,EAAWC,CAAK,CAAC,EACvIH,EAAQ,UAAUF,EAAK,MAAM,GAE1BC,CACX"}
|
|
1
|
+
{"version":3,"file":"ObserverFilterParser.js","names":["header","sourceStreamPattern","match","line","previous","context","DiagnosticCodes","locationOf","child"],"sources":["../../../../../../Compiler/Parsing/ObserverFilterParser.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 { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = sourceStreamPattern('^from\\\\s+([A-Za-z_]\\\\w*)(?:\\\\.([A-Za-z_]\\\\w*))?$');\n\nexport function parseObserverFilter(context: ParserContext, line: SourceLine, previous: ObserverFilterSyntax | null): ObserverFilterSyntax | null {\n const match = header.exec(line.content);\n if (match === null || previous !== null) {\n context.error(DiagnosticCodes.InvalidObserverFilter, \"Declare at most one 'from <Source>[.<Stream>]' observer filter.\", locationOf(line));\n } else {\n previous = { kind: 'ObserverFilterSyntax', eventSource: match[1], stream: match[2] ?? null, location: locationOf(line) };\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidObserverFilter, 'An observer filter cannot have children or filter stream ids.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return previous;\n}\n"],"mappings":"A,yOASA,MAAMA,EAASC,EAAoB,kDAAkD,EAErF,SAAgB,oBAAoB,EAAwB,EAAkB,EAAoE,CAC9I,IAAMC,EAAQF,EAAO,KAAKG,EAAK,OAAO,EAClCD,IAAU,MAAQE,IAAa,KAC/BC,EAAQ,MAAMC,EAAgB,sBAAuB,kEAAmEC,EAAWJ,CAAI,CAAC,EAExI,EAAW,CAAE,KAAM,uBAAwB,YAAaD,EAAM,GAAI,OAAQA,EAAM,IAAM,KAAM,SAAUK,EAAWJ,CAAI,CAAE,EAE3H,IAAMK,EAAQH,EAAQ,UAAUF,EAAK,MAAM,EAK3C,OAJIK,IAAU,IAAA,KACVH,EAAQ,MAAMC,EAAgB,sBAAuB,gEAAiEC,EAAWC,CAAK,CAAC,EACvIH,EAAQ,UAAUF,EAAK,MAAM,GAE1BC,CACX,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserverFilterValidator.js","names":["catalog","EventSourceCatalog","application","filter","context","DiagnosticCodes","resolver","reaction","slice","trigger","reducer","dependencySourcesOf"],"sources":["../../../../../../Compiler/Parsing/ObserverFilterValidator.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 { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { EventSourceCatalog, EventSourceResolutionKind } from '../Syntax/EventSourceCatalog';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validateObserverFilters(application: ApplicationSyntax, context: ParserContext, resolver: AuthoringProductionResolver): void {\n const catalog = new EventSourceCatalog(application);\n const resolve = (filter: ObserverFilterSyntax): boolean => {\n const resolution = catalog.resolve(filter.eventSource, filter.stream ?? undefined);\n if (resolution.kind === EventSourceResolutionKind.Unique) return true;\n context.error(DiagnosticCodes.InvalidObserverFilter, 'An observer filter must name one physical event source and, when supplied, one stream belonging to it.', filter.location);\n return false;\n };\n for (const { slice } of resolver.slices) {\n for (const reaction of slice.reactions) {\n if (reaction.from == null || !resolve(reaction.from)) continue;\n for (const trigger of reaction.triggers) {\n if (trigger.source.kind !== 'NamedTriggerSourceSyntax' || resolver.resolve(trigger.source.name, slice).declaration?.node.kind !== 'EventSyntax')\n context.error(DiagnosticCodes.InvalidObserverFilter, \"A filtered reaction requires only 'when <Event>' triggers on declared events.\", trigger.location);\n }\n }\n for (const reducer of dependencySourcesOf(slice).reducers ?? []) {\n if (reducer.from != null) resolve(reducer.from);\n }\n }\n}\n"],"mappings":"mQAWA,SAAgB,wBAAwB,EAAgC,EAAwB,EAA6C,CACzI,IAAMA,EAAU,IAAIC,EAAmBC,CAAW,EAC5C,QAAW,GACMF,EAAQ,QAAQG,EAAO,YAAaA,EAAO,QAAU,IAAA,EAC3D,CAAC,CAAC,OAAA,WACfC,EAAQ,MAAMC,EAAgB,sBAAuB,yGAA0GF,EAAO,QAAQ,EACvK,IAEX,IAAK,GAAM,CAAE,WAAWG,EAAS,OAAQ,CACrC,IAAK,IAAMC,KAAYC,EAAM,UACzB,GAAID,EAAS,MAAQ,MAAS,QAAQA,EAAS,IAAI,EACnD,IAAK,IAAME,KAAWF,EAAS,UACvBE,EAAQ,OAAO,OAAS,4BAA8BH,EAAS,QAAQG,EAAQ,OAAO,KAAMD,CAAK,CAAC,CAAC,aAAa,KAAK,OAAS,gBAC9HJ,EAAQ,MAAMC,EAAgB,sBAAuB,gFAAiFI,EAAQ,QAAQ,EAGlK,IAAK,IAAMC,KAAWC,EAAoBH,CAAK,CAAC,CAAC,UAAY,CAAC,EACtDE,EAAQ,MAAQ,MAAM,QAAQA,EAAQ,IAAI,CAEtD,CACJ"}
|
|
1
|
+
{"version":3,"file":"ObserverFilterValidator.js","names":["catalog","EventSourceCatalog","application","filter","context","DiagnosticCodes","resolver","reaction","slice","trigger","reducer","dependencySourcesOf"],"sources":["../../../../../../Compiler/Parsing/ObserverFilterValidator.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 { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { EventSourceCatalog, EventSourceResolutionKind } from '../Syntax/EventSourceCatalog';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validateObserverFilters(application: ApplicationSyntax, context: ParserContext, resolver: AuthoringProductionResolver): void {\n const catalog = new EventSourceCatalog(application);\n const resolve = (filter: ObserverFilterSyntax): boolean => {\n const resolution = catalog.resolve(filter.eventSource, filter.stream ?? undefined);\n if (resolution.kind === EventSourceResolutionKind.Unique) return true;\n context.error(DiagnosticCodes.InvalidObserverFilter, 'An observer filter must name one physical event source and, when supplied, one stream belonging to it.', filter.location);\n return false;\n };\n for (const { slice } of resolver.slices) {\n for (const reaction of slice.reactions) {\n if (reaction.from == null || !resolve(reaction.from)) continue;\n for (const trigger of reaction.triggers) {\n if (trigger.source.kind !== 'NamedTriggerSourceSyntax' || resolver.resolve(trigger.source.name, slice).declaration?.node.kind !== 'EventSyntax')\n context.error(DiagnosticCodes.InvalidObserverFilter, \"A filtered reaction requires only 'when <Event>' triggers on declared events.\", trigger.location);\n }\n }\n for (const reducer of dependencySourcesOf(slice).reducers ?? []) {\n if (reducer.from != null) resolve(reducer.from);\n }\n }\n}\n"],"mappings":"A,mQAWA,SAAgB,wBAAwB,EAAgC,EAAwB,EAA6C,CACzI,IAAMA,EAAU,IAAIC,EAAmBC,CAAW,EAC5C,QAAW,GACMF,EAAQ,QAAQG,EAAO,YAAaA,EAAO,QAAU,IAAA,EAC3D,CAAC,CAAC,OAAA,WACfC,EAAQ,MAAMC,EAAgB,sBAAuB,yGAA0GF,EAAO,QAAQ,EACvK,IAEX,IAAK,GAAM,CAAE,WAAWG,EAAS,OAAQ,CACrC,IAAK,IAAMC,KAAYC,EAAM,UACzB,GAAID,EAAS,MAAQ,MAAS,QAAQA,EAAS,IAAI,EACnD,IAAK,IAAME,KAAWF,EAAS,UACvBE,EAAQ,OAAO,OAAS,4BAA8BH,EAAS,QAAQG,EAAQ,OAAO,KAAMD,CAAK,CAAC,CAAC,aAAa,KAAK,OAAS,gBAC9HJ,EAAQ,MAAMC,EAAgB,sBAAuB,gFAAiFI,EAAQ,QAAQ,EAGlK,IAAK,IAAMC,KAAWC,EAAoBH,CAAK,CAAC,CAAC,UAAY,CAAC,EACtDE,EAAQ,MAAQ,MAAM,QAAQA,EAAQ,IAAI,CAEtD,CACJ,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{parseDescription as n}from"./DescriptionParser.js";import{parseMappingSource as r}from"./ExpressionParser.js";import{isFileDirective as i}from"./FileReferences.js";import{parseCode as a,parseFile as o,parseImplementationWrapper as s}from"./ImplementationParser.js";import{firstWord as c}from"./LineText.js";import{parseProperty as l,tryParseProperty as u}from"./PropertyLineParser.js";import{locationOf as d}from"./SourceLine.js";import{parseStructuredValue as f,trailingMarker as p}from"./StructuredBlockParser.js";const m=t(`^system\\s+([A-Za-z_]\\w*)$`),h=t(`^operation\\s+([A-Za-z_]\\w*)$`),g=t(`^produces\\s+operation\\s+([A-Za-z_]\\w*)$`),_=t(`^uses\\s+([A-Za-z_]\\w*)$`),v=t(`^(.+?)\\s*=(?!=|>)\\s*(.+)$`),y=/* @__PURE__ */ new Set([`for`,`tag`,`generation`,`origin`,`documentation`,`namespace`,`sequence`,`correlation`,`causation`,`causedBy`,`occurred`]);function rejectOperationChildren(e,t,n,r){let i=e.peekChild(t.indent);i!==void 0&&(e.error(n,r,d(i)),e.skipBlock(t.indent))}function parseSystem(t,r){let i=m.exec(r.content);i===null&&t.error(e.InvalidSystemDeclaration,`Expected 'system <Name>'.`,d(r));let a=null;for(let o=t.peekChild(r.indent);o!==void 0;o=t.peekChild(r.indent))t.reader.takeSignificant(),c(o.content)===`description`?a=n(t,o,a,`System '${i?.[1]??``}'`):(t.error(e.InvalidSystemDeclaration,`A system accepts only a description; abilities are not supported.`,d(o)),t.skipBlock(o.indent));return{kind:`SystemSyntax`,name:i?.[1]??``,description:a,location:d(r)}}function parseOperation(t,i,a=!1){let o=(a?g:h).exec(i.content),s=o?.[1]??``;o===null&&t.error(e.InvalidOperationDeclaration,`Expected an operation declaration with one name.`,d(i));let m=null,b=null,x=d(i),S=null,C=null,w=[],T=[],E=/* @__PURE__ */ new Set;for(let o=t.peekChild(i.indent);o!==void 0;o=t.peekChild(i.indent)){t.reader.takeSignificant();let i=v.exec(o.content),h=a&&i===null?p(o.content):void 0,g=o;a&&i!==null?g={...o,content:i[1].trimEnd()}:h!==void 0&&(g={...o,content:o.content.substring(0,o.content.length-h.length-1)});let D=a&&i===null&&(h!==void 0||t.peekChild(o.indent)!==void 0);if(i===null&&y.has(c(o.content)))t.error(e.InvalidOperationDeclaration,`Operations cannot declare event routing or metadata; escape a keyword-named input with @.`,d(o)),t.skipBlock(o.indent);else if(!_.test(o.content)&&u(g)!==void 0){let n=l(t,g);a&&i===null&&!D&&t.error(e.InvalidOperationMapping,`An inline operation input requires '<property> <Type> = <source>'.`,d(o)),n.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not operation inputs (decision 0008: one data subject per event).`,d(o)),(n.isIdentifier||n.isGenerated)&&t.error(e.InvalidOperationDeclaration,`Operation inputs cannot be identifier or generated properties.`,d(o)),E.has(n.name)&&t.error(e.DuplicateDeclaration,`Operation '${s}' already declares input '${n.name}'.`,d(o)),E.add(n.name),w.push(n),a&&i!==null&&T.push({kind:`PropertyMappingSyntax`,property:n.name,source:r(i[2],{...d(o),column:o.indent+o.content.length-i[2].length+1},t),location:d(o)}),D&&T.push({kind:`PropertyMappingSyntax`,property:n.name,source:f(t,o,h),location:d(o)}),rejectOperationChildren(t,o,e.InvalidOperationDeclaration,`An operation input cannot have children.`)}else if(c(o.content)===`description`)m=n(t,o,m,`Operation '${s}'`);else if(_.test(o.content))b===null?(b=_.exec(o.content)[1],x={...d(o),column:d(o).column+o.content.indexOf(b,4)}):t.error(e.InvalidSystemReference,`An operation declares exactly one 'uses <System>'.`,d(o)),rejectOperationChildren(t,o,e.InvalidSystemReference,`A system reference cannot have children.`);else if(o.content===`execute`||o.content===`compensate`){let n=parseOperationPhase(t,o);o.content===`execute`?S===null?S=n:t.error(e.InvalidOperationDeclaration,`An operation declares execute at most once.`,d(o)):C===null?C=n:t.error(e.InvalidOperationDeclaration,`An operation declares compensate at most once.`,d(o))}else t.error(e.InvalidOperationDeclaration,`Unexpected '${o.content}' in operation - expected uses, an input, description, execute or compensate.`,d(o)),t.skipBlock(o.indent)}return b===null&&t.error(e.InvalidSystemReference,`An operation requires exactly one 'uses <System>'.`,d(i)),{operation:{kind:`OperationSyntax`,name:s,uses:b??``,usesLocation:x,inputs:w,description:m,execute:S,compensate:C,location:d(i)},mappings:T}}function parseOperationPhase(t,r){let l=null,u=null,f=null,p=null,m=!1;for(let h=t.peekChild(r.indent);h!==void 0;h=t.peekChild(r.indent))if(t.reader.takeSignificant(),c(h.content)===`description`)l=n(t,h,l,`Operation phase '${r.content}'`);else if(c(h.content)===`implementation`){m&&t.error(e.ConflictingImplementationSources,`A phase cannot mix wrapped and direct sources or repeat its wrapper.`,d(h));let n=s(t,h);m||(u=n.file,f=n.code,p=n.implementation),m=!0}else if(i(h)||h.content.startsWith("```")){m&&t.error(e.ConflictingImplementationSources,`A phase has at most one file or inline payload.`,d(h));let n=i(h)?o(t,h):null,r=n===null?a(t,h):null;m||(u=n,f=r),m=!0,n!==null&&rejectOperationChildren(t,h,e.InvalidImplementationBlock,`A file directive cannot have children.`)}else t.error(e.InvalidOperationDeclaration,`A phase accepts description, file, a tagged fence or implementation.`,d(h)),t.skipBlock(h.indent);return{kind:`OperationPhaseSyntax`,description:l,file:u,code:f,implementation:p,location:d(r)}}export{parseOperation,parseSystem,rejectOperationChildren};
|
|
2
2
|
//# sourceMappingURL=OperationParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationParser.js","names":["systemHeader","pattern","operationHeader","inlineHeader","usesPattern","typedMapping","eventMetadata","child","context","line","code","message","locationOf","match","header","DiagnosticCodes","description","firstWord","parseDescription","inline","name","uses","usesLocation","execute","compensate","inputs","mappings","names","typed","marker","trailingMarker","propertyLine","structured","tryParseProperty","property","parseProperty","parseMappingSource","parseStructuredValue","phase","file","implementation","sourceSelected","source","parseImplementationWrapper","isFileDirective","parsedFile","parseFile","parsedCode","parseCode"],"sources":["../../../../../../Compiler/Parsing/OperationParser.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 { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { OperationPhaseSyntax, OperationSyntax, SystemSyntax } from '../Syntax/Operations';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseCode, parseFile, parseImplementationWrapper } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseStructuredValue, trailingMarker } from './StructuredBlockParser';\n\nconst systemHeader = pattern('^system\\\\s+([A-Za-z_]\\\\w*)$');\nconst operationHeader = pattern('^operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst inlineHeader = pattern('^produces\\\\s+operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst usesPattern = pattern('^uses\\\\s+([A-Za-z_]\\\\w*)$');\nconst typedMapping = pattern('^(.+?)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst eventMetadata = new Set(['for', 'tag', 'generation', 'origin', 'documentation', 'namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);\n\nexport function rejectOperationChildren(context: ParserContext, line: SourceLine, code: string, message: string): void {\n const child = context.peekChild(line.indent);\n if (child === undefined) return;\n context.error(code, message, locationOf(child));\n context.skipBlock(line.indent);\n}\n\nexport function parseSystem(context: ParserContext, header: SourceLine): SystemSyntax {\n const match = systemHeader.exec(header.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSystemDeclaration, \"Expected 'system <Name>'.\", locationOf(header));\n let description: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') description = parseDescription(context, child, description, `System '${match?.[1] ?? ''}'`);\n else {\n context.error(DiagnosticCodes.InvalidSystemDeclaration, 'A system accepts only a description; abilities are not supported.', locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'SystemSyntax', name: match?.[1] ?? '', description, location: locationOf(header) };\n}\n\nexport function parseOperation(context: ParserContext, header: SourceLine, inline = false): { operation: OperationSyntax; mappings: PropertyMappingSyntax[] } {\n const match = (inline ? inlineHeader : operationHeader).exec(header.content);\n const name = match?.[1] ?? '';\n if (match === null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Expected an operation declaration with one name.', locationOf(header));\n let description: string | null = null;\n let uses: string | null = null;\n let usesLocation = locationOf(header);\n let execute: OperationPhaseSyntax | null = null;\n let compensate: OperationPhaseSyntax | null = null;\n const inputs: PropertySyntax[] = [];\n const mappings: PropertyMappingSyntax[] = [];\n const names = new Set<string>();\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const typed = typedMapping.exec(line.content);\n const marker = inline && typed === null ? trailingMarker(line.content) : undefined;\n let propertyLine = line;\n if (inline && typed !== null) propertyLine = { ...line, content: typed[1].trimEnd() };\n else if (marker !== undefined) propertyLine = { ...line, content: line.content.substring(0, line.content.length - marker.length - 1) };\n const structured = inline && typed === null && (marker !== undefined || context.peekChild(line.indent) !== undefined);\n if (typed === null && eventMetadata.has(firstWord(line.content))) {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operations cannot declare event routing or metadata; escape a keyword-named input with @.', locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n if (!usesPattern.test(line.content) && tryParseProperty(propertyLine) !== undefined) {\n const property = parseProperty(context, propertyLine)!;\n if (inline && typed === null && !structured) context.error(DiagnosticCodes.InvalidOperationMapping, \"An inline operation input requires '<property> <Type> = <source>'.\", locationOf(line));\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not operation inputs (decision 0008: one data subject per event).', locationOf(line));\n if (property.isIdentifier || property.isGenerated) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operation inputs cannot be identifier or generated properties.', locationOf(line));\n if (names.has(property.name)) context.error(DiagnosticCodes.DuplicateDeclaration, `Operation '${name}' already declares input '${property.name}'.`, locationOf(line));\n names.add(property.name);\n inputs.push(property);\n if (inline && typed !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: property.name, source: parseMappingSource(typed[2], { ...locationOf(line), column: line.indent + line.content.length - typed[2].length + 1 }, context), location: locationOf(line) });\n if (structured) mappings.push({ kind: 'PropertyMappingSyntax', property: property.name, source: parseStructuredValue(context, line, marker), location: locationOf(line) });\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationDeclaration, 'An operation input cannot have children.');\n } else if (firstWord(line.content) === 'description') description = parseDescription(context, line, description, `Operation '${name}'`);\n else if (usesPattern.test(line.content)) {\n if (uses !== null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation declares exactly one 'uses <System>'.\", locationOf(line));\n else {\n uses = usesPattern.exec(line.content)![1];\n usesLocation = { ...locationOf(line), column: locationOf(line).column + line.content.indexOf(uses, 4) };\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidSystemReference, 'A system reference cannot have children.');\n } else if (line.content === 'execute' || line.content === 'compensate') {\n const phase = parseOperationPhase(context, line);\n if (line.content === 'execute') {\n if (execute !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares execute at most once.', locationOf(line));\n else execute = phase;\n } else {\n if (compensate !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares compensate at most once.', locationOf(line));\n else compensate = phase;\n }\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, `Unexpected '${line.content}' in operation - expected uses, an input, description, execute or compensate.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n if (uses === null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation requires exactly one 'uses <System>'.\", locationOf(header));\n return { operation: { kind: 'OperationSyntax', name, uses: uses ?? '', usesLocation, inputs, description, execute, compensate, location: locationOf(header) }, mappings };\n}\n\nfunction parseOperationPhase(context: ParserContext, header: SourceLine): OperationPhaseSyntax {\n let description: string | null = null;\n let file: OperationPhaseSyntax['file'] = null;\n let code: OperationPhaseSyntax['code'] = null;\n let implementation: OperationPhaseSyntax['implementation'] = null;\n let sourceSelected = false;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n description = parseDescription(context, line, description, `Operation phase '${header.content}'`);\n continue;\n }\n if (firstWord(line.content) === 'implementation') {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase cannot mix wrapped and direct sources or repeat its wrapper.', locationOf(line));\n const source = parseImplementationWrapper(context, line);\n if (!sourceSelected) { file = source.file; code = source.code; implementation = source.implementation; }\n sourceSelected = true;\n } else if (isFileDirective(line) || line.content.startsWith('```')) {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase has at most one file or inline payload.', locationOf(line));\n const parsedFile = isFileDirective(line) ? parseFile(context, line) : null;\n const parsedCode = parsedFile === null ? parseCode(context, line) : null;\n if (!sourceSelected) { file = parsedFile; code = parsedCode; }\n sourceSelected = true;\n if (parsedFile !== null) rejectOperationChildren(context, line, DiagnosticCodes.InvalidImplementationBlock, 'A file directive cannot have children.');\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'A phase accepts description, file, a tagged fence or implementation.', locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'OperationPhaseSyntax', description, file, code, implementation, location: locationOf(header) };\n}\n"],"mappings":"krBAkBA,MAAMA,EAAeC,EAAQ,6BAA6B,EACpDC,EAAkBD,EAAQ,gCAAgC,EAC1DE,EAAeF,EAAQ,4CAA4C,EACnEG,EAAcH,EAAQ,2BAA2B,EACjDI,EAAeJ,EAAQ,6BAA6B,EACpDK,kBAAgB,IAAI,IAAI,CAAC,MAAO,MAAO,aAAc,SAAU,gBAAiB,YAAa,WAAY,cAAe,YAAa,WAAY,UAAU,CAAC,EAElK,SAAgB,wBAAwB,EAAwB,EAAkB,EAAc,EAAuB,CACnH,IAAMC,EAAQC,EAAQ,UAAUC,EAAK,MAAM,EACvCF,IAAU,IAAA,KACdC,EAAQ,MAAME,EAAMC,EAASC,EAAWL,CAAK,CAAC,EAC9CC,EAAQ,UAAUC,EAAK,MAAM,EACjC,CAEA,SAAgB,YAAY,EAAwB,EAAkC,CAClF,IAAMI,EAAQb,EAAa,KAAKc,EAAO,OAAO,EAC1CD,IAAU,MAAML,EAAQ,MAAMO,EAAgB,yBAA0B,4BAA6BH,EAAWE,CAAM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GrC,MAAO,CAAE,KAAM,uBAAwB,cAAa,OAAM,OAAM,iBAAgB,SAAUG,EAAWE,CAAM,CAAE,CACjH"}
|
|
1
|
+
{"version":3,"file":"OperationParser.js","names":["systemHeader","pattern","operationHeader","inlineHeader","usesPattern","typedMapping","eventMetadata","child","context","line","code","message","locationOf","match","header","DiagnosticCodes","description","firstWord","parseDescription","inline","name","uses","usesLocation","execute","compensate","inputs","mappings","names","typed","marker","trailingMarker","propertyLine","structured","tryParseProperty","property","parseProperty","parseMappingSource","parseStructuredValue","phase","file","implementation","sourceSelected","source","parseImplementationWrapper","isFileDirective","parsedFile","parseFile","parsedCode","parseCode"],"sources":["../../../../../../Compiler/Parsing/OperationParser.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 { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { OperationPhaseSyntax, OperationSyntax, SystemSyntax } from '../Syntax/Operations';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseCode, parseFile, parseImplementationWrapper } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseStructuredValue, trailingMarker } from './StructuredBlockParser';\n\nconst systemHeader = pattern('^system\\\\s+([A-Za-z_]\\\\w*)$');\nconst operationHeader = pattern('^operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst inlineHeader = pattern('^produces\\\\s+operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst usesPattern = pattern('^uses\\\\s+([A-Za-z_]\\\\w*)$');\nconst typedMapping = pattern('^(.+?)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst eventMetadata = new Set(['for', 'tag', 'generation', 'origin', 'documentation', 'namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);\n\nexport function rejectOperationChildren(context: ParserContext, line: SourceLine, code: string, message: string): void {\n const child = context.peekChild(line.indent);\n if (child === undefined) return;\n context.error(code, message, locationOf(child));\n context.skipBlock(line.indent);\n}\n\nexport function parseSystem(context: ParserContext, header: SourceLine): SystemSyntax {\n const match = systemHeader.exec(header.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSystemDeclaration, \"Expected 'system <Name>'.\", locationOf(header));\n let description: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') description = parseDescription(context, child, description, `System '${match?.[1] ?? ''}'`);\n else {\n context.error(DiagnosticCodes.InvalidSystemDeclaration, 'A system accepts only a description; abilities are not supported.', locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'SystemSyntax', name: match?.[1] ?? '', description, location: locationOf(header) };\n}\n\nexport function parseOperation(context: ParserContext, header: SourceLine, inline = false): { operation: OperationSyntax; mappings: PropertyMappingSyntax[] } {\n const match = (inline ? inlineHeader : operationHeader).exec(header.content);\n const name = match?.[1] ?? '';\n if (match === null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Expected an operation declaration with one name.', locationOf(header));\n let description: string | null = null;\n let uses: string | null = null;\n let usesLocation = locationOf(header);\n let execute: OperationPhaseSyntax | null = null;\n let compensate: OperationPhaseSyntax | null = null;\n const inputs: PropertySyntax[] = [];\n const mappings: PropertyMappingSyntax[] = [];\n const names = new Set<string>();\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const typed = typedMapping.exec(line.content);\n const marker = inline && typed === null ? trailingMarker(line.content) : undefined;\n let propertyLine = line;\n if (inline && typed !== null) propertyLine = { ...line, content: typed[1].trimEnd() };\n else if (marker !== undefined) propertyLine = { ...line, content: line.content.substring(0, line.content.length - marker.length - 1) };\n const structured = inline && typed === null && (marker !== undefined || context.peekChild(line.indent) !== undefined);\n if (typed === null && eventMetadata.has(firstWord(line.content))) {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operations cannot declare event routing or metadata; escape a keyword-named input with @.', locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n if (!usesPattern.test(line.content) && tryParseProperty(propertyLine) !== undefined) {\n const property = parseProperty(context, propertyLine)!;\n if (inline && typed === null && !structured) context.error(DiagnosticCodes.InvalidOperationMapping, \"An inline operation input requires '<property> <Type> = <source>'.\", locationOf(line));\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not operation inputs (decision 0008: one data subject per event).', locationOf(line));\n if (property.isIdentifier || property.isGenerated) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operation inputs cannot be identifier or generated properties.', locationOf(line));\n if (names.has(property.name)) context.error(DiagnosticCodes.DuplicateDeclaration, `Operation '${name}' already declares input '${property.name}'.`, locationOf(line));\n names.add(property.name);\n inputs.push(property);\n if (inline && typed !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: property.name, source: parseMappingSource(typed[2], { ...locationOf(line), column: line.indent + line.content.length - typed[2].length + 1 }, context), location: locationOf(line) });\n if (structured) mappings.push({ kind: 'PropertyMappingSyntax', property: property.name, source: parseStructuredValue(context, line, marker), location: locationOf(line) });\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationDeclaration, 'An operation input cannot have children.');\n } else if (firstWord(line.content) === 'description') description = parseDescription(context, line, description, `Operation '${name}'`);\n else if (usesPattern.test(line.content)) {\n if (uses !== null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation declares exactly one 'uses <System>'.\", locationOf(line));\n else {\n uses = usesPattern.exec(line.content)![1];\n usesLocation = { ...locationOf(line), column: locationOf(line).column + line.content.indexOf(uses, 4) };\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidSystemReference, 'A system reference cannot have children.');\n } else if (line.content === 'execute' || line.content === 'compensate') {\n const phase = parseOperationPhase(context, line);\n if (line.content === 'execute') {\n if (execute !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares execute at most once.', locationOf(line));\n else execute = phase;\n } else {\n if (compensate !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares compensate at most once.', locationOf(line));\n else compensate = phase;\n }\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, `Unexpected '${line.content}' in operation - expected uses, an input, description, execute or compensate.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n if (uses === null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation requires exactly one 'uses <System>'.\", locationOf(header));\n return { operation: { kind: 'OperationSyntax', name, uses: uses ?? '', usesLocation, inputs, description, execute, compensate, location: locationOf(header) }, mappings };\n}\n\nfunction parseOperationPhase(context: ParserContext, header: SourceLine): OperationPhaseSyntax {\n let description: string | null = null;\n let file: OperationPhaseSyntax['file'] = null;\n let code: OperationPhaseSyntax['code'] = null;\n let implementation: OperationPhaseSyntax['implementation'] = null;\n let sourceSelected = false;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n description = parseDescription(context, line, description, `Operation phase '${header.content}'`);\n continue;\n }\n if (firstWord(line.content) === 'implementation') {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase cannot mix wrapped and direct sources or repeat its wrapper.', locationOf(line));\n const source = parseImplementationWrapper(context, line);\n if (!sourceSelected) { file = source.file; code = source.code; implementation = source.implementation; }\n sourceSelected = true;\n } else if (isFileDirective(line) || line.content.startsWith('```')) {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase has at most one file or inline payload.', locationOf(line));\n const parsedFile = isFileDirective(line) ? parseFile(context, line) : null;\n const parsedCode = parsedFile === null ? parseCode(context, line) : null;\n if (!sourceSelected) { file = parsedFile; code = parsedCode; }\n sourceSelected = true;\n if (parsedFile !== null) rejectOperationChildren(context, line, DiagnosticCodes.InvalidImplementationBlock, 'A file directive cannot have children.');\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'A phase accepts description, file, a tagged fence or implementation.', locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'OperationPhaseSyntax', description, file, code, implementation, location: locationOf(header) };\n}\n"],"mappings":"A,krBAkBA,MAAMA,EAAeC,EAAQ,6BAA6B,EACpDC,EAAkBD,EAAQ,gCAAgC,EAC1DE,EAAeF,EAAQ,4CAA4C,EACnEG,EAAcH,EAAQ,2BAA2B,EACjDI,EAAeJ,EAAQ,6BAA6B,EACpDK,kBAAgB,IAAI,IAAI,CAAC,MAAO,MAAO,aAAc,SAAU,gBAAiB,YAAa,WAAY,cAAe,YAAa,WAAY,UAAU,CAAC,EAElK,SAAgB,wBAAwB,EAAwB,EAAkB,EAAc,EAAuB,CACnH,IAAMC,EAAQC,EAAQ,UAAUC,EAAK,MAAM,EACvCF,IAAU,IAAA,KACdC,EAAQ,MAAME,EAAMC,EAASC,EAAWL,CAAK,CAAC,EAC9CC,EAAQ,UAAUC,EAAK,MAAM,EACjC,CAEA,SAAgB,YAAY,EAAwB,EAAkC,CAClF,IAAMI,EAAQb,EAAa,KAAKc,EAAO,OAAO,EAC1CD,IAAU,MAAML,EAAQ,MAAMO,EAAgB,yBAA0B,4BAA6BH,EAAWE,CAAM,CAAC,EAC3H,IAAIE,EAA6B,KACjC,IAAK,IAAIT,EAAQC,EAAQ,UAAUM,EAAO,MAAM,EAAGP,IAAU,IAAA,GAAW,EAAQC,EAAQ,UAAUM,EAAO,MAAM,EAC3GN,EAAQ,OAAO,gBAAgB,EAC3BS,EAAUV,EAAM,OAAO,IAAM,cAAe,EAAcW,EAAiBV,EAASD,EAAOS,EAAa,WAAWH,IAAQ,IAAM,GAAG,EAAE,GAEtIL,EAAQ,MAAMO,EAAgB,yB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AAQ,UAAUM,EAAO,MAAM,EAExG,GADAN,EAAQ,OAAO,gBAAgB,EAC3BS,EAAUR,EAAK,OAAO,IAAM,cAC5B,EAAcS,EAAiBV,EAASC,EAAMO,EAAa,oBAAoBF,EAAO,QAAQ,EAAE,OAGpG,GAAIG,EAAUR,EAAK,OAAO,IAAM,iBAAkB,CAC1CgC,GAAgBjC,EAAQ,MAAMO,EAAgB,iCAAkC,uEAAwEH,EAAWH,CAAI,CAAC,EAC5K,IAAMiC,EAASC,EAA2BnC,EAASC,CAAI,EAClDgC,IAAkB,EAAOC,EAAO,KAAM,EAAOA,EAAO,KAAM,EAAiBA,EAAO,gBACvF,EAAiB,EACrB,MAAO,GAAIE,EAAgBnC,CAAI,GAAKA,EAAK,QAAQ,WAAW,KAAK,EAAG,CAC5DgC,GAAgBjC,EAAQ,MAAMO,EAAgB,iCAAkC,kDAAmDH,EAAWH,CAAI,CAAC,EACvJ,IAAMoC,EAAaD,EAAgBnC,CAAI,EAAIqC,EAAUtC,EAASC,CAAI,EAAI,KAChEsC,EAAaF,IAAe,KAAOG,EAAUxC,EAASC,CAAI,EAAI,KAC/DgC,IAAkB,EAAOI,EAAY,EAAOE,GACjD,EAAiB,GACbF,IAAe,MAAM,wBAAwBrC,EAASC,EAAMM,EAAgB,2BAA4B,wCAAwC,CACxJ,MACIP,EAAQ,MAAMO,EAAgB,4BAA6B,uEAAwEH,EAAWH,CAAI,CAAC,EACnJD,EAAQ,UAAUC,EAAK,MAAM,EAGrC,MAAO,CAAE,KAAM,uBAAwB,cAAa,OAAM,OAAM,iBAAgB,SAAUG,EAAWE,CAAM,CAAE,CACjH,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{AuthoringProductionResolver as t}from"../Syntax/AuthoringProductionResolver.js";import{eventDeclarations as n}from"../Syntax/EventDeclarations.js";import{operationDeclarations as r}from"../Syntax/Operations.js";import{commandReadSources as i}from"./CommandReadSources.js";import{compatibleValue as a,uniqueByName as o}from"./ResponseValidator.js";import{specificationCommandExamples as s}from"./SpecificationCommandExamples.js";function validateOperations(c,l){let u=new t(c),d=s(c),f=o(c.concepts),p=new Map([...o(c.types)].map(([e,t])=>[e,o(t.properties)])),m=/* @__PURE__ */ new Set([`Uuid`,`String`,`Int`,`Decimal`,`Bool`,`Date`,`DateTime`,...f.keys(),...p.keys()]),h=new Set(c.imports.map(e=>e.qualifiedName.split(`.`).at(-1))),g=/* @__PURE__ */ new Map;for(let e of c.imports){let t=e.qualifiedName.split(`.`).at(-1);g.set(t,[...g.get(t)??[],e.qualifiedName])}let scoped=e=>{let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.name)??[];e.push(n),t.set(n.name,e)}return(e,r)=>{let i=JSON.stringify([e,r]);if(n.has(i))return n.get(i);let candidates=e=>{let n=e.split(`.`),i=t.get(n.at(-1))??[],a=n.slice(0,-1);if(a.length>0)return i.filter(e=>a.length<=e.scope.length&&a.every((t,n)=>e.scope[e.scope.length-a.length+n]===t));for(let e=r.length;e>=0;e--){let t=i.filter(t=>e<=t.scope.length&&r.slice(0,e).every((e,n)=>t.scope[n]===e));if(t.length>0)return t}return[]},a=candidates(e),o=g.get(e)??[];a.length===0&&o.length===1&&(a=candidates(o[0]));let s=a.length===1?a[0].node:null;return n.set(i,s),s}},_=scoped(u.slices.flatMap(({slice:e,scope:t})=>e.readModels.map(e=>({name:e.name,scope:t,node:e})))),v=scoped(u.slices.flatMap(({slice:e,scope:t})=>e.commands.map(n=>({name:n.name,scope:t,node:{command:n,slice:e}})))),y=/* @__PURE__ */ new Map;for(let t of c.systems??[])y.has(t.name)&&l.error(e.InvalidSystemDeclaration,`System '${t.name}' is declared more than once.`,t.location),y.set(t.name,(y.get(t.name)??0)+1);let pathType=(e,t,n=!0)=>{let[r,...i]=t.split(`.`),a=e.filter(e=>e.name===r);if(a.length!==1)return{type:null,missing:a.length===0};let o=a[0].type;if(i.length===0)return{type:o,missing:!1};let s=p.get(o.name);if(s===void 0)return{type:null,missing:m.has(o.name)};let c=pathType([...s.values()],i.join(`.`),n);return c.type===null?c:{type:{...c.type,isOptional:n&&o.isOptional||c.type.isOptional,isCollection:o.isCollection||c.type.isCollection},missing:!1}},covered=(e,t,n,r,i=/* @__PURE__ */ new Set)=>{if(n.has(t)||e.isOptional&&!r.has(t))return!0;if(e.isCollection||i.has(e.name))return!1;let a=p.get(e.name);return a===void 0?r.has(t)&&!m.has(e.name):[...a.values()].every(a=>covered(a.type,`${t}.${a.name}`,n,r,/* @__PURE__ */ new Set([...i,e.name])))},completeValue=(e,t)=>{if(e.kind===`ListExpressionSyntax`&&t.isCollection)return e.items.every(e=>completeValue(e,{...t,isCollection:!1,isOptional:!1}));let n=p.get(t.name);return e.kind!==`ObjectExpressionSyntax`||n===void 0||[...n.values()].every(t=>(t.type.isOptional||e.members.some(e=>e.name===t.name))&&e.members.filter(e=>e.name===t.name).every(e=>completeValue(e.value,t.type)))},concrete=e=>e.kind===`LiteralExpressionSyntax`?typeof e.value!=`number`||Number.isFinite(e.value):e.kind===`ObjectExpressionSyntax`?e.members.every(e=>concrete(e.value)):e.kind===`ListExpressionSyntax`&&e.items.every(concrete),validateMappings=(t,n,r,o,s)=>{let c=/* @__PURE__ */ new Set,u=new Set(t.map(e=>e.property)),d=/* @__PURE__ */ new Set;for(let e of t){let t=e.property.split(`.`);for(let e=1;e<=t.length;e++)d.add(t.slice(0,e).join(`.`))}for(let d of t){c.has(d.property)&&l.error(e.InvalidOperationMapping,`Duplicate operation input mapping '${d.property}'.`,d.location),c.add(d.property);let t=pathType(n.inputs,d.property,!1);if(t.missing&&l.error(e.InvalidOperationMapping,`Operation '${n.name}' declares no input '${d.property}'.`,d.location),t.type===null)continue;let h=d.property.split(`.`);for(let t=1;t<h.length;t++)u.has(h.slice(0,t).join(`.`))&&l.error(e.InvalidOperationMapping,`Operation input mapping '${d.property}' overlaps a whole input mapping.`,d.location);if(r!==null&&d.source.kind===`PathExpressionSyntax`){let a=pathType(r.properties,d.source.path),o=d.source.path.split(`.`),c=(i.get(r)??[]).filter(e=>(e.alias??e.readModel)===o[0]);if(a.missing&&c.length>0){a={type:null,missing:!1};let e=c.length===1?_(c[0].readModel,s):null;o.length>1&&e!==null&&(a=pathType(e.properties,o.slice(1).join(`.`)))}a.missing&&l.error(e.InvalidOperationMapping,`Command '${r.name}' declares no source '${d.source.path}'.`,d.source.location);let u=a.type,f=t.type;u!==null&&m.has(u.name)&&m.has(f.name)&&(u.name!==f.name||u.isCollection!==f.isCollection||u.isOptional&&!f.isOptional)&&l.error(e.InvalidOperationMapping,`Source '${d.source.path}' is incompatible with input '${d.property}' of operation '${n.name}'.`,d.source.location)}else[`LiteralExpressionSyntax`,`ObjectExpressionSyntax`,`ListExpressionSyntax`].includes(d.source.kind)&&(!a(d.source,t.type,f,p)||o&&!completeValue(d.source,t.type))&&l.error(e.InvalidOperationMapping,`Value is incompatible with input '${d.property}' of operation '${n.name}'.`,d.source.location)}if(o)for(let t of n.inputs)covered(t.type,t.name,c,d)||l.error(e.InvalidOperationMapping,`Production of operation '${n.name}' supplies no value for required input '${t.name}'.`,n.location)};for(let{slice:t,scope:i}of u.slices){let a=r(t),o=new Set(n(t).map(e=>e.name));for(let n of a){o.has(n.name)&&l.error(e.ProductionDeclarationCollision,`Operation '${n.name}' collides with another event or operation in slice '${t.name}'.`,n.location),o.add(n.name),n.uses.length>0&&y.get(n.uses)!==1&&l.error(e.InvalidSystemReference,`Operation '${n.name}' must use one declared system; '${n.uses}' does not resolve uniquely.`,n.usesLocation??n.location);for(let t of n.inputs)!m.has(t.type.name)&&!h.has(t.type.name)&&l.warning(e.UnknownType,`Unknown type '${t.type.name}' on input '${t.name}' of operation '${n.name}'.`,t.type.location)}for(let n of t.commands)for(let r of n.produces){let a=u.resolve(r.event,t);a.kind===`ambiguous`&&a.candidates.some(e=>e.kind===`operation`)&&l.error(e.InvalidProductionReference,`Production '${r.event}' is ambiguous.`,r.location),r.event.includes(`.`)&&a.kind!==`operation`&&l.error(e.InvalidProductionReference,`Qualified productions are supported only for explicitly declared operations.`,r.location),a.declaration?.node.kind===`OperationSyntax`&&((r.for!==null||r.tags.length>0)&&l.error(e.InvalidOperationDeclaration,`Operation productions cannot declare event destinations or tags.`,r.location),validateMappings(r.mappings,a.declaration.node,n,!0,i))}for(let n of t.reactions.flatMap(e=>e.triggers).flatMap(e=>e.produces)){let r=u.resolve(n.event,t);r.kind===`ambiguous`&&r.candidates.some(e=>e.kind===`operation`)&&l.error(e.InvalidProductionReference,`Production '${n.event}' is ambiguous.`,n.location),n.event.includes(`.`)&&u.resolve(n.event,t).kind!==`operation`&&l.error(e.InvalidProductionReference,`Qualified productions are supported only for explicitly declared operations.`,n.location),u.isOperation(n,t)&&l.error(e.OperationOutsideCommand,`Operations can only be produced by commands.`,n.location)}for(let n of t.specifications){let r=[...n.givenOperationFailures??[],...n.thenOperations??[],...n.thenCompensated??[]];if(r.length===0)continue;let a=v(d(n.when,i)?.commandType??``,i);(a===null||n.whenAppended!==null||n.whenQuery!==null||n.whenTrigger!==null||n.whenClock!==null||n.whenCapture!==null)&&l.error(e.InvalidOperationSpecification,`Operation fixtures and assertions require a declared command action.`,n.location);let o=/* @__PURE__ */ new Map;for(let n of r){if(n.kind===`SpecificationOperationSyntax`)for(let t of n.values)concrete(t.source)||l.error(e.InvalidOperationSpecification,`Operation assertions require concrete input values.`,t.source.location);let r=u.resolve(n.operation,t).declaration?.node;if(r?.kind!==`OperationSyntax`){l.error(e.InvalidOperationSpecification,`'${n.operation}' does not resolve uniquely to a declared operation.`,n.location);continue}let s=o.get(r)??/* @__PURE__ */ new Set;if(s.has(n.kind)&&l.error(e.InvalidOperationSpecification,`Duplicate operation step '${n.operation}'.`,n.location),s.add(n.kind),o.set(r,s),n.kind===`SpecificationCompensatedSyntax`&&r.compensate===null&&l.error(e.InvalidOperationSpecification,`Operation '${n.operation}' declares no compensation.`,n.location),a!==null&&a.command.handler==null){let t=a.command.produces.map(e=>u.resolve(e.event,a.slice));t.every(e=>e.kind===`event`||e.kind===`operation`)&&!t.some(e=>e.declaration?.node===r)&&l.error(e.InvalidOperationSpecification,`Command '${a.command.name}' does not produce operation '${n.operation}'.`,n.location)}n.kind===`SpecificationOperationSyntax`&&validateMappings(n.values,r,null,!1,i)}}}}export{validateOperations};
|
|
2
2
|
//# sourceMappingURL=OperationValidator.js.map
|