occam-verify-cli 0.0.990 → 0.0.992
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/resolve/complexSubstitutionAgainstSimpleSubstitution.js +29 -46
- package/lib/substitution/frameForMetavariable.js +31 -10
- package/lib/substitution/statementForMetavariable.js +1 -31
- package/lib/substitution/termForVariable.js +32 -15
- package/lib/substitution.js +8 -1
- package/lib/substitutions.js +8 -2
- package/lib/unifier/metaLevel.js +20 -12
- package/lib/unify/metavariableWithFrame.js +3 -2
- package/lib/unify/metavariableWithStatement.js +3 -2
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +3 -2
- package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +31 -0
- package/package.json +1 -1
- package/src/resolve/complexSubstitutionAgainstSimpleSubstitution.js +35 -59
- package/src/substitution/frameForMetavariable.js +42 -9
- package/src/substitution/statementForMetavariable.js +0 -44
- package/src/substitution/termForVariable.js +44 -15
- package/src/substitution.js +6 -0
- package/src/substitutions.js +3 -1
- package/src/unifier/metaLevel.js +32 -21
- package/src/unify/metavariableWithFrame.js +3 -1
- package/src/unify/metavariableWithStatement.js +3 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +3 -1
- package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +27 -0
- package/lib/unify/complexSubstitutionStatementWithSimpleSubstitutionStatement.js +0 -31
- package/src/unify/complexSubstitutionStatementWithSimpleSubstitutionStatement.js +0 -27
|
@@ -4,11 +4,8 @@ import Substitution from "../substitution";
|
|
|
4
4
|
import TermForVariableSubstitution from "../substitution/termForVariable";
|
|
5
5
|
import FrameForMetavariableSubstitution from "../substitution/frameForMetavariable";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
7
|
import { stripBracketsFromStatement } from "../utilities/brackets";
|
|
9
8
|
|
|
10
|
-
const statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!");
|
|
11
|
-
|
|
12
9
|
export default class StatementForMetavariableSubstitution extends Substitution {
|
|
13
10
|
constructor(statementNode, metavariableNode, substitution) {
|
|
14
11
|
super();
|
|
@@ -42,23 +39,6 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
42
39
|
return simple;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
transformed(substitutions) {
|
|
46
|
-
let transformedSubstitution = null;
|
|
47
|
-
|
|
48
|
-
const transformedStatementNode = transformStatementNode(this.statementNode, substitutions);
|
|
49
|
-
|
|
50
|
-
if (transformedStatementNode !== null) {
|
|
51
|
-
const substitution = null,
|
|
52
|
-
statementNode = transformedStatementNode, ///
|
|
53
|
-
metavariableNode = this.metavariableNode, ///
|
|
54
|
-
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(statementNode, metavariableNode, substitution);
|
|
55
|
-
|
|
56
|
-
transformedSubstitution = statementForMetavariableSubstitution; ///
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return transformedSubstitution;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
42
|
matchStatementNode(statementNode) {
|
|
63
43
|
statementNode = stripBracketsFromStatement(statementNode); ///
|
|
64
44
|
|
|
@@ -132,27 +112,3 @@ function substitutionFromSubstitutionNode(substitutionNode) {
|
|
|
132
112
|
|
|
133
113
|
return substitution;
|
|
134
114
|
}
|
|
135
|
-
|
|
136
|
-
function transformStatementNode(statementNode, substitutions) {
|
|
137
|
-
let transformedStatementNode = null;
|
|
138
|
-
|
|
139
|
-
const statementMetavariableNode = statementMetavariableNodeQuery(statementNode);
|
|
140
|
-
|
|
141
|
-
if (statementMetavariableNode !== null) {
|
|
142
|
-
const metavariableNode = statementMetavariableNode; ///
|
|
143
|
-
|
|
144
|
-
substitutions.someSubstitution((substitution) => {
|
|
145
|
-
const substitutionMatchesVariableNode = substitution.matchMetavariableNode(metavariableNode);
|
|
146
|
-
|
|
147
|
-
if (substitutionMatchesVariableNode) {
|
|
148
|
-
const statementNode = substitution.getStatementNode();
|
|
149
|
-
|
|
150
|
-
transformedStatementNode = statementNode; ////
|
|
151
|
-
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return transformedStatementNode;
|
|
158
|
-
}
|
|
@@ -5,8 +5,9 @@ import Substitution from "../substitution";
|
|
|
5
5
|
import { nodeQuery } from "../utilities/query";
|
|
6
6
|
import { stripBracketsFromTerm } from "../utilities/brackets";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
9
|
+
substitutionTermmNodeQuery = nodeQuery("/substitution/term!"),
|
|
10
|
+
substitutionsVariableNodeQuery = nodeQuery("/substitution/variable!");
|
|
10
11
|
|
|
11
12
|
export default class TermForVariableSubstitution extends Substitution {
|
|
12
13
|
constructor(termNode, variableNode) {
|
|
@@ -33,11 +34,12 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
33
34
|
transformed(substitutions) {
|
|
34
35
|
let transformedSubstitution = null;
|
|
35
36
|
|
|
36
|
-
const transformedTermNode = transformTermNode(this.termNode, substitutions)
|
|
37
|
+
const transformedTermNode = transformTermNode(this.termNode, substitutions),
|
|
38
|
+
transformedVariableNode = transformVariableNode(this.variableNode, substitutions);
|
|
37
39
|
|
|
38
|
-
if (transformedTermNode !== null) {
|
|
40
|
+
if ((transformedTermNode !== null) && (transformedVariableNode !== null)) {
|
|
39
41
|
const termNode = transformedTermNode, ///
|
|
40
|
-
variableNode =
|
|
42
|
+
variableNode = transformedVariableNode, ///
|
|
41
43
|
termForVariableSubstitution = new TermForVariableSubstitution(termNode, variableNode);
|
|
42
44
|
|
|
43
45
|
transformedSubstitution = termForVariableSubstitution; ///
|
|
@@ -46,14 +48,14 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
46
48
|
return transformedSubstitution;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
isEqualTo(substitution) {
|
|
50
52
|
const termNode = substitution.getTermNode(),
|
|
51
53
|
variableNode = substitution.getVariableNode(),
|
|
52
54
|
termNodeMatches = this.matchTermNode(termNode),
|
|
53
55
|
variableNodeMatches = this.matchVariableNode(variableNode),
|
|
54
|
-
|
|
56
|
+
equalTo = (termNodeMatches && variableNodeMatches);
|
|
55
57
|
|
|
56
|
-
return
|
|
58
|
+
return equalTo;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
matchTermNode(termNode) {
|
|
@@ -65,9 +67,9 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
matchVariableNode(variableNode) {
|
|
68
|
-
const
|
|
70
|
+
const variableNodeMatches = this.variableNode.match(variableNode);
|
|
69
71
|
|
|
70
|
-
return
|
|
72
|
+
return variableNodeMatches;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB) {
|
|
@@ -99,12 +101,16 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
99
101
|
static fromSubstitutionNode(substitutionNode) {
|
|
100
102
|
let termForVariableSubstitution = null;
|
|
101
103
|
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
+
let substitutionTermNode = substitutionTermmNodeQuery(substitutionNode);
|
|
105
|
+
|
|
106
|
+
if (substitutionTermNode !== null) {
|
|
107
|
+
let termNode = substitutionTermNode; ///
|
|
104
108
|
|
|
105
|
-
if (termNode !== null) {
|
|
106
109
|
termNode = stripBracketsFromTerm(termNode); ///
|
|
107
110
|
|
|
111
|
+
const substitutionVariableNode = substitutionsVariableNodeQuery(substitutionNode),
|
|
112
|
+
variableNode = substitutionVariableNode; ///
|
|
113
|
+
|
|
108
114
|
termForVariableSubstitution = new TermForVariableSubstitution(termNode, variableNode);
|
|
109
115
|
}
|
|
110
116
|
|
|
@@ -123,9 +129,11 @@ export default class TermForVariableSubstitution extends Substitution {
|
|
|
123
129
|
function transformTermNode(termNode, substitutions) {
|
|
124
130
|
let transformedTermNode = null;
|
|
125
131
|
|
|
126
|
-
const
|
|
132
|
+
const termVariableNode = termVariableNodeQuery(termNode);
|
|
133
|
+
|
|
134
|
+
if (termVariableNode !== null) {
|
|
135
|
+
const variableNode = termVariableNode; ///
|
|
127
136
|
|
|
128
|
-
if (variableNode !== null) {
|
|
129
137
|
substitutions.someSubstitution((substitution) => {
|
|
130
138
|
const substitutionMatchesVariableNode = substitution.matchVariableNode(variableNode);
|
|
131
139
|
|
|
@@ -141,3 +149,24 @@ function transformTermNode(termNode, substitutions) {
|
|
|
141
149
|
|
|
142
150
|
return transformedTermNode;
|
|
143
151
|
}
|
|
152
|
+
|
|
153
|
+
function transformVariableNode(variableNode, substitutions) {
|
|
154
|
+
let transformedVariableNode = null;
|
|
155
|
+
|
|
156
|
+
substitutions.someSubstitution((substitution) => {
|
|
157
|
+
const variableNodeMatches = substitution.matchVariableNode(variableNode);
|
|
158
|
+
|
|
159
|
+
if (variableNodeMatches) {
|
|
160
|
+
const termNode = substitution.getTermNode(),
|
|
161
|
+
termVariableNode = termVariableNodeQuery(termNode);
|
|
162
|
+
|
|
163
|
+
if (termVariableNode !== null) {
|
|
164
|
+
transformedVariableNode = termVariableNode; ///
|
|
165
|
+
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return transformedVariableNode;
|
|
172
|
+
}
|
package/src/substitution.js
CHANGED
package/src/substitutions.js
CHANGED
|
@@ -17,10 +17,12 @@ export default class Substitutions {
|
|
|
17
17
|
return this.savedArray;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getLength() { return this.array.length; }
|
|
21
|
+
|
|
20
22
|
getFirstSubstitution() {
|
|
21
23
|
let firstSubstitution = null;
|
|
22
24
|
|
|
23
|
-
const length = this.
|
|
25
|
+
const length = this.getLength();
|
|
24
26
|
|
|
25
27
|
if (length > 0) {
|
|
26
28
|
firstSubstitution = first(this.array);
|
package/src/unifier/metaLevel.js
CHANGED
|
@@ -37,32 +37,30 @@ class MetaLevelUnifier extends Unifier {
|
|
|
37
37
|
unify: (statementNodeA, statementNodeB, substitutions, localContextA, localContextB) => {
|
|
38
38
|
let statementUnifiedWithStatement;
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const matches = statementNodeA.match(statementNodeB);
|
|
41
41
|
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (matches) {
|
|
43
|
+
statementUnifiedWithStatement = true;
|
|
44
|
+
} else {
|
|
45
|
+
const statementMetavariableNodeA = statementMetavariableNodeQuery(statementNodeA);
|
|
45
46
|
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
47
|
+
if (statementMetavariableNodeA !== null) {
|
|
48
|
+
const metavariableNodeA = statementMetavariableNodeA, ///
|
|
49
|
+
statementSubstitutionNodeA = statementSubstitutionNodeQuery(statementNodeA);
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const substitutionNodeA = statementSubstitutionNodeA, ///
|
|
52
|
-
metavariableUnifiedWithStatementGivenSubstitution = unifyMetavariableWithStatementGivenSubstitution(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB);
|
|
51
|
+
if (statementSubstitutionNodeA === null) {
|
|
52
|
+
const metavariableUnifiedWithStatement = unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutions, localContextA, localContextB);
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
statementUnifiedWithStatement = metavariableUnifiedWithStatement; ///
|
|
55
|
+
} else {
|
|
56
|
+
const substitutionNodeA = statementSubstitutionNodeA, ///
|
|
57
|
+
metavariableUnifiedWithStatementGivenSubstitution = unifyMetavariableWithStatementGivenSubstitution(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB);
|
|
58
|
+
|
|
59
|
+
statementUnifiedWithStatement = metavariableUnifiedWithStatementGivenSubstitution; ///
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, substitutions, localContextA, localContextB);
|
|
55
63
|
}
|
|
56
|
-
} else {
|
|
57
|
-
const nonTerminalNodeA = statementNodeA, ///
|
|
58
|
-
nonTerminalNodeB = statementNodeB, ///
|
|
59
|
-
nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
|
|
60
|
-
nonTerminalNodeBChildNodes = nonTerminalNodeB.getChildNodes(),
|
|
61
|
-
childNodesA = nonTerminalNodeAChildNodes, ///
|
|
62
|
-
childNodesB = nonTerminalNodeBChildNodes, ///
|
|
63
|
-
childNodesVerified = metaLevelUnifier.unifyChildNodes(childNodesA, childNodesB, substitutions, localContextA, localContextB);
|
|
64
|
-
|
|
65
|
-
statementUnifiedWithStatement = childNodesVerified; ///
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
return statementUnifiedWithStatement;
|
|
@@ -98,3 +96,16 @@ Object.assign(shim, {
|
|
|
98
96
|
});
|
|
99
97
|
|
|
100
98
|
export default metaLevelUnifier;
|
|
99
|
+
|
|
100
|
+
function unifyStatementWithStatement(statementNodeA, statementNodeB, substitutions, localContextA, localContextB) {
|
|
101
|
+
const nonTerminalNodeA = statementNodeA, ///
|
|
102
|
+
nonTerminalNodeB = statementNodeB, ///
|
|
103
|
+
nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
|
|
104
|
+
nonTerminalNodeBChildNodes = nonTerminalNodeB.getChildNodes(),
|
|
105
|
+
childNodesA = nonTerminalNodeAChildNodes, ///
|
|
106
|
+
childNodesB = nonTerminalNodeBChildNodes, ///
|
|
107
|
+
childNodesVerified = metaLevelUnifier.unifyChildNodes(childNodesA, childNodesB, substitutions, localContextA, localContextB),
|
|
108
|
+
statementUnifiedWithStatement = childNodesVerified; ///
|
|
109
|
+
|
|
110
|
+
return statementUnifiedWithStatement;
|
|
111
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import FrameForMetavariableSubstitution from "../substitution/frameForMetavariable";
|
|
4
4
|
|
|
5
5
|
import { metavariableFromFrameNode } from "../utilities/unify";
|
|
6
|
+
import {metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
6
7
|
|
|
7
8
|
export default function unifyMetavariableWithFrame(metavariableNodeA, frameNodeB, substitutions, localContextA, localContextB) {
|
|
8
9
|
let metavariableUnifiedWithFrame = false;
|
|
@@ -17,7 +18,8 @@ export default function unifyMetavariableWithFrame(metavariableNodeA, frameNodeB
|
|
|
17
18
|
metavariableUnifiedWithFrame = true;
|
|
18
19
|
}
|
|
19
20
|
} else {
|
|
20
|
-
const
|
|
21
|
+
const metavariableNameA = metavariableNameFromMetavariableNode(metavariableNodeA),
|
|
22
|
+
metavariableA = localContextA.findMetavariableByMetavariableName(metavariableNameA),
|
|
21
23
|
metavariableB = metavariableFromFrameNode(frameNodeB, localContextB);
|
|
22
24
|
|
|
23
25
|
if (metavariableA === metavariableB) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
|
|
4
4
|
|
|
5
5
|
import { metavariableFromStatementNode } from "../utilities/unify";
|
|
6
|
+
import {metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
6
7
|
|
|
7
8
|
export default function unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutions, localContextA, localContextB) {
|
|
8
9
|
let metavariableUnifiedWithStatement = false;
|
|
@@ -17,7 +18,8 @@ export default function unifyMetavariableWithStatement(metavariableNodeA, statem
|
|
|
17
18
|
metavariableUnifiedWithStatement = true;
|
|
18
19
|
}
|
|
19
20
|
} else {
|
|
20
|
-
const
|
|
21
|
+
const metavariableNameA = metavariableNameFromMetavariableNode(metavariableNodeA),
|
|
22
|
+
metavariableA = localContextA.findMetavariableByMetavariableName(metavariableNameA),
|
|
21
23
|
metavariableB = metavariableFromStatementNode(statementNodeB, localContextB);
|
|
22
24
|
|
|
23
25
|
if (metavariableA === metavariableB) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
|
|
4
4
|
|
|
5
5
|
import { metavariableFromStatementNode } from "../utilities/unify";
|
|
6
|
+
import {metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
6
7
|
|
|
7
8
|
export default function unifyMetavariableWithStatementGivenSubstitution(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB) {
|
|
8
9
|
let metavariableUnifiedWithStatementGivenSubstitution = false;
|
|
@@ -17,7 +18,8 @@ export default function unifyMetavariableWithStatementGivenSubstitution(metavari
|
|
|
17
18
|
metavariableUnifiedWithStatementGivenSubstitution = true;
|
|
18
19
|
}
|
|
19
20
|
} else {
|
|
20
|
-
const
|
|
21
|
+
const metavariableNameA = metavariableNameFromMetavariableNode(metavariableNodeA),
|
|
22
|
+
metavariableA = localContextA.findMetavariableByMetavariableName(metavariableNameA),
|
|
21
23
|
metavariableB = metavariableFromStatementNode(statementNodeB, localContextB);
|
|
22
24
|
|
|
23
25
|
if (metavariableA === metavariableB) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import metaLevelUnifier from "../unifier/metaLevel";
|
|
4
|
+
|
|
5
|
+
export default function unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement(simpleSubstitutionStatementNode, complexSubstitutionStatementNode, substitutions, localContextA, localContextB) {
|
|
6
|
+
let simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement;
|
|
7
|
+
|
|
8
|
+
const simpleSubstitutionStatementString = localContextB.nodeAsString(simpleSubstitutionStatementNode),
|
|
9
|
+
complexSubstitutionStatementString = localContextB.nodeAsString(complexSubstitutionStatementNode);
|
|
10
|
+
|
|
11
|
+
localContextB.trace(`Unifying the simple substitution's '${simpleSubstitutionStatementString}' statement with the complex substitution's '${complexSubstitutionStatementString}' statement...`, simpleSubstitutionStatementNode);
|
|
12
|
+
|
|
13
|
+
const nodeA = complexSubstitutionStatementNode, ///
|
|
14
|
+
nodeB = simpleSubstitutionStatementNode; ///
|
|
15
|
+
|
|
16
|
+
localContextA = localContextB; ///
|
|
17
|
+
|
|
18
|
+
const unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
19
|
+
|
|
20
|
+
simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement = unified; ///
|
|
21
|
+
|
|
22
|
+
if (simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement) {
|
|
23
|
+
localContextB.trace(`...unified the simple substitution's '${simpleSubstitutionStatementString}' statement with the complex substitution's '${complexSubstitutionStatementString}' statement.`, simpleSubstitutionStatementNode);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement;
|
|
27
|
+
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _metaLevel = /*#__PURE__*/ _interop_require_default(require("../unifier/metaLevel"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement(complexSubstitutionStatementNode, simpleSubstitutionStatementNode, substitutions, localContextA, localContextB) {
|
|
18
|
-
var complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
19
|
-
var complexSubstitutionStatementString = localContextB.nodeAsString(complexSubstitutionStatementNode), simpleSubstitutionStatementString = localContextB.nodeAsString(simpleSubstitutionStatementNode);
|
|
20
|
-
localContextB.trace("Unifying the complex substitution's '".concat(complexSubstitutionStatementString, "' statement with the simple substitution's '").concat(simpleSubstitutionStatementString, "' statement..."), simpleSubstitutionStatementNode);
|
|
21
|
-
var nodeA = complexSubstitutionStatementNode, nodeB = simpleSubstitutionStatementNode; ///
|
|
22
|
-
localContextA = localContextB; ///
|
|
23
|
-
var unified = _metaLevel.default.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
24
|
-
complexSubstitutionStatementWithSimpleSubstitutionStatement = unified; ///
|
|
25
|
-
if (complexSubstitutionStatementWithSimpleSubstitutionStatement) {
|
|
26
|
-
localContextB.trace("...unified the complex substitution's '".concat(complexSubstitutionStatementString, "' statement with the simple substitution's '").concat(simpleSubstitutionStatementString, "' statement."), simpleSubstitutionStatementNode);
|
|
27
|
-
}
|
|
28
|
-
return complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91bmlmeS9jb21wbGV4U3Vic3RpdHV0aW9uU3RhdGVtZW50V2l0aFNpbXBsZVN1YnN0aXR1dGlvblN0YXRlbWVudC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IG1ldGFMZXZlbFVuaWZpZXIgZnJvbSBcIi4uL3VuaWZpZXIvbWV0YUxldmVsXCI7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHVuaWZ5Q29tcGxleFN1YnN0aXR1dGlvblN0YXRlbWVudFdpdGhTaW1wbGVTdWJzdGl0dXRpb25TdGF0ZW1lbnQoY29tcGxleFN1YnN0aXR1dGlvblN0YXRlbWVudE5vZGUsIHNpbXBsZVN1YnN0aXR1dGlvblN0YXRlbWVudE5vZGUsIHN1YnN0aXR1dGlvbnMsIGxvY2FsQ29udGV4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0cmFjZSIsIm5vZGVBIiwibm9kZUIiLCJ1bmlmaWVkIiwibWV0YUxldmVsVW5pZmllciIsInVuaWZ5Il0sIm1hcHBpbmdzIjoiQUFBQTs7OzsrQkFJQTs7O2VBQXdCQTs7O2dFQUZLOzs7Ozs7QUFFZCxTQUFTQSxpRUFBaUVDLGdDQUFnQyxFQUFFQywrQkFBK0IsRUFBRUMsYUFBYSxFQUFFQyxhQUFhLEVBQUVDLGFBQWE7SUFDck0sSUFBSUM7SUFFSixJQUFNQyxxQ0FBcUNGLGNBQWNHLFlBQVksQ0FBQ1AsbUNBQ2hFUSxvQ0FBb0NKLGNBQWNHLFlBQVksQ0FBQ047SUFFckVHLGNBQWNLLEtBQUssQ0FBQyxBQUFDLHdDQUF3SEQsT0FBakZGLG9DQUFtQyxnREFBZ0YsT0FBbENFLG1DQUFrQyxtQkFBaUJQO0lBRWhNLElBQU1TLFFBQVFWLGtDQUNSVyxRQUFRVixpQ0FBa0MsR0FBRztJQUVuREUsZ0JBQWdCQyxlQUFnQixHQUFHO0lBRW5DLElBQU1RLFVBQVVDLGtCQUFnQixDQUFDQyxLQUFLLENBQUNKLE9BQU9DLE9BQU9ULGVBQWVDLGVBQWVDO0lBRW5GQyw4REFBOERPLFNBQVUsR0FBRztJQUUzRSxJQUFJUCw2REFBNkQ7UUFDL0RELGNBQWNLLEtBQUssQ0FBQyxBQUFDLDBDQUEwSEQsT0FBakZGLG9DQUFtQyxnREFBZ0YsT0FBbENFLG1DQUFrQyxpQkFBZVA7SUFDbE07SUFFQSxPQUFPSTtBQUNUIn0=
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import metaLevelUnifier from "../unifier/metaLevel";
|
|
4
|
-
|
|
5
|
-
export default function unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement(complexSubstitutionStatementNode, simpleSubstitutionStatementNode, substitutions, localContextA, localContextB) {
|
|
6
|
-
let complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
7
|
-
|
|
8
|
-
const complexSubstitutionStatementString = localContextB.nodeAsString(complexSubstitutionStatementNode),
|
|
9
|
-
simpleSubstitutionStatementString = localContextB.nodeAsString(simpleSubstitutionStatementNode);
|
|
10
|
-
|
|
11
|
-
localContextB.trace(`Unifying the complex substitution's '${complexSubstitutionStatementString}' statement with the simple substitution's '${simpleSubstitutionStatementString}' statement...`, simpleSubstitutionStatementNode);
|
|
12
|
-
|
|
13
|
-
const nodeA = complexSubstitutionStatementNode, ///
|
|
14
|
-
nodeB = simpleSubstitutionStatementNode; ///
|
|
15
|
-
|
|
16
|
-
localContextA = localContextB; ///
|
|
17
|
-
|
|
18
|
-
const unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
19
|
-
|
|
20
|
-
complexSubstitutionStatementWithSimpleSubstitutionStatement = unified; ///
|
|
21
|
-
|
|
22
|
-
if (complexSubstitutionStatementWithSimpleSubstitutionStatement) {
|
|
23
|
-
localContextB.trace(`...unified the complex substitution's '${complexSubstitutionStatementString}' statement with the simple substitution's '${simpleSubstitutionStatementString}' statement.`, simpleSubstitutionStatementNode);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return complexSubstitutionStatementWithSimpleSubstitutionStatement;
|
|
27
|
-
}
|