@cratis/screenplay-language 5.3.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
  2. package/dist/bundles/action-subject-authoring.js.map +1 -1
  3. package/dist/bundles/bmp-word-characters.js.map +1 -1
  4. package/dist/bundles/case-authoring.js +1 -1
  5. package/dist/bundles/case-authoring.js.map +1 -1
  6. package/dist/bundles/code-actions.js.map +1 -1
  7. package/dist/bundles/command-read-completions.js.map +1 -1
  8. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
  9. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
  10. package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  12. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
  13. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
  14. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
  15. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
  16. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
  17. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
  18. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
  19. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
  20. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
  21. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
  22. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
  23. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
  24. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
  25. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
  26. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
  27. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  30. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
  32. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
  37. package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  39. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  40. package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
  41. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  42. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  43. package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
  44. package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
  45. package/dist/bundles/compiler/Files/PlayImports.js +1 -1
  46. package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
  47. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
  48. package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
  49. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
  50. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
  51. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
  52. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
  53. package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
  54. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
  55. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
  56. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
  57. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
  58. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
  59. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
  60. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
  61. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
  62. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
  63. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
  64. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
  65. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
  66. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +1 -1
  67. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -1
  68. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
  69. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
  70. package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
  71. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  72. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  73. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  74. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
  75. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
  76. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
  77. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  78. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  79. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  80. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
  81. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  82. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
  83. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
  84. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
  85. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  86. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
  87. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  88. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  89. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
  90. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
  91. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  92. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  93. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  94. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
  95. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
  96. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
  97. package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
  98. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  99. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  100. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  101. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  102. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
  103. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  104. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
  105. package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
  106. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
  107. package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
  108. package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
  109. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  110. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
  111. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  112. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
  113. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  114. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  115. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
  116. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
  117. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  118. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
  119. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  120. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
  121. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
  122. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
  123. package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
  124. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
  125. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
  126. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  127. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  128. package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
  129. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  130. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
  131. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
  132. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  133. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  134. package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
  135. package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
  136. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  137. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  138. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  139. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
  140. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
  141. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  142. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  143. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
  144. package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
  145. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
  146. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  147. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
  148. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  149. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
  150. package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
  151. package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
  152. package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
  153. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
  154. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
  155. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
  156. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
  157. package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
  158. package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
  159. package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
  160. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
  161. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
  162. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  163. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
  164. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
  165. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
  166. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
  167. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  168. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
  169. package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
  170. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
  171. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
  172. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
  173. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  174. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
  175. package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
  176. package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
  177. package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
  178. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
  179. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
  180. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  181. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  182. package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
  183. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
  184. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
  185. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  186. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
  187. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
  188. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
  189. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  190. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  191. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
  192. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
  193. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
  194. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
  195. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  196. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  197. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  198. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
  199. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
  200. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  201. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  202. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  203. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
  204. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  205. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  206. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
  207. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
  208. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
  209. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
  210. package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
  211. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
  212. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
  213. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
  214. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
  215. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
  216. package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
  217. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
  218. package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
  219. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
  220. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  221. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  222. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  223. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  224. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  225. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
  226. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  227. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
  228. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
  229. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
  230. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  231. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
  232. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  233. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
  234. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
  235. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
  236. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
  237. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
  238. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  239. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
  240. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  241. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  242. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
  243. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
  244. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  245. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
  246. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
  247. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
  248. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  249. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  250. package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
  251. package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
  252. package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
  253. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
  254. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
  255. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
  256. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
  257. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
  258. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  259. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  260. package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
  261. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
  262. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
  263. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
  264. package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
  265. package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
  266. package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
  267. package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
  268. package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
  269. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
  270. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  271. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  272. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
  273. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
  274. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
  275. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
  276. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
  277. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  278. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
  279. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
  280. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
  281. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
  282. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
  283. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
  284. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
  285. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
  286. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
  287. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  288. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
  289. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
  290. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
  291. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
  292. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  293. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  294. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  295. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  296. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  297. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  298. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
  299. package/dist/bundles/compiler/Syntax/index.js +1 -1
  300. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
  301. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
  302. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
  303. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
  304. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
  305. package/dist/bundles/compiler/Text/patterns.js.map +1 -1
  306. package/dist/bundles/compiler/index.js +1 -1
  307. package/dist/bundles/completion-items.js +4 -4
  308. package/dist/bundles/completion-items.js.map +1 -1
  309. package/dist/bundles/completion-planner.js +2 -2
  310. package/dist/bundles/completion-planner.js.map +1 -1
  311. package/dist/bundles/completions.js +1 -1
  312. package/dist/bundles/completions.js.map +1 -1
  313. package/dist/bundles/continuation-responses.js +1 -1
  314. package/dist/bundles/continuation-responses.js.map +1 -1
  315. package/dist/bundles/declarations.js.map +1 -1
  316. package/dist/bundles/dependency-completions.js.map +1 -1
  317. package/dist/bundles/dependency-target-analysis.js.map +1 -1
  318. package/dist/bundles/diagnostic-codes.js +1 -1
  319. package/dist/bundles/diagnostic-codes.js.map +1 -1
  320. package/dist/bundles/diagnostics.js +1 -1
  321. package/dist/bundles/diagnostics.js.map +1 -1
  322. package/dist/bundles/document-context.js.map +1 -1
  323. package/dist/bundles/documentation-item.js.map +1 -1
  324. package/dist/bundles/event-analysis-source.js.map +1 -1
  325. package/dist/bundles/event-context-catalog.js.map +1 -1
  326. package/dist/bundles/event-context.js.map +1 -1
  327. package/dist/bundles/event-source-authoring.js +11 -11
  328. package/dist/bundles/event-source-authoring.js.map +1 -1
  329. package/dist/bundles/example-analysis.js +2 -2
  330. package/dist/bundles/example-analysis.js.map +1 -1
  331. package/dist/bundles/example-authoring.js +2 -2
  332. package/dist/bundles/example-authoring.js.map +1 -1
  333. package/dist/bundles/example-declaration-items.js.map +1 -1
  334. package/dist/bundles/example-values.js.map +1 -1
  335. package/dist/bundles/file-imports.js.map +1 -1
  336. package/dist/bundles/file-references.js.map +1 -1
  337. package/dist/bundles/generation-completions.js.map +1 -1
  338. package/dist/bundles/hover-content.js +5 -5
  339. package/dist/bundles/hover-content.js.map +1 -1
  340. package/dist/bundles/hover.js.map +1 -1
  341. package/dist/bundles/index.js +1 -1
  342. package/dist/bundles/index.js.map +1 -1
  343. package/dist/bundles/inlay-hints.js.map +1 -1
  344. package/dist/bundles/inline-completions.js +1 -1
  345. package/dist/bundles/inline-completions.js.map +1 -1
  346. package/dist/bundles/inline-event-validation.js +1 -1
  347. package/dist/bundles/inline-event-validation.js.map +1 -1
  348. package/dist/bundles/keyword-docs.js.map +1 -1
  349. package/dist/bundles/language.js.map +1 -1
  350. package/dist/bundles/named-rule-context.js.map +1 -1
  351. package/dist/bundles/operation-authoring.js +6 -6
  352. package/dist/bundles/operation-authoring.js.map +1 -1
  353. package/dist/bundles/persona-analysis.js +1 -1
  354. package/dist/bundles/persona-analysis.js.map +1 -1
  355. package/dist/bundles/production-destinations.js +1 -1
  356. package/dist/bundles/production-destinations.js.map +1 -1
  357. package/dist/bundles/purpose-items.js.map +1 -1
  358. package/dist/bundles/reaction-authoring.js +3 -3
  359. package/dist/bundles/reaction-authoring.js.map +1 -1
  360. package/dist/bundles/read-model-key-completions.js +1 -1
  361. package/dist/bundles/read-model-key-completions.js.map +1 -1
  362. package/dist/bundles/refusal-context.js.map +1 -1
  363. package/dist/bundles/response-analysis.js.map +1 -1
  364. package/dist/bundles/response-completions.js +1 -1
  365. package/dist/bundles/response-completions.js.map +1 -1
  366. package/dist/bundles/response-tokens.js +2 -2
  367. package/dist/bundles/response-tokens.js.map +1 -1
  368. package/dist/bundles/scope-items.js +3 -3
  369. package/dist/bundles/scope-items.js.map +1 -1
  370. package/dist/bundles/structure-completions.js.map +1 -1
  371. package/dist/bundles/sub-language-registry.js.map +1 -1
  372. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
  373. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
  374. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
  375. package/dist/bundles/sub-languages/capture/index.js.map +1 -1
  376. package/dist/bundles/sub-languages/capture/language.js.map +1 -1
  377. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  378. package/dist/bundles/sub-languages/pdl.js.map +1 -1
  379. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
  380. package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
  381. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
  382. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
  383. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
  384. package/dist/bundles/sub-languages/projection/index.js.map +1 -1
  385. package/dist/bundles/sub-languages/projection/language.js.map +1 -1
  386. package/dist/bundles/symbols.js +2 -2
  387. package/dist/bundles/symbols.js.map +1 -1
  388. package/dist/bundles/themes/screenplay-dark.js.map +1 -1
  389. package/dist/bundles/themes/screenplay-light.js.map +1 -1
  390. package/dist/bundles/tokens.js.map +1 -1
  391. package/dist/bundles/validation.js +2 -2
  392. package/dist/bundles/validation.js.map +1 -1
  393. package/dist/diagnostic-codes.d.ts +1 -0
  394. package/dist/diagnostic-codes.d.ts.map +1 -1
  395. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"StructuredBlockParser.js","names":["itemKeyword","noneKeyword","emptyKeyword","name","mappingHeaderPattern","dotNetWhitespace","memberPattern","stringBodyPattern","match","content","header","line","context","unescapeIdentifier","locationOf","location","marker","first","DiagnosticCodes","text","parseMappingSource","literal","parseLiteral","offset","items","rest","members","names","token","memberName","unescapeString","value","child","message"],"sources":["../../../../../../Compiler/Parsing/StructuredBlockParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { dotNetWhitespace } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseLiteral, parseMappingSource } from './ExpressionParser';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads structured values - objects and lists - written as indented blocks; the port of the C# StructuredBlockParser.\n// Screenplay has no JSON. An object is a header line followed by one indented 'member = value' line per member; a\n// member holding an object or a list opens another indented block. A list is a header line followed by one 'item'\n// line per element: 'item <value>' for a scalar and a bare 'item' with an indented block for an object or a nested\n// list. A header - a property, a member or an 'item' - ending in 'none' is an empty list and one ending in 'empty' an\n// object without members; any other header opens a block, so a stray word is never mistaken for an empty value. A\n// block whose first line is an 'item' is a list; a member named 'item' is written '@item', and a member name that is\n// not an identifier is quoted.\nexport const itemKeyword = 'item';\nexport const noneKeyword = 'none';\nexport const emptyKeyword = 'empty';\nexport type StructuredMarker = typeof noneKeyword | typeof emptyKeyword | undefined;\n\nconst name = '@?[\\\\p{L}_][\\\\p{L}\\\\p{N}_]*';\nconst mappingHeaderPattern = new RegExp(`^(?<name>${name}(?:\\\\.${name})*)(?:${dotNetWhitespace}+(?<marker>none|empty))?$`, 'u');\nconst memberPattern = new RegExp(`^(?<name>${name}|\"${stringBodyPattern}\")(?:${dotNetWhitespace}*=${dotNetWhitespace}*(?<value>\\\\S.*)|(?:${dotNetWhitespace}+(?<marker>none|empty))?)$`, 'u');\n\n// The 'none' or 'empty' marker a header match captured, or undefined when the header opens a block.\nexport const markerOf = (match: RegExpExecArray): StructuredMarker => match.groups?.marker as StructuredMarker;\n\n// The 'none' or 'empty' marker ending a line, such as a typed declaration 'tags String[] none'.\nexport function trailingMarker(content: string): StructuredMarker {\n if (content.endsWith(` ${noneKeyword}`)) return noneKeyword;\n return content.endsWith(` ${emptyKeyword}`) ? emptyKeyword : undefined;\n}\n\n// Reads a '<property>' or '<property> none' header line, already taken from the reader, or undefined when the line is not one.\nexport function tryParseStructuredMapping(context: ParserContext, line: SourceLine): PropertyMappingSyntax | undefined {\n const header = mappingHeaderPattern.exec(line.content);\n // A bare word with nothing under it is a malformed line, not an empty object - an object always has members.\n if (header === null || header.groups!.name === 'streamId' || (markerOf(header) === undefined && context.peekChild(line.indent) === undefined)) return undefined;\n return { kind: 'PropertyMappingSyntax', property: unescapeIdentifier(header.groups!.name), source: parseStructuredValue(context, line, markerOf(header)), location: locationOf(line) };\n}\n\n// Reads the structured value opened by a header line already taken from the reader.\nexport function parseStructuredValue(context: ParserContext, header: SourceLine, marker: StructuredMarker): ExpressionSyntax {\n const location = locationOf(header);\n if (marker === noneKeyword) {\n rejectChildren(context, header, \"An empty list ('none') has no lines under it.\");\n return { kind: 'ListExpressionSyntax', items: [], location };\n }\n if (marker === emptyKeyword) {\n rejectChildren(context, header, \"An object without members ('empty') has no lines under it.\");\n return { kind: 'ObjectExpressionSyntax', members: [], location };\n }\n const first = context.peekChild(header.indent);\n if (first === undefined) {\n context.error(DiagnosticCodes.InvalidStructuredValue, `'${header.content}' opens a structured value - indent its 'member = value' lines or 'item' lines under it, or end it in 'none' for an empty list or 'empty' for an object without members`, location);\n return { kind: 'ObjectExpressionSyntax', members: [], location };\n }\n return isItem(first.content) ? parseList(context, header) : parseObject(context, header);\n}\n\n// Reads a scalar written in a structured block, a member value or an 'item' value.\nexport function parseStructuredScalar(context: ParserContext, text: string, location: SourceLocation): ExpressionSyntax {\n if (text.startsWith('{') || text.startsWith('[')) return parseMappingSource(text, location, context);\n if (text.startsWith('case.')) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'A case reference fills a whole value position; it cannot occur inside a structured value or expression.', location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n const literal = parseLiteral(text, location, context);\n if (literal !== undefined) return literal;\n context.error(DiagnosticCodes.InvalidStructuredValue, `Expected a string, number, true, false or null in a structured value, got '${text}'`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n}\n\nconst isItem = (content: string): boolean =>\n content === itemKeyword || (content.startsWith(`${itemKeyword} `) && !content.substring(itemKeyword.length).trimStart().startsWith('='));\n\nconst at = (line: SourceLine, offset: number): SourceLocation => ({ ...locationOf(line), column: locationOf(line).column + offset });\n\nfunction parseList(context: ParserContext, header: SourceLine): ExpressionSyntax {\n const items: ExpressionSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (!isItem(line.content)) {\n context.error(DiagnosticCodes.InvalidStructuredValue, `A list holds one 'item' line per element, got '${line.content}'`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n const rest = line.content.substring(itemKeyword.length).trimStart();\n if (rest.length === 0) {\n items.push(parseStructuredValue(context, line, undefined));\n } else if (rest === noneKeyword || rest === emptyKeyword) {\n items.push(parseStructuredValue(context, line, rest));\n } else {\n items.push(parseStructuredScalar(context, rest, at(line, line.content.length - rest.length)));\n rejectChildren(context, line, \"An 'item' with a value has no lines under it.\");\n }\n }\n return { kind: 'ListExpressionSyntax', items, location: locationOf(header) };\n}\n\nfunction parseObject(context: ParserContext, header: SourceLine): ExpressionSyntax {\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = memberPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidStructuredValue, isItem(line.content)\n ? `An object holds 'member = value' lines; an 'item' line belongs in a list, got '${line.content}'`\n : `Expected 'member = value', a member opening an indented block, 'member none' or 'member empty', got '${line.content}'`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n const token = match.groups!.name;\n const memberName = token.startsWith('\"') ? unescapeString(token.substring(1, token.length - 1)) : unescapeIdentifier(token);\n let value: ExpressionSyntax;\n if (match.groups!.value !== undefined) {\n value = parseStructuredScalar(context, match.groups!.value, at(line, line.content.length - match.groups!.value.length));\n rejectChildren(context, line, 'A member with a value has no lines under it.');\n } else {\n value = parseStructuredValue(context, line, markerOf(match));\n }\n if (names.has(memberName)) {\n context.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${memberName}' in structured value`, locationOf(line));\n continue;\n }\n names.add(memberName);\n members.push({ kind: 'ObjectMemberSyntax', name: memberName, value, location: locationOf(line) });\n }\n return { kind: 'ObjectExpressionSyntax', members, location: locationOf(header) };\n}\n\nfunction rejectChildren(context: ParserContext, line: SourceLine, message: string): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidStructuredValue, message, locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n"],"mappings":"8aAqBA,MAAaA,EAAc,OACdC,EAAc,OACdC,EAAe,QAGtBC,EAAO,8BACPC,EAA2B,OAAO,YAAYD,EAAK,QAAQA,EAAK,QAAQE,EAAiB,2BAA4B,GAAG,EACxHC,EAAoB,OAAO,YAAYH,EAAK,IAAII,EAAkB,OAAOF,EAAiB,IAAIA,EAAiB,sBAAsBA,EAAiB,4BAA6B,GAAG,EAG/K,SAAY,GAA6CG,EAAM,QAAQ,OAGpF,SAAgB,eAAe,EAAmC,CAE9D,OADIC,EAAQ,SAAS,OAAiB,EAAUR,EACzCQ,EAAQ,SAAS,QAAkB,EAAIP,EAAe,IAAA,E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,SAAS,eAAe,EAAwB,EAAkB,EAAuB,CACrF,IAAMsB,EAAQpB,EAAQ,UAAUD,EAAK,MAAM,EACvCqB,IAAU,IAAA,KACVpB,EAAQ,MAAMM,EAAgB,uBAAwBe,EAASnB,EAAWkB,CAAK,CAAC,EAChFpB,EAAQ,UAAUD,EAAK,MAAM,EAErC"}
