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.
Files changed (197) hide show
  1. package/lib/combinator/bracketed.js +15 -65
  2. package/lib/combinator.js +4 -8
  3. package/lib/constructor/bracketed.js +24 -101
  4. package/lib/constructor.js +4 -8
  5. package/lib/context/file.js +41 -12
  6. package/lib/context/local.js +45 -25
  7. package/lib/context/release.js +2 -2
  8. package/lib/dom/assertion/contained.js +246 -0
  9. package/lib/dom/assertion/defined.js +266 -0
  10. package/lib/dom/assertion/subproof.js +210 -0
  11. package/lib/dom/assertion/type.js +240 -0
  12. package/lib/{axiom.js → dom/axiom.js} +18 -8
  13. package/lib/dom/conclusion.js +171 -0
  14. package/lib/{conjecture.js → dom/conjecture.js} +18 -8
  15. package/lib/dom/consequent.js +171 -0
  16. package/lib/dom/declaration/combinator.js +105 -0
  17. package/lib/dom/declaration/constructor.js +140 -0
  18. package/lib/dom/declaration/metavariable.js +154 -0
  19. package/lib/dom/declaration/type.js +140 -0
  20. package/lib/dom/declaration/variable.js +155 -0
  21. package/lib/{declaration.js → dom/declaration.js} +62 -18
  22. package/lib/dom/derivation.js +137 -0
  23. package/lib/dom/equality.js +260 -0
  24. package/lib/dom/error.js +85 -0
  25. package/lib/dom/frame.js +372 -0
  26. package/lib/dom/judgement.js +198 -0
  27. package/lib/dom/label.js +190 -0
  28. package/lib/{lemma.js → dom/lemma.js} +19 -9
  29. package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
  30. package/lib/dom/metaType.js +261 -0
  31. package/lib/dom/metatheorem.js +273 -0
  32. package/lib/dom/metavariable.js +463 -0
  33. package/lib/dom/premise.js +221 -0
  34. package/lib/dom/proof.js +154 -0
  35. package/lib/dom/proofStep.js +239 -0
  36. package/lib/dom/reference.js +218 -0
  37. package/lib/dom/rule.js +311 -0
  38. package/lib/dom/statement.js +379 -0
  39. package/lib/dom/subDerivation.js +137 -0
  40. package/lib/dom/subproof.js +211 -0
  41. package/lib/dom/supposition.js +221 -0
  42. package/lib/dom/term.js +354 -0
  43. package/lib/{theorem.js → dom/theorem.js} +18 -8
  44. package/lib/dom/topLevelAssertion.js +306 -0
  45. package/lib/dom/type.js +327 -0
  46. package/lib/dom/variable.js +328 -0
  47. package/lib/dom.js +27 -0
  48. package/lib/equivalences.js +307 -0
  49. package/lib/index.js +40 -35
  50. package/lib/mixins/proofStep/unify.js +86 -0
  51. package/lib/mixins/statement/verify.js +27 -2
  52. package/lib/mixins/term/verify.js +24 -4
  53. package/lib/substitution/frame.js +3 -3
  54. package/lib/substitution/statement.js +17 -16
  55. package/lib/substitution/term.js +10 -7
  56. package/lib/substitution.js +4 -31
  57. package/lib/substitutions.js +24 -56
  58. package/lib/unifier/equality.js +2 -3
  59. package/lib/unifier/label.js +3 -3
  60. package/lib/unifier/metaLevel.js +9 -8
  61. package/lib/unifier/metavariable.js +3 -3
  62. package/lib/unifier/statementWithCombinator.js +5 -5
  63. package/lib/unifier/termWithConstructor.js +3 -3
  64. package/lib/utilities/json.js +26 -40
  65. package/lib/utilities/string.js +6 -8
  66. package/lib/utilities/subproof.js +2 -2
  67. package/lib/utilities/substitutions.js +7 -6
  68. package/lib/utilities/verification.js +22 -14
  69. package/lib/verifier/combinator.js +4 -4
  70. package/lib/verifier/constructor.js +3 -3
  71. package/lib/verifier/topLevel.js +15 -21
  72. package/package.json +1 -1
  73. package/src/combinator/bracketed.js +11 -4
  74. package/src/combinator.js +3 -10
  75. package/src/constructor/bracketed.js +17 -5
  76. package/src/constructor.js +3 -9
  77. package/src/context/file.js +42 -11
  78. package/src/context/local.js +26 -34
  79. package/src/context/release.js +1 -1
  80. package/src/{assertion → dom/assertion}/contained.js +10 -8
  81. package/src/{assertion → dom/assertion}/defined.js +14 -11
  82. package/src/{assertion → dom/assertion}/subproof.js +11 -62
  83. package/src/{assertion → dom/assertion}/type.js +11 -8
  84. package/src/{axiom.js → dom/axiom.js} +6 -9
  85. package/src/dom/conclusion.js +95 -0
  86. package/src/{conjecture.js → dom/conjecture.js} +5 -8
  87. package/src/dom/consequent.js +95 -0
  88. package/src/{declaration → dom/declaration}/combinator.js +8 -5
  89. package/src/{declaration → dom/declaration}/constructor.js +8 -4
  90. package/src/{declaration → dom/declaration}/metavariable.js +8 -5
  91. package/src/{declaration → dom/declaration}/type.js +8 -4
  92. package/src/{declaration → dom/declaration}/variable.js +9 -6
  93. package/src/{declaration.js → dom/declaration.js} +11 -16
  94. package/src/{derivation.js → dom/derivation.js} +9 -12
  95. package/src/{equality.js → dom/equality.js} +11 -14
  96. package/src/{error.js → dom/error.js} +6 -3
  97. package/src/{frame.js → dom/frame.js} +14 -23
  98. package/src/{judgement.js → dom/judgement.js} +8 -11
  99. package/src/{label.js → dom/label.js} +9 -16
  100. package/src/{lemma.js → dom/lemma.js} +5 -9
  101. package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
  102. package/src/{metaType.js → dom/metaType.js} +7 -10
  103. package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
  104. package/src/{metavariable.js → dom/metavariable.js} +79 -77
  105. package/src/dom/premise.js +173 -0
  106. package/src/{proof.js → dom/proof.js} +8 -11
  107. package/src/dom/proofStep.js +173 -0
  108. package/src/{reference.js → dom/reference.js} +48 -20
  109. package/src/{rule.js → dom/rule.js} +13 -17
  110. package/src/{statement.js → dom/statement.js} +142 -71
  111. package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
  112. package/src/{subproof.js → dom/subproof.js} +14 -47
  113. package/src/dom/supposition.js +173 -0
  114. package/src/{term.js → dom/term.js} +24 -45
  115. package/src/{theorem.js → dom/theorem.js} +5 -8
  116. package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
  117. package/src/{type.js → dom/type.js} +9 -12
  118. package/src/{variable.js → dom/variable.js} +20 -28
  119. package/src/dom.js +13 -0
  120. package/src/equivalences.js +278 -0
  121. package/src/index.js +39 -34
  122. package/src/mixins/proofStep/unify.js +115 -0
  123. package/src/mixins/statement/verify.js +33 -1
  124. package/src/mixins/term/verify.js +33 -3
  125. package/src/substitution/frame.js +2 -2
  126. package/src/substitution/statement.js +20 -18
  127. package/src/substitution/term.js +12 -5
  128. package/src/substitution.js +4 -29
  129. package/src/substitutions.js +35 -73
  130. package/src/unifier/equality.js +1 -2
  131. package/src/unifier/label.js +2 -2
  132. package/src/unifier/metaLevel.js +9 -7
  133. package/src/unifier/metavariable.js +2 -2
  134. package/src/unifier/statementWithCombinator.js +4 -4
  135. package/src/unifier/termWithConstructor.js +2 -2
  136. package/src/utilities/json.js +23 -42
  137. package/src/utilities/string.js +8 -6
  138. package/src/utilities/subproof.js +2 -2
  139. package/src/utilities/substitutions.js +7 -5
  140. package/src/utilities/verification.js +29 -13
  141. package/src/verifier/combinator.js +3 -3
  142. package/src/verifier/constructor.js +3 -3
  143. package/src/verifier/topLevel.js +20 -21
  144. package/lib/assertion/contained.js +0 -232
  145. package/lib/assertion/defined.js +0 -211
  146. package/lib/assertion/subproof.js +0 -203
  147. package/lib/assertion/type.js +0 -185
  148. package/lib/conclusion.js +0 -130
  149. package/lib/consequent.js +0 -130
  150. package/lib/declaration/combinator.js +0 -90
  151. package/lib/declaration/constructor.js +0 -90
  152. package/lib/declaration/metavariable.js +0 -104
  153. package/lib/declaration/type.js +0 -90
  154. package/lib/declaration/variable.js +0 -105
  155. package/lib/derivation.js +0 -91
  156. package/lib/equality.js +0 -209
  157. package/lib/error.js +0 -70
  158. package/lib/frame.js +0 -331
  159. package/lib/judgement.js +0 -147
  160. package/lib/label.js +0 -141
  161. package/lib/metaType.js +0 -255
  162. package/lib/metatheorem.js +0 -263
  163. package/lib/metavariable.js +0 -399
  164. package/lib/mixins/statement/qualified/unify.js +0 -69
  165. package/lib/mixins/statement/unify.js +0 -42
  166. package/lib/mixins/statement/unifyIndependenntly.js +0 -46
  167. package/lib/mixins/term/unify.js +0 -40
  168. package/lib/premise.js +0 -184
  169. package/lib/proof.js +0 -103
  170. package/lib/proofStep.js +0 -179
  171. package/lib/reference.js +0 -145
  172. package/lib/rule.js +0 -259
  173. package/lib/shim.js +0 -14
  174. package/lib/statement/qualified.js +0 -152
  175. package/lib/statement/unqualified.js +0 -175
  176. package/lib/statement.js +0 -270
  177. package/lib/subDerivation.js +0 -91
  178. package/lib/subproof.js +0 -181
  179. package/lib/supposition.js +0 -184
  180. package/lib/term.js +0 -318
  181. package/lib/topLevelAssertion.js +0 -305
  182. package/lib/type.js +0 -321
  183. package/lib/utilities/equivalences.js +0 -178
  184. package/lib/variable.js +0 -281
  185. package/src/conclusion.js +0 -96
  186. package/src/consequent.js +0 -96
  187. package/src/mixins/statement/qualified/unify.js +0 -103
  188. package/src/mixins/statement/unify.js +0 -41
  189. package/src/mixins/statement/unifyIndependenntly.js +0 -58
  190. package/src/mixins/term/unify.js +0 -36
  191. package/src/premise.js +0 -183
  192. package/src/proofStep.js +0 -181
  193. package/src/shim.js +0 -5
  194. package/src/statement/qualified.js +0 -133
  195. package/src/statement/unqualified.js +0 -166
  196. package/src/supposition.js +0 -183
  197. package/src/utilities/equivalences.js +0 -183
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
 
