occam-verify-cli 1.0.230 → 1.0.233
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/context/local.js +1 -14
- package/lib/dom/axiom.js +22 -16
- package/lib/dom/combinator.js +5 -5
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/conjecture.js +9 -9
- package/lib/dom/constructor.js +5 -5
- package/lib/dom/declaration/combinator.js +14 -14
- package/lib/dom/declaration/complexType.js +35 -35
- package/lib/dom/declaration/constructor.js +19 -19
- package/lib/dom/declaration/metavariable.js +22 -22
- package/lib/dom/declaration/simpleType.js +23 -23
- package/lib/dom/declaration/variable.js +20 -20
- package/lib/dom/declaration.js +4 -2
- package/lib/dom/deduction.js +5 -5
- package/lib/dom/derivation.js +5 -5
- package/lib/dom/error.js +9 -9
- package/lib/dom/hypothesis.js +260 -0
- package/lib/dom/label.js +18 -24
- package/lib/dom/lemma.js +7 -7
- package/lib/dom/metaLemma.js +9 -9
- package/lib/dom/metaType.js +4 -10
- package/lib/dom/metatheorem.js +9 -9
- package/lib/dom/metavariable.js +7 -8
- package/lib/dom/parameter.js +2 -2
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +11 -10
- package/lib/dom/proof.js +3 -3
- package/lib/dom/property.js +9 -9
- package/lib/dom/reference.js +23 -22
- package/lib/dom/rule.js +25 -25
- package/lib/dom/section.js +146 -0
- package/lib/dom/signature.js +5 -5
- package/lib/dom/statement.js +25 -20
- package/lib/dom/step.js +3 -3
- package/lib/dom/subDerivation.js +5 -5
- package/lib/dom/subproof.js +7 -7
- package/lib/dom/substitution/statement.js +3 -3
- package/lib/dom/supposition.js +5 -5
- package/lib/dom/term.js +5 -6
- package/lib/dom/theorem.js +9 -9
- package/lib/dom/topLevelAssertion.js +22 -22
- package/lib/dom/topLevelMetaAssertion.js +14 -14
- package/lib/dom/type.js +21 -21
- package/lib/dom/variable.js +9 -15
- package/lib/index.js +3 -1
- package/lib/node/hypothesis.js +123 -0
- package/lib/node/section.js +116 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/json.js +59 -59
- package/lib/utilities/subproof.js +10 -10
- package/lib/verifier/combinator.js +9 -10
- package/lib/verifier/constructor.js +10 -11
- package/lib/verifier/topLevel.js +38 -31
- package/package.json +2 -2
- package/src/context/local.js +0 -14
- package/src/dom/axiom.js +30 -29
- package/src/dom/combinator.js +4 -4
- package/src/dom/conclusion.js +5 -5
- package/src/dom/conjecture.js +8 -8
- package/src/dom/constructor.js +4 -4
- package/src/dom/declaration/combinator.js +14 -14
- package/src/dom/declaration/complexType.js +35 -35
- package/src/dom/declaration/constructor.js +20 -20
- package/src/dom/declaration/metavariable.js +22 -22
- package/src/dom/declaration/simpleType.js +22 -22
- package/src/dom/declaration/variable.js +21 -21
- package/src/dom/declaration.js +5 -3
- package/src/dom/deduction.js +5 -5
- package/src/dom/derivation.js +5 -5
- package/src/dom/error.js +8 -8
- package/src/dom/hypothesis.js +230 -0
- package/src/dom/label.js +17 -19
- package/src/dom/lemma.js +8 -8
- package/src/dom/metaLemma.js +8 -8
- package/src/dom/metaType.js +2 -6
- package/src/dom/metatheorem.js +8 -8
- package/src/dom/metavariable.js +9 -12
- package/src/dom/parameter.js +1 -1
- package/src/dom/premise.js +8 -8
- package/src/dom/procedureCall.js +9 -9
- package/src/dom/proof.js +2 -2
- package/src/dom/property.js +8 -8
- package/src/dom/reference.js +23 -27
- package/src/dom/rule.js +30 -30
- package/src/dom/section.js +70 -0
- package/src/dom/signature.js +4 -4
- package/src/dom/statement.js +24 -32
- package/src/dom/step.js +4 -4
- package/src/dom/subDerivation.js +5 -5
- package/src/dom/subproof.js +8 -8
- package/src/dom/substitution/statement.js +5 -5
- package/src/dom/supposition.js +7 -7
- package/src/dom/term.js +3 -8
- package/src/dom/theorem.js +7 -7
- package/src/dom/topLevelAssertion.js +29 -30
- package/src/dom/topLevelMetaAssertion.js +20 -20
- package/src/dom/type.js +22 -22
- package/src/dom/variable.js +8 -11
- package/src/index.js +2 -0
- package/src/node/hypothesis.js +23 -0
- package/src/node/section.js +16 -0
- package/src/nonTerminalNodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/utilities/json.js +58 -58
- package/src/utilities/subproof.js +10 -10
- package/src/verifier/combinator.js +6 -11
- package/src/verifier/constructor.js +9 -12
- package/src/verifier/topLevel.js +42 -30
package/src/dom/conclusion.js
CHANGED
|
@@ -74,19 +74,19 @@ export default domAssigned(class Conclusion {
|
|
|
74
74
|
|
|
75
75
|
static name = "Conclusion";
|
|
76
76
|
|
|
77
|
-
static fromJSON(json,
|
|
78
|
-
const statement = statementFromJSON(json,
|
|
77
|
+
static fromJSON(json, context) {
|
|
78
|
+
const statement = statementFromJSON(json, context),
|
|
79
79
|
string = statement.getString(),
|
|
80
80
|
conclusion = new Conclusion(string, statement);
|
|
81
81
|
|
|
82
82
|
return conclusion;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
static fromConclusionNode(conclusionNode,
|
|
85
|
+
static fromConclusionNode(conclusionNode, context) {
|
|
86
86
|
const { Statement } = dom,
|
|
87
87
|
node = conclusionNode, ///
|
|
88
|
-
string =
|
|
89
|
-
statement = Statement.fromConclusionNode(conclusionNode,
|
|
88
|
+
string = context.nodeAsString(node),
|
|
89
|
+
statement = Statement.fromConclusionNode(conclusionNode, context),
|
|
90
90
|
conclusion = new Conclusion(string, statement);
|
|
91
91
|
|
|
92
92
|
return conclusion;
|
package/src/dom/conjecture.js
CHANGED
|
@@ -8,20 +8,20 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const context = this.getContext(),
|
|
12
|
+
conjecture = this, ///
|
|
13
13
|
conjectureString = conjecture.getString();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
context.trace(`Verifying the '${conjectureString}' conjecture...`);
|
|
16
16
|
|
|
17
17
|
verifies = super.verify();
|
|
18
18
|
|
|
19
19
|
if (verifies) {
|
|
20
20
|
const conjecture = this; ///
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
context.addConjecture(conjecture);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
context.debug(`...verified the '${conjectureString}' conjecture.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return verifies;
|
|
@@ -29,11 +29,11 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
29
29
|
|
|
30
30
|
static name = "Conjecture";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json,
|
|
32
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Conjecture, json, context); }
|
|
33
33
|
|
|
34
|
-
static fromConjectureNode(conjectureNode,
|
|
34
|
+
static fromConjectureNode(conjectureNode, context) {
|
|
35
35
|
const node = conjectureNode, ///
|
|
36
|
-
conjecture = TopLevelAssertion.fromNode(Conjecture, node,
|
|
36
|
+
conjecture = TopLevelAssertion.fromNode(Conjecture, node, context);
|
|
37
37
|
|
|
38
38
|
return conjecture;
|
|
39
39
|
}
|
package/src/dom/constructor.js
CHANGED
|
@@ -67,17 +67,17 @@ export default domAssigned(class Constructor {
|
|
|
67
67
|
return json;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
static fromJSON(json,
|
|
71
|
-
const term = termFromJSON(json,
|
|
70
|
+
static fromJSON(json, context) {
|
|
71
|
+
const term = termFromJSON(json, context),
|
|
72
72
|
string = stringFromTerm(term),
|
|
73
73
|
constructor = new Constructor(string, term);
|
|
74
74
|
|
|
75
75
|
return constructor;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
78
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
79
79
|
const { Term } = dom,
|
|
80
|
-
term = Term.fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
80
|
+
term = Term.fromConstructorDeclarationNode(constructorDeclarationNode, context),
|
|
81
81
|
string = stringFromTerm(term),
|
|
82
82
|
constructor = new Constructor(string, term);
|
|
83
83
|
|
|
@@ -7,14 +7,14 @@ import { domAssigned } from "../../dom";
|
|
|
7
7
|
import combinatorVerifier from "../../verifier/combinator";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class CombinatorDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, combinator) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.combinator = combinator;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -30,18 +30,18 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
30
30
|
|
|
31
31
|
const combinatorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
this.
|
|
33
|
+
this.context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
34
34
|
|
|
35
35
|
const combinatorVerifies = this.verifyCombinator();
|
|
36
36
|
|
|
37
37
|
if (combinatorVerifies) {
|
|
38
|
-
this.
|
|
38
|
+
this.context.addCombinator(this.combinator);
|
|
39
39
|
|
|
40
40
|
verifies = true;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (verifies) {
|
|
44
|
-
this.
|
|
44
|
+
this.context.debug(`...verified the '${combinatorDeclarationString}' combinator declaration.`);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return verifies;
|
|
@@ -52,15 +52,15 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
52
52
|
|
|
53
53
|
const combinatorString = this.combinator.getString();
|
|
54
54
|
|
|
55
|
-
this.
|
|
55
|
+
this.context.trace(`Verifying the '${combinatorString}' combinator...`);
|
|
56
56
|
|
|
57
57
|
const statement = this.combinator.getStatement(),
|
|
58
58
|
statementNode = statement.getNode();
|
|
59
59
|
|
|
60
|
-
statementVerifies = combinatorVerifier.verifyStatement(statementNode, this.
|
|
60
|
+
statementVerifies = combinatorVerifier.verifyStatement(statementNode, this.context);
|
|
61
61
|
|
|
62
62
|
if (statementVerifies) {
|
|
63
|
-
this.
|
|
63
|
+
this.context.debug(`...verified the '${combinatorString}' combinator.`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return statementVerifies;
|
|
@@ -68,12 +68,12 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
68
68
|
|
|
69
69
|
static name = "CombinatorDeclaration";
|
|
70
70
|
|
|
71
|
-
static fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
71
|
+
static fromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
|
|
72
72
|
const { Combinator } = dom,
|
|
73
73
|
node = combinatorDeclarationNode, ///
|
|
74
|
-
string =
|
|
75
|
-
combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
76
|
-
combinatorDeclaration = new CombinatorDeclaration(
|
|
74
|
+
string = context.nodeAsString(node),
|
|
75
|
+
combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, context),
|
|
76
|
+
combinatorDeclaration = new CombinatorDeclaration(context, string, combinator);
|
|
77
77
|
|
|
78
78
|
return combinatorDeclaration;
|
|
79
79
|
}
|
|
@@ -7,14 +7,14 @@ import { domAssigned } from "../../dom";
|
|
|
7
7
|
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class ComplexTypeDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, type) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.type = type;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -25,16 +25,16 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
25
25
|
return this.type;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
getReleaseContext() { return this.
|
|
28
|
+
getReleaseContext() { return this.context.getReleaseContext(); }
|
|
29
29
|
|
|
30
30
|
getReleaseTypes() {
|
|
31
31
|
const includeDependencies = false,
|
|
32
32
|
includeRelease = false,
|
|
33
33
|
releaseContext = this.getReleaseContext(),
|
|
34
|
-
|
|
34
|
+
contextTypes = this.context.getTypes(includeRelease),
|
|
35
35
|
releaseContextTypes = releaseContext.getTypes(includeDependencies),
|
|
36
36
|
releaseTypes = [
|
|
37
|
-
...
|
|
37
|
+
...contextTypes,
|
|
38
38
|
...releaseContextTypes
|
|
39
39
|
];
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
46
46
|
|
|
47
47
|
const complexTypeDeclarationString = this.getString();
|
|
48
48
|
|
|
49
|
-
this.
|
|
49
|
+
this.context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`);
|
|
50
50
|
|
|
51
51
|
const typeVerifies = this.verifyType();
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
57
57
|
const propertiesVerify = this.verifyProperties();
|
|
58
58
|
|
|
59
59
|
if (propertiesVerify) {
|
|
60
|
-
this.
|
|
60
|
+
this.context.addType(this.type);
|
|
61
61
|
|
|
62
62
|
verifies = true;
|
|
63
63
|
}
|
|
@@ -65,7 +65,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (verifies) {
|
|
68
|
-
this.
|
|
68
|
+
this.context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
return verifies;
|
|
@@ -76,7 +76,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
76
76
|
|
|
77
77
|
const complexTypeString = this.type.getString();
|
|
78
78
|
|
|
79
|
-
this.
|
|
79
|
+
this.context.trace(`Verifying the '${complexTypeString}' complex type...`);
|
|
80
80
|
|
|
81
81
|
const typeName = this.type.getName(),
|
|
82
82
|
releaseTypes = this.getReleaseTypes(),
|
|
@@ -89,13 +89,13 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
if (typePresent) {
|
|
92
|
-
this.
|
|
92
|
+
this.context.debug(`The type '${complexTypeString}' is already present in the package.`);
|
|
93
93
|
} else {
|
|
94
94
|
typeVerifies = true;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (typeVerifies) {
|
|
98
|
-
this.
|
|
98
|
+
this.context.debug(`...verified the '${complexTypeString}' complex type.`);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
return typeVerifies;
|
|
@@ -106,17 +106,17 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
106
106
|
|
|
107
107
|
const superTypeString = superType.getString();
|
|
108
108
|
|
|
109
|
-
this.
|
|
109
|
+
this.context.trace(`Verifying the '${superTypeString}' super-type...`);
|
|
110
110
|
|
|
111
111
|
const superTypeName = superType.getName(),
|
|
112
|
-
superTypePresent = this.
|
|
112
|
+
superTypePresent = this.context.isTypePresentByTypeName(superTypeName);
|
|
113
113
|
|
|
114
114
|
if (superTypePresent) {
|
|
115
115
|
superTypeVerifies = true;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
if (superTypeVerifies) {
|
|
119
|
-
this.
|
|
119
|
+
this.context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
return superTypeVerifies;
|
|
@@ -125,7 +125,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
125
125
|
verifySuperTypes() {
|
|
126
126
|
let superTypesVerify = false;
|
|
127
127
|
|
|
128
|
-
this.
|
|
128
|
+
this.context.trace(`Verifying the super-types...`);
|
|
129
129
|
|
|
130
130
|
let superTypes;
|
|
131
131
|
|
|
@@ -135,7 +135,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
135
135
|
superTypesLength = superTypes.length;
|
|
136
136
|
|
|
137
137
|
if (superTypesLength === 0) {
|
|
138
|
-
const type = this.
|
|
138
|
+
const type = this.context.findTypeByTypeName(typeName);
|
|
139
139
|
|
|
140
140
|
if (type === null) {
|
|
141
141
|
const superType = objectType; ///
|
|
@@ -150,7 +150,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
150
150
|
if (typeBasic) {
|
|
151
151
|
superTypesVerify = true;
|
|
152
152
|
|
|
153
|
-
this.
|
|
153
|
+
this.context.trace(`The '${typeString}' type is basic.`)
|
|
154
154
|
} else {
|
|
155
155
|
const superTypeNames = superTypes.map((superType) => {
|
|
156
156
|
const superTypeName = superType.getName();
|
|
@@ -160,10 +160,10 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
160
160
|
superTypeNamesIncludesTypeName = superTypeNames.includes(typeName);
|
|
161
161
|
|
|
162
162
|
if (superTypeNamesIncludesTypeName) {
|
|
163
|
-
this.
|
|
163
|
+
this.context.trace(`The '${typeName}' type cannot be a super-type `);
|
|
164
164
|
} else {
|
|
165
165
|
if (superTypesLength === 0) {
|
|
166
|
-
const type = this.
|
|
166
|
+
const type = this.context.findTypeByTypeName(typeName),
|
|
167
167
|
superType = type; ///
|
|
168
168
|
|
|
169
169
|
superTypes.push(superType);
|
|
@@ -181,7 +181,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
181
181
|
superTypes = superTypes.map((superType) => {
|
|
182
182
|
const superTypeName = superType.getName();
|
|
183
183
|
|
|
184
|
-
superType = this.
|
|
184
|
+
superType = this.context.findTypeByTypeName(superTypeName);
|
|
185
185
|
|
|
186
186
|
return superType;
|
|
187
187
|
});
|
|
@@ -197,7 +197,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
if (superTypesVerify) {
|
|
200
|
-
this.
|
|
200
|
+
this.context.debug(`...verified the super-types.`);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
return superTypesVerify;
|
|
@@ -208,7 +208,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
208
208
|
|
|
209
209
|
const propertyString = property.getString();
|
|
210
210
|
|
|
211
|
-
this.
|
|
211
|
+
this.context.trace(`Verifying the '${propertyString}' property...`);
|
|
212
212
|
|
|
213
213
|
const propertyName = property.getName(),
|
|
214
214
|
count = properties.reduce((count, property) => {
|
|
@@ -222,7 +222,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
222
222
|
}, 0);
|
|
223
223
|
|
|
224
224
|
if (count > 1) {
|
|
225
|
-
this.
|
|
225
|
+
this.context.debug(`The '${propertyString}' property appears more than once.`);
|
|
226
226
|
} else {
|
|
227
227
|
const superTypeProperty = superTypeProperties.find((superTypeProperty) => {
|
|
228
228
|
const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
|
|
@@ -235,7 +235,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
235
235
|
if (superTypeProperty !== null) {
|
|
236
236
|
const superTypePropertyString = superTypeProperty.getString();
|
|
237
237
|
|
|
238
|
-
this.
|
|
238
|
+
this.context.debug(`The '${propertyString}' property matches the super-type's '${superTypePropertyString}' property.`);
|
|
239
239
|
} else {
|
|
240
240
|
let propertyType;
|
|
241
241
|
|
|
@@ -246,7 +246,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
246
246
|
if (propertyTypeVerifies) {
|
|
247
247
|
const propertyTypeName = propertyType.getName();
|
|
248
248
|
|
|
249
|
-
propertyType = this.
|
|
249
|
+
propertyType = this.context.findTypeByTypeName(propertyTypeName);
|
|
250
250
|
|
|
251
251
|
const type = propertyType; ///
|
|
252
252
|
|
|
@@ -265,7 +265,7 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
265
265
|
property.setType(this.type);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
this.
|
|
268
|
+
this.context.debug(`verifies the '${propertyString}' property.`);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
return propertyVerifies;
|
|
@@ -306,21 +306,21 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
306
306
|
} else {
|
|
307
307
|
const propertyTypeString = propertyType.getString(); ///
|
|
308
308
|
|
|
309
|
-
this.
|
|
309
|
+
this.context.trace(`Verifying the '${propertyTypeString}' property type...`);
|
|
310
310
|
|
|
311
311
|
const propertyTypeName = propertyType.getName(),
|
|
312
|
-
propertyTypePresent = this.
|
|
312
|
+
propertyTypePresent = this.context.isTypePresentByTypeName(propertyTypeName);
|
|
313
313
|
|
|
314
314
|
if (!propertyTypePresent) {
|
|
315
315
|
const propertyTypeString = propertyType.getString();
|
|
316
316
|
|
|
317
|
-
this.
|
|
317
|
+
this.context.debug(`The '${propertyTypeString}' property type is not present.`);
|
|
318
318
|
} else {
|
|
319
319
|
propertyTypeVerifies = true;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
if (propertyTypeVerifies) {
|
|
323
|
-
this.
|
|
323
|
+
this.context.debug(`...verified the '${propertyTypeString}' property type.`);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
@@ -329,13 +329,13 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
329
329
|
|
|
330
330
|
static name = "ComplexTypeDeclaration";
|
|
331
331
|
|
|
332
|
-
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode,
|
|
332
|
+
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
333
333
|
const { Type } = dom,
|
|
334
|
-
type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode,
|
|
334
|
+
type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
335
335
|
typeName = type.getName(),
|
|
336
336
|
superTypes = type.getSuperTypes(),
|
|
337
337
|
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
338
|
-
complexTypeDeclaration = new ComplexTypeDeclaration(
|
|
338
|
+
complexTypeDeclaration = new ComplexTypeDeclaration(context, string, type);
|
|
339
339
|
|
|
340
340
|
return complexTypeDeclaration;
|
|
341
341
|
}
|
|
@@ -7,14 +7,14 @@ import constructorVerifier from "../../verifier/constructor";
|
|
|
7
7
|
import { domAssigned } from "../../dom";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class ConstructorDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, constructor) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.constructor = constructor;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -30,7 +30,7 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
30
30
|
|
|
31
31
|
const constructorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
this.
|
|
33
|
+
this.context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
34
34
|
|
|
35
35
|
const constructorTypeVerifies = this.verifyConstructorType();
|
|
36
36
|
|
|
@@ -38,14 +38,14 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
38
38
|
const constructorVerifies = this.verifyConstructor();
|
|
39
39
|
|
|
40
40
|
if (constructorVerifies) {
|
|
41
|
-
this.
|
|
41
|
+
this.context.addConstructor(this.constructor);
|
|
42
42
|
|
|
43
43
|
verifies = true;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (verifies) {
|
|
48
|
-
this.
|
|
48
|
+
this.context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return verifies;
|
|
@@ -56,15 +56,15 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
56
56
|
|
|
57
57
|
const constructorString = this.constructor.getString();
|
|
58
58
|
|
|
59
|
-
this.
|
|
59
|
+
this.context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
60
60
|
|
|
61
61
|
const term = this.constructor.getTerm(),
|
|
62
62
|
termNode = term.getNode();
|
|
63
63
|
|
|
64
|
-
constructorVerifies = constructorVerifier.verifyTerm(termNode, this.
|
|
64
|
+
constructorVerifies = constructorVerifier.verifyTerm(termNode, this.context);
|
|
65
65
|
|
|
66
66
|
if (constructorVerifies) {
|
|
67
|
-
this.
|
|
67
|
+
this.context.debug(`...verified the '${constructorString}' constructor.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return constructorVerifies;
|
|
@@ -80,24 +80,24 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
80
80
|
const typeName = type.getName(),
|
|
81
81
|
typeString = type.getString();
|
|
82
82
|
|
|
83
|
-
this.
|
|
83
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
84
84
|
|
|
85
85
|
const includeSupertypes = false,
|
|
86
86
|
provisional = type.isProvisional(includeSupertypes);
|
|
87
87
|
|
|
88
|
-
type = this.
|
|
88
|
+
type = this.context.findTypeByTypeName(typeName);
|
|
89
89
|
|
|
90
90
|
const typePresent = (type !== null)
|
|
91
91
|
|
|
92
92
|
if (!typePresent) {
|
|
93
|
-
this.
|
|
93
|
+
this.context.debug(`The '${typeString}' type is not present.`);
|
|
94
94
|
} else {
|
|
95
95
|
const provisionalMatches = type.matchProvisional(provisional);
|
|
96
96
|
|
|
97
97
|
if (!provisionalMatches) {
|
|
98
98
|
provisional ?
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
99
|
+
this.context.debug(`The '${typeString}' type is present but not provisional.`) :
|
|
100
|
+
this.context.debug(`The '${typeString}' type is present but provisional.`);
|
|
101
101
|
} else {
|
|
102
102
|
this.constructor.setType(type);
|
|
103
103
|
|
|
@@ -106,7 +106,7 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
if (constructorTypeVerifies) {
|
|
109
|
-
this.
|
|
109
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
return constructorTypeVerifies;
|
|
@@ -114,12 +114,12 @@ export default domAssigned(class ConstructorDeclaration {
|
|
|
114
114
|
|
|
115
115
|
static name = "ConstructorDeclaration";
|
|
116
116
|
|
|
117
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
117
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
118
118
|
const { Constructor } = dom,
|
|
119
119
|
node = constructorDeclarationNode, ///
|
|
120
|
-
string =
|
|
121
|
-
constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
122
|
-
constructorDeclaration = new ConstructorDeclaration(
|
|
120
|
+
string = context.nodeAsString(node),
|
|
121
|
+
constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, context),
|
|
122
|
+
constructorDeclaration = new ConstructorDeclaration(context, string, constructor);
|
|
123
123
|
|
|
124
124
|
return constructorDeclaration;
|
|
125
125
|
}
|
|
@@ -5,14 +5,14 @@ import dom from "../../dom";
|
|
|
5
5
|
import { domAssigned } from "../../dom";
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class MetavariableDeclaration {
|
|
8
|
-
constructor(
|
|
9
|
-
this.
|
|
8
|
+
constructor(context, string, metavariable) {
|
|
9
|
+
this.context = context;
|
|
10
10
|
this.string = string;
|
|
11
11
|
this.metavariable = metavariable;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
return this.
|
|
14
|
+
getContext() {
|
|
15
|
+
return this.context;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getString() {
|
|
@@ -28,18 +28,18 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
28
28
|
|
|
29
29
|
const metavariableDeclarationString = this.string; ///
|
|
30
30
|
|
|
31
|
-
this.
|
|
31
|
+
this.context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
|
|
32
32
|
|
|
33
33
|
const metavariableVerifies = this.verifyMetavariable(this.metavariable);
|
|
34
34
|
|
|
35
35
|
if (metavariableVerifies) {
|
|
36
|
-
this.
|
|
36
|
+
this.context.addMetavariable(this.metavariable);
|
|
37
37
|
|
|
38
38
|
verifies = true;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (verifies) {
|
|
42
|
-
this.
|
|
42
|
+
this.context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return verifies;
|
|
@@ -54,18 +54,18 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
54
54
|
const typeName = type.getName(),
|
|
55
55
|
typeString = type.getString();
|
|
56
56
|
|
|
57
|
-
this.
|
|
57
|
+
this.context.trace(`Verifying the '${typeString}' type...`);
|
|
58
58
|
|
|
59
|
-
const typePresent = this.
|
|
59
|
+
const typePresent = this.context.isTypePresentByTypeName(typeName);
|
|
60
60
|
|
|
61
61
|
if (!typePresent) {
|
|
62
|
-
this.
|
|
62
|
+
this.context.debug(`The '${typeString}' type is not present.`);
|
|
63
63
|
} else {
|
|
64
64
|
typeVerifies = true;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (typeVerifies) {
|
|
68
|
-
this.
|
|
68
|
+
this.context.debug(`...verified the '${typeString}' type.`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -77,19 +77,19 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
77
77
|
|
|
78
78
|
const metavariableString = metavariable.getString();
|
|
79
79
|
|
|
80
|
-
this.
|
|
80
|
+
this.context.trace(`Verifying the '${metavariableString}' metavariable when declared...`);
|
|
81
81
|
|
|
82
82
|
const metavariableNode = metavariable.getNode(), ///
|
|
83
83
|
termNode = metavariableNode.getTermNode();
|
|
84
84
|
|
|
85
85
|
if (termNode !== null) {
|
|
86
|
-
this.
|
|
86
|
+
this.context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
|
|
87
87
|
} else {
|
|
88
88
|
const metavariableName = metavariable.getName(),
|
|
89
|
-
metavariablePresent = this.
|
|
89
|
+
metavariablePresent = this.context.isMetavariablePresentByMetavariableName(metavariableName);
|
|
90
90
|
|
|
91
91
|
if (metavariablePresent) {
|
|
92
|
-
this.
|
|
92
|
+
this.context.debug(`The '${metavariableName}' metavariable is already present.`);
|
|
93
93
|
} else {
|
|
94
94
|
const type = metavariable.getType(),
|
|
95
95
|
typeVerifies = this.verifyType(type);
|
|
@@ -99,7 +99,7 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (metavariableVerifies) {
|
|
102
|
-
this.
|
|
102
|
+
this.context.debug(`...verified the '${metavariableString}' metavariable when declared.`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return metavariableVerifies;
|
|
@@ -107,12 +107,12 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
107
107
|
|
|
108
108
|
static name = "MetavariableDeclaration";
|
|
109
109
|
|
|
110
|
-
static fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
110
|
+
static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
111
111
|
const { Metavariable } = dom,
|
|
112
|
-
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
113
|
-
metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
112
|
+
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
113
|
+
metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
114
114
|
string = stringFromMetavariableAndMetaType(metavariable, metaType),
|
|
115
|
-
metavariableDeclaration = new MetavariableDeclaration(
|
|
115
|
+
metavariableDeclaration = new MetavariableDeclaration(context, string, metavariable);
|
|
116
116
|
|
|
117
117
|
return metavariableDeclaration;
|
|
118
118
|
}
|
|
@@ -134,10 +134,10 @@ function stringFromMetavariableAndMetaType(metavariable, metaType) {
|
|
|
134
134
|
return string;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode,
|
|
137
|
+
function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
138
138
|
const { MetaType } = dom,
|
|
139
139
|
metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
|
|
140
|
-
metaType = MetaType.fromMetaTypeNode(metaTypeNode,
|
|
140
|
+
metaType = MetaType.fromMetaTypeNode(metaTypeNode, context);
|
|
141
141
|
|
|
142
142
|
return metaType;
|
|
143
143
|
}
|