sysml-validate 0.14.4 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/main.js CHANGED
@@ -58699,6 +58699,11 @@ var DIAGNOSTIC_MESSAGES = {
58699
58699
  LEX004_INVALID_STRING_ESCAPE: (escape) => `Invalid escape '\\${escape}'. KerML Table 4 permits \\' \\" \\b \\f \\t \\n and \\\\.`,
58700
58700
  LEX008_NON_ASCII_IDENTIFIER: (name) => `Identifier '${name}' contains a non-ASCII character. Wrap it in single quotes ('${name}') to use it as an unrestricted name.`,
58701
58701
  LEX009_TRAILING_WHITESPACE: "Trailing whitespace.",
58702
+ // REQ-385 — OMG SysML v2 Part 1 §7.17.3 restricts control nodes to the body of
58703
+ // an action definition or usage. Successions are NOT covered (§7.13.5 sanctions
58704
+ // `first a then b;` and the `then` occurrence shorthand in a part), so the
58705
+ // message names the construct it means rather than "action language".
58706
+ SEM011_ACTION_ONLY_CONSTRUCT: (construct, clause, owner) => `${construct} may only be declared in the body of an action definition or usage (OMG SysML v2 Part 1 \xA7${clause}), not in ${owner}.`,
58702
58707
  RES016_LIBRARY_SHADOWING: (name) => `'${name}' shadows a standard-library element of the same name; the library symbol is hidden in this scope.`,
58703
58708
  // issue #183 — KerML namespace distinguishability (validateNamespaceDistinguishability).
58704
58709
  // Owned siblings sharing a name/short name (or an alias clashing with an owned
@@ -59449,6 +59454,48 @@ var CONSTRAINT_SIDE_EFFECT_TYPES = /* @__PURE__ */ new Set([
59449
59454
  "DoAction",
59450
59455
  "ExitAction"
59451
59456
  ]);
59457
+ var ACTION_BODY_TYPES = /* @__PURE__ */ new Set([
59458
+ "ActionDecl",
59459
+ "PerformStmt",
59460
+ "MergeNode",
59461
+ "DecideNode",
59462
+ "JoinNode",
59463
+ "ForkNode",
59464
+ "IfActionNode",
59465
+ "WhileLoopNode",
59466
+ "LoopNode",
59467
+ "ForLoopNode",
59468
+ "SendNode",
59469
+ "AcceptNode",
59470
+ "AssignNode",
59471
+ "TerminateNode",
59472
+ "StateDecl",
59473
+ "ExhibitStateDecl",
59474
+ "TransitionDecl",
59475
+ "EntryAction",
59476
+ "DoAction",
59477
+ "ExitAction",
59478
+ "CalcDecl",
59479
+ "CaseDecl",
59480
+ "UseCaseDecl",
59481
+ "AnalysisCaseDecl",
59482
+ "VerificationCaseDecl"
59483
+ ]);
59484
+ var CONTROL_NODE_KEYWORDS = {
59485
+ MergeNode: "merge",
59486
+ DecideNode: "decide",
59487
+ JoinNode: "join",
59488
+ ForkNode: "fork"
59489
+ };
59490
+ var SUCCESSION_MEMBER_WRAPPERS = /* @__PURE__ */ new Set([
59491
+ "ThenActionMember",
59492
+ "ElseSuccessionMember",
59493
+ "PrefixMetadataMember"
59494
+ ]);
59495
+ function actionOnlyConstruct(node) {
59496
+ const keyword = CONTROL_NODE_KEYWORDS[node.$type];
59497
+ return keyword ? { construct: `A '${keyword}' control node`, clause: "7.17.3" } : void 0;
59498
+ }
59452
59499
  var SysmlValidator = class _SysmlValidator {
59453
59500
  indexManager;
59454
59501
  langiumDocuments;
@@ -59538,6 +59585,26 @@ var SysmlValidator = class _SysmlValidator {
59538
59585
  }
59539
59586
  }
59540
59587
  }
59588
+ // REQ-385 — SEM011. A fork/join/decide/merge control node "can only be declared
59589
+ // in the body of an action definition or usage" (OMG SysML v2 Part 1 §7.17.3).
59590
+ // Written in a part, one parsed and drew silently, which is how a part came to
59591
+ // show control flow it cannot own (user report 2026-08-09). See
59592
+ // `actionOnlyConstruct` for the constructs deliberately NOT covered.
59593
+ checkActionFlowPlacement(node, accept) {
59594
+ const restricted = actionOnlyConstruct(node);
59595
+ if (!restricted)
59596
+ return;
59597
+ if (SUCCESSION_MEMBER_WRAPPERS.has(node.$container?.$type ?? ""))
59598
+ return;
59599
+ let owner = node.$container;
59600
+ while (owner && SUCCESSION_MEMBER_WRAPPERS.has(owner.$type))
59601
+ owner = owner.$container;
59602
+ if (!owner || ACTION_BODY_TYPES.has(owner.$type))
59603
+ return;
59604
+ const ownerName = owner.name;
59605
+ const ownerKind = DECL_KEYWORDS[owner.$type] ?? "this context";
59606
+ accept(severity("SEM011", "warning"), DIAGNOSTIC_MESSAGES.SEM011_ACTION_ONLY_CONSTRUCT(restricted.construct, restricted.clause, ownerName ? `${ownerKind} '${ownerName}'` : ownerKind), { node, code: "SEM011" });
59607
+ }
59541
59608
  // REQ-148, REQ-294, REQ-315, REQ-330 — SEM006/SYN092 requirement definition must have a subject
59542
59609
  checkRequirementDecl(node, accept) {
59543
59610
  if (!node.isDef || !node.name)
@@ -61267,7 +61334,12 @@ ${baseIndent}}`;
61267
61334
  StateDecl: this.checkStateDecl.bind(this),
61268
61335
  Import: this.checkImport.bind(this),
61269
61336
  Package: this.checkPackage.bind(this),
61270
- VerifyStmt: this.checkVerifyStmt.bind(this)
61337
+ VerifyStmt: this.checkVerifyStmt.bind(this),
61338
+ // REQ-385 — SEM011: the action language OMG confines to an action body.
61339
+ MergeNode: this.checkActionFlowPlacement.bind(this),
61340
+ DecideNode: this.checkActionFlowPlacement.bind(this),
61341
+ JoinNode: this.checkActionFlowPlacement.bind(this),
61342
+ ForkNode: this.checkActionFlowPlacement.bind(this)
61271
61343
  };
61272
61344
  }
61273
61345
  };
@@ -68895,7 +68967,7 @@ async function runValidation(command) {
68895
68967
  }
68896
68968
 
68897
68969
  // src/main.ts
68898
- var VERSION2 = true ? "0.14.4" : "dev";
68970
+ var VERSION2 = true ? "0.14.5" : "dev";
68899
68971
  async function main(argv) {
68900
68972
  const command = parseArgs(argv);
68901
68973
  if (command.kind === "help") {