3
- import shim from "./shim";
4
- import JudgementAssignment from "./assignment/judgement";
3
+ import dom from "../dom";
4
+ import JudgementAssignment from "../assignment/judgement";
5
5
 
6
- import { nodeQuery } from "./utilities/query";
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 } = shim,
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 shim from "./shim";
4
- import LocalContext from "./context/local";
3
+ import dom from "../dom";
4
+ import LocalContext from "../context/local";
5
5
 
6
- import { nodeQuery } from "./utilities/query";
7
- import { metavariableFromJSON, metavariableToMetavariableJSON } from "./utilities/json";
6
+ import { domAssigned } from "../dom";
7
+ import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
8
8
 
9
- const metavariableNodeQuery = nodeQuery("//label/metavariable");
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 } = shim,
89
- metavariableNode = metavariableNodeQuery(labelNode),
88
+ const { Metavariable } = dom,
90
89
  localContext = LocalContext.fromFileContext(fileContext),
91
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
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 { EMPTY_STRING } from "./constants";
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 fromLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(Lemma, metaLemmaNode, fileContext); }
36
- }
35
+ static name = "Lemma";
37
36
 
38
- Object.assign(shim, {
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 shim from "./shim";
4
- import LocalContext from "./context/local";
3
+ import LocalContext from "../context/local";
5
4
  import TopLevelAssertion from "./topLevelAssertion";
6
5
 
7
- class MetaLemma extends TopLevelAssertion {
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 fromMetaLemmaNode(metaLemmaNode, fileContext) { return TopLevelAssertion.fromNode(MetaLemma, metaLemmaNode, fileContext); }
105
- }
105
+ static name = "MetaLemma";
106
106
 
107
- Object.assign(shim, {
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 shim from "./shim";
4
-
5
- import { nodeQuery } from "./utilities/query";
6
- import { metaTypeNameFromMetaTypeNode } from "./utilities/name";
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
- Object.assign(shim, {
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 shim from "./shim";
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 "./utilities/json";
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 shim from "./shim";
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 "./type";
11
- import { EMPTY_STRING } from "./constants";
12
- import { unifyMetavariable } from "./utilities/unification";
13
- import { typeFromJSON, typeToTypeJSON } from "./utilities/json";
14
- import { metavariableNameFromMetavariableNode } from "./utilities/name";
15
- import { metaTypeFromJSON, metaTypeToMetaTypeJSON } from "./utilities/json";
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
- statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!");
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(metavariable) {
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
- equalTo = (metavariableString === this.string);
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
- isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
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
- essentiallyEqualToFrame = true;
90
+ effectivelyEqualToFrame = true;
93
91
  }
94
92
  }
95
93
 
96
- return essentiallyEqualToFrame;
94
+ return effectivelyEqualToFrame;
97
95
  }
98
96
 
99
- isEssentiallyEqualToStatement(statement, generalContext, specificContext) {
100
- let essentiallyEqualToStatement = false;
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
- essentiallyEqualToStatement = true;
107
+ effectivelyEqualToStatement = true;
110
108
  }
111
109
  }
112
110
 
113
- return essentiallyEqualToStatement;
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 essentiallyEqualToFrame = this.isEssentiallyEqualToFrame(frame, generalContext, specificContext);
122
+ const effectivelyEqualToFrame = this.isEffectivelyEqualToFrame(frame, generalContext, specificContext);
125
123
 
126
- if (essentiallyEqualToFrame) {
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 essentiallyEqualToStatement = this.isEssentiallyEqualToStatement(statement, generalContext, specificContext);
168
+ const effectivelyEqualToStatement = this.isEffectivelyEqualToStatement(statement, generalContext, specificContext);
171
169
 
172
- if (essentiallyEqualToStatement) {
170
+ if (effectivelyEqualToStatement) {
173
171
  statementUnified = true;
174
172
  } else {
175
- const metavariable = this, ///
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 context = specificContext, ///
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 against the '${generalMetavariableString}' 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 against the '${generalMetavariableString}' 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
- metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
409
- name = metavariableName, ///
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
- metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
430
- name = metavariableName, ///
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
- const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
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 } = shim,
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
- export default Metavariable;
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
+ }