sysml-validate 0.14.5 → 0.15.0
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 +65 -1
- package/out/main.js.map +2 -2
- package/package.json +1 -1
- package/resources/sysml.dimension-table.json +1 -1
package/out/main.js
CHANGED
|
@@ -59496,6 +59496,26 @@ function actionOnlyConstruct(node) {
|
|
|
59496
59496
|
const keyword = CONTROL_NODE_KEYWORDS[node.$type];
|
|
59497
59497
|
return keyword ? { construct: `A '${keyword}' control node`, clause: "7.17.3" } : void 0;
|
|
59498
59498
|
}
|
|
59499
|
+
function portionKindOf(node) {
|
|
59500
|
+
const mods = node.modifiers;
|
|
59501
|
+
if (!Array.isArray(mods))
|
|
59502
|
+
return void 0;
|
|
59503
|
+
return mods.find((m) => m === "timeslice" || m === "snapshot");
|
|
59504
|
+
}
|
|
59505
|
+
var NAMESPACE_ONLY_TYPES = /* @__PURE__ */ new Set(["Package", "Document", "NamespaceDecl"]);
|
|
59506
|
+
function owningTypeOf(node) {
|
|
59507
|
+
let owner = node.$container;
|
|
59508
|
+
while (owner && (owner.$type === "PrefixMetadataMember" || owner.$type === "ThenActionMember")) {
|
|
59509
|
+
owner = owner.$container;
|
|
59510
|
+
}
|
|
59511
|
+
if (!owner)
|
|
59512
|
+
return void 0;
|
|
59513
|
+
return NAMESPACE_ONLY_TYPES.has(owner.$type) ? void 0 : owner;
|
|
59514
|
+
}
|
|
59515
|
+
function declLabel(node, kind) {
|
|
59516
|
+
const name = node.name;
|
|
59517
|
+
return name ? `'${name}'` : `this '${kind}'`;
|
|
59518
|
+
}
|
|
59499
59519
|
var SysmlValidator = class _SysmlValidator {
|
|
59500
59520
|
indexManager;
|
|
59501
59521
|
langiumDocuments;
|
|
@@ -59719,6 +59739,7 @@ var SysmlValidator = class _SysmlValidator {
|
|
|
59719
59739
|
this.checkLanguageDisjointness(node, accept);
|
|
59720
59740
|
this.checkKermlWellFormedness(node, accept);
|
|
59721
59741
|
this.checkFilterExpressions(node, accept);
|
|
59742
|
+
this.checkOccurrencePortions(node, accept);
|
|
59722
59743
|
this.checkCrossReferences(node, accept);
|
|
59723
59744
|
this.checkAutoImportSuggestions(node, accept);
|
|
59724
59745
|
this.checkUnits(node, accept);
|
|
@@ -60602,6 +60623,49 @@ ${baseIndent}}`;
|
|
|
60602
60623
|
this.checkTypeComposition(decl, index, accept);
|
|
60603
60624
|
}
|
|
60604
60625
|
}
|
|
60626
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
60627
|
+
// REQ-160 — occurrence portions: `timeslice` / `snapshot` well-formedness
|
|
60628
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
60629
|
+
// The declaration kinds that are NOT occurrences, so a portion of their life is
|
|
60630
|
+
// meaningless. Kept as a deny-list rather than an allow-list because nearly every
|
|
60631
|
+
// SysML usage kind IS an OccurrenceUsage (part, item, action, state, port,
|
|
60632
|
+
// connection, case, …) while the data-valued ones are few and closed: an
|
|
60633
|
+
// AttributeUsage is typed by a DataType and an enumeration is a special attribute,
|
|
60634
|
+
// neither of which has a life to carve up.
|
|
60635
|
+
static NON_OCCURRENCE_OWNER_TYPES = /* @__PURE__ */ new Set(["AttributeDecl", "EnumDecl", "EnumValueDecl", "MetadataDecl", "MultiplicityDecl"]);
|
|
60636
|
+
// REQ-160 — OMG SysML v2 §8.2.2.9 (Occurrences) with the Kernel Semantic Library
|
|
60637
|
+
// `Occurrences::TimeSlice` / `Occurrences::Snapshot`:
|
|
60638
|
+
//
|
|
60639
|
+
// SSM015 — a portion is a portion OF something. Its owning type must be an
|
|
60640
|
+
// occurrence; declared at package level (or inside an attribute /
|
|
60641
|
+
// enumeration body) there is no life for it to be a portion of.
|
|
60642
|
+
// SSM016 — `Snapshot :> TimeSlice` with a zero duration: a snapshot is the
|
|
60643
|
+
// occurrence at ONE instant. Every portion of a zero-duration
|
|
60644
|
+
// occurrence is itself zero-duration, so a snapshot may own further
|
|
60645
|
+
// snapshots but never a `timeslice`.
|
|
60646
|
+
//
|
|
60647
|
+
// Both are structural — they read modifiers and owners only — so they hold
|
|
60648
|
+
// without resolving a single cross-reference.
|
|
60649
|
+
checkOccurrencePortions(node, accept) {
|
|
60650
|
+
for (const child of ast_utils_exports.streamAllContents(node)) {
|
|
60651
|
+
const kind = portionKindOf(child);
|
|
60652
|
+
if (!kind)
|
|
60653
|
+
continue;
|
|
60654
|
+
const label = declLabel(child, kind);
|
|
60655
|
+
const owner = owningTypeOf(child);
|
|
60656
|
+
if (!owner) {
|
|
60657
|
+
accept(severity("SSM015", "error"), `A '${kind}' is a portion of an occurrence's life, so ${label} must be declared inside an occurrence \u2014 not directly in a package.`, { node: child, code: "SSM015" });
|
|
60658
|
+
continue;
|
|
60659
|
+
}
|
|
60660
|
+
if (_SysmlValidator.NON_OCCURRENCE_OWNER_TYPES.has(owner.$type)) {
|
|
60661
|
+
accept(severity("SSM015", "error"), `A '${kind}' is a portion of an occurrence's life, and '${owner.name ?? owner.$type}' is not an occurrence.`, { node: child, code: "SSM015" });
|
|
60662
|
+
continue;
|
|
60663
|
+
}
|
|
60664
|
+
if (kind === "timeslice" && portionKindOf(owner) === "snapshot") {
|
|
60665
|
+
accept(severity("SSM016", "error"), `A 'snapshot' is a zero-duration timeslice, so ${label} cannot be a timeslice of it \u2014 a portion of an instant is itself a snapshot.`, { node: child, code: "SSM016" });
|
|
60666
|
+
}
|
|
60667
|
+
}
|
|
60668
|
+
}
|
|
60605
60669
|
// REQ-328 — KSM008: a `filter` membership condition must be Boolean. Only a
|
|
60606
60670
|
// *definitely* non-Boolean expression is flagged — a string or numeric/quantity
|
|
60607
60671
|
// literal, or an arithmetic/range binary expression. A bare feature path is left
|
|
@@ -68967,7 +69031,7 @@ async function runValidation(command) {
|
|
|
68967
69031
|
}
|
|
68968
69032
|
|
|
68969
69033
|
// src/main.ts
|
|
68970
|
-
var VERSION2 = true ? "0.
|
|
69034
|
+
var VERSION2 = true ? "0.15.0" : "dev";
|
|
68971
69035
|
async function main(argv) {
|
|
68972
69036
|
const command = parseArgs(argv);
|
|
68973
69037
|
if (command.kind === "help") {
|