occam-verify-cli 1.0.956 → 1.0.973
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/lib/context/bounded.js +11 -7
- package/lib/context.js +17 -5
- package/lib/element/assertion/signature.js +17 -19
- package/lib/element/assertion/subproof.js +36 -39
- package/lib/element/assertion/type.js +20 -1
- package/lib/element/assumption/metaLevel.js +18 -17
- package/lib/element/assumption.js +52 -3
- package/lib/element/combinator.js +10 -12
- package/lib/element/conclusion.js +33 -33
- package/lib/element/constructor.js +7 -11
- package/lib/element/deduction.js +33 -33
- package/lib/element/equivalence.js +11 -7
- package/lib/element/hypothesis.js +45 -19
- package/lib/element/judgement.js +1 -1
- package/lib/element/label.js +9 -11
- package/lib/element/proofAssertion/premise.js +98 -87
- package/lib/element/proofAssertion/step.js +27 -27
- package/lib/element/proofAssertion/supposition.js +99 -88
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +30 -38
- package/lib/element/signature.js +38 -47
- package/lib/element/statement.js +18 -58
- package/lib/element/substitution/frame.js +34 -42
- package/lib/element/substitution/reference.js +12 -13
- package/lib/element/substitution/statement.js +26 -31
- package/lib/element/substitution/term.js +32 -37
- package/lib/element/term.js +2 -2
- package/lib/element/topLevelAssertion/axiom.js +33 -34
- package/lib/element/topLevelAssertion.js +30 -7
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/process/discharge.js +38 -0
- package/lib/process/unification.js +228 -0
- package/lib/process/unify.js +9 -5
- package/lib/process/validation.js +291 -0
- package/lib/utilities/context.js +69 -105
- package/lib/utilities/element.js +2 -4
- package/lib/utilities/string.js +4 -4
- package/package.json +1 -1
- package/src/context/bounded.js +19 -7
- package/src/context.js +26 -6
- package/src/element/assertion/signature.js +21 -26
- package/src/element/assertion/subproof.js +43 -45
- package/src/element/assertion/type.js +30 -1
- package/src/element/assumption/metaLevel.js +26 -22
- package/src/element/assumption.js +80 -2
- package/src/element/combinator.js +11 -14
- package/src/element/conclusion.js +38 -37
- package/src/element/constructor.js +8 -13
- package/src/element/deduction.js +38 -37
- package/src/element/equivalence.js +17 -13
- package/src/element/hypothesis.js +59 -19
- package/src/element/judgement.js +1 -1
- package/src/element/label.js +10 -12
- package/src/element/proofAssertion/premise.js +123 -107
- package/src/element/proofAssertion/step.js +29 -29
- package/src/element/proofAssertion/supposition.js +124 -108
- package/src/element/proofAssertion.js +2 -2
- package/src/element/reference.js +36 -47
- package/src/element/signature.js +42 -53
- package/src/element/statement.js +18 -89
- package/src/element/substitution/frame.js +45 -58
- package/src/element/substitution/reference.js +13 -16
- package/src/element/substitution/statement.js +27 -34
- package/src/element/substitution/term.js +37 -46
- package/src/element/term.js +1 -1
- package/src/element/topLevelAssertion/axiom.js +43 -45
- package/src/element/topLevelAssertion.js +42 -6
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/process/discharge.js +33 -0
- package/src/{utilities → process}/unification.js +21 -27
- package/src/process/unify.js +9 -5
- package/src/{utilities → process}/validation.js +2 -2
- package/src/utilities/context.js +77 -128
- package/src/utilities/element.js +2 -5
- package/src/utilities/string.js +6 -6
- package/lib/context/ephemeral.js +0 -28
- package/lib/context/synoptic.js +0 -255
- package/lib/utilities/unification.js +0 -233
- package/lib/utilities/validation.js +0 -291
- package/src/context/ephemeral.js +0 -17
- package/src/context/synoptic.js +0 -361
package/src/element/signature.js
CHANGED
|
@@ -4,9 +4,10 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
+
import { instantiateSignature } from "../process/instantiate";
|
|
7
8
|
import { signatureFromSignatureNode } from "../utilities/element";
|
|
8
9
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
9
|
-
import {
|
|
10
|
+
import { ablate, attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
10
11
|
|
|
11
12
|
const { match } = arrayUtilities;
|
|
12
13
|
|
|
@@ -72,16 +73,18 @@ export default define(class Signature extends Element {
|
|
|
72
73
|
|
|
73
74
|
context.trace(`Verifying the '${signatureString}' signature...`);
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
ablate((context) => {
|
|
77
|
+
attempt((context) => {
|
|
78
|
+
const termsValidate = this.validateTerms(context);
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
if (termsValidate !== null) {
|
|
81
|
+
verifies = true;
|
|
82
|
+
}
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
if (verifies) {
|
|
85
|
+
this.commit(context);
|
|
86
|
+
}
|
|
87
|
+
}, context);
|
|
85
88
|
}, context);
|
|
86
89
|
|
|
87
90
|
if (verifies) {
|
|
@@ -109,7 +112,7 @@ export default define(class Signature extends Element {
|
|
|
109
112
|
|
|
110
113
|
context.debug(`...the '${signatureString}' signature is already valid.`);
|
|
111
114
|
} else {
|
|
112
|
-
const
|
|
115
|
+
const temporaryContext = context; ///
|
|
113
116
|
|
|
114
117
|
context = this.getContext();
|
|
115
118
|
|
|
@@ -125,7 +128,7 @@ export default define(class Signature extends Element {
|
|
|
125
128
|
}
|
|
126
129
|
}, context);
|
|
127
130
|
|
|
128
|
-
context =
|
|
131
|
+
context = temporaryContext; ///
|
|
129
132
|
|
|
130
133
|
if (validates) {
|
|
131
134
|
signature = this; ///
|
|
@@ -175,11 +178,10 @@ export default define(class Signature extends Element {
|
|
|
175
178
|
return termsValidate
|
|
176
179
|
}
|
|
177
180
|
|
|
178
|
-
unifySignature(signature,
|
|
181
|
+
unifySignature(signature, context) {
|
|
179
182
|
let signatureUnifies;
|
|
180
183
|
|
|
181
|
-
const
|
|
182
|
-
generalSignature = this,
|
|
184
|
+
const generalSignature = this,
|
|
183
185
|
specificSignature = signature, ///
|
|
184
186
|
generalSignatureString = generalSignature.getString(),
|
|
185
187
|
specificSignatureString = specificSignature.getString();
|
|
@@ -192,35 +194,24 @@ export default define(class Signature extends Element {
|
|
|
192
194
|
specificSignatureContext = specificSignature.getContext(),
|
|
193
195
|
generalTerms = generalSignatureTerms, ///
|
|
194
196
|
specificTerms = specificSignatureTerms, ///
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
generalContext
|
|
198
|
-
],
|
|
199
|
-
specificContexts = [
|
|
200
|
-
specificSignatureContext,
|
|
201
|
-
specificContext
|
|
202
|
-
];
|
|
203
|
-
|
|
204
|
-
join((generalContext) => {
|
|
205
|
-
join((specificContext) => {
|
|
206
|
-
signatureUnifies = match(generalTerms, specificTerms, (generalTerm, specificTerm) => {
|
|
207
|
-
let termUnifies;
|
|
208
|
-
|
|
209
|
-
reconcile((specificContext) => {
|
|
210
|
-
termUnifies = generalTerm.unifyTerm(specificTerm, generalContext, specificContext);
|
|
211
|
-
|
|
212
|
-
if (termUnifies) {
|
|
213
|
-
specificContext.commit();
|
|
214
|
-
}
|
|
215
|
-
}, specificContext);
|
|
216
|
-
|
|
217
|
-
if (termUnifies) {
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}, ...specificContexts);
|
|
222
|
-
}, ...generalContexts);
|
|
197
|
+
generalContext = generalSignatureContext, ///
|
|
198
|
+
specificContext = specificSignatureContext; ///
|
|
223
199
|
|
|
200
|
+
reconcile((specificContext) => {
|
|
201
|
+
signatureUnifies = match(generalTerms, specificTerms, (generalTerm, specificTerm) => {
|
|
202
|
+
let termUnifies;
|
|
203
|
+
|
|
204
|
+
termUnifies = generalTerm.unifyTerm(specificTerm, generalContext, specificContext);
|
|
205
|
+
|
|
206
|
+
if (termUnifies) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
if (signatureUnifies) {
|
|
212
|
+
specificContext.commit(context);
|
|
213
|
+
}
|
|
214
|
+
}, specificContext);
|
|
224
215
|
|
|
225
216
|
if (signatureUnifies) {
|
|
226
217
|
context.debug(`...unified the '${specificSignatureString}' signature with the '${generalSignatureString}' signature.`);
|
|
@@ -258,8 +249,8 @@ export default define(class Signature extends Element {
|
|
|
258
249
|
static fromJSON(json, context) {
|
|
259
250
|
let signature;
|
|
260
251
|
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
instantiate((context) => {
|
|
253
|
+
unserialise((json, context) => {
|
|
263
254
|
const { string } = json,
|
|
264
255
|
signatureNode = instantiateSignature(string, context),
|
|
265
256
|
node = signatureNode, ///
|
|
@@ -267,8 +258,8 @@ export default define(class Signature extends Element {
|
|
|
267
258
|
terms = termsFromSignatureNode(signatureNode, context);
|
|
268
259
|
|
|
269
260
|
signature = new Signature(context, string, node, breakPoint, terms);
|
|
270
|
-
}, context);
|
|
271
|
-
},
|
|
261
|
+
}, json, context);
|
|
262
|
+
}, context);
|
|
272
263
|
|
|
273
264
|
return signature;
|
|
274
265
|
}
|
|
@@ -276,14 +267,12 @@ export default define(class Signature extends Element {
|
|
|
276
267
|
static fromSignatureString(signatureString, context) {
|
|
277
268
|
let signature;
|
|
278
269
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
signatureNode = instantiateSignature(string, context);
|
|
270
|
+
ablate((context) => {
|
|
271
|
+
instantiate((context) => {
|
|
272
|
+
const string = signatureString, ///
|
|
273
|
+
signatureNode = instantiateSignature(string, context);
|
|
284
274
|
|
|
285
|
-
|
|
286
|
-
}, context);
|
|
275
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
287
276
|
}, context);
|
|
288
277
|
}, context);
|
|
289
278
|
|
package/src/element/statement.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
6
7
|
import { unifyStatement } from "../process/unify";
|
|
7
|
-
import { validateStatements } from "../
|
|
8
|
+
import { validateStatements } from "../process/validation";
|
|
9
|
+
import { dischargeStatements } from "../process/discharge";
|
|
8
10
|
import { instantiateStatement } from "../process/instantiate";
|
|
9
|
-
import { reconcile, instantiate } from "../utilities/context";
|
|
10
11
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
11
12
|
|
|
12
13
|
export default define(class Statement extends Element {
|
|
@@ -125,7 +126,7 @@ export default define(class Statement extends Element {
|
|
|
125
126
|
return comparesToParamter;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
findValidStatement(context) {
|
|
129
130
|
const statementNode = this.getStatementNode(),
|
|
130
131
|
statement = context.findStatementByStatementNode(statementNode),
|
|
131
132
|
validStatement = statement; ///
|
|
@@ -194,7 +195,7 @@ export default define(class Statement extends Element {
|
|
|
194
195
|
|
|
195
196
|
let validates;
|
|
196
197
|
|
|
197
|
-
const validStatement = this.
|
|
198
|
+
const validStatement = this.findValidStatement(context);
|
|
198
199
|
|
|
199
200
|
if (validStatement !== null) {
|
|
200
201
|
validates = true;
|
|
@@ -226,56 +227,27 @@ export default define(class Statement extends Element {
|
|
|
226
227
|
return statement;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
let
|
|
230
|
+
discharge(context) {
|
|
231
|
+
let discharges;
|
|
231
232
|
|
|
232
|
-
const
|
|
233
|
-
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
234
|
-
|
|
235
|
-
if (subproofAssertionNode !== null) {
|
|
236
|
-
const context = generalContext, ///
|
|
237
|
-
subproofString = subproof.getString(),
|
|
238
|
-
statementString = this.getString(); ///
|
|
239
|
-
|
|
240
|
-
context.trace(`Unifying the '${subproofString}' subproof with the '${statementString}' statement...`);
|
|
241
|
-
|
|
242
|
-
const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
243
|
-
|
|
244
|
-
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
245
|
-
|
|
246
|
-
if (subproofUnifies) {
|
|
247
|
-
context.debug(`...unified the '${subproofString}' subproof with the '${statementString}' statement.`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return subproofUnifies;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
unifyDeduction(deduction, generalContext, specificContext) {
|
|
255
|
-
let deductionUnifies = false;
|
|
256
|
-
|
|
257
|
-
const context = generalContext, ///
|
|
258
|
-
statementString = this.getString(), ///
|
|
259
|
-
deductionString = deduction.getString(),
|
|
260
|
-
deductionStatement = deduction.getStatement();
|
|
261
|
-
|
|
262
|
-
context.trace(`Unifying the '${deductionString}' deduction with the '${statementString}' statement...`);
|
|
233
|
+
const statementString = this.getString(); ///
|
|
263
234
|
|
|
264
|
-
|
|
265
|
-
const deductionStatementUnifies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
235
|
+
context.trace(`Dicharging the '${statementString}' statement...`);
|
|
266
236
|
|
|
267
|
-
|
|
268
|
-
|
|
237
|
+
discharges = dischargeStatements.some((dischargeStatement) => {
|
|
238
|
+
const statement = this, ///
|
|
239
|
+
statementDischarged = dischargeStatement(statement, context);
|
|
269
240
|
|
|
270
|
-
|
|
241
|
+
if (statementDischarged) {
|
|
242
|
+
return true;
|
|
271
243
|
}
|
|
272
|
-
}
|
|
244
|
+
});
|
|
273
245
|
|
|
274
|
-
if (
|
|
275
|
-
context.debug(`...
|
|
246
|
+
if (discharges) {
|
|
247
|
+
context.debug(`...discharged the '${statementString}' statement.`);
|
|
276
248
|
}
|
|
277
249
|
|
|
278
|
-
return
|
|
250
|
+
return discharges;
|
|
279
251
|
}
|
|
280
252
|
|
|
281
253
|
unifyStatement(statement, generalContext, specificContext) {
|
|
@@ -348,49 +320,6 @@ export default define(class Statement extends Element {
|
|
|
348
320
|
return unifiesIndependently;
|
|
349
321
|
}
|
|
350
322
|
|
|
351
|
-
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
352
|
-
let topLevelAssertionUnifies = false;
|
|
353
|
-
|
|
354
|
-
const statementString = this.getString(), ///
|
|
355
|
-
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
356
|
-
|
|
357
|
-
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement...`);
|
|
358
|
-
|
|
359
|
-
const unconditional = topLevelMetaAssertion.isUnconditional();
|
|
360
|
-
|
|
361
|
-
if (unconditional) {
|
|
362
|
-
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
363
|
-
generalContext = context; ///
|
|
364
|
-
|
|
365
|
-
context = deduction.getContext();
|
|
366
|
-
|
|
367
|
-
const specificContext = context; ///
|
|
368
|
-
|
|
369
|
-
context = generalContext; ///
|
|
370
|
-
|
|
371
|
-
const deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
372
|
-
|
|
373
|
-
if (deductionUnifies) {
|
|
374
|
-
topLevelAssertionUnifies = true;
|
|
375
|
-
}
|
|
376
|
-
} else {
|
|
377
|
-
const statementNode = this.getStatementNode(),
|
|
378
|
-
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
379
|
-
|
|
380
|
-
if (subproofAssertionNode !== null) {
|
|
381
|
-
const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
382
|
-
|
|
383
|
-
topLevelAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (topLevelAssertionUnifies) {
|
|
388
|
-
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement.`);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return topLevelAssertionUnifies;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
323
|
static name = "Statement";
|
|
395
324
|
|
|
396
325
|
toJSON() {
|
|
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
|
7
7
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
10
|
-
import {
|
|
10
|
+
import { elide, ablate, ablates, manifest, attempts, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
|
|
12
12
|
export default define(class FrameSubstitution extends Substitution {
|
|
13
13
|
constructor(contexts, string, node, breakPoint, targetFrame, replacementFrame) {
|
|
@@ -136,7 +136,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
136
136
|
|
|
137
137
|
if (targetFrameSingular) {
|
|
138
138
|
manifest((context) => {
|
|
139
|
-
|
|
139
|
+
elide((context) => {
|
|
140
140
|
const tragetFrame = this.targetFrame.validate(context);
|
|
141
141
|
|
|
142
142
|
if (tragetFrame !== null) {
|
|
@@ -167,7 +167,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
167
167
|
|
|
168
168
|
context.trace(`Validating the '${frameSubstitutionString}' frame substitution's replacement frame...`);
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
elide((context) => {
|
|
171
171
|
const replacementFrame = this.replacementFrame.validate(context);
|
|
172
172
|
|
|
173
173
|
if (replacementFrame !== null) {
|
|
@@ -234,24 +234,21 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
234
234
|
generalFrame = generalSubstitutionTargetFrame, ///
|
|
235
235
|
specificFrame = specificSubstitutionTargetFrame; ///
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
|
|
237
|
+
reconcile((specificContext) => {
|
|
238
|
+
const frameNode = generalFrame.getFrameNode(),
|
|
239
|
+
metavariable = metavariableFromFrameNode(frameNode, generalContext);
|
|
241
240
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
241
|
+
if (metavariable !== null) {
|
|
242
|
+
const frame = specificFrame, ///
|
|
243
|
+
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
246
244
|
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
if (frameUnifies) {
|
|
246
|
+
specificContext.commit(context);
|
|
249
247
|
|
|
250
|
-
|
|
251
|
-
}
|
|
248
|
+
targetFrameUnifies = true;
|
|
252
249
|
}
|
|
253
|
-
}
|
|
254
|
-
}, specificContext
|
|
250
|
+
}
|
|
251
|
+
}, specificContext);
|
|
255
252
|
|
|
256
253
|
if (targetFrameUnifies) {
|
|
257
254
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's target frame with the '${generalSubstitutionString}' substitution's target frame.`);
|
|
@@ -279,24 +276,21 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
279
276
|
generalFrame = generalSubstitutionReplacementFrame, ///
|
|
280
277
|
specificFrame = specificSubstitutionReplacementFrame; ///
|
|
281
278
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
|
|
279
|
+
reconcile((specificContext) => {
|
|
280
|
+
const frameNode = generalFrame.getNode(),
|
|
281
|
+
metavariable = metavariableFromFrameNode(frameNode, generalContext);
|
|
286
282
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
283
|
+
if (metavariable !== null) {
|
|
284
|
+
const frame = specificFrame, ///
|
|
285
|
+
frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
|
|
291
286
|
|
|
292
|
-
|
|
293
|
-
|
|
287
|
+
if (frameUnifies) {
|
|
288
|
+
specificContext.commit(context);
|
|
294
289
|
|
|
295
|
-
|
|
296
|
-
}
|
|
290
|
+
replacementFrameUnifies = true;
|
|
297
291
|
}
|
|
298
|
-
}
|
|
299
|
-
}, specificContext
|
|
292
|
+
}
|
|
293
|
+
}, specificContext);
|
|
300
294
|
|
|
301
295
|
if (replacementFrameUnifies) {
|
|
302
296
|
context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement frame with the '${generalSubstitutionString}' substitution's replacement frame.`);
|
|
@@ -313,29 +307,22 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
313
307
|
const { name } = json;
|
|
314
308
|
|
|
315
309
|
if (this.name === name) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
ablate((context) => {
|
|
310
|
+
instantiate((context) => {
|
|
319
311
|
unserialises((json, generalContext, specificContext) => {
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
specificContext
|
|
333
|
-
];
|
|
334
|
-
|
|
335
|
-
frameSubstitutionn = new FrameSubstitution(contexts, string, node, breakPoint, targetFrame, replacementFrame);
|
|
336
|
-
}, context);
|
|
312
|
+
const { string } = json,
|
|
313
|
+
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
314
|
+
node = frameSubstitutionNode, ///
|
|
315
|
+
breakPoint = breakPointFromJSON(json),
|
|
316
|
+
targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, generalContext),
|
|
317
|
+
replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, specificContext),
|
|
318
|
+
contexts = [
|
|
319
|
+
generalContext,
|
|
320
|
+
specificContext
|
|
321
|
+
];
|
|
322
|
+
|
|
323
|
+
frameSubstitutionn = new FrameSubstitution(contexts, string, node, breakPoint, targetFrame, replacementFrame);
|
|
337
324
|
}, json, context);
|
|
338
|
-
},
|
|
325
|
+
}, context);
|
|
339
326
|
}
|
|
340
327
|
|
|
341
328
|
return frameSubstitutionn;
|
|
@@ -378,28 +365,28 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
378
365
|
}
|
|
379
366
|
});
|
|
380
367
|
|
|
381
|
-
function metavariableFromFrameNode(frameNode,
|
|
368
|
+
function metavariableFromFrameNode(frameNode, generalContext) {
|
|
382
369
|
let metavariable = null;
|
|
383
370
|
|
|
384
371
|
const metavariableNode = frameNode.getMetavariableNode();
|
|
385
372
|
|
|
386
373
|
if (metavariableNode !== null) {
|
|
387
|
-
metavariable =
|
|
374
|
+
metavariable = generalContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
388
375
|
}
|
|
389
376
|
|
|
390
377
|
return metavariable;
|
|
391
378
|
}
|
|
392
379
|
|
|
393
|
-
function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
380
|
+
function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, generalContext) {
|
|
394
381
|
const targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
|
|
395
|
-
targetFrame =
|
|
382
|
+
targetFrame = generalContext.findFrameByFrameNode(targetFrameNode);
|
|
396
383
|
|
|
397
384
|
return targetFrame;
|
|
398
385
|
}
|
|
399
386
|
|
|
400
|
-
function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
387
|
+
function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, specificContext) {
|
|
401
388
|
const replacementFrameNode = frameSubstitutionNode.getReplacementFrameNode(),
|
|
402
|
-
replacementFrame =
|
|
389
|
+
replacementFrame = specificContext.findFrameByFrameNode(replacementFrameNode);
|
|
403
390
|
|
|
404
391
|
return replacementFrame;
|
|
405
392
|
}
|
|
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
|
|
|
7
7
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
10
|
-
import { ablates, manifest, attempts,
|
|
10
|
+
import { elide, ablates, manifest, attempts, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
|
|
12
12
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
13
13
|
constructor(context, string, node, breakPoint, targetReference, replacementReference) {
|
|
@@ -150,7 +150,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
150
150
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's target reference...`);
|
|
151
151
|
|
|
152
152
|
manifest((context) => {
|
|
153
|
-
|
|
153
|
+
elide((context) => {
|
|
154
154
|
const targetReference = this.targetReference.validate(context);
|
|
155
155
|
|
|
156
156
|
if (targetReference !== null) {
|
|
@@ -174,7 +174,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
174
174
|
|
|
175
175
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's replacement reference...`);
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
elide((context) => {
|
|
178
178
|
const replacementReference = this.replacementReference.validate(context);
|
|
179
179
|
|
|
180
180
|
if (replacementReference !== null) {
|
|
@@ -197,25 +197,22 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
197
197
|
const { name } = json;
|
|
198
198
|
|
|
199
199
|
if (this.name === name) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
instantiate((context) => {
|
|
200
|
+
instantiate((context) => {
|
|
201
|
+
unserialises((json, generalContext, specificContext) => {
|
|
204
202
|
const { string } = json,
|
|
205
203
|
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
206
204
|
node = referenceSubstitutionNode, ///
|
|
207
205
|
breakPoint = breakPointFromJSON(json),
|
|
208
|
-
targetReference = targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
209
|
-
replacementReference = replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
210
|
-
specificContext = context, ///
|
|
206
|
+
targetReference = targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext),
|
|
207
|
+
replacementReference = replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, specificContext),
|
|
211
208
|
contexts = [
|
|
212
209
|
generalContext,
|
|
213
210
|
specificContext
|
|
214
211
|
];
|
|
215
212
|
|
|
216
213
|
referenceSubstitutionn = new ReferenceSubstitution(contexts, string, node, breakPoint, targetReference, replacementReference);
|
|
217
|
-
}, context);
|
|
218
|
-
},
|
|
214
|
+
}, json, context);
|
|
215
|
+
}, context);
|
|
219
216
|
}
|
|
220
217
|
|
|
221
218
|
return referenceSubstitutionn;
|
|
@@ -262,16 +259,16 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
262
259
|
}
|
|
263
260
|
});
|
|
264
261
|
|
|
265
|
-
function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
262
|
+
function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext) {
|
|
266
263
|
const targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
|
|
267
|
-
targetReference =
|
|
264
|
+
targetReference = generalContext.findReferenceByReferenceNode(targetReferenceNode);
|
|
268
265
|
|
|
269
266
|
return targetReference;
|
|
270
267
|
}
|
|
271
268
|
|
|
272
|
-
function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
269
|
+
function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, specificContext) {
|
|
273
270
|
const replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
|
|
274
|
-
replacementReference =
|
|
271
|
+
replacementReference = specificContext.findReferenceByReferenceNode(replacementReferenceNode);
|
|
275
272
|
|
|
276
273
|
return replacementReference;
|
|
277
274
|
}
|