1
+ {"version":3,"file":"StructuredBlockParser.js","names":["itemKeyword","noneKeyword","emptyKeyword","name","mappingHeaderPattern","dotNetWhitespace","memberPattern","stringBodyPattern","match","content","header","line","context","unescapeIdentifier","locationOf","location","marker","first","DiagnosticCodes","text","parseMappingSource","literal","parseLiteral","offset","items","rest","members","names","token","memberName","unescapeString","value","child","message"],"sources":["../../../../../../Compiler/Parsing/StructuredBlockParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { dotNetWhitespace } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseLiteral, parseMappingSource } from './ExpressionParser';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads structured values - objects and lists - written as indented blocks; the port of the C# StructuredBlockParser.\n// Screenplay has no JSON. An object is a header line followed by one indented 'member = value' line per member; a\n// member holding an object or a list opens another indented block. A list is a header line followed by one 'item'\n// line per element: 'item <value>' for a scalar and a bare 'item' with an indented block for an object or a nested\n// list. A header - a property, a member or an 'item' - ending in 'none' is an empty list and one ending in 'empty' an\n// object without members; any other header opens a block, so a stray word is never mistaken for an empty value. A\n// block whose first line is an 'item' is a list; a member named 'item' is written '@item', and a member name that is\n// not an identifier is quoted.\nexport const itemKeyword = 'item';\nexport const noneKeyword = 'none';\nexport const emptyKeyword = 'empty';\nexport type StructuredMarker = typeof noneKeyword | typeof emptyKeyword | undefined;\n\nconst name = '@?[\\\\p{L}_][\\\\p{L}\\\\p{N}_]*';\nconst mappingHeaderPattern = new RegExp(`^(?<name>${name}(?:\\\\.${name})*)(?:${dotNetWhitespace}+(?<marker>none|empty))?$`, 'u');\nconst memberPattern = new RegExp(`^(?<name>${name}|\"${stringBodyPattern}\")(?:${dotNetWhitespace}*=${dotNetWhitespace}*(?<value>\\\\S.*)|(?:${dotNetWhitespace}+(?<marker>none|empty))?)$`, 'u');\n\n// The 'none' or 'empty' marker a header match captured, or undefined when the header opens a block.\nexport const markerOf = (match: RegExpExecArray): StructuredMarker => match.groups?.marker as StructuredMarker;\n\n// The 'none' or 'empty' marker ending a line, such as a typed declaration 'tags String[] none'.\nexport function trailingMarker(content: string): StructuredMarker {\n if (content.endsWith(` ${noneKeyword}`)) return noneKeyword;\n return content.endsWith(` ${emptyKeyword}`) ? emptyKeyword : undefined;\n}\n\n// Reads a '<property>' or '<property> none' header line, already taken from the reader, or undefined when the line is not one.\nexport function tryParseStructuredMapping(context: ParserContext, line: SourceLine): PropertyMappingSyntax | undefined {\n const header = mappingHeaderPattern.exec(line.content);\n // A bare word with nothing under it is a malformed line, not an empty object - an object always has members.\n if (header === null || header.groups!.name === 'streamId' || (markerOf(header) === undefined && context.peekChild(line.indent) === undefined)) return undefined;\n return { kind: 'PropertyMappingSyntax', property: unescapeIdentifier(header.groups!.name), source: parseStructuredValue(context, line, markerOf(header)), location: locationOf(line) };\n}\n\n// Reads the structured value opened by a header line already taken from the reader.\nexport function parseStructuredValue(context: ParserContext, header: SourceLine, marker: StructuredMarker): ExpressionSyntax {\n const location = locationOf(header);\n if (marker === noneKeyword) {\n rejectChildren(context, header, \"An empty list ('none') has no lines under it.\");\n return { kind: 'ListExpressionSyntax', items: [], location };\n }\n if (marker === emptyKeyword) {\n rejectChildren(context, header, \"An object without members ('empty') has no lines under it.\");\n return { kind: 'ObjectExpressionSyntax', members: [], location };\n }\n const first = context.peekChild(header.indent);\n if (first === undefined) {\n context.error(DiagnosticCodes.InvalidStructuredValue, `'${header.content}' opens a structured value - indent its 'member = value' lines or 'item' lines under it, or end it in 'none' for an empty list or 'empty' for an object without members`, location);\n return { kind: 'ObjectExpressionSyntax', members: [], location };\n }\n return isItem(first.content) ? parseList(context, header) : parseObject(context, header);\n}\n\n// Reads a scalar written in a structured block, a member value or an 'item' value.\nexport function parseStructuredScalar(context: ParserContext, text: string, location: SourceLocation): ExpressionSyntax {\n if (text.startsWith('{') || text.startsWith('[')) return parseMappingSource(text, location, context);\n if (text.startsWith('case.')) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'A case reference fills a whole value position; it cannot occur inside a structured value or expression.', location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n const literal = parseLiteral(text, location, context);\n if (literal !== undefined) return literal;\n context.error(DiagnosticCodes.InvalidStructuredValue, `Expected a string, number, true, false or null in a structured value, got '${text}'`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n}\n\nconst isItem = (content: string): boolean =>\n content === itemKeyword || (content.startsWith(`${itemKeyword} `) && !content.substring(itemKeyword.length).trimStart().startsWith('='));\n\nconst at = (line: SourceLine, offset: number): SourceLocation => ({ ...locationOf(line), column: locationOf(line).column + offset });\n\nfunction parseList(context: ParserContext, header: SourceLine): ExpressionSyntax {\n const items: ExpressionSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (!isItem(line.content)) {\n context.error(DiagnosticCodes.InvalidStructuredValue, `A list holds one 'item' line per element, got '${line.content}'`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n const rest = line.content.substring(itemKeyword.length).trimStart();\n if (rest.length === 0) {\n items.push(parseStructuredValue(context, line, undefined));\n } else if (rest === noneKeyword || rest === emptyKeyword) {\n items.push(parseStructuredValue(context, line, rest));\n } else {\n items.push(parseStructuredScalar(context, rest, at(line, line.content.length - rest.length)));\n rejectChildren(context, line, \"An 'item' with a value has no lines under it.\");\n }\n }\n return { kind: 'ListExpressionSyntax', items, location: locationOf(header) };\n}\n\nfunction parseObject(context: ParserContext, header: SourceLine): ExpressionSyntax {\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = memberPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidStructuredValue, isItem(line.content)\n ? `An object holds 'member = value' lines; an 'item' line belongs in a list, got '${line.content}'`\n : `Expected 'member = value', a member opening an indented block, 'member none' or 'member empty', got '${line.content}'`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n const token = match.groups!.name;\n const memberName = token.startsWith('\"') ? unescapeString(token.substring(1, token.length - 1)) : unescapeIdentifier(token);\n let value: ExpressionSyntax;\n if (match.groups!.value !== undefined) {\n value = parseStructuredScalar(context, match.groups!.value, at(line, line.content.length - match.groups!.value.length));\n rejectChildren(context, line, 'A member with a value has no lines under it.');\n } else {\n value = parseStructuredValue(context, line, markerOf(match));\n }\n if (names.has(memberName)) {\n context.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${memberName}' in structured value`, locationOf(line));\n continue;\n }\n names.add(memberName);\n members.push({ kind: 'ObjectMemberSyntax', name: memberName, value, location: locationOf(line) });\n }\n return { kind: 'ObjectExpressionSyntax', members, location: locationOf(header) };\n}\n\nfunction rejectChildren(context: ParserContext, line: SourceLine, message: string): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidStructuredValue, message, locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n"],"mappings":"A,8aAqBA,MAAaA,EAAc,OACdC,EAAc,OACdC,EAAe,QAGtBC,EAAO,8BACPC,EAA2B,OAAO,YAAYD,EAAK,QAAQA,EAAK,QAAQE,EAAiB,2BAA4B,GAAG,EACxH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BAAgC,uBAAuBW,EAAW,uBAAwBf,EAAWH,CAAI,CAAC,GAG5IgB,EAAM,IAAIE,CAAU,EACpBH,EAAQ,KAAK,CAAE,KAAM,qBAAsB,KAAMG,EAAY,QAAO,SAAUf,EAAWH,CAAI,CAAE,CAAC,EACpG,CACA,MAAO,CAAE,KAAM,yBAA0B,UAAS,SAAUG,EAAWJ,CAAM,CAAE,CACnF,CAEA,SAAS,eAAe,EAAwB,EAAkB,EAAuB,CACrF,IAAMsB,EAAQpB,EAAQ,UAAUD,EAAK,MAAM,EACvCqB,IAAU,IAAA,KACVpB,EAAQ,MAAMM,EAAgB,uBAAwBe,EAASnB,EAAWkB,CAAK,CAAC,EAChFpB,EAAQ,UAAUD,EAAK,MAAM,EAErC,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"StructuredValueParser.js","names":["text","start","context","value","#value","#whitespace","#position","location","#at","current","depth","#list","#object","#string","word","#number","items","#take","#expect","members","names","keyLocation","name","DiagnosticCodes","end","#stringEnd","raw","index","from","match","number","parseExactNumber","character"],"sources":["../../../../../../Compiler/Parsing/StructuredValueParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax } from '../Syntax/Expressions';\nimport { parseExactNumber } from '../Syntax/ExactNumber';\nimport { ParserContext } from './ParserContext';\n\n// How deeply a structured value may nest - the C# compiler's JsonDocument limit.\nconst maximumDepth = 64;\n\n// A structured value that is not valid JSON. The message says why; the caller reports it.\nexport class InvalidStructuredValue extends Error {}\n\n// Reads an inline '{...}' or '[...]' value - the port of the C# StructuredValueParser. It is strict JSON, as\n// System.Text.Json reads it, and it keeps the first of two members with the same name and reports the\n// second, which JSON.parse would silently keep instead.\nexport class StructuredValueParser {\n #position = 0;\n\n constructor(private readonly text: string, private readonly start: SourceLocation, private readonly context?: ParserContext) {}\n\n parse(): ExpressionSyntax {\n const value = this.#value(0);\n this.#whitespace();\n if (this.#position < this.text.length) {\n throw new InvalidStructuredValue(`'${this.text[this.#position]}' is invalid after a single JSON value.`);\n }\n return value;\n }\n\n #value(depth: number): ExpressionSyntax {\n this.#whitespace();\n const location = this.#at();\n const current = this.text[this.#position];\n if (current === '[' || current === '{') {\n if (depth >= maximumDepth) {\n throw new InvalidStructuredValue(`The value nests deeper than ${maximumDepth} levels.`);\n }\n return current === '[' ? this.#list(depth, location) : this.#object(depth, location);\n }\n if (current === '\"') {\n return { kind: 'LiteralExpressionSyntax', value: this.#string(), location };\n }\n for (const [word, value] of [['true', true], ['false', false], ['null', null]] as const) {\n if (this.text.startsWith(word, this.#position)) {\n this.#position += word.length;\n return { kind: 'LiteralExpressionSyntax', value, location };\n }\n }\n return this.#number(location);\n }\n\n #list(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const items: ExpressionSyntax[] = [];\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n for (;;) {\n items.push(this.#value(depth + 1));\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n this.#expect(',');\n }\n }\n\n #object(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n for (;;) {\n this.#whitespace();\n const keyLocation = this.#at();\n if (this.text[this.#position] !== '\"') {\n throw new InvalidStructuredValue('Expected a property name in double quotes.');\n }\n const name = this.#string();\n this.#whitespace();\n this.#expect(':');\n const value = this.#value(depth + 1);\n if (names.has(name)) {\n this.context?.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${name}' in structured value`, keyLocation);\n } else {\n names.add(name);\n members.push({ kind: 'ObjectMemberSyntax', name, value, location: keyLocation });\n }\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n this.#expect(',');\n }\n }\n\n #string(): string {\n const end = this.#stringEnd(this.#position);\n const raw = this.text.substring(this.#position, end);\n this.#position = end;\n try {\n return JSON.parse(raw) as string;\n } catch {\n throw new InvalidStructuredValue(`${raw} is not a valid JSON string.`);\n }\n }\n\n #stringEnd(from: number): number {\n for (let index = from + 1; index < this.text.length; index++) {\n if (this.text[index] === '\\\\') {\n index++;\n } else if (this.text[index] === '\"') {\n return index + 1;\n }\n }\n throw new InvalidStructuredValue('A string is not closed.');\n }\n\n #number(location: SourceLocation): ExpressionSyntax {\n const match = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(this.text.substring(this.#position));\n if (match === null) {\n throw new InvalidStructuredValue(`'${this.text[this.#position] ?? ''}' is an invalid start of a value.`);\n }\n this.#position += match[0].length;\n if (this.context?.sourceOptions.numericMode === 'exact') {\n const number = parseExactNumber(match[0]);\n if (number === undefined) {\n this.context.error(DiagnosticCodes.InexactNumericLiteral, 'Numeric literal is not exactly representable in the bounded Decimal domain.', location);\n return { kind: 'RawExpressionSyntax', text: match[0], location };\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n const number = Number(match[0]);\n if (!Number.isFinite(number)) {\n throw new InvalidStructuredValue('JSON number is outside the finite Double range.');\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n\n #at(): SourceLocation {\n return { ...this.start, column: this.start.column + this.#position };\n }\n\n #whitespace(): void {\n while (this.#position < this.text.length && ' \\t\\n\\r'.includes(this.text[this.#position])) {\n this.#position++;\n }\n }\n\n #take(character: string): boolean {\n if (this.text[this.#position] !== character) {\n return false;\n }\n this.#position++;\n return true;\n }\n\n #expect(character: string): void {\n if (!this.#take(character)) {\n throw new InvalidStructuredValue(`Expected '${character}' at position ${this.#position}.`);\n }\n }\n}\n"],"mappings":"qLAaA,IAAa,uB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,aAAaA,EAAU,gBAAgB,KAAK1B,GAAU,EAAE,CAEjG,CACJ"}
1
+ {"version":3,"file":"StructuredValueParser.js","names":["text","start","context","value","#value","#whitespace","#position","location","#at","current","depth","#list","#object","#string","word","#number","items","#take","#expect","members","names","keyLocation","name","DiagnosticCodes","end","#stringEnd","raw","index","from","match","number","parseExactNumber","character"],"sources":["../../../../../../Compiler/Parsing/StructuredValueParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax } from '../Syntax/Expressions';\nimport { parseExactNumber } from '../Syntax/ExactNumber';\nimport { ParserContext } from './ParserContext';\n\n// How deeply a structured value may nest - the C# compiler's JsonDocument limit.\nconst maximumDepth = 64;\n\n// A structured value that is not valid JSON. The message says why; the caller reports it.\nexport class InvalidStructuredValue extends Error {}\n\n// Reads an inline '{...}' or '[...]' value - the port of the C# StructuredValueParser. It is strict JSON, as\n// System.Text.Json reads it, and it keeps the first of two members with the same name and reports the\n// second, which JSON.parse would silently keep instead.\nexport class StructuredValueParser {\n #position = 0;\n\n constructor(private readonly text: string, private readonly start: SourceLocation, private readonly context?: ParserContext) {}\n\n parse(): ExpressionSyntax {\n const value = this.#value(0);\n this.#whitespace();\n if (this.#position < this.text.length) {\n throw new InvalidStructuredValue(`'${this.text[this.#position]}' is invalid after a single JSON value.`);\n }\n return value;\n }\n\n #value(depth: number): ExpressionSyntax {\n this.#whitespace();\n const location = this.#at();\n const current = this.text[this.#position];\n if (current === '[' || current === '{') {\n if (depth >= maximumDepth) {\n throw new InvalidStructuredValue(`The value nests deeper than ${maximumDepth} levels.`);\n }\n return current === '[' ? this.#list(depth, location) : this.#object(depth, location);\n }\n if (current === '\"') {\n return { kind: 'LiteralExpressionSyntax', value: this.#string(), location };\n }\n for (const [word, value] of [['true', true], ['false', false], ['null', null]] as const) {\n if (this.text.startsWith(word, this.#position)) {\n this.#position += word.length;\n return { kind: 'LiteralExpressionSyntax', value, location };\n }\n }\n return this.#number(location);\n }\n\n #list(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const items: ExpressionSyntax[] = [];\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n for (;;) {\n items.push(this.#value(depth + 1));\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n this.#expect(',');\n }\n }\n\n #object(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n for (;;) {\n this.#whitespace();\n const keyLocation = this.#at();\n if (this.text[this.#position] !== '\"') {\n throw new InvalidStructuredValue('Expected a property name in double quotes.');\n }\n const name = this.#string();\n this.#whitespace();\n this.#expect(':');\n const value = this.#value(depth + 1);\n if (names.has(name)) {\n this.context?.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${name}' in structured value`, keyLocation);\n } else {\n names.add(name);\n members.push({ kind: 'ObjectMemberSyntax', name, value, location: keyLocation });\n }\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n this.#expect(',');\n }\n }\n\n #string(): string {\n const end = this.#stringEnd(this.#position);\n const raw = this.text.substring(this.#position, end);\n this.#position = end;\n try {\n return JSON.parse(raw) as string;\n } catch {\n throw new InvalidStructuredValue(`${raw} is not a valid JSON string.`);\n }\n }\n\n #stringEnd(from: number): number {\n for (let index = from + 1; index < this.text.length; index++) {\n if (this.text[index] === '\\\\') {\n index++;\n } else if (this.text[index] === '\"') {\n return index + 1;\n }\n }\n throw new InvalidStructuredValue('A string is not closed.');\n }\n\n #number(location: SourceLocation): ExpressionSyntax {\n const match = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(this.text.substring(this.#position));\n if (match === null) {\n throw new InvalidStructuredValue(`'${this.text[this.#position] ?? ''}' is an invalid start of a value.`);\n }\n this.#position += match[0].length;\n if (this.context?.sourceOptions.numericMode === 'exact') {\n const number = parseExactNumber(match[0]);\n if (number === undefined) {\n this.context.error(DiagnosticCodes.InexactNumericLiteral, 'Numeric literal is not exactly representable in the bounded Decimal domain.', location);\n return { kind: 'RawExpressionSyntax', text: match[0], location };\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n const number = Number(match[0]);\n if (!Number.isFinite(number)) {\n throw new InvalidStructuredValue('JSON number is outside the finite Double range.');\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n\n #at(): SourceLocation {\n return { ...this.start, column: this.start.column + this.#position };\n }\n\n #whitespace(): void {\n while (this.#position < this.text.length && ' \\t\\n\\r'.includes(this.text[this.#position])) {\n this.#position++;\n }\n }\n\n #take(character: string): boolean {\n if (this.text[this.#position] !== character) {\n return false;\n }\n this.#position++;\n return true;\n }\n\n #expect(character: string): void {\n if (!this.#take(character)) {\n throw new InvalidStructuredValue(`Expected '${character}' at position ${this.#position}.`);\n }\n }\n}\n"],"mappings":"A,qLAaA,IAAa,uBAAb,cAA4C,KAAM,CAAC,EAKtC,sBAAb,KAAmC,CAGF,KAA+B,MAAwC,QAFpG,GAAY,EAEZ,YAAY,EAA+B,EAAwC,EAA0C,CAAhG,KAAA,KAAAA,EAA+B,KAAA,MAAAC,EAAwC,KAAA,QAAAC,CAA0B,CAE9H,OAA0B,CACtB,IAAMC,EAAQ,KAAKC,GAAO,CAAC,EAE3B,GADA,KAAKC,GAAY,EACb,KAAKC,GAAY,KAAK,KAAK,OAC3B,MAAM,IAAI,uBAAuB,IAAI,KAAK,KAAK,KAAKA,IAAW,wCAAwC,EAE3G,OAAOH,CACX,CAEA,GAAO,EAAiC,CACpC,KAAKE,GAAY,EACjB,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,SAAS,cAAc,cAAgB,QAAS,CACrD,IAAMC,EAASC,EAAiBF,EAAM,EAAE,EAKxC,OAJIC,IAAW,IAAA,IACX,KAAK,QAAQ,MAAMP,EAAgB,sBAAuB,8EAA+EhB,CAAQ,EAC1I,CAAE,KAAM,sBAAuB,KAAMsB,EAAM,GAAI,UAAS,GAE5D,CAAE,KAAM,0BAA2B,MAAOC,EAAQ,UAAS,CACtE,CACA,IAAMA,EAAS,OAAOD,EAAM,EAAE,EAC9B,GAAI,CAAC,OAAO,SAASC,CAAM,EACvB,MAAM,IAAI,uBAAuB,iDAAiD,EAEtF,MAAO,CAAE,KAAM,0BAA2B,MAAOA,EAAQ,UAAS,CACtE,CAEA,IAAsB,CAClB,MAAO,CAAE,GAAG,KAAK,MAAO,OAAQ,KAAK,MAAM,OAAS,KAAKxB,EAAU,CACvE,CAEA,IAAoB,CAChB,KAAO,KAAKA,GAAY,KAAK,KAAK,QAAU;IAAU,SAAS,KAAK,KAAK,KAAKA,GAAU,GACpF,KAAKA,IAEb,CAEA,GAAM,EAA4B,CAK9B,OAJI,KAAK,KAAK,KAAKA,MAAe0B,IAGlC,KAAK1B,KACE,GACX,CAEA,GAAQ,EAAyB,CAC7B,GAAI,CAAC,KAAKW,GAAMe,CAAS,EACrB,MAAM,IAAI,uBAAuB,aAAaA,EAAU,gBAAgB,KAAK1B,GAAU,EAAE,CAEjG,CACJ,E"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{stringBodyPattern as e,unescapeString as t}from"../Text/StringLiteral.js";import{pattern as n}from"../Text/patterns.js";const r=n(`^blueprint\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(?:\\s+version\\s+"(${e})")?$`),i=[`>=`,`<=`,`^`,`~`,`>`,`<`,`=`];function startsBlueprintReference(e){return e.startsWith(`blueprint `)}function parseBlueprintReference(e){let n=r.exec(e);if(n!==null)return{blueprint:n[1],name:n[2],version:n[3]===void 0?null:t(n[3])}}function isValidTemplateVersionRange(e){let t=e.trim();if(t.length===0||t===`*`)return!0;let n=t;for(let e of i)if(t.startsWith(e)){n=t.substring(e.length).trim();break}let r=n.search(/[-+]/),a=(r>=0?n.substring(0,r):n).trim().split(`.`);return a.length>=1&&a.length<=3&&a.every(e=>/^[0-9]+$/.test(e))}export{isValidTemplateVersionRange,parseBlueprintReference,startsBlueprintReference};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{pattern as e}from"../Text/patterns.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";const r=e(`^blueprint\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(?:\\s+version\\s+"(${t})")?$`),i=[`>=`,`<=`,`^`,`~`,`>`,`<`,`=`];function startsBlueprintReference(e){return e.startsWith(`blueprint `)}function parseBlueprintReference(e){let t=r.exec(e);if(t!==null)return{blueprint:t[1],name:t[2],version:t[3]===void 0?null:n(t[3])}}function isValidTemplateVersionRange(e){let t=e.trim();if(t.length===0||t===`*`)return!0;let n=t;for(let e of i)if(t.startsWith(e)){n=t.substring(e.length).trim();break}let r=n.search(/[-+]/),a=(r>=0?n.substring(0,r):n).trim().split(`.`);return a.length>=1&&a.length<=3&&a.every(e=>/^[0-9]+$/.test(e))}export{isValidTemplateVersionRange,parseBlueprintReference,startsBlueprintReference};
2
2
  //# sourceMappingURL=TemplateReferenceText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateReferenceText.js","names":["blueprintReference","pattern","stringBodyPattern","rangeOperators","text","match","unescapeString","trimmed","range","literal","operator","suffix","parts","part"],"sources":["../../../../../../Compiler/Parsing/TemplateReferenceText.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\n\n// 'template blueprint <Blueprint> <Name> [version \"<range>\"]': a template a blueprint package ships, with the\n// semver range of the blueprint the author accepts. The port of the C# TemplateReferenceText.\nconst blueprintReference = pattern(`^blueprint\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(?:\\\\s+version\\\\s+\"(${stringBodyPattern})\")?$`);\n\nconst rangeOperators = ['>=', '<=', '^', '~', '>', '<', '='];\n\nexport interface TemplateReferenceParts {\n readonly blueprint: string;\n readonly name: string;\n readonly version: string | null;\n}\n\n// Whether the text after 'template' starts the blueprint form, whether or not it is well formed.\nexport function startsBlueprintReference(text: string): boolean {\n return text.startsWith('blueprint ');\n}\n\n// Reads the blueprint form, or undefined when it is malformed.\nexport function parseBlueprintReference(text: string): TemplateReferenceParts | undefined {\n const match = blueprintReference.exec(text);\n if (match === null) return undefined;\n return { blueprint: match[1], name: match[2], version: match[3] === undefined ? null : unescapeString(match[3]) };\n}\n\n// Whether a template reference's version is a range Scene understands - the same subset as Scene's\n// isValidVersionRange and PackageVersionRange.IsValidRange. Whether the installed blueprint satisfies it is\n// decided where the blueprint is known, in Stage and Scene.\nexport function isValidTemplateVersionRange(range: string): boolean {\n const trimmed = range.trim();\n if (trimmed.length === 0 || trimmed === '*') return true;\n let literal = trimmed;\n for (const operator of rangeOperators) {\n if (trimmed.startsWith(operator)) {\n literal = trimmed.substring(operator.length).trim();\n break;\n }\n }\n const suffix = literal.search(/[-+]/);\n const numeric = (suffix >= 0 ? literal.substring(0, suffix) : literal).trim();\n const parts = numeric.split('.');\n return parts.length >= 1 && parts.length <= 3 && parts.every(part => /^[0-9]+$/.test(part));\n}\n"],"mappings":"oLAQA,MAAMA,EAAqBC,EAAQ,+FAA+FC,EAAkB,MAAM,EAEpJC,EAAiB,CAAC,KAAM,KAAM,IAAK,IAAK,IAAK,IAAK,GAAG,EAS3D,SAAgB,yBAAyB,EAAuB,CAC5D,OAAOC,EAAK,WAAW,YAAY,CACvC,CAGA,SAAgB,wBAAwB,EAAkD,CACtF,IAAMC,EAAQL,EAAmB,KAAKI,CAAI,EAC1C,GAAIC,IAAU,KACd,MAAO,CAAE,UAAWA,EAAM,GAAI,KAAMA,EAAM,GAAI,QAASA,EAAM,KAAO,IAAA,GAAY,KAAOC,EAAeD,EAAM,EAAE,CAAE,CACpH,CAKA,SAAgB,4BAA4B,EAAwB,CAChE,IAAME,EAAUC,EAAM,KAAK,EAC3B,GAAID,EAAQ,SAAW,GAAKA,IAAY,IAAK,MAAO,GACpD,IAAIE,EAAUF,EACd,IAAK,IAAMG,KAAYP,EACnB,GAAII,EAAQ,WAAWG,CAAQ,EAAG,CAC9B,EAAUH,EAAQ,UAAUG,EAAS,MAAM,CAAC,CAAC,KAAK,EAClD,KACJ,CAEJ,IAAMC,EAASF,EAAQ,OAAO,MAAM,EAE9BG,GADWD,GAAU,EAAIF,EAAQ,UAAU,EAAGE,CAAM,EAAIF,EAAA,CAAS,KACnD,CAAC,CAAC,MAAM,GAAG,EAC/B,OAAOG,EAAM,QAAU,GAAKA,EAAM,QAAU,GAAKA,EAAM,MAAM,GAAQ,WAAW,KAAKC,CAAI,CAAC,CAC9F"}
1
+ {"version":3,"file":"TemplateReferenceText.js","names":["blueprintReference","pattern","stringBodyPattern","rangeOperators","text","match","unescapeString","trimmed","range","literal","operator","suffix","parts","part"],"sources":["../../../../../../Compiler/Parsing/TemplateReferenceText.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 { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\n\n// 'template blueprint <Blueprint> <Name> [version \"<range>\"]': a template a blueprint package ships, with the\n// semver range of the blueprint the author accepts. The port of the C# TemplateReferenceText.\nconst blueprintReference = pattern(`^blueprint\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(?:\\\\s+version\\\\s+\"(${stringBodyPattern})\")?$`);\n\nconst rangeOperators = ['>=', '<=', '^', '~', '>', '<', '='];\n\nexport interface TemplateReferenceParts {\n readonly blueprint: string;\n readonly name: string;\n readonly version: string | null;\n}\n\n// Whether the text after 'template' starts the blueprint form, whether or not it is well formed.\nexport function startsBlueprintReference(text: string): boolean {\n return text.startsWith('blueprint ');\n}\n\n// Reads the blueprint form, or undefined when it is malformed.\nexport function parseBlueprintReference(text: string): TemplateReferenceParts | undefined {\n const match = blueprintReference.exec(text);\n if (match === null) return undefined;\n return { blueprint: match[1], name: match[2], version: match[3] === undefined ? null : unescapeString(match[3]) };\n}\n\n// Whether a template reference's version is a range Scene understands - the same subset as Scene's\n// isValidVersionRange and PackageVersionRange.IsValidRange. Whether the installed blueprint satisfies it is\n// decided where the blueprint is known, in Stage and Scene.\nexport function isValidTemplateVersionRange(range: string): boolean {\n const trimmed = range.trim();\n if (trimmed.length === 0 || trimmed === '*') return true;\n let literal = trimmed;\n for (const operator of rangeOperators) {\n if (trimmed.startsWith(operator)) {\n literal = trimmed.substring(operator.length).trim();\n break;\n }\n }\n const suffix = literal.search(/[-+]/);\n const numeric = (suffix >= 0 ? literal.substring(0, suffix) : literal).trim();\n const parts = numeric.split('.');\n return parts.length >= 1 && parts.length <= 3 && parts.every(part => /^[0-9]+$/.test(part));\n}\n"],"mappings":"A,oLAQA,MAAMA,EAAqBC,EAAQ,+FAA+FC,EAAkB,MAAM,EAEpJC,EAAiB,CAAC,KAAM,KAAM,IAAK,IAAK,IAAK,IAAK,GAAG,EAS3D,SAAgB,yBAAyB,EAAuB,CAC5D,OAAOC,EAAK,WAAW,YAAY,CACvC,CAGA,SAAgB,wBAAwB,EAAkD,CACtF,IAAMC,EAAQL,EAAmB,KAAKI,CAAI,EAC1C,GAAIC,IAAU,KACd,MAAO,CAAE,UAAWA,EAAM,GAAI,KAAMA,EAAM,GAAI,QAASA,EAAM,KAAO,IAAA,GAAY,KAAOC,EAAeD,EAAM,EAAE,CAAE,CACpH,CAKA,SAAgB,4BAA4B,EAAwB,CAChE,IAAME,EAAUC,EAAM,KAAK,EAC3B,GAAID,EAAQ,SAAW,GAAKA,IAAY,IAAK,MAAO,GACpD,IAAIE,EAAUF,EACd,IAAK,IAAMG,KAAYP,EACnB,GAAII,EAAQ,WAAWG,CAAQ,EAAG,CAC9B,EAAUH,EAAQ,UAAUG,EAAS,MAAM,CAAC,CAAC,KAAK,EAClD,KACJ,CAEJ,IAAMC,EAASF,EAAQ,OAAO,MAAM,EAE9BG,GADWD,GAAU,EAAIF,EAAQ,UAAU,EAAGE,CAAM,EAAIF,EAAA,CAAS,KACnD,CAAC,CAAC,MAAM,GAAG,EAC/B,OAAOG,EAAM,QAAU,GAAKA,EAAM,QAAU,GAAKA,EAAM,MAAM,GAAQ,WAAW,KAAKC,CAAI,CAAC,CAC9F,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{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{parseProperty as i}from"./PropertyLineParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{isFileDirective as o}from"./FileReferences.js";const s=t(`^@?[a-z_]\\w*\\s+[\\w.]+`);function parseTriggerData(t,r){let a=i(t,r);a===void 0?(s.test(r.content)&&/\?|\boptional\b/.test(r.content)&&t.error(e.InvalidTriggerData,`Invalid trigger value '${r.content}' - expected '<name>' or '<name> <Type>'`,n(r)),t.skipOpaqueBlock(r.indent)):(a.isKey&&t.error(e.InvalidReadModelKey,`The key modifier is only valid on top-level read-model properties.`,a.location),a.isGenerated&&t.error(e.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,a.location),a.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).`,a.location),t.triggerData.push(a))}function parseTriggerDeclaration(e,t){let n=e.triggerData.length;for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent))e.reader.takeSignificant(),r(n.content)===`description`?a(e,n,null,`Trigger '${t.content}'`):o(n)||parseTriggerData(e,n);return e.triggerData.slice(n)}export{parseTriggerData,parseTriggerDeclaration};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{parseDescription as n}from"./DescriptionParser.js";import{isFileDirective as r}from"./FileReferences.js";import{firstWord as i}from"./LineText.js";import{parseProperty as a}from"./PropertyLineParser.js";import{locationOf as o}from"./SourceLine.js";const s=t(`^@?[a-z_]\\w*\\s+[\\w.]+`);function parseTriggerData(t,n){let r=a(t,n);r===void 0?(s.test(n.content)&&/\?|\boptional\b/.test(n.content)&&t.error(e.InvalidTriggerData,`Invalid trigger value '${n.content}' - expected '<name>' or '<name> <Type>'`,o(n)),t.skipOpaqueBlock(n.indent)):(r.isKey&&t.error(e.InvalidReadModelKey,`The key modifier is only valid on top-level read-model properties.`,r.location),r.isGenerated&&t.error(e.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,r.location),r.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).`,r.location),t.triggerData.push(r))}function parseTriggerDeclaration(e,t){let a=e.triggerData.length;for(let a=e.peekChild(t.indent);a!==void 0;a=e.peekChild(t.indent))e.reader.takeSignificant(),i(a.content)===`description`?n(e,a,null,`Trigger '${t.content}'`):r(a)||parseTriggerData(e,a);return e.triggerData.slice(a)}export{parseTriggerData,parseTriggerDeclaration};
2
2
  //# sourceMappingURL=TriggerDataParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TriggerDataParser.js","names":["typedValue","pattern","property","parseProperty","context","line","DiagnosticCodes","locationOf","start","header","firstWord","parseDescription","isFileDirective"],"sources":["../../../../../../Compiler/Parsing/TriggerDataParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typedValue = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+');\n\n// Trigger values are kept as parser-owned diagnostic metadata, outside the syntax wire projection. Recognize their type spelling in\n// exactly the C# data positions, without scanning descriptions, attachments, code or mapping expressions.\nexport function parseTriggerData(context: ParserContext, line: SourceLine): void {\n const property = parseProperty(context, line);\n if (property !== undefined) {\n if (property.isKey) context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', property.location);\n if (property.isGenerated) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).', property.location);\n context.triggerData.push(property);\n return;\n }\n // Keep the existing opaque projection for other trigger values and implementation bodies.\n // Only optionality-shaped failures belong to this spelling change.\n if (typedValue.test(line.content) && /\\?|\\boptional\\b/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidTriggerData, `Invalid trigger value '${line.content}' - expected '<name>' or '<name> <Type>'`, locationOf(line));\n }\n context.skipOpaqueBlock(line.indent);\n}\n\nexport function parseTriggerDeclaration(context: ParserContext, header: SourceLine): readonly PropertySyntax[] {\n const start = context.triggerData.length;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n parseDescription(context, line, null, `Trigger '${header.content}'`);\n } else if (!isFileDirective(line)) {\n parseTriggerData(context, line);\n }\n }\n return context.triggerData.slice(start);\n}\n"],"mappings":"saAaA,MAAMA,EAAaC,EAAQ,0BAA0B,EAIrD,SAAgB,iBAAiB,EAAwB,EAAwB,CAC7E,IAAMC,EAAWC,EAAcC,EAASC,CAAI,EACxCH,IAAa,IAAA,IASbF,EAAW,KAAKK,EAAK,OAAO,GAAK,kBAAkB,KAAKA,EAAK,OAAO,GACpED,EAAQ,MAAME,EAAgB,mBAAoB,0BAA0BD,EAAK,QAAQ,0CAA2CE,EAAWF,CAAI,CAAC,EAExJD,EAAQ,gBAAgBC,EAAK,MAAM,IAX3BH,EAAS,OAAOE,EAAQ,MAAME,EAAgB,oBAAqB,qEAAsEJ,EAAS,QAAQ,EAC1JA,EAAS,aAAaE,EAAQ,MAAME,EAAgB,gCAAiC,yDAA0DJ,EAAS,QAAQ,EAChKA,EAAS,WAAWE,EAAQ,MAAME,EAAgB,oBAAqB,+IAAgJJ,EAAS,QAAQ,EAC5OE,EAAQ,YAAY,KAAKF,CAAQ,EASzC,CAEA,SAAgB,wBAAwB,EAAwB,EAA+C,CAC3G,IAAMM,EAAQJ,EAAQ,YAAY,OAClC,IAAK,IAAIC,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EAAGJ,IAAS,IAAA,GAAW,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EACxGL,EAAQ,OAAO,gBAAgB,EAC3BM,EAAUL,EAAK,OAAO,IAAM,cAC5BM,EAAiBP,EAASC,EAAM,KAAM,YAAYI,EAAO,QAAQ,EAAE,EAC3DG,EAAgBP,CAAI,GAC5B,iBAAiBD,EAASC,CAAI,EAGtC,OAAOD,EAAQ,YAAY,MAAMI,CAAK,CAC1C"}
1
+ {"version":3,"file":"TriggerDataParser.js","names":["typedValue","pattern","property","parseProperty","context","line","DiagnosticCodes","locationOf","start","header","firstWord","parseDescription","isFileDirective"],"sources":["../../../../../../Compiler/Parsing/TriggerDataParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typedValue = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+');\n\n// Trigger values are kept as parser-owned diagnostic metadata, outside the syntax wire projection. Recognize their type spelling in\n// exactly the C# data positions, without scanning descriptions, attachments, code or mapping expressions.\nexport function parseTriggerData(context: ParserContext, line: SourceLine): void {\n const property = parseProperty(context, line);\n if (property !== undefined) {\n if (property.isKey) context.error(DiagnosticCodes.InvalidReadModelKey, 'The key modifier is only valid on top-level read-model properties.', property.location);\n if (property.isGenerated) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).', property.location);\n context.triggerData.push(property);\n return;\n }\n // Keep the existing opaque projection for other trigger values and implementation bodies.\n // Only optionality-shaped failures belong to this spelling change.\n if (typedValue.test(line.content) && /\\?|\\boptional\\b/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidTriggerData, `Invalid trigger value '${line.content}' - expected '<name>' or '<name> <Type>'`, locationOf(line));\n }\n context.skipOpaqueBlock(line.indent);\n}\n\nexport function parseTriggerDeclaration(context: ParserContext, header: SourceLine): readonly PropertySyntax[] {\n const start = context.triggerData.length;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n parseDescription(context, line, null, `Trigger '${header.content}'`);\n } else if (!isFileDirective(line)) {\n parseTriggerData(context, line);\n }\n }\n return context.triggerData.slice(start);\n}\n"],"mappings":"A,saAaA,MAAMA,EAAaC,EAAQ,0BAA0B,EAIrD,SAAgB,iBAAiB,EAAwB,EAAwB,CAC7E,IAAMC,EAAWC,EAAcC,EAASC,CAAI,EACxCH,IAAa,IAAA,IASbF,EAAW,KAAKK,EAAK,OAAO,GAAK,kBAAkB,KAAKA,EAAK,OAAO,GACpED,EAAQ,MAAME,EAAgB,mBAAoB,0BAA0BD,EAAK,QAAQ,0CAA2CE,EAAWF,CAAI,CAAC,EAExJD,EAAQ,gBAAgBC,EAAK,MAAM,IAX3BH,EAAS,OAAOE,EAAQ,MAAME,EAAgB,oBAAqB,qEAAsEJ,EAAS,QAAQ,EAC1JA,EAAS,aAAaE,EAAQ,MAAME,EAAgB,gCAAiC,yDAA0DJ,EAAS,QAAQ,EAChKA,EAAS,WAAWE,EAAQ,MAAME,EAAgB,oBAAqB,+IAAgJJ,EAAS,QAAQ,EAC5OE,EAAQ,YAAY,KAAKF,CAAQ,EASzC,CAEA,SAAgB,wBAAwB,EAAwB,EAA+C,CAC3G,IAAMM,EAAQJ,EAAQ,YAAY,OAClC,IAAK,IAAIC,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EAAGJ,IAAS,IAAA,GAAW,EAAOD,EAAQ,UAAUK,EAAO,MAAM,EACxGL,EAAQ,OAAO,gBAAgB,EAC3BM,EAAUL,EAAK,OAAO,IAAM,cAC5BM,EAAiBP,EAASC,EAAM,KAAM,YAAYI,EAAO,QAAQ,EAAE,EAC3DG,EAAgBP,CAAI,GAC5B,iBAAiBD,EAASC,CAAI,EAGtC,OAAOD,EAAQ,YAAY,MAAMI,CAAK,CAC1C,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{locationOf as n}from"./SourceLine.js";import{parseMappingSource as r}from"./ExpressionParser.js";import{markerOf as i,parseStructuredValue as a}from"./StructuredBlockParser.js";const o=t(`^(data|query|component)\\s+(\\S+)(.*)$`),s=t(`^(?:from\\s+)?literal(?:\\s+(?<modifiers>(?:mode|null|expected)\\s+.+?))?(?:\\s+(?<marker>none|empty))?$`),c=t(`^literal\\s+(.+?)(?:\\s+(mode\\s+.+|null\\s+.+|expected\\s+.+))?$`),l=t(`^([A-Za-z_]\\w*)(?:\\.(.+))?$`),u=t(`^(?:([A-Za-z_]\\w*)|"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)")\\.(.+)$`),d=t(`^mode\\s+(oneWay|twoWay)\\b(.*)$`),f=t(`^null\\s+(propagate|clear|preserve)\\b(.*)$`),p=t(`^expected\\s+(\\w+(?:\\.\\w+)*)(.*)$`);function parseFromClauseOn(e,t,r){let o=s.exec(t.trim());if(o===null||i(o)===void 0&&e.peekChild(r.indent)===void 0)return parseFromClause(e,t,n(r));let c=a(e,r,i(o));return withModifiers(e,{...create(`Literal`,``,n(r)),literal:c},o.groups.modifiers??``,n(r))}function parseFromClause(e,t,n){let r=t.trim(),i=r.split(/\s+/,1)[0];return i===`data`||i===`query`||i===`component`||i===`literal`?parseUiBinding(e,`from ${r}`,n):parseUiBinding(e,r,n)}function parseUiBinding(t,n,i){let a=n.trim();if(!a.startsWith(`from `))return withModifiers(t,create(`DataContext`,a,i),``,i);let s=a.substring(5).trim();if(s.startsWith(`literal `)){let n=c.exec(s);return n===null?(t.error(e.UnknownScreenDirective,`Invalid UI binding '${a}' - expected 'from literal <value>'`,i),{...create(`Invalid`,s,i),rawText:a}):withModifiers(t,{...create(`Literal`,``,i),literal:r(n[1],i,t)},n[2]??``,i)}let l=o.exec(s);return l===null?(t.error(e.UnknownScreenDirective,`Invalid UI binding '${a}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`,i),{...create(`Invalid`,s,i),rawText:a}):withModifiers(t,parseBindingSource(t,l[1],l[2],a,i),l[3],i)}function parseBindingSource(e,t,n,r,i){return t===`data`?create(`DataContext`,n,i):t===`query`?queryBinding(e,n,r,i):componentBinding(e,n,r,i)}function queryBinding(t,n,r,i){let a=l.exec(n);return a===null?(t.error(e.UnknownScreenDirective,`Invalid query binding '${r}' - expected 'from query <Query>[.<path>]'.`,i),{...create(`Invalid`,n,i),rawText:r}):{...create(`QueryResult`,a[2]??``,i),query:a[1]}}function componentBinding(t,n,r,i){let a=u.exec(n);if(a===null)return t.error(e.UnknownScreenDirective,`Invalid component binding '${r}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component "<stableInstanceId>".<outputPath>'.`,i),{...create(`Invalid`,n,i),rawText:r};let o=a[1]??a[2],s=a[3];return{...create(`ComponentProperty`,s,i),componentId:o,componentPropertyPath:s}}function withModifiers(t,n,r,i){let a=n,o=r.trim();for(;o.length>0;){let n=d.exec(o);if(n!==null){a={...a,mode:n[1]===`twoWay`?`TwoWay`:`OneWay`},o=n[2].trim();continue}let r=f.exec(o);if(r!==null){a={...a,nullBehavior:r[1]===`clear`?`Clear`:r[1]===`preserve`?`Preserve`:`Propagate`},o=r[2].trim();continue}let s=p.exec(o);if(s!==null)a={...a,expectedValueType:s[1]},o=s[2].trim();else return t.error(e.UnknownScreenDirective,`Unsupported UI binding modifier '${o}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`,i),{...a,rawText:a.rawText??o}}return a}function create(e,t,n){return{kind:`UiBindingSyntax`,bindingKind:e,path:t,query:null,componentId:null,componentPropertyPath:null,mode:null,nullBehavior:null,expectedValueType:null,literal:null,rawText:null,location:n}}export{parseFromClause,parseFromClauseOn,parseUiBinding};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{parseMappingSource as t}from"./ExpressionParser.js";import{pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{markerOf as i,parseStructuredValue as a}from"./StructuredBlockParser.js";const o=n(`^(data|query|component)\\s+(\\S+)(.*)$`),s=n(`^(?:from\\s+)?literal(?:\\s+(?<modifiers>(?:mode|null|expected)\\s+.+?))?(?:\\s+(?<marker>none|empty))?$`),c=n(`^literal\\s+(.+?)(?:\\s+(mode\\s+.+|null\\s+.+|expected\\s+.+))?$`),l=n(`^([A-Za-z_]\\w*)(?:\\.(.+))?$`),u=n(`^(?:([A-Za-z_]\\w*)|"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)")\\.(.+)$`),d=n(`^mode\\s+(oneWay|twoWay)\\b(.*)$`),f=n(`^null\\s+(propagate|clear|preserve)\\b(.*)$`),p=n(`^expected\\s+(\\w+(?:\\.\\w+)*)(.*)$`);function parseFromClauseOn(e,t,n){let o=s.exec(t.trim());if(o===null||i(o)===void 0&&e.peekChild(n.indent)===void 0)return parseFromClause(e,t,r(n));let c=a(e,n,i(o));return withModifiers(e,{...create(`Literal`,``,r(n)),literal:c},o.groups.modifiers??``,r(n))}function parseFromClause(e,t,n){let r=t.trim(),i=r.split(/\s+/,1)[0];return i===`data`||i===`query`||i===`component`||i===`literal`?parseUiBinding(e,`from ${r}`,n):parseUiBinding(e,r,n)}function parseUiBinding(n,r,i){let a=r.trim();if(!a.startsWith(`from `))return withModifiers(n,create(`DataContext`,a,i),``,i);let s=a.substring(5).trim();if(s.startsWith(`literal `)){let r=c.exec(s);return r===null?(n.error(e.UnknownScreenDirective,`Invalid UI binding '${a}' - expected 'from literal <value>'`,i),{...create(`Invalid`,s,i),rawText:a}):withModifiers(n,{...create(`Literal`,``,i),literal:t(r[1],i,n)},r[2]??``,i)}let l=o.exec(s);return l===null?(n.error(e.UnknownScreenDirective,`Invalid UI binding '${a}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`,i),{...create(`Invalid`,s,i),rawText:a}):withModifiers(n,parseBindingSource(n,l[1],l[2],a,i),l[3],i)}function parseBindingSource(e,t,n,r,i){return t===`data`?create(`DataContext`,n,i):t===`query`?queryBinding(e,n,r,i):componentBinding(e,n,r,i)}function queryBinding(t,n,r,i){let a=l.exec(n);return a===null?(t.error(e.UnknownScreenDirective,`Invalid query binding '${r}' - expected 'from query <Query>[.<path>]'.`,i),{...create(`Invalid`,n,i),rawText:r}):{...create(`QueryResult`,a[2]??``,i),query:a[1]}}function componentBinding(t,n,r,i){let a=u.exec(n);if(a===null)return t.error(e.UnknownScreenDirective,`Invalid component binding '${r}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component "<stableInstanceId>".<outputPath>'.`,i),{...create(`Invalid`,n,i),rawText:r};let o=a[1]??a[2],s=a[3];return{...create(`ComponentProperty`,s,i),componentId:o,componentPropertyPath:s}}function withModifiers(t,n,r,i){let a=n,o=r.trim();for(;o.length>0;){let n=d.exec(o);if(n!==null){a={...a,mode:n[1]===`twoWay`?`TwoWay`:`OneWay`},o=n[2].trim();continue}let r=f.exec(o);if(r!==null){a={...a,nullBehavior:r[1]===`clear`?`Clear`:r[1]===`preserve`?`Preserve`:`Propagate`},o=r[2].trim();continue}let s=p.exec(o);if(s!==null)a={...a,expectedValueType:s[1]},o=s[2].trim();else return t.error(e.UnknownScreenDirective,`Unsupported UI binding modifier '${o}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`,i),{...a,rawText:a.rawText??o}}return a}function create(e,t,n){return{kind:`UiBindingSyntax`,bindingKind:e,path:t,query:null,componentId:null,componentPropertyPath:null,mode:null,nullBehavior:null,expectedValueType:null,literal:null,rawText:null,location:n}}export{parseFromClause,parseFromClauseOn,parseUiBinding};
2
2
  //# sourceMappingURL=UiBindingParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiBindingParser.js","names":["bindingHead","pattern","structuredLiteral","literalBindingHead","qualifiedPath","requiredQualifiedPath","mode","nullBehavior","expected","structured","text","markerOf","context","line","locationOf","literal","parseStructuredValue","trimmed","first","location","body","literalHead","DiagnosticCodes","parseMappingSource","head","source","expression","raw","match","componentId","path","next","binding","rest","modifiers","modeMatch","nullMatch","expectedMatch"],"sources":["../../../../../../Compiler/Parsing/UiBindingParser.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 { UiBindingSyntax } from '../Syntax/Screens';\nimport { parseMappingSource } from './ExpressionParser';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { markerOf, parseStructuredValue } from './StructuredBlockParser';\n\nconst bindingHead = pattern('^(data|query|component)\\\\s+(\\\\S+)(.*)$');\nconst structuredLiteral = pattern('^(?:from\\\\s+)?literal(?:\\\\s+(?<modifiers>(?:mode|null|expected)\\\\s+.+?))?(?:\\\\s+(?<marker>none|empty))?$');\nconst literalBindingHead = pattern('^literal\\\\s+(.+?)(?:\\\\s+(mode\\\\s+.+|null\\\\s+.+|expected\\\\s+.+))?$');\nconst qualifiedPath = pattern('^([A-Za-z_]\\\\w*)(?:\\\\.(.+))?$');\nconst requiredQualifiedPath = pattern('^(?:([A-Za-z_]\\\\w*)|\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\")\\\\.(.+)$');\nconst mode = pattern('^mode\\\\s+(oneWay|twoWay)\\\\b(.*)$');\nconst nullBehavior = pattern('^null\\\\s+(propagate|clear|preserve)\\\\b(.*)$');\nconst expected = pattern('^expected\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(.*)$');\n\n// A binding clause on a line, where 'from literal' with no value on the line opens the literal as an indented block.\nexport function parseFromClauseOn(context: ParserContext, text: string, line: SourceLine): UiBindingSyntax {\n const structured = structuredLiteral.exec(text.trim());\n if (structured === null || (markerOf(structured) === undefined && context.peekChild(line.indent) === undefined)) return parseFromClause(context, text, locationOf(line));\n const literal = parseStructuredValue(context, line, markerOf(structured));\n return withModifiers(context, { ...create('Literal', '', locationOf(line)), literal }, structured.groups!.modifiers ?? '', locationOf(line));\n}\n\nexport function parseFromClause(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n const first = trimmed.split(/\\s+/, 1)[0];\n return first === 'data' || first === 'query' || first === 'component' || first === 'literal'\n ? parseUiBinding(context, `from ${trimmed}`, location)\n : parseUiBinding(context, trimmed, location);\n}\n\nexport function parseUiBinding(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n if (!trimmed.startsWith('from ')) {\n return withModifiers(context, create('DataContext', trimmed, location), '', location);\n }\n\n const body = trimmed.substring('from '.length).trim();\n if (body.startsWith('literal ')) {\n const literalHead = literalBindingHead.exec(body);\n if (literalHead === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n return withModifiers(context, { ...create('Literal', '', location), literal: parseMappingSource(literalHead[1], location, context) }, literalHead[2] ?? '', location);\n }\n\n const head = bindingHead.exec(body);\n if (head === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n\n const binding = parseBindingSource(context, head[1], head[2], trimmed, location);\n return withModifiers(context, binding, head[3], location);\n}\n\nfunction parseBindingSource(context: ParserContext, source: string, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n if (source === 'data') return create('DataContext', expression, location);\n if (source === 'query') return queryBinding(context, expression, raw, location);\n\n return componentBinding(context, expression, raw, location);\n}\n\nfunction queryBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = qualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid query binding '${raw}' - expected 'from query <Query>[.<path>]'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n return { ...create('QueryResult', match[2] ?? '', location), query: match[1] };\n}\n\nfunction componentBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = requiredQualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component binding '${raw}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component \"<stableInstanceId>\".<outputPath>'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n const componentId = match[1] ?? match[2];\n const path = match[3];\n return { ...create('ComponentProperty', path, location), componentId, componentPropertyPath: path };\n}\n\nfunction withModifiers(context: ParserContext, binding: UiBindingSyntax, modifiers: string, location: SourceLocation): UiBindingSyntax {\n let next = binding;\n let rest = modifiers.trim();\n while (rest.length > 0) {\n const modeMatch = mode.exec(rest);\n if (modeMatch !== null) {\n next = { ...next, mode: modeMatch[1] === 'twoWay' ? 'TwoWay' : 'OneWay' };\n rest = modeMatch[2].trim();\n continue;\n }\n\n const nullMatch = nullBehavior.exec(rest);\n if (nullMatch !== null) {\n next = { ...next, nullBehavior: nullMatch[1] === 'clear' ? 'Clear' : nullMatch[1] === 'preserve' ? 'Preserve' : 'Propagate' };\n rest = nullMatch[2].trim();\n continue;\n }\n\n const expectedMatch = expected.exec(rest);\n if (expectedMatch !== null) {\n next = { ...next, expectedValueType: expectedMatch[1] };\n rest = expectedMatch[2].trim();\n continue;\n }\n\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unsupported UI binding modifier '${rest}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`, location);\n return { ...next, rawText: next.rawText ?? rest };\n }\n\n return next;\n}\n\nfunction create(bindingKind: UiBindingSyntax['bindingKind'], path: string, location: SourceLocation): UiBindingSyntax {\n return {\n kind: 'UiBindingSyntax',\n bindingKind,\n path,\n query: null,\n componentId: null,\n componentPropertyPath: null,\n mode: null,\n nullBehavior: null,\n expectedValueType: null,\n literal: null,\n rawText: null,\n location,\n };\n}\n"],"mappings":"+VAYA,MAAMA,EAAcC,EAAQ,wCAAwC,EAC9DC,EAAoBD,EAAQ,0GAA0G,EACtIE,EAAqBF,EAAQ,mEAAmE,EAChGG,EAAgBH,EAAQ,+BAA+B,EACvDI,EAAwBJ,EAAQ,+DAA+D,EAC/FK,EAAOL,EAAQ,kCAAkC,EACjDM,EAAeN,EAAQ,6CAA6C,EACpEO,EAAWP,EAAQ,sCAAsC,EAG/D,SAAgB,kBAAkB,EAAwB,EAAc,EAAmC,CACvG,IAAMQ,EAAaP,EAAkB,KAAKQ,EAAK,KAAK,CAAC,EACrD,GAAID,IAAe,MAASE,EAASF,CAAU,IAAM,IAAA,IAAaG,EAAQ,UAAUC,EAAK,MAAM,IAAM,IAAA,GAAY,OAAO,gBAAgBD,EAASF,EAAMI,EAAWD,CAAI,CAAC,EACvK,IAAME,EAAUC,EAAqBJ,EAASC,EAAMF,EAASF,CAAU,CAAC,EACxE,OAAO,cAAcG,EAAS,CAAE,GAAG,OAAO,UAAW,GAAIE,EAAWD,CAAI,CAAC,EAAG,SAAQ,EAAGJ,EAAW,OAAQ,WAAa,GAAIK,EAAWD,CAAI,CAAC,CAC/I,CAEA,SAAgB,gBAAgB,EAAwB,EAAc,EAA2C,CAC7G,IAAMI,EAAUP,EAAK,KAAK,EACpBQ,EAAQD,EAAQ,MAAM,MAAO,CAAC,CAAC,CAAC,GACtC,OAAOC,IAAU,QAAUA,IAAU,SAAWA,IAAU,aAAeA,IAAU,UAC7E,eAAeN,EAAS,QAAQK,IAAWE,CAAQ,EACnD,eAAeP,EAASK,EAASE,CAAQ,CACnD,CAEA,SAAgB,eAAe,EAAwB,EAAc,EAA2C,CAC5G,IAAMF,EAAUP,EAAK,KAAK,EAC1B,GAAI,CAACO,EAAQ,WAAW,OAAO,EAC3B,OAAO,cAAcL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AgB,uBAAwB,oCAAoCW,EAAK,0GAA2Gd,CAAQ,EAC3M,CAAE,GAAGY,EAAM,QAASA,EAAK,SAAWE,CAAK,CACpD,CAEA,OAAOF,CACX,CAEA,SAAS,OAAO,EAA6C,EAAc,EAA2C,CAClH,MAAO,CACH,KAAM,kBACN,cACA,OACA,MAAO,KACP,YAAa,KACb,sBAAuB,KACvB,KAAM,KACN,aAAc,KACd,kBAAmB,KACnB,QAAS,KACT,QAAS,KACT,UACJ,CACJ"}
