@ifc-lite/export 4.9.0 → 4.12.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/dist/affected-set.d.ts +9 -0
- package/dist/affected-set.d.ts.map +1 -0
- package/dist/affected-set.js +72 -0
- package/dist/affected-set.js.map +1 -0
- package/dist/anonymize-placement.d.ts +0 -34
- package/dist/anonymize-placement.d.ts.map +1 -1
- package/dist/anonymize-placement.js +58 -27
- package/dist/anonymize-placement.js.map +1 -1
- package/dist/declared-property-type.d.ts +7 -0
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +29 -2
- package/dist/declared-property-type.js.map +1 -1
- package/dist/edit-ownership.d.ts +7 -0
- package/dist/edit-ownership.d.ts.map +1 -0
- package/dist/edit-ownership.js +95 -0
- package/dist/edit-ownership.js.map +1 -0
- package/dist/effective-index.d.ts.map +1 -1
- package/dist/effective-index.js +12 -5
- package/dist/effective-index.js.map +1 -1
- package/dist/entity-subgraph.d.ts +11 -3
- package/dist/entity-subgraph.d.ts.map +1 -1
- package/dist/entity-subgraph.js +54 -11
- package/dist/entity-subgraph.js.map +1 -1
- package/dist/grid-placement-dependents.d.ts +4 -0
- package/dist/grid-placement-dependents.d.ts.map +1 -0
- package/dist/grid-placement-dependents.js +71 -0
- package/dist/grid-placement-dependents.js.map +1 -0
- package/dist/grid-reference-context.d.ts +6 -0
- package/dist/grid-reference-context.d.ts.map +1 -0
- package/dist/grid-reference-context.js +68 -0
- package/dist/grid-reference-context.js.map +1 -0
- package/dist/ifc5-exporter.d.ts.map +1 -1
- package/dist/ifc5-exporter.js +5 -4
- package/dist/ifc5-exporter.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/lod-geometry-types.d.ts +5 -0
- package/dist/lod-geometry-types.d.ts.map +1 -1
- package/dist/lod0-generator.d.ts.map +1 -1
- package/dist/lod0-generator.js +52 -18
- package/dist/lod0-generator.js.map +1 -1
- package/dist/lod1-generator.d.ts.map +1 -1
- package/dist/lod1-generator.js +4 -1
- package/dist/lod1-generator.js.map +1 -1
- package/dist/merged-empty-containers-refs.d.ts.map +1 -1
- package/dist/merged-empty-containers-refs.js +5 -3
- package/dist/merged-empty-containers-refs.js.map +1 -1
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +31 -31
- package/dist/merged-exporter.js.map +1 -1
- package/dist/merged-remap.d.ts +0 -8
- package/dist/merged-remap.d.ts.map +1 -1
- package/dist/merged-remap.js +7 -17
- package/dist/merged-remap.js.map +1 -1
- package/dist/obj.d.ts +8 -8
- package/dist/obj.js +8 -8
- package/dist/parquet-exporter.d.ts.map +1 -1
- package/dist/parquet-exporter.js +14 -2
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/property-value-serialization.d.ts.map +1 -1
- package/dist/property-value-serialization.js +7 -3
- package/dist/property-value-serialization.js.map +1 -1
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +17 -16
- package/dist/reference-collector.js.map +1 -1
- package/dist/retype.d.ts.map +1 -1
- package/dist/retype.js +12 -11
- package/dist/retype.js.map +1 -1
- package/dist/schema-conversion-loss-report.d.ts +2 -1
- package/dist/schema-conversion-loss-report.d.ts.map +1 -1
- package/dist/schema-conversion-loss-report.js +20 -11
- package/dist/schema-conversion-loss-report.js.map +1 -1
- package/dist/schema-converter-mep.d.ts +2 -0
- package/dist/schema-converter-mep.d.ts.map +1 -0
- package/dist/schema-converter-mep.js +9 -0
- package/dist/schema-converter-mep.js.map +1 -0
- package/dist/schema-converter-mep.json +96 -0
- package/dist/schema-converter-product-proxy.d.ts +25 -0
- package/dist/schema-converter-product-proxy.d.ts.map +1 -0
- package/dist/schema-converter-product-proxy.js +33 -0
- package/dist/schema-converter-product-proxy.js.map +1 -0
- package/dist/schema-converter-renames.d.ts +32 -0
- package/dist/schema-converter-renames.d.ts.map +1 -0
- package/dist/schema-converter-renames.js +60 -0
- package/dist/schema-converter-renames.js.map +1 -0
- package/dist/schema-converter.d.ts +8 -16
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +44 -71
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-style-flatten.d.ts +82 -0
- package/dist/schema-style-flatten.d.ts.map +1 -0
- package/dist/schema-style-flatten.js +245 -0
- package/dist/schema-style-flatten.js.map +1 -0
- package/dist/step-argument-parser.d.ts +7 -2
- package/dist/step-argument-parser.d.ts.map +1 -1
- package/dist/step-argument-parser.js +69 -62
- package/dist/step-argument-parser.js.map +1 -1
- package/dist/step-attribute-mutations.d.ts.map +1 -1
- package/dist/step-attribute-mutations.js +21 -22
- package/dist/step-attribute-mutations.js.map +1 -1
- package/dist/step-coordinate-options.d.ts +8 -0
- package/dist/step-coordinate-options.d.ts.map +1 -1
- package/dist/step-export-contexts.d.ts +1 -1
- package/dist/step-export-contexts.d.ts.map +1 -1
- package/dist/step-export-contexts.js +4 -1
- package/dist/step-export-contexts.js.map +1 -1
- package/dist/step-export-types.d.ts +6 -0
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +19 -19
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-map-unit-normalization.d.ts +3 -5
- package/dist/step-map-unit-normalization.d.ts.map +1 -1
- package/dist/step-map-unit-normalization.js +12 -8
- package/dist/step-map-unit-normalization.js.map +1 -1
- package/dist/step-map-unit.d.ts +3 -78
- package/dist/step-map-unit.d.ts.map +1 -1
- package/dist/step-map-unit.js +33 -195
- package/dist/step-map-unit.js.map +1 -1
- package/dist/step-native-set-record.d.ts +6 -0
- package/dist/step-native-set-record.d.ts.map +1 -0
- package/dist/step-native-set-record.js +30 -0
- package/dist/step-native-set-record.js.map +1 -0
- package/dist/step-outer-args.d.ts +10 -0
- package/dist/step-outer-args.d.ts.map +1 -1
- package/dist/step-outer-args.js +29 -12
- package/dist/step-outer-args.js.map +1 -1
- package/dist/step-overlay-entities.d.ts +2 -0
- package/dist/step-overlay-entities.d.ts.map +1 -1
- package/dist/step-overlay-entities.js +43 -11
- package/dist/step-overlay-entities.js.map +1 -1
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js +4 -0
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts.map +1 -1
- package/dist/step-property-set-collection.js +24 -8
- package/dist/step-property-set-collection.js.map +1 -1
- package/dist/step-property-set-generators.d.ts +8 -2
- package/dist/step-property-set-generators.d.ts.map +1 -1
- package/dist/step-property-set-generators.js +26 -10
- package/dist/step-property-set-generators.js.map +1 -1
- package/dist/step-property-set-index.d.ts.map +1 -1
- package/dist/step-property-set-index.js +8 -3
- package/dist/step-property-set-index.js.map +1 -1
- package/dist/step-property-set-readers.d.ts +6 -0
- package/dist/step-property-set-readers.d.ts.map +1 -1
- package/dist/step-property-set-readers.js +68 -14
- package/dist/step-property-set-readers.js.map +1 -1
- package/dist/step-property-sets.d.ts +17 -4
- package/dist/step-property-sets.d.ts.map +1 -1
- package/dist/step-property-sets.js +79 -20
- package/dist/step-property-sets.js.map +1 -1
- package/dist/step-record-frame.d.ts +69 -0
- package/dist/step-record-frame.d.ts.map +1 -0
- package/dist/step-record-frame.js +136 -0
- package/dist/step-record-frame.js.map +1 -0
- package/dist/step-ref-scan.d.ts +8 -0
- package/dist/step-ref-scan.d.ts.map +1 -1
- package/dist/step-ref-scan.js +29 -8
- package/dist/step-ref-scan.js.map +1 -1
- package/dist/step-serialization.d.ts +16 -4
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +39 -13
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-slot-grammar.d.ts +21 -18
- package/dist/step-slot-grammar.d.ts.map +1 -1
- package/dist/step-slot-grammar.js +210 -177
- package/dist/step-slot-grammar.js.map +1 -1
- package/dist/step-source-iteration.d.ts +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +27 -3
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/step-type-owned-quantities.d.ts +34 -0
- package/dist/step-type-owned-quantities.d.ts.map +1 -0
- package/dist/step-type-owned-quantities.js +222 -0
- package/dist/step-type-owned-quantities.js.map +1 -0
- package/dist/step-vertical-datum-normalization.d.ts +17 -0
- package/dist/step-vertical-datum-normalization.d.ts.map +1 -0
- package/dist/step-vertical-datum-normalization.js +52 -0
- package/dist/step-vertical-datum-normalization.js.map +1 -0
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +13 -20
- package/dist/unit-normalize.js.map +1 -1
- package/dist/zero-content.d.ts +21 -3
- package/dist/zero-content.d.ts.map +1 -1
- package/dist/zero-content.js +35 -3
- package/dist/zero-content.js.map +1 -1
- package/package.json +11 -11
|
@@ -29,16 +29,40 @@ import { applySourceLineMutationsReported } from './step-attribute-mutations.js'
|
|
|
29
29
|
import { nominateDeliveredInPlaceEdits } from './in-place-nomination.js';
|
|
30
30
|
import { getPropertySetName } from './step-property-set-readers.js';
|
|
31
31
|
import { generatePropertySetEntities, generateQuantitySetEntities } from './step-property-set-generators.js';
|
|
32
|
+
import { generateTypeQuantityCopy } from './step-type-owned-quantities.js';
|
|
33
|
+
import { convertStepLine } from './schema-converter.js';
|
|
32
34
|
/**
|
|
33
35
|
* Write the generated property-set and quantity-set records into
|
|
34
36
|
* `pass.entities`, and point every affected type object's `HasPropertySets` at
|
|
35
37
|
* the property sets this export just generated.
|
|
36
38
|
*
|
|
37
|
-
*
|
|
38
|
-
* the
|
|
39
|
-
*
|
|
40
|
-
* only after the quantity-set loop has run.
|
|
39
|
+
* Property and quantity generation both precede the shared type-object rewrite:
|
|
40
|
+
* HasPropertySets must name the replacement IDs from both generators (#7355).
|
|
41
|
+
* The caller flushes rewrittenEntityLines only after this function returns.
|
|
41
42
|
*/
|
|
43
|
+
/**
|
|
44
|
+
* The one emit path for every record this export APPENDS after the source
|
|
45
|
+
* pass: generated property and quantity sets, the type-object lines whose
|
|
46
|
+
* `HasPropertySets` is repointed, and the georeferencing records (#7682,
|
|
47
|
+
* EXPORT-STEP-3). Each is written in the SOURCE schema's layout, so when the
|
|
48
|
+
* export converts it goes through `convertStepLine` exactly as a source
|
|
49
|
+
* record does: renamed (`IFCDOORTYPE` to `IFCDOORSTYLE`), re-laid-out (a
|
|
50
|
+
* quantity's `Formula` trimmed for IFC2X3, #7378), and through the IFC2X3
|
|
51
|
+
* slot fill and its counters. It used to run for generated quantities only,
|
|
52
|
+
* so the others reached an IFC2X3 file in IFC4 shape. The Rust writer's
|
|
53
|
+
* `write_line` is the twin. A record the target cannot represent is a refusal
|
|
54
|
+
* here, never an omission: other appended records name it.
|
|
55
|
+
*/
|
|
56
|
+
export function convertAppendedLines(pass, options, lines) {
|
|
57
|
+
if (!pass.converting)
|
|
58
|
+
return [...lines];
|
|
59
|
+
return lines.map((line) => {
|
|
60
|
+
const converted = convertStepLine(line, pass.sourceSchema, pass.schema, options.guidRandom, pass.slotFill, pass.withheldRefIds, pass.ifc4Slots, pass.enums);
|
|
61
|
+
if (converted === null)
|
|
62
|
+
throw new Error('Generated record is unsupported in the target schema');
|
|
63
|
+
return converted;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
42
66
|
export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
43
67
|
// Generate new property entities for mutations (these REPLACE the skipped ones)
|
|
44
68
|
const generatedTypeOwnedPsetIds = new Map();
|
|
@@ -51,7 +75,7 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
51
75
|
if (!pass.willBeEmitted(entityId))
|
|
52
76
|
continue;
|
|
53
77
|
const newEntities = generatePropertySetEntities(ctx, entityId, psets, pass.willBeEmitted, pass.effective, pass.typeOwnedPsetNamesByEntity.get(entityId), options.guidRandom, sourceMembers, canReferenceSourceMember);
|
|
54
|
-
pass.entities.push(...newEntities.lines);
|
|
78
|
+
pass.entities.push(...convertAppendedLines(pass, options, newEntities.lines));
|
|
55
79
|
pass.newEntityCount += newEntities.count;
|
|
56
80
|
// Replacement content for this host actually landed, so a delta really
|
|
57
81
|
// does carry its PROPERTY-SET modification — and only that one (#2462).
|
|
@@ -59,16 +83,58 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
59
83
|
pass.modifications.recordEmitted(entityId, 'property-set');
|
|
60
84
|
generatedTypeOwnedPsetIds.set(entityId, newEntities.generatedTypeOwnedPsetIds);
|
|
61
85
|
}
|
|
86
|
+
// Type quantity generation precedes the shared HasPropertySets rewrite (#7355).
|
|
87
|
+
for (const { entityId, qsets, sourceSets } of pass.newQuantitySets) {
|
|
88
|
+
if (!pass.willBeEmitted(entityId))
|
|
89
|
+
continue;
|
|
90
|
+
const typeOwned = pass.typeOwnedQuantityIdsByEntity.has(entityId);
|
|
91
|
+
qsets.forEach((qset, index) => {
|
|
92
|
+
const source = sourceSets?.[index];
|
|
93
|
+
const generated = source
|
|
94
|
+
? generateTypeQuantityCopy(pass, options, ctx, entityId, qset, source)
|
|
95
|
+
: generateQuantitySetEntities(ctx, entityId, [qset], pass.willBeEmitted, pass.effective, options.guidRandom, typeOwned);
|
|
96
|
+
// Generated quantity records are written in the source schema's layout.
|
|
97
|
+
// One conversion site serves occurrence, new Type and copied Type sets (#7378).
|
|
98
|
+
pass.entities.push(...convertAppendedLines(pass, options, generated.lines));
|
|
99
|
+
pass.newEntityCount += generated.count;
|
|
100
|
+
if (generated.lines.length > 0)
|
|
101
|
+
pass.modifications.recordEmitted(entityId, 'quantity-set');
|
|
102
|
+
if (typeOwned) {
|
|
103
|
+
const id = 'setId' in generated ? generated.setId : generated.generatedSetIds[0];
|
|
104
|
+
if (id !== undefined) {
|
|
105
|
+
if (source)
|
|
106
|
+
pass.typeOwnedQuantityIdsByEntity.get(entityId)?.set(source.setId, id);
|
|
107
|
+
else
|
|
108
|
+
pass.addedTypeOwnedQuantityIds.get(entityId)?.push(id);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
62
113
|
// Point every affected type object's HasPropertySets at the psets this
|
|
63
114
|
// export generated. One loop, because a type whose affected psets produced
|
|
64
115
|
// no replacement content (a deletion) needs exactly the same resolution
|
|
65
116
|
// with an empty replacement map.
|
|
66
|
-
|
|
117
|
+
const typeOwners = new Set([...pass.typeOwnedPsetNamesByEntity.keys(), ...pass.typeOwnedQuantityIdsByEntity.keys()]);
|
|
118
|
+
for (const entityId of typeOwners) {
|
|
119
|
+
const typeOwnedPsetNames = pass.typeOwnedPsetNamesByEntity.get(entityId) ?? new Set();
|
|
120
|
+
const modificationKinds = [];
|
|
121
|
+
if (pass.typeOwnedPsetNamesByEntity.has(entityId))
|
|
122
|
+
modificationKinds.push('property-set');
|
|
123
|
+
if (pass.typeOwnedQuantityIdsByEntity.has(entityId))
|
|
124
|
+
modificationKinds.push('quantity-set');
|
|
67
125
|
// `entityId` here is a TYPE object rather than an element; `willBeEmitted`
|
|
68
126
|
// resolves either the same way (#2030).
|
|
69
127
|
if (!pass.willBeEmitted(entityId))
|
|
70
128
|
continue;
|
|
71
|
-
const
|
|
129
|
+
const propertyResolved = resolveTypeOwnedPsetIds(pass.typeOwnedPsetIdsByEntity.get(entityId) ?? [], typeOwnedPsetNames, generatedTypeOwnedPsetIds.get(entityId) ?? new Map(), (psetId) => getPropertySetName(ctx, psetId));
|
|
130
|
+
const quantityReplacements = pass.typeOwnedQuantityIdsByEntity.get(entityId);
|
|
131
|
+
const resolved = propertyResolved.flatMap(id => {
|
|
132
|
+
if (!quantityReplacements?.has(id))
|
|
133
|
+
return [id];
|
|
134
|
+
const replacement = quantityReplacements.get(id);
|
|
135
|
+
return replacement === null || replacement === undefined ? [] : [replacement];
|
|
136
|
+
});
|
|
137
|
+
resolved.push(...(pass.addedTypeOwnedQuantityIds.get(entityId) ?? []));
|
|
72
138
|
if (pass.effective.isOverlayCreated(entityId)) {
|
|
73
139
|
// No source line to rewrite: the new-entities pass writes this record
|
|
74
140
|
// from its authored payload, so the list rides in as a slot override.
|
|
@@ -118,7 +184,8 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
118
184
|
// The line above IS the report, so the ledger must not add a second,
|
|
119
185
|
// vaguer one blaming the delta format for a drop the format did not
|
|
120
186
|
// cause.
|
|
121
|
-
|
|
187
|
+
for (const kind of modificationKinds)
|
|
188
|
+
pass.modifications.acknowledgeUndelivered(entityId, kind);
|
|
122
189
|
continue;
|
|
123
190
|
}
|
|
124
191
|
const { line, repointed } = rewriteTypeOwnedPsetLine(mutated.text, resolved);
|
|
@@ -142,7 +209,8 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
142
209
|
// property-set edit that put this host in the loop; the rest of the
|
|
143
210
|
// line delivers whichever in-place edits the pipeline applied to it.
|
|
144
211
|
if (changed) {
|
|
145
|
-
|
|
212
|
+
for (const kind of modificationKinds)
|
|
213
|
+
pass.modifications.recordEmitted(entityId, kind);
|
|
146
214
|
recordSourceLineDelivery(pass.modifications, entityId, mutated);
|
|
147
215
|
// `rewrittenEntityIds` made the source-iteration pass skip this
|
|
148
216
|
// host, so this line is the ONLY place a full export can see its
|
|
@@ -163,7 +231,8 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
163
231
|
// the affected psets produced replacement content, the property-set pass
|
|
164
232
|
// above has already recorded the emission, and an emission outranks an
|
|
165
233
|
// acknowledgement.)
|
|
166
|
-
|
|
234
|
+
for (const kind of modificationKinds)
|
|
235
|
+
pass.modifications.acknowledgeUndelivered(entityId, kind);
|
|
167
236
|
// `line` is byte-for-byte what the source-iteration pass would have
|
|
168
237
|
// written, so emit it wherever that pass would have run. Under
|
|
169
238
|
// `deltaOnly` it does not run, and a line the mutation pipeline left
|
|
@@ -185,15 +254,5 @@ export function generatePropertyAndQuantitySetEntities(pass, options, ctx) {
|
|
|
185
254
|
nominateDeliveredInPlaceEdits(pass.modifications, entityId, mutated, pass.inPlaceNominees);
|
|
186
255
|
}
|
|
187
256
|
}
|
|
188
|
-
// Generate new quantity entities for mutations
|
|
189
|
-
for (const { entityId, qsets } of pass.newQuantitySets) {
|
|
190
|
-
if (!pass.willBeEmitted(entityId))
|
|
191
|
-
continue;
|
|
192
|
-
const newEntities = generateQuantitySetEntities(ctx, entityId, qsets, pass.willBeEmitted, pass.effective, options.guidRandom);
|
|
193
|
-
pass.entities.push(...newEntities.lines);
|
|
194
|
-
pass.newEntityCount += newEntities.count;
|
|
195
|
-
if (newEntities.lines.length > 0)
|
|
196
|
-
pass.modifications.recordEmitted(entityId, 'quantity-set');
|
|
197
|
-
}
|
|
198
257
|
}
|
|
199
258
|
//# sourceMappingURL=step-property-sets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-property-sets.js","sourceRoot":"","sources":["../src/step-property-sets.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAA2B,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"step-property-sets.js","sourceRoot":"","sources":["../src/step-property-sets.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAA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,KAAK,UAAU,CAAC;QACpC,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,IAAI,OAAO,EAAE,CAAC;YAC1C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;QACD,+DAA+D;QAC/D,oEAAoE;QACpE,uEAAuE;QACvE,kEAAkE;QAClE,sEAAsE;QACtE,yCAAyC;QACzC,IAAI,OAAO,EAAE,CAAC;YACZ,wBAAwB,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAChE,oEAAoE;YACpE,wEAAwE;YACxE,6BAA6B,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;AAGH,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a `#id=TYPE(args);` record's parts sit in its text: the one reader
|
|
3
|
+
* every STEP writer in this package frames a record with before it edits one
|
|
4
|
+
* (#7682, EXPORT-STEP-1).
|
|
5
|
+
*
|
|
6
|
+
* ISO 10303-21 allows trivia (whitespace, including vertical tab and form
|
|
7
|
+
* feed, and `/* ... */` comments) wherever whitespace may go, so
|
|
8
|
+
* `#5=IFCWALL(...) ;` and `#5=IFCWALL(...) /* c */;` are records like any
|
|
9
|
+
* other. The writers used to find the frame each their own way, and the ones
|
|
10
|
+
* that looked for a literal `');'` read those records as no record at all:
|
|
11
|
+
* every named, positional and retype edit on them was dropped and nothing
|
|
12
|
+
* reported it.
|
|
13
|
+
*
|
|
14
|
+
* This is the matched half of `rust/export/src/step_record_frame.rs`; the two
|
|
15
|
+
* are changed together and pinned by the shared parity vectors in
|
|
16
|
+
* `rust/export/tests/fixtures/step_log_parity_vectors.json`. Trivia follows
|
|
17
|
+
* core's `skip_step_trivia` / `is_step_space` (`skipTrivia` / `isSpaceByte` in
|
|
18
|
+
* `@ifc-lite/parser`'s `step-lexing.ts`): ASCII whitespace only, and an
|
|
19
|
+
* unterminated comment ends the scan with nothing found.
|
|
20
|
+
*
|
|
21
|
+
* The close is found from the END, the way the writers found it before: the
|
|
22
|
+
* last `)` that only trivia and one `;` follow. A forward scan would have to
|
|
23
|
+
* trust the record's string literals, and a record with an undoubled
|
|
24
|
+
* apostrophe would then have no frame at all, where it now has one whose
|
|
25
|
+
* argument list the slot splitter refuses and the caller reports as
|
|
26
|
+
* unreadable. The candidate found walking back is then checked forward, so a
|
|
27
|
+
* frame returned is always one the forward trivia rule agrees with.
|
|
28
|
+
*/
|
|
29
|
+
/** `#id=TYPE(`: everything a record's head says, as string offsets. */
|
|
30
|
+
export interface StepRecordHead {
|
|
31
|
+
/** The `=` after the instance name. */
|
|
32
|
+
readonly eq: number;
|
|
33
|
+
/** The type keyword, `typeStart..typeEnd`. */
|
|
34
|
+
readonly typeStart: number;
|
|
35
|
+
readonly typeEnd: number;
|
|
36
|
+
/** The `(` that opens the argument list. */
|
|
37
|
+
readonly open: number;
|
|
38
|
+
}
|
|
39
|
+
/** A whole record: its head, the `)` closing the argument list, and the `;`. */
|
|
40
|
+
export interface StepRecordFrame {
|
|
41
|
+
readonly head: StepRecordHead;
|
|
42
|
+
readonly close: number;
|
|
43
|
+
readonly semi: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `#digits TRIVIA =`: the line declares an entity instance, whatever follows
|
|
47
|
+
* the `=`. Trivia, comments included, sits before the `=` as core's scanner
|
|
48
|
+
* reads it: `#48/* c */=(IFCA(..)IFCB(..));` is a record. A scanner indexes records {@link stepRecordHead} does not read (a
|
|
49
|
+
* complex instance `#N=(IFCA(..)IFCB(..));`, a non-ASCII character after the
|
|
50
|
+
* `=` or before the `(`), so a line that opens like this and has no frame is an
|
|
51
|
+
* UNREADABLE record, never "no record": an edit queued for it is reported, not
|
|
52
|
+
* passed over (#7682 review).
|
|
53
|
+
*/
|
|
54
|
+
export declare function opensStepRecord(text: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The record's head, or null when `text` does not open as
|
|
57
|
+
* `#digits = KEYWORD (`, trivia allowed around the `=` and before the `(`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function stepRecordHead(text: string): StepRecordHead | null;
|
|
60
|
+
/**
|
|
61
|
+
* The record's frame, or null when `text` is not one whole record:
|
|
62
|
+
* {@link stepRecordHead}, then a `)` that only trivia, one `;` and trivia follow.
|
|
63
|
+
*/
|
|
64
|
+
export declare function stepRecordFrame(text: string): StepRecordFrame | null;
|
|
65
|
+
/** The text between the argument list's parentheses. */
|
|
66
|
+
export declare function frameArgs(text: string, frame: StepRecordFrame): string;
|
|
67
|
+
/** `text` with its argument list replaced, every other character kept. */
|
|
68
|
+
export declare function withFrameArgs(text: string, frame: StepRecordFrame, args: string): string;
|
|
69
|
+
//# sourceMappingURL=step-record-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-record-frame.d.ts","sourceRoot":"","sources":["../src/step-record-frame.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASrD;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAiBlE;AAwCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAIpE;AAED,wDAAwD;AACxD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,CAEtE;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/** `is_step_space`: space, tab, LF, CR, vertical tab, form feed. */
|
|
5
|
+
function isStepSpace(code) {
|
|
6
|
+
return code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0d || code === 0x0b || code === 0x0c;
|
|
7
|
+
}
|
|
8
|
+
/** `skip_step_trivia`: the first index at or after `i` that is not trivia, or -1 when a comment never closes. */
|
|
9
|
+
function skipTrivia(text, i) {
|
|
10
|
+
let p = i;
|
|
11
|
+
for (;;) {
|
|
12
|
+
while (p < text.length && isStepSpace(text.charCodeAt(p)))
|
|
13
|
+
p++;
|
|
14
|
+
if (!(text[p] === '/' && text[p + 1] === '*'))
|
|
15
|
+
return p;
|
|
16
|
+
const end = text.indexOf('*/', p + 2);
|
|
17
|
+
if (end === -1)
|
|
18
|
+
return -1;
|
|
19
|
+
p = end + 2;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `#digits TRIVIA =`: the line declares an entity instance, whatever follows
|
|
24
|
+
* the `=`. Trivia, comments included, sits before the `=` as core's scanner
|
|
25
|
+
* reads it: `#48/* c */=(IFCA(..)IFCB(..));` is a record. A scanner indexes records {@link stepRecordHead} does not read (a
|
|
26
|
+
* complex instance `#N=(IFCA(..)IFCB(..));`, a non-ASCII character after the
|
|
27
|
+
* `=` or before the `(`), so a line that opens like this and has no frame is an
|
|
28
|
+
* UNREADABLE record, never "no record": an edit queued for it is reported, not
|
|
29
|
+
* passed over (#7682 review).
|
|
30
|
+
*/
|
|
31
|
+
export function opensStepRecord(text) {
|
|
32
|
+
let i = skipTrivia(text, 0);
|
|
33
|
+
if (i === -1 || text[i] !== '#')
|
|
34
|
+
return false;
|
|
35
|
+
i++;
|
|
36
|
+
const digits = i;
|
|
37
|
+
while (i < text.length && text[i] >= '0' && text[i] <= '9')
|
|
38
|
+
i++;
|
|
39
|
+
if (i === digits)
|
|
40
|
+
return false;
|
|
41
|
+
const eq = skipTrivia(text, i);
|
|
42
|
+
return eq !== -1 && text[eq] === '=';
|
|
43
|
+
}
|
|
44
|
+
function isKeywordChar(c) {
|
|
45
|
+
return c !== undefined && /[A-Za-z0-9_]/.test(c);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The record's head, or null when `text` does not open as
|
|
49
|
+
* `#digits = KEYWORD (`, trivia allowed around the `=` and before the `(`.
|
|
50
|
+
*/
|
|
51
|
+
export function stepRecordHead(text) {
|
|
52
|
+
let i = skipTrivia(text, 0);
|
|
53
|
+
if (i === -1 || text[i] !== '#')
|
|
54
|
+
return null;
|
|
55
|
+
i++;
|
|
56
|
+
const digits = i;
|
|
57
|
+
while (i < text.length && text[i] >= '0' && text[i] <= '9')
|
|
58
|
+
i++;
|
|
59
|
+
if (i === digits)
|
|
60
|
+
return null;
|
|
61
|
+
const eq = skipTrivia(text, i);
|
|
62
|
+
if (eq === -1 || text[eq] !== '=')
|
|
63
|
+
return null;
|
|
64
|
+
const typeStart = skipTrivia(text, eq + 1);
|
|
65
|
+
if (typeStart === -1)
|
|
66
|
+
return null;
|
|
67
|
+
let typeEnd = typeStart;
|
|
68
|
+
while (isKeywordChar(text[typeEnd]))
|
|
69
|
+
typeEnd++;
|
|
70
|
+
if (typeEnd === typeStart)
|
|
71
|
+
return null;
|
|
72
|
+
const open = skipTrivia(text, typeEnd);
|
|
73
|
+
if (open === -1 || text[open] !== '(')
|
|
74
|
+
return null;
|
|
75
|
+
return { eq, typeStart, typeEnd, open };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Where a trailing comment that ends just before `end` (with `*/`) starts. A
|
|
79
|
+
* comment cannot hold `*/`, so it opens at one of the `/*` after the previous
|
|
80
|
+
* `*/`: the nearest one unless the comment itself holds a `/*`, else the first
|
|
81
|
+
* one unless a string in the record body holds a `*/` and a `/*`. Neither
|
|
82
|
+
* guess is trusted: {@link stepRecordFrame} tries both and keeps the one the
|
|
83
|
+
* forward check confirms.
|
|
84
|
+
*/
|
|
85
|
+
function commentStart(text, end, nearest) {
|
|
86
|
+
const body = text.slice(0, end);
|
|
87
|
+
if (nearest)
|
|
88
|
+
return body.lastIndexOf('/*');
|
|
89
|
+
const prev = body.lastIndexOf('*/');
|
|
90
|
+
const floor = prev === -1 ? 0 : prev + 2;
|
|
91
|
+
return body.indexOf('/*', floor);
|
|
92
|
+
}
|
|
93
|
+
/** Walk back over trivia ending just before `k`. */
|
|
94
|
+
function triviaBack(text, k, nearest) {
|
|
95
|
+
for (;;) {
|
|
96
|
+
while (k > 0 && isStepSpace(text.charCodeAt(k - 1)))
|
|
97
|
+
k--;
|
|
98
|
+
if (k < 4 || text[k - 2] !== '*' || text[k - 1] !== '/')
|
|
99
|
+
return k;
|
|
100
|
+
const start = commentStart(text, k - 2, nearest);
|
|
101
|
+
if (start === -1)
|
|
102
|
+
return k;
|
|
103
|
+
k = start;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function frameWith(text, head, nearest) {
|
|
107
|
+
const semi = triviaBack(text, text.length, nearest) - 1;
|
|
108
|
+
if (semi < 0 || text[semi] !== ';')
|
|
109
|
+
return null;
|
|
110
|
+
const close = triviaBack(text, semi, nearest) - 1;
|
|
111
|
+
if (close <= head.open || text[close] !== ')')
|
|
112
|
+
return null;
|
|
113
|
+
// The walk back is a guess about where the trailing comments begin; the
|
|
114
|
+
// forward trivia rule is what decides it.
|
|
115
|
+
const verified = skipTrivia(text, close + 1) === semi && skipTrivia(text, semi + 1) === text.length;
|
|
116
|
+
return verified ? { head, close, semi } : null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The record's frame, or null when `text` is not one whole record:
|
|
120
|
+
* {@link stepRecordHead}, then a `)` that only trivia, one `;` and trivia follow.
|
|
121
|
+
*/
|
|
122
|
+
export function stepRecordFrame(text) {
|
|
123
|
+
const head = stepRecordHead(text);
|
|
124
|
+
if (head === null)
|
|
125
|
+
return null;
|
|
126
|
+
return frameWith(text, head, true) ?? frameWith(text, head, false);
|
|
127
|
+
}
|
|
128
|
+
/** The text between the argument list's parentheses. */
|
|
129
|
+
export function frameArgs(text, frame) {
|
|
130
|
+
return text.slice(frame.head.open + 1, frame.close);
|
|
131
|
+
}
|
|
132
|
+
/** `text` with its argument list replaced, every other character kept. */
|
|
133
|
+
export function withFrameArgs(text, frame, args) {
|
|
134
|
+
return `${text.slice(0, frame.head.open + 1)}${args}${text.slice(frame.close)}`;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=step-record-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-record-frame.js","sourceRoot":"","sources":["../src/step-record-frame.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAiD/D,oEAAoE;AACpE,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC;AAC5G,CAAC;AAED,iHAAiH;AACjH,SAAS,U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CAAC,IAAY,EAAE,KAAsB,EAAE,IAAY;IAC9E,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;AAClF,CAAC"}
|
package/dist/step-ref-scan.d.ts
CHANGED
|
@@ -3,4 +3,12 @@
|
|
|
3
3
|
* Short-circuits rather than collecting every reference the text contains.
|
|
4
4
|
*/
|
|
5
5
|
export declare function referencesAnyExpressId(attrsRaw: string, ids: ReadonlySet<number>): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Byte twin of `stepStringLiteralEnd` (`@ifc-lite/encoding`) for walkers that
|
|
8
|
+
* scan a source buffer without decoding it (#7589): the index just past the
|
|
9
|
+
* apostrophe closing the literal that opens at `open`, or `-1` when it does not
|
|
10
|
+
* close before `end`. Same rule, tested in the same order: a `\S\` PAGE
|
|
11
|
+
* operand is text, then `''` is an escaped quote.
|
|
12
|
+
*/
|
|
13
|
+
export declare function stepBytesLiteralEnd(bytes: Uint8Array, open: number, end: number): number;
|
|
6
14
|
//# sourceMappingURL=step-ref-scan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-ref-scan.d.ts","sourceRoot":"","sources":["../src/step-ref-scan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step-ref-scan.d.ts","sourceRoot":"","sources":["../src/step-ref-scan.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CA2B1F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQxF"}
|
package/dist/step-ref-scan.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* caller only ever asks "does this record touch one of these ids", never
|
|
13
13
|
* which slot.
|
|
14
14
|
*/
|
|
15
|
+
import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
15
16
|
import { skipStepComment } from './step-comment-skip.js';
|
|
16
17
|
/**
|
|
17
18
|
* True as soon as any `#id` found in `attrsRaw` is a member of `ids`.
|
|
@@ -20,22 +21,21 @@ import { skipStepComment } from './step-comment-skip.js';
|
|
|
20
21
|
export function referencesAnyExpressId(attrsRaw, ids) {
|
|
21
22
|
if (ids.size === 0)
|
|
22
23
|
return false;
|
|
23
|
-
let inString = false;
|
|
24
24
|
for (let i = 0; i < attrsRaw.length; i++) {
|
|
25
25
|
const ch = attrsRaw[i];
|
|
26
|
-
if (
|
|
26
|
+
if (ch === '/' && attrsRaw[i + 1] === '*') {
|
|
27
27
|
i = skipStepComment(attrsRaw, i) - 1;
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
30
|
if (ch === '\'') {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
// The shared rule for where a literal ends (#7589); unterminated: the rest.
|
|
32
|
+
const end = stepStringLiteralEnd(attrsRaw, i);
|
|
33
|
+
if (end === -1)
|
|
34
|
+
return false;
|
|
35
|
+
i = end - 1;
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (ch === '#') {
|
|
39
39
|
let j = i + 1;
|
|
40
40
|
let digits = '';
|
|
41
41
|
while (j < attrsRaw.length && attrsRaw[j] >= '0' && attrsRaw[j] <= '9') {
|
|
@@ -49,4 +49,25 @@ export function referencesAnyExpressId(attrsRaw, ids) {
|
|
|
49
49
|
}
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Byte twin of `stepStringLiteralEnd` (`@ifc-lite/encoding`) for walkers that
|
|
54
|
+
* scan a source buffer without decoding it (#7589): the index just past the
|
|
55
|
+
* apostrophe closing the literal that opens at `open`, or `-1` when it does not
|
|
56
|
+
* close before `end`. Same rule, tested in the same order: a `\S\` PAGE
|
|
57
|
+
* operand is text, then `''` is an escaped quote.
|
|
58
|
+
*/
|
|
59
|
+
export function stepBytesLiteralEnd(bytes, open, end) {
|
|
60
|
+
for (let p = open + 1; p < end; p++) {
|
|
61
|
+
if (bytes[p] !== 0x27)
|
|
62
|
+
continue;
|
|
63
|
+
if (p >= 3 && bytes[p - 1] === 0x5c && bytes[p - 2] === 0x53 && bytes[p - 3] === 0x5c)
|
|
64
|
+
continue;
|
|
65
|
+
if (p + 1 < end && bytes[p + 1] === 0x27) {
|
|
66
|
+
p++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return p + 1;
|
|
70
|
+
}
|
|
71
|
+
return -1;
|
|
72
|
+
}
|
|
52
73
|
//# sourceMappingURL=step-ref-scan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-ref-scan.js","sourceRoot":"","sources":["../src/step-ref-scan.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;GAUG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,GAAwB;IAC/E,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjC,
|
|
1
|
+
{"version":3,"file":"step-ref-scan.js","sourceRoot":"","sources":["../src/step-ref-scan.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;GAUG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,GAAwB;IAC/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CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAiB,EAAE,IAAY,EAAE,GAAW;IAC9E,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,SAAS;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;YAAE,SAAS;QAChG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAAC,CAAC,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -44,12 +44,24 @@ export declare function serializeTypedMarker(type: string, value: string | numbe
|
|
|
44
44
|
/**
|
|
45
45
|
* Convert a number to a valid STEP REAL literal.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* Delegates the mantissa/`E` rewrite to the shared {@link formatStepReal} so
|
|
48
|
+
* exponential magnitudes serialize as valid STEP (`5e-8` -> `5.E-8`, `1e21` ->
|
|
49
|
+
* `1.E+21`, `1.5e-7` -> `1.5E-7`) rather than the invalid `5e-8.` /
|
|
50
|
+
* lowercase-`e` forms a bare decimal-point append produced.
|
|
51
|
+
*
|
|
52
|
+
* A non-finite value THROWS (#7679). It used to be written as a made-up `0.`,
|
|
53
|
+
* which turned a NaN measure into a real zero. `$` ("omitted") is the reading
|
|
54
|
+
* only a caller that owns a whole optional attribute or property value can
|
|
55
|
+
* give, so those callers test `Number.isFinite` first; every other slot is
|
|
56
|
+
* refused here. The Rust writer (`jsval.rs::to_step_real`) refuses identically.
|
|
51
57
|
*/
|
|
52
58
|
export declare function toStepReal(v: number): string;
|
|
59
|
+
/**
|
|
60
|
+
* The digits of a finite integral number below 1e21, or `null`.
|
|
61
|
+
* `String(1e21)` is `1e+21`, which is not a STEP INTEGER (#7679). Not 2^53:
|
|
62
|
+
* the digits of a value between 2^53 and 1e21 are still a valid STEP INTEGER.
|
|
63
|
+
*/
|
|
64
|
+
export declare function toStepInteger(v: number): string | null;
|
|
53
65
|
/**
|
|
54
66
|
* Map QuantityType enum to IFC STEP entity type name.
|
|
55
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-serialization.d.ts","sourceRoot":"","sources":["../src/step-serialization.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAmC,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAkB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"step-serialization.d.ts","sourceRoot":"","sources":["../src/step-serialization.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAmC,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAkB,gBAAgB,EAAgC,MAAM,gBAAgB,CAAC;AAE9G;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAK5B;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqBlE;AAqDD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,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