@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,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{parseClockOperand as t}from"./ClockOperandParser.js";import{dotNetWhitespace as n,nativePattern as r}from"../Text/patterns.js";import{stringBodyPattern as i}from"../Text/StringLiteral.js";import{parseModeledMappingSource as a}from"./ExpressionParser.js";import{ConditionDepthBudget as o}from"./ConditionDepthBudget.js";const s={"==":`Equal`,"!=":`NotEqual`,">":`GreaterThan`,">=":`GreaterThanOrEqual`,"<":`LessThan`,"<=":`LessThanOrEqual`,contains:`Contains`,"starts with":`StartsWith`};function parseCondition(c,l,u,d=!1,f=c){let p=new o(f,u),m=c;d||(c=c.valueContext);let h=d?n:`\\s`,g=c.sourceOptions.numericMode===`exact`?`-?[0-9]+(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|${h}|[()])|`:``,_=c.sourceOptions.numericMode===`exact`&&!d?`[\\w.$-]+|[^\\s]`:`[\\w.$-]+`,v=new RegExp(r(`"${i}"|==|!=|>=|<=|>|<|\\(|\\)|\\+|${g}${_}`).source,`gu`);if(d){let t=l.replace(v,``).replace(new RegExp(n,`gu`),``);if(t.length>0)return c.error(e.UnsupportedActionConditionOperand,`Guarded action conditions contain unsupported character '${t[0]}'`,u),null}let y=l.match(v)??[],b=0,operand=(e,n)=>{let r=t(m,y,b,u);if(r!==null)return r.expression===null?null:(b=r.position,r);let i=y[b++];return d&&i===void 0?(c.error(e,n,u),null):{text:i,expression:null}},group=()=>{if(y[b]===`(`){if(!p.enter())return null;b++;try{let t=or();return p.exceeded?null:(y[b]===`)`?b++:(d||c.sourceOptions.numericMode===`exact`)&&c.error(e.UnclosedConditionGroup,`Expected ')' in condition`,u),t)}finally{p.leave()}}let t=operand(e.ExpectedCondition,`Expected a condition`);if(t===null)return null;let{text:n,expression:r}=t,i=y[b++];if(i===`starts`&&y[b]===`with`&&(i+=` with`,b++),d&&!Object.hasOwn(s,i))return c.error(e.ExpectedComparisonOperator,`Expected a comparison operator after '${n}'`,u),null;let o=operand(e.ExpectedComparisonValue,`Expected a value to compare against`);if(o===null)return null;let{text:l,expression:f}=o;return n===void 0||l===void 0||s[i]===void 0?null:{kind:`ComparisonConditionSyntax`,left:n,...r===null?{}:{leftExpression:r},operator:s[i],right:f??a(l,u,c),location:u}},and=()=>{let e=group();for(;e!==null&&y[b]===`and`;){b++;let t=group();if(t===null)return null;let n=e;e=p.build([n,t],()=>({kind:`LogicalConditionSyntax`,left:n,operator:`And`,right:t,location:u}))}return e},or=()=>{let e=and();for(;e!==null&&y[b]===`or`;){b++;let t=and();if(t===null)return null;let n=e;e=p.build([n,t],()=>({kind:`LogicalConditionSyntax`,left:n,operator:`Or`,right:t,location:u}))}return e},x=or();return!p.exceeded&&(d||c.sourceOptions.numericMode===`exact`)&&(x===null&&!d?c.error(e.ExpectedCondition,`Expected a condition`,u):x!==null&&b<y.length&&c.error(e.UnexpectedTokenInCondition,`Unexpected '${y[b]}' in condition`,u)),x}export{parseCondition};
|
|
2
2
|
//# sourceMappingURL=ConditionParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionParser.js","names":["parseMappingSource","operators","
|
|
1
|
+
{"version":3,"file":"ConditionParser.js","names":["parseMappingSource","operators","context","budget","ConditionDepthBudget","budgetContext","location","clockContext","strict","whitespace","dotNetWhitespace","numeric","words","regex","nativePattern","stringBodyPattern","unsupported","text","DiagnosticCodes","tokens","position","clock","parseClockOperand","missingCode","missingMessage","condition","leftOperand","left","leftExpression","operator","rightOperand","right","rightExpression","parseModeledMappingSource","previous"],"sources":["../../../../../../Compiler/Parsing/ConditionParser.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 { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ComparisonOperator, ConditionSyntax } from '../Syntax/Conditions';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { parseClockOperand } from './ClockOperandParser';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { ConditionDepthBudget } from './ConditionDepthBudget';\n\nconst operators: Record<string, ComparisonOperator> = { '==': 'Equal', '!=': 'NotEqual', '>': 'GreaterThan', '>=': 'GreaterThanOrEqual', '<': 'LessThan', '<=': 'LessThanOrEqual', contains: 'Contains', 'starts with': 'StartsWith' };\n\n// The existing C# condition grammar: comparisons, left-associative and/or, and grouped conditions.\n// Previously omitted Legacy operands gain structure, not new parser diagnostics.\nexport function parseCondition(context: ParserContext, text: string, location: SourceLocation, strict = false, budgetContext: ParserContext = context): ConditionSyntax | null {\n const budget = new ConditionDepthBudget(budgetContext, location);\n const clockContext = context;\n if (!strict) context = context.valueContext;\n const whitespace = strict ? dotNetWhitespace : '\\\\s';\n const numeric = context.sourceOptions.numericMode === 'exact' ? `-?[0-9]+(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|${whitespace}|[()])|` : '';\n const words = context.sourceOptions.numericMode === 'exact' && !strict ? '[\\\\w.$-]+|[^\\\\s]' : '[\\\\w.$-]+';\n const regex = new RegExp(nativePattern(`\"${stringBodyPattern}\"|==|!=|>=|<=|>|<|\\\\(|\\\\)|\\\\+|${numeric}${words}`).source, 'gu');\n if (strict) {\n const unsupported = text.replace(regex, '').replace(new RegExp(dotNetWhitespace, 'gu'), '');\n if (unsupported.length > 0) {\n context.error(DiagnosticCodes.UnsupportedActionConditionOperand, `Guarded action conditions contain unsupported character '${unsupported[0]}'`, location);\n return null;\n }\n }\n const tokens = text.match(regex) ?? [];\n let position = 0;\n const operand = (missingCode: string, missingMessage: string): { text: string; expression: ExpressionSyntax | null } | null => {\n const clock = parseClockOperand(clockContext, tokens, position, location);\n if (clock !== null) {\n if (clock.expression === null) return null;\n position = clock.position;\n return clock;\n }\n const text = tokens[position++];\n if (strict && text === undefined) {\n context.error(missingCode, missingMessage, location);\n return null;\n }\n return { text, expression: null };\n };\n const group = (): ConditionSyntax | null => {\n if (tokens[position] === '(') {\n if (!budget.enter()) return null;\n position++;\n try {\n const condition = or();\n if (budget.exceeded) return null;\n if (tokens[position] === ')') position++;\n else if (strict || context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.UnclosedConditionGroup, \"Expected ')' in condition\", location);\n return condition;\n } finally { budget.leave(); }\n }\n const leftOperand = operand(DiagnosticCodes.ExpectedCondition, 'Expected a condition');\n if (leftOperand === null) return null;\n const { text: left, expression: leftExpression } = leftOperand;\n let operator = tokens[position++];\n if (operator === 'starts' && tokens[position] === 'with') { operator += ' with'; position++; }\n if (strict && !Object.hasOwn(operators, operator)) {\n context.error(DiagnosticCodes.ExpectedComparisonOperator, `Expected a comparison operator after '${left}'`, location);\n return null;\n }\n const rightOperand = operand(DiagnosticCodes.ExpectedComparisonValue, 'Expected a value to compare against');\n if (rightOperand === null) return null;\n const { text: right, expression: rightExpression } = rightOperand;\n return left === undefined || right === undefined || operators[operator] === undefined ? null : { kind: 'ComparisonConditionSyntax', left, ...(leftExpression === null ? {} : { leftExpression }), operator: operators[operator], right: rightExpression ?? parseMappingSource(right, location, context), location };\n };\n const and = (): ConditionSyntax | null => {\n let left = group();\n while (left !== null && tokens[position] === 'and') {\n position++;\n const right = group();\n if (right === null) return null;\n const previous: ConditionSyntax = left;\n left = budget.build<ConditionSyntax>([previous, right], () => ({ kind: 'LogicalConditionSyntax', left: previous, operator: 'And', right, location }));\n }\n return left;\n };\n const or = (): ConditionSyntax | null => {\n let left = and();\n while (left !== null && tokens[position] === 'or') {\n position++;\n const right = and();\n if (right === null) return null;\n const previous: ConditionSyntax = left;\n left = budget.build<ConditionSyntax>([previous, right], () => ({ kind: 'LogicalConditionSyntax', left: previous, operator: 'Or', right, location }));\n }\n return left;\n };\n const condition = or();\n if (!budget.exceeded && (strict || context.sourceOptions.numericMode === 'exact')) {\n if (condition === null && !strict) context.error(DiagnosticCodes.ExpectedCondition, 'Expected a condition', location);\n else if (condition !== null && position < tokens.length) context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Unexpected '${tokens[position]}' in condition`, location);\n }\n return condition;\n}\n"],"mappings":"A,+bAcA,MAAMC,EAAgD,CAAE,KAAM,QAAS,KAAM,WAAY,IAAK,cAAe,KAAM,qBAAsB,IAAK,WAAY,KAAM,kBAAmB,SAAU,WAAY,cAAe,YAAa,EAIrO,SAAgB,eAAe,EAAwB,EAAc,EAA0B,EAAS,GAAO,EAA+BC,EAAiC,CAC3K,IAAMC,EAAS,IAAIC,EAAqBC,EAAeC,CAAQ,EACzDC,EAAeL,EAChBM,IAAQ,EAAUN,EAAQ,cAC/B,IA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AAU,CAAE,KAAM,yBAA0B,KAAMG,EAAU,SAAU,KAAM,QAAO,UAAS,EAAE,CACvJ,CACA,OAAOP,CACX,EACMF,EAAY,GAAG,EAKrB,MAJI,CAACtB,EAAO,WAAaK,GAAUN,EAAQ,cAAc,cAAgB,WACjEuB,IAAc,MAAQ,CAACjB,EAAQN,EAAQ,MAAMgB,EAAgB,kBAAmB,uBAAwBZ,CAAQ,EAC3GmB,IAAc,MAAQL,EAAWD,EAAO,QAAQjB,EAAQ,MAAMgB,EAAgB,2BAA4B,eAAeC,EAAOC,GAAU,gBAAiBd,CAAQ,GAEzKmB,CACX,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{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{isFileDirective as i}from"./FileReferences.js";import{firstWord as a}from"./LineText.js";import{parseDescription as o}from"./DescriptionParser.js";import{locationOf as s}from"./SourceLine.js";const c=t(`^constraint\\s+([A-Za-z_]\\w*)$`),l=t(`^unique\\s+event\\s+([A-Z]\\w*)$`),u=t(`^unique\\s+([a-z_][\\w.]*(?:\\s*,\\s*[a-z_][\\w.]*)*)\\s+on\\s+([A-Z]\\w*)$`),d=t(`^released\\s+by\\s+([A-Z]\\w*)$`),f=t(`^message\\s+"(${n})"$`),targetOf=e=>e.kind===`FileConstraintSyntax`?void 0:e.event;function parseConstraint(t,n){let i=c.exec(n.content);i===null&&t.error(e.InvalidConstraintDeclaration,`Invalid constraint declaration '${n.content}' - expected 'constraint <Name>'`,s(n));let l=i?.[1]??a(n.content),u=[],p=[],m=/* @__PURE__ */ new Set,h=/* @__PURE__ */ new Set,g=null,_=null,v=!1;for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){if(t.reader.takeSignificant(),a(i.content)===`description`){_=o(t,i,_,`Constraint '${l}'`);continue}let n=d.exec(i.content),c=f.exec(i.content);n===null?c===null?i.content===`ignore casing`?(v&&t.error(e.DuplicateConstraintBody,`Constraint '${l}' already ignores casing`,s(i)),v=!0):addRule(t,l,i,u,h):g===null?g=r(c[1]):t.error(e.DuplicateConstraintBody,`Constraint '${l}' already has a message`,s(i)):m.has(n[1])?t.error(e.DuplicateConstraintBody,`Constraint '${l}' already releases with event '${n[1]}'`,s(i)):(p.push(n[1]),m.add(n[1]))}for(let r of p.filter(e=>h.has(e)))t.error(e.DuplicateConstraintBody,`Constraint '${l}' cannot target and release event '${r}'`,s(n));return u.length===0&&(t.error(e.ConstraintWithoutRule,`Constraint '${l}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`,s(n)),u.push(rule(l,s(n),{kind:`UniqueEventConstraintSyntax`,event:``}))),u[0].kind===`FileConstraintSyntax`&&(p.length>0||g!==null||v)&&t.error(e.InvalidConstraintBody,`File constraint '${l}' cannot have declarative options`,s(n)),{...u[0],additionalRules:u.slice(1),releasedBy:p,message:g,ignoreCasing:v,description:_}}function addRule(t,n,r,i,a){let o=parseRule(t,n,r);if(o===void 0)return;if(i.length>0&&(o.kind===`FileConstraintSyntax`||i[0].kind===`FileConstraintSyntax`||o.kind===`UniqueEventConstraintSyntax`!=(i[0].kind===`UniqueEventConstraintSyntax`))){t.error(e.DuplicateConstraintBody,`Constraint '${n}' cannot mix constraint kinds`,s(r));return}let c=targetOf(o);c!==void 0&&a.has(c)?t.error(e.DuplicateConstraintBody,`Constraint '${n}' already targets event '${c}'`,s(r)):(c!==void 0&&a.add(c),i.push(o))}function parseRule(t,n,r){let a=s(r),o=l.exec(r.content);if(o!==null)return rule(n,a,{kind:`UniqueEventConstraintSyntax`,event:o[1]});let c=u.exec(r.content);if(c!==null){let r=c[1].split(`,`).map(e=>e.trim());if(new Set(r).size!==r.length){t.error(e.DuplicateConstraintBody,`Constraint '${n}' repeats a property in its composite key`,a);return}return rule(n,a,{kind:`UniquePropertyConstraintSyntax`,property:r[0],additionalProperties:r.slice(1),event:c[2]})}if(i(r))return t.warning(e.FileConstraintOnlySupportsUniqueness,`A file constraint can only declare unique constraints in Chronicle - declare them with 'unique ...' so they are portable; a rule that is not uniqueness belongs in command validation or a 'require' condition`,a),rule(n,a,{kind:`FileConstraintSyntax`,file:{kind:`FileReferenceSyntax`,path:r.content.substring(4).trim(),location:a}});t.error(e.InvalidConstraintBody,`Invalid constraint body '${r.content}'`,a)}function rule(e,t,n){return{...n,name:e,additionalRules:[],releasedBy:[],ignoreCasing:!1,message:null,location:t}}export{parseConstraint};
|
|
2
2
|
//# sourceMappingURL=ConstraintParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstraintParser.js","names":["header","pattern","uniqueEventPattern","uniquePropertyPattern","releasePattern","messagePattern","stringBodyPattern","rule","headerMatch","line","context","DiagnosticCodes","locationOf","name","firstWord","rules","releases","releasedEvents","targets","message","description","ignoreCasing","child","parseDescription","release","text","unescapeString","parsed","target","location","uniqueEvent","uniqueProperty","properties","property","isFileDirective","shape"],"sources":["../../../../../../Compiler/Parsing/ConstraintParser.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 { ConstraintSyntax } from '../Syntax/Constraints';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { parseDescription } from './DescriptionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^constraint\\\\s+([A-Za-z_]\\\\w*)$');\nconst uniqueEventPattern = pattern('^unique\\\\s+event\\\\s+([A-Z]\\\\w*)$');\nconst uniquePropertyPattern = pattern('^unique\\\\s+([a-z_][\\\\w.]*(?:\\\\s*,\\\\s*[a-z_][\\\\w.]*)*)\\\\s+on\\\\s+([A-Z]\\\\w*)$');\nconst releasePattern = pattern('^released\\\\s+by\\\\s+([A-Z]\\\\w*)$');\nconst messagePattern = pattern(`^message\\\\s+\"(${stringBodyPattern})\"$`);\n\nconst targetOf = (rule: ConstraintSyntax): string | undefined => rule.kind === 'FileConstraintSyntax' ? undefined : rule.event;\n\n// The port of the C# ConstraintParser: the first rule is the constraint, any further rules of the same kind\n// are its additional rules.\nexport function parseConstraint(context: ParserContext, line: SourceLine): ConstraintSyntax {\n const headerMatch = header.exec(line.content);\n if (headerMatch === null) {\n context.error(DiagnosticCodes.InvalidConstraintDeclaration, `Invalid constraint declaration '${line.content}' - expected 'constraint <Name>'`, locationOf(line));\n }\n const name = headerMatch?.[1] ?? firstWord(line.content);\n const rules: ConstraintSyntax[] = [];\n const releases: string[] = [];\n const releasedEvents = new Set<string>();\n const targets = new Set<string>();\n let message: string | null = null;\n let description: string | null = null;\n let ignoreCasing = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Constraint '${name}'`);\n continue;\n }\n const release = releasePattern.exec(child.content);\n const text = messagePattern.exec(child.content);\n if (release !== null) {\n if (releasedEvents.has(release[1])) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already releases with event '${release[1]}'`, locationOf(child));\n } else {\n releases.push(release[1]);\n releasedEvents.add(release[1]);\n }\n } else if (text !== null) {\n if (message !== null) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already has a message`, locationOf(child));\n } else {\n message = unescapeString(text[1]);\n }\n } else if (child.content === 'ignore casing') {\n if (ignoreCasing) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already ignores casing`, locationOf(child));\n }\n ignoreCasing = true;\n } else {\n addRule(context, name, child, rules, targets);\n }\n }\n for (const release of releases.filter(release => targets.has(release))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot target and release event '${release}'`, locationOf(line));\n }\n if (rules.length === 0) {\n context.error(DiagnosticCodes.ConstraintWithoutRule, `Constraint '${name}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`, locationOf(line));\n rules.push(rule(name, locationOf(line), { kind: 'UniqueEventConstraintSyntax', event: '' }));\n }\n if (rules[0].kind === 'FileConstraintSyntax' && (releases.length > 0 || message !== null || ignoreCasing)) {\n context.error(DiagnosticCodes.InvalidConstraintBody, `File constraint '${name}' cannot have declarative options`, locationOf(line));\n }\n return { ...rules[0], additionalRules: rules.slice(1), releasedBy: releases, message, ignoreCasing, description };\n}\n\nfunction addRule(context: ParserContext, name: string, line: SourceLine, rules: ConstraintSyntax[], targets: Set<string>): void {\n const parsed = parseRule(context, name, line);\n if (parsed === undefined) {\n return;\n }\n if (rules.length > 0 && (parsed.kind === 'FileConstraintSyntax' || rules[0].kind === 'FileConstraintSyntax' ||\n (parsed.kind === 'UniqueEventConstraintSyntax') !== (rules[0].kind === 'UniqueEventConstraintSyntax'))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot mix constraint kinds`, locationOf(line));\n return;\n }\n const target = targetOf(parsed);\n if (target !== undefined && targets.has(target)) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already targets event '${target}'`, locationOf(line));\n return;\n }\n if (target !== undefined) targets.add(target);\n rules.push(parsed);\n}\n\nfunction parseRule(context: ParserContext, name: string, line: SourceLine): ConstraintSyntax | undefined {\n const location = locationOf(line);\n const uniqueEvent = uniqueEventPattern.exec(line.content);\n if (uniqueEvent !== null) {\n return rule(name, location, { kind: 'UniqueEventConstraintSyntax', event: uniqueEvent[1] });\n }\n const uniqueProperty = uniquePropertyPattern.exec(line.content);\n if (uniqueProperty !== null) {\n const properties = uniqueProperty[1].split(',').map(property => property.trim());\n if (new Set(properties).size !== properties.length) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' repeats a property in its composite key`, location);\n return undefined;\n }\n return rule(name, location, { kind: 'UniquePropertyConstraintSyntax', property: properties[0], additionalProperties: properties.slice(1), event: uniqueProperty[2] });\n }\n if (isFileDirective(line)) {\n context.warning(DiagnosticCodes.FileConstraintOnlySupportsUniqueness, 'A file constraint can only declare unique constraints in Chronicle - declare them with \\'unique ...\\' so they are portable; a rule that is not uniqueness belongs in command validation or a \\'require\\' condition', location);\n const path = line.content.substring('file'.length).trim();\n return rule(name, location, { kind: 'FileConstraintSyntax', file: { kind: 'FileReferenceSyntax', path, location } });\n }\n context.error(DiagnosticCodes.InvalidConstraintBody, `Invalid constraint body '${line.content}'`, location);\n return undefined;\n}\n\ntype RuleShape =\n | { kind: 'UniqueEventConstraintSyntax'; event: string }\n | { kind: 'UniquePropertyConstraintSyntax'; property: string; additionalProperties: string[]; event: string }\n | { kind: 'FileConstraintSyntax'; file: { kind: 'FileReferenceSyntax'; path: string; location: ReturnType<typeof locationOf> } };\n\nfunction rule(name: string, location: ReturnType<typeof locationOf>, shape: RuleShape): ConstraintSyntax {\n return { ...shape, name, additionalRules: [], releasedBy: [], ignoreCasing: false, message: null, location } as ConstraintSyntax;\n}\n"],"mappings":"+bAaA,MAAMA,EAASC,EAAQ,iCAAiC,EAClDC,EAAqBD,EAAQ,kCAAkC,EAC/DE,EAAwBF,EAAQ,6EAA6E,EAC7GG,EAAiBH,EAAQ,iCAAiC,EAC1DI,EAAiBJ,EAAQ,iBAAiBK,EAAkB,IAAI,EAEhE,SAAY,GAA+CC,EAAK,OAAS,uBAAyB,IAAA,GAAYA,EAAK,MAIzH,SAAgB,gBAAgB,EAAwB,EAAoC,CACxF,IAAMC,EAAcR,EAAO,KAAKS,EAAK,OAAO,EACxCD,IAAgB,MAChBE,EAAQ,MAAMC,EAAgB,6BAA8B,mCAAmCF,EAAK,QAAQ,kCAAmCG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O,EAAK,OAAO,EACxD,GAAIqB,IAAgB,KAChB,OAAO,KAAKjB,EAAMgB,EAAU,CAAE,KAAM,8BAA+B,MAAOC,EAAY,EAAG,CAAC,EAE9F,IAAMC,EAAiB5B,EAAsB,KAAKM,EAAK,OAAO,EAC9D,GAAIsB,IAAmB,KAAM,CACzB,IAAMC,EAAaD,EAAe,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAYE,EAAS,KAAK,CAAC,EAC/E,GAAI,IAAI,IAAID,CAAU,CAAC,CAAC,OAASA,EAAW,OAAQ,CAChDtB,EAAQ,MAAMC,EAAgB,wBAAyB,eAAeE,EAAK,2CAA4CgB,CAAQ,EAC/H,MACJ,CACA,OAAO,KAAKhB,EAAMgB,EAAU,CAAE,KAAM,iCAAkC,SAAUG,EAAW,GAAI,qBAAsBA,EAAW,MAAM,CAAC,EAAG,MAAOD,EAAe,EAAG,CAAC,CACxK,CACA,GAAIG,EAAgBzB,CAAI,EAGpB,OAFAC,EAAQ,QAAQC,EAAgB,qCAAsC,iNAAsNkB,CAAQ,EAE7R,KAAKhB,EAAMgB,EAAU,CAAE,KAAM,uBAAwB,KAAM,CAAE,KAAM,sBAAuB,KADpFpB,EAAK,QAAQ,UAAU,CAAa,CAAC,CAAC,KACiD,EAAG,UAAS,CAAE,CAAC,EAEvHC,EAAQ,MAAMC,EAAgB,sBAAuB,4BAA4BF,EAAK,QAAQ,GAAIoB,CAAQ,CAE9G,CAOA,SAAS,KAAK,EAAc,EAAyC,EAAoC,CACrG,MAAO,CAAE,GAAGM,EAAO,OAAM,gBAAiB,CAAC,EAAG,WAAY,CAAC,EAAG,aAAc,GAAO,QAAS,KAAM,UAAS,CAC/G"}
|
|
1
|
+
{"version":3,"file":"ConstraintParser.js","names":["header","pattern","uniqueEventPattern","uniquePropertyPattern","releasePattern","messagePattern","stringBodyPattern","rule","headerMatch","line","context","DiagnosticCodes","locationOf","name","firstWord","rules","releases","releasedEvents","targets","message","description","ignoreCasing","child","parseDescription","release","text","unescapeString","parsed","target","location","uniqueEvent","uniqueProperty","properties","property","isFileDirective","shape"],"sources":["../../../../../../Compiler/Parsing/ConstraintParser.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 { ConstraintSyntax } from '../Syntax/Constraints';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { parseDescription } from './DescriptionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^constraint\\\\s+([A-Za-z_]\\\\w*)$');\nconst uniqueEventPattern = pattern('^unique\\\\s+event\\\\s+([A-Z]\\\\w*)$');\nconst uniquePropertyPattern = pattern('^unique\\\\s+([a-z_][\\\\w.]*(?:\\\\s*,\\\\s*[a-z_][\\\\w.]*)*)\\\\s+on\\\\s+([A-Z]\\\\w*)$');\nconst releasePattern = pattern('^released\\\\s+by\\\\s+([A-Z]\\\\w*)$');\nconst messagePattern = pattern(`^message\\\\s+\"(${stringBodyPattern})\"$`);\n\nconst targetOf = (rule: ConstraintSyntax): string | undefined => rule.kind === 'FileConstraintSyntax' ? undefined : rule.event;\n\n// The port of the C# ConstraintParser: the first rule is the constraint, any further rules of the same kind\n// are its additional rules.\nexport function parseConstraint(context: ParserContext, line: SourceLine): ConstraintSyntax {\n const headerMatch = header.exec(line.content);\n if (headerMatch === null) {\n context.error(DiagnosticCodes.InvalidConstraintDeclaration, `Invalid constraint declaration '${line.content}' - expected 'constraint <Name>'`, locationOf(line));\n }\n const name = headerMatch?.[1] ?? firstWord(line.content);\n const rules: ConstraintSyntax[] = [];\n const releases: string[] = [];\n const releasedEvents = new Set<string>();\n const targets = new Set<string>();\n let message: string | null = null;\n let description: string | null = null;\n let ignoreCasing = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Constraint '${name}'`);\n continue;\n }\n const release = releasePattern.exec(child.content);\n const text = messagePattern.exec(child.content);\n if (release !== null) {\n if (releasedEvents.has(release[1])) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already releases with event '${release[1]}'`, locationOf(child));\n } else {\n releases.push(release[1]);\n releasedEvents.add(release[1]);\n }\n } else if (text !== null) {\n if (message !== null) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already has a message`, locationOf(child));\n } else {\n message = unescapeString(text[1]);\n }\n } else if (child.content === 'ignore casing') {\n if (ignoreCasing) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already ignores casing`, locationOf(child));\n }\n ignoreCasing = true;\n } else {\n addRule(context, name, child, rules, targets);\n }\n }\n for (const release of releases.filter(release => targets.has(release))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot target and release event '${release}'`, locationOf(line));\n }\n if (rules.length === 0) {\n context.error(DiagnosticCodes.ConstraintWithoutRule, `Constraint '${name}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`, locationOf(line));\n rules.push(rule(name, locationOf(line), { kind: 'UniqueEventConstraintSyntax', event: '' }));\n }\n if (rules[0].kind === 'FileConstraintSyntax' && (releases.length > 0 || message !== null || ignoreCasing)) {\n context.error(DiagnosticCodes.InvalidConstraintBody, `File constraint '${name}' cannot have declarative options`, locationOf(line));\n }\n return { ...rules[0], additionalRules: rules.slice(1), releasedBy: releases, message, ignoreCasing, description };\n}\n\nfunction addRule(context: ParserContext, name: string, line: SourceLine, rules: ConstraintSyntax[], targets: Set<string>): void {\n const parsed = parseRule(context, name, line);\n if (parsed === undefined) {\n return;\n }\n if (rules.length > 0 && (parsed.kind === 'FileConstraintSyntax' || rules[0].kind === 'FileConstraintSyntax' ||\n (parsed.kind === 'UniqueEventConstraintSyntax') !== (rules[0].kind === 'UniqueEventConstraintSyntax'))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot mix constraint kinds`, locationOf(line));\n return;\n }\n const target = targetOf(parsed);\n if (target !== undefined && targets.has(target)) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already targets event '${target}'`, locationOf(line));\n return;\n }\n if (target !== undefined) targets.add(target);\n rules.push(parsed);\n}\n\nfunction parseRule(context: ParserContext, name: string, line: SourceLine): ConstraintSyntax | undefined {\n const location = locationOf(line);\n const uniqueEvent = uniqueEventPattern.exec(line.content);\n if (uniqueEvent !== null) {\n return rule(name, location, { kind: 'UniqueEventConstraintSyntax', event: uniqueEvent[1] });\n }\n const uniqueProperty = uniquePropertyPattern.exec(line.content);\n if (uniqueProperty !== null) {\n const properties = uniqueProperty[1].split(',').map(property => property.trim());\n if (new Set(properties).size !== properties.length) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' repeats a property in its composite key`, location);\n return undefined;\n }\n return rule(name, location, { kind: 'UniquePropertyConstraintSyntax', property: properties[0], additionalProperties: properties.slice(1), event: uniqueProperty[2] });\n }\n if (isFileDirective(line)) {\n context.warning(DiagnosticCodes.FileConstraintOnlySupportsUniqueness, 'A file constraint can only declare unique constraints in Chronicle - declare them with \\'unique ...\\' so they are portable; a rule that is not uniqueness belongs in command validation or a \\'require\\' condition', location);\n const path = line.content.substring('file'.length).trim();\n return rule(name, location, { kind: 'FileConstraintSyntax', file: { kind: 'FileReferenceSyntax', path, location } });\n }\n context.error(DiagnosticCodes.InvalidConstraintBody, `Invalid constraint body '${line.content}'`, location);\n return undefined;\n}\n\ntype RuleShape =\n | { kind: 'UniqueEventConstraintSyntax'; event: string }\n | { kind: 'UniquePropertyConstraintSyntax'; property: string; additionalProperties: string[]; event: string }\n | { kind: 'FileConstraintSyntax'; file: { kind: 'FileReferenceSyntax'; path: string; location: ReturnType<typeof locationOf> } };\n\nfunction rule(name: string, location: ReturnType<typeof locationOf>, shape: RuleShape): ConstraintSyntax {\n return { ...shape, name, additionalRules: [], releasedBy: [], ignoreCasing: false, message: null, location } as ConstraintSyntax;\n}\n"],"mappings":"A,+bAaA,MAAMA,EAASC,EAAQ,iCAAiC,EAClDC,EAAqBD,EAAQ,kCAAkC,EAC/DE,EAAwBF,EAAQ,6EAA6E,EAC7GG,EAAiBH,EAAQ,iCAAiC,EAC1DI,EAAiBJ,EAAQ,iBAAiBK,EAAkB,IAAI,EAEhE,SAAY,GAA+CC,EAAK,OAAS,uBAAyB,IAAA,GAAYA,EAAK,MAIzH,SAAgB,gBAAgB,EAAwB,EAAoC,CACxF,IAAMC,EAAcR,EAAO,KAAKS,EAAK,OAAO,EACxCD,IAAgB,MAChBE,EAAQ,MAAMC,EAAgB,6BAA8B,mCAAmCF,EAAK,QAAQ,kCAAmCG,EAAWH,CAAI,CAAC,EAEnK,IAAMI,EAAOL,IAAc,IAAMM,EAAUL,EAAK,OAAO,EACjDM,EAA4B,CAAC,EAC7BC,EAAqB,CAAC,EACtBC,kBAAiB,IAAI,IACrBC,kBAAU,IAAI,IAChBC,EAAyB,KACzBC,EAA6B,KAC7BC,EAAe,GACnB,IAAK,IAAIC,EAAQZ,EAAQ,UAAUD,EAAK,MAAM,EAAGa,IAAU,IAAA,GAAW,EAAQZ,EAAQ,UAAUD,EAAK,MAAM,EAAG,CAE1G,GADAC,EAAQ,OAAO,gBAAgB,EAC3BI,EAAUQ,EAAM,OAAO,IAAM,cAAe,CAC5C,EAAcC,EAAiBb,EAASY,EAAOF,EAAa,eAAeP,EAAK,EAAE,EAClF,QACJ,CACA,IAAMW,EAAUpB,EAAe,KAAKkB,EAAM,OAAO,EAC3CG,EAAOpB,EAAe,KAAKiB,EAAM,OAAO,EAC1CE,IAAY,KAOLC,IAAS,KAMTH,EAAM,UAAY,iBACrBD,GACAX,EAAQ,MAAMC,EAAgB,wBAAyB,eAAeE,EAAK,0BAA2B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AKhB,EAAMgB,EAAU,CAAE,KAAM,uBAAwB,KAAM,CAAE,KAAM,sBAAuB,KADpFpB,EAAK,QAAQ,UAAU,CAAa,CAAC,CAAC,KACiD,EAAG,UAAS,CAAE,CAAC,EAEvHC,EAAQ,MAAMC,EAAgB,sBAAuB,4BAA4BF,EAAK,QAAQ,GAAIoB,CAAQ,CAE9G,CAOA,SAAS,KAAK,EAAc,EAAyC,EAAoC,CACrG,MAAO,CAAE,GAAGM,EAAO,OAAM,gBAAiB,CAAC,EAAG,WAAY,CAAC,EAAG,aAAc,GAAO,QAAS,KAAM,UAAS,CAC/G,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";function validateConstraintProperties(r,i){let a=new t(r).slices.map(e=>e.slice),o=a.flatMap(n);for(let t of a)for(let n of t.constraints.flatMap(e=>[e,...e.additionalRules])){if(n.kind!==`UniquePropertyConstraintSyntax`)continue;let t=o.filter(e=>e.name===n.event);if(t.length!==0)for(let r of[n.property,...n.additionalProperties])r.includes(`.`)||t.some(e=>e.properties.some(e=>e.name===r))||i.error(e.UnknownConstraintProperty,`Constraint '${n.name}' names property '${r}', which event '${n.event}' does not declare.`,n.location)}}export{validateConstraintProperties};
|
|
2
2
|
//# sourceMappingURL=ConstraintPropertyValidator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstraintPropertyValidator.js","names":["slices","AuthoringProductionResolver","application","entry","events","eventDeclarations","slice","rule","constraint","declarations","event","property","field","context","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/ConstraintPropertyValidator.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 { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Mirrors ScreenplayValidator.ValidateConstraintProperties: direct fields only, across all generations.\n// Unknown/imported events, dotted paths and fields removed in a later generation remain C# binder checks.\nexport function validateConstraintProperties(application: ApplicationSyntax, context: ParserContext): void {\n const slices = new AuthoringProductionResolver(application).slices.map(entry => entry.slice);\n const events = slices.flatMap(eventDeclarations);\n for (const slice of slices) {\n for (const rule of slice.constraints.flatMap(constraint => [constraint, ...constraint.additionalRules])) {\n if (rule.kind !== 'UniquePropertyConstraintSyntax') continue;\n const declarations = events.filter(event => event.name === rule.event);\n if (declarations.length === 0) continue;\n for (const property of [rule.property, ...rule.additionalProperties]) {\n if (property.includes('.') || declarations.some(event => event.properties.some(field => field.name === property))) continue;\n context.error(DiagnosticCodes.UnknownConstraintProperty,\n `Constraint '${rule.name}' names property '${property}', which event '${rule.event}' does not declare.`, rule.location);\n }\n }\n }\n}\n"],"mappings":"mRAWA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,EAAS,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,IAAI,GAASC,EAAM,KAAK,EACrFC,EAASJ,EAAO,QAAQK,CAAiB,EAC/C,IAAK,IAAMC,KAASN,EAChB,IAAK,IAAMO,KAAQD,EAAM,YAAY,QAAQ,GAAc,CAACE,EAAY,GAAGA,EAAW,eAAe,CAAC,EAAG,CACrG,GAAID,EAAK,OAAS,iCAAkC,SACpD,IAAME,EAAeL,EAAO,OAAO,GAASM,EAAM,OAASH,EAAK,KAAK,EACrE,GAAIE,EAAa,SAAW,EAC5B,IAAK,IAAME,IAAY,CAACJ,EAAK,SAAU,GAAGA,EAAK,oBAAoB,EAC3DI,EAAS,SAAS,GAAG,GAAKF,EAAa,KAAK,GAASC,EAAM,WAAW,KAAK,GAASE,EAAM,OAASD,CAAQ,CAAC,GAChHE,EAAQ,MAAMC,EAAgB,0BAC1B,eAAeP,EAAK,KAAK,oBAAoBI,EAAS,kBAAkBJ,EAAK,MAAM,qBAAsBA,EAAK,QAAQ,CAElI,CAER"}
|
|
1
|
+
{"version":3,"file":"ConstraintPropertyValidator.js","names":["slices","AuthoringProductionResolver","application","entry","events","eventDeclarations","slice","rule","constraint","declarations","event","property","field","context","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/ConstraintPropertyValidator.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 { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Mirrors ScreenplayValidator.ValidateConstraintProperties: direct fields only, across all generations.\n// Unknown/imported events, dotted paths and fields removed in a later generation remain C# binder checks.\nexport function validateConstraintProperties(application: ApplicationSyntax, context: ParserContext): void {\n const slices = new AuthoringProductionResolver(application).slices.map(entry => entry.slice);\n const events = slices.flatMap(eventDeclarations);\n for (const slice of slices) {\n for (const rule of slice.constraints.flatMap(constraint => [constraint, ...constraint.additionalRules])) {\n if (rule.kind !== 'UniquePropertyConstraintSyntax') continue;\n const declarations = events.filter(event => event.name === rule.event);\n if (declarations.length === 0) continue;\n for (const property of [rule.property, ...rule.additionalProperties]) {\n if (property.includes('.') || declarations.some(event => event.properties.some(field => field.name === property))) continue;\n context.error(DiagnosticCodes.UnknownConstraintProperty,\n `Constraint '${rule.name}' names property '${property}', which event '${rule.event}' does not declare.`, rule.location);\n }\n }\n }\n}\n"],"mappings":"A,mRAWA,SAAgB,6BAA6B,EAAgC,EAA8B,CACvG,IAAMA,EAAS,IAAIC,EAA4BC,CAAW,CAAC,CAAC,OAAO,IAAI,GAASC,EAAM,KAAK,EACrFC,EAASJ,EAAO,QAAQK,CAAiB,EAC/C,IAAK,IAAMC,KAASN,EAChB,IAAK,IAAMO,KAAQD,EAAM,YAAY,QAAQ,GAAc,CAACE,EAAY,GAAGA,EAAW,eAAe,CAAC,EAAG,CACrG,GAAID,EAAK,OAAS,iCAAkC,SACpD,IAAME,EAAeL,EAAO,OAAO,GAASM,EAAM,OAASH,EAAK,KAAK,EACrE,GAAIE,EAAa,SAAW,EAC5B,IAAK,IAAME,IAAY,CAACJ,EAAK,SAAU,GAAGA,EAAK,oBAAoB,EAC3DI,EAAS,SAAS,GAAG,GAAKF,EAAa,KAAK,GAASC,EAAM,WAAW,KAAK,GAASE,EAAM,OAASD,CAAQ,CAAC,GAChHE,EAAQ,MAAMC,EAAgB,0BAC1B,eAAeP,EAAK,KAAK,oBAAoBI,EAAS,kBAAkBJ,EAAK,MAAM,qBAAsBA,EAAK,QAAQ,CAElI,CAER,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContinuationValues.js","names":["pattern","formHeader","nativePattern","executeHeader","behaviorHeader","localDeclaration","argument","submitNavigation","stateValue","continuation","owners","parents","locals","line","lines","local","owner","parent","text","ancestry","success","failure","index","branch","outcome","executed","form","parameters","locationOf","content"],"sources":["../../../../../../Compiler/Parsing/ContinuationValues.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { nativePattern as pattern } from '../Text/patterns';\nimport { ContinuationValueUse } from './ContinuationValueUse';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst formHeader = pattern(/^form\\s+[A-Za-z_]\\w*\\s+for\\s+([\\w.]+)$/.source);\nconst executeHeader = pattern(/^execute\\s+([\\w.]+)$/.source);\nconst behaviorHeader = pattern(/^behavior\\s+[A-Za-z_]\\w*/.source);\nconst localDeclaration = pattern(/^(?:field|parameter)\\s+([A-Za-z_]\\w*)(?:\\s|$)/.source);\nconst argument = pattern(/^with\\s+\\w+\\s+from\\s+(.+)$/.source);\nconst submitNavigation = pattern(/^on\\s+submit\\s+navigate\\s+to\\s+[\\w.]+\\s+by\\s+(.+)$/.source);\nconst stateValue = pattern(/^set\\s+[\\w.$]+\\s+to\\s+(.+)$/.source);\nconst continuation = /^on\\s+(success|failure|submit)$/;\n\n// Lines have already had comments, fences and descriptions removed by the body reader.\n// Each owner remains alive only for its greater-indented subtree; siblings restore their ancestry.\nexport function collectContinuationValues(lines: readonly SourceLine[], scope: readonly string[]): ContinuationValueUse[] {\n const owners: SourceLine[] = [];\n const parents = new Map<SourceLine, readonly SourceLine[]>();\n const locals = new Map<SourceLine, string[]>();\n for (const line of lines) {\n while (owners.length > 0 && owners.at(-1)!.indent >= line.indent) owners.pop();\n parents.set(line, [...owners]);\n const local = localDeclaration.exec(line.content);\n if (local) {\n const owner = [...owners].reverse().find(parent => formHeader.test(parent.content) || behaviorHeader.test(parent.content));\n if (owner) locals.set(owner, [...locals.get(owner) ?? [], local[1]]);\n }\n owners.push(line);\n }\n return lines.flatMap(line => {\n const text = continuationOperand(line.content) ?? '';\n const ancestry = parents.get(line)!;\n const success: string[] = [];\n const failure: string[] = [];\n for (let index = 0; index < ancestry.length; index++) {\n const branch = ancestry[index];\n const parent = ancestry[index - 1];\n const outcome = continuation.exec(branch.content)?.[1];\n const executed = parent ? executeHeader.exec(parent.content) : null;\n if (executed && outcome === 'success') success.push(executed[1]);\n if (executed && outcome === 'failure') failure.push(executed[1]);\n const form = parent ? formHeader.exec(parent.content) : null;\n if (form && outcome === 'submit') success.push(form[1]);\n }\n // One-line form sugar is its own success continuation, not a screen action's navigation.\n if (/^on\\s+submit\\s+navigate\\s+to\\s+/.test(line.content)) {\n const form = ancestry.at(-1) ? formHeader.exec(ancestry.at(-1)!.content) : null;\n if (form) success.push(form[1]);\n }\n const parameters = ancestry.filter(parent => behaviorHeader.test(parent.content)).flatMap(parent => locals.get(parent) ?? []);\n return [{ text, location: locationOf(line), scope, success, failure, parameters,\n locals: ancestry.flatMap(parent => locals.get(parent) ?? []) }];\n });\n}\n\nexport function continuationOperand(content: string): string | null {\n return argument.exec(content)?.[1]\n ?? submitNavigation.exec(content)?.[1]\n ?? stateValue.exec(content)?.[1]\n ?? /^notify\\s+(?:info|warning|error)\\s+(.+)$/.exec(content)?.[1]\n ?? /^confirm\\s+(.+)$/.exec(content)?.[1]\n ?? null;\n}\n"],"mappings":"sJAOA,MAAMC,EAAaD,EAAQ,6CAA+C,EACpEG,EAAgBH,EAAQ,wBAA6B,EACrDI,EAAiBJ,EAAQ,4BAAiC,EAC1DK,EAAmBL,EAAQ,kDAAsD,EACjFM,EAAWN,EAAQ,gCAAmC,EACtDO,EAAmBP,EAAQ,2DAA2D,EACtFQ,EAAaR,EAAQ,iCAAoC,EACzDS,EAAe,kCAIrB,SAAgB,0BAA0B,EAA8B,EAAkD,CACtH,IAAMC,EAAuB,CAAC,EACxBC,kBAAU,IAAI,IACdC,kBAAS,IAAI,IACnB,IAAK,IAAMC,KAAQC,EAAO,CACtB,KAAOJ,EAAO,OAAS,GAAKA,EAAO,GAAG,EAAE,CAAC,CAAE,QAAUG,EAAK,QAAQH,EAAO,IAAI,EAC7EC,EAAQ,IAAIE,EAAM,CAAC,GAAGH,CAAM,CAAC,EAC7B,IAAMK,EAAQV,EAAiB,KAAKQ,EAAK,OAAO,EAChD,GAAIE,EAAO,CACP,IAAMC,EAAQ,CAAC,GAAGN,CAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAUT,EAAW,KAAKgB,EAAO,OAAO,GAAKb,EAAe,KAAKa,EAAO,OAAO,CAAC,EACrHD,GAAOJ,EAAO,IAAII,EAAO,CAAC,GAAGJ,EAAO,IAAII,CAAK,GAAK,CAAC,EAAGD,EAAM,EAAE,CAAC,CACvE,CACAL,EAA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KAAKsB,CAAO,CAAC,GAAG,IACjCrB,EAAW,KAAKqB,CAAO,CAAC,GAAG,IAC3B,2CAA2C,KAAKA,CAAO,CAAC,GAAG,IAC3D,mBAAmB,KAAKA,CAAO,CAAC,GAAG,IACnC,IACX"}
|
|
1
|
+
{"version":3,"file":"ContinuationValues.js","names":["pattern","formHeader","nativePattern","executeHeader","behaviorHeader","localDeclaration","argument","submitNavigation","stateValue","continuation","owners","parents","locals","line","lines","local","owner","parent","text","ancestry","success","failure","index","branch","outcome","executed","form","parameters","locationOf","content"],"sources":["../../../../../../Compiler/Parsing/ContinuationValues.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { nativePattern as pattern } from '../Text/patterns';\nimport { ContinuationValueUse } from './ContinuationValueUse';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst formHeader = pattern(/^form\\s+[A-Za-z_]\\w*\\s+for\\s+([\\w.]+)$/.source);\nconst executeHeader = pattern(/^execute\\s+([\\w.]+)$/.source);\nconst behaviorHeader = pattern(/^behavior\\s+[A-Za-z_]\\w*/.source);\nconst localDeclaration = pattern(/^(?:field|parameter)\\s+([A-Za-z_]\\w*)(?:\\s|$)/.source);\nconst argument = pattern(/^with\\s+\\w+\\s+from\\s+(.+)$/.source);\nconst submitNavigation = pattern(/^on\\s+submit\\s+navigate\\s+to\\s+[\\w.]+\\s+by\\s+(.+)$/.source);\nconst stateValue = pattern(/^set\\s+[\\w.$]+\\s+to\\s+(.+)$/.source);\nconst continuation = /^on\\s+(success|failure|submit)$/;\n\n// Lines have already had comments, fences and descriptions removed by the body reader.\n// Each owner remains alive only for its greater-indented subtree; siblings restore their ancestry.\nexport function collectContinuationValues(lines: readonly SourceLine[], scope: readonly string[]): ContinuationValueUse[] {\n const owners: SourceLine[] = [];\n const parents = new Map<SourceLine, readonly SourceLine[]>();\n const locals = new Map<SourceLine, string[]>();\n for (const line of lines) {\n while (owners.length > 0 && owners.at(-1)!.indent >= line.indent) owners.pop();\n parents.set(line, [...owners]);\n const local = localDeclaration.exec(line.content);\n if (local) {\n const owner = [...owners].reverse().find(parent => formHeader.test(parent.content) || behaviorHeader.test(parent.content));\n if (owner) locals.set(owner, [...locals.get(owner) ?? [], local[1]]);\n }\n owners.push(line);\n }\n return lines.flatMap(line => {\n const text = continuationOperand(line.content) ?? '';\n const ancestry = parents.get(line)!;\n const success: string[] = [];\n const failure: string[] = [];\n for (let index = 0; index < ancestry.length; index++) {\n const branch = ancestry[index];\n const parent = ancestry[index - 1];\n const outcome = continuation.exec(branch.content)?.[1];\n const executed = parent ? executeHeader.exec(parent.content) : null;\n if (executed && outcome === 'success') success.push(executed[1]);\n if (executed && outcome === 'failure') failure.push(executed[1]);\n const form = parent ? formHeader.exec(parent.content) : null;\n if (form && outcome === 'submit') success.push(form[1]);\n }\n // One-line form sugar is its own success continuation, not a screen action's navigation.\n if (/^on\\s+submit\\s+navigate\\s+to\\s+/.test(line.content)) {\n const form = ancestry.at(-1) ? formHeader.exec(ancestry.at(-1)!.content) : null;\n if (form) success.push(form[1]);\n }\n const parameters = ancestry.filter(parent => behaviorHeader.test(parent.content)).flatMap(parent => locals.get(parent) ?? []);\n return [{ text, location: locationOf(line), scope, success, failure, parameters,\n locals: ancestry.flatMap(parent => locals.get(parent) ?? []) }];\n });\n}\n\nexport function continuationOperand(content: string): string | null {\n return argument.exec(content)?.[1]\n ?? submitNavigation.exec(content)?.[1]\n ?? stateValue.exec(content)?.[1]\n ?? /^notify\\s+(?:info|warning|error)\\s+(.+)$/.exec(content)?.[1]\n ?? /^confirm\\s+(.+)$/.exec(content)?.[1]\n ?? null;\n}\n"],"mappings":"A,sJAOA,MAAMC,EAAaD,EAAQ,6CAA+C,EACpEG,EAAgBH,EAAQ,wBAA6B,EACrDI,EAAiBJ,EAAQ,4BAAiC,EAC1DK,EAAmBL,EAAQ,kDAAsD,EACjFM,EAAWN,EAAQ,gCAAmC,EACtDO,EAAmBP,EA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KgB,EAAO,OAAO,EAAI,KACpDS,GAAQF,IAAY,UAAUJ,EAAQ,KAAKM,EAAK,EAAE,CAC1D,CAEA,GAAI,kCAAkC,KAAKb,EAAK,OAAO,EAAG,CACtD,IAAMa,EAAOP,EAAS,GAAG,EAAE,EAAIlB,EAAW,KAAKkB,EAAS,GAAG,EAAE,CAAC,CAAE,OAAO,EAAI,KACvEO,GAAMN,EAAQ,KAAKM,EAAK,EAAE,CAClC,CACA,IAAMC,EAAaR,EAAS,OAAO,GAAUf,EAAe,KAAKa,EAAO,OAAO,CAAC,CAAC,CAAC,QAAQ,GAAUL,EAAO,IAAIK,CAAM,GAAK,CAAC,CAAC,EAC5H,MAAO,CAAC,CAAE,OAAM,SAAUW,EAAWf,CAAI,EAAG,QAAO,UAAS,UAAS,aACjE,OAAQM,EAAS,QAAQ,GAAUP,EAAO,IAAIK,CAAM,GAAK,CAAC,CAAC,CAAE,CAAC,CACtE,CAAC,CACL,CAEA,SAAgB,oBAAoB,EAAgC,CAChE,OAAOX,EAAS,KAAKuB,CAAO,CAAC,GAAG,IACzBtB,EAAiB,KAAKsB,CAAO,CAAC,GAAG,IACjCrB,EAAW,KAAKqB,CAAO,CAAC,GAAG,IAC3B,2CAA2C,KAAKA,CAAO,CAAC,GAAG,IAC3D,mBAAmB,KAAKA,CAAO,CAAC,GAAG,IACnC,IACX,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{pattern as t}from"../Text/patterns.js";import{isBlankPublicEventOrigin as n}from"../Syntax/PublicEventInvariants.js";import{stringBodyPattern as r,unescapeString as i}from"../Text/StringLiteral.js";import{eventBodyReservedWords as a}from"../Text/ReservedWords.js";import{parseDescription as o}from"./DescriptionParser.js";import{parseDocumentation as s}from"./DocumentationParser.js";import{EventMetadataParser as c}from"./EventMetadataParser.js";import{parseMappingSource as l}from"./ExpressionParser.js";import{isFileDirectiveAmongProperties as u}from"./FileReferences.js";import{firstWord as d}from"./LineText.js";import{parseProperty as f,tryParseProperty as p}from"./PropertyLineParser.js";import{locationOf as m}from"./SourceLine.js";const h=t(`^type\\s+([A-Za-z_]\\w*)$`),g=t(`^(?:(?<public>public)\\s+)?event\\s+(?<name>[A-Za-z_]\\w*)(?:\\s+generation\\s+(?<generation>[0-9]+))?(?:\\s+from\\s+"(?<origin>${r})")?$`),_=t(`^readmodel\\s+([A-Za-z_]\\w*)$`),v=t(`^[A-Z]\\w*(?:\\[\\])?(?:\\?|\\s+optional)?$`),y=t(`^[A-Za-z_]\\w*$`),isDescription=e=>d(e.content)===`description`&&p(e)===void 0;function withoutIdentifier(e,t,n,r,i){return t.isIdentifier?(e.error(r,i,m(n)),{...t,isIdentifier:!1}):t}function parseType(t,n){let r=h.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidTypeDeclaration,`Invalid type declaration '${n.content}' - expected 'type <Name>'`,m(n));let i=[],a=null;for(let s=t.peekChild(n.indent);s!==void 0;s=t.peekChild(n.indent)){if(t.reader.takeSignificant(),isDescription(s)){a=o(t,s,a,`Type '${r}'`);continue}if(u(s))continue;let n=f(t,s);n===void 0?t.error(e.InvalidPropertyDeclaration,`Invalid property '${s.content}' - expected '<name> <Type>'`,m(s)):i.push(withoutIdentifier(t,n,s,e.IdentifierOutsideCommand,`Property '${n.name}' of type '${r}' cannot be marked identifier - only a command property can be`))}return i.length===0&&t.error(e.TypeWithoutProperties,`Type '${r}' must declare at least one property`,m(n)),{kind:`TypeSyntax`,name:r,properties:i,description:a,location:m(n)}}function parseEvent(t,r){let o=g.exec(r.content),s=o?.groups?.name??``;o===null&&t.error(e.InvalidEventDeclaration,`Invalid event declaration '${r.content}' - expected '[public] event <Name> [generation <N>] [from "<origin>"]'`,m(r));let l=o?.groups?.origin===void 0?null:i(o.groups.origin),p=o?.groups?.public!==void 0||l!==null?`Public`:`Private`;l!==null&&n(l)&&t.error(e.InvalidEventDeclaration,`An event origin must be a nonblank quoted string`,m(r));let h=o?.groups?.generation!==void 0,_=1;if(h){let n=Number(o.groups.generation);!Number.isSafeInteger(n)||n===0||n>=4294967295?t.error(e.InvalidEventGeneration,`Event '${s}' must declare a generation between 1 and 4294967294`,m(r)):_=n}let v=[],y=[],b=new c(s);for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent)){if(t.reader.takeSignificant(),u(n))continue;if(a.includes(d(n.content))){let e=parseTag(t,n);e!==void 0&&y.push(e);continue}let r=f(t,n);r===void 0?b.tryParse(t,n)||t.error(e.InvalidPropertyDeclaration,`Invalid property '${n.content}' - expected '<name> <Type>'`,m(n)):v.push(withoutIdentifier(t,r,n,e.IdentifierOnEventProperty,`Property '${r.name}' of event '${s}' cannot be marked identifier - an event never carries its event source id`))}return{kind:`EventSyntax`,name:s,properties:v,tags:y,visibility:p,origin:l,generation:_,hasGenerationMarker:h,...b.value,location:m(r)}}function parseTag(t,n,r=!0){let i=n.content.substring(3).trim();if(r&&v.test(i)&&t.warning(e.TagPropertyReadAsTag,`'${n.content}' declares a static tag with the value '${i}', not a property named 'tag' - write 'tag "${i}"' for the tag, or '@${n.content}' for the property`,m(n)),i.length===0){t.error(e.TagWithoutValue,`Expected a value after 'tag' - an identifier, a string literal or a context expression`,m(n));return}if(y.test(i))return{kind:`TagSyntax`,value:{kind:`LiteralExpressionSyntax`,value:i,location:m(n)},location:m(n)};let a=l(i,m(n),t);if(a.kind===`RawExpressionSyntax`)t.error(e.InvalidTagValue,`Invalid tag value '${i}' - expected an identifier, a string literal or a context expression`,m(n));else return{kind:`TagSyntax`,value:a,location:m(n)}}function parseReadModel(t,n){let r,i=!1,a=_.exec(n.content)?.[1]??``;a===``&&t.error(e.InvalidReadModelDeclaration,`Invalid read model declaration '${n.content}' - expected 'readmodel <Name>'`,m(n));let c=[],l=null,h=null;for(let g=t.peekChild(n.indent);g!==void 0;g=t.peekChild(n.indent))if(t.reader.takeSignificant(),r??=g.indent,isDescription(g))l=o(t,g,l,`Read model '${a}'`);else if(d(g.content)===`documentation`&&p(g)===void 0)h=s(t,g,h,`Read model '${a}'`);else if(g.content===`passive`)i&&t.warning(e.RepeatedPassiveDirective,`A read model repeats 'passive'; the directive is idempotent.`,m(g)),i=!0;else if(d(g.content)===`passive`&&[`true`,`false`].includes(g.content.slice(7).trim()))t.error(e.InvalidPropertyDeclaration,`Invalid property '${g.content}' - expected '<name> <Type>'`,m(g));else if(u(g))continue;else{let n=f(t,g);if(n===void 0){t.error(e.InvalidPropertyDeclaration,`Invalid property '${g.content}' - expected '<name> <Type>'`,m(g));continue}n.isKey&&g.indent>r&&t.error(e.InvalidReadModelKey,`The key modifier is only valid on top-level read-model properties.`,n.location),c.push(withoutIdentifier(t,g.indent>r?{...n,isKey:!1}:n,g,e.IdentifierOutsideCommand,`Property '${n.name}' of read model '${a}' cannot be marked identifier - only a command property can be`))}let g={kind:`ReadModelSyntax`,name:a,properties:c,description:l,documentation:h,location:m(n)};return i?{...g,isPassive:!0}:g}export{parseEvent,parseReadModel,parseTag,parseType};
|
|
2
2
|
//# sourceMappingURL=DeclarationParsers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclarationParsers.js","names":["typeHeader","pattern","eventHeader","stringBodyPattern","readModelHeader","typeShapedPattern","tagIdentifierPattern","firstWord","line","tryParseProperty","property","context","code","message","locationOf","name","header","DiagnosticCodes","properties","description","parseDescription","isFileDirectiveAmongProperties","parseProperty","match","origin","unescapeString","visibility","isBlankPublicEventOrigin","hasGenerationMarker","generation","declared","tags","metadata","EventMetadataParser","eventBodyReservedWords","tag","value","eventDeclaration","expression","parseMappingSource","bodyIndent","documentation","parseDocumentation"],"sources":["../../../../../../Compiler/Parsing/DeclarationParsers.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 { EventSyntax, PropertySyntax, ReadModelSyntax, TagSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { eventBodyReservedWords } from '../Text/ReservedWords';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { EventMetadataParser } from './EventMetadataParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirectiveAmongProperties } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typeHeader = pattern('^type\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventHeader = pattern(`^(?:(?<public>public)\\\\s+)?event\\\\s+(?<name>[A-Za-z_]\\\\w*)(?:\\\\s+generation\\\\s+(?<generation>[0-9]+))?(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst readModelHeader = pattern('^readmodel\\\\s+([A-Za-z_]\\\\w*)$');\nconst maximumGeneration = 4294967295;\nconst typeShapedPattern = pattern('^[A-Z]\\\\w*(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?$');\nconst tagIdentifierPattern = pattern('^[A-Za-z_]\\\\w*$');\n\n// 'description' takes no type reference, so a line with property shape is a property named description.\nconst isDescription = (line: SourceLine): boolean => firstWord(line.content) === 'description' && tryParseProperty(line) === undefined;\n\nfunction withoutIdentifier(context: ParserContext, property: PropertySyntax, line: SourceLine, code: string, message: string): PropertySyntax {\n if (!property.isIdentifier) {\n return property;\n }\n context.error(code, message, locationOf(line));\n return { ...property, isIdentifier: false };\n}\n\nexport function parseType(context: ParserContext, header: SourceLine): TypeSyntax {\n const name = typeHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidTypeDeclaration, `Invalid type declaration '${header.content}' - expected 'type <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Type '${name}'`);\n continue;\n }\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of type '${name}' cannot be marked identifier - only a command property can be`));\n }\n if (properties.length === 0) {\n context.error(DiagnosticCodes.TypeWithoutProperties, `Type '${name}' must declare at least one property`, locationOf(header));\n }\n return { kind: 'TypeSyntax', name, properties, description, location: locationOf(header) };\n}\n\nexport function parseEvent(context: ParserContext, header: SourceLine): EventSyntax {\n const match = eventHeader.exec(header.content);\n const name = match?.groups?.name ?? '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, `Invalid event declaration '${header.content}' - expected '[public] event <Name> [generation <N>] [from \"<origin>\"]'`, locationOf(header));\n }\n const origin = match?.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n const visibility = match?.groups?.public !== undefined || origin !== null ? EventVisibility.Public : EventVisibility.Private;\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, 'An event origin must be a nonblank quoted string', locationOf(header));\n }\n const hasGenerationMarker = match?.groups?.generation !== undefined;\n let generation = 1;\n if (hasGenerationMarker) {\n const declared = Number(match!.groups!.generation);\n if (!Number.isSafeInteger(declared) || declared === 0 || declared >= maximumGeneration) {\n context.error(DiagnosticCodes.InvalidEventGeneration, `Event '${name}' must declare a generation between 1 and ${maximumGeneration - 1}`, locationOf(header));\n } else {\n generation = declared;\n }\n }\n const properties: PropertySyntax[] = [];\n const tags: TagSyntax[] = [];\n const metadata = new EventMetadataParser(name);\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n if (eventBodyReservedWords.includes(firstWord(line.content))) {\n const tag = parseTag(context, line);\n if (tag !== undefined) {\n tags.push(tag);\n }\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n if (!metadata.tryParse(context, line)) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n }\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOnEventProperty,\n `Property '${property.name}' of event '${name}' cannot be marked identifier - an event never carries its event source id`));\n }\n return { kind: 'EventSyntax', name, properties, tags, visibility, origin, generation, hasGenerationMarker, ...metadata.value, location: locationOf(header) };\n}\n\n// 'tag <value>' - the port of the C# TagParser, with the warning the C# EventParser gives for a tag whose\n// value looks like a type, which is almost always a property named tag written without its '@'.\nexport function parseTag(context: ParserContext, line: SourceLine, eventDeclaration = true): TagSyntax | undefined {\n const value = line.content.substring('tag'.length).trim();\n if (eventDeclaration && typeShapedPattern.test(value)) {\n context.warning(DiagnosticCodes.TagPropertyReadAsTag,\n `'${line.content}' declares a static tag with the value '${value}', not a property named 'tag' - write 'tag \"${value}\"' for the tag, or '@${line.content}' for the property`,\n locationOf(line));\n }\n if (value.length === 0) {\n context.error(DiagnosticCodes.TagWithoutValue, 'Expected a value after \\'tag\\' - an identifier, a string literal or a context expression', locationOf(line));\n return undefined;\n }\n if (tagIdentifierPattern.test(value)) {\n return { kind: 'TagSyntax', value: { kind: 'LiteralExpressionSyntax', value, location: locationOf(line) }, location: locationOf(line) };\n }\n const expression = parseMappingSource(value, locationOf(line), context);\n if (expression.kind === 'RawExpressionSyntax') {\n context.error(DiagnosticCodes.InvalidTagValue, `Invalid tag value '${value}' - expected an identifier, a string literal or a context expression`, locationOf(line));\n return undefined;\n }\n return { kind: 'TagSyntax', value: expression, location: locationOf(line) };\n}\n\nexport function parseReadModel(context: ParserContext, header: SourceLine): ReadModelSyntax {\n let bodyIndent: number | undefined;\n const name = readModelHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReadModelDeclaration, `Invalid read model declaration '${header.content}' - expected 'readmodel <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n let documentation: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n bodyIndent ??= line.indent;\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Read model '${name}'`);\n } else if (firstWord(line.content) === 'documentation' && tryParseProperty(line) === undefined) {\n documentation = parseDocumentation(context, line, documentation, `Read model '${name}'`);\n } else if (isFileDirectiveAmongProperties(line)) {\n continue;\n } else {\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n if (property.isKey && line.indent > bodyIndent) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', property.location);\n }\n properties.push(withoutIdentifier(context, line.indent > bodyIndent ? { ...property, isKey: false } : property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of read model '${name}' cannot be marked identifier - only a command property can be`));\n }\n }\n return { kind: 'ReadModelSyntax', name, properties, description, documentation, location: locationOf(header) };\n}\n"],"mappings":"o2BAoBA,MAAMA,EAAaC,EAAQ,2BAA2B,EAChDC,EAAcD,EAAQ,mIAAmIE,EAAkB,MAAM,EACjLC,EAAkBH,EAAQ,gCAAgC,EAE1D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M,aAAY,cAAa,gBAAe,SAAUD,EAAWE,CAAM,CAAE,CACjH"}
|
|
1
|
+
{"version":3,"file":"DeclarationParsers.js","names":["typeHeader","pattern","eventHeader","stringBodyPattern","readModelHeader","typeShapedPattern","tagIdentifierPattern","firstWord","line","tryParseProperty","property","context","code","message","locationOf","name","header","DiagnosticCodes","properties","description","parseDescription","isFileDirectiveAmongProperties","parseProperty","match","origin","unescapeString","visibility","isBlankPublicEventOrigin","hasGenerationMarker","generation","declared","tags","metadata","EventMetadataParser","eventBodyReservedWords","tag","value","eventDeclaration","expression","parseMappingSource","bodyIndent","passive","documentation","parseDocumentation","model"],"sources":["../../../../../../Compiler/Parsing/DeclarationParsers.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 { EventSyntax, PropertySyntax, ReadModelSyntax, TagSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { eventBodyReservedWords } from '../Text/ReservedWords';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { EventMetadataParser } from './EventMetadataParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirectiveAmongProperties } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typeHeader = pattern('^type\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventHeader = pattern(`^(?:(?<public>public)\\\\s+)?event\\\\s+(?<name>[A-Za-z_]\\\\w*)(?:\\\\s+generation\\\\s+(?<generation>[0-9]+))?(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst readModelHeader = pattern('^readmodel\\\\s+([A-Za-z_]\\\\w*)$');\nconst maximumGeneration = 4294967295;\nconst typeShapedPattern = pattern('^[A-Z]\\\\w*(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?$');\nconst tagIdentifierPattern = pattern('^[A-Za-z_]\\\\w*$');\n\n// 'description' takes no type reference, so a line with property shape is a property named description.\nconst isDescription = (line: SourceLine): boolean => firstWord(line.content) === 'description' && tryParseProperty(line) === undefined;\n\nfunction withoutIdentifier(context: ParserContext, property: PropertySyntax, line: SourceLine, code: string, message: string): PropertySyntax {\n if (!property.isIdentifier) {\n return property;\n }\n context.error(code, message, locationOf(line));\n return { ...property, isIdentifier: false };\n}\n\nexport function parseType(context: ParserContext, header: SourceLine): TypeSyntax {\n const name = typeHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidTypeDeclaration, `Invalid type declaration '${header.content}' - expected 'type <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Type '${name}'`);\n continue;\n }\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of type '${name}' cannot be marked identifier - only a command property can be`));\n }\n if (properties.length === 0) {\n context.error(DiagnosticCodes.TypeWithoutProperties, `Type '${name}' must declare at least one property`, locationOf(header));\n }\n return { kind: 'TypeSyntax', name, properties, description, location: locationOf(header) };\n}\n\nexport function parseEvent(context: ParserContext, header: SourceLine): EventSyntax {\n const match = eventHeader.exec(header.content);\n const name = match?.groups?.name ?? '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, `Invalid event declaration '${header.content}' - expected '[public] event <Name> [generation <N>] [from \"<origin>\"]'`, locationOf(header));\n }\n const origin = match?.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n const visibility = match?.groups?.public !== undefined || origin !== null ? EventVisibility.Public : EventVisibility.Private;\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, 'An event origin must be a nonblank quoted string', locationOf(header));\n }\n const hasGenerationMarker = match?.groups?.generation !== undefined;\n let generation = 1;\n if (hasGenerationMarker) {\n const declared = Number(match!.groups!.generation);\n if (!Number.isSafeInteger(declared) || declared === 0 || declared >= maximumGeneration) {\n context.error(DiagnosticCodes.InvalidEventGeneration, `Event '${name}' must declare a generation between 1 and ${maximumGeneration - 1}`, locationOf(header));\n } else {\n generation = declared;\n }\n }\n const properties: PropertySyntax[] = [];\n const tags: TagSyntax[] = [];\n const metadata = new EventMetadataParser(name);\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n if (eventBodyReservedWords.includes(firstWord(line.content))) {\n const tag = parseTag(context, line);\n if (tag !== undefined) {\n tags.push(tag);\n }\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n if (!metadata.tryParse(context, line)) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n }\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOnEventProperty,\n `Property '${property.name}' of event '${name}' cannot be marked identifier - an event never carries its event source id`));\n }\n return { kind: 'EventSyntax', name, properties, tags, visibility, origin, generation, hasGenerationMarker, ...metadata.value, location: locationOf(header) };\n}\n\n// 'tag <value>' - the port of the C# TagParser, with the warning the C# EventParser gives for a tag whose\n// value looks like a type, which is almost always a property named tag written without its '@'.\nexport function parseTag(context: ParserContext, line: SourceLine, eventDeclaration = true): TagSyntax | undefined {\n const value = line.content.substring('tag'.length).trim();\n if (eventDeclaration && typeShapedPattern.test(value)) {\n context.warning(DiagnosticCodes.TagPropertyReadAsTag,\n `'${line.content}' declares a static tag with the value '${value}', not a property named 'tag' - write 'tag \"${value}\"' for the tag, or '@${line.content}' for the property`,\n locationOf(line));\n }\n if (value.length === 0) {\n context.error(DiagnosticCodes.TagWithoutValue, 'Expected a value after \\'tag\\' - an identifier, a string literal or a context expression', locationOf(line));\n return undefined;\n }\n if (tagIdentifierPattern.test(value)) {\n return { kind: 'TagSyntax', value: { kind: 'LiteralExpressionSyntax', value, location: locationOf(line) }, location: locationOf(line) };\n }\n const expression = parseMappingSource(value, locationOf(line), context);\n if (expression.kind === 'RawExpressionSyntax') {\n context.error(DiagnosticCodes.InvalidTagValue, `Invalid tag value '${value}' - expected an identifier, a string literal or a context expression`, locationOf(line));\n return undefined;\n }\n return { kind: 'TagSyntax', value: expression, location: locationOf(line) };\n}\n\nexport function parseReadModel(context: ParserContext, header: SourceLine): ReadModelSyntax {\n let bodyIndent: number | undefined;\n let passive = false;\n const name = readModelHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReadModelDeclaration, `Invalid read model declaration '${header.content}' - expected 'readmodel <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n let documentation: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n bodyIndent ??= line.indent;\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Read model '${name}'`);\n } else if (firstWord(line.content) === 'documentation' && tryParseProperty(line) === undefined) {\n documentation = parseDocumentation(context, line, documentation, `Read model '${name}'`);\n } else if (line.content === 'passive') {\n if (passive) {\n context.warning(DiagnosticCodes.RepeatedPassiveDirective, \"A read model repeats 'passive'; the directive is idempotent.\", locationOf(line));\n }\n passive = true;\n } else if (firstWord(line.content) === 'passive' && ['true', 'false'].includes(line.content.slice('passive'.length).trim())) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n } else if (isFileDirectiveAmongProperties(line)) {\n continue;\n } else {\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n if (property.isKey && line.indent > bodyIndent) {\n context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', property.location);\n }\n properties.push(withoutIdentifier(context, line.indent > bodyIndent ? { ...property, isKey: false } : property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of read model '${name}' cannot be marked identifier - only a command property can be`));\n }\n }\n const model: ReadModelSyntax = { kind: 'ReadModelSyntax', name, properties, description, documentation, location: locationOf(header) };\n return passive ? { ...model, isPassive: true } : model;\n}\n"],"mappings":"A,o2BAoBA,MAAMA,EAAaC,EAAQ,2BAA2B,EAChDC,EAAcD,EAAQ,mIAAmIE,EAAkB,MAAM,EACjLC,EAAkBH,EAAQ,gCAAgC,EAE1DI,EAAoBJ,EAAQ,6CAA6C,EACzEK,EAAuBL,EAAQ,iBAAiB,EAGhD,cAAiB,GAA8BM,EAAUC,EAAK,OAAO,IAAM,eAAiBC,EAAiBD,CAAI,IAAM,IAAA,GAE7H,SAAS,kBAAkB,EAAwB,EAA0B,EAAkB,EAAc,EAAiC,CAK1I,OAJKE,EAAS,cAGdC,EAAQ,MAAMC,EAAMC,EAASC,EAAWN,CAAI,CAAC,EACtC,CAAE,GAAGE,EAAU,aAAc,EAAM,GAH/BA,CAIf,CAEA,SAAgB,UAAU,EAAwB,EAAgC,CAC9E,IAAMK,EAAOf,EAAW,KAAKgB,EAAO,OAAO,CAAC,GAAG,IAAM,GACjDD,IAAS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EAAO,UAAW,EAAK,EAAIA,CACrD,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n}from"../Text/patterns.js";import{parseDescription as r}from"./DescriptionParser.js";import{parseObserverFilter as i}from"./ObserverFilterParser.js";import{firstWord as a}from"./LineText.js";import{ParserContext as o}from"./ParserContext.js";import{locationOf as s}from"./SourceLine.js";function captureReads(e){let r=n(`^reads${t}+([A-Z]\\w*)(?:${t}+as${t}+([a-z_]\\w*))?(?:${t}+by${t}+([a-z_]\\w*))?$`).exec(e.content);if(!(r===null||[`as`,`by`,`reads`].includes(r[2])))return{kind:`ReadsSyntax`,readModel:r[1],alias:r[2]??null,by:r[3]??null,location:s(e)}}function fork(e){return new o(e.reader.fork(),e.path,e.languages)}function captureConcurrency(e,r){if(r.content!==`concurrency`)return;let i=fork(e),o=!1,c={},l;for(let e=i.peekChild(r.indent);e!==void 0;e=i.peekChild(r.indent))switch(i.reader.takeSignificant(),a(e.content)){case`eventSource`:e.content===`eventSource`&&(o=!0);break;case`sourceType`:case`streamType`:case`streamId`:{let r=n(`^(sourceType|streamType|streamId)${t}+([A-Za-z_]\\w*)$`).exec(e.content);r!==null&&(c[r[1]]??=r[2]);break}case`events`:{if(l!==void 0)break;let r=e.content.slice(6).split(`,`).map(e=>e.replace(RegExp(`^${t}+|${t}+$`,`gu`),``)).filter(Boolean);r.length>0&&r.every(e=>n(`^[A-Z]\\w*$`).test(e))&&(l=r);break}default:i.skipBlock(e.indent)}return{kind:`ConcurrencySyntax`,eventSource:o,eventSourceType:c.sourceType??null,eventStreamType:c.streamType??null,eventStreamId:c.streamId??null,eventTypes:l??[],location:s(r)}}function captureReducer(o,c){let l=n(`^reducer${t}+([A-Za-z_]\\w*)${t}*=>${t}*([A-Za-z_]\\w*)$`).exec(c.content),u=fork(o),d=[],f=null;for(let e=u.peekChild(c.indent);e!==void 0;e=u.peekChild(c.indent)){if(u.reader.takeSignificant(),a(e.content)===`description`){r(u,e,null,`Reducer`);continue}if(a(e.content)===`from`){f=i(u,e,f);continue}let o=n(`^on${t}+([A-Z]\\w*)$`).exec(e.content);o!==null&&d.push({kind:`ReducerRuleSyntax`,event:o[1],file:null,code:null,description:null,location:s(e)}),u.skipOpaqueBlock(e.indent)}for(let t of u.diagnostics.filter(t=>t.code===e.InvalidObserverFilter))o.error(t.code,t.message,t.location);return{kind:`ReducerSyntax`,from:f,name:l?.[1]??``,readModel:l?.[2]??``,rules:d,description:null,location:s(c)}}export{captureConcurrency,captureReads,captureReducer};
|
|
2
2
|
//# sourceMappingURL=DependencySourceParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencySourceParser.js","names":["match","nativePattern","dotNetWhitespace","line","locationOf","ParserContext","context","body","eventSource","dimensions","eventTypes","child","firstWord","dimension","names","name","rules","from","parseDescription","parseObserverFilter","rule","diagnostic","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/DependencySourceParser.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 { ConcurrencySyntax, ReadsSyntax, ReducerRuleSyntax, ReducerSyntax } from '../Syntax/DependencySources';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { parseObserverFilter } from './ObserverFilterParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reference-only capture does not change the committed parser's diagnostics or opaque-block skipping.\n// Fork before reading a body: code, malformed operands and unsupported realization stay opaque.\nexport function captureReads(line: SourceLine): ReadsSyntax | undefined {\n const match = nativePattern(`^reads${dotNetWhitespace}+([A-Z]\\\\w*)(?:${dotNetWhitespace}+as${dotNetWhitespace}+([a-z_]\\\\w*))?(?:${dotNetWhitespace}+by${dotNetWhitespace}+([a-z_]\\\\w*))?$`).exec(line.content);\n if (match === null || ['as', 'by', 'reads'].includes(match[2])) return undefined;\n return { kind: 'ReadsSyntax', readModel: match[1], alias: match[2] ?? null, by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction fork(context: ParserContext): ParserContext {\n return new ParserContext(context.reader.fork(), context.path, context.languages);\n}\n\nexport function captureConcurrency(context: ParserContext, line: SourceLine): ConcurrencySyntax | undefined {\n if (line.content !== 'concurrency') return undefined;\n const body = fork(context);\n let eventSource = false;\n const dimensions: Record<string, string> = {};\n let eventTypes: string[] | undefined;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n // C# keeps walking every descendant of the header for recognized dimensions, even malformed\n // or duplicate ones. Only an unknown dimension skips its own descendants during recovery.\n switch (firstWord(child.content)) {\n case 'eventSource':\n if (child.content === 'eventSource') eventSource = true;\n break;\n case 'sourceType':\n case 'streamType':\n case 'streamId': {\n const dimension = nativePattern(`^(sourceType|streamType|streamId)${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`).exec(child.content);\n if (dimension !== null) dimensions[dimension[1]] ??= dimension[2];\n break;\n }\n case 'events': {\n if (eventTypes !== undefined) break;\n const names = child.content.slice('events'.length).split(',').map(name => name.replace(new RegExp(`^${dotNetWhitespace}+|${dotNetWhitespace}+$`, 'gu'), '')).filter(Boolean);\n if (names.length > 0 && names.every(name => nativePattern('^[A-Z]\\\\w*$').test(name))) eventTypes = names;\n break;\n }\n default:\n body.skipBlock(child.indent);\n break;\n }\n }\n return { kind: 'ConcurrencySyntax', eventSource, eventSourceType: dimensions.sourceType ?? null, eventStreamType: dimensions.streamType ?? null, eventStreamId: dimensions.streamId ?? null, eventTypes: eventTypes ?? [], location: locationOf(line) };\n}\n\nexport function captureReducer(context: ParserContext, line: SourceLine): ReducerSyntax {\n const match = nativePattern(`^reducer${dotNetWhitespace}+([A-Za-z_]\\\\w*)${dotNetWhitespace}*=>${dotNetWhitespace}*([A-Za-z_]\\\\w*)$`).exec(line.content);\n const body = fork(context);\n const rules: ReducerRuleSyntax[] = [];\n let from: ObserverFilterSyntax | null = null;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n // Descriptions consume only their fenced text, never the following descendants. Diagnostics\n // stay on the fork, so reference capture does not change the committed parser's behavior.\n parseDescription(body, child, null, 'Reducer');\n continue;\n }\n if (firstWord(child.content) === 'from') {\n from = parseObserverFilter(body, child, from);\n continue;\n }\n const rule = nativePattern(`^on${dotNetWhitespace}+([A-Z]\\\\w*)$`).exec(child.content);\n if (rule !== null) rules.push({ kind: 'ReducerRuleSyntax', event: rule[1], file: null, code: null, description: null, location: locationOf(child) });\n body.skipOpaqueBlock(child.indent);\n }\n for (const diagnostic of body.diagnostics.filter(diagnostic => diagnostic.code === DiagnosticCodes.InvalidObserverFilter))\n context.error(diagnostic.code, diagnostic.message, diagnostic.location);\n return { kind: 'ReducerSyntax', from, name: match?.[1] ?? '', readModel: match?.[2] ?? '', rules, description: null, location: locationOf(line) };\n}\n"],"mappings":"ucAeA,SAAgB,aAAa,EAA2C,CACpE,IAAMA,EAAQC,EAAc,SAASC,EAAiB,iBAAiBA,EAAiB,KAAKA,EAAiB,oBAAoBA,EAAiB,KAAKA,EAAiB,iBAAiB,CAAC,CAAC,KAAKC,EAAK,OAAO,EAC7M,GAAI,MAAU,MAAQ,CAAC,KAAM,KAAM,OAAO,CAAC,CAAC,SAASH,EAAM,EAAE,GAC7D,MAAO,CAAE,KAAM,cAAe,UAAWA,EAAM,GAA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"DependencySourceParser.js","names":["match","nativePattern","dotNetWhitespace","line","locationOf","ParserContext","context","body","eventSource","dimensions","eventTypes","child","firstWord","dimension","names","name","rules","from","parseDescription","parseObserverFilter","rule","diagnostic","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/DependencySourceParser.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 { ConcurrencySyntax, ReadsSyntax, ReducerRuleSyntax, ReducerSyntax } from '../Syntax/DependencySources';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { ObserverFilterSyntax } from '../Syntax/ObserverFilterSyntax';\nimport { parseObserverFilter } from './ObserverFilterParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reference-only capture does not change the committed parser's diagnostics or opaque-block skipping.\n// Fork before reading a body: code, malformed operands and unsupported realization stay opaque.\nexport function captureReads(line: SourceLine): ReadsSyntax | undefined {\n const match = nativePattern(`^reads${dotNetWhitespace}+([A-Z]\\\\w*)(?:${dotNetWhitespace}+as${dotNetWhitespace}+([a-z_]\\\\w*))?(?:${dotNetWhitespace}+by${dotNetWhitespace}+([a-z_]\\\\w*))?$`).exec(line.content);\n if (match === null || ['as', 'by', 'reads'].includes(match[2])) return undefined;\n return { kind: 'ReadsSyntax', readModel: match[1], alias: match[2] ?? null, by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction fork(context: ParserContext): ParserContext {\n return new ParserContext(context.reader.fork(), context.path, context.languages);\n}\n\nexport function captureConcurrency(context: ParserContext, line: SourceLine): ConcurrencySyntax | undefined {\n if (line.content !== 'concurrency') return undefined;\n const body = fork(context);\n let eventSource = false;\n const dimensions: Record<string, string> = {};\n let eventTypes: string[] | undefined;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n // C# keeps walking every descendant of the header for recognized dimensions, even malformed\n // or duplicate ones. Only an unknown dimension skips its own descendants during recovery.\n switch (firstWord(child.content)) {\n case 'eventSource':\n if (child.content === 'eventSource') eventSource = true;\n break;\n case 'sourceType':\n case 'streamType':\n case 'streamId': {\n const dimension = nativePattern(`^(sourceType|streamType|streamId)${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`).exec(child.content);\n if (dimension !== null) dimensions[dimension[1]] ??= dimension[2];\n break;\n }\n case 'events': {\n if (eventTypes !== undefined) break;\n const names = child.content.slice('events'.length).split(',').map(name => name.replace(new RegExp(`^${dotNetWhitespace}+|${dotNetWhitespace}+$`, 'gu'), '')).filter(Boolean);\n if (names.length > 0 && names.every(name => nativePattern('^[A-Z]\\\\w*$').test(name))) eventTypes = names;\n break;\n }\n default:\n body.skipBlock(child.indent);\n break;\n }\n }\n return { kind: 'ConcurrencySyntax', eventSource, eventSourceType: dimensions.sourceType ?? null, eventStreamType: dimensions.streamType ?? null, eventStreamId: dimensions.streamId ?? null, eventTypes: eventTypes ?? [], location: locationOf(line) };\n}\n\nexport function captureReducer(context: ParserContext, line: SourceLine): ReducerSyntax {\n const match = nativePattern(`^reducer${dotNetWhitespace}+([A-Za-z_]\\\\w*)${dotNetWhitespace}*=>${dotNetWhitespace}*([A-Za-z_]\\\\w*)$`).exec(line.content);\n const body = fork(context);\n const rules: ReducerRuleSyntax[] = [];\n let from: ObserverFilterSyntax | null = null;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n // Descriptions consume only their fenced text, never the following descendants. Diagnostics\n // stay on the fork, so reference capture does not change the committed parser's behavior.\n parseDescription(body, child, null, 'Reducer');\n continue;\n }\n if (firstWord(child.content) === 'from') {\n from = parseObserverFilter(body, child, from);\n continue;\n }\n const rule = nativePattern(`^on${dotNetWhitespace}+([A-Z]\\\\w*)$`).exec(child.content);\n if (rule !== null) rules.push({ kind: 'ReducerRuleSyntax', event: rule[1], file: null, code: null, description: null, location: locationOf(child) });\n body.skipOpaqueBlock(child.indent);\n }\n for (const diagnostic of body.diagnostics.filter(diagnostic => diagnostic.code === DiagnosticCodes.InvalidObserverFilter))\n context.error(diagnostic.code, diagnostic.message, diagnostic.location);\n return { kind: 'ReducerSyntax', from, name: match?.[1] ?? '', readModel: match?.[2] ?? '', rules, description: null, location: locationOf(line) };\n}\n"],"mappings":"A,ucAeA,SAAgB,aAAa,EAA2C,CACpE,IAAMA,EAAQC,EAAc,SAASC,EAAiB,iBAAiBA,EAAiB,KAAKA,EAAiB,oBAAoBA,EAAiB,KAAKA,EAAiB,iBAAiB,CAAC,CAAC,KAAKC,EAAK,OAAO,EAC7M,GAAI,MAAU,MAAQ,CAAC,KAAM,KAAM,OAAO,CAAC,CAAC,SAASH,EAAM,EAAE,GAC7D,MAAO,CAAE,KAAM,cAAe,UAAWA,EAAM,GAAI,MAAOA,EAAM,IAAM,KAAM,GAAIA,EAAM,IAAM,KAAM,SAAUI,EAAWD,CAAI,CAAE,CACjI,CAEA,SAAS,KAAK,EAAuC,CACjD,OAAO,IAAIE,EAAcC,EAAQ,OAAO,KAAK,EAAGA,EAAQ,KAAMA,EAAQ,SAAS,CACnF,CAEA,SAAgB,mBAAmB,EAAwB,EAAiD,CACxG,GAAIH,EAAK,UAAY,cAAe,OACpC,IAAMI,EAAO,KAAKD,CAAO,EACrBE,EAAc,GACZC,EAAqC,CAAC,EACxCC,EACJ,IAAK,IAAIC,EAAQJ,EAAK,UAAUJ,EAAK,MAAM,EAAGQ,IAAU,IAAA,GAAW,EAAQJ,EAAK,UAAUJ,EAAK,MAAM,EAIjG,OAHAI,EAAK,OAAO,gBAAgB,EAGpBK,EAAUD,EAAM,OAAO,EAA/B,CACI,IAAK,cACGA,EAAM,UAAY,gBAAe,EAAc,IACnD,MACJ,IAAK,aACL,IAAK,aACL,IAAK,WAAY,CACb,IAAME,EAA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EAAMI,EAAOM,CAAI,EAC5C,QACJ,CACA,IAAMG,EAAOnB,EAAc,MAAMC,EAAiB,cAAc,CAAC,CAAC,KAAKS,EAAM,OAAO,EAChFS,IAAS,MAAMJ,EAAM,KAAK,CAAE,KAAM,oBAAqB,MAAOI,EAAK,GAAI,KAAM,KAAM,KAAM,KAAM,YAAa,KAAM,SAAUhB,EAAWO,CAAK,CAAE,CAAC,EACnJJ,EAAK,gBAAgBI,EAAM,MAAM,CACrC,CACA,IAAK,IAAMU,KAAcd,EAAK,YAAY,OAAO,GAAcc,EAAW,OAASC,EAAgB,qBAAqB,EACpHhB,EAAQ,MAAMe,EAAW,KAAMA,EAAW,QAASA,EAAW,QAAQ,EAC1E,MAAO,CAAE,KAAM,gBAAiB,OAAM,KAAMrB,IAAQ,IAAM,GAAI,UAAWA,IAAQ,IAAM,GAAI,QAAO,YAAa,KAAM,SAAUI,EAAWD,CAAI,CAAE,CACpJ,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependsOnParser.js","names":["declaration","nativePattern","dotNetWhitespace","target","line","context","errorCode","locationOf","declarations","dependency","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/DependsOnParser.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 { DependsOnSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst declaration = nativePattern(`^depends${dotNetWhitespace}+on${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$`);\n\nexport function parseDependsOn(context: ParserContext, line: SourceLine, declarations: DependsOnSyntax[], errorCode: string): void {\n const target = declaration.exec(line.content)?.[1];\n if (target === undefined) {\n context.error(errorCode, `Invalid dependency declaration '${line.content}' - expected 'depends on <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n if (declarations.some(dependency => dependency.target === target)) {\n context.warning(DiagnosticCodes.RepeatedDependencyDeclaration, `Dependency '${target}' is already declared on this container - this repeated declaration is ignored`, locationOf(line));\n return;\n }\n declarations.push({ kind: 'DependsOnSyntax', target, location: locationOf(line) });\n}\n"],"mappings":"gPASA,MAAMA,EAAcC,EAAc,WAAWC,EAAiB,KAAKA,EAAiB,uCAAuC,EAE3H,SAAgB,eAAe,EAAwB,EAAkB,EAAiC,EAAyB,CAC/H,IAAMC,EAASH,EAAY,KAAKI,EAAK,OAAO,CAAC,GAAG,GAC5CD,IAAW,IAAA,IACXE,EAAQ,MAAMC,EAAW,mCAAmCF,EAAK,QAAQ,kCAAmCG,EAAWH,CAAI,CAAC,EAC5HC,EAAQ,UAAUD,EAAK,MAAM,GAG7BI,EAAa,KAAK,GAAcC,EAAW,SAAWN,CAAM,EAC5DE,EAAQ,QAAQK,EAAgB,8BAA+B,eAAeP,EAAO,gFAAiFI,EAAWH,CAAI,CAAC,EAG1LI,EAAa,KAAK,CAAE,KAAM,kBAAmB,SAAQ,SAAUD,EAAWH,CAAI,CAAE,CAAC,CACrF"}
|
|
1
|
+
{"version":3,"file":"DependsOnParser.js","names":["declaration","nativePattern","dotNetWhitespace","target","line","context","errorCode","locationOf","declarations","dependency","DiagnosticCodes"],"sources":["../../../../../../Compiler/Parsing/DependsOnParser.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 { DependsOnSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst declaration = nativePattern(`^depends${dotNetWhitespace}+on${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$`);\n\nexport function parseDependsOn(context: ParserContext, line: SourceLine, declarations: DependsOnSyntax[], errorCode: string): void {\n const target = declaration.exec(line.content)?.[1];\n if (target === undefined) {\n context.error(errorCode, `Invalid dependency declaration '${line.content}' - expected 'depends on <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n if (declarations.some(dependency => dependency.target === target)) {\n context.warning(DiagnosticCodes.RepeatedDependencyDeclaration, `Dependency '${target}' is already declared on this container - this repeated declaration is ignored`, locationOf(line));\n return;\n }\n declarations.push({ kind: 'DependsOnSyntax', target, location: locationOf(line) });\n}\n"],"mappings":"A,gPASA,MAAMA,EAAcC,EAAc,WAAWC,EAAiB,KAAKA,EAAiB,uCAAuC,EAE3H,SAAgB,eAAe,EAAwB,EAAkB,EAAiC,EAAyB,CAC/H,IAAMC,EAASH,EAAY,KAAKI,EAAK,OAAO,CAAC,GAAG,GAC5CD,IAAW,IAAA,IACXE,EAAQ,MAAMC,EAAW,mCAAmCF,EAAK,QAAQ,kCAAmCG,EAAWH,CAAI,CAAC,EAC5HC,EAAQ,UAAUD,EAAK,MAAM,GAG7BI,EAAa,KAAK,GAAcC,EAAW,SAAWN,CAAM,EAC5DE,EAAQ,QAAQK,EAAgB,8BAA+B,eAAeP,EAAO,gFAAiFI,EAAWH,CAAI,CAAC,EAG1LI,EAAa,KAAK,CAAE,KAAM,kBAAmB,SAAQ,SAAUD,EAAWH,CAAI,CAAE,CAAC,CACrF,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{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseFencedText as i}from"./CodeBlockParser.js";import{locationOf as a}from"./SourceLine.js";const o=t(`^description\\s+"(${n})"$`);function parseDescription(t,n,s,c,l=!1){if(n.content===`description`){let r=i(t,`description`,n,l);return r===null?s:r.trim().length===0?(t.error(e.EmptyDescription,`${c} declares an empty description - the fenced block must contain text`,a(n)),s):keep(t,n,s,c,r)}let u=o.exec(n.content);return u===null?(t.error(e.InvalidDescription,`Invalid description '${n.content}' - expected 'description "<text>"'`,a(n)),s):keep(t,n,s,c,r(u[1]))}function keep(t,n,r,i,o){return r===null?o:(t.error(e.DuplicateDescription,`${i} already declares a description - at most one is allowed`,a(n)),r)}export{parseDescription};
|
|
2
2
|
//# sourceMappingURL=DescriptionParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionParser.js","names":["descriptionPattern","pattern","stringBodyPattern","line","text","parseFencedText","context","allowMarkdown","existing","DiagnosticCodes","owner","locationOf","match","unescapeString","description"],"sources":["../../../../../../Compiler/Parsing/DescriptionParser.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst descriptionPattern = pattern(`^description\\\\s+\"(${stringBodyPattern})\"$`);\n\n// Reads 'description \"<text>\"' or a 'description' followed by a ```text fence. A construct keeps its first\n// description; a second one is reported and ignored.\nexport function parseDescription(context: ParserContext, line: SourceLine, existing: string | null, owner: string, allowMarkdown = false): string | null {\n if (line.content === 'description') {\n const text = parseFencedText(context, 'description', line, allowMarkdown);\n if (text === null) {\n return existing;\n }\n if (text.trim().length === 0) {\n context.error(DiagnosticCodes.EmptyDescription, `${owner} declares an empty description - the fenced block must contain text`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, text);\n }\n const match = descriptionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDescription, `Invalid description '${line.content}' - expected 'description \"<text>\"'`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, unescapeString(match[1]));\n}\n\nfunction keep(context: ParserContext, line: SourceLine, existing: string | null, owner: string, description: string): string | null {\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDescription, `${owner} already declares a description - at most one is allowed`, locationOf(line));\n return existing;\n }\n return description;\n}\n"],"mappings":"4VAUA,MAAMA,EAAqBC,EAAQ,qBAAqBC,EAAkB,IAAI,EAI9E,SAAgB,iBAAiB,EAAwB,EAAkB,EAAyB,EAAe,EAAgB,GAAsB,CACrJ,GAAIC,EAAK,UAAY,cAAe,CAChC,IAAMC,EAAOC,EAAgBC,EAAS,cAAeH,EAAMI,CAAa,EAQxE,OAPIH,IAAS,KACFI,EAEPJ,EAAK,KAAK,CAAC,CAAC,SAAW,GACvBE,EAAQ,MAAMG,EAAgB,iBAAkB,GAAGC,EAAM,qEAAsEC,EAAWR,CAAI,CAAC,EACxIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAON,CAAI,CACpD,CACA,IAAMQ,EAAQZ,EAAmB,KAAKG,EAAK,OAAO,EAKlD,OAJIS,IAAU,MACVN,EAAQ,MAAMG,EAAgB,mBAAoB,wBAAwBN,EAAK,QAAQ,qCAAsCQ,EAAWR,CAAI,CAAC,EACtIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAOG,EAAeD,EAAM,EAAE,CAAC,CACxE,CAEA,SAAS,KAAK,EAAwB,EAAkB,EAAyB,EAAe,EAAoC,CAKhI,OAJIJ,IAAa,KAIVM,GAHHR,EAAQ,MAAMG,EAAgB,qBAAsB,GAAGC,EAAM,0DAA2DC,EAAWR,CAAI,CAAC,EACjIK,EAGf"}
|
|
1
|
+
{"version":3,"file":"DescriptionParser.js","names":["descriptionPattern","pattern","stringBodyPattern","line","text","parseFencedText","context","allowMarkdown","existing","DiagnosticCodes","owner","locationOf","match","unescapeString","description"],"sources":["../../../../../../Compiler/Parsing/DescriptionParser.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst descriptionPattern = pattern(`^description\\\\s+\"(${stringBodyPattern})\"$`);\n\n// Reads 'description \"<text>\"' or a 'description' followed by a ```text fence. A construct keeps its first\n// description; a second one is reported and ignored.\nexport function parseDescription(context: ParserContext, line: SourceLine, existing: string | null, owner: string, allowMarkdown = false): string | null {\n if (line.content === 'description') {\n const text = parseFencedText(context, 'description', line, allowMarkdown);\n if (text === null) {\n return existing;\n }\n if (text.trim().length === 0) {\n context.error(DiagnosticCodes.EmptyDescription, `${owner} declares an empty description - the fenced block must contain text`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, text);\n }\n const match = descriptionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDescription, `Invalid description '${line.content}' - expected 'description \"<text>\"'`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, unescapeString(match[1]));\n}\n\nfunction keep(context: ParserContext, line: SourceLine, existing: string | null, owner: string, description: string): string | null {\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDescription, `${owner} already declares a description - at most one is allowed`, locationOf(line));\n return existing;\n }\n return description;\n}\n"],"mappings":"A,4VAUA,MAAMA,EAAqBC,EAAQ,qBAAqBC,EAAkB,IAAI,EAI9E,SAAgB,iBAAiB,EAAwB,EAAkB,EAAyB,EAAe,EAAgB,GAAsB,CACrJ,GAAIC,EAAK,UAAY,cAAe,CAChC,IAAMC,EAAOC,EAAgBC,EAAS,cAAeH,EAAMI,CAAa,EAQxE,OAPIH,IAAS,KACFI,EAEPJ,EAAK,KAAK,CAAC,CAAC,SAAW,GACvBE,EAAQ,MAAMG,EAAgB,iBAAkB,GAAGC,EAAM,qEAAsEC,EAAWR,CAAI,CAAC,EACxIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAON,CAAI,CACpD,CACA,IAAMQ,EAAQZ,EAAmB,KAAKG,EAAK,OAAO,EAKlD,OAJIS,IAAU,MACVN,EAAQ,MAAMG,EAAgB,mBAAoB,wBAAwBN,EAAK,QAAQ,qCAAsCQ,EAAWR,CAAI,CAAC,EACtIK,GAEJ,KAAKF,EAASH,EAAMK,EAAUE,EAAOG,EAAeD,EAAM,EAAE,CAAC,CACxE,CAEA,SAAS,KAAK,EAAwB,EAAkB,EAAyB,EAAe,EAAoC,CAKhI,OAJIJ,IAAa,KAIVM,GAHHR,EAAQ,MAAMG,EAAgB,qBAAsB,GAAGC,EAAM,0DAA2DC,EAAWR,CAAI,CAAC,EACjIK,EAGf,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{parseFencedText as t}from"./CodeBlockParser.js";import{locationOf as n}from"./SourceLine.js";function parseDocumentation(r,i,a,o,s=e.InvalidDocumentation){if(i.content!==`documentation`||r.peekChild(i.indent)?.content!=="```markdown")return r.error(s,`${o} documentation requires a fenced markdown block`,n(i)),r.skipOpaqueBlock(i.indent),a;let c=t(r,`markdown`,i);return c===null||c.trim().length===0||a!==null?(r.error(s,`${o} accepts one nonempty documentation block`,n(i)),a):c}export{parseDocumentation};
|
|
2
2
|
//# sourceMappingURL=DocumentationParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentationParser.js","names":["DiagnosticCodes","line","context","code","owner","locationOf","existing","text","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/DocumentationParser.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 { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport function parseDocumentation(context: ParserContext, line: SourceLine, existing: string | null, owner: string, code: string = DiagnosticCodes.InvalidDocumentation): string | null {\n if (line.content !== 'documentation' || context.peekChild(line.indent)?.content !== '```markdown') {\n context.error(code, `${owner} documentation requires a fenced markdown block`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return existing;\n }\n const text = parseFencedText(context, 'markdown', line);\n if (text === null || text.trim().length === 0 || existing !== null) {\n context.error(code, `${owner} accepts one nonempty documentation block`, locationOf(line));\n return existing;\n }\n return text;\n}\n"],"mappings":"6NAQA,SAAgB,mBAAmB,EAAwB,EAAkB,EAAyB,EAAe,EAAeA,EAAgB,qBAAqC,CACrL,GAAIC,EAAK,UAAY,iBAAmBC,EAAQ,UAAUD,EAAK,MAAM,CAAC,EAAE,UAAY,cAGhF,OAFAC,EAAQ,MAAMC,EAAM,GAAGC,EAAM,iDAAkDC,EAAWJ,CAAI,CAAC,EAC/FC,EAAQ,gBAAgBD,EAAK,MAAM,EAC5BK,EAEX,IAAMC,EAAOC,EAAgBN,EAAS,WAAYD,CAAI,EAKtD,OAJIM,IAAS,MAAQA,EAAK,KAAK,CAAC,CAAC,SAAW,GAAKD,IAAa,MAC1DJ,EAAQ,MAAMC,EAAM,GAAGC,EAAM,2CAA4CC,EAAWJ,CAAI,CAAC,EAClFK,GAEJC,CACX"}
|
|
1
|
+
{"version":3,"file":"DocumentationParser.js","names":["DiagnosticCodes","line","context","code","owner","locationOf","existing","text","parseFencedText"],"sources":["../../../../../../Compiler/Parsing/DocumentationParser.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 { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport function parseDocumentation(context: ParserContext, line: SourceLine, existing: string | null, owner: string, code: string = DiagnosticCodes.InvalidDocumentation): string | null {\n if (line.content !== 'documentation' || context.peekChild(line.indent)?.content !== '```markdown') {\n context.error(code, `${owner} documentation requires a fenced markdown block`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return existing;\n }\n const text = parseFencedText(context, 'markdown', line);\n if (text === null || text.trim().length === 0 || existing !== null) {\n context.error(code, `${owner} accepts one nonempty documentation block`, locationOf(line));\n return existing;\n }\n return text;\n}\n"],"mappings":"A,6NAQA,SAAgB,mBAAmB,EAAwB,EAAkB,EAAyB,EAAe,EAAeA,EAAgB,qBAAqC,CACrL,GAAIC,EAAK,UAAY,iBAAmBC,EAAQ,UAAUD,EAAK,MAAM,CAAC,EAAE,UAAY,cAGhF,OAFAC,EAAQ,MAAMC,EAAM,GAAGC,EAAM,iDAAkDC,EAAWJ,CAAI,CAAC,EAC/FC,EAAQ,gBAAgBD,EAAK,MAAM,EAC5BK,EAEX,IAAMC,EAAOC,EAAgBN,EAAS,WAAYD,CAAI,EAKtD,OAJIM,IAAS,MAAQA,EAAK,KAAK,CAAC,CAAC,SAAW,GAAKD,IAAa,MAC1DJ,EAAQ,MAAMC,EAAM,GAAGC,EAAM,2CAA4CC,EAAWJ,CAAI,CAAC,EAClFK,GAEJC,CACX,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{unescapeIdentifier as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";const i=t(`^(@?[a-z_]\\w*)\\s*=\\s*(.*)$`),a=/^-?(0|[1-9][0-9]*)$/;var EnumerationMembers=class{numbers=[];seen=/* @__PURE__ */ new Set;numbered=0;tryNumbered(t,o){let s=i.exec(o.content);if(s===null)return;this.numbered++;let c=s[2],l=Number(c);if(a.exec(c)?.[0]!==c)t.error(e.MalformedEnumerationNumber,`Invalid enum number '${c}' - expected an optional '-' followed by decimal digits, with no leading zero`,r(o));else if(!Number.isInteger(l)||l<-2147483648||l>2147483647)t.error(e.EnumerationNumberOutsideInt32,`Enum number '${c}' is outside the int32 range`,r(o));else{let n=l===0?0:l;this.numbers.push(n),this.seen.has(n)&&t.error(e.DuplicateEnumerationNumber,`Enum number '${n}' is declared more than once`,r(o)),this.seen.add(n)}return n(s[1])}finish(t,n,i){return this.numbered>0&&this.numbered!==i&&t.error(e.MixedEnumerationNumbering,`Enum members must either all declare numbers or all omit them`,r(n)),this.numbered>0&&this.numbers.length===i?this.numbers:void 0}};export{EnumerationMembers};
|
|
2
2
|
//# sourceMappingURL=EnumerationMembers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumerationMembers.js","names":["memberPattern","pattern","numberPattern","match","line","literal","number","context","DiagnosticCodes","locationOf","canonical","unescapeIdentifier","count","declaration"],"sources":["../../../../../../Compiler/Parsing/EnumerationMembers.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 { pattern } from '../Text/patterns';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst memberPattern = pattern('^(@?[a-z_]\\\\w*)\\\\s*=\\\\s*(.*)$');\nconst numberPattern = /^-?(0|[1-9][0-9]*)$/;\n\nexport class EnumerationMembers {\n private readonly numbers: number[] = [];\n private readonly seen = new Set<number>();\n private numbered = 0;\n\n tryNumbered(context: ParserContext, line: SourceLine): string | undefined {\n const match = memberPattern.exec(line.content);\n if (match === null) return undefined;\n this.numbered++;\n const literal = match[2];\n const number = Number(literal);\n if (numberPattern.exec(literal)?.[0] !== literal) {\n context.error(DiagnosticCodes.MalformedEnumerationNumber, `Invalid enum number '${literal}' - expected an optional '-' followed by decimal digits, with no leading zero`, locationOf(line));\n } else if (!Number.isInteger(number) || number < -2147483648 || number > 2147483647) {\n context.error(DiagnosticCodes.EnumerationNumberOutsideInt32, `Enum number '${literal}' is outside the int32 range`, locationOf(line));\n } else {\n const canonical = number === 0 ? 0 : number;\n this.numbers.push(canonical);\n if (this.seen.has(canonical)) context.error(DiagnosticCodes.DuplicateEnumerationNumber, `Enum number '${canonical}' is declared more than once`, locationOf(line));\n this.seen.add(canonical);\n }\n return unescapeIdentifier(match[1]);\n }\n\n finish(context: ParserContext, declaration: SourceLine, count: number): readonly number[] | undefined {\n if (this.numbered > 0 && this.numbered !== count) {\n context.error(DiagnosticCodes.MixedEnumerationNumbering, 'Enum members must either all declare numbers or all omit them', locationOf(declaration));\n }\n return this.numbered > 0 && this.numbers.length === count ? this.numbers : undefined;\n }\n}\n"],"mappings":"uQASA,MAAMA,EAAgBC,EAAQ,+BAA+B,EACvDC,EAAgB,sBAEtB,IAAa,mBAAb,KAAgC,CAC5B,QAAqC,CAAC,EACtC,qBAAwB,IAAI,IAC5B,SAAmB,EAEnB,YAAY,EAAwB,EAAsC,CACtE,IAAMC,EAAQH,EAAc,KAAKI,EAAK,OAAO,EAC7C,GAAID,IAAU,KAAM,OACpB,KAAK,WACL,IAAME,EAAUF,EAAM,GAChBG,EAAS,OAAOD,CAAO,EAC7B,GAAIH,EAAc,KAAKG,CAAO,CAAC,GAAG,KAAOA,EACrCE,EAAQ,MAAMC,EAAgB,2BAA4B,wBAAwBH,EAAQ,+EAAgFI,EAAWL,CAAI,CAAC,OACvL,GAAI,CAAC,OAAO,UAAUE,CAAM,GAAKA,EAAS,aAAeA,EAAS,WACrEC,EAAQ,MAAMC,EAAgB,8BAA+B,gBAAgBH,EAAQ,8BAA+BI,EAAWL,CAAI,CAAC,MACjI,CACH,IAAMM,EAAYJ,IAAW,EAAI,EAAIA,EACrC,KAAK,QAAQ,KAAKI,CAAS,EACvB,KAAK,KAAK,IAAIA,CAAS,GAAGH,EAAQ,MAAMC,EAAgB,2BAA4B,gBAAgBE,EAAU,8BAA+BD,EAAWL,CAAI,CAAC,EACjK,KAAK,KAAK,IAAIM,CAAS,CAC3B,CACA,OAAOC,EAAmBR,EAAM,EAAE,CACtC,CAEA,OAAO,EAAwB,EAAyB,EAA8C,CAIlG,OAHI,KAAK,SAAW,GAAK,KAAK,WAAaS,GACvCL,EAAQ,MAAMC,EAAgB,0BAA2B,gEAAiEC,EAAWI,CAAW,CAAC,EAE9I,KAAK,SAAW,GAAK,KAAK,QAAQ,SAAWD,EAAQ,KAAK,QAAU,IAAA,EAC/E,CACJ"}
|
|
1
|
+
{"version":3,"file":"EnumerationMembers.js","names":["memberPattern","pattern","numberPattern","match","line","literal","number","context","DiagnosticCodes","locationOf","canonical","unescapeIdentifier","count","declaration"],"sources":["../../../../../../Compiler/Parsing/EnumerationMembers.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 { pattern } from '../Text/patterns';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst memberPattern = pattern('^(@?[a-z_]\\\\w*)\\\\s*=\\\\s*(.*)$');\nconst numberPattern = /^-?(0|[1-9][0-9]*)$/;\n\nexport class EnumerationMembers {\n private readonly numbers: number[] = [];\n private readonly seen = new Set<number>();\n private numbered = 0;\n\n tryNumbered(context: ParserContext, line: SourceLine): string | undefined {\n const match = memberPattern.exec(line.content);\n if (match === null) return undefined;\n this.numbered++;\n const literal = match[2];\n const number = Number(literal);\n if (numberPattern.exec(literal)?.[0] !== literal) {\n context.error(DiagnosticCodes.MalformedEnumerationNumber, `Invalid enum number '${literal}' - expected an optional '-' followed by decimal digits, with no leading zero`, locationOf(line));\n } else if (!Number.isInteger(number) || number < -2147483648 || number > 2147483647) {\n context.error(DiagnosticCodes.EnumerationNumberOutsideInt32, `Enum number '${literal}' is outside the int32 range`, locationOf(line));\n } else {\n const canonical = number === 0 ? 0 : number;\n this.numbers.push(canonical);\n if (this.seen.has(canonical)) context.error(DiagnosticCodes.DuplicateEnumerationNumber, `Enum number '${canonical}' is declared more than once`, locationOf(line));\n this.seen.add(canonical);\n }\n return unescapeIdentifier(match[1]);\n }\n\n finish(context: ParserContext, declaration: SourceLine, count: number): readonly number[] | undefined {\n if (this.numbered > 0 && this.numbered !== count) {\n context.error(DiagnosticCodes.MixedEnumerationNumbering, 'Enum members must either all declare numbers or all omit them', locationOf(declaration));\n }\n return this.numbered > 0 && this.numbers.length === count ? this.numbers : undefined;\n }\n}\n"],"mappings":"A,uQASA,MAAMA,EAAgBC,EAAQ,+BAA+B,EACvDC,EAAgB,sBAEtB,IAAa,mBAAb,KAAgC,CAC5B,QAAqC,CAAC,EACtC,qBAAwB,IAAI,IAC5B,SAAmB,EAEnB,YAAY,EAAwB,EAAsC,CACtE,IAAMC,EAAQH,EAAc,KAAKI,EAAK,OAAO,EAC7C,GAAID,IAAU,KAAM,OACpB,KAAK,WACL,IAAME,EAAUF,EAAM,GAChBG,EAAS,OAAOD,CAAO,EAC7B,GAAIH,EAAc,KAAKG,CAAO,CAAC,GAAG,KAAOA,EACrCE,EAAQ,MAAMC,EAAgB,2BAA4B,wBAAwBH,EAAQ,+EAAgFI,EAAWL,CAAI,CAAC,OACvL,GAAI,CAAC,OAAO,UAAUE,CAAM,GAAKA,EAAS,aAAeA,EAAS,WACrEC,EAAQ,MAAMC,EAAgB,8BAA+B,gBAAgBH,EAAQ,8BAA+BI,EAAWL,CAAI,CAAC,MACjI,CACH,IAAMM,EAAYJ,IAAW,EAAI,EAAIA,EACrC,KAAK,QAAQ,KAAKI,CAAS,EACvB,KAAK,KAAK,IAAIA,CAAS,GAAGH,EAAQ,MAAMC,EAAgB,2BAA4B,gBAAgBE,EAAU,8BAA+BD,EAAWL,CAAI,CAAC,EACjK,KAAK,KAAK,IAAIM,CAAS,CAC3B,CACA,OAAOC,EAAmBR,EAAM,EAAE,CACtC,CAEA,OAAO,EAAwB,EAAyB,EAA8C,CAIlG,OAHI,KAAK,SAAW,GAAK,KAAK,WAAaS,GACvCL,EAAQ,MAAMC,EAAgB,0BAA2B,gEAAiEC,EAAWI,CAAW,CAAC,EAE9I,KAAK,SAAW,GAAK,KAAK,QAAQ,SAAWD,EAAQ,KAAK,QAAU,IAAA,EAC/E,CACJ,E"}
|
|
@@ -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{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n,unescapeString as r}from"../Text/StringLiteral.js";import{parseDocumentation as i}from"./DocumentationParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{firstWord as o}from"./LineText.js";import{locationOf as s}from"./SourceLine.js";const c=t(`^id\\s+"(${n})"$`);var EventMetadataParser=class{name;value={id:null,description:null,documentation:null};constructor(e){this.name=e}tryParse(t,n){let l=s(n);switch(o(n.content)){case`id`:{let i=c.exec(n.content),a=i===null?``:r(i[1]);return a.trim().length===0||this.value.id!==null?t.error(e.InvalidEventId,`Event '${this.name}' accepts one nonempty 'id "<old-name>"'`,l):(this.value.id=a,a===this.name&&t.information(e.RedundantEventId,`Event '${this.name}' already has this name as its identity - remove the redundant id`,l)),!0}case`description`:return this.value.description=a(t,n,this.value.description,`Event '${this.name}'`,!0),!0;case`documentation`:return this.value.documentation=i(t,n,this.value.documentation,`Event '${this.name}'`,e.InvalidEventDocumentation),!0;default:return!1}}};export{EventMetadataParser};
|
|
2
2
|
//# sourceMappingURL=EventMetadataParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventMetadataParser.js","names":["idPattern","pattern","stringBodyPattern","name","location","locationOf","line","firstWord","match","id","unescapeString","context","DiagnosticCodes","parseDescription","parseDocumentation"],"sources":["../../../../../../Compiler/Parsing/EventMetadataParser.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst idPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\n\nexport class EventMetadataParser {\n readonly value: { id: string | null; description: string | null; documentation: string | null } = { id: null, description: null, documentation: null };\n\n constructor(readonly name: string) {}\n\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'id': {\n const match = idPattern.exec(line.content);\n const id = match === null ? '' : unescapeString(match[1]);\n if (id.trim().length === 0 || this.value.id !== null) {\n context.error(DiagnosticCodes.InvalidEventId, `Event '${this.name}' accepts one nonempty 'id \"<old-name>\"'`, location);\n } else {\n this.value.id = id;\n if (id === this.name) {\n context.information(DiagnosticCodes.RedundantEventId, `Event '${this.name}' already has this name as its identity - remove the redundant id`, location);\n }\n }\n return true;\n }\n case 'description':\n this.value.description = parseDescription(context, line, this.value.description, `Event '${this.name}'`, true);\n return true;\n case 'documentation':\n this.value.documentation = parseDocumentation(context, line, this.value.documentation, `Event '${this.name}'`, DiagnosticCodes.InvalidEventDocumentation);\n return true;\n default:\n return false;\n }\n }\n}\n"],"mappings":"ucAYA,MAAMA,EAAYC,EAAQ,YAAYC,EAAkB,IAAI,EAE5D,IAAa,oBAAb,KAAiC,CAGR,KAFrB,MAAkG,CAAE,GAAI,KAAM,YAAa,KAAM,cAAe,IAAK,EAErJ,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAEpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAWC,EAAWC,CAAI,EAChC,OAAQC,EAAUD,EAAK,OAAO,EAA9B,CACI,IAAK,KAAM,CACP,IAAME,EAAQR,EAAU,KAAKM,EAAK,OAAO,EACnCG,EAAKD,IAAU,KAAO,GAAKE,EAAeF,EAAM,EAAE,EASxD,OARIC,EAAG,KAAK,CAAC,CAAC,SAAW,GAAK,KAAK,MAAM,KAAO,KAC5CE,EAAQ,MAAMC,EAAgB,eAAgB,UAAU,KAAK,KAAK,0CAA2CR,CAAQ,GAErH,KAAK,MAAM,GAAKK,EACZA,IAAO,KAAK,MACZE,EAAQ,YAAYC,EAAgB,iBAAkB,UAAU,KAAK,KAAK,mEAAoER,CAAQ,GAGvJ,EACX,CACA,IAAK,cAED,MADA,MAAK,MAAM,YAAcS,EAAiBF,EAASL,EAAM,KAAK,MAAM,YAAa,UAAU,KAAK,KAAK,GAAI,EAAI,EACtG,GACX,IAAK,gBAED,MADA,MAAK,MAAM,cAAgBQ,EAAmBH,EAASL,EAAM,KAAK,MAAM,cAAe,UAAU,KAAK,KAAK,GAAIM,EAAgB,yBAAyB,EACjJ,GACX,QACI,MAAO,EACf,CACJ,CACJ"}
|
|
1
|
+
{"version":3,"file":"EventMetadataParser.js","names":["idPattern","pattern","stringBodyPattern","name","location","locationOf","line","firstWord","match","id","unescapeString","context","DiagnosticCodes","parseDescription","parseDocumentation"],"sources":["../../../../../../Compiler/Parsing/EventMetadataParser.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst idPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\n\nexport class EventMetadataParser {\n readonly value: { id: string | null; description: string | null; documentation: string | null } = { id: null, description: null, documentation: null };\n\n constructor(readonly name: string) {}\n\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'id': {\n const match = idPattern.exec(line.content);\n const id = match === null ? '' : unescapeString(match[1]);\n if (id.trim().length === 0 || this.value.id !== null) {\n context.error(DiagnosticCodes.InvalidEventId, `Event '${this.name}' accepts one nonempty 'id \"<old-name>\"'`, location);\n } else {\n this.value.id = id;\n if (id === this.name) {\n context.information(DiagnosticCodes.RedundantEventId, `Event '${this.name}' already has this name as its identity - remove the redundant id`, location);\n }\n }\n return true;\n }\n case 'description':\n this.value.description = parseDescription(context, line, this.value.description, `Event '${this.name}'`, true);\n return true;\n case 'documentation':\n this.value.documentation = parseDocumentation(context, line, this.value.documentation, `Event '${this.name}'`, DiagnosticCodes.InvalidEventDocumentation);\n return true;\n default:\n return false;\n }\n }\n}\n"],"mappings":"A,ucAYA,MAAMA,EAAYC,EAAQ,YAAYC,EAAkB,IAAI,EAE5D,IAAa,oBAAb,KAAiC,CAGR,KAFrB,MAAkG,CAAE,GAAI,KAAM,YAAa,KAAM,cAAe,IAAK,EAErJ,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CAEpC,SAAS,EAAwB,EAA2B,CACxD,IAAMC,EAAWC,EAAWC,CAAI,EAChC,OAAQC,EAAUD,EAAK,OAAO,EAA9B,CACI,IAAK,KAAM,CACP,IAAME,EAAQR,EAAU,KAAKM,EAAK,OAAO,EACnCG,EAAKD,IAAU,KAAO,GAAKE,EAAeF,EAAM,EAAE,EASxD,OARIC,EAAG,KAAK,CAAC,CAAC,SAAW,GAAK,KAAK,MAAM,KAAO,KAC5CE,EAAQ,MAAMC,EAAgB,eAAgB,UAAU,KAAK,KAAK,0CAA2CR,CAAQ,GAErH,KAAK,MAAM,GAAKK,EACZA,IAAO,KAAK,MACZE,EAAQ,YAAYC,EAAgB,iBAAkB,UAAU,KAAK,KAAK,mEAAoER,CAAQ,GAGvJ,EACX,CACA,IAAK,cAED,MADA,MAAK,MAAM,YAAcS,EAAiBF,EAASL,EAAM,KAAK,MAAM,YAAa,UAAU,KAAK,KAAK,GAAI,EAAI,EACtG,GACX,IAAK,gBAED,MADA,MAAK,MAAM,cAAgBQ,EAAmBH,EAASL,EAAM,KAAK,MAAM,cAAe,UAAU,KAAK,KAAK,GAAIM,EAAgB,yBAAyB,EACjJ,GACX,QACI,MAAO,EACf,CACJ,CACJ,E"}
|