1
+ {"version":3,"file":"UiBindingParser.js","names":["bindingHead","pattern","structuredLiteral","literalBindingHead","qualifiedPath","requiredQualifiedPath","mode","nullBehavior","expected","structured","text","markerOf","context","line","locationOf","literal","parseStructuredValue","trimmed","first","location","body","literalHead","DiagnosticCodes","parseMappingSource","head","source","expression","raw","match","componentId","path","next","binding","rest","modifiers","modeMatch","nullMatch","expectedMatch"],"sources":["../../../../../../Compiler/Parsing/UiBindingParser.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 { UiBindingSyntax } from '../Syntax/Screens';\nimport { parseMappingSource } from './ExpressionParser';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { markerOf, parseStructuredValue } from './StructuredBlockParser';\n\nconst bindingHead = pattern('^(data|query|component)\\\\s+(\\\\S+)(.*)$');\nconst structuredLiteral = pattern('^(?:from\\\\s+)?literal(?:\\\\s+(?<modifiers>(?:mode|null|expected)\\\\s+.+?))?(?:\\\\s+(?<marker>none|empty))?$');\nconst literalBindingHead = pattern('^literal\\\\s+(.+?)(?:\\\\s+(mode\\\\s+.+|null\\\\s+.+|expected\\\\s+.+))?$');\nconst qualifiedPath = pattern('^([A-Za-z_]\\\\w*)(?:\\\\.(.+))?$');\nconst requiredQualifiedPath = pattern('^(?:([A-Za-z_]\\\\w*)|\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\")\\\\.(.+)$');\nconst mode = pattern('^mode\\\\s+(oneWay|twoWay)\\\\b(.*)$');\nconst nullBehavior = pattern('^null\\\\s+(propagate|clear|preserve)\\\\b(.*)$');\nconst expected = pattern('^expected\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(.*)$');\n\n// A binding clause on a line, where 'from literal' with no value on the line opens the literal as an indented block.\nexport function parseFromClauseOn(context: ParserContext, text: string, line: SourceLine): UiBindingSyntax {\n const structured = structuredLiteral.exec(text.trim());\n if (structured === null || (markerOf(structured) === undefined && context.peekChild(line.indent) === undefined)) return parseFromClause(context, text, locationOf(line));\n const literal = parseStructuredValue(context, line, markerOf(structured));\n return withModifiers(context, { ...create('Literal', '', locationOf(line)), literal }, structured.groups!.modifiers ?? '', locationOf(line));\n}\n\nexport function parseFromClause(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n const first = trimmed.split(/\\s+/, 1)[0];\n return first === 'data' || first === 'query' || first === 'component' || first === 'literal'\n ? parseUiBinding(context, `from ${trimmed}`, location)\n : parseUiBinding(context, trimmed, location);\n}\n\nexport function parseUiBinding(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n if (!trimmed.startsWith('from ')) {\n return withModifiers(context, create('DataContext', trimmed, location), '', location);\n }\n\n const body = trimmed.substring('from '.length).trim();\n if (body.startsWith('literal ')) {\n const literalHead = literalBindingHead.exec(body);\n if (literalHead === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n return withModifiers(context, { ...create('Literal', '', location), literal: parseMappingSource(literalHead[1], location, context) }, literalHead[2] ?? '', location);\n }\n\n const head = bindingHead.exec(body);\n if (head === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n\n const binding = parseBindingSource(context, head[1], head[2], trimmed, location);\n return withModifiers(context, binding, head[3], location);\n}\n\nfunction parseBindingSource(context: ParserContext, source: string, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n if (source === 'data') return create('DataContext', expression, location);\n if (source === 'query') return queryBinding(context, expression, raw, location);\n\n return componentBinding(context, expression, raw, location);\n}\n\nfunction queryBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = qualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid query binding '${raw}' - expected 'from query <Query>[.<path>]'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n return { ...create('QueryResult', match[2] ?? '', location), query: match[1] };\n}\n\nfunction componentBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = requiredQualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component binding '${raw}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component \"<stableInstanceId>\".<outputPath>'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n const componentId = match[1] ?? match[2];\n const path = match[3];\n return { ...create('ComponentProperty', path, location), componentId, componentPropertyPath: path };\n}\n\nfunction withModifiers(context: ParserContext, binding: UiBindingSyntax, modifiers: string, location: SourceLocation): UiBindingSyntax {\n let next = binding;\n let rest = modifiers.trim();\n while (rest.length > 0) {\n const modeMatch = mode.exec(rest);\n if (modeMatch !== null) {\n next = { ...next, mode: modeMatch[1] === 'twoWay' ? 'TwoWay' : 'OneWay' };\n rest = modeMatch[2].trim();\n continue;\n }\n\n const nullMatch = nullBehavior.exec(rest);\n if (nullMatch !== null) {\n next = { ...next, nullBehavior: nullMatch[1] === 'clear' ? 'Clear' : nullMatch[1] === 'preserve' ? 'Preserve' : 'Propagate' };\n rest = nullMatch[2].trim();\n continue;\n }\n\n const expectedMatch = expected.exec(rest);\n if (expectedMatch !== null) {\n next = { ...next, expectedValueType: expectedMatch[1] };\n rest = expectedMatch[2].trim();\n continue;\n }\n\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unsupported UI binding modifier '${rest}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`, location);\n return { ...next, rawText: next.rawText ?? rest };\n }\n\n return next;\n}\n\nfunction create(bindingKind: UiBindingSyntax['bindingKind'], path: string, location: SourceLocation): UiBindingSyntax {\n return {\n kind: 'UiBindingSyntax',\n bindingKind,\n path,\n query: null,\n componentId: null,\n componentPropertyPath: null,\n mode: null,\n nullBehavior: null,\n expectedValueType: null,\n literal: null,\n rawText: null,\n location,\n };\n}\n"],"mappings":"A,+VAYA,MAAMA,EAAcC,EAAQ,wCAAwC,EAC9DC,EAAoBD,EAAQ,0GAA0G,EACtIE,EAAqBF,EAAQ,mEAAmE,EAChGG,EAAgBH,EAAQ,+BAA+B,EACvDI,EAAwBJ,EAAQ,+DAA+D,EAC/FK,EAAOL,EAAQ,kCAAkC,EACjDM,EAAeN,EAAQ,6CAA6C,EACpEO,EAAWP,EAAQ,sCAAsC,EAG/D,SAAgB,kBAAkB,EAAwB,EAAc,EAAmC,CACvG,IAAMQ,EAAaP,EAAkB,KAAKQ,EAAK,KAAK,CAAC,EACrD,GAAID,IAAe,MAASE,EAASF,CAAU,IAAM,IAAA,IAAaG,EAAQ,UAAUC,EAAK,MAAM,IAAM,IAAA,GAAY,OAAO,gBAAgBD,EAASF,EAAMI,EAAWD,CAAI,CAAC,EACvK,IAAME,EAAUC,EAAqBJ,EAASC,EAAMF,EAASF,CAAU,CAAC,EACxE,OAAO,cAAcG,EAAS,CAAE,GAAG,OAAO,UAAW,GAAIE,EAAWD,CAAI,CAAC,EAAG,S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AO,SAAW,SAAW,QAAS,EACxE,EAAOA,EAAU,EAAE,CAAC,KAAK,EACzB,QACJ,CAEA,IAAMC,EAAY7B,EAAa,KAAK0B,CAAI,EACxC,GAAIG,IAAc,KAAM,CACpB,EAAO,CAAE,GAAGL,EAAM,aAAcK,EAAU,KAAO,QAAU,QAAUA,EAAU,KAAO,WAAa,WAAa,WAAY,EAC5H,EAAOA,EAAU,EAAE,CAAC,KAAK,EACzB,QACJ,CAEA,IAAMC,EAAgB7B,EAAS,KAAKyB,CAAI,EACxC,GAAII,IAAkB,KAClB,EAAO,CAAE,GAAGN,EAAM,kBAAmBM,EAAc,EAAG,EACtD,EAAOA,EAAc,EAAE,CAAC,KAAK,OAKjC,OADAzB,EAAQ,MAAMU,EAAgB,uBAAwB,oCAAoCW,EAAK,0GAA2Gd,CAAQ,EAC3M,CAAE,GAAGY,EAAM,QAASA,EAAK,SAAWE,CAAK,CACpD,CAEA,OAAOF,CACX,CAEA,SAAS,OAAO,EAA6C,EAAc,EAA2C,CAClH,MAAO,CACH,KAAM,kBACN,cACA,OACA,MAAO,KACP,YAAa,KACb,sBAAuB,KACvB,KAAM,KACN,aAAc,KACd,kBAAmB,KACnB,QAAS,KACT,QAAS,KACT,UACJ,CACJ,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{locationOf as t}from"./SourceLine.js";import{diagnosticText as n}from"../Diagnostics/DiagnosticArgument.js";const r=/^ui\s+profile\s+([A-Za-z_]\w*)$/,i=/^layout\s+([A-Za-z_]\w*)$/,a=/^root\s+template\s+(?:blueprint\s+[A-Za-z_]\w*(?:\.\w+)*\s+)?([A-Za-z_]\w*(?:\.\w+)*)(?:\s|$)/;function parseUiProfile(o,s){let c=r.exec(s.content);if(c===null||c[1]===void 0){o.skipOpaqueBlock(s.indent);return}let l,u,d=o.peekChild(s.indent);for(;d!==void 0;)o.reader.takeSignificant(),d.content.startsWith("```")?o.skipFencedBody():(l??=i.exec(d.content)?.[1],u??=a.exec(d.content)?.[1]),d=o.peekChild(s.indent);if(l===void 0)return;let f=u===void 0?`write 'root template ${l}'`:`the root template '${u}' is used and this line is ignored - remove it`;o.warning(e.LegacyProfileLayout,`The ui profile '${c[1]}' selects its shell with the legacy 'layout ${l}' - ${f}`,t(s),{...n(`profile`,c[1]),...n(`template`,l)})}export{parseUiProfile};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{diagnosticText as t}from"../Diagnostics/DiagnosticArgument.js";import{locationOf as n}from"./SourceLine.js";const r=/^ui\s+profile\s+([A-Za-z_]\w*)$/,i=/^layout\s+([A-Za-z_]\w*)$/,a=/^root\s+template\s+(?:blueprint\s+[A-Za-z_]\w*(?:\.\w+)*\s+)?([A-Za-z_]\w*(?:\.\w+)*)(?:\s|$)/;function parseUiProfile(o,s){let c=r.exec(s.content);if(c===null||c[1]===void 0){o.skipOpaqueBlock(s.indent);return}let l,u,d=o.peekChild(s.indent);for(;d!==void 0;)o.reader.takeSignificant(),d.content.startsWith("```")?o.skipFencedBody():(l??=i.exec(d.content)?.[1],u??=a.exec(d.content)?.[1]),d=o.peekChild(s.indent);if(l===void 0)return;let f=u===void 0?`write 'root template ${l}'`:`the root template '${u}' is used and this line is ignored - remove it`;o.warning(e.LegacyProfileLayout,`The ui profile '${c[1]}' selects its shell with the legacy 'layout ${l}' - ${f}`,n(s),{...t(`profile`,c[1]),...t(`template`,l)})}export{parseUiProfile};
2
2
  //# sourceMappingURL=UiProfileLegacyLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiProfileLegacyLayout.js","names":["profileHeader","layoutReference","rootTemplate","match","header","context","layout","root","child","consequence","DiagnosticCodes","locationOf","diagnosticText"],"sources":["../../../../../../Compiler/Parsing/UiProfileLegacyLayout.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { ParserContext } from './ParserContext';\nimport { SourceLine, locationOf } from './SourceLine';\n\nconst profileHeader = /^ui\\s+profile\\s+([A-Za-z_]\\w*)$/;\nconst layoutReference = /^layout\\s+([A-Za-z_]\\w*)$/;\nconst rootTemplate = /^root\\s+template\\s+(?:blueprint\\s+[A-Za-z_]\\w*(?:\\.\\w+)*\\s+)?([A-Za-z_]\\w*(?:\\.\\w+)*)(?:\\s|$)/;\n\n// A ui profile is otherwise skipped by this compiler (the C# compiler models it). The one rule that is shared with the editors is\n// the legacy `layout` line: PLAY0791 is reported on the profile, as the C# compiler does, so the quick fix can rewrite the line.\nexport function parseUiProfile(context: ParserContext, header: SourceLine): void {\n const match = profileHeader.exec(header.content);\n if (match === null || match[1] === undefined) {\n context.skipOpaqueBlock(header.indent);\n return;\n }\n\n let layout: string | undefined;\n let root: string | undefined;\n let child = context.peekChild(header.indent);\n while (child !== undefined) {\n context.reader.takeSignificant();\n if (child.content.startsWith('```')) {\n context.skipFencedBody();\n } else {\n layout ??= layoutReference.exec(child.content)?.[1];\n root ??= rootTemplate.exec(child.content)?.[1];\n }\n child = context.peekChild(header.indent);\n }\n\n if (layout === undefined) return;\n const consequence = root === undefined\n ? `write 'root template ${layout}'`\n : `the root template '${root}' is used and this line is ignored - remove it`;\n context.warning(\n DiagnosticCodes.LegacyProfileLayout,\n `The ui profile '${match[1]}' selects its shell with the legacy 'layout ${layout}' - ${consequence}`,\n locationOf(header),\n { ...diagnosticText('profile', match[1]), ...diagnosticText('template', layout) });\n}\n"],"mappings":"4OAQA,MAAMA,EAAgB,kCAChBC,EAAkB,4BAClBC,EAAe,gGAIrB,SAAgB,eAAe,EAAwB,EAA0B,CAC7E,IAAMC,EAAQH,EAAc,KAAKI,EAAO,OAAO,EAC/C,GAAID,IAAU,MAAQA,EAAM,KAAO,IAAA,GAAW,CAC1CE,EAAQ,gBAAgBD,EAAO,MAAM,EACrC,MACJ,CAEA,IAAIE,EACAC,EACAC,EAAQH,EAAQ,UAAUD,EAAO,MAAM,EAC3C,KAAOI,IAAU,IAAA,IACbH,EAAQ,OAAO,gBAAgB,EAC3BG,EAAM,QAAQ,WAAW,KAAK,EAC9BH,EAAQ,eAAe,GAEvB,IAAWJ,EAAgB,KAAKO,EAAM,OAAO,CAAC,GAAG,GACjD,IAASN,EAAa,KAAKM,EAAM,OAAO,CAAC,GAAG,IAEhD,EAAQH,EAAQ,UAAUD,EAAO,MAAM,EAG3C,GAAIE,IAAW,IAAA,GAAW,OAC1B,IAAMG,EAAcF,IAAS,IAAA,GACvB,wBAAwBD,EAAO,GAC/B,sBAAsBC,EAAK,gDACjCF,EAAQ,QACJK,EAAgB,oBAChB,mBAAmBP,EAAM,GAAG,8CAA8CG,EAAO,MAAMG,IACvFE,EAAWP,CAAM,EACjB,CAAE,GAAGQ,EAAe,UAAWT,EAAM,EAAE,EAAG,GAAGS,EAAe,WAAYN,CAAM,CAAE,CAAC,CACzF"}
1
+ {"version":3,"file":"UiProfileLegacyLayout.js","names":["profileHeader","layoutReference","rootTemplate","match","header","context","layout","root","child","consequence","DiagnosticCodes","locationOf","diagnosticText"],"sources":["../../../../../../Compiler/Parsing/UiProfileLegacyLayout.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { ParserContext } from './ParserContext';\nimport { SourceLine, locationOf } from './SourceLine';\n\nconst profileHeader = /^ui\\s+profile\\s+([A-Za-z_]\\w*)$/;\nconst layoutReference = /^layout\\s+([A-Za-z_]\\w*)$/;\nconst rootTemplate = /^root\\s+template\\s+(?:blueprint\\s+[A-Za-z_]\\w*(?:\\.\\w+)*\\s+)?([A-Za-z_]\\w*(?:\\.\\w+)*)(?:\\s|$)/;\n\n// A ui profile is otherwise skipped by this compiler (the C# compiler models it). The one rule that is shared with the editors is\n// the legacy `layout` line: PLAY0791 is reported on the profile, as the C# compiler does, so the quick fix can rewrite the line.\nexport function parseUiProfile(context: ParserContext, header: SourceLine): void {\n const match = profileHeader.exec(header.content);\n if (match === null || match[1] === undefined) {\n context.skipOpaqueBlock(header.indent);\n return;\n }\n\n let layout: string | undefined;\n let root: string | undefined;\n let child = context.peekChild(header.indent);\n while (child !== undefined) {\n context.reader.takeSignificant();\n if (child.content.startsWith('```')) {\n context.skipFencedBody();\n } else {\n layout ??= layoutReference.exec(child.content)?.[1];\n root ??= rootTemplate.exec(child.content)?.[1];\n }\n child = context.peekChild(header.indent);\n }\n\n if (layout === undefined) return;\n const consequence = root === undefined\n ? `write 'root template ${layout}'`\n : `the root template '${root}' is used and this line is ignored - remove it`;\n context.warning(\n DiagnosticCodes.LegacyProfileLayout,\n `The ui profile '${match[1]}' selects its shell with the legacy 'layout ${layout}' - ${consequence}`,\n locationOf(header),\n { ...diagnosticText('profile', match[1]), ...diagnosticText('template', layout) });\n}\n"],"mappings":"A,4OAQA,MAAMA,EAAgB,kCAChBC,EAAkB,4BAClBC,EAAe,gGAIrB,SAAgB,eAAe,EAAwB,EAA0B,CAC7E,IAAMC,EAAQH,EAAc,KAAKI,EAAO,OAAO,EAC/C,GAAID,IAAU,MAAQA,EAAM,KAAO,IAAA,GAAW,CAC1CE,EAAQ,gBAAgBD,EAAO,MAAM,EACrC,MACJ,CAEA,IAAIE,EACAC,EACAC,EAAQH,EAAQ,UAAUD,EAAO,MAAM,EAC3C,KAAOI,IAAU,IAAA,IACbH,EAAQ,OAAO,gBAAgB,EAC3BG,EAAM,QAAQ,WAAW,KAAK,EAC9BH,EAAQ,eAAe,GAEvB,IAAWJ,EAAgB,KAAKO,EAAM,OAAO,CAAC,GAAG,GACjD,IAASN,EAAa,KAAKM,EAAM,OAAO,CAAC,GAAG,IAEhD,EAAQH,EAAQ,UAAUD,EAAO,MAAM,EAG3C,GAAIE,IAAW,IAAA,GAAW,OAC1B,IAAMG,EAAcF,IAAS,IAAA,GACvB,wBAAwBD,EAAO,GAC/B,sBAAsBC,EAAK,gDACjCF,EAAQ,QACJK,EAAgB,oBAChB,mBAAmBP,EAAM,GAAG,8CAA8CG,EAAO,MAAMG,IACvFE,EAAWP,CAAM,EACjB,CAAE,GAAGQ,EAAe,UAAWT,EAAM,EAAE,EAAG,GAAGS,EAAe,WAAYN,CAAM,CAAE,CAAC,CACzF,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{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{parseDescription as i}from"./DescriptionParser.js";import{parseCondition as a}from"./ConditionParser.js";import{rejectOperationChildren as o}from"./OperationParser.js";import{parseLifecycleSpecification as s}from"./SpecificationParser.js";import{parseTriggerSource as c}from"./ReactionParser.js";const l=`(seconds?|minutes?|hours?|days?)`,u=t(`^workflow\\s+([A-Za-z_]\\w*)$`),d=t(`^for\\s+([A-Za-z_]\\w*)$`),f=t(`^->\\s*([A-Za-z_]\\w*)$`),p=t(`^(?:"([^"]+)"|([A-Za-z_]\\w*))(?:\\s*->\\s*([A-Za-z_]\\w*))?$`),m=t(`^trigger(?:\\s+(?!(?:on|when|every|at|manual)\\b)([A-Za-z_]\\w*))?\\s+(.+)$`),h=t(`^on\\s+([A-Za-z_][\\w.]*)$`),g=t(`^when\\s+([A-Za-z_]\\w*)\\s+enters\\s+([A-Za-z_]\\w*)$`),_=t(`^action\\s+([A-Za-z_]\\w*)\\s+sends\\s+([A-Za-z_]\\w*)((?:\\s+(?:attempts\\s+\\d+|timeout\\s+\\d+\\s+\\w+|retry\\s+after\\s+\\d+\\s+\\w+))*)$`),v=/attempts\s+(\d+)|timeout\s+(\d+)\s+(\w+)|retry\s+after\s+(\d+)\s+(\w+)/g,y=t(`^decide\\s+([A-Za-z_]\\w*)\\s+when\\s+(.+)$`),b=t(`^wait\\s+([A-Za-z_]\\w*)\\s+for\\s+(?:(\\d+)\\s+${l}|([A-Za-z_][\\w.]*)(?:\\s+expires\\s+after\\s+(\\d+)\\s+${l})?)$`),x=t(`^approval\\s+([A-Za-z_]\\w*)\\s+by\\s+([A-Za-z_]\\w*)(?:\\s+expires\\s+after\\s+(\\d+)\\s+${l})?$`),S=t(`^foreach\\s+([A-Za-z_]\\w*)\\s+over\\s+([A-Za-z_][\\w.]*)(?:\\s+parallel\\s+(\\d+))?$`),C=t(`^join\\s+([A-Za-z_]\\w*)\\s+(all|any|at\\s+least\\s+(\\d+))$`),empty=(e,t,n,r)=>({kind:`WorkflowNodeSyntax`,nodeKind:e,name:t,edges:[],location:n,triggerKind:null,event:null,stateMachine:null,state:null,schedule:null,command:null,attempts:null,timeout:null,retryAfter:null,condition:null,duration:null,expiresAfter:null,by:null,items:null,parallel:null,joinMode:null,joinCount:null,...r});function parseWorkflow(t,a){let c=u.exec(a.content);if(c===null)return t.error(e.InvalidWorkflowDeclaration,`Invalid workflow declaration '${a.content}' - expected 'workflow <Name>'.`,n(a)),t.skipBlock(a.indent),{kind:`WorkflowSyntax`,name:r(a.content),subject:``,description:null,nodes:[],specifications:[],location:n(a)};let l=c[1],f=null,p=null,m=[],h=[],g={},_=0;for(let c=t.peekChild(a.indent);c!==void 0;c=t.peekChild(a.indent)){t.reader.takeSignificant();let a=r(c.content);if(a===`description`)f=i(t,c,f,`Workflow '${l}'`),g.description??=n(c);else if(a===`specification`)h.push(s(t,c,e.InvalidWorkflowDeclaration));else if(a===`for`){let r=d.exec(c.content);r===null?t.error(e.InvalidWorkflowDeclaration,`Invalid subject '${c.content}' - expected 'for <ReadModel>'.`,n(c)):p===null?(p=r[1],g.for=n(c)):t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' declares its subject more than once.`,n(c)),o(t,c,e.InvalidWorkflowDeclaration,`A for line cannot have children.`)}else{let e=parseNode(t,c,l,a===`trigger`?++_:_);e!==void 0&&m.push(e)}}p===null&&t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' must name its subject: 'for <ReadModel>'.`,n(a));let v=/* @__PURE__ */ new Set;for(let n of m)v.has(n.name)&&t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' declares node '${n.name}' more than once.`,n.location),v.add(n.name);return{kind:`WorkflowSyntax`,name:l,subject:p??``,description:f,nodes:m,specifications:h,location:n(a),directiveLocations:g}}function parseNode(t,i,a,o){let s=r(i.content),c;switch(s){case`trigger`:c=parseTrigger(t,i,o);break;case`action`:c=parseAction(t,i);break;case`decide`:c=parseDecide(t,i);break;case`wait`:c=parseWait(t,i);break;case`approval`:c=parseApproval(t,i);break;case`foreach`:c=parseForEach(t,i);break;case`join`:c=parseJoin(t,i);break;default:t.error(e.InvalidWorkflowDeclaration,`Unexpected '${i.content}' in workflow '${a}' - expected for, description, specification or a node: trigger, action, decide, wait, approval, foreach or join.`,n(i))}if(c===void 0)t.skipBlock(i.indent);else return{...c,edges:parseEdges(t,i)}}function parseEdges(t,r){let i=[];for(let a=t.peekChild(r.indent);a!==void 0;a=t.peekChild(r.indent)){t.reader.takeSignificant();let r=f.exec(a.content),s=p.exec(a.content);if(r!==null)i.push({kind:`WorkflowEdgeSyntax`,outlet:`next`,target:r[1],location:n(a)});else if(s!==null)i.push({kind:`WorkflowEdgeSyntax`,outlet:s[1]??s[2],target:s[3]??``,location:n(a)});else{t.error(e.InvalidWorkflowDeclaration,`Invalid edge '${a.content}' - expected '<outlet> -> <Node>'.`,n(a)),t.skipBlock(a.indent);continue}o(t,a,e.InvalidWorkflowDeclaration,`An edge cannot have children.`)}return i}function parseTrigger(t,r,i){let a=m.exec(r.content);if(a===null){t.error(e.InvalidWorkflowDeclaration,`Invalid trigger '${r.content}' - expected 'trigger [<Name>] on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`,n(r));return}let o=a[1]??(i===1?`Trigger`:`Trigger${i}`),s=a[2],l=n(r);if(s===`manual`)return empty(`Trigger`,o,l,{triggerKind:`Manual`});let u=h.exec(s);if(u!==null)return empty(`Trigger`,o,l,{triggerKind:`Event`,event:u[1]});let d=g.exec(s);if(d!==null)return empty(`Trigger`,o,l,{triggerKind:`StateEntered`,stateMachine:d[1],state:d[2]});if(s.startsWith(`every `)||s.startsWith(`at `)){let e=c(t,{...r,content:s});return e===void 0?void 0:empty(`Trigger`,o,l,{triggerKind:`Schedule`,schedule:e})}t.error(e.InvalidWorkflowDeclaration,`Invalid trigger '${r.content}' - expected 'on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`,n(r))}function parseAction(t,r){let i=_.exec(r.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid action '${r.content}' - expected 'action <Name> sends <Command> [attempts <n>] [timeout <n> <unit>] [retry after <n> <unit>]'.`,n(r));return}let a=null,o=null,s=null;for(let c of i[3].matchAll(v))if(c[1]!==void 0){let i=Number(c[1]);a!==null||!Number.isInteger(i)||i<1?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated attempts in '${r.content}'.`,n(r)):a=i}else if(c[2]!==void 0){let i=duration(t,c[2],c[3],r);o!==null||i===void 0?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated timeout in '${r.content}'.`,n(r)):o=i}else{let i=duration(t,c[4],c[5],r);s!==null||i===void 0?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated retry in '${r.content}'.`,n(r)):s=i}return empty(`Action`,i[1],n(r),{command:i[2],attempts:a,timeout:o,retryAfter:s})}function parseDecide(t,r){let i=y.exec(r.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid decide '${r.content}' - expected 'decide <Name> when <condition>'.`,n(r));return}let o=a(t,i[2],n(r));return o===null?void 0:empty(`Decide`,i[1],n(r),{condition:o})}function parseWait(t,r){let i=b.exec(r.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid wait '${r.content}' - expected 'wait <Name> for <Event> [expires after <n> <unit>]' or 'wait <Name> for <n> <unit>'.`,n(r));return}if(i[2]!==void 0){let e=duration(t,i[2],i[3],r);return e===void 0?void 0:empty(`Wait`,i[1],n(r),{duration:e})}let a=null;if(i[5]!==void 0){let e=duration(t,i[5],i[6],r);if(e===void 0)return;a=e}return empty(`Wait`,i[1],n(r),{event:i[4],expiresAfter:a})}function parseApproval(t,r){let i=x.exec(r.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid approval '${r.content}' - expected 'approval <Name> by <Persona or Policy> [expires after <n> <unit>]'.`,n(r));return}let a=null;if(i[3]!==void 0){let e=duration(t,i[3],i[4],r);if(e===void 0)return;a=e}return empty(`Approval`,i[1],n(r),{by:i[2],expiresAfter:a})}function parseForEach(t,r){let i=S.exec(r.content);if(i===null||i[3]!==void 0&&Number(i[3])<1)t.error(e.InvalidWorkflowDeclaration,`Invalid foreach '${r.content}' - expected 'foreach <Name> over <property> [parallel <n>]'.`,n(r));else return empty(`ForEach`,i[1],n(r),{items:i[2],parallel:i[3]===void 0?null:Number(i[3])})}function parseJoin(t,r){let i=C.exec(r.content);if(i===null||i[3]!==void 0&&Number(i[3])<1)t.error(e.InvalidWorkflowDeclaration,`Invalid join '${r.content}' - expected 'join <Name> all', 'join <Name> any' or 'join <Name> at least <n>'.`,n(r));else return empty(`Join`,i[1],n(r),{joinMode:i[2]===`all`?`All`:i[2]===`any`?`Any`:`AtLeast`,joinCount:i[3]===void 0?null:Number(i[3])})}function duration(t,r,i,a){let o=Number(r);if(!Number.isInteger(o)||o<1){t.error(e.InvalidWorkflowDeclaration,`Invalid duration '${r} ${i}' in '${a.content}' - an amount is at least 1.`,n(a));return}let s=i.replace(/s$/,``);return{kind:`WorkflowDurationSyntax`,amount:o,unit:s===`second`?`Seconds`:s===`minute`?`Minutes`:s===`hour`?`Hours`:`Days`,location:n(a)}}export{parseWorkflow};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{parseCondition as n}from"./ConditionParser.js";import{parseDescription as r}from"./DescriptionParser.js";import{firstWord as i}from"./LineText.js";import{rejectOperationChildren as a}from"./OperationParser.js";import{parseTriggerSource as o}from"./ReactionParser.js";import{locationOf as s}from"./SourceLine.js";import{parseLifecycleSpecification as c}from"./SpecificationParser.js";const l=`(seconds?|minutes?|hours?|days?)`,u=t(`^workflow\\s+([A-Za-z_]\\w*)$`),d=t(`^for\\s+([A-Za-z_]\\w*)$`),f=t(`^->\\s*([A-Za-z_]\\w*)$`),p=t(`^(?:"([^"]+)"|([A-Za-z_]\\w*))(?:\\s*->\\s*([A-Za-z_]\\w*))?$`),m=t(`^trigger(?:\\s+(?!(?:on|when|every|at|manual)\\b)([A-Za-z_]\\w*))?\\s+(.+)$`),h=t(`^on\\s+([A-Za-z_][\\w.]*)$`),g=t(`^when\\s+([A-Za-z_]\\w*)\\s+enters\\s+([A-Za-z_]\\w*)$`),_=t(`^action\\s+([A-Za-z_]\\w*)\\s+sends\\s+([A-Za-z_]\\w*)((?:\\s+(?:attempts\\s+\\d+|timeout\\s+\\d+\\s+\\w+|retry\\s+after\\s+\\d+\\s+\\w+))*)$`),v=/attempts\s+(\d+)|timeout\s+(\d+)\s+(\w+)|retry\s+after\s+(\d+)\s+(\w+)/g,y=t(`^decide\\s+([A-Za-z_]\\w*)\\s+when\\s+(.+)$`),b=t(`^wait\\s+([A-Za-z_]\\w*)\\s+for\\s+(?:(\\d+)\\s+${l}|([A-Za-z_][\\w.]*)(?:\\s+expires\\s+after\\s+(\\d+)\\s+${l})?)$`),x=t(`^approval\\s+([A-Za-z_]\\w*)\\s+by\\s+([A-Za-z_]\\w*)(?:\\s+expires\\s+after\\s+(\\d+)\\s+${l})?$`),S=t(`^foreach\\s+([A-Za-z_]\\w*)\\s+over\\s+([A-Za-z_][\\w.]*)(?:\\s+parallel\\s+(\\d+))?$`),C=t(`^join\\s+([A-Za-z_]\\w*)\\s+(all|any|at\\s+least\\s+(\\d+))$`),empty=(e,t,n,r)=>({kind:`WorkflowNodeSyntax`,nodeKind:e,name:t,edges:[],location:n,triggerKind:null,event:null,stateMachine:null,state:null,schedule:null,command:null,attempts:null,timeout:null,retryAfter:null,condition:null,duration:null,expiresAfter:null,by:null,items:null,parallel:null,joinMode:null,joinCount:null,...r});function parseWorkflow(t,n){let o=u.exec(n.content);if(o===null)return t.error(e.InvalidWorkflowDeclaration,`Invalid workflow declaration '${n.content}' - expected 'workflow <Name>'.`,s(n)),t.skipBlock(n.indent),{kind:`WorkflowSyntax`,name:i(n.content),subject:``,description:null,nodes:[],specifications:[],location:s(n)};let l=o[1],f=null,p=null,m=[],h=[],g={},_=0;for(let o=t.peekChild(n.indent);o!==void 0;o=t.peekChild(n.indent)){t.reader.takeSignificant();let n=i(o.content);if(n===`description`)f=r(t,o,f,`Workflow '${l}'`),g.description??=s(o);else if(n===`specification`)h.push(c(t,o,e.InvalidWorkflowDeclaration));else if(n===`for`){let n=d.exec(o.content);n===null?t.error(e.InvalidWorkflowDeclaration,`Invalid subject '${o.content}' - expected 'for <ReadModel>'.`,s(o)):p===null?(p=n[1],g.for=s(o)):t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' declares its subject more than once.`,s(o)),a(t,o,e.InvalidWorkflowDeclaration,`A for line cannot have children.`)}else{let e=parseNode(t,o,l,n===`trigger`?++_:_);e!==void 0&&m.push(e)}}p===null&&t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' must name its subject: 'for <ReadModel>'.`,s(n));let v=/* @__PURE__ */ new Set;for(let n of m)v.has(n.name)&&t.error(e.InvalidWorkflowDeclaration,`Workflow '${l}' declares node '${n.name}' more than once.`,n.location),v.add(n.name);return{kind:`WorkflowSyntax`,name:l,subject:p??``,description:f,nodes:m,specifications:h,location:s(n),directiveLocations:g}}function parseNode(t,n,r,a){let o=i(n.content),c;switch(o){case`trigger`:c=parseTrigger(t,n,a);break;case`action`:c=parseAction(t,n);break;case`decide`:c=parseDecide(t,n);break;case`wait`:c=parseWait(t,n);break;case`approval`:c=parseApproval(t,n);break;case`foreach`:c=parseForEach(t,n);break;case`join`:c=parseJoin(t,n);break;default:t.error(e.InvalidWorkflowDeclaration,`Unexpected '${n.content}' in workflow '${r}' - expected for, description, specification or a node: trigger, action, decide, wait, approval, foreach or join.`,s(n))}if(c===void 0)t.skipBlock(n.indent);else return{...c,edges:parseEdges(t,n)}}function parseEdges(t,n){let r=[];for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n=f.exec(i.content),o=p.exec(i.content);if(n!==null)r.push({kind:`WorkflowEdgeSyntax`,outlet:`next`,target:n[1],location:s(i)});else if(o!==null)r.push({kind:`WorkflowEdgeSyntax`,outlet:o[1]??o[2],target:o[3]??``,location:s(i)});else{t.error(e.InvalidWorkflowDeclaration,`Invalid edge '${i.content}' - expected '<outlet> -> <Node>'.`,s(i)),t.skipBlock(i.indent);continue}a(t,i,e.InvalidWorkflowDeclaration,`An edge cannot have children.`)}return r}function parseTrigger(t,n,r){let i=m.exec(n.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid trigger '${n.content}' - expected 'trigger [<Name>] on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`,s(n));return}let a=i[1]??(r===1?`Trigger`:`Trigger${r}`),c=i[2],l=s(n);if(c===`manual`)return empty(`Trigger`,a,l,{triggerKind:`Manual`});let u=h.exec(c);if(u!==null)return empty(`Trigger`,a,l,{triggerKind:`Event`,event:u[1]});let d=g.exec(c);if(d!==null)return empty(`Trigger`,a,l,{triggerKind:`StateEntered`,stateMachine:d[1],state:d[2]});if(c.startsWith(`every `)||c.startsWith(`at `)){let e=o(t,{...n,content:c});return e===void 0?void 0:empty(`Trigger`,a,l,{triggerKind:`Schedule`,schedule:e})}t.error(e.InvalidWorkflowDeclaration,`Invalid trigger '${n.content}' - expected 'on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`,s(n))}function parseAction(t,n){let r=_.exec(n.content);if(r===null){t.error(e.InvalidWorkflowDeclaration,`Invalid action '${n.content}' - expected 'action <Name> sends <Command> [attempts <n>] [timeout <n> <unit>] [retry after <n> <unit>]'.`,s(n));return}let i=null,a=null,o=null;for(let c of r[3].matchAll(v))if(c[1]!==void 0){let r=Number(c[1]);i!==null||!Number.isInteger(r)||r<1?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated attempts in '${n.content}'.`,s(n)):i=r}else if(c[2]!==void 0){let r=duration(t,c[2],c[3],n);a!==null||r===void 0?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated timeout in '${n.content}'.`,s(n)):a=r}else{let r=duration(t,c[4],c[5],n);o!==null||r===void 0?t.error(e.InvalidWorkflowDeclaration,`Invalid or repeated retry in '${n.content}'.`,s(n)):o=r}return empty(`Action`,r[1],s(n),{command:r[2],attempts:i,timeout:a,retryAfter:o})}function parseDecide(t,r){let i=y.exec(r.content);if(i===null){t.error(e.InvalidWorkflowDeclaration,`Invalid decide '${r.content}' - expected 'decide <Name> when <condition>'.`,s(r));return}let a=n(t,i[2],s(r));return a===null?void 0:empty(`Decide`,i[1],s(r),{condition:a})}function parseWait(t,n){let r=b.exec(n.content);if(r===null){t.error(e.InvalidWorkflowDeclaration,`Invalid wait '${n.content}' - expected 'wait <Name> for <Event> [expires after <n> <unit>]' or 'wait <Name> for <n> <unit>'.`,s(n));return}if(r[2]!==void 0){let e=duration(t,r[2],r[3],n);return e===void 0?void 0:empty(`Wait`,r[1],s(n),{duration:e})}let i=null;if(r[5]!==void 0){let e=duration(t,r[5],r[6],n);if(e===void 0)return;i=e}return empty(`Wait`,r[1],s(n),{event:r[4],expiresAfter:i})}function parseApproval(t,n){let r=x.exec(n.content);if(r===null){t.error(e.InvalidWorkflowDeclaration,`Invalid approval '${n.content}' - expected 'approval <Name> by <Persona or Policy> [expires after <n> <unit>]'.`,s(n));return}let i=null;if(r[3]!==void 0){let e=duration(t,r[3],r[4],n);if(e===void 0)return;i=e}return empty(`Approval`,r[1],s(n),{by:r[2],expiresAfter:i})}function parseForEach(t,n){let r=S.exec(n.content);if(r===null||r[3]!==void 0&&Number(r[3])<1)t.error(e.InvalidWorkflowDeclaration,`Invalid foreach '${n.content}' - expected 'foreach <Name> over <property> [parallel <n>]'.`,s(n));else return empty(`ForEach`,r[1],s(n),{items:r[2],parallel:r[3]===void 0?null:Number(r[3])})}function parseJoin(t,n){let r=C.exec(n.content);if(r===null||r[3]!==void 0&&Number(r[3])<1)t.error(e.InvalidWorkflowDeclaration,`Invalid join '${n.content}' - expected 'join <Name> all', 'join <Name> any' or 'join <Name> at least <n>'.`,s(n));else return empty(`Join`,r[1],s(n),{joinMode:r[2]===`all`?`All`:r[2]===`any`?`Any`:`AtLeast`,joinCount:r[3]===void 0?null:Number(r[3])})}function duration(t,n,r,i){let a=Number(n);if(!Number.isInteger(a)||a<1){t.error(e.InvalidWorkflowDeclaration,`Invalid duration '${n} ${r}' in '${i.content}' - an amount is at least 1.`,s(i));return}let o=r.replace(/s$/,``);return{kind:`WorkflowDurationSyntax`,amount:a,unit:o===`second`?`Seconds`:o===`minute`?`Minutes`:o===`hour`?`Hours`:`Days`,location:s(i)}}export{parseWorkflow};
2
2
  //# sourceMappingURL=WorkflowParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowParser.js","names":["unit","headerPattern","pattern","forPattern","shorthandEdge","edgePattern","triggerPattern","onEventPattern","entersPattern","actionPattern","actionOption","decidePattern","waitPattern","approvalPattern","forEachPattern","joinPattern","parts","match","header","context","DiagnosticCodes","locationOf","firstWord","name","description","subject","nodes","specifications","directiveLocations","triggers","line","keyword","parseDescription","parseLifecycleSpecification","found","rejectOperationChildren","node","seen","ordinal","workflow","edges","shorthand","edge","rest","location","onEvent","enters","schedule","parseTriggerSource","attempts","timeout","retryAfter","option","count","parsed","condition","parseCondition","expiresAfter","amount","text","base"],"sources":["../../../../../../Compiler/Parsing/WorkflowParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { IntervalUnit } from '../Syntax/Reactions';\nimport { LifecycleSpecificationSyntax, WorkflowDurationSyntax, WorkflowEdgeSyntax, WorkflowNodeKind, WorkflowNodeSyntax, WorkflowSyntax } from '../Syntax/Lifecycles';\nimport { pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { rejectOperationChildren } from './OperationParser';\nimport { ParserContext } from './ParserContext';\nimport { parseTriggerSource } from './ReactionParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseLifecycleSpecification } from './SpecificationParser';\n\nconst unit = '(seconds?|minutes?|hours?|days?)';\nconst headerPattern = pattern('^workflow\\\\s+([A-Za-z_]\\\\w*)$');\nconst forPattern = pattern('^for\\\\s+([A-Za-z_]\\\\w*)$');\nconst shorthandEdge = pattern('^->\\\\s*([A-Za-z_]\\\\w*)$');\nconst edgePattern = pattern('^(?:\"([^\"]+)\"|([A-Za-z_]\\\\w*))(?:\\\\s*->\\\\s*([A-Za-z_]\\\\w*))?$');\nconst triggerPattern = pattern('^trigger(?:\\\\s+(?!(?:on|when|every|at|manual)\\\\b)([A-Za-z_]\\\\w*))?\\\\s+(.+)$');\nconst onEventPattern = pattern('^on\\\\s+([A-Za-z_][\\\\w.]*)$');\nconst entersPattern = pattern('^when\\\\s+([A-Za-z_]\\\\w*)\\\\s+enters\\\\s+([A-Za-z_]\\\\w*)$');\nconst actionPattern = pattern('^action\\\\s+([A-Za-z_]\\\\w*)\\\\s+sends\\\\s+([A-Za-z_]\\\\w*)((?:\\\\s+(?:attempts\\\\s+\\\\d+|timeout\\\\s+\\\\d+\\\\s+\\\\w+|retry\\\\s+after\\\\s+\\\\d+\\\\s+\\\\w+))*)$');\nconst actionOption = /attempts\\s+(\\d+)|timeout\\s+(\\d+)\\s+(\\w+)|retry\\s+after\\s+(\\d+)\\s+(\\w+)/g;\nconst decidePattern = pattern('^decide\\\\s+([A-Za-z_]\\\\w*)\\\\s+when\\\\s+(.+)$');\nconst waitPattern = pattern(`^wait\\\\s+([A-Za-z_]\\\\w*)\\\\s+for\\\\s+(?:(\\\\d+)\\\\s+${unit}|([A-Za-z_][\\\\w.]*)(?:\\\\s+expires\\\\s+after\\\\s+(\\\\d+)\\\\s+${unit})?)$`);\nconst approvalPattern = pattern(`^approval\\\\s+([A-Za-z_]\\\\w*)\\\\s+by\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+expires\\\\s+after\\\\s+(\\\\d+)\\\\s+${unit})?$`);\nconst forEachPattern = pattern('^foreach\\\\s+([A-Za-z_]\\\\w*)\\\\s+over\\\\s+([A-Za-z_][\\\\w.]*)(?:\\\\s+parallel\\\\s+(\\\\d+))?$');\nconst joinPattern = pattern('^join\\\\s+([A-Za-z_]\\\\w*)\\\\s+(all|any|at\\\\s+least\\\\s+(\\\\d+))$');\n\ntype NodeParts = Partial<Omit<WorkflowNodeSyntax, 'kind' | 'nodeKind' | 'name' | 'edges' | 'location'>>;\n\nconst empty = (nodeKind: WorkflowNodeKind, name: string, location: SourceLocation, parts: NodeParts): WorkflowNodeSyntax => ({\n kind: 'WorkflowNodeSyntax', nodeKind, name, edges: [], location,\n triggerKind: null, event: null, stateMachine: null, state: null, schedule: null, command: null, attempts: null, timeout: null, retryAfter: null,\n condition: null, duration: null, expiresAfter: null, by: null, items: null, parallel: null, joinMode: null, joinCount: null,\n ...parts,\n});\n\n// The port of C# WorkflowParser.\nexport function parseWorkflow(context: ParserContext, header: SourceLine): WorkflowSyntax {\n const match = headerPattern.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid workflow declaration '${header.content}' - expected 'workflow <Name>'.`, locationOf(header));\n context.skipBlock(header.indent);\n return { kind: 'WorkflowSyntax', name: firstWord(header.content), subject: '', description: null, nodes: [], specifications: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n let subject: string | null = null;\n const nodes: WorkflowNodeSyntax[] = [];\n const specifications: LifecycleSpecificationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n let triggers = 0;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Workflow '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'specification') {\n specifications.push(parseLifecycleSpecification(context, line, DiagnosticCodes.InvalidWorkflowDeclaration));\n } else if (keyword === 'for') {\n const found = forPattern.exec(line.content);\n if (found === null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid subject '${line.content}' - expected 'for <ReadModel>'.`, locationOf(line));\n else if (subject !== null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' declares its subject more than once.`, locationOf(line));\n else {\n subject = found[1];\n directiveLocations.for = locationOf(line);\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidWorkflowDeclaration, 'A for line cannot have children.');\n } else {\n const node = parseNode(context, line, name, keyword === 'trigger' ? ++triggers : triggers);\n if (node !== undefined) nodes.push(node);\n }\n }\n if (subject === null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' must name its subject: 'for <ReadModel>'.`, locationOf(header));\n const seen = new Set<string>();\n for (const node of nodes) {\n if (seen.has(node.name)) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' declares node '${node.name}' more than once.`, node.location);\n seen.add(node.name);\n }\n return { kind: 'WorkflowSyntax', name, subject: subject ?? '', description, nodes, specifications, location: locationOf(header), directiveLocations };\n}\n\nfunction parseNode(context: ParserContext, line: SourceLine, workflow: string, ordinal: number): WorkflowNodeSyntax | undefined {\n const keyword = firstWord(line.content);\n let node: WorkflowNodeSyntax | undefined;\n switch (keyword) {\n case 'trigger': node = parseTrigger(context, line, ordinal); break;\n case 'action': node = parseAction(context, line); break;\n case 'decide': node = parseDecide(context, line); break;\n case 'wait': node = parseWait(context, line); break;\n case 'approval': node = parseApproval(context, line); break;\n case 'foreach': node = parseForEach(context, line); break;\n case 'join': node = parseJoin(context, line); break;\n default:\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Unexpected '${line.content}' in workflow '${workflow}' - expected for, description, specification or a node: trigger, action, decide, wait, approval, foreach or join.`, locationOf(line));\n }\n if (node === undefined) {\n context.skipBlock(line.indent);\n return undefined;\n }\n return { ...node, edges: parseEdges(context, line) };\n}\n\nfunction parseEdges(context: ParserContext, header: SourceLine): WorkflowEdgeSyntax[] {\n const edges: WorkflowEdgeSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const shorthand = shorthandEdge.exec(line.content);\n const edge = edgePattern.exec(line.content);\n if (shorthand !== null) edges.push({ kind: 'WorkflowEdgeSyntax', outlet: 'next', target: shorthand[1], location: locationOf(line) });\n else if (edge !== null) edges.push({ kind: 'WorkflowEdgeSyntax', outlet: edge[1] ?? edge[2], target: edge[3] ?? '', location: locationOf(line) });\n else {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid edge '${line.content}' - expected '<outlet> -> <Node>'.`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidWorkflowDeclaration, 'An edge cannot have children.');\n }\n return edges;\n}\n\nfunction parseTrigger(context: ParserContext, line: SourceLine, ordinal: number): WorkflowNodeSyntax | undefined {\n const match = triggerPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid trigger '${line.content}' - expected 'trigger [<Name>] on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`, locationOf(line));\n return undefined;\n }\n const name = match[1] ?? (ordinal === 1 ? 'Trigger' : `Trigger${ordinal}`);\n const rest = match[2];\n const location = locationOf(line);\n if (rest === 'manual') return empty('Trigger', name, location, { triggerKind: 'Manual' });\n const onEvent = onEventPattern.exec(rest);\n if (onEvent !== null) return empty('Trigger', name, location, { triggerKind: 'Event', event: onEvent[1] });\n const enters = entersPattern.exec(rest);\n if (enters !== null) return empty('Trigger', name, location, { triggerKind: 'StateEntered', stateMachine: enters[1], state: enters[2] });\n const scheduled = rest.startsWith('every ') || rest.startsWith('at ');\n if (scheduled) {\n const schedule = parseTriggerSource(context, { ...line, content: rest });\n return schedule === undefined ? undefined : empty('Trigger', name, location, { triggerKind: 'Schedule', schedule });\n }\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid trigger '${line.content}' - expected 'on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`, locationOf(line));\n return undefined;\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = actionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid action '${line.content}' - expected 'action <Name> sends <Command> [attempts <n>] [timeout <n> <unit>] [retry after <n> <unit>]'.`, locationOf(line));\n return undefined;\n }\n let attempts: number | null = null;\n let timeout: WorkflowDurationSyntax | null = null;\n let retryAfter: WorkflowDurationSyntax | null = null;\n for (const option of match[3].matchAll(actionOption)) {\n if (option[1] !== undefined) {\n const count = Number(option[1]);\n if (attempts !== null || !Number.isInteger(count) || count < 1) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated attempts in '${line.content}'.`, locationOf(line));\n else attempts = count;\n } else if (option[2] !== undefined) {\n const parsed = duration(context, option[2], option[3], line);\n if (timeout !== null || parsed === undefined) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated timeout in '${line.content}'.`, locationOf(line));\n else timeout = parsed;\n } else {\n const parsed = duration(context, option[4], option[5], line);\n if (retryAfter !== null || parsed === undefined) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated retry in '${line.content}'.`, locationOf(line));\n else retryAfter = parsed;\n }\n }\n return empty('Action', match[1], locationOf(line), { command: match[2], attempts, timeout, retryAfter });\n}\n\nfunction parseDecide(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = decidePattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid decide '${line.content}' - expected 'decide <Name> when <condition>'.`, locationOf(line));\n return undefined;\n }\n const condition = parseCondition(context, match[2], locationOf(line));\n return condition === null ? undefined : empty('Decide', match[1], locationOf(line), { condition });\n}\n\nfunction parseWait(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = waitPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid wait '${line.content}' - expected 'wait <Name> for <Event> [expires after <n> <unit>]' or 'wait <Name> for <n> <unit>'.`, locationOf(line));\n return undefined;\n }\n if (match[2] !== undefined) {\n const parsed = duration(context, match[2], match[3], line);\n return parsed === undefined ? undefined : empty('Wait', match[1], locationOf(line), { duration: parsed });\n }\n let expiresAfter: WorkflowDurationSyntax | null = null;\n if (match[5] !== undefined) {\n const parsed = duration(context, match[5], match[6], line);\n if (parsed === undefined) return undefined;\n expiresAfter = parsed;\n }\n return empty('Wait', match[1], locationOf(line), { event: match[4], expiresAfter });\n}\n\nfunction parseApproval(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = approvalPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid approval '${line.content}' - expected 'approval <Name> by <Persona or Policy> [expires after <n> <unit>]'.`, locationOf(line));\n return undefined;\n }\n let expiresAfter: WorkflowDurationSyntax | null = null;\n if (match[3] !== undefined) {\n const parsed = duration(context, match[3], match[4], line);\n if (parsed === undefined) return undefined;\n expiresAfter = parsed;\n }\n return empty('Approval', match[1], locationOf(line), { by: match[2], expiresAfter });\n}\n\nfunction parseForEach(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = forEachPattern.exec(line.content);\n if (match === null || (match[3] !== undefined && Number(match[3]) < 1)) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid foreach '${line.content}' - expected 'foreach <Name> over <property> [parallel <n>]'.`, locationOf(line));\n return undefined;\n }\n return empty('ForEach', match[1], locationOf(line), { items: match[2], parallel: match[3] === undefined ? null : Number(match[3]) });\n}\n\nfunction parseJoin(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = joinPattern.exec(line.content);\n if (match === null || (match[3] !== undefined && Number(match[3]) < 1)) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid join '${line.content}' - expected 'join <Name> all', 'join <Name> any' or 'join <Name> at least <n>'.`, locationOf(line));\n return undefined;\n }\n return empty('Join', match[1], locationOf(line), { joinMode: match[2] === 'all' ? 'All' : match[2] === 'any' ? 'Any' : 'AtLeast', joinCount: match[3] === undefined ? null : Number(match[3]) });\n}\n\nfunction duration(context: ParserContext, amount: string, text: string, line: SourceLine): WorkflowDurationSyntax | undefined {\n const count = Number(amount);\n if (!Number.isInteger(count) || count < 1) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid duration '${amount} ${text}' in '${line.content}' - an amount is at least 1.`, locationOf(line));\n return undefined;\n }\n const base = text.replace(/s$/, '');\n const parsed: IntervalUnit = base === 'second' ? 'Seconds' : base === 'minute' ? 'Minutes' : base === 'hour' ? 'Hours' : 'Days';\n return { kind: 'WorkflowDurationSyntax', amount: count, unit: parsed, location: locationOf(line) };\n}\n"],"mappings":"6iBAiBA,MAAMA,EAAO,mCAC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WS,CAAI,EAAG,CAAE,SAAUb,EAAM,KAAO,MAAQ,MAAQA,EAAM,KAAO,MAAQ,MAAQ,UAAW,UAAWA,EAAM,KAAO,IAAA,GAAY,KAAO,OAAOA,EAAM,EAAE,CAAE,CAAC,CACnM,CAEA,SAAS,SAAS,EAAwB,EAAgB,EAAc,EAAsD,CAC1H,IAAMoC,EAAQ,OAAOK,CAAM,EAC3B,GAAI,CAAC,OAAO,UAAUL,CAAK,GAAKA,EAAQ,EAAG,CACvClC,EAAQ,MAAMC,EAAgB,2BAA4B,qBAAqBsC,EAAO,GAAGC,EAAK,QAAQ7B,EAAK,QAAQ,8BAA+BT,EAAWS,CAAI,CAAC,EAClK,MACJ,CACA,IAAM8B,EAAOD,EAAK,QAAQ,KAAM,EAAE,EAElC,MAAO,CAAE,KAAM,yBAA0B,OAAQN,EAAO,KAD3BO,IAAS,SAAW,UAAYA,IAAS,SAAW,UAAYA,IAAS,OAAS,QAAU,OACnD,SAAUvC,EAAWS,CAAI,CAAE,CACrG"}
