occam-verify-cli 1.0.876 → 1.0.878
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/phaneric.js +44 -0
- package/lib/context/synoptic.js +42 -139
- package/lib/element/substitution/frame.js +10 -8
- package/lib/element/substitution/reference.js +10 -8
- package/lib/element/substitution/statement.js +12 -9
- package/lib/element/substitution/term.js +13 -11
- package/lib/utilities/context.js +13 -5
- package/package.json +1 -1
- package/src/context/phaneric.js +43 -0
- package/src/context/synoptic.js +44 -216
- package/src/element/substitution/frame.js +10 -8
- package/src/element/substitution/reference.js +9 -7
- package/src/element/substitution/statement.js +13 -9
- package/src/element/substitution/term.js +13 -11
- package/src/utilities/context.js +12 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
import Context from "../context";
|
|
6
|
+
|
|
7
|
+
import { EMPTY_STRING } from "../constants";
|
|
8
|
+
|
|
9
|
+
const { last } = arrayUtilities;
|
|
10
|
+
|
|
11
|
+
export default class PhanericContext extends Context {
|
|
12
|
+
constructor(context, contexts) {
|
|
13
|
+
super(context);
|
|
14
|
+
|
|
15
|
+
this.contexts = contexts;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getContexts() {
|
|
19
|
+
return this.contexts;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
nodeAsString(node) {
|
|
23
|
+
let string = EMPTY_STRING;
|
|
24
|
+
|
|
25
|
+
this.contexts.some((context) => {
|
|
26
|
+
string = context.nodeAsString(node);
|
|
27
|
+
|
|
28
|
+
if (string !== EMPTY_STRING) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static fromContexts(contexts) {
|
|
37
|
+
const lastContext = last(contexts),
|
|
38
|
+
context = lastContext, ///
|
|
39
|
+
phanericContext = new PhanericContext(context, contexts);
|
|
40
|
+
|
|
41
|
+
return phanericContext;
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/context/synoptic.js
CHANGED
|
@@ -15,31 +15,23 @@ import { compressTerms,
|
|
|
15
15
|
compressMetavariables,
|
|
16
16
|
compressSubstitutions,} from "../utilities/synoptic";
|
|
17
17
|
|
|
18
|
-
const {
|
|
18
|
+
const { last } = arrayUtilities;
|
|
19
19
|
|
|
20
20
|
export default class SynopticContext extends Context {
|
|
21
|
-
constructor(context,
|
|
21
|
+
constructor(context, contexts) {
|
|
22
22
|
super(context);
|
|
23
23
|
|
|
24
|
-
this.
|
|
25
|
-
this.frames = frames;
|
|
26
|
-
this.equalities = equalities;
|
|
27
|
-
this.judgements = judgements;
|
|
28
|
-
this.assertions = assertions;
|
|
29
|
-
this.statements = statements;
|
|
30
|
-
this.references = references;
|
|
31
|
-
this.assumptions = assumptions;
|
|
32
|
-
this.metavariables = metavariables;
|
|
33
|
-
this.substitutions = substitutions;
|
|
34
|
-
this.derivedSubstitutions = derivedSubstitutions;
|
|
24
|
+
this.contexts = contexts;
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
push(terms, this.terms);
|
|
27
|
+
getContexts() {
|
|
28
|
+
return this.contexts;
|
|
29
|
+
}
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
getTerms(terms = []) {
|
|
32
|
+
this.contexts.forEach((context) => {
|
|
33
|
+
context.getTerms(terms);
|
|
34
|
+
});
|
|
43
35
|
|
|
44
36
|
compressTerms(terms);
|
|
45
37
|
|
|
@@ -47,11 +39,9 @@ export default class SynopticContext extends Context {
|
|
|
47
39
|
}
|
|
48
40
|
|
|
49
41
|
getFrames(frames = []) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
context.getFrames(frames);
|
|
42
|
+
this.contexts.forEach((context) => {
|
|
43
|
+
context.getFrames(frames);
|
|
44
|
+
});
|
|
55
45
|
|
|
56
46
|
compressFrames(frames);
|
|
57
47
|
|
|
@@ -59,11 +49,9 @@ export default class SynopticContext extends Context {
|
|
|
59
49
|
}
|
|
60
50
|
|
|
61
51
|
getEqualities(equalities = []) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
context.getEqualities(equalities);
|
|
52
|
+
this.contexts.forEach((context) => {
|
|
53
|
+
context.getEqualities(equalities);
|
|
54
|
+
});
|
|
67
55
|
|
|
68
56
|
compressEqualities(equalities);
|
|
69
57
|
|
|
@@ -71,11 +59,9 @@ export default class SynopticContext extends Context {
|
|
|
71
59
|
}
|
|
72
60
|
|
|
73
61
|
getJudgements(judgements = []) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
context.getJudgements(judgements);
|
|
62
|
+
this.contexts.forEach((context) => {
|
|
63
|
+
context.getJudgements(judgements);
|
|
64
|
+
});
|
|
79
65
|
|
|
80
66
|
compressJudgements(judgements);
|
|
81
67
|
|
|
@@ -83,11 +69,9 @@ export default class SynopticContext extends Context {
|
|
|
83
69
|
}
|
|
84
70
|
|
|
85
71
|
getStatements(statements = []) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
context.getStatements(statements);
|
|
72
|
+
this.contexts.forEach((context) => {
|
|
73
|
+
context.getStatements(statements);
|
|
74
|
+
});
|
|
91
75
|
|
|
92
76
|
compressStatements(statements);
|
|
93
77
|
|
|
@@ -95,11 +79,9 @@ export default class SynopticContext extends Context {
|
|
|
95
79
|
}
|
|
96
80
|
|
|
97
81
|
getAssertions(assertions = []) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
context.getAssertions(assertions);
|
|
82
|
+
this.contexts.forEach((context) => {
|
|
83
|
+
context.getAssertions(assertions);
|
|
84
|
+
});
|
|
103
85
|
|
|
104
86
|
compressAssertions(assertions);
|
|
105
87
|
|
|
@@ -107,11 +89,9 @@ export default class SynopticContext extends Context {
|
|
|
107
89
|
}
|
|
108
90
|
|
|
109
91
|
getReferences(references = []) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
context.getReferences(references);
|
|
92
|
+
this.contexts.forEach((context) => {
|
|
93
|
+
context.getReferences(references);
|
|
94
|
+
});
|
|
115
95
|
|
|
116
96
|
compressReferences(references);
|
|
117
97
|
|
|
@@ -119,11 +99,9 @@ export default class SynopticContext extends Context {
|
|
|
119
99
|
}
|
|
120
100
|
|
|
121
101
|
getAssumptions(assumptions = []) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
context.getAssumptions(assumptions);
|
|
102
|
+
this.contexts.forEach((context) => {
|
|
103
|
+
context.getAssumptions(assumptions);
|
|
104
|
+
});
|
|
127
105
|
|
|
128
106
|
compressAssumptions(assumptions);
|
|
129
107
|
|
|
@@ -131,11 +109,9 @@ export default class SynopticContext extends Context {
|
|
|
131
109
|
}
|
|
132
110
|
|
|
133
111
|
getMetavariables(metavariables = []) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
context.getMetavariables(metavariables);
|
|
112
|
+
this.contexts.forEach((context) => {
|
|
113
|
+
context.getMetavariables(metavariables);
|
|
114
|
+
});
|
|
139
115
|
|
|
140
116
|
compressMetavariables(metavariables);
|
|
141
117
|
|
|
@@ -143,11 +119,9 @@ export default class SynopticContext extends Context {
|
|
|
143
119
|
}
|
|
144
120
|
|
|
145
121
|
getSubstitutions(substitutions = []) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
context.getSubstitutions(substitutions);
|
|
122
|
+
this.contexts.forEach((context) => {
|
|
123
|
+
context.getSubstitutions(substitutions);
|
|
124
|
+
});
|
|
151
125
|
|
|
152
126
|
compressSubstitutions(substitutions);
|
|
153
127
|
|
|
@@ -155,11 +129,9 @@ export default class SynopticContext extends Context {
|
|
|
155
129
|
}
|
|
156
130
|
|
|
157
131
|
getDerivedSubstitutions(derivedSubstitutions = []) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
context.getDerivedSubstitutions(derivedSubstitutions);
|
|
132
|
+
this.contexts.forEach((context) => {
|
|
133
|
+
context.getDerivedSubstitutions(derivedSubstitutions);
|
|
134
|
+
});
|
|
163
135
|
|
|
164
136
|
return derivedSubstitutions;
|
|
165
137
|
}
|
|
@@ -307,155 +279,11 @@ export default class SynopticContext extends Context {
|
|
|
307
279
|
return substitution;
|
|
308
280
|
}
|
|
309
281
|
|
|
310
|
-
static fromContexts(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const context = contexts.pop(), ///
|
|
316
|
-
terms = termsFromContexts(contexts),
|
|
317
|
-
frames = framesFromContexts(contexts),
|
|
318
|
-
equalities = equalitiesFromContexts(contexts),
|
|
319
|
-
judgements = judgementsFromContexts(contexts),
|
|
320
|
-
assertions = assertionsFromContexts(contexts),
|
|
321
|
-
statements = statementsFromContexts(contexts),
|
|
322
|
-
references = referencesFromContexts(contexts),
|
|
323
|
-
assumptions = assumptionsFromContexts(contexts),
|
|
324
|
-
metavariables = metavariablesFromContexts(contexts),
|
|
325
|
-
substitutions = substitutionsFromContexts(contexts),
|
|
326
|
-
derivedSubstitutions = derivedSubstitutionsFromContexts(contexts),
|
|
327
|
-
synopticContext = new SynopticContext(context, terms, frames, equalities, judgements, assertions, statements, references, assumptions, metavariables, substitutions, derivedSubstitutions);
|
|
282
|
+
static fromContexts(contexts) {
|
|
283
|
+
const lastContext = last(contexts),
|
|
284
|
+
context = lastContext, ///
|
|
285
|
+
synopticContext = new SynopticContext(context, contexts);
|
|
328
286
|
|
|
329
287
|
return synopticContext;
|
|
330
288
|
}
|
|
331
289
|
}
|
|
332
|
-
|
|
333
|
-
function termsFromContexts(contexts) {
|
|
334
|
-
const terms = [];
|
|
335
|
-
|
|
336
|
-
contexts.forEach((context) => {
|
|
337
|
-
context.getTerms(terms);
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
compressTerms(terms);
|
|
341
|
-
|
|
342
|
-
return terms;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function framesFromContexts(contexts) {
|
|
346
|
-
const frames = [];
|
|
347
|
-
|
|
348
|
-
contexts.forEach((context) => {
|
|
349
|
-
context.getFrames(frames);
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
compressFrames(frames);
|
|
353
|
-
|
|
354
|
-
return frames;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function equalitiesFromContexts(contexts) {
|
|
358
|
-
const equalities = [];
|
|
359
|
-
|
|
360
|
-
contexts.forEach((context) => {
|
|
361
|
-
context.getEqualities(equalities);
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
compressEqualities(equalities);
|
|
365
|
-
|
|
366
|
-
return equalities;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function judgementsFromContexts(contexts) {
|
|
370
|
-
const judgements = [];
|
|
371
|
-
|
|
372
|
-
contexts.forEach((context) => {
|
|
373
|
-
context.getJudgements(judgements);
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
compressJudgements(judgements);
|
|
377
|
-
|
|
378
|
-
return judgements;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function assertionsFromContexts(contexts) {
|
|
382
|
-
const assertions = [];
|
|
383
|
-
|
|
384
|
-
contexts.forEach((context) => {
|
|
385
|
-
context.getAssertions(assertions);
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
compressAssertions(assertions);
|
|
389
|
-
|
|
390
|
-
return assertions;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function statementsFromContexts(contexts) {
|
|
394
|
-
const statements = [];
|
|
395
|
-
|
|
396
|
-
contexts.forEach((context) => {
|
|
397
|
-
context.getStatements(statements);
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
compressStatements(statements);
|
|
401
|
-
|
|
402
|
-
return statements;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function referencesFromContexts(contexts) {
|
|
406
|
-
const references = [];
|
|
407
|
-
|
|
408
|
-
contexts.forEach((context) => {
|
|
409
|
-
context.getReferences(references);
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
compressReferences(references);
|
|
413
|
-
|
|
414
|
-
return references;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function assumptionsFromContexts(contexts) {
|
|
418
|
-
const assumptions = [];
|
|
419
|
-
|
|
420
|
-
contexts.forEach((context) => {
|
|
421
|
-
context.getAssumptions(assumptions);
|
|
422
|
-
});
|
|
423
|
-
|
|
424
|
-
compressAssumptions(assumptions);
|
|
425
|
-
|
|
426
|
-
return assumptions;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function metavariablesFromContexts(contexts) {
|
|
430
|
-
const metavariables = [];
|
|
431
|
-
|
|
432
|
-
contexts.forEach((context) => {
|
|
433
|
-
context.getMetavariables(metavariables);
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
compressMetavariables(metavariables);
|
|
437
|
-
|
|
438
|
-
return metavariables;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function substitutionsFromContexts(contexts) {
|
|
442
|
-
const substitutions = [];
|
|
443
|
-
|
|
444
|
-
contexts.forEach((context) => {
|
|
445
|
-
context.getSubstitutions(substitutions);
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
compressSubstitutions(substitutions);
|
|
449
|
-
|
|
450
|
-
return substitutions;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function derivedSubstitutionsFromContexts(contexts) {
|
|
454
|
-
const derivedSubstitutions = [];
|
|
455
|
-
|
|
456
|
-
contexts.forEach((context) => {
|
|
457
|
-
context.getDerivedSubstitutions(derivedSubstitutions);
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
return derivedSubstitutions;
|
|
461
|
-
}
|
|
@@ -6,7 +6,7 @@ import { define } from "../../elements";
|
|
|
6
6
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
7
7
|
import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
8
8
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
9
|
-
import { ablate, ablates, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
9
|
+
import { ablate, ablates, manifest, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class FrameSubstitution extends Substitution {
|
|
12
12
|
constructor(contexts, string, node, lineIndex, targetFrame, replacementFrame) {
|
|
@@ -130,15 +130,17 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
130
130
|
const targetFrameSingular = this.targetFrame.isSingular();
|
|
131
131
|
|
|
132
132
|
if (targetFrameSingular) {
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
manifest((context) => {
|
|
134
|
+
descend((context) => {
|
|
135
|
+
const tragetFrame = this.targetFrame.validate(context);
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
if (tragetFrame !== null) {
|
|
138
|
+
this.targetFrame = tragetFrame;
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
targetFrameValidates = true;
|
|
141
|
+
}
|
|
142
|
+
}, context);
|
|
143
|
+
}, specificContext, context);
|
|
142
144
|
} else {
|
|
143
145
|
const targetFrameString = this.targetFrame.getString();
|
|
144
146
|
|
|
@@ -5,8 +5,8 @@ import Substitution from "../substitution";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
7
7
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
8
|
-
import { ablates, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
9
8
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
9
|
+
import { ablates, manifest, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
12
12
|
constructor(context, string, node, lineIndex, targetReference, replacementReference) {
|
|
@@ -144,13 +144,15 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
144
144
|
|
|
145
145
|
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's target reference...`);
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
manifest((context) => {
|
|
148
|
+
descend((context) => {
|
|
149
|
+
const targetReference = this.targetReference.validate(context);
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
if (targetReference !== null) {
|
|
152
|
+
targetReferenceValidates = true;
|
|
153
|
+
}
|
|
154
|
+
}, context);
|
|
155
|
+
}, specificContext, context);
|
|
154
156
|
|
|
155
157
|
if (targetReferenceValidates) {
|
|
156
158
|
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution's target reference...`);
|
|
@@ -7,7 +7,7 @@ import { unifySubstitution } from "../../process/unify";
|
|
|
7
7
|
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
8
8
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
9
9
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
10
|
-
import { join,
|
|
10
|
+
import { join, ablates, manifest, attempts, descend, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
12
|
|
|
13
13
|
export default define(class StatementSubstitution extends Substitution {
|
|
@@ -168,13 +168,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
168
168
|
const targetStatementSingular = this.targetStatement.isSingular();
|
|
169
169
|
|
|
170
170
|
if (targetStatementSingular) {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
manifest((context) => {
|
|
172
|
+
descend((context) => {
|
|
173
|
+
const targetStatement = this.targetStatement.validate(context);
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
if (targetStatement !== null) {
|
|
176
|
+
targetStatementValidates = true;
|
|
177
|
+
}
|
|
178
|
+
}, context);
|
|
179
|
+
}, specificContext, context);
|
|
178
180
|
} else {
|
|
179
181
|
const targetStatementString = this.targetStatement.getString();
|
|
180
182
|
|
|
@@ -403,7 +405,9 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
403
405
|
|
|
404
406
|
let statementSubstitution;
|
|
405
407
|
|
|
406
|
-
|
|
408
|
+
ablates((generalContext, specificContext) => {
|
|
409
|
+
const context = specificContext; ///
|
|
410
|
+
|
|
407
411
|
instantiate((context) => {
|
|
408
412
|
const specificContext = context, ///
|
|
409
413
|
statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
|
|
@@ -412,7 +416,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
412
416
|
|
|
413
417
|
statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext);
|
|
414
418
|
}, context);
|
|
415
|
-
},
|
|
419
|
+
}, generalContext, specificContext);
|
|
416
420
|
|
|
417
421
|
return statementSubstitution;
|
|
418
422
|
}
|
|
@@ -7,7 +7,7 @@ import { stripBracketsFromTerm } from "../../utilities/brackets";
|
|
|
7
7
|
import { instantiateTermSubstitution } from "../../process/instantiate";
|
|
8
8
|
import { termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
|
|
9
9
|
import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
|
|
10
|
-
import { ablate, ablates, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
10
|
+
import { ablate, ablates, manifest, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
|
|
12
12
|
export default define(class TermSubstitution extends Substitution {
|
|
13
13
|
constructor(context, string, node, lineIndex, targetTerm, replacementTerm) {
|
|
@@ -133,19 +133,21 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
133
133
|
const targetTermSingular = this.targetTerm.isSingular();
|
|
134
134
|
|
|
135
135
|
if (targetTermSingular) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
136
|
+
manifest((context) => {
|
|
137
|
+
descend((context) => {
|
|
138
|
+
const targetTerm = this.targetTerm.validate(context, (targetTerm) => {
|
|
139
|
+
const validatesForwards = true;
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
return validatesForwards;
|
|
142
|
+
});
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
if (targetTerm !== null) {
|
|
145
|
+
this.targetTerm = targetTerm;
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
targetTermValidates = true;
|
|
148
|
+
}
|
|
149
|
+
}, context);
|
|
150
|
+
}, specificContext, context);
|
|
149
151
|
} else {
|
|
150
152
|
const targetTermString = this.targetTerm.getString();
|
|
151
153
|
|
package/src/utilities/context.js
CHANGED
|
@@ -7,6 +7,7 @@ import BoundedContext from "../context/bounded";
|
|
|
7
7
|
import NominalContext from "../context/nominal";
|
|
8
8
|
import LiteralContext from "../context/literal";
|
|
9
9
|
import LiminalContext from "../context/liminal";
|
|
10
|
+
import PhanericContext from "../context/phaneric";
|
|
10
11
|
import SynopticContext from "../context/synoptic";
|
|
11
12
|
import IllativeContext from "../context/illative";
|
|
12
13
|
import BranchingContext from "../context/branching";
|
|
@@ -15,7 +16,7 @@ import NominalFileContext from "../context/file/nominal";
|
|
|
15
16
|
import { mnemicContextFromJSON, mnemicContextsFromJSON, mnemicContextToMnemicContextJSON, mnemicContextsToMnemicContextsJSON } from "../utilities/json";
|
|
16
17
|
|
|
17
18
|
export function join(innerFunction, ...contexts) {
|
|
18
|
-
const synopticContext = SynopticContext.fromContexts(
|
|
19
|
+
const synopticContext = SynopticContext.fromContexts(contexts),
|
|
19
20
|
context = synopticContext; ///
|
|
20
21
|
|
|
21
22
|
return innerFunction(context);
|
|
@@ -109,10 +110,11 @@ export function enclose(innerFunction, metaLevelAssumptions, context) {
|
|
|
109
110
|
return innerFunction(context);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
export function
|
|
113
|
-
const
|
|
113
|
+
export function manifest(innerFunction, ...contexts) {
|
|
114
|
+
const phanericContext = PhanericContext.fromContexts(contexts),
|
|
115
|
+
context = phanericContext; ///
|
|
114
116
|
|
|
115
|
-
return
|
|
117
|
+
return innerFunction(context);
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
export function reconcile(innerFunction, context) {
|
|
@@ -201,3 +203,9 @@ export function unserialises(innerFunction, json, context) {
|
|
|
201
203
|
|
|
202
204
|
return innerFunction(json, ...contexts);
|
|
203
205
|
}
|
|
206
|
+
|
|
207
|
+
export function evaluate(procedure, terms) {
|
|
208
|
+
const context = procedure.getContext();
|
|
209
|
+
|
|
210
|
+
return procedure.call(terms, context);
|
|
211
|
+
}
|