occam-verify-cli 0.0.1089 → 0.0.1091
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/bin/action/verify.js +2 -2
- package/lib/assertion/contained.js +35 -41
- package/lib/assertion/defined.js +24 -24
- package/lib/assertion/subproof.js +24 -24
- package/lib/assertion/type.js +23 -23
- package/lib/assignment/equality.js +4 -10
- package/lib/assignment/judgement.js +4 -4
- package/lib/assignment/variable.js +4 -4
- package/lib/combinator/bracketed.js +3 -3
- package/lib/conclusion.js +11 -13
- package/lib/consequent.js +11 -13
- package/lib/constructor/bracketed.js +3 -3
- package/lib/constructor.js +2 -2
- package/lib/context/file.js +28 -27
- package/lib/context/local.js +31 -32
- package/lib/context/release.js +6 -3
- package/lib/declaration.js +18 -18
- package/lib/derivation.js +3 -3
- package/lib/equality.js +24 -24
- package/lib/equivalence.js +13 -13
- package/lib/frame.js +43 -43
- package/lib/index.js +2 -1
- package/lib/judgement.js +20 -20
- package/lib/label.js +9 -1
- package/lib/metaType.js +2 -2
- package/lib/metavariable.js +40 -39
- package/lib/mixins/statement/qualified/unify.js +19 -19
- package/lib/mixins/statement/resolve.js +11 -11
- package/lib/mixins/statement/unify.js +12 -12
- package/lib/mixins/statement/verify.js +36 -36
- package/lib/mixins/term/verify.js +2 -2
- package/lib/premise.js +31 -40
- package/lib/proof.js +6 -5
- package/lib/proofStep.js +17 -17
- package/lib/reference.js +8 -8
- package/lib/rule.js +21 -21
- package/lib/statement/qualified.js +17 -17
- package/lib/statement/unqualified.js +19 -19
- package/lib/statement.js +52 -54
- package/lib/subDerivation.js +3 -3
- package/lib/subproof.js +6 -5
- package/lib/substitution/frameForMetavariable.js +16 -39
- package/lib/substitution/statementForMetavariable.js +88 -74
- package/lib/substitution/termForVariable.js +15 -41
- package/lib/substitution.js +20 -6
- package/lib/substitutions.js +13 -13
- package/lib/supposition.js +31 -40
- package/lib/term.js +28 -28
- package/lib/topLevelAssertion.js +33 -21
- package/lib/unifier/equality.js +8 -8
- package/lib/unifier/intrinsicLevel.js +149 -0
- package/lib/unifier/metaLevel.js +41 -31
- package/lib/unifier/metavariable.js +14 -8
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +6 -6
- package/lib/unifier.js +47 -47
- package/lib/utilities/assignments.js +3 -3
- package/lib/utilities/equivalences.js +14 -14
- package/lib/utilities/json.js +22 -21
- package/lib/utilities/unifier.js +7 -8
- package/lib/variable.js +33 -33
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verifier/termAsConstructor.js +2 -2
- package/package.json +2 -2
- package/src/assertion/contained.js +37 -45
- package/src/assertion/defined.js +25 -25
- package/src/assertion/subproof.js +25 -28
- package/src/assertion/type.js +23 -23
- package/src/assignment/equality.js +4 -6
- package/src/assignment/judgement.js +4 -4
- package/src/assignment/variable.js +4 -4
- package/src/combinator/bracketed.js +2 -2
- package/src/conclusion.js +14 -15
- package/src/consequent.js +14 -15
- package/src/constructor/bracketed.js +2 -2
- package/src/constructor.js +3 -2
- package/src/context/file.js +26 -25
- package/src/context/local.js +21 -23
- package/src/context/release.js +5 -3
- package/src/declaration.js +20 -20
- package/src/derivation.js +2 -2
- package/src/equality.js +26 -26
- package/src/equivalence.js +12 -12
- package/src/frame.js +42 -42
- package/src/index.js +1 -0
- package/src/judgement.js +25 -25
- package/src/label.js +14 -0
- package/src/metaType.js +1 -1
- package/src/metavariable.js +51 -43
- package/src/mixins/statement/qualified/unify.js +21 -21
- package/src/mixins/statement/resolve.js +12 -12
- package/src/mixins/statement/unify.js +11 -11
- package/src/mixins/statement/verify.js +35 -35
- package/src/mixins/term/verify.js +1 -1
- package/src/premise.js +42 -53
- package/src/proof.js +6 -4
- package/src/proofStep.js +21 -21
- package/src/reference.js +12 -11
- package/src/rule.js +20 -20
- package/src/statement/qualified.js +18 -17
- package/src/statement/unqualified.js +19 -18
- package/src/statement.js +63 -66
- package/src/subDerivation.js +2 -3
- package/src/subproof.js +6 -4
- package/src/substitution/frameForMetavariable.js +29 -45
- package/src/substitution/statementForMetavariable.js +136 -86
- package/src/substitution/termForVariable.js +28 -49
- package/src/substitution.js +15 -5
- package/src/substitutions.js +12 -12
- package/src/supposition.js +41 -53
- package/src/term.js +27 -27
- package/src/topLevelAssertion.js +32 -19
- package/src/unifier/equality.js +7 -7
- package/src/unifier/intrinsicLevel.js +61 -0
- package/src/unifier/metaLevel.js +60 -46
- package/src/unifier/metavariable.js +22 -13
- package/src/unifier/statementWithCombinator.js +28 -28
- package/src/unifier/termWithConstructor.js +8 -8
- package/src/unifier.js +55 -55
- package/src/utilities/assignments.js +2 -2
- package/src/utilities/equivalences.js +13 -13
- package/src/utilities/json.js +76 -66
- package/src/utilities/unifier.js +10 -12
- package/src/variable.js +43 -40
- package/src/verifier/statementAsCombinator.js +2 -1
- package/src/verifier/termAsConstructor.js +2 -1
package/src/statement.js
CHANGED
|
@@ -16,8 +16,8 @@ import { statementNodeFromUnqualifiedStatementNode,
|
|
|
16
16
|
unqualifiedStatementNodeFromUnqualifiedStatementTokens } from "./utilities/node";
|
|
17
17
|
|
|
18
18
|
const statementNodeQuery = nodeQuery("/*//statement"),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
statementTermNodesQuery = nodesQuery("/statement//term"),
|
|
20
|
+
statementFrameNodesQuery = nodesQuery("/statement//frame");
|
|
21
21
|
|
|
22
22
|
class Statement {
|
|
23
23
|
constructor(string, node, tokens) {
|
|
@@ -46,58 +46,58 @@ class Statement {
|
|
|
46
46
|
return equalTo;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
let
|
|
49
|
+
isTermContained(term, context) {
|
|
50
|
+
let termContained;
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const termString = term.getString(),
|
|
53
53
|
statementString = this.string; ///
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`);
|
|
56
56
|
|
|
57
|
-
const
|
|
57
|
+
const termNode = term.getNode(),
|
|
58
58
|
statementNode = this.node,
|
|
59
|
-
|
|
59
|
+
statementTermNodes = statementTermNodesQuery(statementNode);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
const
|
|
61
|
+
termContained = statementTermNodes.some((statementTermNode) => { ///
|
|
62
|
+
const termNodeMatchesStatementVariableNode = termNode.match(statementTermNode);
|
|
63
63
|
|
|
64
|
-
if (
|
|
64
|
+
if (termNodeMatchesStatementVariableNode) {
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
if (
|
|
70
|
-
|
|
69
|
+
if (termContained) {
|
|
70
|
+
context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return
|
|
73
|
+
return termContained;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
let
|
|
76
|
+
isFrameContained(frame, context) {
|
|
77
|
+
let frameContained;
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const frameString = frame.getString(),
|
|
80
80
|
statementString = this.string; ///
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`);
|
|
83
83
|
|
|
84
|
-
const
|
|
84
|
+
const frameNode = frame.getNode(),
|
|
85
85
|
statementNode = this.node,
|
|
86
|
-
|
|
86
|
+
statementFrameNodes = statementFrameNodesQuery(statementNode);
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
const
|
|
88
|
+
frameContained = statementFrameNodes.some((statementFrameNode) => { ///
|
|
89
|
+
const frameNodeMatchesStatementMetavariableNode = frameNode.match(statementFrameNode);
|
|
90
90
|
|
|
91
|
-
if (
|
|
91
|
+
if (frameNodeMatchesStatementMetavariableNode) {
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
if (
|
|
97
|
-
|
|
96
|
+
if (frameContained) {
|
|
97
|
+
context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return
|
|
100
|
+
return frameContained;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
matchStatementNode(statementNode) {
|
|
@@ -106,20 +106,16 @@ class Statement {
|
|
|
106
106
|
return statementNodeMatches;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
resolveIndependently(substitutions,
|
|
109
|
+
resolveIndependently(substitutions, generalContext, specificContext) {
|
|
110
110
|
let resolvedIndependently;
|
|
111
111
|
|
|
112
112
|
const statement = this, ///
|
|
113
113
|
statementString = this.string; ///
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const context = localContextA; ///
|
|
118
|
-
|
|
119
|
-
localContextA = LocalContext.fromContextAndTokens(context, this.tokens);
|
|
115
|
+
specificContext.trace(`Resolving the '${statementString}' statement independently...`);
|
|
120
116
|
|
|
121
117
|
const resolved = resolveMixins.some((resolveMixin) => {
|
|
122
|
-
const resolved = resolveMixin(statement, substitutions,
|
|
118
|
+
const resolved = resolveMixin(statement, substitutions, generalContext, specificContext);
|
|
123
119
|
|
|
124
120
|
if (resolved) {
|
|
125
121
|
return true;
|
|
@@ -129,52 +125,53 @@ class Statement {
|
|
|
129
125
|
resolvedIndependently = resolved; ///
|
|
130
126
|
|
|
131
127
|
if (resolvedIndependently) {
|
|
132
|
-
|
|
128
|
+
specificContext.debug(`...resolved the '${statementString}' statement independently.`);
|
|
133
129
|
}
|
|
134
130
|
|
|
135
131
|
return resolvedIndependently;
|
|
136
132
|
}
|
|
137
133
|
|
|
138
|
-
unifyStatement(statement, substitutions,
|
|
134
|
+
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
139
135
|
let statementUnified;
|
|
140
136
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
const generalStatement = this, ///
|
|
138
|
+
specificStatement = statement, ///
|
|
139
|
+
generalStatementString = generalStatement.getString(),
|
|
140
|
+
specificStatementString = specificStatement.getString();
|
|
145
141
|
|
|
146
|
-
|
|
142
|
+
specificContext.trace(`Unifying the '${specificStatementString}' statement with the '${generalStatementString}' statement...`);
|
|
147
143
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
context = localContextA, ///
|
|
151
|
-
nodeA = statementANode, ///
|
|
152
|
-
nodeB = statementBNode; ///
|
|
144
|
+
const context = generalContext, ///
|
|
145
|
+
localContext = LocalContext.fromContextAndTokens(context, this.tokens);
|
|
153
146
|
|
|
154
|
-
|
|
147
|
+
generalContext = localContext; ///
|
|
155
148
|
|
|
156
|
-
const
|
|
149
|
+
const generalStatementNode = generalStatement.getNode(), ///
|
|
150
|
+
specificStatementNode = specificStatement.getNode(), ///
|
|
151
|
+
generalNode = generalStatementNode, ///
|
|
152
|
+
specificNode = specificStatementNode,
|
|
153
|
+
unifiedAtMetaLevel = metaLevelUnifier.unify(generalNode, specificNode, substitutions, generalContext, specificContext);
|
|
157
154
|
|
|
158
155
|
statementUnified = unifiedAtMetaLevel; ///
|
|
159
156
|
|
|
160
157
|
if (statementUnified) {
|
|
161
|
-
|
|
158
|
+
specificContext.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
|
|
162
159
|
}
|
|
163
160
|
|
|
164
161
|
return statementUnified;
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
verify(assignments, stated,
|
|
164
|
+
verify(assignments, stated, context) {
|
|
168
165
|
let verified = false;
|
|
169
166
|
|
|
170
167
|
const statement = this, ///
|
|
171
168
|
statementString = this.string; ///
|
|
172
169
|
|
|
173
|
-
|
|
170
|
+
context.trace(`Verifying the '${statementString}' statement...`);
|
|
174
171
|
|
|
175
172
|
if (!verified) {
|
|
176
173
|
verified = verifyMixins.some((verifyMixin) => {
|
|
177
|
-
const verified = verifyMixin(statement, assignments, stated,
|
|
174
|
+
const verified = verifyMixin(statement, assignments, stated, context);
|
|
178
175
|
|
|
179
176
|
if (verified) {
|
|
180
177
|
return true;
|
|
@@ -184,7 +181,7 @@ class Statement {
|
|
|
184
181
|
|
|
185
182
|
if (!verified) {
|
|
186
183
|
const unified = unifyMixins.some((unifyMixin) => {
|
|
187
|
-
const unified = unifyMixin(statement, assignments, stated,
|
|
184
|
+
const unified = unifyMixin(statement, assignments, stated, context);
|
|
188
185
|
|
|
189
186
|
if (unified) {
|
|
190
187
|
return true;
|
|
@@ -195,7 +192,7 @@ class Statement {
|
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
if (verified) {
|
|
198
|
-
|
|
195
|
+
context.debug(`...verified the '${statementString}' statement.`);
|
|
199
196
|
}
|
|
200
197
|
|
|
201
198
|
return verified;
|
|
@@ -218,24 +215,24 @@ class Statement {
|
|
|
218
215
|
return verifiedAtTopLevel;
|
|
219
216
|
}
|
|
220
217
|
|
|
221
|
-
verifyGivenMetaType(metaType, assignments, stated,
|
|
218
|
+
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
222
219
|
let verifiedGivenMetaType = false;
|
|
223
220
|
|
|
224
221
|
const metaTypeString = metaType.getString(),
|
|
225
222
|
statementString = this.string; ///
|
|
226
223
|
|
|
227
|
-
|
|
224
|
+
context.trace(`Verifying the '${statementString}' statement given the '${metaTypeString}' meta-type...`);
|
|
228
225
|
|
|
229
226
|
const metaTypeName = metaType.getName();
|
|
230
227
|
|
|
231
228
|
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
232
|
-
const verified = this.verify(assignments, stated,
|
|
229
|
+
const verified = this.verify(assignments, stated, context)
|
|
233
230
|
|
|
234
231
|
verifiedGivenMetaType = verified; ///
|
|
235
232
|
}
|
|
236
233
|
|
|
237
234
|
if (verifiedGivenMetaType) {
|
|
238
|
-
|
|
235
|
+
context.debug(`...verified the '${statementString}' statement given the '${metaTypeString}' meta-type.`);
|
|
239
236
|
}
|
|
240
237
|
|
|
241
238
|
return verifiedGivenMetaType;
|
|
@@ -267,13 +264,13 @@ class Statement {
|
|
|
267
264
|
return statement;
|
|
268
265
|
}
|
|
269
266
|
|
|
270
|
-
static fromStatementNode(statementNode,
|
|
267
|
+
static fromStatementNode(statementNode, context) {
|
|
271
268
|
let statement = null;
|
|
272
269
|
|
|
273
270
|
if (statementNode !== null) {
|
|
274
271
|
const node = statementNode, ///
|
|
275
|
-
tokens =
|
|
276
|
-
string =
|
|
272
|
+
tokens = context.nodeAsTokens(node),
|
|
273
|
+
string = context.tokensAsString(tokens);
|
|
277
274
|
|
|
278
275
|
statement = new Statement(string, node, tokens);
|
|
279
276
|
}
|
|
@@ -281,21 +278,21 @@ class Statement {
|
|
|
281
278
|
return statement;
|
|
282
279
|
}
|
|
283
280
|
|
|
284
|
-
static fromDefinedAssertionNode(definedAssertionNode,
|
|
281
|
+
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
285
282
|
const statementNode = statementNodeQuery(definedAssertionNode),
|
|
286
283
|
node = statementNode, ///
|
|
287
|
-
tokens =
|
|
288
|
-
string =
|
|
284
|
+
tokens = context.nodeAsTokens(node),
|
|
285
|
+
string = context.tokensAsString(tokens),
|
|
289
286
|
statement = new Statement(string, node, tokens);
|
|
290
287
|
|
|
291
288
|
return statement;
|
|
292
289
|
}
|
|
293
290
|
|
|
294
|
-
static fromContainedAssertionNode(containedAssertionNode,
|
|
291
|
+
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
295
292
|
const statementNode = statementNodeQuery(containedAssertionNode),
|
|
296
293
|
node = statementNode, ///
|
|
297
|
-
tokens =
|
|
298
|
-
string =
|
|
294
|
+
tokens = context.nodeAsTokens(node),
|
|
295
|
+
string = context.tokensAsString(tokens),
|
|
299
296
|
statement = new Statement(string, node, tokens);
|
|
300
297
|
|
|
301
298
|
return statement;
|
package/src/subDerivation.js
CHANGED
|
@@ -25,11 +25,11 @@ class SubDerivation {
|
|
|
25
25
|
return lastProofStep;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
verify(substitutions,
|
|
28
|
+
verify(substitutions, context) {
|
|
29
29
|
let verified;
|
|
30
30
|
|
|
31
31
|
verified = this.proofSteps.every((proofStep) => { ///
|
|
32
|
-
const proofStepVerified = proofStep.verify(substitutions,
|
|
32
|
+
const proofStepVerified = proofStep.verify(substitutions, context);
|
|
33
33
|
|
|
34
34
|
if (proofStepVerified) {
|
|
35
35
|
return true;
|
|
@@ -50,7 +50,6 @@ class SubDerivation {
|
|
|
50
50
|
subDerivation = new SubDerivation(proofSteps);
|
|
51
51
|
|
|
52
52
|
return subDerivation;
|
|
53
|
-
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
|
package/src/subproof.js
CHANGED
|
@@ -51,13 +51,15 @@ class Subproof {
|
|
|
51
51
|
return statements;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
verify(substitutions,
|
|
54
|
+
verify(substitutions, context) {
|
|
55
55
|
let subproofVerified = false;
|
|
56
56
|
|
|
57
|
-
localContext = LocalContext.
|
|
57
|
+
const localContext = LocalContext.fromContext(context); ///
|
|
58
|
+
|
|
59
|
+
context = localContext; ///
|
|
58
60
|
|
|
59
61
|
const suppositionsVerified = this.suppositions.every((supposition) => {
|
|
60
|
-
const suppositionVerified = supposition.verify(
|
|
62
|
+
const suppositionVerified = supposition.verify(context);
|
|
61
63
|
|
|
62
64
|
if (suppositionVerified) {
|
|
63
65
|
return true;
|
|
@@ -65,7 +67,7 @@ class Subproof {
|
|
|
65
67
|
});
|
|
66
68
|
|
|
67
69
|
if (suppositionsVerified) {
|
|
68
|
-
const subDerivationVerified = this.subDerivation.verify(substitutions,
|
|
70
|
+
const subDerivationVerified = this.subDerivation.verify(substitutions, context);
|
|
69
71
|
|
|
70
72
|
if (subDerivationVerified) {
|
|
71
73
|
subproofVerified = true;
|
|
@@ -15,13 +15,11 @@ const frameNodeQuery = nodeQuery("/substitution/frame[0]"),
|
|
|
15
15
|
substitutionNodeQuery = nodeQuery("/statement/substitution");
|
|
16
16
|
|
|
17
17
|
export default class FrameForMetavariableSubstitution extends Substitution {
|
|
18
|
-
constructor(string,
|
|
19
|
-
super(string);
|
|
18
|
+
constructor(string, node, tokens, frame, metavariable) {
|
|
19
|
+
super(string, node, tokens);
|
|
20
20
|
|
|
21
21
|
this.frame = frame;
|
|
22
22
|
this.metavariable = metavariable;
|
|
23
|
-
this.substitutionNode = substitutionNode;
|
|
24
|
-
this.substitutionTokens = substitutionTokens;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
getFrame() {
|
|
@@ -32,14 +30,6 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
32
30
|
return this.metavariable;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
getSubstitutionNode() {
|
|
36
|
-
return this.substitutionNode;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getSubstitutionTokens() {
|
|
40
|
-
return this.substitutionTokens;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
33
|
getMetavariableName() {
|
|
44
34
|
const metavariableName = this.metavariable.getName();
|
|
45
35
|
|
|
@@ -54,22 +44,6 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
54
44
|
return substitutionString;
|
|
55
45
|
}
|
|
56
46
|
|
|
57
|
-
setSubstitutionNodeAndTokens(localContext) {
|
|
58
|
-
const lexer = localContext.getLexer(),
|
|
59
|
-
parser = localContext.getParser(),
|
|
60
|
-
substitutionString = this.getSubstitutionString(),
|
|
61
|
-
unqualifiedStatementString = unqualifiedStatementStringFromSubstitutionString(substitutionString),
|
|
62
|
-
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer),
|
|
63
|
-
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser);
|
|
64
|
-
|
|
65
|
-
this.substitutionNode = substitutionNodeFromUnqualifiedStatementNode(unqualifiedStatementNode);
|
|
66
|
-
|
|
67
|
-
this.substitutionTokens = substitutionTokensFromUnqualifiedStatementTokensAndSubstitutionNode(unqualifiedStatementTokens, this.substitutionNode);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setSubstitutionTokens(localContext) {
|
|
71
|
-
}
|
|
72
|
-
|
|
73
47
|
isEqualTo(substitution) {
|
|
74
48
|
let equalTo = false;
|
|
75
49
|
|
|
@@ -93,18 +67,20 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
93
67
|
matchMetavariableName(metavariableName) {
|
|
94
68
|
let metavariableNameMatches;
|
|
95
69
|
|
|
96
|
-
const
|
|
70
|
+
const generalMetavariableName = metavariableName; ///
|
|
97
71
|
|
|
98
72
|
metavariableName = this.metavariable.getName();
|
|
99
73
|
|
|
100
|
-
const
|
|
74
|
+
const specificMetavariableName = metavariableName; ///
|
|
101
75
|
|
|
102
|
-
metavariableNameMatches = (
|
|
76
|
+
metavariableNameMatches = (generalMetavariableName === specificMetavariableName);
|
|
103
77
|
|
|
104
78
|
return metavariableNameMatches;
|
|
105
79
|
}
|
|
106
80
|
|
|
107
81
|
matchSubstitutionNode(substitutionNode) {
|
|
82
|
+
debugger
|
|
83
|
+
|
|
108
84
|
let substitutionNodeMatches;
|
|
109
85
|
|
|
110
86
|
if ((substitutionNode === null) && (this.substitutionNode === null)) {
|
|
@@ -128,7 +104,7 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
128
104
|
return metavariableNameAndSubstitutionNodeMatches;
|
|
129
105
|
}
|
|
130
106
|
|
|
131
|
-
static fromStatementNode(statementNode,
|
|
107
|
+
static fromStatementNode(statementNode, context) {
|
|
132
108
|
let frameForMetavariableSubstitution = null;
|
|
133
109
|
|
|
134
110
|
const substitutionNode = substitutionNodeQuery(statementNode);
|
|
@@ -139,31 +115,39 @@ export default class FrameForMetavariableSubstitution extends Substitution {
|
|
|
139
115
|
|
|
140
116
|
if ((frameNode !== null) && (metavariableNode !== null)) {
|
|
141
117
|
const { Frame, Metavariable } = shim,
|
|
142
|
-
frame = Frame.fromFrameNode(frameNode,
|
|
143
|
-
metavariable = Metavariable.fromMetavariableNode(metavariableNode,
|
|
144
|
-
|
|
145
|
-
|
|
118
|
+
frame = Frame.fromFrameNode(frameNode, context),
|
|
119
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
|
|
120
|
+
node = substitutionNode, ///
|
|
121
|
+
tokens = context.nodeAsTokens(node),
|
|
122
|
+
string = stringFromFrameAndMetavariable(frame, metavariable);
|
|
146
123
|
|
|
147
|
-
frameForMetavariableSubstitution = new FrameForMetavariableSubstitution(string,
|
|
124
|
+
frameForMetavariableSubstitution = new FrameForMetavariableSubstitution(string, node, tokens, frame, metavariable);
|
|
148
125
|
}
|
|
149
126
|
}
|
|
150
127
|
|
|
151
128
|
return frameForMetavariableSubstitution;
|
|
152
129
|
}
|
|
153
130
|
|
|
154
|
-
static fromFrameAndMetavariable(frame, metavariable,
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
131
|
+
static fromFrameAndMetavariable(frame, metavariable, context) {
|
|
132
|
+
const lexer = context.getLexer(),
|
|
133
|
+
parser = context.getParser(),
|
|
134
|
+
string = stringFromFrameAndMetavariable(frame, metavariable),
|
|
135
|
+
substitutionString = string, ///
|
|
136
|
+
unqualifiedStatementString = unqualifiedStatementStringFromSubstitutionString(substitutionString),
|
|
137
|
+
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer),
|
|
138
|
+
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser),
|
|
139
|
+
substitutionNode = substitutionNodeFromUnqualifiedStatementNode(unqualifiedStatementNode),
|
|
140
|
+
substitutionTokens = substitutionTokensFromUnqualifiedStatementTokensAndSubstitutionNode(unqualifiedStatementTokens, substitutionNode),
|
|
141
|
+
node = substitutionNode, //
|
|
142
|
+
tokens = substitutionTokens, ///
|
|
143
|
+
statementForMetavariableSubstitution = new FrameForMetavariableSubstitution(string, node, tokens, frame, metavariable);
|
|
159
144
|
|
|
160
145
|
return statementForMetavariableSubstitution;
|
|
161
146
|
}
|
|
162
147
|
}
|
|
163
148
|
|
|
164
|
-
function stringFromFrameAndMetavariable(frame, metavariable
|
|
165
|
-
const
|
|
166
|
-
frameString = localContext.nodeAsString(frameNode),
|
|
149
|
+
function stringFromFrameAndMetavariable(frame, metavariable) {
|
|
150
|
+
const frameString = frame.getString(),
|
|
167
151
|
metavariableString = metavariable.getString(),
|
|
168
152
|
string = `[${frameString} for [${metavariableString}]]`;
|
|
169
153
|
|