1
+ {"version":3,"file":"WorkflowParser.js","names":["unit","headerPattern","pattern","forPattern","shorthandEdge","edgePattern","triggerPattern","onEventPattern","entersPattern","actionPattern","actionOption","decidePattern","waitPattern","approvalPattern","forEachPattern","joinPattern","parts","match","header","context","DiagnosticCodes","locationOf","firstWord","name","description","subject","nodes","specifications","directiveLocations","triggers","line","keyword","parseDescription","parseLifecycleSpecification","found","rejectOperationChildren","node","seen","ordinal","workflow","edges","shorthand","edge","rest","location","onEvent","enters","schedule","parseTriggerSource","attempts","timeout","retryAfter","option","count","parsed","condition","parseCondition","expiresAfter","amount","text","base"],"sources":["../../../../../../Compiler/Parsing/WorkflowParser.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { IntervalUnit } from '../Syntax/Reactions';\nimport { LifecycleSpecificationSyntax, WorkflowDurationSyntax, WorkflowEdgeSyntax, WorkflowNodeKind, WorkflowNodeSyntax, WorkflowSyntax } from '../Syntax/Lifecycles';\nimport { pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { rejectOperationChildren } from './OperationParser';\nimport { ParserContext } from './ParserContext';\nimport { parseTriggerSource } from './ReactionParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseLifecycleSpecification } from './SpecificationParser';\n\nconst unit = '(seconds?|minutes?|hours?|days?)';\nconst headerPattern = pattern('^workflow\\\\s+([A-Za-z_]\\\\w*)$');\nconst forPattern = pattern('^for\\\\s+([A-Za-z_]\\\\w*)$');\nconst shorthandEdge = pattern('^->\\\\s*([A-Za-z_]\\\\w*)$');\nconst edgePattern = pattern('^(?:\"([^\"]+)\"|([A-Za-z_]\\\\w*))(?:\\\\s*->\\\\s*([A-Za-z_]\\\\w*))?$');\nconst triggerPattern = pattern('^trigger(?:\\\\s+(?!(?:on|when|every|at|manual)\\\\b)([A-Za-z_]\\\\w*))?\\\\s+(.+)$');\nconst onEventPattern = pattern('^on\\\\s+([A-Za-z_][\\\\w.]*)$');\nconst entersPattern = pattern('^when\\\\s+([A-Za-z_]\\\\w*)\\\\s+enters\\\\s+([A-Za-z_]\\\\w*)$');\nconst actionPattern = pattern('^action\\\\s+([A-Za-z_]\\\\w*)\\\\s+sends\\\\s+([A-Za-z_]\\\\w*)((?:\\\\s+(?:attempts\\\\s+\\\\d+|timeout\\\\s+\\\\d+\\\\s+\\\\w+|retry\\\\s+after\\\\s+\\\\d+\\\\s+\\\\w+))*)$');\nconst actionOption = /attempts\\s+(\\d+)|timeout\\s+(\\d+)\\s+(\\w+)|retry\\s+after\\s+(\\d+)\\s+(\\w+)/g;\nconst decidePattern = pattern('^decide\\\\s+([A-Za-z_]\\\\w*)\\\\s+when\\\\s+(.+)$');\nconst waitPattern = pattern(`^wait\\\\s+([A-Za-z_]\\\\w*)\\\\s+for\\\\s+(?:(\\\\d+)\\\\s+${unit}|([A-Za-z_][\\\\w.]*)(?:\\\\s+expires\\\\s+after\\\\s+(\\\\d+)\\\\s+${unit})?)$`);\nconst approvalPattern = pattern(`^approval\\\\s+([A-Za-z_]\\\\w*)\\\\s+by\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+expires\\\\s+after\\\\s+(\\\\d+)\\\\s+${unit})?$`);\nconst forEachPattern = pattern('^foreach\\\\s+([A-Za-z_]\\\\w*)\\\\s+over\\\\s+([A-Za-z_][\\\\w.]*)(?:\\\\s+parallel\\\\s+(\\\\d+))?$');\nconst joinPattern = pattern('^join\\\\s+([A-Za-z_]\\\\w*)\\\\s+(all|any|at\\\\s+least\\\\s+(\\\\d+))$');\n\ntype NodeParts = Partial<Omit<WorkflowNodeSyntax, 'kind' | 'nodeKind' | 'name' | 'edges' | 'location'>>;\n\nconst empty = (nodeKind: WorkflowNodeKind, name: string, location: SourceLocation, parts: NodeParts): WorkflowNodeSyntax => ({\n kind: 'WorkflowNodeSyntax', nodeKind, name, edges: [], location,\n triggerKind: null, event: null, stateMachine: null, state: null, schedule: null, command: null, attempts: null, timeout: null, retryAfter: null,\n condition: null, duration: null, expiresAfter: null, by: null, items: null, parallel: null, joinMode: null, joinCount: null,\n ...parts,\n});\n\n// The port of C# WorkflowParser.\nexport function parseWorkflow(context: ParserContext, header: SourceLine): WorkflowSyntax {\n const match = headerPattern.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid workflow declaration '${header.content}' - expected 'workflow <Name>'.`, locationOf(header));\n context.skipBlock(header.indent);\n return { kind: 'WorkflowSyntax', name: firstWord(header.content), subject: '', description: null, nodes: [], specifications: [], location: locationOf(header) };\n }\n const name = match[1];\n let description: string | null = null;\n let subject: string | null = null;\n const nodes: WorkflowNodeSyntax[] = [];\n const specifications: LifecycleSpecificationSyntax[] = [];\n const directiveLocations: Record<string, SourceLocation> = {};\n let triggers = 0;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'description') {\n description = parseDescription(context, line, description, `Workflow '${name}'`);\n directiveLocations.description ??= locationOf(line);\n } else if (keyword === 'specification') {\n specifications.push(parseLifecycleSpecification(context, line, DiagnosticCodes.InvalidWorkflowDeclaration));\n } else if (keyword === 'for') {\n const found = forPattern.exec(line.content);\n if (found === null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid subject '${line.content}' - expected 'for <ReadModel>'.`, locationOf(line));\n else if (subject !== null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' declares its subject more than once.`, locationOf(line));\n else {\n subject = found[1];\n directiveLocations.for = locationOf(line);\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidWorkflowDeclaration, 'A for line cannot have children.');\n } else {\n const node = parseNode(context, line, name, keyword === 'trigger' ? ++triggers : triggers);\n if (node !== undefined) nodes.push(node);\n }\n }\n if (subject === null) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' must name its subject: 'for <ReadModel>'.`, locationOf(header));\n const seen = new Set<string>();\n for (const node of nodes) {\n if (seen.has(node.name)) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Workflow '${name}' declares node '${node.name}' more than once.`, node.location);\n seen.add(node.name);\n }\n return { kind: 'WorkflowSyntax', name, subject: subject ?? '', description, nodes, specifications, location: locationOf(header), directiveLocations };\n}\n\nfunction parseNode(context: ParserContext, line: SourceLine, workflow: string, ordinal: number): WorkflowNodeSyntax | undefined {\n const keyword = firstWord(line.content);\n let node: WorkflowNodeSyntax | undefined;\n switch (keyword) {\n case 'trigger': node = parseTrigger(context, line, ordinal); break;\n case 'action': node = parseAction(context, line); break;\n case 'decide': node = parseDecide(context, line); break;\n case 'wait': node = parseWait(context, line); break;\n case 'approval': node = parseApproval(context, line); break;\n case 'foreach': node = parseForEach(context, line); break;\n case 'join': node = parseJoin(context, line); break;\n default:\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Unexpected '${line.content}' in workflow '${workflow}' - expected for, description, specification or a node: trigger, action, decide, wait, approval, foreach or join.`, locationOf(line));\n }\n if (node === undefined) {\n context.skipBlock(line.indent);\n return undefined;\n }\n return { ...node, edges: parseEdges(context, line) };\n}\n\nfunction parseEdges(context: ParserContext, header: SourceLine): WorkflowEdgeSyntax[] {\n const edges: WorkflowEdgeSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const shorthand = shorthandEdge.exec(line.content);\n const edge = edgePattern.exec(line.content);\n if (shorthand !== null) edges.push({ kind: 'WorkflowEdgeSyntax', outlet: 'next', target: shorthand[1], location: locationOf(line) });\n else if (edge !== null) edges.push({ kind: 'WorkflowEdgeSyntax', outlet: edge[1] ?? edge[2], target: edge[3] ?? '', location: locationOf(line) });\n else {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid edge '${line.content}' - expected '<outlet> -> <Node>'.`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidWorkflowDeclaration, 'An edge cannot have children.');\n }\n return edges;\n}\n\nfunction parseTrigger(context: ParserContext, line: SourceLine, ordinal: number): WorkflowNodeSyntax | undefined {\n const match = triggerPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid trigger '${line.content}' - expected 'trigger [<Name>] on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`, locationOf(line));\n return undefined;\n }\n const name = match[1] ?? (ordinal === 1 ? 'Trigger' : `Trigger${ordinal}`);\n const rest = match[2];\n const location = locationOf(line);\n if (rest === 'manual') return empty('Trigger', name, location, { triggerKind: 'Manual' });\n const onEvent = onEventPattern.exec(rest);\n if (onEvent !== null) return empty('Trigger', name, location, { triggerKind: 'Event', event: onEvent[1] });\n const enters = entersPattern.exec(rest);\n if (enters !== null) return empty('Trigger', name, location, { triggerKind: 'StateEntered', stateMachine: enters[1], state: enters[2] });\n const scheduled = rest.startsWith('every ') || rest.startsWith('at ');\n if (scheduled) {\n const schedule = parseTriggerSource(context, { ...line, content: rest });\n return schedule === undefined ? undefined : empty('Trigger', name, location, { triggerKind: 'Schedule', schedule });\n }\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid trigger '${line.content}' - expected 'on <Event>', 'when <StateMachine> enters <State>', 'every <n> <unit>', 'at <HH:mm>' or 'manual'.`, locationOf(line));\n return undefined;\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = actionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid action '${line.content}' - expected 'action <Name> sends <Command> [attempts <n>] [timeout <n> <unit>] [retry after <n> <unit>]'.`, locationOf(line));\n return undefined;\n }\n let attempts: number | null = null;\n let timeout: WorkflowDurationSyntax | null = null;\n let retryAfter: WorkflowDurationSyntax | null = null;\n for (const option of match[3].matchAll(actionOption)) {\n if (option[1] !== undefined) {\n const count = Number(option[1]);\n if (attempts !== null || !Number.isInteger(count) || count < 1) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated attempts in '${line.content}'.`, locationOf(line));\n else attempts = count;\n } else if (option[2] !== undefined) {\n const parsed = duration(context, option[2], option[3], line);\n if (timeout !== null || parsed === undefined) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated timeout in '${line.content}'.`, locationOf(line));\n else timeout = parsed;\n } else {\n const parsed = duration(context, option[4], option[5], line);\n if (retryAfter !== null || parsed === undefined) context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid or repeated retry in '${line.content}'.`, locationOf(line));\n else retryAfter = parsed;\n }\n }\n return empty('Action', match[1], locationOf(line), { command: match[2], attempts, timeout, retryAfter });\n}\n\nfunction parseDecide(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = decidePattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid decide '${line.content}' - expected 'decide <Name> when <condition>'.`, locationOf(line));\n return undefined;\n }\n const condition = parseCondition(context, match[2], locationOf(line));\n return condition === null ? undefined : empty('Decide', match[1], locationOf(line), { condition });\n}\n\nfunction parseWait(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = waitPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid wait '${line.content}' - expected 'wait <Name> for <Event> [expires after <n> <unit>]' or 'wait <Name> for <n> <unit>'.`, locationOf(line));\n return undefined;\n }\n if (match[2] !== undefined) {\n const parsed = duration(context, match[2], match[3], line);\n return parsed === undefined ? undefined : empty('Wait', match[1], locationOf(line), { duration: parsed });\n }\n let expiresAfter: WorkflowDurationSyntax | null = null;\n if (match[5] !== undefined) {\n const parsed = duration(context, match[5], match[6], line);\n if (parsed === undefined) return undefined;\n expiresAfter = parsed;\n }\n return empty('Wait', match[1], locationOf(line), { event: match[4], expiresAfter });\n}\n\nfunction parseApproval(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = approvalPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid approval '${line.content}' - expected 'approval <Name> by <Persona or Policy> [expires after <n> <unit>]'.`, locationOf(line));\n return undefined;\n }\n let expiresAfter: WorkflowDurationSyntax | null = null;\n if (match[3] !== undefined) {\n const parsed = duration(context, match[3], match[4], line);\n if (parsed === undefined) return undefined;\n expiresAfter = parsed;\n }\n return empty('Approval', match[1], locationOf(line), { by: match[2], expiresAfter });\n}\n\nfunction parseForEach(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = forEachPattern.exec(line.content);\n if (match === null || (match[3] !== undefined && Number(match[3]) < 1)) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid foreach '${line.content}' - expected 'foreach <Name> over <property> [parallel <n>]'.`, locationOf(line));\n return undefined;\n }\n return empty('ForEach', match[1], locationOf(line), { items: match[2], parallel: match[3] === undefined ? null : Number(match[3]) });\n}\n\nfunction parseJoin(context: ParserContext, line: SourceLine): WorkflowNodeSyntax | undefined {\n const match = joinPattern.exec(line.content);\n if (match === null || (match[3] !== undefined && Number(match[3]) < 1)) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid join '${line.content}' - expected 'join <Name> all', 'join <Name> any' or 'join <Name> at least <n>'.`, locationOf(line));\n return undefined;\n }\n return empty('Join', match[1], locationOf(line), { joinMode: match[2] === 'all' ? 'All' : match[2] === 'any' ? 'Any' : 'AtLeast', joinCount: match[3] === undefined ? null : Number(match[3]) });\n}\n\nfunction duration(context: ParserContext, amount: string, text: string, line: SourceLine): WorkflowDurationSyntax | undefined {\n const count = Number(amount);\n if (!Number.isInteger(count) || count < 1) {\n context.error(DiagnosticCodes.InvalidWorkflowDeclaration, `Invalid duration '${amount} ${text}' in '${line.content}' - an amount is at least 1.`, locationOf(line));\n return undefined;\n }\n const base = text.replace(/s$/, '');\n const parsed: IntervalUnit = base === 'second' ? 'Seconds' : base === 'minute' ? 'Minutes' : base === 'hour' ? 'Hours' : 'Days';\n return { kind: 'WorkflowDurationSyntax', amount: count, unit: parsed, location: locationOf(line) };\n}\n"],"mappings":"A,6iBAiBA,MAAMA,EAAO,mCACPC,EAAgBC,EAAQ,+BAA+B,EACvDC,EAAaD,EAAQ,0BAA0B,EAC/CE,EAAgBF,EAAQ,yBAAyB,EACjDG,EAAcH,EAAQ,+DAA+D,EACrFI,EAAiBJ,EAAQ,6EAA6E,EACtGK,EAAiBL,EAAQ,4BAA4B,EACrDM,EAAgBN,EAAQ,wDAAwD,EAChFO,EAAgBP,EAAQ,+IAA+I,EACvKQ,EAAe,0EACfC,EAAgBT,E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AAK,GAAKA,EAAQ,EAAG,CACvClC,EAAQ,MAAMC,EAAgB,2BAA4B,qBAAqBsC,EAAO,GAAGC,EAAK,QAAQ7B,EAAK,QAAQ,8BAA+BT,EAAWS,CAAI,CAAC,EAClK,MACJ,CACA,IAAM8B,EAAOD,EAAK,QAAQ,KAAM,EAAE,EAElC,MAAO,CAAE,KAAM,yBAA0B,OAAQN,EAAO,KAD3BO,IAAS,SAAW,UAAYA,IAAS,SAAW,UAAYA,IAAS,OAAS,QAAU,OACnD,SAAUvC,EAAWS,CAAI,CAAE,CACrG,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkPortableMatchPattern.js","names":["replacement","recognizeLegacyTextRule","pattern","suggestion","DiagnosticCodes","issue","validateMatchPattern"],"sources":["../../../../../../Compiler/Parsing/checkPortableMatchPattern.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 { PortableMatchCheck } from './PortableMatchCheck';\nimport { PortableMatchStatus } from './PortableMatchStatus';\nimport { recognizeLegacyTextRule } from './LegacyTextRulePatterns';\nimport { validateMatchPattern } from './PortableMatchPattern';\n\n/** Checks a decoded pattern without executing it or constructing a platform RegExp. */\nexport function checkPortableMatchPattern(pattern: string): PortableMatchCheck {\n const replacement = recognizeLegacyTextRule(pattern);\n if (replacement !== undefined) {\n const spelling = replacement.kind === 'Equal' ? '==' : replacement.kind === 'NotEqual' ? '!=' : replacement.kind === 'NotContains' ? 'not contains' : 'ends with';\n const suggestion = `Use '${spelling}' with the literal text operand instead.`;\n return { status: PortableMatchStatus.Deprecated, code: DiagnosticCodes.DeprecatedStudioTextRulePattern, construct: 'Studio text rule', offset: 0, suggestion, description: `This Studio lookaround pattern is deprecated. ${suggestion}`, replacement };\n }\n const issue = validateMatchPattern(pattern);\n if (issue === undefined) return { status: PortableMatchStatus.Admitted, code: null, construct: null, offset: 0, suggestion: null, description: '' };\n return {\n status: issue.invalid ? PortableMatchStatus.Invalid : PortableMatchStatus.Refused,\n code: issue.invalid ? DiagnosticCodes.InvalidMatchPattern : DiagnosticCodes.PatternOutsidePortableMatchDialect,\n construct: issue.construct,\n offset: issue.offset,\n suggestion: issue.suggestion ?? null,\n description: `${issue.construct} at offset ${issue.offset}. ${issue.suggestion ?? ''}`.trimEnd(),\n };\n}\n"],"mappings":"gQAUA,SAAgB,0BAA0B,EAAqC,CAC3E,IAAMA,EAAcC,EAAwBC,CAAO,EACnD,GAAIF,IAAgB,IAAA,GAAW,CAE3B,IAAMG,EAAa,QADFH,EAAY,OAAS,QAAU,KAAOA,EAAY,OAAS,WAAa,KAAOA,EAAY,OAAS,cAAgB,eAAiB,YAClH,0CACpC,MAAO,CAAE,OAAA,aAAwC,KAAMI,EAAgB,gCAAiC,UAAW,mBAAoB,OAAQ,EAAG,aAAY,YAAa,iDAAiDD,IAAc,aAAY,CAC1P,CACA,IAAME,EAAQC,EAAqBJ,CAAO,EAE1C,OADIG,IAAU,IAAA,GAAkB,CAAE,OAAA,WAAsC,KAAM,KAAM,UAAW,KAAM,OAAQ,EAAG,WAAY,KAAM,YAAa,EAAG,EAC3I,CACH,OAAQA,EAAM,QAAA,UAAA,UACd,KAAMA,EAAM,QAAUD,EAAgB,oBAAsBA,EAAgB,mCAC5E,UAAWC,EAAM,UACjB,OAAQA,EAAM,OACd,WAAYA,EAAM,YAAc,KAChC,YAAa,GAAGA,EAAM,UAAU,aAAaA,EAAM,OAAO,IAAIA,EAAM,YAAc,KAAK,QAAQ,CACnG,CACJ"}
1
+ {"version":3,"file":"checkPortableMatchPattern.js","names":["replacement","recognizeLegacyTextRule","pattern","suggestion","DiagnosticCodes","issue","validateMatchPattern"],"sources":["../../../../../../Compiler/Parsing/checkPortableMatchPattern.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 { PortableMatchCheck } from './PortableMatchCheck';\nimport { PortableMatchStatus } from './PortableMatchStatus';\nimport { recognizeLegacyTextRule } from './LegacyTextRulePatterns';\nimport { validateMatchPattern } from './PortableMatchPattern';\n\n/** Checks a decoded pattern without executing it or constructing a platform RegExp. */\nexport function checkPortableMatchPattern(pattern: string): PortableMatchCheck {\n const replacement = recognizeLegacyTextRule(pattern);\n if (replacement !== undefined) {\n const spelling = replacement.kind === 'Equal' ? '==' : replacement.kind === 'NotEqual' ? '!=' : replacement.kind === 'NotContains' ? 'not contains' : 'ends with';\n const suggestion = `Use '${spelling}' with the literal text operand instead.`;\n return { status: PortableMatchStatus.Deprecated, code: DiagnosticCodes.DeprecatedStudioTextRulePattern, construct: 'Studio text rule', offset: 0, suggestion, description: `This Studio lookaround pattern is deprecated. ${suggestion}`, replacement };\n }\n const issue = validateMatchPattern(pattern);\n if (issue === undefined) return { status: PortableMatchStatus.Admitted, code: null, construct: null, offset: 0, suggestion: null, description: '' };\n return {\n status: issue.invalid ? PortableMatchStatus.Invalid : PortableMatchStatus.Refused,\n code: issue.invalid ? DiagnosticCodes.InvalidMatchPattern : DiagnosticCodes.PatternOutsidePortableMatchDialect,\n construct: issue.construct,\n offset: issue.offset,\n suggestion: issue.suggestion ?? null,\n description: `${issue.construct} at offset ${issue.offset}. ${issue.suggestion ?? ''}`.trimEnd(),\n };\n}\n"],"mappings":"A,gQAUA,SAAgB,0BAA0B,EAAqC,CAC3E,IAAMA,EAAcC,EAAwBC,CAAO,EACnD,GAAIF,IAAgB,IAAA,GAAW,CAE3B,IAAMG,EAAa,QADFH,EAAY,OAAS,QAAU,KAAOA,EAAY,OAAS,WAAa,KAAOA,EAAY,OAAS,cAAgB,eAAiB,YAClH,0CACpC,MAAO,CAAE,OAAA,aAAwC,KAAMI,EAAgB,gCAAiC,UAAW,mBAAoB,OAAQ,EAAG,aAAY,YAAa,iDAAiDD,IAAc,aAAY,CAC1P,CACA,IAAME,EAAQC,EAAqBJ,CAAO,EAE1C,OADIG,IAAU,IAAA,GAAkB,CAAE,OAAA,WAAsC,KAAM,KAAM,UAAW,KAAM,OAAQ,EAAG,WAAY,KAAM,YAAa,EAAG,EAC3I,CACH,OAAQA,EAAM,QAAA,UAAA,UACd,KAAMA,EAAM,QAAUD,EAAgB,oBAAsBA,EAAgB,mCAC5E,UAAWC,EAAM,UACjB,OAAQA,EAAM,OACd,WAAYA,EAAM,YAAc,KAChC,YAAa,GAAGA,EAAM,UAAU,aAAaA,EAAM,OAAO,IAAIA,EAAM,YAAc,KAAK,QAAQ,CACnG,CACJ,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasExponentialMatchAmbiguity.js","names":["following","graph","edge","live","owner","overlaps","origin","pending","left","right","different","visited","index","leftPosition","rightPosition","leftCount","rightCount","first","second","key","overlap","one","two","distinct","next"],"sources":["../../../../../../Compiler/Parsing/hasExponentialMatchAmbiguity.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 { MatchAmbiguityGraph, matchAmbiguityWorkLimit } from './MatchAmbiguityGraph';\nimport { MatchAmbiguityNode } from './MatchAmbiguityNode';\n\n/** Weber–Seidl EDA: a synchronized closed pair-path that uses distinct edges. */\nexport function hasExponentialMatchAmbiguity(graph: MatchAmbiguityGraph, owner: MatchAmbiguityNode, live: Set<number>): boolean {\n const following = graph.positions.map(() => new Map<number, number>());\n for (const edge of graph.edges.filter(edge => live.has(edge.source) && live.has(edge.target) && edge.origin.offset >= owner.offset && edge.origin.offset + edge.origin.length <= owner.offset + owner.length)) {\n following[edge.source].set(edge.target, Math.min(2, (following[edge.source].get(edge.target) ?? 0) + edge.count));\n }\n const overlaps = new Map<number, boolean>();\n for (const origin of live) {\n const pending: [number, number, boolean][] = [[origin, origin, false]];\n const encode = (left: number, right: number, different: boolean) => (left * graph.positions.length + right) * 2 + Number(different);\n const visited = new Set([encode(origin, origin, false)]);\n for (let index = 0; index < pending.length; index++) {\n const [leftPosition, rightPosition, different] = pending[index];\n for (const [left, leftCount] of following[leftPosition]) for (const [right, rightCount] of following[rightPosition]) {\n if (++graph.work > matchAmbiguityWorkLimit) { graph.exhausted = true; return false; }\n const first = Math.min(left, right);\n const second = Math.max(left, right);\n const key = first * graph.positions.length + second;\n let overlap = overlaps.get(key);\n if (overlap === undefined) {\n overlap = graph.positions[left].characters.some(one => graph.positions[right].characters.some(two => one[0] <= two[1] && two[0] <= one[1]));\n overlaps.set(key, overlap);\n }\n if (!overlap) continue;\n const distinct = different || leftPosition !== rightPosition || left !== right || leftCount > 1 || rightCount > 1;\n if (left === origin && right === origin && distinct) return true;\n const next = encode(first, second, distinct);\n if (!visited.has(next)) { visited.add(next); pending.push([first, second, distinct]); }\n }\n }\n }\n return false;\n}\n"],"mappings":"sFAOA,SAAgB,6BAA6B,EAA4B,EAA2B,EAA4B,CAC5H,IAAMA,EAAYC,EAAM,UAAU,wBAAU,IAAI,GAAqB,EACrE,IAAK,IAAMC,KAAQD,EAAM,MAAM,OAAO,GAAQE,EAAK,IAAID,EAAK,MAAM,GAAKC,EAAK,IAAID,EAAK,MAAM,GAAKA,EAAK,OAAO,QAAUE,EAAM,QAAUF,EAAK,OAAO,OAASA,EAAK,OAAO,QAAUE,EAAM,OAASA,EAAM,MAAM,EACxMJ,EAAUE,EAAK,OAAO,CAAC,IAAIA,EAAK,OAAQ,KAAK,IAAI,GAAIF,EAAUE,EAAK,OAAO,CAAC,IAAIA,EAAK,MAAM,GAAK,GAAKA,EAAK,KAAK,CAAC,EAEpH,IAAMG,kBAAW,IAAI,IACrB,IAAK,IAAMC,KAAUH,EAAM,CACvB,IAAMI,EAAuC,CAAC,CAACD,EAAQA,EAAQ,EAAK,CAAC,EAC/D,QAAU,EAAc,EAAe,KAAwBE,EAAOP,EAAM,UAAU,OAASQ,GAAS,EAAI,OAAOC,CAAS,EAC5HC,kBAAU,IAAI,IAAI,CAAC,OAAOL,EAAQA,EAAQ,EAAK,CAAC,CAAC,EACvD,IAAK,IAAIM,EAAQ,EAAGA,EAAQL,EAAQ,OAAQ,IAAS,CACjD,GAAM,CAACM,EAAcC,EAAeJ,GAAaH,EAAQK,GACzD,IAAK,GAAM,CAACJ,EAAMO,KAAcf,EAAUa,GAAe,IAAK,GAAM,CAACJ,EAAOO,KAAehB,EAAUc,GAAgB,CACjH,GAAI,EAAEb,EAAM,KAAA,IAA0D,MAAxB,GAAM,UAAY,GAAa,GAC7E,IAAMgB,EAAQ,KAAK,IAAIT,EAAMC,CAAK,EAC5BS,EAAS,KAAK,IAAIV,EAAMC,CAAK,EAC7BU,EAAMF,EAAQhB,EAAM,UAAU,OAASiB,EACzCE,EAAUf,EAAS,IAAIc,CAAG,EAK9B,GAJIC,IAAY,IAAA,KACZ,EAAUnB,EAAM,UAAUO,EAAK,CAAC,WAAW,KAAK,GAAOP,EAAM,UAAUQ,EAAM,CAAC,WAAW,KAAK,GAAOY,EAAI,IAAMC,EAAI,IAAMA,EAAI,IAAMD,EAAI,EAAE,CAAC,EAC1IhB,EAAS,IAAIc,EAAKC,CAAO,GAEzB,CAACA,EAAS,SACd,IAAMG,EAAWb,GAAaG,IAAiBC,GAAiBN,IAASC,GAASM,EAAY,GAAKC,EAAa,EAChH,GAAIR,IAASF,GAAUG,IAAUH,GAAUiB,EAAU,MAAO,GAC5D,IAAMC,EAAO,OAAOP,EAAOC,EAAQK,CAAQ,EACtCZ,EAAQ,IAAIa,CAAI,IAAKb,EAAQ,IAAIa,CAAI,EAAGjB,EAAQ,KAAK,CAACU,EAAOC,EAAQK,CAAQ,CAAC,EACvF,CACJ,CACJ,CACA,MAAO,EACX"}
1
+ {"version":3,"file":"hasExponentialMatchAmbiguity.js","names":["following","graph","edge","live","owner","overlaps","origin","pending","left","right","different","visited","index","leftPosition","rightPosition","leftCount","rightCount","first","second","key","overlap","one","two","distinct","next"],"sources":["../../../../../../Compiler/Parsing/hasExponentialMatchAmbiguity.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 { MatchAmbiguityGraph, matchAmbiguityWorkLimit } from './MatchAmbiguityGraph';\nimport { MatchAmbiguityNode } from './MatchAmbiguityNode';\n\n/** Weber–Seidl EDA: a synchronized closed pair-path that uses distinct edges. */\nexport function hasExponentialMatchAmbiguity(graph: MatchAmbiguityGraph, owner: MatchAmbiguityNode, live: Set<number>): boolean {\n const following = graph.positions.map(() => new Map<number, number>());\n for (const edge of graph.edges.filter(edge => live.has(edge.source) && live.has(edge.target) && edge.origin.offset >= owner.offset && edge.origin.offset + edge.origin.length <= owner.offset + owner.length)) {\n following[edge.source].set(edge.target, Math.min(2, (following[edge.source].get(edge.target) ?? 0) + edge.count));\n }\n const overlaps = new Map<number, boolean>();\n for (const origin of live) {\n const pending: [number, number, boolean][] = [[origin, origin, false]];\n const encode = (left: number, right: number, different: boolean) => (left * graph.positions.length + right) * 2 + Number(different);\n const visited = new Set([encode(origin, origin, false)]);\n for (let index = 0; index < pending.length; index++) {\n const [leftPosition, rightPosition, different] = pending[index];\n for (const [left, leftCount] of following[leftPosition]) for (const [right, rightCount] of following[rightPosition]) {\n if (++graph.work > matchAmbiguityWorkLimit) { graph.exhausted = true; return false; }\n const first = Math.min(left, right);\n const second = Math.max(left, right);\n const key = first * graph.positions.length + second;\n let overlap = overlaps.get(key);\n if (overlap === undefined) {\n overlap = graph.positions[left].characters.some(one => graph.positions[right].characters.some(two => one[0] <= two[1] && two[0] <= one[1]));\n overlaps.set(key, overlap);\n }\n if (!overlap) continue;\n const distinct = different || leftPosition !== rightPosition || left !== right || leftCount > 1 || rightCount > 1;\n if (left === origin && right === origin && distinct) return true;\n const next = encode(first, second, distinct);\n if (!visited.has(next)) { visited.add(next); pending.push([first, second, distinct]); }\n }\n }\n }\n return false;\n}\n"],"mappings":"A,sFAOA,SAAgB,6BAA6B,EAA4B,EAA2B,EAA4B,CAC5H,IAAMA,EAAYC,EAAM,UAAU,wBAAU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MC,EAAI,IAAMA,EAAI,IAAMD,EAAI,EAAE,CAAC,EAC1IhB,EAAS,IAAIc,EAAKC,CAAO,GAEzB,CAACA,EAAS,SACd,IAAMG,EAAWb,GAAaG,IAAiBC,GAAiBN,IAASC,GAASM,EAAY,GAAKC,EAAa,EAChH,GAAIR,IAASF,GAAUG,IAAUH,GAAUiB,EAAU,MAAO,GAC5D,IAAMC,EAAO,OAAOP,EAAOC,EAAQK,CAAQ,EACtCZ,EAAQ,IAAIa,CAAI,IAAKb,EAAQ,IAAIa,CAAI,EAAGjB,EAAQ,KAAK,CAACU,EAAOC,EAAQK,CAAQ,CAAC,EACvF,CACJ,CACJ,CACA,MAAO,EACX,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"trimMatchAmbiguityGraph.js","names":["following","graph","edge","position","reverse","reached","pending","finals","index","state","phase","target","node","nextPhase","next","live","backward","previous"],"sources":["../../../../../../Compiler/Parsing/trimMatchAmbiguityGraph.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 { MatchAmbiguityGraph } from './MatchAmbiguityGraph';\n\n/** Trim with zero-width assertions guarded by consumed-input and asserted-end flags. */\nexport function trimMatchAmbiguityGraph(graph: MatchAmbiguityGraph): Set<number> {\n const following = graph.positions.map(() => new Set<number>());\n for (const edge of graph.edges) following[edge.source].add(edge.target);\n for (const position of graph.root.first.keys()) following[0].add(position);\n const reverse = Array.from({ length: graph.positions.length * 4 }, () => new Set<number>());\n const reached = new Set([0, 1]);\n const pending = [0, 1];\n const finals = new Set<number>();\n for (let index = 0; index < pending.length; index++) {\n const state = pending[index];\n const position = Math.floor(state / 4);\n const phase = state % 4;\n if (graph.root.last.has(position) || (position === 0 && graph.root.nullable > 0)) finals.add(state);\n for (const target of following[position]) {\n const node = graph.positions[target];\n if (node.kind === 'start' && (phase & 1) !== 0) continue;\n if (node.kind === 'characters' && ((phase & 2) !== 0 || node.characters.length === 0)) continue;\n const nextPhase = node.kind === 'end' ? phase | 2 : node.kind === 'characters' ? phase | 1 : phase;\n const next = target * 4 + nextPhase;\n reverse[next].add(state);\n if (!reached.has(next)) { reached.add(next); pending.push(next); }\n }\n }\n const live = new Set(finals);\n const backward = [...finals];\n for (let index = 0; index < backward.length; index++) for (const previous of reverse[backward[index]]) {\n if (!live.has(previous)) { live.add(previous); backward.push(previous); }\n }\n return new Set(graph.positions.map((_, index) => index).filter(position => graph.positions[position].kind === 'characters' && reached.has(position * 4 + 1) && live.has(position * 4 + 1)));\n}\n"],"mappings":"qDAMA,SAAgB,wBAAwB,EAAyC,CAC7E,IAAMA,EAAYC,EAAM,UAAU,wBAAU,IAAI,GAAa,EAC7D,IAAK,IAAMC,KAAQD,EAAM,MAAOD,EAAUE,EAAK,OAAO,CAAC,IAAIA,EAAK,MAAM,EACtE,IAAK,IAAMC,KAAYF,EAAM,KAAK,MAAM,KAAK,EAAGD,EAAU,EAAE,CAAC,IAAIG,CAAQ,EACzE,IAAMC,EAAU,MAAM,KAAK,CAAE,OAAQH,EAAM,UAAU,OAAS,CAAE,sBAAS,IAAI,GAAa,EACpFI,kBAAU,IAAI,IAAI,CAAC,EAAG,CAAC,CAAC,EACxBC,EAAU,CAAC,EAAG,CAAC,EACfC,kBAAS,IAAI,IACnB,IAAK,IAAIC,EAAQ,EAAGA,EAAQF,EAAQ,OAAQ,IAAS,CACjD,IAAMG,EAAQH,EAAQE,GAChBL,EAAW,KAAK,MAAMM,EAAQ,CAAC,EAC/BC,EAAQD,EAAQ,GAClBR,EAAM,KAAK,KAAK,IAAIE,CAAQ,GAAMA,IAAa,GAAKF,EAAM,KAAK,SAAW,IAAIM,EAAO,IAAIE,CAAK,EAClG,IAAK,IAAME,KAAUX,EAAUG,GAAW,CACtC,IAAMS,EAAOX,EAAM,UAAUU,GAE7B,GADIC,EAAK,OAAS,SAAYF,EAAQ,GAClCE,EAAK,OAAS,eAAkBF,EAAQ,GAAYE,EAAK,WAAW,SAAW,GAAI,SACvF,IAAMC,EAAYD,EAAK,OAAS,MAAQF,EAAQ,EAAIE,EAAK,OAAS,aAAeF,EAAQ,EAAIA,EACvFI,EAAOH,EAAS,EAAIE,EAC1BT,EAAQU,EAAK,CAAC,IAAIL,CAAK,EAClBJ,EAAQ,IAAIS,CAAI,IAAKT,EAAQ,IAAIS,CAAI,EAAGR,EAAQ,KAAKQ,CAAI,EAClE,CACJ,CACA,IAAMC,EAAO,IAAI,IAAIR,CAAM,EACrBS,EAAW,CAAC,GAAGT,CAAM,EAC3B,IAAK,IAAIC,EAAQ,EAAGA,EAAQQ,EAAS,OAAQ,IAAS,IAAK,IAAMC,KAAYb,EAAQY,EAASR,IACrFO,EAAK,IAAIE,CAAQ,IAAKF,EAAK,IAAIE,CAAQ,EAAGD,EAAS,KAAKC,CAAQ,GAEzE,OAAO,IAAI,IAAIhB,EAAM,UAAU,KAAK,EAAG,IAAUO,CAAK,CAAC,CAAC,OAAO,GAAYP,EAAM,UAAUE,EAAS,CAAC,OAAS,cAAgBE,EAAQ,IAAIF,EAAW,EAAI,CAAC,GAAKY,EAAK,IAAIZ,EAAW,EAAI,CAAC,CAAC,CAAC,CAC9L"}
1
+ {"version":3,"file":"trimMatchAmbiguityGraph.js","names":["following","graph","edge","position","reverse","reached","pending","finals","index","state","phase","target","node","nextPhase","next","live","backward","previous"],"sources":["../../../../../../Compiler/Parsing/trimMatchAmbiguityGraph.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 { MatchAmbiguityGraph } from './MatchAmbiguityGraph';\n\n/** Trim with zero-width assertions guarded by consumed-input and asserted-end flags. */\nexport function trimMatchAmbiguityGraph(graph: MatchAmbiguityGraph): Set<number> {\n const following = graph.positions.map(() => new Set<number>());\n for (const edge of graph.edges) following[edge.source].add(edge.target);\n for (const position of graph.root.first.keys()) following[0].add(position);\n const reverse = Array.from({ length: graph.positions.length * 4 }, () => new Set<number>());\n const reached = new Set([0, 1]);\n const pending = [0, 1];\n const finals = new Set<number>();\n for (let index = 0; index < pending.length; index++) {\n const state = pending[index];\n const position = Math.floor(state / 4);\n const phase = state % 4;\n if (graph.root.last.has(position) || (position === 0 && graph.root.nullable > 0)) finals.add(state);\n for (const target of following[position]) {\n const node = graph.positions[target];\n if (node.kind === 'start' && (phase & 1) !== 0) continue;\n if (node.kind === 'characters' && ((phase & 2) !== 0 || node.characters.length === 0)) continue;\n const nextPhase = node.kind === 'end' ? phase | 2 : node.kind === 'characters' ? phase | 1 : phase;\n const next = target * 4 + nextPhase;\n reverse[next].add(state);\n if (!reached.has(next)) { reached.add(next); pending.push(next); }\n }\n }\n const live = new Set(finals);\n const backward = [...finals];\n for (let index = 0; index < backward.length; index++) for (const previous of reverse[backward[index]]) {\n if (!live.has(previous)) { live.add(previous); backward.push(previous); }\n }\n return new Set(graph.positions.map((_, index) => index).filter(position => graph.positions[position].kind === 'characters' && reached.has(position * 4 + 1) && live.has(position * 4 + 1)));\n}\n"],"mappings":"A,qDAMA,SAAgB,wBAAwB,EAAyC,CAC7E,IAAMA,EAAYC,EAAM,UAAU,wBAAU,IAAI,GAAa,EAC7D,IAAK,IAAMC,KAAQD,EAAM,MAAOD,EAAUE,EAAK,OAAO,CAAC,IAAIA,EAAK,MAAM,EACtE,IAAK,IAAMC,KAAYF,EAAM,KAAK,MAAM,KAAK,EAAGD,EAAU,EAAE,CAAC,IAAIG,CAAQ,EACzE,IAAMC,EAAU,MAAM,KAAK,CAAE,OAAQH,EAAM,UAAU,OAAS,CAAE,sBAAS,IAAI,GAAa,EACpFI,kBAAU,IAAI,IAAI,CAAC,EAAG,CAAC,CAAC,EACxBC,EAAU,CAAC,EAAG,CAAC,EACfC,kBAAS,IAAI,IACnB,IAAK,IAAIC,EAAQ,EAAGA,EAAQF,EAAQ,OAAQ,IAAS,CACjD,IAAMG,EAAQH,EAAQE,GAChBL,EAAW,KAAK,MAAMM,EAAQ,CAAC,EAC/BC,EAAQD,EAAQ,GACl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