occam-verify-cli 0.0.1066 → 0.0.1068
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/assertion/contained.js +3 -2
- package/lib/assertion/defined.js +3 -2
- package/lib/assignment/judgement.js +3 -3
- package/lib/conclusion.js +8 -4
- package/lib/consequent.js +8 -4
- package/lib/context/file.js +7 -7
- package/lib/context/local.js +12 -25
- package/lib/declaration.js +90 -3
- package/lib/frame.js +109 -48
- package/lib/judgement.js +84 -5
- package/lib/metaType.js +24 -3
- package/lib/metavariable.js +94 -65
- package/lib/mixins/statement/unify.js +1 -1
- package/lib/mixins/statement/verify.js +14 -23
- package/lib/premise.js +14 -6
- package/lib/proofStep.js +22 -13
- package/lib/reference.js +11 -9
- package/lib/rule.js +9 -2
- package/lib/ruleNames.js +5 -1
- package/lib/statement/qualified.js +30 -17
- package/lib/statement/unqualified.js +30 -6
- package/lib/statement.js +20 -9
- package/lib/subproof.js +1 -1
- package/lib/substitution/frameForMetavariable.js +80 -71
- package/lib/substitution/statementForMetavariable.js +118 -56
- package/lib/substitution/termForVariable.js +75 -75
- package/lib/substitution.js +68 -33
- package/lib/substitutions.js +58 -49
- package/lib/supposition.js +8 -4
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +23 -16
- package/lib/unifier/statementWithCombinator.js +2 -2
- package/lib/utilities/node.js +24 -10
- package/lib/utilities/tokens.js +8 -1
- package/lib/variable.js +17 -13
- package/package.json +2 -2
- package/src/assertion/contained.js +3 -1
- package/src/assertion/defined.js +3 -1
- package/src/assignment/judgement.js +3 -4
- package/src/conclusion.js +10 -3
- package/src/consequent.js +10 -3
- package/src/context/file.js +6 -8
- package/src/context/local.js +12 -33
- package/src/declaration.js +57 -4
- package/src/frame.js +149 -90
- package/src/judgement.js +109 -3
- package/src/metaType.js +29 -3
- package/src/metavariable.js +140 -87
- package/src/mixins/statement/unify.js +1 -0
- package/src/mixins/statement/verify.js +16 -28
- package/src/premise.js +19 -5
- package/src/proofStep.js +28 -12
- package/src/reference.js +11 -7
- package/src/rule.js +13 -1
- package/src/ruleNames.js +1 -0
- package/src/statement/qualified.js +38 -21
- package/src/statement/unqualified.js +35 -5
- package/src/statement.js +20 -12
- package/src/subproof.js +0 -1
- package/src/substitution/frameForMetavariable.js +90 -104
- package/src/substitution/statementForMetavariable.js +133 -61
- package/src/substitution/termForVariable.js +83 -113
- package/src/substitution.js +55 -26
- package/src/substitutions.js +59 -47
- package/src/supposition.js +10 -3
- package/src/unifier/intrinsicLevel.js +4 -3
- package/src/unifier/metaLevel.js +42 -24
- package/src/unifier/statementWithCombinator.js +1 -1
- package/src/utilities/node.js +26 -10
- package/src/utilities/tokens.js +7 -0
- package/src/variable.js +20 -11
- package/lib/resolve/complexSubstitutionAgainstSimpleSubstitution.js +0 -62
- package/lib/resolve/substitution.js +0 -27
- package/lib/resolve/substitutions.js +0 -37
- package/lib/unify/metavariableWithFrame.js +0 -40
- package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -31
- package/lib/verify/declaration.js +0 -83
- package/lib/verify/frame.js +0 -120
- package/lib/verify/judgement.js +0 -88
- package/lib/verify/metavariableGivenMetaType.js +0 -44
- package/src/resolve/complexSubstitutionAgainstSimpleSubstitution.js +0 -79
- package/src/resolve/substitution.js +0 -19
- package/src/resolve/substitutions.js +0 -31
- package/src/unify/metavariableWithFrame.js +0 -40
- package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -27
- package/src/verify/declaration.js +0 -113
- package/src/verify/frame.js +0 -157
- package/src/verify/judgement.js +0 -127
- package/src/verify/metavariableGivenMetaType.js +0 -45
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import shim from "../shim";
|
|
4
6
|
import LocalContext from "../context/local";
|
|
5
7
|
|
|
6
8
|
import { trim } from "../utilities/string";
|
|
7
9
|
import { nodeQuery } from "../utilities/query";
|
|
8
10
|
|
|
11
|
+
const { reverse } = arrayUtilities;
|
|
12
|
+
|
|
9
13
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement");
|
|
10
14
|
|
|
11
15
|
export default class UnqualifiedStatement {
|
|
@@ -32,7 +36,15 @@ export default class UnqualifiedStatement {
|
|
|
32
36
|
|
|
33
37
|
const statementVerified = this.statement.verify(assignments, stated, localContext);
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
if (statementVerified) {
|
|
40
|
+
verified = true;
|
|
41
|
+
} else {
|
|
42
|
+
const statementUnifiedWithProofSteps = this.unifyStatementWithProofSteps(this.statement, assignments, stated, localContext);
|
|
43
|
+
|
|
44
|
+
if (statementUnifiedWithProofSteps) {
|
|
45
|
+
verified = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
36
48
|
|
|
37
49
|
if (verified) {
|
|
38
50
|
localContext.debug(`...verified the '${unqualifiedStatementString}' unqualified statement.`);
|
|
@@ -45,23 +57,41 @@ export default class UnqualifiedStatement {
|
|
|
45
57
|
return verified;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
unifyStatement(statement, substitutions,
|
|
60
|
+
unifyStatement(statement, substitutions, localContextA, localContextB) {
|
|
49
61
|
let statementUnified;
|
|
50
62
|
|
|
51
63
|
const statementString = statement.getString(),
|
|
52
64
|
unqualifiedStatementString = this.getString(); ///
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
localContextB.trace(`Unifying the '${statementString}' statement with the '${unqualifiedStatementString}' unqualified statement...`);
|
|
55
67
|
|
|
56
|
-
statementUnified = this.statement.unifyStatement(statement, substitutions,
|
|
68
|
+
statementUnified = this.statement.unifyStatement(statement, substitutions, localContextA, localContextB);
|
|
57
69
|
|
|
58
70
|
if (statementUnified) {
|
|
59
|
-
|
|
71
|
+
localContextB.debug(`...unified the '${statementString}' statement with the '${unqualifiedStatementString}' unqualified statement.`);
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
return statementUnified;
|
|
63
75
|
}
|
|
64
76
|
|
|
77
|
+
unifyStatementWithProofSteps(statement, assignments, stated, localContext) {
|
|
78
|
+
let statementUnifiedWithProofSteps;
|
|
79
|
+
|
|
80
|
+
let proofSteps = localContext.getProofSteps();
|
|
81
|
+
|
|
82
|
+
proofSteps = reverse(proofSteps); ///
|
|
83
|
+
|
|
84
|
+
statementUnifiedWithProofSteps = proofSteps.some((proofStep) => {
|
|
85
|
+
const statementUnified = proofStep.unifyStatement(statement, localContext);
|
|
86
|
+
|
|
87
|
+
if (statementUnified) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return statementUnifiedWithProofSteps;
|
|
93
|
+
}
|
|
94
|
+
|
|
65
95
|
toJSON() {
|
|
66
96
|
const statementJSON = this.statement.toJSON(),
|
|
67
97
|
statement = statementJSON, ///
|
package/src/statement.js
CHANGED
|
@@ -51,7 +51,7 @@ class Statement {
|
|
|
51
51
|
const variableString = variable.getString(),
|
|
52
52
|
statementString = this.string; ///
|
|
53
53
|
|
|
54
|
-
localContext.trace(`
|
|
54
|
+
localContext.trace(`Is the '${variableString}' variable contained in the '${statementString}' statement...`);
|
|
55
55
|
|
|
56
56
|
const variableNode = variable.getNode(),
|
|
57
57
|
statementNode = this.node,
|
|
@@ -66,7 +66,7 @@ class Statement {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
if (variableContained) {
|
|
69
|
-
localContext.debug(`...the '${variableString}' variable is contained in
|
|
69
|
+
localContext.debug(`...the '${variableString}' variable is contained in the '${statementString}' statement.`);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return variableContained;
|
|
@@ -78,7 +78,7 @@ class Statement {
|
|
|
78
78
|
const metavariableString = metavariable.getString(),
|
|
79
79
|
statementString = this.string; ///
|
|
80
80
|
|
|
81
|
-
localContext.trace(`
|
|
81
|
+
localContext.trace(`Is the '${metavariableString}' metavariable contained in the '${statementString}' statement...`);
|
|
82
82
|
|
|
83
83
|
const metavariableNode = metavariable.getNode(),
|
|
84
84
|
statementNode = this.node,
|
|
@@ -93,13 +93,19 @@ class Statement {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
if (metavariableContained) {
|
|
96
|
-
localContext.debug(`...the '${metavariableString}' metavariable is contained in
|
|
96
|
+
localContext.debug(`...the '${metavariableString}' metavariable is contained in the '${statementString}' statement.`);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return metavariableContained;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
matchStatementNode(statementNode) {
|
|
103
|
+
const statementNodeMatches = this.node.match(statementNode);
|
|
104
|
+
|
|
105
|
+
return statementNodeMatches;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
unifyStatement(statement, substitutions, localContextA, localContextB) {
|
|
103
109
|
let statementUnified;
|
|
104
110
|
|
|
105
111
|
const statementA = this, ///
|
|
@@ -107,20 +113,22 @@ class Statement {
|
|
|
107
113
|
statementAString = statementA.getString(),
|
|
108
114
|
statementBString = statementB.getString();
|
|
109
115
|
|
|
110
|
-
|
|
116
|
+
localContextB.trace(`Unifying the '${statementBString}' statement with the '${statementAString}' statement...`);
|
|
111
117
|
|
|
112
118
|
const statementANode = statementA.getNode(),
|
|
113
119
|
statementBNode = statementB.getNode(),
|
|
114
120
|
nodeA = statementANode, ///
|
|
115
|
-
nodeB = statementBNode
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
nodeB = statementBNode; ///
|
|
122
|
+
|
|
123
|
+
localContextA = LocalContext.fromLocalContextAndTokens(localContextA, this.tokens);
|
|
124
|
+
|
|
125
|
+
const unifiedAtMetaLevel = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
120
126
|
|
|
121
127
|
statementUnified = unifiedAtMetaLevel; ///
|
|
122
128
|
|
|
123
|
-
|
|
129
|
+
if (statementUnified) {
|
|
130
|
+
localContextB.debug(`...unified the '${statementBString}' statement with the '${statementAString}' statement.`);
|
|
131
|
+
}
|
|
124
132
|
|
|
125
133
|
return statementUnified;
|
|
126
134
|
}
|
package/src/subproof.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import shim from "../shim";
|
|
3
4
|
import Substitution from "../substitution";
|
|
4
5
|
|
|
5
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
8
|
+
import { substitutionNodeFromSubstitutionTokens } from "../utilities/node";
|
|
9
|
+
import { substitutionTokensFromSubstitutionString } from "../utilities/tokens";
|
|
6
10
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const frameNodeQuery = nodeQuery("/substitution/frame[0]"),
|
|
12
|
+
metavariableNodeQuery = nodeQuery("/substitution/frame[1]/metavariable!"),
|
|
13
|
+
substitutionNodeQuery = nodeQuery("/statement/substitution"),
|
|
14
|
+
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable");
|
|
11
15
|
|
|
12
16
|
export default class FrameForMetavariableSubstitution extends Substitution {
|
|
13
|
-
constructor(string, frameNode, metavariableNode) {
|
|
17
|
+
constructor(string, frameNode, metavariableNode, substitutionNode, substitutionTokens) {
|
|
14
18
|
super(string);
|
|
15
19
|
|
|
16
20
|
this.frameNode = frameNode;
|
|
17
21
|
this.metavariableNode = metavariableNode;
|
|
22
|
+
this.substitutionNode = substitutionNode;
|
|
23
|
+
this.substitutionTokens = substitutionTokens;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
getFrameNode() {
|
|
@@ -25,35 +31,45 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
25
31
|
return this.metavariableNode;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
getSubstitutionNode() {
|
|
35
|
+
return this.substitutionNode;
|
|
36
|
+
}
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
getSubstitutionTokens() {
|
|
39
|
+
return this.substitutionTokens;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
getMetavariableName() {
|
|
43
|
+
const metavariableName = metavariableNameFromMetavariableNode(this.metavariableNode);
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
return metavariableName;
|
|
46
|
+
}
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
frameForMetavariableSubstitution = new FrameForMetavariableSubstitution(frameNode, metavariableNode);
|
|
48
|
+
setSubstitutionNode() {
|
|
49
|
+
this.substitutionNode = substitutionNodeFromSubstitutionTokens(this.substitutionTokens);
|
|
50
|
+
}
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
setSubstitutionTokens() {
|
|
53
|
+
const frameMetavariableNode = frameMetavariableNodeQuery(this.frameNode),
|
|
54
|
+
frameMetavariableName = metavariableNameFromMetavariableNode(frameMetavariableNode),
|
|
55
|
+
metavariableName = metavariableNameFromMetavariableNode(this.metavariableNode),
|
|
56
|
+
substitutionString = `[[${frameMetavariableName}] for [${metavariableName}]]`;
|
|
47
57
|
|
|
48
|
-
|
|
58
|
+
this.substitutionTokens = substitutionTokensFromSubstitutionString(substitutionString);
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
isEqualTo(substitution) {
|
|
62
|
+
let equalTo = false;
|
|
63
|
+
|
|
52
64
|
const frameNode = substitution.getFrameNode(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
metavariableName = substitution.getMetavariableName();
|
|
66
|
+
|
|
67
|
+
if ((frameNode !== null) && (metavariableName !== null)) {
|
|
68
|
+
const frameNodeMatches = this.matchFrameNode(frameNode),
|
|
69
|
+
metavariableNameMatches = this.matchMetavariableName(metavariableName);
|
|
70
|
+
|
|
71
|
+
equalTo = (frameNodeMatches && metavariableNameMatches);
|
|
72
|
+
}
|
|
57
73
|
|
|
58
74
|
return equalTo;
|
|
59
75
|
}
|
|
@@ -64,28 +80,42 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
64
80
|
return frameNodeMatches;
|
|
65
81
|
}
|
|
66
82
|
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
matchMetavariableName(metavariableName) {
|
|
84
|
+
let metavariableNameMatches;
|
|
69
85
|
|
|
70
|
-
|
|
71
|
-
}
|
|
86
|
+
const metavariableNameA = metavariableName; ///
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
let frameForMetavariableSubstitution = null;
|
|
88
|
+
metavariableName = metavariableNameFromMetavariableNode(this.metavariableNode);
|
|
75
89
|
|
|
76
|
-
const
|
|
77
|
-
substitutionFrameNode = substitutionFrameNodeQuery(substitutionNode);
|
|
90
|
+
const metavariableNameB = metavariableName; ///
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
const substitutionMetavariableNode = substitutionMetavariableNodeQuery(substitutionNode),
|
|
81
|
-
metavariableNode = substitutionMetavariableNode, ///
|
|
82
|
-
frameNode = substitutionFrameNode, ///
|
|
83
|
-
string = stringFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, localContextA, localContextB);
|
|
92
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
84
93
|
|
|
85
|
-
|
|
94
|
+
return metavariableNameMatches;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
matchSubstitutionNode(substitutionNode) {
|
|
98
|
+
let substitutionNodeMatches;
|
|
99
|
+
|
|
100
|
+
if ((substitutionNode === null) && (this.substitutionNode === null)) {
|
|
101
|
+
substitutionNodeMatches = true;
|
|
102
|
+
} else if ((substitutionNode === null) && (this.substitutionNode !== null)) {
|
|
103
|
+
substitutionNodeMatches = false;
|
|
104
|
+
} else if ((substitutionNode !== null) && (this.substitutionNode === null)) {
|
|
105
|
+
substitutionNodeMatches = false;
|
|
106
|
+
} else {
|
|
107
|
+
substitutionNodeMatches = this.substitutionNode.match(substitutionNode);
|
|
86
108
|
}
|
|
87
109
|
|
|
88
|
-
return
|
|
110
|
+
return substitutionNodeMatches;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
matchMetavariableNameAndSubstitutionNode(metavariableName, substitutionNode) {
|
|
114
|
+
const metavariableNameMatches = this.matchMetavariableName(metavariableName),
|
|
115
|
+
substitutionNodeMatches = this.matchSubstitutionNode(substitutionNode),
|
|
116
|
+
metavariableNameAndSubstitutionNodeMatches = (metavariableNameMatches && substitutionNodeMatches);
|
|
117
|
+
|
|
118
|
+
return metavariableNameAndSubstitutionNodeMatches;
|
|
89
119
|
}
|
|
90
120
|
|
|
91
121
|
static fromStatementNode(statementNode, localContext) {
|
|
@@ -94,84 +124,40 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
94
124
|
const substitutionNode = substitutionNodeQuery(statementNode);
|
|
95
125
|
|
|
96
126
|
if (substitutionNode !== null) {
|
|
97
|
-
const
|
|
127
|
+
const frameNode = frameNodeQuery(substitutionNode),
|
|
128
|
+
metavariableNode = metavariableNodeQuery(substitutionNode);
|
|
98
129
|
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
string = stringFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, localContextA, localContextB);
|
|
130
|
+
if ((frameNode !== null) && (metavariableNode !== null)) {
|
|
131
|
+
const { Frame, Metavariable } = shim,
|
|
132
|
+
frame = Frame.fromFrameNode(frameNode, localContext),
|
|
133
|
+
variable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
|
|
134
|
+
string = stringFromFrameAndMetavariable(frame, variable, localContext),
|
|
135
|
+
substitutionTokens = localContext.nodeAsTokens(substitutionNode);
|
|
106
136
|
|
|
107
|
-
frameForMetavariableSubstitution = new FrameForMetavariableSubstitution(string, frameNode, metavariableNode);
|
|
137
|
+
frameForMetavariableSubstitution = new FrameForMetavariableSubstitution(string, frameNode, metavariableNode, substitutionNode, substitutionTokens);
|
|
108
138
|
}
|
|
109
|
-
|
|
110
139
|
}
|
|
111
140
|
|
|
112
141
|
return frameForMetavariableSubstitution;
|
|
113
142
|
}
|
|
114
143
|
|
|
115
|
-
static
|
|
116
|
-
const string =
|
|
117
|
-
|
|
144
|
+
static fromFrameAndMetavariable(frame, metavariable, localContext) {
|
|
145
|
+
const string = stringFromFrameAndMetavariable(frame, metavariable, localContext),
|
|
146
|
+
frameNode = frame.getNode(),
|
|
147
|
+
metavariableNode = metavariable.getNode(),
|
|
148
|
+
substitutionNode = null,
|
|
149
|
+
substitutionTokens = null,
|
|
150
|
+
statementForMetavariableSubstitution = new FrameForMetavariableSubstitution(string, frameNode, metavariableNode, substitutionNode, substitutionTokens);
|
|
118
151
|
|
|
119
|
-
return
|
|
152
|
+
return statementForMetavariableSubstitution;
|
|
120
153
|
}
|
|
121
154
|
}
|
|
122
155
|
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (frameMetavariableNode !== null) {
|
|
129
|
-
const metavariableNode = frameMetavariableNode; ///
|
|
130
|
-
|
|
131
|
-
substitutions.someSubstitution((substitution) => {
|
|
132
|
-
const metavariableNodeMatches = substitution.matchMetavariableNode(metavariableNode);
|
|
133
|
-
|
|
134
|
-
if (metavariableNodeMatches) {
|
|
135
|
-
const frameNode = substitution.getFrameNode();
|
|
136
|
-
|
|
137
|
-
transformedFrameNode = frameNode; ////
|
|
138
|
-
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return transformedFrameNode;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function transformMetavariableNode(metavariableNode, substitutions) {
|
|
148
|
-
let transformedMetavariableNode = null;
|
|
149
|
-
|
|
150
|
-
substitutions.someSubstitution((substitution) => {
|
|
151
|
-
const metavariableNodeMatches = substitution.matchMetavariableNode(metavariableNode);
|
|
152
|
-
|
|
153
|
-
if (metavariableNodeMatches) {
|
|
154
|
-
const frameNode = substitution.getFrameNode(),
|
|
155
|
-
frameMetavariableNode = frameMetavariableNodeQuery(frameNode);
|
|
156
|
-
|
|
157
|
-
if (frameMetavariableNode !== null) {
|
|
158
|
-
transformedMetavariableNode = frameMetavariableNode; ///
|
|
159
|
-
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
return transformedMetavariableNode;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function stringFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, localContextA, localContextB) {
|
|
169
|
-
const frameNodeB = frameNode, ///
|
|
170
|
-
frameStringB = localContextB.nodeAsString(frameNodeB),
|
|
171
|
-
metavariableNodeA = metavariableNode, ///
|
|
172
|
-
metavariableStringA = localContextA.nodeAsString(metavariableNodeA),
|
|
173
|
-
string = `[${frameStringB} for ${metavariableStringA}]`;
|
|
156
|
+
function stringFromFrameAndMetavariable(frame, metavariable, localContext) {
|
|
157
|
+
const frameNode = frame.getNode(),
|
|
158
|
+
frameString = localContext.nodeAsString(frameNode),
|
|
159
|
+
metavariableString = metavariable.getString(),
|
|
160
|
+
string = `[[${frameString}] for [${metavariableString}]]`;
|
|
174
161
|
|
|
175
162
|
return string;
|
|
176
163
|
}
|
|
177
|
-
|