@primmel/primmel 1.5.0 → 1.5.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.
- package/dist/src/check-rules.d.ts.map +1 -1
- package/dist/src/check-rules.js +7 -1
- package/dist/src/check-rules.js.map +1 -1
- package/dist/src/check.d.ts +13 -0
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +91 -0
- package/dist/src/check.js.map +1 -1
- package/dist/src/ser-des/config/artifact.d.ts.map +1 -1
- package/dist/src/ser-des/config/artifact.js +29 -12
- package/dist/src/ser-des/config/artifact.js.map +1 -1
- package/dist/src/ser-des/config/calculation.d.ts.map +1 -1
- package/dist/src/ser-des/config/calculation.js +21 -6
- package/dist/src/ser-des/config/calculation.js.map +1 -1
- package/dist/src/ser-des/config/competenceKind.d.ts.map +1 -1
- package/dist/src/ser-des/config/competenceKind.js +9 -0
- package/dist/src/ser-des/config/competenceKind.js.map +1 -1
- package/dist/src/ser-des/config/conformanceClass.d.ts.map +1 -1
- package/dist/src/ser-des/config/conformanceClass.js +2 -1
- package/dist/src/ser-des/config/conformanceClass.js.map +1 -1
- package/dist/src/ser-des/config/conformanceTest.d.ts.map +1 -1
- package/dist/src/ser-des/config/conformanceTest.js +11 -23
- package/dist/src/ser-des/config/conformanceTest.js.map +1 -1
- package/dist/src/ser-des/config/constraint.d.ts.map +1 -1
- package/dist/src/ser-des/config/constraint.js +9 -0
- package/dist/src/ser-des/config/constraint.js.map +1 -1
- package/dist/src/ser-des/config/field-parser.d.ts.map +1 -1
- package/dist/src/ser-des/config/field-parser.js +29 -2
- package/dist/src/ser-des/config/field-parser.js.map +1 -1
- package/dist/src/ser-des/config/form.d.ts.map +1 -1
- package/dist/src/ser-des/config/form.js +12 -2
- package/dist/src/ser-des/config/form.js.map +1 -1
- package/dist/src/ser-des/config/formulasUsed.d.ts.map +1 -1
- package/dist/src/ser-des/config/formulasUsed.js +20 -9
- package/dist/src/ser-des/config/formulasUsed.js.map +1 -1
- package/dist/src/ser-des/config/packageManifest.d.ts.map +1 -1
- package/dist/src/ser-des/config/packageManifest.js +5 -2
- package/dist/src/ser-des/config/packageManifest.js.map +1 -1
- package/dist/src/ser-des/config/process.d.ts.map +1 -1
- package/dist/src/ser-des/config/process.js +15 -12
- package/dist/src/ser-des/config/process.js.map +1 -1
- package/dist/src/ser-des/config/ref.d.ts +61 -0
- package/dist/src/ser-des/config/ref.d.ts.map +1 -1
- package/dist/src/ser-des/config/ref.js +133 -0
- package/dist/src/ser-des/config/ref.js.map +1 -1
- package/dist/src/ser-des/config/referenceMaterial.d.ts.map +1 -1
- package/dist/src/ser-des/config/referenceMaterial.js +43 -19
- package/dist/src/ser-des/config/referenceMaterial.js.map +1 -1
- package/dist/src/ser-des/config/requirement.d.ts.map +1 -1
- package/dist/src/ser-des/config/requirement.js +9 -13
- package/dist/src/ser-des/config/requirement.js.map +1 -1
- package/dist/src/ser-des/config/subject.d.ts.map +1 -1
- package/dist/src/ser-des/config/subject.js +160 -21
- package/dist/src/ser-des/config/subject.js.map +1 -1
- package/dist/src/ser-des/config/symbol.d.ts.map +1 -1
- package/dist/src/ser-des/config/symbol.js +10 -1
- package/dist/src/ser-des/config/symbol.js.map +1 -1
- package/dist/src/ser-des/config/table.d.ts.map +1 -1
- package/dist/src/ser-des/config/table.js +10 -8
- package/dist/src/ser-des/config/table.js.map +1 -1
- package/dist/src/ser-des/config/term.d.ts.map +1 -1
- package/dist/src/ser-des/config/term.js +18 -1
- package/dist/src/ser-des/config/term.js.map +1 -1
- package/dist/src/ser-des/config/testPointSet.d.ts.map +1 -1
- package/dist/src/ser-des/config/testPointSet.js +24 -13
- package/dist/src/ser-des/config/testPointSet.js.map +1 -1
- package/dist/src/ser-des/config/testSequence.d.ts.map +1 -1
- package/dist/src/ser-des/config/testSequence.js +19 -7
- package/dist/src/ser-des/config/testSequence.js.map +1 -1
- package/dist/src/ser-des/config/verdict.d.ts.map +1 -1
- package/dist/src/ser-des/config/verdict.js +24 -13
- package/dist/src/ser-des/config/verdict.js.map +1 -1
- package/dist/src/ser-des/parse-block.d.ts +16 -5
- package/dist/src/ser-des/parse-block.d.ts.map +1 -1
- package/dist/src/ser-des/parse-block.js +45 -6
- package/dist/src/ser-des/parse-block.js.map +1 -1
- package/dist/src/types/Artifact.d.ts +6 -0
- package/dist/src/types/Artifact.d.ts.map +1 -1
- package/dist/src/types/Calculation.d.ts +2 -0
- package/dist/src/types/Calculation.d.ts.map +1 -1
- package/dist/src/types/CompetenceKind.d.ts +3 -0
- package/dist/src/types/CompetenceKind.d.ts.map +1 -1
- package/dist/src/types/Constraint.d.ts +3 -0
- package/dist/src/types/Constraint.d.ts.map +1 -1
- package/dist/src/types/Form.d.ts +3 -0
- package/dist/src/types/Form.d.ts.map +1 -1
- package/dist/src/types/FormulasUsed.d.ts +2 -0
- package/dist/src/types/FormulasUsed.d.ts.map +1 -1
- package/dist/src/types/Invariant.d.ts +1 -0
- package/dist/src/types/Invariant.d.ts.map +1 -1
- package/dist/src/types/ReferenceMaterial.d.ts +7 -0
- package/dist/src/types/ReferenceMaterial.d.ts.map +1 -1
- package/dist/src/types/Subject.d.ts +22 -0
- package/dist/src/types/Subject.d.ts.map +1 -1
- package/dist/src/types/Symbol.d.ts +4 -0
- package/dist/src/types/Symbol.d.ts.map +1 -1
- package/dist/src/types/Table.d.ts +4 -0
- package/dist/src/types/Table.d.ts.map +1 -1
- package/dist/src/types/Term.d.ts +2 -0
- package/dist/src/types/Term.d.ts.map +1 -1
- package/dist/src/types/TestPointSet.d.ts +4 -0
- package/dist/src/types/TestPointSet.d.ts.map +1 -1
- package/dist/src/types/TestSequence.d.ts +2 -0
- package/dist/src/types/TestSequence.d.ts.map +1 -1
- package/dist/src/types/Verdict.d.ts +4 -0
- package/dist/src/types/Verdict.d.ts.map +1 -1
- package/dist/src/types/process.d.ts +3 -0
- package/dist/src/types/process.d.ts.map +1 -1
- package/dist/src/validate.js +9 -1
- package/dist/src/validate.js.map +1 -1
- package/dist-browser/index.mjs +1768 -1507
- package/dist-cli/primmel.mjs +572 -124
- package/package.json +1 -1
package/dist-cli/primmel.mjs
CHANGED
|
@@ -389,11 +389,39 @@ function forEachEntry(data, visitor, errCtx) {
|
|
|
389
389
|
`Parsing error: ${errCtx.construct}. ID ${errCtx.id}: Expecting value for ${keyword}`
|
|
390
390
|
);
|
|
391
391
|
}
|
|
392
|
-
const claimed = visitor(
|
|
392
|
+
const claimed = visitor(
|
|
393
|
+
keyword,
|
|
394
|
+
() => t[i++],
|
|
395
|
+
() => t[i]
|
|
396
|
+
);
|
|
393
397
|
if (!claimed) {
|
|
398
|
+
if (keyword === "ref") {
|
|
399
|
+
i++;
|
|
400
|
+
i++;
|
|
401
|
+
if (i < t.length && t[i].startsWith("{")) {
|
|
402
|
+
i++;
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
i++;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function skipUnknownValue(t, i, keyword) {
|
|
411
|
+
if (keyword === "ref") {
|
|
412
|
+
i++;
|
|
413
|
+
if (i < t.length) {
|
|
394
414
|
i++;
|
|
395
415
|
}
|
|
416
|
+
if (i < t.length && t[i].startsWith("{")) {
|
|
417
|
+
i++;
|
|
418
|
+
}
|
|
419
|
+
return i;
|
|
420
|
+
}
|
|
421
|
+
if (i < t.length) {
|
|
422
|
+
i++;
|
|
396
423
|
}
|
|
424
|
+
return i;
|
|
397
425
|
}
|
|
398
426
|
function forEachAttribute(data, visitor, errCtx) {
|
|
399
427
|
if (data === "") {
|
|
@@ -1080,6 +1108,125 @@ var parseMetadata = function(token) {
|
|
|
1080
1108
|
};
|
|
1081
1109
|
};
|
|
1082
1110
|
|
|
1111
|
+
// src/ser-des/config/ref.ts
|
|
1112
|
+
function parseRef(t, i, stripWrapping2, unwrapBlock2) {
|
|
1113
|
+
const predicate = stripWrapping2(t[i++] ?? "");
|
|
1114
|
+
const target = stripWrapping2(t[i++] ?? "");
|
|
1115
|
+
const ref = { predicate, target };
|
|
1116
|
+
if (i < t.length && t[i].startsWith("{")) {
|
|
1117
|
+
const block = unwrapBlock2(t[i++]);
|
|
1118
|
+
const m = /note\s+"([^"]*)"/.exec(block) ?? /note\s+(\S+)/.exec(block);
|
|
1119
|
+
if (m) {
|
|
1120
|
+
ref.note = m[1];
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
return { ref, next: i };
|
|
1124
|
+
}
|
|
1125
|
+
function parseRefFromReaders(value, peek, stripWrapping2, unwrapBlock2) {
|
|
1126
|
+
const parts = [value(), value()];
|
|
1127
|
+
const next = peek();
|
|
1128
|
+
if (next && next.startsWith("{")) {
|
|
1129
|
+
parts.push(value());
|
|
1130
|
+
}
|
|
1131
|
+
return parseRef(parts, 0, stripWrapping2, unwrapBlock2).ref;
|
|
1132
|
+
}
|
|
1133
|
+
function dumpRefs(refs, indent, escapeString2) {
|
|
1134
|
+
if (!refs || refs.length === 0) {
|
|
1135
|
+
return "";
|
|
1136
|
+
}
|
|
1137
|
+
let out = "";
|
|
1138
|
+
for (const r of refs) {
|
|
1139
|
+
out += `${indent}ref ${r.predicate} "${escapeString2(r.target)}"`;
|
|
1140
|
+
out += r.note ? ` {
|
|
1141
|
+
${indent} note "${escapeString2(r.note)}"
|
|
1142
|
+
${indent}}
|
|
1143
|
+
` : "\n";
|
|
1144
|
+
}
|
|
1145
|
+
return out;
|
|
1146
|
+
}
|
|
1147
|
+
function refTargetToSourceRef(target) {
|
|
1148
|
+
const m = /^(urn:[^#]+)(?:#(.+))?$/.exec(target);
|
|
1149
|
+
if (!m) {
|
|
1150
|
+
return null;
|
|
1151
|
+
}
|
|
1152
|
+
const anchor = m[2];
|
|
1153
|
+
if (!anchor) {
|
|
1154
|
+
return { doc: target, clause: "" };
|
|
1155
|
+
}
|
|
1156
|
+
if (anchor.startsWith("clause-")) {
|
|
1157
|
+
const rest = anchor.slice("clause-".length);
|
|
1158
|
+
const slash = rest.indexOf("/");
|
|
1159
|
+
if (slash >= 0) {
|
|
1160
|
+
return {
|
|
1161
|
+
doc: m[1],
|
|
1162
|
+
clause: rest.slice(0, slash),
|
|
1163
|
+
fragment: rest.slice(slash + 1)
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
return { doc: m[1], clause: rest };
|
|
1167
|
+
}
|
|
1168
|
+
return { doc: target, clause: "" };
|
|
1169
|
+
}
|
|
1170
|
+
function foldRefIntoLegacy(el, ref) {
|
|
1171
|
+
if (ref.predicate === "derives-from") {
|
|
1172
|
+
const roleChannel = el.fieldReferences ?? el.formReferences;
|
|
1173
|
+
const hasProvenanceSlot = "source" in el || "sourceRef" in el || el.sourceRefs !== void 0;
|
|
1174
|
+
if (roleChannel && !hasProvenanceSlot) {
|
|
1175
|
+
roleChannel.push({ urn: ref.target, role: "source" });
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1178
|
+
const b = refTargetToSourceRef(ref.target);
|
|
1179
|
+
if (!b) {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
(el.sourceRefs ??= []).push(b);
|
|
1183
|
+
if ("source" in el && !el.source) {
|
|
1184
|
+
el.source = b;
|
|
1185
|
+
}
|
|
1186
|
+
if ("sourceRef" in el && !el.sourceRef) {
|
|
1187
|
+
el.sourceRef = b;
|
|
1188
|
+
}
|
|
1189
|
+
if ("reference" in el && !el.reference) {
|
|
1190
|
+
el.reference = b.doc;
|
|
1191
|
+
}
|
|
1192
|
+
return true;
|
|
1193
|
+
}
|
|
1194
|
+
if (ref.predicate === "cites") {
|
|
1195
|
+
if (el.fieldReferences) {
|
|
1196
|
+
el.fieldReferences.push({ urn: ref.target, role: "reference" });
|
|
1197
|
+
} else if (el.formReferences) {
|
|
1198
|
+
el.formReferences.push({ urn: ref.target, role: "reference" });
|
|
1199
|
+
} else if (el.referenceIds) {
|
|
1200
|
+
el.referenceIds.push(ref.target);
|
|
1201
|
+
}
|
|
1202
|
+
return true;
|
|
1203
|
+
}
|
|
1204
|
+
const CITATION_ROLES = [
|
|
1205
|
+
"requirement",
|
|
1206
|
+
"test-procedure",
|
|
1207
|
+
"calculation",
|
|
1208
|
+
"report-format",
|
|
1209
|
+
"method"
|
|
1210
|
+
];
|
|
1211
|
+
if (CITATION_ROLES.includes(ref.predicate)) {
|
|
1212
|
+
const channel = el.fieldReferences ?? el.formReferences;
|
|
1213
|
+
if (!channel) {
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
channel.push({ urn: ref.target, role: ref.predicate });
|
|
1217
|
+
return true;
|
|
1218
|
+
}
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1221
|
+
function dumpSourceRefAsRef(src, indent, escapeString2) {
|
|
1222
|
+
if (src.doc && src.doc.startsWith("urn:")) {
|
|
1223
|
+
const anchor = `${src.doc}${src.clause ? "#clause-" + src.clause : ""}${src.fragment ? "/" + src.fragment : ""}`;
|
|
1224
|
+
return `${indent}ref derives-from "${escapeString2(anchor)}"
|
|
1225
|
+
`;
|
|
1226
|
+
}
|
|
1227
|
+
return `${indent}source { doc "${escapeString2(src.doc ?? "")}" clause "${escapeString2(String(src.clause ?? ""))}"` + (src.fragment ? ` fragment "${escapeString2(src.fragment)}"` : "") + " }\n";
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1083
1230
|
// src/ser-des/config/series.ts
|
|
1084
1231
|
function parseSeriesDecl(block) {
|
|
1085
1232
|
const decl = { axes: [], cellSymbol: "", cellUnit: "" };
|
|
@@ -1168,21 +1315,6 @@ function dumpSeriesDecl(decl) {
|
|
|
1168
1315
|
return out;
|
|
1169
1316
|
}
|
|
1170
1317
|
|
|
1171
|
-
// src/ser-des/config/ref.ts
|
|
1172
|
-
function parseRef(t, i, stripWrapping2, unwrapBlock2) {
|
|
1173
|
-
const predicate = stripWrapping2(t[i++] ?? "");
|
|
1174
|
-
const target = stripWrapping2(t[i++] ?? "");
|
|
1175
|
-
const ref = { predicate, target };
|
|
1176
|
-
if (i < t.length && t[i].startsWith("{")) {
|
|
1177
|
-
const block = unwrapBlock2(t[i++]);
|
|
1178
|
-
const m = /note\s+"([^"]*)"/.exec(block) ?? /note\s+(\S+)/.exec(block);
|
|
1179
|
-
if (m) {
|
|
1180
|
-
ref.note = m[1];
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
return { ref, next: i };
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
1318
|
// src/ser-des/config/sourceDiscrepancy.ts
|
|
1187
1319
|
var VALID_RESOLUTIONS = ["follows_clause_x", "annotated_only"];
|
|
1188
1320
|
function parseSourceDiscrepancy(block) {
|
|
@@ -1499,7 +1631,9 @@ function parseFormField(name, block, type) {
|
|
|
1499
1631
|
field.fieldReferences = parseRoleReferences(unwrapBlock(t[i++]));
|
|
1500
1632
|
} else if (cmd === "ref") {
|
|
1501
1633
|
const r = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
1502
|
-
field
|
|
1634
|
+
if (!foldRefIntoLegacy(field, r.ref)) {
|
|
1635
|
+
field.refs.push(r.ref);
|
|
1636
|
+
}
|
|
1503
1637
|
i = r.next;
|
|
1504
1638
|
} else if (cmd === "specification_reference") {
|
|
1505
1639
|
field.specificationReference = stripWrapping(t[i++]);
|
|
@@ -1830,10 +1964,17 @@ function dumpFormField(field, indent) {
|
|
|
1830
1964
|
if (field.targets.length > 0) {
|
|
1831
1965
|
inner.push("targets { " + field.targets.join(" ") + " }");
|
|
1832
1966
|
}
|
|
1967
|
+
if (field.sourceRefs && field.sourceRefs.length > 0) {
|
|
1968
|
+
for (const s of field.sourceRefs) {
|
|
1969
|
+
inner.push(dumpSourceRefAsRef(s, "", escapeString).trimEnd());
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1833
1972
|
if (field.fieldReferences.length > 0) {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1973
|
+
for (const r of field.fieldReferences) {
|
|
1974
|
+
inner.push(
|
|
1975
|
+
"ref " + roleToPredicateForDump(r.role) + ' "' + escapeString(r.urn) + '"'
|
|
1976
|
+
);
|
|
1977
|
+
}
|
|
1837
1978
|
}
|
|
1838
1979
|
if (field.refs && field.refs.length > 0) {
|
|
1839
1980
|
for (const r of field.refs) {
|
|
@@ -1908,19 +2049,14 @@ function parseRoleReferences(block) {
|
|
|
1908
2049
|
}
|
|
1909
2050
|
return out;
|
|
1910
2051
|
}
|
|
1911
|
-
function
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
for (const r of refs) {
|
|
1915
|
-
if (!byRole.has(r.role)) {
|
|
1916
|
-
byRole.set(r.role, []);
|
|
1917
|
-
roles.push(r.role);
|
|
1918
|
-
}
|
|
1919
|
-
byRole.get(r.role).push(r.urn);
|
|
2052
|
+
function roleToPredicateForDump(role) {
|
|
2053
|
+
if (role === "source") {
|
|
2054
|
+
return "derives-from";
|
|
1920
2055
|
}
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2056
|
+
if (role === "reference") {
|
|
2057
|
+
return "cites";
|
|
2058
|
+
}
|
|
2059
|
+
return role;
|
|
1924
2060
|
}
|
|
1925
2061
|
|
|
1926
2062
|
// src/ser-des/config/quantity.ts
|
|
@@ -2220,7 +2356,7 @@ function parseProcessInstances(block) {
|
|
|
2220
2356
|
}
|
|
2221
2357
|
}
|
|
2222
2358
|
} else {
|
|
2223
|
-
|
|
2359
|
+
i = skipUnknownValue(t, i, cmd);
|
|
2224
2360
|
}
|
|
2225
2361
|
}
|
|
2226
2362
|
return out;
|
|
@@ -2468,7 +2604,7 @@ var parseProcess = function(id, data) {
|
|
|
2468
2604
|
}
|
|
2469
2605
|
forEachEntry(
|
|
2470
2606
|
data,
|
|
2471
|
-
(keyword, value) => {
|
|
2607
|
+
(keyword, value, peek) => {
|
|
2472
2608
|
if (keyword === "modality") {
|
|
2473
2609
|
result.modality = value();
|
|
2474
2610
|
} else if (keyword === "name") {
|
|
@@ -2537,6 +2673,11 @@ var parseProcess = function(id, data) {
|
|
|
2537
2673
|
result.source = src;
|
|
2538
2674
|
}
|
|
2539
2675
|
(result.sourceRefs ??= []).push(src);
|
|
2676
|
+
} else if (keyword === "ref") {
|
|
2677
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
2678
|
+
if (!foldRefIntoLegacy(result, r)) {
|
|
2679
|
+
(result.refs ??= []).push(r);
|
|
2680
|
+
}
|
|
2540
2681
|
} else {
|
|
2541
2682
|
return false;
|
|
2542
2683
|
}
|
|
@@ -2801,8 +2942,9 @@ var dumpProcess = function(process2, ctx) {
|
|
|
2801
2942
|
out += dumpDoes(process2.does);
|
|
2802
2943
|
}
|
|
2803
2944
|
for (const src of process2.sourceRefs ?? (process2.source && (process2.source.doc || process2.source.clause) ? [process2.source] : [])) {
|
|
2804
|
-
out +=
|
|
2945
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
2805
2946
|
}
|
|
2947
|
+
out += dumpRefs(process2.refs, " ", escapeString);
|
|
2806
2948
|
if (process2.parent && (process2.children.length === 0 || !ctx?.nested)) {
|
|
2807
2949
|
out += " parent " + process2.parent + "\n";
|
|
2808
2950
|
}
|
|
@@ -3544,6 +3686,12 @@ var parseTable = function(id, data) {
|
|
|
3544
3686
|
} else if (command === "data") {
|
|
3545
3687
|
const dataBlock = unwrapBlock(t[i++]);
|
|
3546
3688
|
result.data = parseTableData(dataBlock);
|
|
3689
|
+
} else if (command === "ref") {
|
|
3690
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
3691
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
3692
|
+
(result.refs ??= []).push(rr.ref);
|
|
3693
|
+
}
|
|
3694
|
+
i = rr.next;
|
|
3547
3695
|
} else {
|
|
3548
3696
|
i++;
|
|
3549
3697
|
}
|
|
@@ -3611,7 +3759,7 @@ var dumpTable = function(t) {
|
|
|
3611
3759
|
out += ' display "' + t.display + '"\n';
|
|
3612
3760
|
}
|
|
3613
3761
|
for (const src of t.sourceRefs ?? (t.sourceRef && (t.sourceRef.doc || t.sourceRef.clause) ? [t.sourceRef] : [])) {
|
|
3614
|
-
out +=
|
|
3762
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
3615
3763
|
}
|
|
3616
3764
|
if (t.sourceDiscrepancy) {
|
|
3617
3765
|
out += dumpSourceDiscrepancy(t.sourceDiscrepancy, " ") + "\n";
|
|
@@ -4134,7 +4282,9 @@ var parseForm = function(id, data) {
|
|
|
4134
4282
|
result.formReferences = parseRoleReferences(unwrapBlock(t[i++]));
|
|
4135
4283
|
} else if (command === "ref") {
|
|
4136
4284
|
const r = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
4137
|
-
|
|
4285
|
+
if (!foldRefIntoLegacy(result, r.ref)) {
|
|
4286
|
+
result.refs = [...result.refs ?? [], r.ref];
|
|
4287
|
+
}
|
|
4138
4288
|
i = r.next;
|
|
4139
4289
|
} else if (command === "calculation_context") {
|
|
4140
4290
|
result.calculationContext = parseCalculationContext(
|
|
@@ -4418,7 +4568,10 @@ var dumpForm = function(f) {
|
|
|
4418
4568
|
out += " report_rows { field " + f.reportRows.field + " item_key " + f.reportRows.itemKey + " }\n";
|
|
4419
4569
|
}
|
|
4420
4570
|
if (f.formReferences.length > 0) {
|
|
4421
|
-
|
|
4571
|
+
for (const r of f.formReferences) {
|
|
4572
|
+
const pred = r.role === "source" ? "derives-from" : r.role === "reference" ? "cites" : r.role;
|
|
4573
|
+
out += " ref " + pred + ' "' + escapeString(r.urn) + '"\n';
|
|
4574
|
+
}
|
|
4422
4575
|
}
|
|
4423
4576
|
if (f.refs && f.refs.length > 0) {
|
|
4424
4577
|
for (const r of f.refs) {
|
|
@@ -4689,7 +4842,14 @@ var parseSymbol = function(id, data) {
|
|
|
4689
4842
|
};
|
|
4690
4843
|
forEachEntry(
|
|
4691
4844
|
data,
|
|
4692
|
-
(command, value) => {
|
|
4845
|
+
(command, value, peek) => {
|
|
4846
|
+
if (command === "ref") {
|
|
4847
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
4848
|
+
if (!foldRefIntoLegacy(result, r)) {
|
|
4849
|
+
(result.refs ??= []).push(r);
|
|
4850
|
+
}
|
|
4851
|
+
return true;
|
|
4852
|
+
}
|
|
4693
4853
|
if (command === "name") {
|
|
4694
4854
|
result.name = unwrapped(value);
|
|
4695
4855
|
} else if (command === "definition") {
|
|
@@ -4859,7 +5019,11 @@ var parseCalculation = function(id, data) {
|
|
|
4859
5019
|
ref: [],
|
|
4860
5020
|
_relations: {
|
|
4861
5021
|
ref: []
|
|
4862
|
-
}
|
|
5022
|
+
},
|
|
5023
|
+
// Initialized so the ref fold (docs/primmel/18 §18.4) mirrors the
|
|
5024
|
+
// first derives-from block here — the fold only mirrors slots the
|
|
5025
|
+
// object already carries.
|
|
5026
|
+
sourceRef: null
|
|
4863
5027
|
};
|
|
4864
5028
|
if (data !== "") {
|
|
4865
5029
|
const t = tokenizePackage(data);
|
|
@@ -4883,6 +5047,12 @@ var parseCalculation = function(id, data) {
|
|
|
4883
5047
|
result.expression = unwrapBlock(t[i++]);
|
|
4884
5048
|
} else if (command === "reference") {
|
|
4885
5049
|
result._relations.ref = tokenizePackage(t[i++]);
|
|
5050
|
+
} else if (command === "ref") {
|
|
5051
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
5052
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
5053
|
+
(result.refs ??= []).push(rr.ref);
|
|
5054
|
+
}
|
|
5055
|
+
i = rr.next;
|
|
4886
5056
|
} else if (command === "source") {
|
|
4887
5057
|
const inner = tokenize(unwrapBlock(t[i++]));
|
|
4888
5058
|
const src = {
|
|
@@ -5149,7 +5319,10 @@ var dumpCalculation = function(c) {
|
|
|
5149
5319
|
out += " profile " + c.profile + "\n";
|
|
5150
5320
|
}
|
|
5151
5321
|
for (const src of c.sourceRefs ?? (c.sourceRef && (c.sourceRef.doc || c.sourceRef.clause) ? [c.sourceRef] : [])) {
|
|
5152
|
-
out +=
|
|
5322
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
5323
|
+
}
|
|
5324
|
+
for (const r of c.refs ?? []) {
|
|
5325
|
+
out += " ref " + r.predicate + ' "' + escapeString(r.target) + '"' + (r.note ? ' { note "' + escapeString(r.note) + '" }' : "") + "\n";
|
|
5153
5326
|
}
|
|
5154
5327
|
if (c.ref.length > 0) {
|
|
5155
5328
|
out += " reference {\n";
|
|
@@ -6430,6 +6603,12 @@ var parseCompetenceKind = function(id, data) {
|
|
|
6430
6603
|
);
|
|
6431
6604
|
}
|
|
6432
6605
|
result.methodStandards.push({ id: stdId, title: readValue(t[i++]) });
|
|
6606
|
+
} else if (keyword === "ref") {
|
|
6607
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
6608
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
6609
|
+
(result.refs ??= []).push(rr.ref);
|
|
6610
|
+
}
|
|
6611
|
+
i = rr.next;
|
|
6433
6612
|
} else {
|
|
6434
6613
|
i++;
|
|
6435
6614
|
}
|
|
@@ -6834,11 +7013,15 @@ var parseConformanceTest = function(id, data) {
|
|
|
6834
7013
|
inheritsFrom: "",
|
|
6835
7014
|
resultForms: [],
|
|
6836
7015
|
derivedValues: [],
|
|
6837
|
-
sourceDiscrepancy: null
|
|
7016
|
+
sourceDiscrepancy: null,
|
|
7017
|
+
// The singular provenance slot is initialized so the ref fold
|
|
7018
|
+
// (docs/primmel/18 §18.4) mirrors the first derives-from block into
|
|
7019
|
+
// it — the fold only mirrors slots the object already carries.
|
|
7020
|
+
sourceRef: null
|
|
6838
7021
|
};
|
|
6839
7022
|
forEachEntry(
|
|
6840
7023
|
data,
|
|
6841
|
-
(keyword, value) => {
|
|
7024
|
+
(keyword, value, peek) => {
|
|
6842
7025
|
if (keyword === "name") {
|
|
6843
7026
|
result.name = unwrapped(value);
|
|
6844
7027
|
} else if (keyword === "purpose") {
|
|
@@ -6889,10 +7072,10 @@ var parseConformanceTest = function(id, data) {
|
|
|
6889
7072
|
} else if (keyword === "targets") {
|
|
6890
7073
|
result.targets = tokenizePackage(value());
|
|
6891
7074
|
} else if (keyword === "ref") {
|
|
6892
|
-
const
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
7075
|
+
const rr = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
7076
|
+
if (!foldRefIntoLegacy(result, rr)) {
|
|
7077
|
+
(result.refs ??= []).push(rr);
|
|
7078
|
+
}
|
|
6896
7079
|
} else if (keyword === "binds_to") {
|
|
6897
7080
|
result.bindsTo = tokenizePackage(value());
|
|
6898
7081
|
} else if (keyword === "applicability") {
|
|
@@ -7012,10 +7195,10 @@ var dumpConformanceTest = function(ct) {
|
|
|
7012
7195
|
}
|
|
7013
7196
|
if (ct.sourceRefs && ct.sourceRefs.length > 0) {
|
|
7014
7197
|
for (const src of ct.sourceRefs) {
|
|
7015
|
-
out +=
|
|
7198
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
7016
7199
|
}
|
|
7017
7200
|
} else if (ct.sourceRef && ct.sourceRef.doc) {
|
|
7018
|
-
out +=
|
|
7201
|
+
out += dumpSourceRefAsRef(ct.sourceRef, " ", escapeString);
|
|
7019
7202
|
} else if (ct.reference) {
|
|
7020
7203
|
out += " reference " + ct.reference + "\n";
|
|
7021
7204
|
}
|
|
@@ -7267,7 +7450,18 @@ var parseTerm = function(id, data) {
|
|
|
7267
7450
|
};
|
|
7268
7451
|
forEachEntry(
|
|
7269
7452
|
data,
|
|
7270
|
-
(command, value) => {
|
|
7453
|
+
(command, value, peek) => {
|
|
7454
|
+
if (command === "ref") {
|
|
7455
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
7456
|
+
if (r.predicate === "derives-from" && !result.source) {
|
|
7457
|
+
result.source = r.target;
|
|
7458
|
+
} else if (r.predicate === "cites") {
|
|
7459
|
+
result.referenceIds.push(r.target);
|
|
7460
|
+
} else {
|
|
7461
|
+
(result.refs ??= []).push(r);
|
|
7462
|
+
}
|
|
7463
|
+
return true;
|
|
7464
|
+
}
|
|
7271
7465
|
if (command === "label") {
|
|
7272
7466
|
result.label = unwrapped(value);
|
|
7273
7467
|
} else if (command === "definition") {
|
|
@@ -7413,7 +7607,7 @@ var parseVerdict = function(id, data) {
|
|
|
7413
7607
|
};
|
|
7414
7608
|
forEachEntry(
|
|
7415
7609
|
data,
|
|
7416
|
-
(keyword, value) => {
|
|
7610
|
+
(keyword, value, peek) => {
|
|
7417
7611
|
if (keyword === "quantity") {
|
|
7418
7612
|
const qt = tokenize(unwrapBlock(value()));
|
|
7419
7613
|
let j = 0;
|
|
@@ -7451,7 +7645,16 @@ var parseVerdict = function(id, data) {
|
|
|
7451
7645
|
} else if (keyword === "acceptance") {
|
|
7452
7646
|
result.acceptance = parseAcceptance(unwrapBlock(value()));
|
|
7453
7647
|
} else if (keyword === "source" || keyword === "reference") {
|
|
7454
|
-
|
|
7648
|
+
const src = readSource(unwrapBlock(value()));
|
|
7649
|
+
(result.sourceRefs ??= []).push(src);
|
|
7650
|
+
if (!result.source) {
|
|
7651
|
+
result.source = src;
|
|
7652
|
+
}
|
|
7653
|
+
} else if (keyword === "ref") {
|
|
7654
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
7655
|
+
if (!foldRefIntoLegacy(result, r)) {
|
|
7656
|
+
(result.refs ??= []).push(r);
|
|
7657
|
+
}
|
|
7455
7658
|
} else {
|
|
7456
7659
|
return false;
|
|
7457
7660
|
}
|
|
@@ -7491,9 +7694,11 @@ var dumpVerdict = function(v) {
|
|
|
7491
7694
|
if (v.acceptance) {
|
|
7492
7695
|
out += dumpAcceptance(v.acceptance, " ") + "\n";
|
|
7493
7696
|
}
|
|
7494
|
-
|
|
7495
|
-
|
|
7697
|
+
const verdictSources = v.sourceRefs && v.sourceRefs.length > 0 ? v.sourceRefs : v.source && (v.source.doc || v.source.clause) ? [v.source] : [];
|
|
7698
|
+
for (const s of verdictSources) {
|
|
7699
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7496
7700
|
}
|
|
7701
|
+
out += dumpRefs(v.refs, " ", escapeString);
|
|
7497
7702
|
out += "}\n";
|
|
7498
7703
|
return out;
|
|
7499
7704
|
};
|
|
@@ -7535,7 +7740,7 @@ function parseIdentityFields(block) {
|
|
|
7535
7740
|
} else if (fc === "required") {
|
|
7536
7741
|
field.required = stripWrapping(ft[j++]) === "true";
|
|
7537
7742
|
} else {
|
|
7538
|
-
|
|
7743
|
+
j = skipUnknownValue(ft, j, fc);
|
|
7539
7744
|
}
|
|
7540
7745
|
}
|
|
7541
7746
|
}
|
|
@@ -7615,8 +7820,17 @@ function parseConstraints(block) {
|
|
|
7615
7820
|
c.onViolation = stripWrapping(ct[j++]);
|
|
7616
7821
|
} else if (cc === "source") {
|
|
7617
7822
|
c.source = readSource(unwrapBlock(ct[j++]));
|
|
7823
|
+
} else if (cc === "ref") {
|
|
7824
|
+
const rr = parseRef(ct, j, stripWrapping, unwrapBlock);
|
|
7825
|
+
j = rr.next;
|
|
7826
|
+
if (rr.ref.predicate === "derives-from" && !c.source) {
|
|
7827
|
+
const b = refTargetToSourceRef(rr.ref.target);
|
|
7828
|
+
if (b) {
|
|
7829
|
+
c.source = b;
|
|
7830
|
+
}
|
|
7831
|
+
}
|
|
7618
7832
|
} else {
|
|
7619
|
-
|
|
7833
|
+
j = skipUnknownValue(ct, j, cc);
|
|
7620
7834
|
}
|
|
7621
7835
|
}
|
|
7622
7836
|
}
|
|
@@ -7636,7 +7850,7 @@ var parseReferenceMaterial = function(id, data) {
|
|
|
7636
7850
|
};
|
|
7637
7851
|
forEachEntry(
|
|
7638
7852
|
data,
|
|
7639
|
-
(keyword, value) => {
|
|
7853
|
+
(keyword, value, peek) => {
|
|
7640
7854
|
if (keyword === "kind") {
|
|
7641
7855
|
result.kind = stripWrapping(value());
|
|
7642
7856
|
} else if (keyword === "name") {
|
|
@@ -7644,7 +7858,16 @@ var parseReferenceMaterial = function(id, data) {
|
|
|
7644
7858
|
} else if (keyword === "definition") {
|
|
7645
7859
|
result.definition = unwrapped(value);
|
|
7646
7860
|
} else if (keyword === "source") {
|
|
7647
|
-
|
|
7861
|
+
const src = readSource(unwrapBlock(value()));
|
|
7862
|
+
(result.sourceRefs ??= []).push(src);
|
|
7863
|
+
if (!result.source) {
|
|
7864
|
+
result.source = src;
|
|
7865
|
+
}
|
|
7866
|
+
} else if (keyword === "ref") {
|
|
7867
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
7868
|
+
if (!foldRefIntoLegacy(result, r)) {
|
|
7869
|
+
(result.refs ??= []).push(r);
|
|
7870
|
+
}
|
|
7648
7871
|
} else if (keyword === "identity_fields") {
|
|
7649
7872
|
result.identityFields = parseIdentityFields(unwrapBlock(value()));
|
|
7650
7873
|
} else if (keyword === "constraints") {
|
|
@@ -7661,12 +7884,6 @@ var parseReferenceMaterial = function(id, data) {
|
|
|
7661
7884
|
return ctx;
|
|
7662
7885
|
};
|
|
7663
7886
|
};
|
|
7664
|
-
function dumpSource(src, indent) {
|
|
7665
|
-
if (!src || !src.doc && !src.clause) {
|
|
7666
|
-
return "";
|
|
7667
|
-
}
|
|
7668
|
-
return indent + 'source { doc "' + escapeString(src.doc) + '" clause "' + escapeString(src.clause) + '"' + (src.fragment ? ' fragment "' + escapeString(src.fragment) + '"' : "") + " }\n";
|
|
7669
|
-
}
|
|
7670
7887
|
var dumpReferenceMaterial = function(m) {
|
|
7671
7888
|
let out = "reference_material " + m.id + " {\n";
|
|
7672
7889
|
if (m.kind) {
|
|
@@ -7678,7 +7895,11 @@ var dumpReferenceMaterial = function(m) {
|
|
|
7678
7895
|
if (m.definition) {
|
|
7679
7896
|
out += ' definition "' + escapeString(m.definition) + '"\n';
|
|
7680
7897
|
}
|
|
7681
|
-
|
|
7898
|
+
const rmSources = m.sourceRefs && m.sourceRefs.length > 0 ? m.sourceRefs : m.source ? [m.source] : [];
|
|
7899
|
+
for (const s of rmSources) {
|
|
7900
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7901
|
+
}
|
|
7902
|
+
out += dumpRefs(m.refs, " ", escapeString);
|
|
7682
7903
|
if (m.identityFields.length > 0) {
|
|
7683
7904
|
out += " identity_fields {\n";
|
|
7684
7905
|
for (const f of m.identityFields) {
|
|
@@ -7724,7 +7945,9 @@ var dumpReferenceMaterial = function(m) {
|
|
|
7724
7945
|
if (c.onViolation) {
|
|
7725
7946
|
out += " on_violation " + c.onViolation + "\n";
|
|
7726
7947
|
}
|
|
7727
|
-
|
|
7948
|
+
if (c.source && (c.source.doc || c.source.clause)) {
|
|
7949
|
+
out += dumpSourceRefAsRef(c.source, " ", escapeString);
|
|
7950
|
+
}
|
|
7728
7951
|
out += " }\n";
|
|
7729
7952
|
}
|
|
7730
7953
|
out += " }\n";
|
|
@@ -7859,6 +8082,12 @@ var parseConstraint = function(id, data) {
|
|
|
7859
8082
|
result.onViolation = stripWrapping(t[i++]);
|
|
7860
8083
|
} else if (keyword === "source") {
|
|
7861
8084
|
result.source = readSource(unwrapBlock(t[i++]));
|
|
8085
|
+
} else if (keyword === "ref") {
|
|
8086
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
8087
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
8088
|
+
(result.refs ??= []).push(rr.ref);
|
|
8089
|
+
}
|
|
8090
|
+
i = rr.next;
|
|
7862
8091
|
} else {
|
|
7863
8092
|
i++;
|
|
7864
8093
|
}
|
|
@@ -8057,11 +8286,20 @@ var parseTestPointSet = function(id, data) {
|
|
|
8057
8286
|
};
|
|
8058
8287
|
forEachEntry(
|
|
8059
8288
|
data,
|
|
8060
|
-
(keyword, value) => {
|
|
8289
|
+
(keyword, value, peek) => {
|
|
8061
8290
|
if (keyword === "description") {
|
|
8062
8291
|
result.description = unwrapped(value);
|
|
8063
8292
|
} else if (keyword === "source") {
|
|
8064
|
-
|
|
8293
|
+
const src = readSource(unwrapBlock(value()));
|
|
8294
|
+
(result.sourceRefs ??= []).push(src);
|
|
8295
|
+
if (!result.source) {
|
|
8296
|
+
result.source = src;
|
|
8297
|
+
}
|
|
8298
|
+
} else if (keyword === "ref") {
|
|
8299
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
8300
|
+
if (!foldRefIntoLegacy(result, r)) {
|
|
8301
|
+
(result.refs ??= []).push(r);
|
|
8302
|
+
}
|
|
8065
8303
|
} else if (keyword === "cardinality") {
|
|
8066
8304
|
result.cardinality = parseCardinality(unwrapBlock(value()));
|
|
8067
8305
|
} else if (keyword === "repetitions_per_point") {
|
|
@@ -8085,9 +8323,11 @@ var dumpTestPointSet = function(s) {
|
|
|
8085
8323
|
if (s.description) {
|
|
8086
8324
|
out += ' description "' + escapeString(s.description) + '"\n';
|
|
8087
8325
|
}
|
|
8088
|
-
|
|
8089
|
-
|
|
8326
|
+
const tpsSources = s.sourceRefs && s.sourceRefs.length > 0 ? s.sourceRefs : s.source && (s.source.doc || s.source.clause) ? [s.source] : [];
|
|
8327
|
+
for (const src of tpsSources) {
|
|
8328
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
8090
8329
|
}
|
|
8330
|
+
out += dumpRefs(s.refs, " ", escapeString);
|
|
8091
8331
|
const ckeys = Object.keys(s.cardinality);
|
|
8092
8332
|
if (ckeys.length > 0) {
|
|
8093
8333
|
out += " cardinality {\n";
|
|
@@ -8155,7 +8395,7 @@ function readAccepts(block) {
|
|
|
8155
8395
|
} else if (cmd === "source_discrepancy") {
|
|
8156
8396
|
accepts.sourceDiscrepancy = parseSourceDiscrepancy(unwrapBlock(t[i++]));
|
|
8157
8397
|
} else {
|
|
8158
|
-
|
|
8398
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8159
8399
|
}
|
|
8160
8400
|
}
|
|
8161
8401
|
return accepts;
|
|
@@ -8195,7 +8435,7 @@ function readLimit(block) {
|
|
|
8195
8435
|
} else if (cmd === "source_discrepancy") {
|
|
8196
8436
|
limit.sourceDiscrepancy = parseSourceDiscrepancy(unwrapBlock(t[i++]));
|
|
8197
8437
|
} else {
|
|
8198
|
-
|
|
8438
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8199
8439
|
}
|
|
8200
8440
|
}
|
|
8201
8441
|
return limit;
|
|
@@ -8389,10 +8629,12 @@ var parseRequirement = function(id, data) {
|
|
|
8389
8629
|
(result.sourceRefs ??= []).push(src);
|
|
8390
8630
|
} else if (cmd === "ref") {
|
|
8391
8631
|
const r = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
8392
|
-
(result
|
|
8632
|
+
if (!foldRefIntoLegacy(result, r.ref)) {
|
|
8633
|
+
(result.refs ??= []).push(r.ref);
|
|
8634
|
+
}
|
|
8393
8635
|
i = r.next;
|
|
8394
8636
|
} else {
|
|
8395
|
-
|
|
8637
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8396
8638
|
}
|
|
8397
8639
|
}
|
|
8398
8640
|
return (ctx) => {
|
|
@@ -8530,7 +8772,7 @@ var dumpRequirement = function(r) {
|
|
|
8530
8772
|
out += dumpSourceDiscrepancy(r.sourceDiscrepancy, " ") + "\n";
|
|
8531
8773
|
}
|
|
8532
8774
|
for (const src of r.sourceRefs ?? (r.source && (r.source.doc || r.source.clause) ? [r.source] : [])) {
|
|
8533
|
-
out +=
|
|
8775
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
8534
8776
|
}
|
|
8535
8777
|
for (const ref of r.refs ?? []) {
|
|
8536
8778
|
out += " ref " + ref.predicate + ' "' + escapeString(ref.target) + '"' + (ref.note ? ' { note "' + escapeString(ref.note) + '" }' : "") + "\n";
|
|
@@ -8571,7 +8813,7 @@ var parseRequirementClass = function(id, data) {
|
|
|
8571
8813
|
} else if (cmd === "reference") {
|
|
8572
8814
|
result.referenceIds = readIdList2(t[i++]);
|
|
8573
8815
|
} else {
|
|
8574
|
-
|
|
8816
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8575
8817
|
}
|
|
8576
8818
|
}
|
|
8577
8819
|
return (ctx) => {
|
|
@@ -8714,7 +8956,9 @@ var parsePackage = function(data) {
|
|
|
8714
8956
|
manifest.mapsTo = readList(t[i++]);
|
|
8715
8957
|
} else if (cmd === "ref") {
|
|
8716
8958
|
const r = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
8717
|
-
(manifest
|
|
8959
|
+
if (!foldRefIntoLegacy(manifest, r.ref)) {
|
|
8960
|
+
(manifest.refs ??= []).push(r.ref);
|
|
8961
|
+
}
|
|
8718
8962
|
i = r.next;
|
|
8719
8963
|
} else if (cmd === "scheme_type" || cmd === "schemeType") {
|
|
8720
8964
|
manifest.schemeType = stripWrapping(t[i++]);
|
|
@@ -8781,7 +9025,7 @@ var parsePackage = function(data) {
|
|
|
8781
9025
|
}
|
|
8782
9026
|
manifest.source = src;
|
|
8783
9027
|
} else {
|
|
8784
|
-
|
|
9028
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8785
9029
|
}
|
|
8786
9030
|
}
|
|
8787
9031
|
return (ctx) => {
|
|
@@ -8832,7 +9076,7 @@ var parseConformanceClass = function(id, data) {
|
|
|
8832
9076
|
} else if (cmd === "reference") {
|
|
8833
9077
|
result.referenceIds = tokenize(stripWrapping(t[i++])).map(stripWrapping);
|
|
8834
9078
|
} else {
|
|
8835
|
-
|
|
9079
|
+
i = skipUnknownValue(t, i, cmd);
|
|
8836
9080
|
}
|
|
8837
9081
|
}
|
|
8838
9082
|
return (ctx) => {
|
|
@@ -9258,7 +9502,7 @@ function dumpComposedOf(decl, indent) {
|
|
|
9258
9502
|
}
|
|
9259
9503
|
|
|
9260
9504
|
// src/ser-des/config/subject.ts
|
|
9261
|
-
function
|
|
9505
|
+
function dumpSource(keyword, src, indent) {
|
|
9262
9506
|
if (!src || !src.doc && !src.clause) {
|
|
9263
9507
|
return "";
|
|
9264
9508
|
}
|
|
@@ -9294,7 +9538,11 @@ var parseInstrument = function(id, data) {
|
|
|
9294
9538
|
referenceIds: [],
|
|
9295
9539
|
measurand: null,
|
|
9296
9540
|
components: [],
|
|
9297
|
-
structure: []
|
|
9541
|
+
structure: [],
|
|
9542
|
+
// Initialized so the ref fold (docs/primmel/18 §18.4) mirrors the
|
|
9543
|
+
// first derives-from block here — the fold only mirrors slots the
|
|
9544
|
+
// object already carries.
|
|
9545
|
+
source: null
|
|
9298
9546
|
};
|
|
9299
9547
|
const t = tokenizePackage(data);
|
|
9300
9548
|
let i = 0;
|
|
@@ -9322,7 +9570,11 @@ var parseInstrument = function(id, data) {
|
|
|
9322
9570
|
} else if (cmd === "note") {
|
|
9323
9571
|
result.note = stripWrapping(t[i++]);
|
|
9324
9572
|
} else if (cmd === "source") {
|
|
9325
|
-
|
|
9573
|
+
const src = readSource(unwrapBlock(t[i++]));
|
|
9574
|
+
(result.sourceRefs ??= []).push(src);
|
|
9575
|
+
if (!result.source) {
|
|
9576
|
+
result.source = src;
|
|
9577
|
+
}
|
|
9326
9578
|
} else if (cmd === "variant") {
|
|
9327
9579
|
const variantId = stripWrapping(t[i++]);
|
|
9328
9580
|
const vblock = i < t.length ? unwrapBlock(t[i++]) : "";
|
|
@@ -9372,6 +9624,15 @@ var parseInstrument = function(id, data) {
|
|
|
9372
9624
|
result.familyNote = stripWrapping(ft[j++]);
|
|
9373
9625
|
} else if (fc === "source") {
|
|
9374
9626
|
result.familySource = readSource(unwrapBlock(ft[j++]));
|
|
9627
|
+
} else if (fc === "ref") {
|
|
9628
|
+
const rr = parseRef(ft, j, stripWrapping, unwrapBlock);
|
|
9629
|
+
j = rr.next;
|
|
9630
|
+
if (rr.ref.predicate === "derives-from") {
|
|
9631
|
+
const b = refTargetToSourceRef(rr.ref.target);
|
|
9632
|
+
if (b && !result.familySource) {
|
|
9633
|
+
result.familySource = b;
|
|
9634
|
+
}
|
|
9635
|
+
}
|
|
9375
9636
|
} else {
|
|
9376
9637
|
unwrapBlock(ft[j++]);
|
|
9377
9638
|
}
|
|
@@ -9397,8 +9658,14 @@ var parseInstrument = function(id, data) {
|
|
|
9397
9658
|
result.modelGroup = parseModelGroup(unwrapBlock(t[i++]));
|
|
9398
9659
|
} else if (cmd === "reference") {
|
|
9399
9660
|
result.referenceIds = readReference(t[i++]);
|
|
9661
|
+
} else if (cmd === "ref") {
|
|
9662
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
9663
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
9664
|
+
(result.refs ??= []).push(rr.ref);
|
|
9665
|
+
}
|
|
9666
|
+
i = rr.next;
|
|
9400
9667
|
} else {
|
|
9401
|
-
|
|
9668
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9402
9669
|
}
|
|
9403
9670
|
}
|
|
9404
9671
|
return (ctx) => {
|
|
@@ -9445,7 +9712,7 @@ function parseMeasurand(block) {
|
|
|
9445
9712
|
} else if (cmd === "source") {
|
|
9446
9713
|
m.source = readSource(unwrapBlock(t[i++]));
|
|
9447
9714
|
} else {
|
|
9448
|
-
|
|
9715
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9449
9716
|
}
|
|
9450
9717
|
}
|
|
9451
9718
|
return m;
|
|
@@ -9471,7 +9738,7 @@ function parseComponent2(id, block) {
|
|
|
9471
9738
|
} else if (cmd === "source") {
|
|
9472
9739
|
c.source = readSource(unwrapBlock(t[i++]));
|
|
9473
9740
|
} else {
|
|
9474
|
-
|
|
9741
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9475
9742
|
}
|
|
9476
9743
|
}
|
|
9477
9744
|
return c;
|
|
@@ -9515,7 +9782,7 @@ function parseStructure(id, block) {
|
|
|
9515
9782
|
} else if (cmd === "source") {
|
|
9516
9783
|
s.source = readSource(unwrapBlock(t[i++]));
|
|
9517
9784
|
} else {
|
|
9518
|
-
|
|
9785
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9519
9786
|
}
|
|
9520
9787
|
}
|
|
9521
9788
|
return s;
|
|
@@ -9559,7 +9826,7 @@ function parseDimension(id, block) {
|
|
|
9559
9826
|
} else if (cmd === "values") {
|
|
9560
9827
|
dim.values = parseDimensionValues(unwrapBlock(t[i++]));
|
|
9561
9828
|
} else {
|
|
9562
|
-
|
|
9829
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9563
9830
|
}
|
|
9564
9831
|
}
|
|
9565
9832
|
return dim;
|
|
@@ -9666,10 +9933,19 @@ function parseModelGroup(block) {
|
|
|
9666
9933
|
mg.note = stripWrapping(t[i++]);
|
|
9667
9934
|
} else if (cmd === "source") {
|
|
9668
9935
|
mg.sources.push(readSource(unwrapBlock(t[i++])));
|
|
9936
|
+
} else if (cmd === "ref") {
|
|
9937
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
9938
|
+
i = rr.next;
|
|
9939
|
+
if (rr.ref.predicate === "derives-from") {
|
|
9940
|
+
const b = refTargetToSourceRef(rr.ref.target);
|
|
9941
|
+
if (b) {
|
|
9942
|
+
mg.sources.push(b);
|
|
9943
|
+
}
|
|
9944
|
+
}
|
|
9669
9945
|
} else if (cmd === "sample_selection") {
|
|
9670
9946
|
mg.sampleSelection.push(readSource(unwrapBlock(t[i++])));
|
|
9671
9947
|
} else {
|
|
9672
|
-
|
|
9948
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9673
9949
|
}
|
|
9674
9950
|
}
|
|
9675
9951
|
return mg;
|
|
@@ -9704,7 +9980,7 @@ var dumpInstrument = function(inst) {
|
|
|
9704
9980
|
}
|
|
9705
9981
|
out += " }\n";
|
|
9706
9982
|
}
|
|
9707
|
-
out +=
|
|
9983
|
+
out += dumpSource("source", m.source, " ");
|
|
9708
9984
|
out += " }\n";
|
|
9709
9985
|
}
|
|
9710
9986
|
for (const c of inst.components ?? []) {
|
|
@@ -9744,7 +10020,7 @@ var dumpInstrument = function(inst) {
|
|
|
9744
10020
|
if (s.note) {
|
|
9745
10021
|
out += ' note "' + escapeString(s.note) + '"\n';
|
|
9746
10022
|
}
|
|
9747
|
-
out +=
|
|
10023
|
+
out += dumpSource("source", s.source, " ");
|
|
9748
10024
|
out += " }\n";
|
|
9749
10025
|
}
|
|
9750
10026
|
if (inst.definition) {
|
|
@@ -9784,7 +10060,7 @@ var dumpInstrument = function(inst) {
|
|
|
9784
10060
|
if (d.description) {
|
|
9785
10061
|
out += ' description "' + escapeString(d.description) + '"\n';
|
|
9786
10062
|
}
|
|
9787
|
-
out +=
|
|
10063
|
+
out += dumpSource("reference", d.source, " ");
|
|
9788
10064
|
if (d.values.length > 0) {
|
|
9789
10065
|
out += " values {\n";
|
|
9790
10066
|
for (const v of d.values) {
|
|
@@ -9838,7 +10114,9 @@ var dumpInstrument = function(inst) {
|
|
|
9838
10114
|
if (inst.familyNote) {
|
|
9839
10115
|
out += ' note "' + escapeString(inst.familyNote) + '"\n';
|
|
9840
10116
|
}
|
|
9841
|
-
|
|
10117
|
+
if (inst.familySource && (inst.familySource.doc || inst.familySource.clause)) {
|
|
10118
|
+
out += dumpSourceRefAsRef(inst.familySource, " ", escapeString);
|
|
10119
|
+
}
|
|
9842
10120
|
out += " }\n";
|
|
9843
10121
|
}
|
|
9844
10122
|
if (inst.familyCriteria.length > 0) {
|
|
@@ -9876,14 +10154,18 @@ var dumpInstrument = function(inst) {
|
|
|
9876
10154
|
" "
|
|
9877
10155
|
);
|
|
9878
10156
|
for (const s of inst.modelGroup.sources ?? []) {
|
|
9879
|
-
out +=
|
|
10157
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
9880
10158
|
}
|
|
9881
10159
|
for (const s of inst.modelGroup.sampleSelection ?? []) {
|
|
9882
|
-
out +=
|
|
10160
|
+
out += dumpSource("sample_selection", s, " ");
|
|
9883
10161
|
}
|
|
9884
10162
|
out += " }\n";
|
|
9885
10163
|
}
|
|
9886
|
-
|
|
10164
|
+
const instSources = inst.sourceRefs && inst.sourceRefs.length > 0 ? inst.sourceRefs : inst.source ? [inst.source] : [];
|
|
10165
|
+
for (const s of instSources) {
|
|
10166
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10167
|
+
}
|
|
10168
|
+
out += dumpRefs(inst.refs, " ", escapeString);
|
|
9887
10169
|
out += dumpIdList("reference", inst.referenceIds, " ");
|
|
9888
10170
|
out += "}\n";
|
|
9889
10171
|
return out;
|
|
@@ -9921,7 +10203,11 @@ var parseAttributeDefinition = function(id, data) {
|
|
|
9921
10203
|
} else if (cmd === "definition") {
|
|
9922
10204
|
result.definition = stripWrapping(t[i++]);
|
|
9923
10205
|
} else if (cmd === "source" || cmd === "reference") {
|
|
9924
|
-
|
|
10206
|
+
const src = readSource(unwrapBlock(t[i++]));
|
|
10207
|
+
(result.sourceRefs ??= []).push(src);
|
|
10208
|
+
if (!result.source) {
|
|
10209
|
+
result.source = src;
|
|
10210
|
+
}
|
|
9925
10211
|
} else if (cmd === "quantity_kind") {
|
|
9926
10212
|
result.quantityKind = stripWrapping(t[i++]);
|
|
9927
10213
|
} else if (cmd === "unit") {
|
|
@@ -9946,8 +10232,14 @@ var parseAttributeDefinition = function(id, data) {
|
|
|
9946
10232
|
result.irdi = stripWrapping(t[i++]);
|
|
9947
10233
|
} else if (cmd === "derived") {
|
|
9948
10234
|
result.derived = stripWrapping(t[i++]);
|
|
10235
|
+
} else if (cmd === "ref") {
|
|
10236
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
10237
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
10238
|
+
(result.refs ??= []).push(rr.ref);
|
|
10239
|
+
}
|
|
10240
|
+
i = rr.next;
|
|
9949
10241
|
} else {
|
|
9950
|
-
|
|
10242
|
+
i = skipUnknownValue(t, i, cmd);
|
|
9951
10243
|
}
|
|
9952
10244
|
}
|
|
9953
10245
|
return (ctx) => {
|
|
@@ -9966,7 +10258,11 @@ var dumpAttributeDefinition = function(a) {
|
|
|
9966
10258
|
if (a.definition) {
|
|
9967
10259
|
out += ' definition "' + escapeString(a.definition) + '"\n';
|
|
9968
10260
|
}
|
|
9969
|
-
|
|
10261
|
+
const attrSources = a.sourceRefs && a.sourceRefs.length > 0 ? a.sourceRefs : a.source ? [a.source] : [];
|
|
10262
|
+
for (const s of attrSources) {
|
|
10263
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10264
|
+
}
|
|
10265
|
+
out += dumpRefs(a.refs, " ", escapeString);
|
|
9970
10266
|
if (a.quantityKind) {
|
|
9971
10267
|
out += " quantity_kind " + a.quantityKind + "\n";
|
|
9972
10268
|
}
|
|
@@ -10038,8 +10334,14 @@ var parseCapability = function(id, data) {
|
|
|
10038
10334
|
result.verifiedByTests = readReference(t[i++]);
|
|
10039
10335
|
} else if (cmd === "reference") {
|
|
10040
10336
|
result.referenceIds = readReference(t[i++]);
|
|
10337
|
+
} else if (cmd === "ref") {
|
|
10338
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
10339
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
10340
|
+
(result.refs ??= []).push(rr.ref);
|
|
10341
|
+
}
|
|
10342
|
+
i = rr.next;
|
|
10041
10343
|
} else {
|
|
10042
|
-
|
|
10344
|
+
i = skipUnknownValue(t, i, cmd);
|
|
10043
10345
|
}
|
|
10044
10346
|
}
|
|
10045
10347
|
return (ctx) => {
|
|
@@ -10064,6 +10366,7 @@ var dumpCapability = function(c) {
|
|
|
10064
10366
|
out += dumpIdList("satisfies_requirements", c.satisfiesRequirements, " ");
|
|
10065
10367
|
out += dumpIdList("verified_by_tests", c.verifiedByTests, " ");
|
|
10066
10368
|
out += dumpIdList("reference", c.referenceIds, " ");
|
|
10369
|
+
out += dumpRefs(c.refs, " ", escapeString);
|
|
10067
10370
|
out += "}\n";
|
|
10068
10371
|
return out;
|
|
10069
10372
|
};
|
|
@@ -10091,11 +10394,21 @@ var parseBehavior = function(id, data) {
|
|
|
10091
10394
|
} else if (cmd === "response") {
|
|
10092
10395
|
result.response = stripWrapping(t[i++]);
|
|
10093
10396
|
} else if (cmd === "source" || cmd === "reference") {
|
|
10094
|
-
|
|
10397
|
+
const src = readSource(unwrapBlock(t[i++]));
|
|
10398
|
+
(result.sourceRefs ??= []).push(src);
|
|
10399
|
+
if (!result.source) {
|
|
10400
|
+
result.source = src;
|
|
10401
|
+
}
|
|
10095
10402
|
} else if (cmd === "verified_by" || cmd === "verified_by_tests") {
|
|
10096
10403
|
result.verifiedBy = readReference(t[i++]);
|
|
10404
|
+
} else if (cmd === "ref") {
|
|
10405
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
10406
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
10407
|
+
(result.refs ??= []).push(rr.ref);
|
|
10408
|
+
}
|
|
10409
|
+
i = rr.next;
|
|
10097
10410
|
} else {
|
|
10098
|
-
|
|
10411
|
+
i = skipUnknownValue(t, i, cmd);
|
|
10099
10412
|
}
|
|
10100
10413
|
}
|
|
10101
10414
|
return (ctx) => {
|
|
@@ -10114,7 +10427,11 @@ var dumpBehavior = function(b) {
|
|
|
10114
10427
|
if (b.response) {
|
|
10115
10428
|
out += ' response "' + escapeString(b.response) + '"\n';
|
|
10116
10429
|
}
|
|
10117
|
-
|
|
10430
|
+
const behaviorSources = b.sourceRefs && b.sourceRefs.length > 0 ? b.sourceRefs : b.source ? [b.source] : [];
|
|
10431
|
+
for (const s of behaviorSources) {
|
|
10432
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10433
|
+
}
|
|
10434
|
+
out += dumpRefs(b.refs, " ", escapeString);
|
|
10118
10435
|
out += dumpIdList("verified_by", b.verifiedBy, " ");
|
|
10119
10436
|
out += "}\n";
|
|
10120
10437
|
return out;
|
|
@@ -10149,10 +10466,28 @@ var parseConditionSet = function(id, data) {
|
|
|
10149
10466
|
if (!result.source) {
|
|
10150
10467
|
result.source = src;
|
|
10151
10468
|
}
|
|
10469
|
+
} else if (cmd === "ref") {
|
|
10470
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
10471
|
+
i = rr.next;
|
|
10472
|
+
if (rr.ref.predicate === "derives-from") {
|
|
10473
|
+
const b = refTargetToSourceRef(rr.ref.target);
|
|
10474
|
+
if (b) {
|
|
10475
|
+
result.sources.push(b);
|
|
10476
|
+
if (!result.source) {
|
|
10477
|
+
result.source = b;
|
|
10478
|
+
}
|
|
10479
|
+
} else {
|
|
10480
|
+
(result.refs ??= []).push(rr.ref);
|
|
10481
|
+
}
|
|
10482
|
+
} else if (rr.ref.predicate === "cites") {
|
|
10483
|
+
result.referenceIds.push(rr.ref.target);
|
|
10484
|
+
} else {
|
|
10485
|
+
(result.refs ??= []).push(rr.ref);
|
|
10486
|
+
}
|
|
10152
10487
|
} else if (cmd === "reference") {
|
|
10153
10488
|
result.referenceIds = readReference(t[i++]);
|
|
10154
10489
|
} else {
|
|
10155
|
-
|
|
10490
|
+
i = skipUnknownValue(t, i, cmd);
|
|
10156
10491
|
}
|
|
10157
10492
|
}
|
|
10158
10493
|
return (ctx) => {
|
|
@@ -10231,9 +10566,10 @@ var dumpConditionSet = function(cs) {
|
|
|
10231
10566
|
}
|
|
10232
10567
|
const sources = cs.sources && cs.sources.length > 0 ? cs.sources : cs.source ? [cs.source] : [];
|
|
10233
10568
|
for (const s of sources) {
|
|
10234
|
-
out +=
|
|
10569
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10235
10570
|
}
|
|
10236
10571
|
out += dumpIdList("reference", cs.referenceIds, " ");
|
|
10572
|
+
out += dumpRefs(cs.refs, " ", escapeString);
|
|
10237
10573
|
out += "}\n";
|
|
10238
10574
|
return out;
|
|
10239
10575
|
};
|
|
@@ -10362,7 +10698,7 @@ function readCharacteristicBlock(block) {
|
|
|
10362
10698
|
} else if (cmd === "source" || cmd === "reference") {
|
|
10363
10699
|
c.source = readSource(unwrapBlock(t[i++]));
|
|
10364
10700
|
} else {
|
|
10365
|
-
|
|
10701
|
+
i = skipUnknownValue(t, i, cmd);
|
|
10366
10702
|
}
|
|
10367
10703
|
}
|
|
10368
10704
|
return c;
|
|
@@ -10626,7 +10962,7 @@ var parseSubject = function(id, data) {
|
|
|
10626
10962
|
} else if (cmd === "reference") {
|
|
10627
10963
|
result.referenceIds = readReference(t[i++]);
|
|
10628
10964
|
} else {
|
|
10629
|
-
|
|
10965
|
+
i = skipUnknownValue(t, i, cmd);
|
|
10630
10966
|
}
|
|
10631
10967
|
}
|
|
10632
10968
|
return (ctx) => {
|
|
@@ -10778,7 +11114,7 @@ function dumpSubjectPromises(promises) {
|
|
|
10778
11114
|
out += ' statement "' + escapeString(p.statement) + '"\n';
|
|
10779
11115
|
}
|
|
10780
11116
|
out += dumpIdList("verified_by", p.verifiedBy, " ");
|
|
10781
|
-
out +=
|
|
11117
|
+
out += dumpSource("source", p.source ?? null, " ");
|
|
10782
11118
|
out += " }\n";
|
|
10783
11119
|
}
|
|
10784
11120
|
out += " }\n";
|
|
@@ -10810,7 +11146,7 @@ function dumpSubjectCharacteristics(map) {
|
|
|
10810
11146
|
if (c.unit) {
|
|
10811
11147
|
out += ' unit "' + escapeString(c.unit) + '"\n';
|
|
10812
11148
|
}
|
|
10813
|
-
out +=
|
|
11149
|
+
out += dumpSource("source", c.source ?? null, " ");
|
|
10814
11150
|
out += " }\n";
|
|
10815
11151
|
continue;
|
|
10816
11152
|
}
|
|
@@ -11082,14 +11418,6 @@ var instanceConstruct = {
|
|
|
11082
11418
|
};
|
|
11083
11419
|
|
|
11084
11420
|
// src/ser-des/config/artifact.ts
|
|
11085
|
-
function dumpSource3(keyword, src, indent) {
|
|
11086
|
-
if (!src || !src.doc && !src.clause) {
|
|
11087
|
-
return "";
|
|
11088
|
-
}
|
|
11089
|
-
const frag = src.fragment ? ` fragment "${escapeString(src.fragment)}"` : "";
|
|
11090
|
-
return `${indent}${keyword} { doc "${escapeString(src.doc)}" clause "${escapeString(src.clause)}"${frag} }
|
|
11091
|
-
`;
|
|
11092
|
-
}
|
|
11093
11421
|
function readIdList4(block) {
|
|
11094
11422
|
return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
|
|
11095
11423
|
}
|
|
@@ -11183,7 +11511,7 @@ function parseContentContract(block) {
|
|
|
11183
11511
|
} else if (cmd === "media") {
|
|
11184
11512
|
contract.media = readContractMedia(unwrapBlock(t[i++]));
|
|
11185
11513
|
} else {
|
|
11186
|
-
|
|
11514
|
+
i = skipUnknownValue(t, i, cmd);
|
|
11187
11515
|
}
|
|
11188
11516
|
}
|
|
11189
11517
|
return contract;
|
|
@@ -11224,11 +11552,21 @@ var parseArtifactDefinition = function(id, data) {
|
|
|
11224
11552
|
} else if (cmd === "retention") {
|
|
11225
11553
|
result.retention = stripWrapping(t[i++]);
|
|
11226
11554
|
} else if (cmd === "source") {
|
|
11227
|
-
|
|
11555
|
+
const src = readSource(unwrapBlock(t[i++]));
|
|
11556
|
+
(result.sourceRefs ??= []).push(src);
|
|
11557
|
+
if (!result.source) {
|
|
11558
|
+
result.source = src;
|
|
11559
|
+
}
|
|
11228
11560
|
} else if (cmd === "reference") {
|
|
11229
11561
|
result.referenceIds = readReference3(t[i++]);
|
|
11562
|
+
} else if (cmd === "ref") {
|
|
11563
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
11564
|
+
if (!foldRefIntoLegacy(result, rr.ref)) {
|
|
11565
|
+
(result.refs ??= []).push(rr.ref);
|
|
11566
|
+
}
|
|
11567
|
+
i = rr.next;
|
|
11230
11568
|
} else {
|
|
11231
|
-
|
|
11569
|
+
i = skipUnknownValue(t, i, cmd);
|
|
11232
11570
|
}
|
|
11233
11571
|
}
|
|
11234
11572
|
return (ctx) => {
|
|
@@ -11289,7 +11627,11 @@ var dumpArtifactDefinition = function(d) {
|
|
|
11289
11627
|
if (d.retention) {
|
|
11290
11628
|
out += ' retention "' + escapeString(d.retention) + '"\n';
|
|
11291
11629
|
}
|
|
11292
|
-
|
|
11630
|
+
const artifactSources = d.sourceRefs && d.sourceRefs.length > 0 ? d.sourceRefs : d.source ? [d.source] : [];
|
|
11631
|
+
for (const s of artifactSources) {
|
|
11632
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
11633
|
+
}
|
|
11634
|
+
out += dumpRefs(d.refs, " ", escapeString);
|
|
11293
11635
|
out += dumpIdList2("reference", d.referenceIds, " ");
|
|
11294
11636
|
out += "}\n";
|
|
11295
11637
|
return out;
|
|
@@ -11324,7 +11666,7 @@ var parseArtifactInstance = function(id, data) {
|
|
|
11324
11666
|
} else if (cmd === "reference") {
|
|
11325
11667
|
result.referenceIds = readReference3(t[i++]);
|
|
11326
11668
|
} else {
|
|
11327
|
-
|
|
11669
|
+
i = skipUnknownValue(t, i, cmd);
|
|
11328
11670
|
}
|
|
11329
11671
|
}
|
|
11330
11672
|
return (ctx) => {
|
|
@@ -11875,6 +12217,12 @@ var parseTestSequence = function(id, data) {
|
|
|
11875
12217
|
sequence.description = stripWrapping(t[i++]);
|
|
11876
12218
|
} else if (command === "sample_applicability") {
|
|
11877
12219
|
sequence.sampleApplicability = stripWrapping(t[i++]);
|
|
12220
|
+
} else if (command === "ref") {
|
|
12221
|
+
const rr = parseRef(t, i, stripWrapping, unwrapBlock);
|
|
12222
|
+
if (!foldRefIntoLegacy(sequence, rr.ref)) {
|
|
12223
|
+
sequence.refs = [...sequence.refs ?? [], rr.ref];
|
|
12224
|
+
}
|
|
12225
|
+
i = rr.next;
|
|
11878
12226
|
} else if (command === "source") {
|
|
11879
12227
|
sequence.sourceRefs.push(readSource(unwrapBlock(t[i++])));
|
|
11880
12228
|
} else if (command === "step") {
|
|
@@ -11930,8 +12278,11 @@ var dumpTestSequence = function(seq) {
|
|
|
11930
12278
|
if (seq.sampleApplicability !== "") {
|
|
11931
12279
|
out += " sample_applicability " + dumpBareSafe(seq.sampleApplicability) + "\n";
|
|
11932
12280
|
}
|
|
12281
|
+
for (const r of seq.refs ?? []) {
|
|
12282
|
+
out += " ref " + r.predicate + ' "' + escapeString(r.target) + '"' + (r.note ? ' { note "' + escapeString(r.note) + '" }' : "") + "\n";
|
|
12283
|
+
}
|
|
11933
12284
|
for (const src of seq.sourceRefs) {
|
|
11934
|
-
out +=
|
|
12285
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
11935
12286
|
}
|
|
11936
12287
|
out += "}\n";
|
|
11937
12288
|
return out;
|
|
@@ -11955,13 +12306,18 @@ var parseFormulasUsed = function(id, data) {
|
|
|
11955
12306
|
};
|
|
11956
12307
|
forEachEntry(
|
|
11957
12308
|
data,
|
|
11958
|
-
(command, value) => {
|
|
12309
|
+
(command, value, peek) => {
|
|
11959
12310
|
if (command === "name") {
|
|
11960
12311
|
trace.name = stripWrapping(value());
|
|
11961
12312
|
} else if (command === "description") {
|
|
11962
12313
|
trace.description = stripWrapping(value());
|
|
11963
12314
|
} else if (command === "formulas") {
|
|
11964
12315
|
trace.formulas.push(...readEntryTokens(value()));
|
|
12316
|
+
} else if (command === "ref") {
|
|
12317
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
12318
|
+
if (!foldRefIntoLegacy(trace, r)) {
|
|
12319
|
+
(trace.refs ??= []).push(r);
|
|
12320
|
+
}
|
|
11965
12321
|
} else if (command === "source") {
|
|
11966
12322
|
trace.sourceRefs.push(readSource(unwrapBlock(value())));
|
|
11967
12323
|
} else {
|
|
@@ -11987,8 +12343,11 @@ var dumpFormulasUsed = function(fu) {
|
|
|
11987
12343
|
if (fu.formulas.length > 0) {
|
|
11988
12344
|
out += " formulas { " + fu.formulas.map(dumpBareSafe).join(" ") + " }\n";
|
|
11989
12345
|
}
|
|
12346
|
+
for (const r of fu.refs ?? []) {
|
|
12347
|
+
out += " ref " + r.predicate + ' "' + escapeString(r.target) + '"' + (r.note ? ' { note "' + escapeString(r.note) + '" }' : "") + "\n";
|
|
12348
|
+
}
|
|
11990
12349
|
for (const src of fu.sourceRefs) {
|
|
11991
|
-
out +=
|
|
12350
|
+
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
11992
12351
|
}
|
|
11993
12352
|
out += "}\n";
|
|
11994
12353
|
return out;
|
|
@@ -15450,6 +15809,19 @@ var CHECK_RULES = [
|
|
|
15450
15809
|
"error",
|
|
15451
15810
|
"normal",
|
|
15452
15811
|
"TODO.integration/14, the composed_of construct (TODO.v3/03 Phase 2)"
|
|
15812
|
+
),
|
|
15813
|
+
// ── the relation registry (docs/primmel/18 §18.6) ──────────────────
|
|
15814
|
+
// C103: every ref predicate resolves against the composed registry —
|
|
15815
|
+
// a typo is an error, not a silent new predicate. The rule only fires
|
|
15816
|
+
// when the package set declares a registry: the predicate vocabulary
|
|
15817
|
+
// is data (the metamodel layer's predicates.prl), never grammar.
|
|
15818
|
+
R(
|
|
15819
|
+
"C103",
|
|
15820
|
+
"declared-predicate",
|
|
15821
|
+
"base",
|
|
15822
|
+
"error",
|
|
15823
|
+
"normal",
|
|
15824
|
+
"docs/primmel/18 \xA718.6 (the unified reference/relation construct)"
|
|
15453
15825
|
)
|
|
15454
15826
|
];
|
|
15455
15827
|
var byId = new Map(CHECK_RULES.map((r) => [r.id, r]));
|
|
@@ -16386,6 +16758,7 @@ function checkPackage(dir, options = {}) {
|
|
|
16386
16758
|
}
|
|
16387
16759
|
issues.push(...checkEditionLifecycle(dir, standard));
|
|
16388
16760
|
issues.push(...checkSpellingCodes(standard));
|
|
16761
|
+
issues.push(...checkDeclaredPredicates(standard));
|
|
16389
16762
|
const reqIds = new Set(
|
|
16390
16763
|
(standard.requirements ?? []).map((r) => r.id)
|
|
16391
16764
|
);
|
|
@@ -19845,6 +20218,81 @@ function checkSpellingCodes(standard) {
|
|
|
19845
20218
|
}
|
|
19846
20219
|
return issues;
|
|
19847
20220
|
}
|
|
20221
|
+
function checkDeclaredPredicates(standard) {
|
|
20222
|
+
const issues = [];
|
|
20223
|
+
const registry = new Set((standard.predicates ?? []).map((p) => p.id));
|
|
20224
|
+
if (registry.size === 0) {
|
|
20225
|
+
return issues;
|
|
20226
|
+
}
|
|
20227
|
+
const visit = (owner, refs) => {
|
|
20228
|
+
for (const r of refs ?? []) {
|
|
20229
|
+
if (!registry.has(r.predicate)) {
|
|
20230
|
+
issues.push({
|
|
20231
|
+
check: "C103",
|
|
20232
|
+
severity: "error",
|
|
20233
|
+
message: `${owner}: ref predicate "${r.predicate}" is not declared in the composed predicate registry (declared-predicate)`
|
|
20234
|
+
});
|
|
20235
|
+
}
|
|
20236
|
+
}
|
|
20237
|
+
};
|
|
20238
|
+
const visitFields = (owner, fields) => {
|
|
20239
|
+
for (const f of fields) {
|
|
20240
|
+
const here = `${owner} field ${f.name}`;
|
|
20241
|
+
visit(here, f.refs);
|
|
20242
|
+
if (f.fields && f.fields.length > 0) {
|
|
20243
|
+
visitFields(here, f.fields);
|
|
20244
|
+
}
|
|
20245
|
+
}
|
|
20246
|
+
};
|
|
20247
|
+
const m = standard.packageManifest;
|
|
20248
|
+
if (m) {
|
|
20249
|
+
visit(`package "${m.id}"`, m.refs);
|
|
20250
|
+
}
|
|
20251
|
+
for (const r of standard.requirements ?? []) {
|
|
20252
|
+
visit(`requirement ${r.id}`, r.refs);
|
|
20253
|
+
}
|
|
20254
|
+
for (const t of standard.conformanceTests ?? []) {
|
|
20255
|
+
visit(`conformance_test ${t.id}`, t.refs);
|
|
20256
|
+
}
|
|
20257
|
+
for (const f of standard.forms ?? []) {
|
|
20258
|
+
visit(`form ${f.id}`, f.refs);
|
|
20259
|
+
visitFields(`form ${f.id}`, f.fields ?? []);
|
|
20260
|
+
}
|
|
20261
|
+
for (const s of standard.subforms ?? []) {
|
|
20262
|
+
visitFields(`subform ${s.id}`, s.fields ?? []);
|
|
20263
|
+
}
|
|
20264
|
+
for (const c of standard.calculations ?? []) {
|
|
20265
|
+
visit(`calculation ${c.id}`, c.refs);
|
|
20266
|
+
}
|
|
20267
|
+
for (const s of standard.symbols ?? []) {
|
|
20268
|
+
visit(`symbol ${s.id}`, s.refs);
|
|
20269
|
+
}
|
|
20270
|
+
for (const t of standard.terms ?? []) {
|
|
20271
|
+
visit(`term ${t.id}`, t.refs);
|
|
20272
|
+
}
|
|
20273
|
+
for (const t of standard.tables ?? []) {
|
|
20274
|
+
visit(`table ${t.id}`, t.refs);
|
|
20275
|
+
}
|
|
20276
|
+
for (const c of standard.constraints ?? []) {
|
|
20277
|
+
visit(`constraint ${c.id}`, c.refs);
|
|
20278
|
+
}
|
|
20279
|
+
for (const k of standard.competenceKinds ?? []) {
|
|
20280
|
+
visit(`competence_kind ${k.id}`, k.refs);
|
|
20281
|
+
}
|
|
20282
|
+
for (const f of standard.formulasUsed ?? []) {
|
|
20283
|
+
visit(`formulas_used ${f.id}`, f.refs);
|
|
20284
|
+
}
|
|
20285
|
+
for (const s of standard.testSequences ?? []) {
|
|
20286
|
+
visit(`test_sequence ${s.id}`, s.refs);
|
|
20287
|
+
}
|
|
20288
|
+
for (const c of standard.conditionSets ?? []) {
|
|
20289
|
+
visit(`condition_set ${c.id}`, c.refs);
|
|
20290
|
+
}
|
|
20291
|
+
for (const i of standard.instruments ?? []) {
|
|
20292
|
+
visit(`instrument ${i.id}`, i.refs);
|
|
20293
|
+
}
|
|
20294
|
+
return issues;
|
|
20295
|
+
}
|
|
19848
20296
|
function checkEditionLifecycle(dir, standard) {
|
|
19849
20297
|
const issues = [];
|
|
19850
20298
|
const err = (check, message) => issues.push({ check, severity: "error", message });
|