occam-nominal 1.0.310 → 1.0.317
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/liminal.js +17 -15
- package/lib/context/phaneric.js +3 -3
- package/lib/context.js +3 -3
- package/lib/element/assertion/contained.js +19 -17
- package/lib/element/assertion/defined.js +16 -14
- package/lib/element/conclusion.js +10 -11
- package/lib/element/declaration/variable.js +2 -2
- package/lib/element/deduction.js +7 -7
- package/lib/element/equality.js +3 -3
- package/lib/element/frame.js +8 -3
- package/lib/element/goal.js +7 -8
- package/lib/element/judgement.js +8 -10
- package/lib/element/metavariable.js +44 -40
- package/lib/element/proof.js +2 -2
- package/lib/element/proofAssertion/premise.js +17 -21
- package/lib/element/proofAssertion/step.js +5 -5
- package/lib/element/proofAssertion/supposition.js +39 -35
- package/lib/element/rule.js +24 -22
- package/lib/element/statement.js +56 -32
- package/lib/element/substitution/frame.js +71 -62
- package/lib/element/substitution/reference.js +21 -21
- package/lib/element/substitution/statement.js +81 -98
- package/lib/element/substitution/term.js +76 -67
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +2 -2
- package/lib/element/topLevelAssertion/axiom.js +4 -5
- package/lib/element/topLevelAssertion/conjecture.js +3 -3
- package/lib/element/topLevelAssertion/lemma.js +3 -3
- package/lib/element/topLevelAssertion/theorem.js +3 -3
- package/lib/element/topLevelAssertion.js +59 -69
- package/lib/node/metavariable.js +18 -1
- package/lib/process/unify.js +5 -7
- package/lib/process/validation.js +5 -2
- package/lib/utilities/element.js +34 -56
- package/package.json +2 -2
- package/src/context/liminal.js +18 -16
- package/src/context/phaneric.js +3 -3
- package/src/context.js +2 -2
- package/src/element/assertion/contained.js +19 -18
- package/src/element/assertion/defined.js +16 -16
- package/src/element/conclusion.js +9 -11
- package/src/element/declaration/variable.js +1 -1
- package/src/element/deduction.js +6 -6
- package/src/element/equality.js +2 -2
- package/src/element/frame.js +10 -2
- package/src/element/goal.js +6 -8
- package/src/element/judgement.js +7 -11
- package/src/element/metavariable.js +56 -52
- package/src/element/proof.js +1 -1
- package/src/element/proofAssertion/premise.js +17 -25
- package/src/element/proofAssertion/step.js +4 -4
- package/src/element/proofAssertion/supposition.js +44 -43
- package/src/element/rule.js +27 -25
- package/src/element/statement.js +71 -41
- package/src/element/substitution/frame.js +88 -82
- package/src/element/substitution/reference.js +30 -32
- package/src/element/substitution/statement.js +97 -132
- package/src/element/substitution/term.js +95 -89
- package/src/element/substitution.js +6 -6
- package/src/element/term.js +1 -1
- package/src/element/topLevelAssertion/axiom.js +3 -5
- package/src/element/topLevelAssertion/conjecture.js +2 -2
- package/src/element/topLevelAssertion/lemma.js +2 -2
- package/src/element/topLevelAssertion/theorem.js +2 -2
- package/src/element/topLevelAssertion.js +61 -80
- package/src/node/metavariable.js +28 -1
- package/src/process/unify.js +7 -16
- package/src/process/validation.js +5 -4
- package/src/utilities/element.js +49 -64
|
@@ -103,7 +103,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
103
103
|
verifyDeduction = this.verifyDeduction.bind(this),
|
|
104
104
|
verifySuppositions = this.verifySuppositions.bind(this);
|
|
105
105
|
|
|
106
|
-
all([
|
|
106
|
+
return all([
|
|
107
107
|
verifyLabels,
|
|
108
108
|
verifySuppositions,
|
|
109
109
|
verifyDeduction,
|
|
@@ -113,7 +113,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
113
113
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion.`);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
continuation(verifies);
|
|
116
|
+
return continuation(verifies);
|
|
117
117
|
});
|
|
118
118
|
}, context);
|
|
119
119
|
}
|
|
@@ -130,7 +130,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
130
130
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's labels.`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
continuation(labelsVerify);
|
|
133
|
+
return continuation(labelsVerify);
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -140,12 +140,12 @@ export default class TopLevelAssertion extends Element {
|
|
|
140
140
|
|
|
141
141
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's '${labelString}' label...`);
|
|
142
142
|
|
|
143
|
-
label.verify((labelVerifies) => {
|
|
143
|
+
return label.verify((labelVerifies) => {
|
|
144
144
|
if (labelVerifies) {
|
|
145
145
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's '${labelString}' label.`);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
continuation(labelVerifies);
|
|
148
|
+
return continuation(labelVerifies);
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -153,9 +153,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
153
153
|
if (this.proof === null) {
|
|
154
154
|
const proofVerifies = true; ///
|
|
155
155
|
|
|
156
|
-
continuation(proofVerifies);
|
|
157
|
-
|
|
158
|
-
return;
|
|
156
|
+
return continuation(proofVerifies);
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
const topLevelAssertionString = this.getString(); ///
|
|
@@ -164,12 +162,12 @@ export default class TopLevelAssertion extends Element {
|
|
|
164
162
|
|
|
165
163
|
const statement = this.deduction.getStatement();
|
|
166
164
|
|
|
167
|
-
this.proof.verify(statement, context, (proofVerifies) => {
|
|
165
|
+
return this.proof.verify(statement, context, (proofVerifies) => {
|
|
168
166
|
if (proofVerifies) {
|
|
169
167
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's proof.`);
|
|
170
168
|
}
|
|
171
169
|
|
|
172
|
-
continuation(proofVerifies);
|
|
170
|
+
return continuation(proofVerifies);
|
|
173
171
|
});
|
|
174
172
|
}
|
|
175
173
|
|
|
@@ -179,12 +177,12 @@ export default class TopLevelAssertion extends Element {
|
|
|
179
177
|
|
|
180
178
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction...`);
|
|
181
179
|
|
|
182
|
-
this.deduction.verify(context, (deductionVerifies) => {
|
|
180
|
+
return this.deduction.verify(context, (deductionVerifies) => {
|
|
183
181
|
if (deductionVerifies) {
|
|
184
182
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction.`);
|
|
185
183
|
}
|
|
186
184
|
|
|
187
|
-
continuation(deductionVerifies);
|
|
185
|
+
return continuation(deductionVerifies);
|
|
188
186
|
});
|
|
189
187
|
}
|
|
190
188
|
|
|
@@ -194,7 +192,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
194
192
|
|
|
195
193
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's '${suppositionString}' supposition...`);
|
|
196
194
|
|
|
197
|
-
supposition.verify(context, (suppositionVerifies) => {
|
|
195
|
+
return supposition.verify(context, (suppositionVerifies) => {
|
|
198
196
|
if (suppositionVerifies) {
|
|
199
197
|
const subproofOrProofAssertion = supposition; ////
|
|
200
198
|
|
|
@@ -207,7 +205,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
207
205
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's '${suppositionString}' supposition.`);
|
|
208
206
|
}
|
|
209
207
|
|
|
210
|
-
continuation(suppositionVerifies);
|
|
208
|
+
return continuation(suppositionVerifies);
|
|
211
209
|
});
|
|
212
210
|
}
|
|
213
211
|
|
|
@@ -223,7 +221,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
223
221
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's suppositions.`);
|
|
224
222
|
}
|
|
225
223
|
|
|
226
|
-
continuation(suppositionsVerify);
|
|
224
|
+
return continuation(suppositionsVerify);
|
|
227
225
|
});
|
|
228
226
|
}
|
|
229
227
|
|
|
@@ -248,7 +246,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
248
246
|
|
|
249
247
|
dischargeHypotheses(context) {
|
|
250
248
|
const hypotheses = this.getHypotheses(),
|
|
251
|
-
|
|
249
|
+
hypothesesDischarge = every(hypotheses, (hypothesis) => {
|
|
252
250
|
const hypothesisDischarges = this.dischargeHypothesis(hypothesis, context);
|
|
253
251
|
|
|
254
252
|
if (hypothesisDischarges) {
|
|
@@ -256,42 +254,49 @@ export default class TopLevelAssertion extends Element {
|
|
|
256
254
|
}
|
|
257
255
|
});
|
|
258
256
|
|
|
259
|
-
return
|
|
257
|
+
return hypothesesDischarge;
|
|
260
258
|
}
|
|
261
259
|
|
|
262
|
-
unifyStepWithDeduction(step, context) {
|
|
263
|
-
|
|
260
|
+
unifyStepWithDeduction(step, context, continuation) {
|
|
261
|
+
const ruleString = this.getString(),
|
|
262
|
+
stepString = step.getString(),
|
|
263
|
+
conclusionString = this.conclusion.getString();
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
context.trace(`Unifying the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion...`);
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
return this.conclusion.unifyStep(step, context, (stepUnifies) => {
|
|
268
|
+
let stepUnifiesWithDeduction = false;
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
if (stepUnifies) {
|
|
271
|
+
stepUnifiesWithDeduction = true;
|
|
272
|
+
}
|
|
271
273
|
|
|
272
|
-
|
|
274
|
+
if (stepUnifiesWithDeduction) {
|
|
275
|
+
context.debug(`...unified the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion.`);
|
|
276
|
+
}
|
|
273
277
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
return continuation(stepUnifiesWithDeduction);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
277
281
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context, continuation) {
|
|
283
|
+
return this.unifyStepWithDeduction(step, context, (statementUnifiesWithDeduction) => {
|
|
284
|
+
if (!statementUnifiesWithDeduction) {
|
|
285
|
+
const stepAndSubproofOrProofAssertionsUnify = false;
|
|
281
286
|
|
|
282
|
-
|
|
283
|
-
|
|
287
|
+
return continuation(stepAndSubproofOrProofAssertionsUnify);
|
|
288
|
+
}
|
|
284
289
|
|
|
285
|
-
|
|
286
|
-
let stepAndSubproofOrProofAssertionsUnify = false;
|
|
290
|
+
const hypothesesDischarge = this.dischargeHypotheses(context);
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
if (hypothesesDischarge) {
|
|
293
|
+
const stepAndSubproofOrProofAssertionsUnify = false;
|
|
289
294
|
|
|
290
|
-
|
|
291
|
-
|
|
295
|
+
return continuation(stepAndSubproofOrProofAssertionsUnify);
|
|
296
|
+
}
|
|
292
297
|
|
|
293
|
-
|
|
294
|
-
|
|
298
|
+
this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context, (subproofOrProofAssertionsUnifiesWithSuppositions) => {
|
|
299
|
+
let stepAndSubproofOrProofAssertionsUnify = false;
|
|
295
300
|
|
|
296
301
|
if (subproofOrProofAssertionsUnifiesWithSuppositions) {
|
|
297
302
|
const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
|
|
@@ -300,58 +305,34 @@ export default class TopLevelAssertion extends Element {
|
|
|
300
305
|
stepAndSubproofOrProofAssertionsUnify = true;
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
308
|
|
|
306
|
-
|
|
309
|
+
return continuation(stepAndSubproofOrProofAssertionsUnify);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
307
312
|
}
|
|
308
313
|
|
|
309
|
-
unifySubproofOrProofAssertionsWithSupposition(subproofOrProofAssertions, supposition, context) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (!subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
315
|
-
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
316
|
-
const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, context);
|
|
317
|
-
|
|
318
|
-
if (subproofOrProofAssertionUnifies) {
|
|
319
|
-
context.resolveDerivedSubstitutions();
|
|
320
|
-
|
|
321
|
-
return true;
|
|
322
|
-
}
|
|
323
|
-
}) || null;
|
|
324
|
-
|
|
314
|
+
unifySubproofOrProofAssertionsWithSupposition(subproofOrProofAssertions, supposition, context, continuation) {
|
|
315
|
+
return extract(subproofOrProofAssertions, (subproofOrProofAssertion, continuation) => {
|
|
316
|
+
return supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, context, continuation);
|
|
317
|
+
}, (subproofOrProofAssertion = null) => {
|
|
325
318
|
if (subproofOrProofAssertion !== null) {
|
|
326
|
-
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (!subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
331
|
-
const suppositionUnifiesIndependently = supposition.unifyIndependently(context);
|
|
319
|
+
const subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
332
320
|
|
|
333
|
-
|
|
334
|
-
|
|
321
|
+
return context.resolveDerivedSubstitutions(() => {
|
|
322
|
+
return continuation(subproofOrProofAssertionsUnifiesWithSupposition);
|
|
323
|
+
});
|
|
335
324
|
}
|
|
336
|
-
}
|
|
337
325
|
|
|
338
|
-
|
|
326
|
+
return supposition.unifyIndependently(context, continuation);
|
|
327
|
+
});
|
|
339
328
|
}
|
|
340
329
|
|
|
341
|
-
unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context) {
|
|
342
|
-
let subproofOrProofAssertionsUnifiesWithSuppositions;
|
|
343
|
-
|
|
330
|
+
unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context, continuation) {
|
|
344
331
|
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
345
332
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (stepUnifiesWithSupposition) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
return subproofOrProofAssertionsUnifiesWithSuppositions;
|
|
333
|
+
return backwardsEvery(this.suppositions, (supposition, continuation) => {
|
|
334
|
+
return this.unifySubproofOrProofAssertionsWithSupposition(subproofOrProofAssertions, supposition, context, continuation);
|
|
335
|
+
}, continuation);
|
|
355
336
|
}
|
|
356
337
|
|
|
357
338
|
toJSON() {
|
package/src/node/metavariable.js
CHANGED
|
@@ -2,9 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
import { NonTerminalNode } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import { TERM_RULE_NAME, TYPE_RULE_NAME } from "../ruleNames";
|
|
5
|
+
import { TERM_RULE_NAME, TYPE_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class MetavariableNode extends NonTerminalNode {
|
|
8
|
+
getSiblingSubstitutionNode() {
|
|
9
|
+
let siblingSubstitutionNode = null;
|
|
10
|
+
|
|
11
|
+
const parentStatementNode = this.getParentStatementNode();
|
|
12
|
+
|
|
13
|
+
if (parentStatementNode !== null) {
|
|
14
|
+
const substitutionNode = parentStatementNode.getSubstitutionNode();
|
|
15
|
+
|
|
16
|
+
siblingSubstitutionNode = substitutionNode; ///
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return siblingSubstitutionNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getParentStatementNode() {
|
|
23
|
+
let parentStatementNode = null;
|
|
24
|
+
|
|
25
|
+
const parentNode = this.getParentNode(),
|
|
26
|
+
parentNodeRuleName = parentNode.getRuleName();
|
|
27
|
+
|
|
28
|
+
if (parentNodeRuleName === STATEMENT_RULE_NAME) {
|
|
29
|
+
parentStatementNode = parentNode; ///
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return parentStatementNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
8
35
|
getMetavariableName() {
|
|
9
36
|
let metavariableName;
|
|
10
37
|
|
package/src/process/unify.js
CHANGED
|
@@ -170,29 +170,20 @@ class MetaLevelPass extends ContinuationZipPassBase {
|
|
|
170
170
|
generalNodeQuery: statementMetavariableNodeQuery,
|
|
171
171
|
specificNodeQuery: statementNodeQuery,
|
|
172
172
|
run: (generalStatementMetavariableNode, specificStatementNode, generalContext, specificContext, continuation) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
context = generalContext; ///
|
|
173
|
+
const statementNode = specificStatementNode, ///
|
|
174
|
+
metavariableNode = generalStatementMetavariableNode;
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
metavariable = context.findMetavariableByMetavariableNode(metavariableNode),
|
|
180
|
-
metavariableNodeParentNode = metavariableNode.getParentNode();
|
|
181
|
-
|
|
182
|
-
statementNode = metavariableNodeParentNode; ///
|
|
176
|
+
let context;
|
|
183
177
|
|
|
184
|
-
|
|
185
|
-
substitution = (substitutionNode !== null) ?
|
|
186
|
-
context.findSubstitutionBySubstitutionNode(substitutionNode) :
|
|
187
|
-
null;
|
|
178
|
+
context = generalContext; ///
|
|
188
179
|
|
|
189
|
-
|
|
180
|
+
const metavariable = context.findMetavariableByMetavariableNode(metavariableNode);
|
|
190
181
|
|
|
191
|
-
|
|
182
|
+
context = specificContext; ///
|
|
192
183
|
|
|
193
184
|
const statement = context.findStatementByStatementNode(statementNode);
|
|
194
185
|
|
|
195
|
-
metavariable.unifyStatement(statement,
|
|
186
|
+
metavariable.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
196
187
|
let success = false;
|
|
197
188
|
|
|
198
189
|
if (statementUnifies) {
|
|
@@ -135,14 +135,15 @@ function validateStatementAsMetavariable(statement, context, continuation) {
|
|
|
135
135
|
return continuation(statementValidatesAsMetavariable);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
const
|
|
139
|
-
frameSubstitution = FrameSubstitution.fromStatement(statement, context),
|
|
140
|
-
termSubstitution = TermSubstitution.fromStatement(statement, context),
|
|
141
|
-
substitution = (termSubstitution || frameSubstitution);
|
|
138
|
+
const substitution = statement.getSubstitution();
|
|
142
139
|
|
|
143
140
|
if (substitution === null) {
|
|
144
141
|
const statementValidatesAsMetavariable = true;
|
|
145
142
|
|
|
143
|
+
if (statementValidatesAsMetavariable) {
|
|
144
|
+
context.debug(`...validated the '${statementString}' statement as a metavariable.`);
|
|
145
|
+
}
|
|
146
|
+
|
|
146
147
|
return continuation(statementValidatesAsMetavariable);
|
|
147
148
|
}
|
|
148
149
|
|
package/src/utilities/element.js
CHANGED
|
@@ -345,11 +345,12 @@ export function statementFromStatementNode(statementNode, context) {
|
|
|
345
345
|
const { Statement } = elements,
|
|
346
346
|
node = statementNode, ///
|
|
347
347
|
string = context.nodeAsString(node),
|
|
348
|
-
breakPoint = null
|
|
348
|
+
breakPoint = null,
|
|
349
|
+
substitution = substitutionFromStatementNode(statementNode, context);
|
|
349
350
|
|
|
350
351
|
context = null;
|
|
351
352
|
|
|
352
|
-
const statement = new Statement(context, string, node, breakPoint);
|
|
353
|
+
const statement = new Statement(context, string, node, breakPoint, substitution);
|
|
353
354
|
|
|
354
355
|
return statement;
|
|
355
356
|
}
|
|
@@ -687,15 +688,15 @@ export function definedAssertionFromDefinedAssertionNode(definedAssertionNode, c
|
|
|
687
688
|
export function termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, generalContext, specificContext) {
|
|
688
689
|
const { TermSubstitution } = elements,
|
|
689
690
|
node = termSubstitutionNode, ///
|
|
690
|
-
context = specificContext, ///
|
|
691
691
|
contexts = [
|
|
692
692
|
generalContext,
|
|
693
693
|
specificContext
|
|
694
694
|
],
|
|
695
|
+
context = specificContext, ///
|
|
695
696
|
string = context.nodeAsString(node),
|
|
696
697
|
breakPoint = null,
|
|
697
|
-
targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
698
|
-
replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
698
|
+
targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext),
|
|
699
|
+
replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext),
|
|
699
700
|
termSubstitution = new TermSubstitution(contexts, string, node, breakPoint, targetTerm, replacementTerm);
|
|
700
701
|
|
|
701
702
|
return termSubstitution;
|
|
@@ -704,15 +705,15 @@ export function termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, g
|
|
|
704
705
|
export function frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, generalContext, specificContext) {
|
|
705
706
|
const { FrameSubstitution } = elements,
|
|
706
707
|
node = frameSubstitutionNode, ///
|
|
707
|
-
context = specificContext, ///
|
|
708
708
|
contexts = [
|
|
709
709
|
generalContext,
|
|
710
710
|
specificContext
|
|
711
711
|
],
|
|
712
|
+
context = specificContext, ///
|
|
712
713
|
string = context.nodeAsString(node),
|
|
713
714
|
breakPoint = null,
|
|
714
|
-
targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
715
|
-
replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
715
|
+
targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, generalContext),
|
|
716
|
+
replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, specificContext),
|
|
716
717
|
frameSubstitution = new FrameSubstitution(contexts, string, node, breakPoint, targetFrame, replacementFrame);
|
|
717
718
|
|
|
718
719
|
return frameSubstitution;
|
|
@@ -924,15 +925,15 @@ export function combinatorDeclarationFromCombinatorDeclarationNode(combinatorDec
|
|
|
924
925
|
export function referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext, specificContext) {
|
|
925
926
|
const { ReferenceSubstitution } = elements,
|
|
926
927
|
node = referenceSubstitutionNode, ///
|
|
927
|
-
context = specificContext, ///
|
|
928
928
|
contexts = [
|
|
929
929
|
generalContext,
|
|
930
930
|
specificContext
|
|
931
931
|
],
|
|
932
|
+
context = specificContext, ///
|
|
932
933
|
string = context.nodeAsString(node),
|
|
933
934
|
breakPoint = null,
|
|
934
|
-
targetReference = targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
935
|
-
replacementReference = replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
935
|
+
targetReference = targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext),
|
|
936
|
+
replacementReference = replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, specificContext),
|
|
936
937
|
referenceSubstitution = new ReferenceSubstitution(contexts, string, node, breakPoint, targetReference, replacementReference);
|
|
937
938
|
|
|
938
939
|
return referenceSubstitution;
|
|
@@ -941,18 +942,17 @@ export function referenceSubstitutionFromReferenceSubstitutionNode(referenceSubs
|
|
|
941
942
|
export function statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext) {
|
|
942
943
|
const { StatementSubstitution } = elements,
|
|
943
944
|
node = statementSubstitutionNode, ///
|
|
944
|
-
context = specificContext, ///
|
|
945
945
|
contexts = [
|
|
946
946
|
generalContext,
|
|
947
947
|
specificContext
|
|
948
948
|
],
|
|
949
|
+
context = specificContext, ///
|
|
949
950
|
string = context.nodeAsString(node),
|
|
950
951
|
breakPoint = null,
|
|
951
|
-
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
statementSubstitution = new StatementSubstitution(contexts, string, node, breakPoint, resolved, substitution, targetStatement, replacementStatement);
|
|
952
|
+
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext),
|
|
953
|
+
targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext),
|
|
954
|
+
replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext),
|
|
955
|
+
statementSubstitution = new StatementSubstitution(contexts, string, node, breakPoint, resolved, targetStatement, replacementStatement);
|
|
956
956
|
|
|
957
957
|
return statementSubstitution;
|
|
958
958
|
}
|
|
@@ -1646,6 +1646,15 @@ export function metavariableFromReferenceNode(referenceNode, context) {
|
|
|
1646
1646
|
return metavariable;
|
|
1647
1647
|
}
|
|
1648
1648
|
|
|
1649
|
+
export function substitutionFromStatementNode(statementNode, context) {
|
|
1650
|
+
const { FrameSubstitution, TermSubstitution } = elements,
|
|
1651
|
+
frameSubstitution = FrameSubstitution.fromStatementNode(statementNode, context),
|
|
1652
|
+
termSubstitution = TermSubstitution.fromStatementNode(statementNode, context),
|
|
1653
|
+
substitution = (frameSubstitution || termSubstitution);
|
|
1654
|
+
|
|
1655
|
+
return substitution;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1649
1658
|
export function hypothesesFromConstructorNode(constructorNode, context) {
|
|
1650
1659
|
const hypotheses = [];
|
|
1651
1660
|
|
|
@@ -1905,8 +1914,9 @@ export function negatedFromContainedAssertionNode(containedAssertionNode, contex
|
|
|
1905
1914
|
return negated;
|
|
1906
1915
|
}
|
|
1907
1916
|
|
|
1908
|
-
export function targetTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
1909
|
-
const
|
|
1917
|
+
export function targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext) {
|
|
1918
|
+
const context = generalContext, ///
|
|
1919
|
+
targetTermNode = termSubstitutionNode.getTargetTermNode(),
|
|
1910
1920
|
targetTerm = termFromTermNode(targetTermNode, context);
|
|
1911
1921
|
|
|
1912
1922
|
return targetTerm;
|
|
@@ -2090,8 +2100,9 @@ export function subjectTermFromPropertyAssertionNode(propertyAssertionNode, cont
|
|
|
2090
2100
|
return subjectTerm;
|
|
2091
2101
|
}
|
|
2092
2102
|
|
|
2093
|
-
export function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
2094
|
-
const
|
|
2103
|
+
export function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, generalContext) {
|
|
2104
|
+
const context = generalContext, ///
|
|
2105
|
+
targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
|
|
2095
2106
|
targetFrame = frameFromFrameNode(targetFrameNode, context);
|
|
2096
2107
|
|
|
2097
2108
|
return targetFrame;
|
|
@@ -2143,7 +2154,7 @@ export function generatorFromGeneratorDeclarationNode(generatorDeclarationNode,
|
|
|
2143
2154
|
return generator;
|
|
2144
2155
|
}
|
|
2145
2156
|
|
|
2146
|
-
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
2157
|
+
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext) {
|
|
2147
2158
|
const resolved = statementSubstitutionNode.isResolved();
|
|
2148
2159
|
|
|
2149
2160
|
return resolved;
|
|
@@ -2168,8 +2179,9 @@ export function procedureReferenceFromProcedureCallNode(procedureCallNode, conte
|
|
|
2168
2179
|
return procedureReference;
|
|
2169
2180
|
}
|
|
2170
2181
|
|
|
2171
|
-
export function replacementTermFromTermSubstitutionNode(termSubstitutionNode,
|
|
2172
|
-
const
|
|
2182
|
+
export function replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext) {
|
|
2183
|
+
const context = specificContext, //////
|
|
2184
|
+
replacementTermNode = termSubstitutionNode.getReplacementTermNode(),
|
|
2173
2185
|
replacementTerm = termFromTermNode(replacementTermNode, context);
|
|
2174
2186
|
|
|
2175
2187
|
return replacementTerm;
|
|
@@ -2202,21 +2214,14 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
2202
2214
|
return metaType;
|
|
2203
2215
|
}
|
|
2204
2216
|
|
|
2205
|
-
export function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode,
|
|
2206
|
-
const
|
|
2217
|
+
export function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, specificContext) {
|
|
2218
|
+
const context = specificContext, ///
|
|
2219
|
+
replacementFrameNode = frameSubstitutionNode.getReplacementFrameNode(),
|
|
2207
2220
|
replacementFrame = frameFromFrameNode(replacementFrameNode, context);
|
|
2208
2221
|
|
|
2209
2222
|
return replacementFrame;
|
|
2210
2223
|
}
|
|
2211
2224
|
|
|
2212
|
-
export function substitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext) {
|
|
2213
|
-
const frameSubstitution = frameSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext),
|
|
2214
|
-
termSubstitution = termSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext),
|
|
2215
|
-
substitution = (frameSubstitution || termSubstitution);
|
|
2216
|
-
|
|
2217
|
-
return substitution;
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
2225
|
export function constructorFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
2221
2226
|
const constructorNode = constructorDeclarationNode.getConstructorNode(),
|
|
2222
2227
|
constructor = constructorFromConstructorNode(constructorNode, context);
|
|
@@ -2237,8 +2242,9 @@ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarat
|
|
|
2237
2242
|
return metavariable;
|
|
2238
2243
|
}
|
|
2239
2244
|
|
|
2240
|
-
export function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode,
|
|
2245
|
+
export function targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext) {
|
|
2241
2246
|
const { Reference } = elements,
|
|
2247
|
+
context = generalContext, ///
|
|
2242
2248
|
targetReferenceNode = referenceSubstitutionNode.getTargetReferenceNode(),
|
|
2243
2249
|
targetReferenceString = context.nodeAsString(targetReferenceNode),
|
|
2244
2250
|
targetReference = Reference.fromReferenceString(targetReferenceString, context);
|
|
@@ -2246,8 +2252,9 @@ export function targetReferenceFromReferenceSubstitutionNode(referenceSubstituti
|
|
|
2246
2252
|
return targetReference;
|
|
2247
2253
|
}
|
|
2248
2254
|
|
|
2249
|
-
export function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
2250
|
-
const
|
|
2255
|
+
export function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext) {
|
|
2256
|
+
const context = generalContext, ///
|
|
2257
|
+
targetStatementNode = statementSubstitutionNode.getTargetStatementNode(),
|
|
2251
2258
|
targetStatement = statementFromStatementNode(targetStatementNode, context);
|
|
2252
2259
|
|
|
2253
2260
|
return targetStatement;
|
|
@@ -2260,32 +2267,9 @@ export function propertyDeclarationsFromCotypeDeclarationNode(cotypeDeclarationN
|
|
|
2260
2267
|
return propertyDeclarations;
|
|
2261
2268
|
}
|
|
2262
2269
|
|
|
2263
|
-
export function
|
|
2264
|
-
let termSubstitution = null;
|
|
2265
|
-
|
|
2266
|
-
const termSubstitutionNode = statementSubstitutionNode.getTermSubstitutionNode();
|
|
2267
|
-
|
|
2268
|
-
if (termSubstitutionNode !== null) {
|
|
2269
|
-
termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, generalContext, specificContext);
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
return termSubstitution;
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
export function frameSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext) {
|
|
2276
|
-
let frameSubstitution = null;
|
|
2277
|
-
|
|
2278
|
-
const frameSubstitutionNode = statementSubstitutionNode.getFrameSubstitutionNode();
|
|
2279
|
-
|
|
2280
|
-
if (frameSubstitutionNode !== null) {
|
|
2281
|
-
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, generalContext, specificContext);
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
return frameSubstitution;
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
export function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
2270
|
+
export function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, specificContext) {
|
|
2288
2271
|
const { Reference } = elements,
|
|
2272
|
+
context = specificContext, ///
|
|
2289
2273
|
replacementReferenceNode = referenceSubstitutionNode.getReplacementReferenceNode(),
|
|
2290
2274
|
replacementReferenceString = context.nodeAsString(replacementReferenceNode),
|
|
2291
2275
|
replacementReference = Reference.fromReferenceString(replacementReferenceString, context);
|
|
@@ -2293,8 +2277,9 @@ export function replacementReferenceFromReferenceSubstitutionNode(referenceSubst
|
|
|
2293
2277
|
return replacementReference;
|
|
2294
2278
|
}
|
|
2295
2279
|
|
|
2296
|
-
export function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode,
|
|
2297
|
-
const
|
|
2280
|
+
export function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext) {
|
|
2281
|
+
const context = specificContext, ///
|
|
2282
|
+
replacementStatementNode = statementSubstitutionNode.getReplacementStatementNode(),
|
|
2298
2283
|
replacementStatement = statementFromStatementNode(replacementStatementNode, context);
|
|
2299
2284
|
|
|
2300
2285
|
return replacementStatement;
|