occam-verify-cli 0.0.1111 → 0.0.1112
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/combinator/bracketed.js +15 -65
- package/lib/combinator.js +4 -8
- package/lib/constructor/bracketed.js +24 -101
- package/lib/constructor.js +4 -8
- package/lib/context/file.js +41 -12
- package/lib/context/local.js +45 -25
- package/lib/context/release.js +2 -2
- package/lib/dom/assertion/contained.js +246 -0
- package/lib/dom/assertion/defined.js +266 -0
- package/lib/dom/assertion/subproof.js +210 -0
- package/lib/dom/assertion/type.js +240 -0
- package/lib/{axiom.js → dom/axiom.js} +18 -8
- package/lib/dom/conclusion.js +171 -0
- package/lib/{conjecture.js → dom/conjecture.js} +18 -8
- package/lib/dom/consequent.js +171 -0
- package/lib/dom/declaration/combinator.js +105 -0
- package/lib/dom/declaration/constructor.js +140 -0
- package/lib/dom/declaration/metavariable.js +154 -0
- package/lib/dom/declaration/type.js +140 -0
- package/lib/dom/declaration/variable.js +155 -0
- package/lib/{declaration.js → dom/declaration.js} +62 -18
- package/lib/dom/derivation.js +137 -0
- package/lib/dom/equality.js +260 -0
- package/lib/dom/error.js +85 -0
- package/lib/dom/frame.js +372 -0
- package/lib/dom/judgement.js +198 -0
- package/lib/dom/label.js +190 -0
- package/lib/{lemma.js → dom/lemma.js} +19 -9
- package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
- package/lib/dom/metaType.js +261 -0
- package/lib/dom/metatheorem.js +273 -0
- package/lib/dom/metavariable.js +463 -0
- package/lib/dom/premise.js +221 -0
- package/lib/dom/proof.js +154 -0
- package/lib/dom/proofStep.js +239 -0
- package/lib/dom/reference.js +218 -0
- package/lib/dom/rule.js +311 -0
- package/lib/dom/statement.js +379 -0
- package/lib/dom/subDerivation.js +137 -0
- package/lib/dom/subproof.js +211 -0
- package/lib/dom/supposition.js +221 -0
- package/lib/dom/term.js +354 -0
- package/lib/{theorem.js → dom/theorem.js} +18 -8
- package/lib/dom/topLevelAssertion.js +306 -0
- package/lib/dom/type.js +327 -0
- package/lib/dom/variable.js +328 -0
- package/lib/dom.js +27 -0
- package/lib/equivalences.js +307 -0
- package/lib/index.js +40 -35
- package/lib/mixins/proofStep/unify.js +86 -0
- package/lib/mixins/statement/verify.js +27 -2
- package/lib/mixins/term/verify.js +24 -4
- package/lib/substitution/frame.js +3 -3
- package/lib/substitution/statement.js +17 -16
- package/lib/substitution/term.js +10 -7
- package/lib/substitution.js +4 -31
- package/lib/substitutions.js +24 -56
- package/lib/unifier/equality.js +2 -3
- package/lib/unifier/label.js +3 -3
- package/lib/unifier/metaLevel.js +9 -8
- package/lib/unifier/metavariable.js +3 -3
- package/lib/unifier/statementWithCombinator.js +5 -5
- package/lib/unifier/termWithConstructor.js +3 -3
- package/lib/utilities/json.js +26 -40
- package/lib/utilities/string.js +6 -8
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/substitutions.js +7 -6
- package/lib/utilities/verification.js +22 -14
- package/lib/verifier/combinator.js +4 -4
- package/lib/verifier/constructor.js +3 -3
- package/lib/verifier/topLevel.js +15 -21
- package/package.json +1 -1
- package/src/combinator/bracketed.js +11 -4
- package/src/combinator.js +3 -10
- package/src/constructor/bracketed.js +17 -5
- package/src/constructor.js +3 -9
- package/src/context/file.js +42 -11
- package/src/context/local.js +26 -34
- package/src/context/release.js +1 -1
- package/src/{assertion → dom/assertion}/contained.js +10 -8
- package/src/{assertion → dom/assertion}/defined.js +14 -11
- package/src/{assertion → dom/assertion}/subproof.js +11 -62
- package/src/{assertion → dom/assertion}/type.js +11 -8
- package/src/{axiom.js → dom/axiom.js} +6 -9
- package/src/dom/conclusion.js +95 -0
- package/src/{conjecture.js → dom/conjecture.js} +5 -8
- package/src/dom/consequent.js +95 -0
- package/src/{declaration → dom/declaration}/combinator.js +8 -5
- package/src/{declaration → dom/declaration}/constructor.js +8 -4
- package/src/{declaration → dom/declaration}/metavariable.js +8 -5
- package/src/{declaration → dom/declaration}/type.js +8 -4
- package/src/{declaration → dom/declaration}/variable.js +9 -6
- package/src/{declaration.js → dom/declaration.js} +11 -16
- package/src/{derivation.js → dom/derivation.js} +9 -12
- package/src/{equality.js → dom/equality.js} +11 -14
- package/src/{error.js → dom/error.js} +6 -3
- package/src/{frame.js → dom/frame.js} +14 -23
- package/src/{judgement.js → dom/judgement.js} +8 -11
- package/src/{label.js → dom/label.js} +9 -16
- package/src/{lemma.js → dom/lemma.js} +5 -9
- package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
- package/src/{metaType.js → dom/metaType.js} +7 -10
- package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
- package/src/{metavariable.js → dom/metavariable.js} +79 -77
- package/src/dom/premise.js +173 -0
- package/src/{proof.js → dom/proof.js} +8 -11
- package/src/dom/proofStep.js +173 -0
- package/src/{reference.js → dom/reference.js} +48 -20
- package/src/{rule.js → dom/rule.js} +13 -17
- package/src/{statement.js → dom/statement.js} +142 -71
- package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
- package/src/{subproof.js → dom/subproof.js} +14 -47
- package/src/dom/supposition.js +173 -0
- package/src/{term.js → dom/term.js} +24 -45
- package/src/{theorem.js → dom/theorem.js} +5 -8
- package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
- package/src/{type.js → dom/type.js} +9 -12
- package/src/{variable.js → dom/variable.js} +20 -28
- package/src/dom.js +13 -0
- package/src/equivalences.js +278 -0
- package/src/index.js +39 -34
- package/src/mixins/proofStep/unify.js +115 -0
- package/src/mixins/statement/verify.js +33 -1
- package/src/mixins/term/verify.js +33 -3
- package/src/substitution/frame.js +2 -2
- package/src/substitution/statement.js +20 -18
- package/src/substitution/term.js +12 -5
- package/src/substitution.js +4 -29
- package/src/substitutions.js +35 -73
- package/src/unifier/equality.js +1 -2
- package/src/unifier/label.js +2 -2
- package/src/unifier/metaLevel.js +9 -7
- package/src/unifier/metavariable.js +2 -2
- package/src/unifier/statementWithCombinator.js +4 -4
- package/src/unifier/termWithConstructor.js +2 -2
- package/src/utilities/json.js +23 -42
- package/src/utilities/string.js +8 -6
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/substitutions.js +7 -5
- package/src/utilities/verification.js +29 -13
- package/src/verifier/combinator.js +3 -3
- package/src/verifier/constructor.js +3 -3
- package/src/verifier/topLevel.js +20 -21
- package/lib/assertion/contained.js +0 -232
- package/lib/assertion/defined.js +0 -211
- package/lib/assertion/subproof.js +0 -203
- package/lib/assertion/type.js +0 -185
- package/lib/conclusion.js +0 -130
- package/lib/consequent.js +0 -130
- package/lib/declaration/combinator.js +0 -90
- package/lib/declaration/constructor.js +0 -90
- package/lib/declaration/metavariable.js +0 -104
- package/lib/declaration/type.js +0 -90
- package/lib/declaration/variable.js +0 -105
- package/lib/derivation.js +0 -91
- package/lib/equality.js +0 -209
- package/lib/error.js +0 -70
- package/lib/frame.js +0 -331
- package/lib/judgement.js +0 -147
- package/lib/label.js +0 -141
- package/lib/metaType.js +0 -255
- package/lib/metatheorem.js +0 -263
- package/lib/metavariable.js +0 -399
- package/lib/mixins/statement/qualified/unify.js +0 -69
- package/lib/mixins/statement/unify.js +0 -42
- package/lib/mixins/statement/unifyIndependenntly.js +0 -46
- package/lib/mixins/term/unify.js +0 -40
- package/lib/premise.js +0 -184
- package/lib/proof.js +0 -103
- package/lib/proofStep.js +0 -179
- package/lib/reference.js +0 -145
- package/lib/rule.js +0 -259
- package/lib/shim.js +0 -14
- package/lib/statement/qualified.js +0 -152
- package/lib/statement/unqualified.js +0 -175
- package/lib/statement.js +0 -270
- package/lib/subDerivation.js +0 -91
- package/lib/subproof.js +0 -181
- package/lib/supposition.js +0 -184
- package/lib/term.js +0 -318
- package/lib/topLevelAssertion.js +0 -305
- package/lib/type.js +0 -321
- package/lib/utilities/equivalences.js +0 -178
- package/lib/variable.js +0 -281
- package/src/conclusion.js +0 -96
- package/src/consequent.js +0 -96
- package/src/mixins/statement/qualified/unify.js +0 -103
- package/src/mixins/statement/unify.js +0 -41
- package/src/mixins/statement/unifyIndependenntly.js +0 -58
- package/src/mixins/term/unify.js +0 -36
- package/src/premise.js +0 -183
- package/src/proofStep.js +0 -181
- package/src/shim.js +0 -5
- package/src/statement/qualified.js +0 -133
- package/src/statement/unqualified.js +0 -166
- package/src/supposition.js +0 -183
- package/src/utilities/equivalences.js +0 -183
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import JudgementAssignment from "
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
import JudgementAssignment from "../assignment/judgement";
|
|
5
5
|
|
|
6
|
-
import { nodeQuery } from "
|
|
6
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
import { domAssigned } from "../dom";
|
|
7
8
|
|
|
8
9
|
const frameNodeQuery = nodeQuery("/judgement/frame"),
|
|
9
10
|
judgementNodeQuery = nodeQuery("/statement/judgement"),
|
|
10
11
|
declarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
11
12
|
|
|
12
|
-
class Judgement {
|
|
13
|
+
export default domAssigned(class Judgement {
|
|
13
14
|
constructor(string, frame, declaration) {
|
|
14
15
|
this.string = string;
|
|
15
16
|
this.frame = frame;
|
|
@@ -103,13 +104,15 @@ class Judgement {
|
|
|
103
104
|
return verifiedWhenDerived;
|
|
104
105
|
}
|
|
105
106
|
|
|
107
|
+
static name = "Judgement";
|
|
108
|
+
|
|
106
109
|
static fromStatementNode(statementNode, context) {
|
|
107
110
|
let judgement = null;
|
|
108
111
|
|
|
109
112
|
const judgementNode = judgementNodeQuery(statementNode);
|
|
110
113
|
|
|
111
114
|
if (judgementNode !== null) {
|
|
112
|
-
const { Frame, Declaration } =
|
|
115
|
+
const { Frame, Declaration } = dom,
|
|
113
116
|
frameNode = frameNodeQuery(judgementNode),
|
|
114
117
|
declarationNode = declarationNodeQuery(judgementNode),
|
|
115
118
|
node = judgementNode, ///
|
|
@@ -122,10 +125,4 @@ class Judgement {
|
|
|
122
125
|
|
|
123
126
|
return judgement;
|
|
124
127
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
Object.assign(shim, {
|
|
128
|
-
Judgement
|
|
129
128
|
});
|
|
130
|
-
|
|
131
|
-
export default Judgement;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalContext from "
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
import LocalContext from "../context/local";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { metavariableFromJSON, metavariableToMetavariableJSON } from "
|
|
6
|
+
import { domAssigned } from "../dom";
|
|
7
|
+
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Label {
|
|
9
|
+
export default domAssigned(class Label {
|
|
12
10
|
constructor(metavariable) {
|
|
13
11
|
this.metavariable = metavariable;
|
|
14
12
|
}
|
|
@@ -77,6 +75,8 @@ class Label {
|
|
|
77
75
|
return json;
|
|
78
76
|
}
|
|
79
77
|
|
|
78
|
+
static name = "Label";
|
|
79
|
+
|
|
80
80
|
static fromJSON(json, fileContext) {
|
|
81
81
|
const metavariable = metavariableFromJSON(json, fileContext),
|
|
82
82
|
label = new Label(metavariable);
|
|
@@ -85,18 +85,11 @@ class Label {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
static fromLabelNode(labelNode, fileContext) {
|
|
88
|
-
const { Metavariable } =
|
|
89
|
-
metavariableNode = metavariableNodeQuery(labelNode),
|
|
88
|
+
const { Metavariable } = dom,
|
|
90
89
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
91
|
-
metavariable = Metavariable.
|
|
90
|
+
metavariable = Metavariable.fromLabelNode(labelNode, localContext),
|
|
92
91
|
label = new Label(metavariable);
|
|
93
92
|
|
|
94
93
|
return label;
|
|
95
94
|
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
Object.assign(shim, {
|
|
99
|
-
Label
|
|
100
95
|
});
|
|
101
|
-
|
|
102
|
-
export default Label;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import shim from "./shim";
|
|
4
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { domAssigned } from "../dom";
|
|
6
|
+
import { EMPTY_STRING } from "../constants";
|
|
7
7
|
|
|
8
|
-
class Lemma extends TopLevelAssertion {
|
|
8
|
+
export default domAssigned(class Lemma extends TopLevelAssertion {
|
|
9
9
|
verify() {
|
|
10
10
|
let verified;
|
|
11
11
|
|
|
@@ -32,11 +32,7 @@ class Lemma extends TopLevelAssertion {
|
|
|
32
32
|
return verified;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
static
|
|
36
|
-
}
|
|
35
|
+
static name = "Lemma";
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
Lemma
|
|
37
|
+
static fromLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(Lemma, metaLemmaNode, fileContext); }
|
|
40
38
|
});
|
|
41
|
-
|
|
42
|
-
export default Lemma;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalContext from "./context/local";
|
|
3
|
+
import LocalContext from "../context/local";
|
|
5
4
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
import { domAssigned } from "../dom";
|
|
7
|
+
|
|
8
|
+
export default domAssigned(class MetaLemma extends TopLevelAssertion {
|
|
8
9
|
unifyReference(reference, substitutions, context) {
|
|
9
10
|
let referenceUnified;
|
|
10
11
|
|
|
@@ -101,11 +102,7 @@ class MetaLemma extends TopLevelAssertion {
|
|
|
101
102
|
return labelsVerified;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
static
|
|
105
|
-
}
|
|
105
|
+
static name = "MetaLemma";
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
MetaLemma
|
|
107
|
+
static fromMetaLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(MetaLemma, metaLemmaNode, fileContext); }
|
|
109
108
|
});
|
|
110
|
-
|
|
111
|
-
export default MetaLemma;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "./metaTypeNames";
|
|
3
|
+
import { nodeQuery } from "../utilities/query";
|
|
4
|
+
import { domAssigned } from "../dom";
|
|
5
|
+
import { metaTypeNameFromMetaTypeNode } from "../utilities/name";
|
|
6
|
+
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
7
|
|
|
9
8
|
const metaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
|
|
10
9
|
|
|
@@ -44,6 +43,8 @@ class MetaType {
|
|
|
44
43
|
return json;
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
static name = "MetaType";
|
|
47
|
+
|
|
47
48
|
static fromJSON(json, fileContext) {
|
|
48
49
|
const { name } = json,
|
|
49
50
|
metaTypeName = name, ///
|
|
@@ -68,11 +69,7 @@ class MetaType {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
MetaType
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
export default MetaType;
|
|
72
|
+
export default domAssigned(MetaType);
|
|
76
73
|
|
|
77
74
|
class FrameMetaType extends MetaType {
|
|
78
75
|
static fromNothing() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalContext from "./context/local";
|
|
3
|
+
import LocalContext from "../context/local";
|
|
5
4
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
6
5
|
|
|
6
|
+
import { domAssigned } from "../dom";
|
|
7
7
|
import { stringFromLabels } from "./topLevelAssertion";
|
|
8
8
|
import { labelsFromJSON,
|
|
9
9
|
labelsToLabelsJSON,
|
|
@@ -12,9 +12,9 @@ import { labelsFromJSON,
|
|
|
12
12
|
substitutionsFromJSON,
|
|
13
13
|
consequentToConsequentJSON,
|
|
14
14
|
suppositionsToSuppositionsJSON,
|
|
15
|
-
substitutionsToSubstitutionsJSON } from "
|
|
15
|
+
substitutionsToSubstitutionsJSON } from "../utilities/json";
|
|
16
16
|
|
|
17
|
-
class Metatheorem extends TopLevelAssertion {
|
|
17
|
+
export default domAssigned(class Metatheorem extends TopLevelAssertion {
|
|
18
18
|
unifyReference(reference, substitutions, context) {
|
|
19
19
|
let referenceUnified;
|
|
20
20
|
|
|
@@ -130,6 +130,8 @@ class Metatheorem extends TopLevelAssertion {
|
|
|
130
130
|
return json;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
static name = "Metatheorem";
|
|
134
|
+
|
|
133
135
|
static fromJSON(json, fileContext) {
|
|
134
136
|
const labels = labelsFromJSON(json, fileContext),
|
|
135
137
|
consequent = consequentFromJSON(json, fileContext),
|
|
@@ -143,10 +145,4 @@ class Metatheorem extends TopLevelAssertion {
|
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
static fromMetatheoremNode(metatheoremNode, fileContext) { return TopLevelAssertion.fromNode(Metatheorem, metatheoremNode, fileContext); }
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
Object.assign(shim, {
|
|
149
|
-
Metatheorem
|
|
150
148
|
});
|
|
151
|
-
|
|
152
|
-
export default Metatheorem;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import LocalContext from "
|
|
5
|
-
import FrameSubstitution from "
|
|
6
|
-
import StatementSubstitution from "
|
|
7
|
-
import MetavariableNodeAndTokens from "
|
|
8
|
-
|
|
9
|
-
import { nodeQuery } from "
|
|
10
|
-
import { objectType } from "
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
import LocalContext from "../context/local";
|
|
5
|
+
import FrameSubstitution from "../substitution/frame";
|
|
6
|
+
import StatementSubstitution from "../substitution/statement";
|
|
7
|
+
import MetavariableNodeAndTokens from "../nodeAndTokens/metavariable";
|
|
8
|
+
|
|
9
|
+
import { nodeQuery } from "../utilities/query";
|
|
10
|
+
import { objectType } from "../dom/type";
|
|
11
|
+
import { domAssigned } from "../dom";
|
|
12
|
+
import { EMPTY_STRING } from "../constants";
|
|
13
|
+
import { unifyMetavariable } from "../utilities/unification";
|
|
14
|
+
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
15
|
+
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
16
|
+
import { metaTypeFromJSON, metaTypeToMetaTypeJSON } from "../utilities/json";
|
|
16
17
|
|
|
17
18
|
const termNodeQuery = nodeQuery("/metavariable/argument/term"),
|
|
18
19
|
metavariableNodeQuery = nodeQuery("/metavariableDeclaration/metavariable"),
|
|
19
20
|
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
20
|
-
|
|
21
|
+
labelMetavariableNodeQuery = nodeQuery("/label/metavariable"),
|
|
22
|
+
referenceMetavariableNodeQuery = nodeQuery("/reference/metavariable"),
|
|
23
|
+
statementMetavariableNodeQuery = nodeQuery("/statement/metavariable");
|
|
21
24
|
|
|
22
|
-
class Metavariable {
|
|
25
|
+
export default domAssigned(class Metavariable {
|
|
23
26
|
constructor(string, node, tokens, name, type, metaType) {
|
|
24
27
|
this.string = string;
|
|
25
28
|
this.node = node;
|
|
@@ -65,22 +68,17 @@ class Metavariable {
|
|
|
65
68
|
return metavariableNodeMatches;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
isEqualTo(
|
|
69
|
-
let equalTo = false;
|
|
70
|
-
|
|
71
|
-
if (metavariable !== null) {
|
|
72
|
-
const metavariableString = metavariable.getString();
|
|
71
|
+
isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
isEqualTo(metavariable) {
|
|
74
|
+
const metavariableString = metavariable.getString(),
|
|
75
|
+
equalTo = (metavariableString === this.string);
|
|
76
76
|
|
|
77
77
|
return equalTo;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
isEssentiallyEqualToFrame(frame, generalContext, specificContext) {
|
|
83
|
-
let essentiallyEqualToFrame = false;
|
|
80
|
+
isEffectivelyEqualToFrame(frame, generalContext, specificContext) {
|
|
81
|
+
let effectivelyEqualToFrame = false;
|
|
84
82
|
|
|
85
83
|
const generalContextFilePath = generalContext.getFilePath(),
|
|
86
84
|
specificContextFilePath = specificContext.getFilePath();
|
|
@@ -89,15 +87,15 @@ class Metavariable {
|
|
|
89
87
|
const frameString = frame.getString();
|
|
90
88
|
|
|
91
89
|
if (frameString === this.string) {
|
|
92
|
-
|
|
90
|
+
effectivelyEqualToFrame = true;
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
return
|
|
94
|
+
return effectivelyEqualToFrame;
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
let
|
|
97
|
+
isEffectivelyEqualToStatement(statement, generalContext, specificContext) {
|
|
98
|
+
let effectivelyEqualToStatement = false;
|
|
101
99
|
|
|
102
100
|
const generalContextFilePath = generalContext.getFilePath(),
|
|
103
101
|
specificContextFilePath = specificContext.getFilePath();
|
|
@@ -106,11 +104,11 @@ class Metavariable {
|
|
|
106
104
|
const statementString = statement.getString();
|
|
107
105
|
|
|
108
106
|
if (statementString === this.string) {
|
|
109
|
-
|
|
107
|
+
effectivelyEqualToStatement = true;
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
|
|
113
|
-
return
|
|
111
|
+
return effectivelyEqualToStatement;
|
|
114
112
|
}
|
|
115
113
|
|
|
116
114
|
unifyFrame(frame, substitutions, generalContext, specificContext) {
|
|
@@ -121,9 +119,9 @@ class Metavariable {
|
|
|
121
119
|
|
|
122
120
|
specificContext.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
123
121
|
|
|
124
|
-
const
|
|
122
|
+
const effectivelyEqualToFrame = this.isEffectivelyEqualToFrame(frame, generalContext, specificContext);
|
|
125
123
|
|
|
126
|
-
if (
|
|
124
|
+
if (effectivelyEqualToFrame) {
|
|
127
125
|
frameUnified = true;
|
|
128
126
|
} else {
|
|
129
127
|
const metavariable = this, ///
|
|
@@ -167,25 +165,25 @@ class Metavariable {
|
|
|
167
165
|
|
|
168
166
|
specificContext.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
|
|
169
167
|
|
|
170
|
-
const
|
|
168
|
+
const effectivelyEqualToStatement = this.isEffectivelyEqualToStatement(statement, generalContext, specificContext);
|
|
171
169
|
|
|
172
|
-
if (
|
|
170
|
+
if (effectivelyEqualToStatement) {
|
|
173
171
|
statementUnified = true;
|
|
174
172
|
} else {
|
|
175
|
-
const
|
|
173
|
+
const context = specificContext, ///
|
|
174
|
+
metavariable = this, ///
|
|
176
175
|
substitutionPresent = substitutions.isSubstitutionPresentByMetavariableAndSubstitution(metavariable, substitution);
|
|
177
176
|
|
|
178
177
|
if (substitutionPresent) {
|
|
179
178
|
substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
|
|
180
179
|
|
|
181
|
-
const substitutionStatementEqualToStatement = substitution.isStatementEqualTo(statement);
|
|
180
|
+
const substitutionStatementEqualToStatement = substitution.isStatementEqualTo(statement, context);
|
|
182
181
|
|
|
183
182
|
if (substitutionStatementEqualToStatement) {
|
|
184
183
|
statementUnified = true;
|
|
185
184
|
}
|
|
186
185
|
} else {
|
|
187
|
-
const
|
|
188
|
-
metavariable = this,
|
|
186
|
+
const metavariable = this,
|
|
189
187
|
statementSubstitution = StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context);
|
|
190
188
|
|
|
191
189
|
substitution = statementSubstitution; ///
|
|
@@ -211,12 +209,12 @@ class Metavariable {
|
|
|
211
209
|
generalMetavariableString = generalMetavariable.getString(),
|
|
212
210
|
specificMetavariableString = specificMetavariable.getString();
|
|
213
211
|
|
|
214
|
-
specificContext.trace(`Unifying the '${specificMetavariableString}' metavariable
|
|
212
|
+
specificContext.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable...`);
|
|
215
213
|
|
|
216
214
|
metavariableUnified = unifyMetavariable(generalMetavariable, specificMetavariable, generalContext, specificContext);
|
|
217
215
|
|
|
218
216
|
if (metavariableUnified) {
|
|
219
|
-
specificContext.debug(`...unified the '${specificMetavariableString}' metavariable
|
|
217
|
+
specificContext.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable.`);
|
|
220
218
|
}
|
|
221
219
|
|
|
222
220
|
return metavariableUnified;
|
|
@@ -381,6 +379,8 @@ class Metavariable {
|
|
|
381
379
|
return json;
|
|
382
380
|
}
|
|
383
381
|
|
|
382
|
+
static name = "Metavariable";
|
|
383
|
+
|
|
384
384
|
static fromJSON(json, fileContext) {
|
|
385
385
|
const { string } = json,
|
|
386
386
|
context = fileContext, ///
|
|
@@ -404,37 +404,39 @@ class Metavariable {
|
|
|
404
404
|
const frameMetavariableNode = frameMetavariableNodeQuery(frameNode);
|
|
405
405
|
|
|
406
406
|
if (frameMetavariableNode !== null) {
|
|
407
|
-
const metavariableNode = frameMetavariableNode
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
node = metavariableNode, ///
|
|
411
|
-
string = context.nodeAsString(node),
|
|
412
|
-
tokens = context.nodeAsTokens(node),
|
|
413
|
-
type = null,
|
|
414
|
-
metaType = null;
|
|
415
|
-
|
|
416
|
-
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
407
|
+
const metavariableNode = frameMetavariableNode; ///
|
|
408
|
+
|
|
409
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
417
410
|
}
|
|
418
411
|
|
|
419
412
|
return metavariable;
|
|
420
413
|
}
|
|
421
414
|
|
|
415
|
+
static fromLabelNode(labelNode, context) {
|
|
416
|
+
const labelMetavariableNode = labelMetavariableNodeQuery(labelNode),
|
|
417
|
+
metavariableNode = labelMetavariableNode, ///
|
|
418
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
419
|
+
|
|
420
|
+
return metavariable;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
static fromReferenceNode(referenceNode, context) {
|
|
424
|
+
const referenceMetavariableNode = referenceMetavariableNodeQuery(referenceNode),
|
|
425
|
+
metavariableNode = referenceMetavariableNode, ///
|
|
426
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
427
|
+
|
|
428
|
+
return metavariable;
|
|
429
|
+
}
|
|
430
|
+
|
|
422
431
|
static fromStatementNode(statementNode, context) {
|
|
423
432
|
let metavariable = null;
|
|
424
433
|
|
|
425
434
|
const statementMetavariableNode = statementMetavariableNodeQuery(statementNode);
|
|
426
435
|
|
|
427
436
|
if (statementMetavariableNode !== null) {
|
|
428
|
-
const metavariableNode = statementMetavariableNode
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
node = metavariableNode, ///
|
|
432
|
-
string = context.nodeAsString(node),
|
|
433
|
-
tokens = context.nodeAsTokens(node),
|
|
434
|
-
type = null,
|
|
435
|
-
metaType = null;
|
|
436
|
-
|
|
437
|
-
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
437
|
+
const metavariableNode = statementMetavariableNode; ///
|
|
438
|
+
|
|
439
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
438
440
|
}
|
|
439
441
|
|
|
440
442
|
return metavariable;
|
|
@@ -444,22 +446,14 @@ class Metavariable {
|
|
|
444
446
|
let metavariable = null;
|
|
445
447
|
|
|
446
448
|
if (metavariableNode !== null) {
|
|
447
|
-
|
|
448
|
-
name = metavariableName, ///
|
|
449
|
-
node = metavariableNode, ///
|
|
450
|
-
string = context.nodeAsString(node),
|
|
451
|
-
tokens = context.nodeAsTokens(node),
|
|
452
|
-
type = null,
|
|
453
|
-
metaType = null;
|
|
454
|
-
|
|
455
|
-
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
449
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
456
450
|
}
|
|
457
451
|
|
|
458
452
|
return metavariable;
|
|
459
453
|
}
|
|
460
454
|
|
|
461
455
|
static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
462
|
-
const { Type, MetaType } =
|
|
456
|
+
const { Type, MetaType } = dom,
|
|
463
457
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
464
458
|
context = localContext, ///
|
|
465
459
|
metavariableNode = metavariableNodeQuery(metavariableDeclarationNode),
|
|
@@ -474,10 +468,18 @@ class Metavariable {
|
|
|
474
468
|
|
|
475
469
|
return metavariable;
|
|
476
470
|
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
Object.assign(shim, {
|
|
480
|
-
Metavariable
|
|
481
471
|
});
|
|
482
472
|
|
|
483
|
-
|
|
473
|
+
function metavariableFromMetavariableNode(metavariableNode, context) {
|
|
474
|
+
const { Metavariable } = dom,
|
|
475
|
+
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
476
|
+
name = metavariableName, ///
|
|
477
|
+
node = metavariableNode, ///
|
|
478
|
+
string = context.nodeAsString(node),
|
|
479
|
+
tokens = context.nodeAsTokens(node),
|
|
480
|
+
type = null,
|
|
481
|
+
metaType = null,
|
|
482
|
+
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
483
|
+
|
|
484
|
+
return metavariable;
|
|
485
|
+
}
|