@ifc-lite/export 4.11.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/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.map +1 -1
- package/dist/declared-property-type.js +3 -2
- package/dist/declared-property-type.js.map +1 -1
- 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/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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- 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-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 +2 -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 +13 -13
- package/dist/step-exporter.js.map +1 -1
- 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 +2 -0
- package/dist/step-pass-builder.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 +53 -14
- package/dist/step-property-set-readers.js.map +1 -1
- package/dist/step-property-sets.d.ts +14 -0
- package/dist/step-property-sets.d.ts.map +1 -1
- package/dist/step-property-sets.js +25 -8
- 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/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 +8 -8
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
import { getInheritanceChainAcrossSchemas } from '@ifc-lite/parser';
|
|
5
|
+
import { decodeRange } from './source-ref-bounds.js';
|
|
6
|
+
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
7
|
+
import { convertStepLine } from './schema-converter.js';
|
|
8
|
+
const ASSIGNMENT = 'IFCPRESENTATIONSTYLEASSIGNMENT';
|
|
9
|
+
/** Deepest list nesting {@link StyleFlatten.strip} reads (IFC nests three). */
|
|
10
|
+
const MAX_DEPTH = 8;
|
|
11
|
+
function listMembers(arg) {
|
|
12
|
+
const t = arg.trim();
|
|
13
|
+
if (t.startsWith('(') && t.endsWith(')')) {
|
|
14
|
+
const items = splitTopLevelStepArguments(t.slice(1, -1));
|
|
15
|
+
return items === null ? null : items.map((m) => m.trim());
|
|
16
|
+
}
|
|
17
|
+
return [t];
|
|
18
|
+
}
|
|
19
|
+
function refId(token) {
|
|
20
|
+
const m = /^#\s*(\d+)$/.exec(token.trim());
|
|
21
|
+
return m ? Number(m[1]) : null;
|
|
22
|
+
}
|
|
23
|
+
/** The `#n` ids of a `Styles` value, or null when a member is not a reference. */
|
|
24
|
+
function styleRefs(value) {
|
|
25
|
+
const ids = listMembers(value)?.map(refId) ?? null;
|
|
26
|
+
return ids === null || ids.includes(null) ? null : ids;
|
|
27
|
+
}
|
|
28
|
+
function isStyledItem(entityType) {
|
|
29
|
+
return entityType === 'IFCSTYLEDITEM' || getInheritanceChainAcrossSchemas(entityType).includes('IfcStyledItem');
|
|
30
|
+
}
|
|
31
|
+
export class StyleFlatten {
|
|
32
|
+
members = new Map();
|
|
33
|
+
/**
|
|
34
|
+
* Styled items whose `Styles` names records only, by those ids: the ones
|
|
35
|
+
* that can flatten to nothing. Read from the store once an assignment holds
|
|
36
|
+
* nothing IFC4X3 can name (`collected`); noted lines always.
|
|
37
|
+
*/
|
|
38
|
+
styled = new Map();
|
|
39
|
+
collected = false;
|
|
40
|
+
/**
|
|
41
|
+
* Styled items whose flattened `Styles` is empty (`SET [1:?]` in IFC4X3, so
|
|
42
|
+
* `()` is not a file): not written, and every reference to one is removed (a
|
|
43
|
+
* list member) or written `$` (a single slot).
|
|
44
|
+
*/
|
|
45
|
+
emptied = new Set();
|
|
46
|
+
/** True for the one conversion that flattens: IFC2X3 or IFC4 source, IFC4X3 target. */
|
|
47
|
+
static applies(from, to) {
|
|
48
|
+
return to === 'IFC4X3' && (from === 'IFC2X3' || from === 'IFC4');
|
|
49
|
+
}
|
|
50
|
+
/** An empty table for a conversion that flattens; undefined for one that does not. */
|
|
51
|
+
static create(from, to) {
|
|
52
|
+
return StyleFlatten.applies(from, to) ? new StyleFlatten() : undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Register an assignment record by its text (source, created, copied or edited; the last record with an id wins). */
|
|
55
|
+
note(expressId, text) {
|
|
56
|
+
const attrs = /^\s*#\d+\s*=\s*\w+\s*\((.*)\)\s*;?\s*$/s.exec(text)?.[1];
|
|
57
|
+
const args = attrs === undefined ? null : splitTopLevelStepArguments(attrs);
|
|
58
|
+
const list = args && args.length > 0 ? listMembers(args[0]) : null;
|
|
59
|
+
// IFC4X3's `Styles` takes IfcPresentationStyle entities only: the typed
|
|
60
|
+
// `IFCNULLSTYLE(.NULL.)` of IFC2X3/IFC4 has no place there and is dropped.
|
|
61
|
+
if (list)
|
|
62
|
+
this.members.set(expressId, list.filter((m) => !/^IFCNULLSTYLE\s*\(/i.test(m)));
|
|
63
|
+
else
|
|
64
|
+
this.members.delete(expressId);
|
|
65
|
+
}
|
|
66
|
+
/** {@link note}, for any record line: an assignment or a styled item is registered. Call {@link settle} after. */
|
|
67
|
+
noteLine(line) {
|
|
68
|
+
const m = RECORD.exec(line);
|
|
69
|
+
if (!m)
|
|
70
|
+
return;
|
|
71
|
+
const type = m[3].toUpperCase();
|
|
72
|
+
if (type === ASSIGNMENT)
|
|
73
|
+
this.note(Number(m[2]), line);
|
|
74
|
+
else if (isStyledItem(type)) {
|
|
75
|
+
const args = splitTopLevelStepArguments(m[5]);
|
|
76
|
+
const refs = args && args.length > 1 ? styleRefs(args[1]) : null;
|
|
77
|
+
if (refs)
|
|
78
|
+
this.styled.set(Number(m[2]), refs);
|
|
79
|
+
else
|
|
80
|
+
this.styled.delete(Number(m[2]));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** From record lines (assignments and styled items are read, the rest ignored). */
|
|
84
|
+
static fromRecords(records) {
|
|
85
|
+
const flat = new StyleFlatten();
|
|
86
|
+
for (const text of records)
|
|
87
|
+
flat.noteLine(text);
|
|
88
|
+
flat.collected = true;
|
|
89
|
+
flat.settle();
|
|
90
|
+
return flat;
|
|
91
|
+
}
|
|
92
|
+
/** Read every assignment of a parsed store; undefined when the conversion does not flatten. */
|
|
93
|
+
static fromStore(store, from, to) {
|
|
94
|
+
const flat = StyleFlatten.create(from, to);
|
|
95
|
+
if (!flat || !store.source)
|
|
96
|
+
return flat;
|
|
97
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
98
|
+
for (const id of store.entityIndex.byType.get(ASSIGNMENT) ?? []) {
|
|
99
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
100
|
+
const ref = store.entityIndex.byId.get(id);
|
|
101
|
+
if (ref)
|
|
102
|
+
flat.note(id, decodeRange(store.source, ref.byteOffset, ref.byteOffset + ref.byteLength));
|
|
103
|
+
}
|
|
104
|
+
flat.settle(store);
|
|
105
|
+
return flat;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Edited source assignments: each id's record text after the session's
|
|
109
|
+
* edits (`edited(id)`, null when unchanged), so a styled item flattens to
|
|
110
|
+
* the members the user set, not the source ones.
|
|
111
|
+
*/
|
|
112
|
+
noteEdited(store, edited) {
|
|
113
|
+
if (!store.source)
|
|
114
|
+
return;
|
|
115
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
116
|
+
for (const id of store.entityIndex.byType.get(ASSIGNMENT) ?? []) {
|
|
117
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
118
|
+
const ref = store.entityIndex.byId.get(id);
|
|
119
|
+
const text = ref ? edited(id, decodeRange(store.source, ref.byteOffset, ref.byteOffset + ref.byteLength)) : null;
|
|
120
|
+
if (text !== null)
|
|
121
|
+
this.note(id, text);
|
|
122
|
+
}
|
|
123
|
+
this.settle(store);
|
|
124
|
+
}
|
|
125
|
+
/** Decide which styled items flatten to nothing, reading the store's styled items once an assignment holds nothing. */
|
|
126
|
+
settle(store) {
|
|
127
|
+
const source = store?.source;
|
|
128
|
+
if (source && !this.collected && [...this.members.values()].some((m) => m.length === 0)) {
|
|
129
|
+
this.collected = true;
|
|
130
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
131
|
+
for (const [type, ids] of store.entityIndex.byType) {
|
|
132
|
+
if (!isStyledItem(type.toUpperCase()))
|
|
133
|
+
continue;
|
|
134
|
+
for (const id of ids) {
|
|
135
|
+
// @raw-entity-enumeration-ok the flatten reads SOURCE records; edits arrive through noteEdited and created records through noteLine
|
|
136
|
+
const ref = store.entityIndex.byId.get(id);
|
|
137
|
+
if (ref && !this.styled.has(id))
|
|
138
|
+
this.noteLine(decodeRange(source, ref.byteOffset, ref.byteOffset + ref.byteLength));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const empty = (r) => this.members.get(r)?.length === 0;
|
|
143
|
+
this.emptied = new Set([...this.styled].filter(([, refs]) => refs.length > 0 && refs.every(empty)).map(([id]) => id));
|
|
144
|
+
}
|
|
145
|
+
/** A record that is not written: an assignment, or a styled item whose `Styles` flattens to nothing. */
|
|
146
|
+
drops(expressId) {
|
|
147
|
+
return this.members.has(expressId) || this.emptied.has(expressId);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The flattened `Styles` members, or null when this is not a styled item
|
|
151
|
+
* naming an assignment. `args` is the validated split.
|
|
152
|
+
*/
|
|
153
|
+
flattened(entityType, args) {
|
|
154
|
+
if (args.length < 2)
|
|
155
|
+
return null;
|
|
156
|
+
const styles = listMembers(args[1]);
|
|
157
|
+
if (!styles || !styles.some((m) => {
|
|
158
|
+
const id = refId(m);
|
|
159
|
+
return id !== null && this.members.has(id);
|
|
160
|
+
}))
|
|
161
|
+
return null;
|
|
162
|
+
if (!isStyledItem(entityType))
|
|
163
|
+
return null;
|
|
164
|
+
const flat = [];
|
|
165
|
+
for (const member of styles) {
|
|
166
|
+
const id = refId(member);
|
|
167
|
+
for (const m of (id !== null ? this.members.get(id) : undefined) ?? [member]) {
|
|
168
|
+
if (!flat.includes(m))
|
|
169
|
+
flat.push(m);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return flat;
|
|
173
|
+
}
|
|
174
|
+
/** `arg` without its references to an emptied styled item; null when `arg` is one. */
|
|
175
|
+
strip(arg, depth) {
|
|
176
|
+
const t = arg.trim();
|
|
177
|
+
const id = refId(t);
|
|
178
|
+
if (id !== null && this.emptied.has(id))
|
|
179
|
+
return null;
|
|
180
|
+
const items = depth < MAX_DEPTH && t.startsWith('(') && t.endsWith(')') ? splitTopLevelStepArguments(t.slice(1, -1)) : null;
|
|
181
|
+
if (items) {
|
|
182
|
+
const kept = items.map((m) => this.strip(m, depth + 1));
|
|
183
|
+
if (kept.some((k, i) => k !== items[i]))
|
|
184
|
+
return `(${kept.filter((k) => k !== null).join(',')})`;
|
|
185
|
+
}
|
|
186
|
+
return arg;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The attribute list with its `Styles` entries flattened and its references
|
|
190
|
+
* to an emptied styled item removed; `'drop'` when the record is a styled
|
|
191
|
+
* item left with no style; null when nothing changes. `args` is the validated split.
|
|
192
|
+
*/
|
|
193
|
+
flatten(entityType, args) {
|
|
194
|
+
const out = [...args];
|
|
195
|
+
let changed = false;
|
|
196
|
+
const flat = this.flattened(entityType, args);
|
|
197
|
+
if (flat !== null) {
|
|
198
|
+
if (flat.length === 0)
|
|
199
|
+
return 'drop';
|
|
200
|
+
out[1] = `(${flat.join(',')})`;
|
|
201
|
+
changed = true;
|
|
202
|
+
}
|
|
203
|
+
if (this.emptied.size > 0) {
|
|
204
|
+
for (let i = 0; i < out.length; i++) {
|
|
205
|
+
if (!out[i].includes('#'))
|
|
206
|
+
continue;
|
|
207
|
+
const stripped = this.strip(out[i], 0) ?? '$';
|
|
208
|
+
if (stripped !== out[i]) {
|
|
209
|
+
out[i] = stripped;
|
|
210
|
+
changed = true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return changed ? out.join(',') : null;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* One record through the flatten: null for an assignment or an emptied
|
|
218
|
+
* styled item (not written), the rewritten line for a record naming either,
|
|
219
|
+
* else `line`.
|
|
220
|
+
*/
|
|
221
|
+
apply(line) {
|
|
222
|
+
const m = RECORD.exec(line);
|
|
223
|
+
if (!m)
|
|
224
|
+
return line;
|
|
225
|
+
const type = m[3].toUpperCase();
|
|
226
|
+
if (type === ASSIGNMENT && this.drops(Number(m[2])))
|
|
227
|
+
return null;
|
|
228
|
+
const split = splitTopLevelStepArguments(m[5]);
|
|
229
|
+
const flat = split === null ? null : this.flatten(type, split);
|
|
230
|
+
if (flat === 'drop')
|
|
231
|
+
return null;
|
|
232
|
+
return flat === null ? line : `${m[1]}${m[3]}${m[4]}(${flat});`;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const RECORD = /^(\s*#(\d+)\s*=\s*)(\w+)(\s*)\(([\s\S]*)\)\s*;?\s*$/;
|
|
236
|
+
/**
|
|
237
|
+
* `convertStepLine`, with `styles` applied first (see {@link StyleFlatten.apply}).
|
|
238
|
+
* Without `styles` it is `convertStepLine` itself.
|
|
239
|
+
*/
|
|
240
|
+
export function convertStepLineFlattening(styles, ...args) {
|
|
241
|
+
const [line, ...rest] = args;
|
|
242
|
+
const flat = styles ? styles.apply(line) : line;
|
|
243
|
+
return flat === null ? null : convertStepLine(flat, ...rest);
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=schema-style-flatten.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-style-flatten.js","sourceRoot":"","sources":["../src/schema-style-flatten.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAqB/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAyB,MAAM,uBAAuB,CAAC;AAE/E,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACrB,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG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AAE,CAAC;QAChC,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACjE,MAAM,KAAK,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC/D,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QACjC,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC;IAClE,CAAC;CACF;AAED,MAAM,MAAM,GAAG,qDAAqD,CAAC;AAErE;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAgC,EAChC,GAAG,IAAwC;IAE3C,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -29,7 +29,12 @@ export interface StepRecordSlots {
|
|
|
29
29
|
readonly slots: readonly string[];
|
|
30
30
|
readonly suffix: string;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Parse a complete STEP record into validated, position-addressable slots.
|
|
34
|
+
* The record is framed by `stepRecordFrame` (#7682), so trivia anywhere Part 21
|
|
35
|
+
* allows it (around the `=`, before the `(`, between the `)` and the `;`) is
|
|
36
|
+
* kept in `prefix` / `suffix` rather than making the record unreadable.
|
|
37
|
+
*/
|
|
33
38
|
export declare function readStepSlots(entityText: string): StepRecordSlots | null;
|
|
34
39
|
/**
|
|
35
40
|
* Replace ONE top-level argument of a STEP record, by zero-based slot, leaving
|
|
@@ -46,7 +51,7 @@ export declare function readStepSlots(entityText: string): StepRecordSlots | nul
|
|
|
46
51
|
* is past the end of the argument list; a null must not be treated as "no
|
|
47
52
|
* change", since the intended replacement did not happen.
|
|
48
53
|
*
|
|
49
|
-
* The
|
|
54
|
+
* The frame only pins the two ENDS of the record — `#N=CLASS(` and `);`. Text
|
|
50
55
|
* malformed BETWEEN them is caught by {@link splitTopLevelStepArguments}, which
|
|
51
56
|
* rejects an argument list it could not scan cleanly rather than handing back
|
|
52
57
|
* whatever it accumulated: those parts are not the record's slots, so writing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-argument-parser.d.ts","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step-argument-parser.d.ts","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoD7D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAWxE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAsBf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CA+EzE"}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
-
import {
|
|
4
|
+
import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
5
5
|
import { skipStepComment } from './step-comment-skip.js';
|
|
6
|
-
import { isWellFormedStepSlot } from './step-slot-grammar.js';
|
|
7
|
-
|
|
8
|
-
* `#N=CLASS(...)` record prefix, with STEP trivia (whitespace and/or a
|
|
9
|
-
* `/* ... */` comment, #3789) tolerated between the type name and its `(`
|
|
10
|
-
* — same adjacency fix as `entity-extractor.ts`'s `extractEntity`, applied
|
|
11
|
-
* here because `replaceStepArgument`'s caller degrades on `null` (a lost
|
|
12
|
-
* repoint, see below), the same failure class. Compiled once since
|
|
13
|
-
* `replaceStepArgument` runs per rewritten line.
|
|
14
|
-
*/
|
|
15
|
-
const RECORD_PREFIX_RE = new RegExp(`^(#\\d+\\s*=\\s*(\\w+)${STEP_TRIVIA}\\()([\\s\\S]*)(\\)\\s*;)\\s*$`);
|
|
6
|
+
import { isStepBlank, isWellFormedStepSlot } from './step-slot-grammar.js';
|
|
7
|
+
import { frameArgs, stepRecordFrame } from './step-record-frame.js';
|
|
16
8
|
/**
|
|
17
9
|
* The STEP argument parser and rewriter: reading a record's top-level argument
|
|
18
10
|
* list out of its text, and writing one slot back.
|
|
@@ -41,32 +33,24 @@ export function splitTopLevelListItems(text) {
|
|
|
41
33
|
const parts = [];
|
|
42
34
|
let current = '';
|
|
43
35
|
let depth = 0;
|
|
44
|
-
let inString = false;
|
|
45
36
|
for (let i = 0; i < text.length; i++) {
|
|
46
37
|
const char = text[i];
|
|
47
|
-
if (
|
|
38
|
+
if (char === '/' && text[i + 1] === '*') {
|
|
48
39
|
const stop = skipStepComment(text, i); // see skipStepComment's docstring
|
|
49
40
|
current += text.slice(i, stop);
|
|
50
41
|
i = stop - 1;
|
|
51
42
|
continue;
|
|
52
43
|
}
|
|
53
|
-
current += char;
|
|
54
|
-
if (inString) {
|
|
55
|
-
if (char === '\'') {
|
|
56
|
-
if (text[i + 1] === '\'') {
|
|
57
|
-
current += text[i + 1];
|
|
58
|
-
i++;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
inString = false;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
44
|
if (char === '\'') {
|
|
67
|
-
|
|
45
|
+
// A literal is copied whole; where it ends is the shared rule, so `''`
|
|
46
|
+
// and a `\S\'` PAGE operand stay inside it (#7589). Unterminated: the rest.
|
|
47
|
+
const end = stepStringLiteralEnd(text, i);
|
|
48
|
+
const stop = end === -1 ? text.length : end;
|
|
49
|
+
current += text.slice(i, stop);
|
|
50
|
+
i = stop - 1;
|
|
68
51
|
continue;
|
|
69
52
|
}
|
|
53
|
+
current += char;
|
|
70
54
|
if (char === '(') {
|
|
71
55
|
depth++;
|
|
72
56
|
continue;
|
|
@@ -91,16 +75,25 @@ export function splitTopLevelListItems(text) {
|
|
|
91
75
|
}
|
|
92
76
|
return parts;
|
|
93
77
|
}
|
|
94
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Parse a complete STEP record into validated, position-addressable slots.
|
|
80
|
+
* The record is framed by `stepRecordFrame` (#7682), so trivia anywhere Part 21
|
|
81
|
+
* allows it (around the `=`, before the `(`, between the `)` and the `;`) is
|
|
82
|
+
* kept in `prefix` / `suffix` rather than making the record unreadable.
|
|
83
|
+
*/
|
|
95
84
|
export function readStepSlots(entityText) {
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
85
|
+
const frame = stepRecordFrame(entityText);
|
|
86
|
+
if (frame === null)
|
|
98
87
|
return null;
|
|
99
|
-
const
|
|
100
|
-
const slots = splitTopLevelStepArguments(attrsText);
|
|
88
|
+
const slots = splitTopLevelStepArguments(frameArgs(entityText, frame));
|
|
101
89
|
if (slots === null)
|
|
102
90
|
return null;
|
|
103
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
prefix: entityText.slice(0, frame.head.open + 1),
|
|
93
|
+
type: entityText.slice(frame.head.typeStart, frame.head.typeEnd).toUpperCase(),
|
|
94
|
+
slots,
|
|
95
|
+
suffix: entityText.slice(frame.close),
|
|
96
|
+
};
|
|
104
97
|
}
|
|
105
98
|
/**
|
|
106
99
|
* Replace ONE top-level argument of a STEP record, by zero-based slot, leaving
|
|
@@ -117,7 +110,7 @@ export function readStepSlots(entityText) {
|
|
|
117
110
|
* is past the end of the argument list; a null must not be treated as "no
|
|
118
111
|
* change", since the intended replacement did not happen.
|
|
119
112
|
*
|
|
120
|
-
* The
|
|
113
|
+
* The frame only pins the two ENDS of the record — `#N=CLASS(` and `);`. Text
|
|
121
114
|
* malformed BETWEEN them is caught by {@link splitTopLevelStepArguments}, which
|
|
122
115
|
* rejects an argument list it could not scan cleanly rather than handing back
|
|
123
116
|
* whatever it accumulated: those parts are not the record's slots, so writing
|
|
@@ -198,51 +191,65 @@ export function replaceStepArgument(entityText, attrIndex, replacement) {
|
|
|
198
191
|
* that has no slots.
|
|
199
192
|
*/
|
|
200
193
|
export function splitTopLevelStepArguments(input) {
|
|
201
|
-
|
|
194
|
+
// STEP whitespace only (core's `is_step_space`), never `trim()`: a no-break
|
|
195
|
+
// space is not padding, and `String.prototype.trim` strips it.
|
|
196
|
+
if (isStepBlank(input))
|
|
202
197
|
return [];
|
|
203
198
|
const parts = [];
|
|
204
199
|
let current = '';
|
|
205
200
|
let depth = 0;
|
|
206
|
-
let inString = false;
|
|
207
201
|
for (let i = 0; i < input.length; i++) {
|
|
208
202
|
const char = input[i];
|
|
209
|
-
// See skipStepComment's docstring
|
|
210
|
-
//
|
|
211
|
-
if (
|
|
203
|
+
// See skipStepComment's docstring. A comment that never closes is not
|
|
204
|
+
// trivia: the list is refused (core's `split_step_slots` refuses it too).
|
|
205
|
+
if (char === '/' && input[i + 1] === '*') {
|
|
206
|
+
if (input.indexOf('*/', i + 2) === -1)
|
|
207
|
+
return null;
|
|
212
208
|
const stop = skipStepComment(input, i);
|
|
213
209
|
current += input.slice(i, stop);
|
|
214
210
|
i = stop - 1;
|
|
215
211
|
continue;
|
|
216
212
|
}
|
|
213
|
+
// A binary literal has no escapes: the first following quote closes it. It
|
|
214
|
+
// moves into the part whole, so a comma or apostrophe in a malformed one
|
|
215
|
+
// is never read as structure; `isWellFormedStepSlot` then holds it to the
|
|
216
|
+
// `[0-3]` + hex form.
|
|
217
|
+
if (char === '"') {
|
|
218
|
+
const close = input.indexOf('"', i + 1);
|
|
219
|
+
if (close === -1)
|
|
220
|
+
return null;
|
|
221
|
+
current += input.slice(i, close + 1);
|
|
222
|
+
i = close;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
// A literal is copied whole. Where it ends is the shared rule, so a `\S\'`
|
|
226
|
+
// operand is text, not a closing quote (#7589); one that never closes is an
|
|
227
|
+
// unterminated string, refused.
|
|
217
228
|
if (char === "'") {
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
inString = !inString;
|
|
229
|
+
const end = stepStringLiteralEnd(input, i);
|
|
230
|
+
if (end === -1)
|
|
231
|
+
return null;
|
|
232
|
+
current += input.slice(i, end);
|
|
233
|
+
i = end - 1;
|
|
225
234
|
continue;
|
|
226
235
|
}
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
236
|
+
if (char === '(')
|
|
237
|
+
depth++;
|
|
238
|
+
else if (char === ')') {
|
|
239
|
+
depth--;
|
|
240
|
+
// Already past the record's own closing paren: every comma from here
|
|
241
|
+
// would be read as nested and the split is meaningless.
|
|
242
|
+
if (depth < 0)
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
else if (char === ',' && depth === 0) {
|
|
246
|
+
parts.push(current);
|
|
247
|
+
current = '';
|
|
248
|
+
continue;
|
|
242
249
|
}
|
|
243
250
|
current += char;
|
|
244
251
|
}
|
|
245
|
-
if (
|
|
252
|
+
if (depth !== 0)
|
|
246
253
|
return null;
|
|
247
254
|
parts.push(current);
|
|
248
255
|
// The three checks above (quote/paren/final-depth) track SCAN state, not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-argument-parser.js","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"step-argument-parser.js","sourceRoot":"","sources":["../src/step-argument-parser.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,MAAM,KAAK,GAAa,EAAE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,IAAI,CAAC;QAC7B,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,GAAG,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;IAClB,CAAC;IAED,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEpB,yEAAyE;IACzE,kEAAkE;IAClE,yEAAyE;IACzE,sEAAsE;IACtE,uEAAuE;IACvE,yEAAyE;IACzE,2EAA2E;IAC3E,0EAA0E;IAC1E,2EAA2E;IAC3E,0EAA0E;IAC1E,yEAAyE;IACzE,6CAA6C;IAC7C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-attribute-mutations.d.ts","sourceRoot":"","sources":["../src/step-attribute-mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step-attribute-mutations.d.ts","sourceRoot":"","sources":["../src/step-attribute-mutations.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,mBAAmB,GAAG,IAAI,EACxC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACnD,YAAY,EAAE,gBAAgB,EAC9B,aAAa,EAAE,OAAO,EACtB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACrD,mBAAmB,CA6ErB;AAED;;;;;GAKG;AACH,KAAK,wBAAwB,GAAG,CAC9B,GAAG,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,KAC9D,mBAAmB,CAAC;AACzB,KAAK,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACzF,IAAI,GACJ,KAAK,CAAC;AAEV;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,wBAAwB,EAC/B,QAAQ,EAAE,MAAM,EAAE,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACnD,YAAY,EAAE,gBAAgB,EAC9B,aAAa,EAAE,OAAO,GACrB,mBAAmB,CAkBrB"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* serializers are `step-attribute-serializers.ts`.
|
|
16
16
|
*/
|
|
17
17
|
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
18
|
+
import { frameArgs, opensStepRecord, stepRecordFrame, withFrameArgs } from './step-record-frame.js';
|
|
18
19
|
import { getRealTypedSlots } from './attribute-real-slots.js';
|
|
19
20
|
import { retypeStepLine } from './retype.js';
|
|
20
21
|
import { attrIndex, stepSourceSchema } from './subset-entity-reader.js';
|
|
@@ -118,8 +119,8 @@ export function applySourceLineMutations(mutationView, expressId, entityText, re
|
|
|
118
119
|
// time. Each of `retypeStepLine`, `applyAttributeMutations` and
|
|
119
120
|
// `applyPositionalMutations` returns its input UNCHANGED when it refuses, so
|
|
120
121
|
// a flag that is true means that writer replaced a slot, which means it
|
|
121
|
-
// scanned the argument list — over the same substring,
|
|
122
|
-
//
|
|
122
|
+
// scanned the argument list — over the same substring, inside the same
|
|
123
|
+
// record frame (`stepRecordFrame`) `argumentListScans` uses. So
|
|
123
124
|
// the added conjuncts only ever skip a call that would have returned true;
|
|
124
125
|
// they cannot turn a refusal into a readable record.
|
|
125
126
|
const requested = typeMutation !== null
|
|
@@ -156,34 +157,33 @@ export function applySourceLineMutationsReported(apply, warnings, expressId, ent
|
|
|
156
157
|
/**
|
|
157
158
|
* Does this line's own argument list scan into slots?
|
|
158
159
|
*
|
|
159
|
-
* Scoped to the arguments deliberately. Text that
|
|
160
|
-
*
|
|
161
|
-
* untouched without claiming anything
|
|
162
|
-
*
|
|
160
|
+
* Scoped to the arguments deliberately. Text that declares no entity instance
|
|
161
|
+
* at all is a different fact, and one every writer here already returns
|
|
162
|
+
* untouched without claiming anything. A line that does (`#N=`) and is not one
|
|
163
|
+
* whole record `stepRecordFrame` reads (a complex instance, a non-ASCII
|
|
164
|
+
* character in its head, no `;`), or whose list does not split, is
|
|
165
|
+
* unreadable: the edits queued for it were dropped (#7682).
|
|
163
166
|
*/
|
|
164
167
|
function argumentListScans(entityText) {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return splitTopLevelStepArguments(entityText.slice(openParen + 1, closeParen)) !== null;
|
|
168
|
+
const frame = stepRecordFrame(entityText);
|
|
169
|
+
if (frame === null)
|
|
170
|
+
return !opensStepRecord(entityText);
|
|
171
|
+
return splitTopLevelStepArguments(frameArgs(entityText, frame)) !== null;
|
|
170
172
|
}
|
|
171
173
|
/**
|
|
172
174
|
* Rewrite root IFC attributes directly on the original STEP entity line.
|
|
173
175
|
*/
|
|
174
176
|
function applyAttributeMutations(entityText, entityType, attributeMutations, schemaVersion, onRejected) {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
if (openParen < 0 || closeParen < openParen) {
|
|
177
|
+
const frame = stepRecordFrame(entityText);
|
|
178
|
+
if (frame === null)
|
|
178
179
|
return entityText;
|
|
179
|
-
}
|
|
180
180
|
// Validating, not permissive. Every write below is BY INDEX into these
|
|
181
181
|
// parts, so parts that are not the record's slots put the value on another
|
|
182
182
|
// attribute and delete whatever was there, while `changed` still says the
|
|
183
183
|
// edit landed (#2470, #4125). A `null` refuses the whole line's named edits
|
|
184
184
|
// rather than handing back a success that did not happen; the caller reports
|
|
185
185
|
// it (see {@link applySourceLineMutations}).
|
|
186
|
-
const args = splitTopLevelStepArguments(entityText
|
|
186
|
+
const args = splitTopLevelStepArguments(frameArgs(entityText, frame));
|
|
187
187
|
if (args === null)
|
|
188
188
|
return entityText;
|
|
189
189
|
// A source line NEVER pads (unlike the overlay-created path): a short
|
|
@@ -223,7 +223,7 @@ function applyAttributeMutations(entityText, entityType, attributeMutations, sch
|
|
|
223
223
|
if (!changed) {
|
|
224
224
|
return entityText;
|
|
225
225
|
}
|
|
226
|
-
return
|
|
226
|
+
return withFrameArgs(entityText, frame, args.join(','));
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Apply positional STEP argument overrides to an entity line.
|
|
@@ -232,13 +232,12 @@ function applyAttributeMutations(entityText, entityType, attributeMutations, sch
|
|
|
232
232
|
* are silently ignored.
|
|
233
233
|
*/
|
|
234
234
|
function applyPositionalMutations(entityText, positionals, entityType, schemaVersion) {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
if (openParen < 0 || closeParen < openParen)
|
|
235
|
+
const frame = stepRecordFrame(entityText);
|
|
236
|
+
if (frame === null)
|
|
238
237
|
return entityText;
|
|
239
238
|
// Validating for the same reason as the named path above: `args[index] = …`
|
|
240
239
|
// is only an edit to attribute `index` when the parts ARE the record's slots.
|
|
241
|
-
const args = splitTopLevelStepArguments(entityText
|
|
240
|
+
const args = splitTopLevelStepArguments(frameArgs(entityText, frame));
|
|
242
241
|
if (args === null)
|
|
243
242
|
return entityText;
|
|
244
243
|
const realSlots = getRealTypedSlots(entityType, schemaVersion);
|
|
@@ -251,6 +250,6 @@ function applyPositionalMutations(entityText, positionals, entityType, schemaVer
|
|
|
251
250
|
}
|
|
252
251
|
if (!changed)
|
|
253
252
|
return entityText;
|
|
254
|
-
return
|
|
253
|
+
return withFrameArgs(entityText, frame, args.join(','));
|
|
255
254
|
}
|
|
256
255
|
//# sourceMappingURL=step-attribute-mutations.js.map
|