occam-verify-cli 1.0.396 → 1.0.404
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/assignment/equality.js +2 -2
- package/lib/context/file.js +4 -5
- package/lib/context/local.js +17 -6
- package/lib/context/partial.js +10 -10
- package/lib/context/temporary.js +102 -52
- package/lib/mixins/step/unify.js +5 -6
- package/lib/node/argument.js +4 -4
- package/lib/node/assertion/contained.js +6 -6
- package/lib/node/assertion/defined.js +6 -6
- package/lib/node/assertion/property.js +6 -6
- package/lib/node/assertion/satisfies.js +6 -6
- package/lib/node/assertion/subproof.js +6 -6
- package/lib/node/assertion/type.js +6 -6
- package/lib/node/assertion.js +107 -0
- package/lib/node/assumption.js +134 -0
- package/lib/node/axiom.js +6 -6
- package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
- package/lib/node/body.js +4 -5
- package/lib/node/combinator.js +4 -4
- package/lib/node/conclusion.js +4 -4
- package/lib/node/conjecture.js +6 -6
- package/lib/node/constructor.js +4 -4
- package/lib/node/declaration/combinator.js +6 -6
- package/lib/node/declaration/complexType.js +6 -6
- package/lib/node/declaration/constructor.js +6 -6
- package/lib/node/declaration/metavariable.js +6 -6
- package/lib/node/declaration/property.js +6 -6
- package/lib/node/declaration/simpleType.js +6 -6
- package/lib/node/declaration/typePrefix.js +6 -6
- package/lib/node/declaration/variable.js +6 -6
- package/lib/node/declaration.js +6 -22
- package/lib/node/deduction.js +4 -4
- package/lib/node/derivation.js +4 -4
- package/lib/node/document.js +107 -0
- package/lib/node/equality.js +4 -4
- package/lib/node/error.js +4 -4
- package/lib/node/frame.js +25 -14
- package/lib/node/header.js +4 -4
- package/lib/node/hypothesis.js +4 -4
- package/lib/node/judgement.js +8 -8
- package/lib/node/label.js +4 -4
- package/lib/node/labels.js +4 -4
- package/lib/node/lemma.js +6 -6
- package/lib/node/metaArgument.js +4 -4
- package/lib/node/metaLemma.js +6 -6
- package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
- package/lib/node/metaType.js +4 -4
- package/lib/node/metatheorem.js +6 -6
- package/lib/node/metavariable.js +4 -4
- package/lib/node/nonsense.js +4 -4
- package/lib/node/parameter.js +4 -4
- package/lib/node/parenthesisedLabel.js +4 -4
- package/lib/node/parenthesisedLabels.js +4 -4
- package/lib/node/placeholder.js +107 -0
- package/lib/node/premise.js +4 -4
- package/lib/node/procedureCall.js +4 -4
- package/lib/node/procedureReference.js +4 -4
- package/lib/node/proof.js +4 -4
- package/lib/node/property.js +4 -4
- package/lib/node/propertyRelation.js +4 -4
- package/lib/node/qualification.js +4 -4
- package/lib/node/reference.js +4 -4
- package/lib/node/rule.js +4 -4
- package/lib/node/section.js +4 -4
- package/lib/node/signature.js +4 -4
- package/lib/node/statement.js +15 -4
- package/lib/node/step.js +4 -4
- package/lib/node/subDerivation.js +4 -4
- package/lib/node/subproof.js +4 -4
- package/lib/node/substitution/frame.js +6 -6
- package/lib/node/substitution/statement.js +6 -6
- package/lib/node/substitution/term.js +6 -6
- package/lib/node/substitution.js +107 -0
- package/lib/node/supposition.js +4 -4
- package/lib/node/term.js +27 -4
- package/lib/node/theorem.js +6 -6
- package/lib/node/type.js +4 -4
- package/lib/node/typePrefix.js +4 -4
- package/lib/node/types.js +4 -4
- package/lib/node/variable.js +4 -4
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNode.js +222 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ontology/assertion/contained.js +8 -9
- package/lib/ontology/assertion/defined.js +9 -10
- package/lib/ontology/assertion/satisfies.js +4 -4
- package/lib/ontology/assumption.js +379 -0
- package/lib/ontology/declaration/combinator.js +75 -33
- package/lib/ontology/declaration/complexType.js +110 -63
- package/lib/ontology/declaration/constructor.js +81 -38
- package/lib/ontology/declaration/metavariable.js +87 -39
- package/lib/ontology/declaration/simpleType.js +95 -48
- package/lib/ontology/declaration/typePrefix.js +87 -40
- package/lib/ontology/declaration/variable.js +87 -39
- package/lib/ontology/declaration.js +13 -338
- package/lib/ontology/equivalence.js +295 -0
- package/lib/ontology/equivalences.js +264 -0
- package/lib/ontology/frame.js +49 -54
- package/lib/ontology/judgement.js +8 -8
- package/lib/ontology/metavariable.js +4 -4
- package/lib/ontology/premise.js +14 -5
- package/lib/ontology/reference.js +3 -9
- package/lib/ontology/rule.js +3 -4
- package/lib/ontology/statement.js +28 -24
- package/lib/ontology/step.js +2 -3
- package/lib/ontology/subproof.js +2 -3
- package/lib/ontology/substitution/statement.js +77 -36
- package/lib/ontology/substitution/term.js +14 -34
- package/lib/ontology/substitution.js +18 -19
- package/lib/ontology/substitutions.js +425 -0
- package/lib/ontology/supposition.js +14 -5
- package/lib/ontology/term.js +33 -36
- package/lib/ontology/topLevelAssertion.js +2 -3
- package/lib/ontology/topLevelMetaAssertion.js +2 -3
- package/lib/ontology/variable.js +1 -34
- package/lib/preamble.js +7 -4
- package/lib/ruleNames.js +20 -12
- package/lib/unifier/intrinsicLevel.js +4 -12
- package/lib/unifier/metaLevel.js +14 -22
- package/lib/utilities/frame.js +18 -0
- package/lib/utilities/statement.js +18 -0
- package/lib/utilities/substitutions.js +43 -30
- package/lib/utilities/variable.js +5 -17
- package/package.json +10 -10
- package/src/assignment/equality.js +1 -1
- package/src/context/file.js +5 -4
- package/src/context/local.js +28 -5
- package/src/context/partial.js +9 -14
- package/src/context/temporary.js +120 -51
- package/src/mixins/step/unify.js +4 -4
- package/src/node/argument.js +1 -1
- package/src/node/assertion/contained.js +3 -3
- package/src/node/assertion/defined.js +3 -3
- package/src/node/assertion/property.js +3 -3
- package/src/node/assertion/satisfies.js +3 -3
- package/src/node/assertion/subproof.js +3 -3
- package/src/node/assertion/type.js +3 -3
- package/src/node/assertion.js +7 -0
- package/src/node/assumption.js +35 -0
- package/src/node/axiom.js +3 -3
- package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
- package/src/node/body.js +1 -3
- package/src/node/combinator.js +1 -1
- package/src/node/conclusion.js +1 -1
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +1 -1
- package/src/node/declaration/combinator.js +3 -3
- package/src/node/declaration/complexType.js +3 -3
- package/src/node/declaration/constructor.js +3 -3
- package/src/node/declaration/metavariable.js +3 -3
- package/src/node/declaration/property.js +3 -3
- package/src/node/declaration/simpleType.js +3 -3
- package/src/node/declaration/typePrefix.js +3 -3
- package/src/node/declaration/variable.js +3 -3
- package/src/node/declaration.js +2 -18
- package/src/node/deduction.js +1 -1
- package/src/node/derivation.js +1 -1
- package/src/node/document.js +7 -0
- package/src/node/equality.js +1 -1
- package/src/node/error.js +1 -1
- package/src/node/frame.js +23 -11
- package/src/node/header.js +1 -1
- package/src/node/hypothesis.js +1 -1
- package/src/node/judgement.js +6 -6
- package/src/node/label.js +1 -1
- package/src/node/labels.js +1 -1
- package/src/node/lemma.js +3 -3
- package/src/node/metaArgument.js +1 -1
- package/src/node/metaLemma.js +3 -3
- package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
- package/src/node/metaType.js +1 -1
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +1 -1
- package/src/node/nonsense.js +1 -1
- package/src/node/parameter.js +1 -1
- package/src/node/parenthesisedLabel.js +1 -1
- package/src/node/parenthesisedLabels.js +1 -1
- package/src/node/placeholder.js +7 -0
- package/src/node/premise.js +1 -1
- package/src/node/procedureCall.js +1 -1
- package/src/node/procedureReference.js +1 -1
- package/src/node/proof.js +1 -1
- package/src/node/property.js +1 -1
- package/src/node/propertyRelation.js +1 -1
- package/src/node/qualification.js +1 -1
- package/src/node/reference.js +1 -1
- package/src/node/rule.js +2 -2
- package/src/node/section.js +1 -1
- package/src/node/signature.js +1 -1
- package/src/node/statement.js +13 -1
- package/src/node/step.js +1 -1
- package/src/node/subDerivation.js +1 -1
- package/src/node/subproof.js +1 -1
- package/src/node/substitution/frame.js +3 -3
- package/src/node/substitution/statement.js +3 -3
- package/src/node/substitution/term.js +3 -3
- package/src/node/substitution.js +7 -0
- package/src/node/supposition.js +1 -1
- package/src/node/term.js +27 -1
- package/src/node/theorem.js +3 -3
- package/src/node/type.js +1 -1
- package/src/node/typePrefix.js +1 -1
- package/src/node/types.js +1 -1
- package/src/node/variable.js +1 -1
- package/src/nominal/parser.js +2 -2
- package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
- package/src/nonTerminalNodeMap.js +10 -5
- package/src/ontology/assertion/contained.js +14 -14
- package/src/ontology/assertion/defined.js +13 -13
- package/src/ontology/assertion/satisfies.js +2 -1
- package/src/ontology/assumption.js +385 -0
- package/src/ontology/declaration/combinator.js +15 -24
- package/src/ontology/declaration/complexType.js +57 -53
- package/src/ontology/declaration/constructor.js +25 -31
- package/src/ontology/declaration/metavariable.js +25 -30
- package/src/ontology/declaration/simpleType.js +34 -38
- package/src/ontology/declaration/typePrefix.js +23 -31
- package/src/ontology/declaration/variable.js +26 -31
- package/src/ontology/declaration.js +8 -372
- package/src/{equivalence.js → ontology/equivalence.js} +4 -3
- package/src/{equivalences.js → ontology/equivalences.js} +14 -12
- package/src/ontology/frame.js +53 -63
- package/src/ontology/judgement.js +8 -8
- package/src/ontology/metavariable.js +2 -2
- package/src/ontology/premise.js +18 -4
- package/src/ontology/reference.js +4 -3
- package/src/ontology/rule.js +4 -3
- package/src/ontology/statement.js +31 -27
- package/src/ontology/step.js +2 -2
- package/src/ontology/subproof.js +2 -2
- package/src/ontology/substitution/statement.js +56 -53
- package/src/ontology/substitution/term.js +9 -35
- package/src/ontology/substitution.js +11 -15
- package/src/{substitutions.js → ontology/substitutions.js} +4 -3
- package/src/ontology/supposition.js +18 -4
- package/src/ontology/term.js +27 -39
- package/src/ontology/topLevelAssertion.js +2 -2
- package/src/ontology/topLevelMetaAssertion.js +2 -2
- package/src/ontology/variable.js +0 -54
- package/src/preamble.js +6 -3
- package/src/ruleNames.js +10 -8
- package/src/unifier/intrinsicLevel.js +3 -14
- package/src/unifier/metaLevel.js +14 -25
- package/src/utilities/frame.js +13 -0
- package/src/utilities/statement.js +13 -0
- package/src/utilities/substitutions.js +59 -31
- package/src/utilities/variable.js +1 -10
- package/lib/equivalence.js +0 -294
- package/lib/equivalences.js +0 -263
- package/lib/node/nonTerminal.js +0 -218
- package/lib/substitutions.js +0 -424
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
+
import Declaration from "../declaration";
|
|
4
5
|
|
|
5
6
|
import { define } from "../../ontology";
|
|
6
7
|
import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../../utilities/type";
|
|
7
8
|
|
|
8
|
-
export default define(class ComplexTypeDeclaration {
|
|
9
|
+
export default define(class ComplexTypeDeclaration extends Declaration {
|
|
9
10
|
constructor(context, node, string, type, prefixed) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.string = string;
|
|
11
|
+
super(context, node, string);
|
|
12
|
+
|
|
13
13
|
this.type = type;
|
|
14
14
|
this.prefixed = prefixed;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
getContext() {
|
|
18
|
-
return this.context;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getNode() {
|
|
22
|
-
return this.node;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getString() {
|
|
26
|
-
return this.string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
getType() {
|
|
30
18
|
return this.type;
|
|
31
19
|
}
|
|
@@ -37,14 +25,16 @@ export default define(class ComplexTypeDeclaration {
|
|
|
37
25
|
verify() {
|
|
38
26
|
let verifies = false;
|
|
39
27
|
|
|
40
|
-
const
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
context = this.getContext(),
|
|
30
|
+
complexTypeDeclarationString = this.getString(); ///
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
context.trace(`Verifying the '${complexTypeDeclarationString}' complex type declaration...`, node);
|
|
43
33
|
|
|
44
34
|
if (this.prefixed) {
|
|
45
35
|
const typeString = this.type.getString();
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
context.trace(`The '${typeString}' type is prefixed.`);
|
|
48
38
|
} else {
|
|
49
39
|
const typeVerifies = this.verifyType();
|
|
50
40
|
|
|
@@ -55,7 +45,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
55
45
|
const propertiesVerify = this.verifyProperties();
|
|
56
46
|
|
|
57
47
|
if (propertiesVerify) {
|
|
58
|
-
const typePrefix =
|
|
48
|
+
const typePrefix = context.getTypePrefix();
|
|
59
49
|
|
|
60
50
|
if (typePrefix !== null) {
|
|
61
51
|
const typePrefixName = typePrefix.getName(),
|
|
@@ -64,7 +54,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
64
54
|
this.type.setPrefixName(prefixName);
|
|
65
55
|
}
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
context.addType(this.type);
|
|
68
58
|
|
|
69
59
|
verifies = true;
|
|
70
60
|
}
|
|
@@ -73,7 +63,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
if (verifies) {
|
|
76
|
-
|
|
66
|
+
context.debug(`...verified the '${complexTypeDeclarationString}' complex type declaration.`, node);
|
|
77
67
|
}
|
|
78
68
|
|
|
79
69
|
return verifies;
|
|
@@ -82,30 +72,32 @@ export default define(class ComplexTypeDeclaration {
|
|
|
82
72
|
verifyType() {
|
|
83
73
|
let typeVerifies = false;
|
|
84
74
|
|
|
85
|
-
const
|
|
75
|
+
const node = this.getNode(),
|
|
76
|
+
context = this.getContext(),
|
|
77
|
+
typeString = this.type.getString();
|
|
86
78
|
|
|
87
|
-
|
|
79
|
+
context.trace(`Verifying the '${typeString}' complex type...`, node);
|
|
88
80
|
|
|
89
81
|
const typeName = this.type.getName(),
|
|
90
82
|
includeRelease = true,
|
|
91
83
|
includeDependencies = false,
|
|
92
|
-
typePresent =
|
|
84
|
+
typePresent = context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies);
|
|
93
85
|
|
|
94
86
|
if (typePresent) {
|
|
95
|
-
|
|
87
|
+
context.trace(`The '${typeString}' type is already present.`, node);
|
|
96
88
|
} else {
|
|
97
89
|
const prefixedTypeName = typeName, ///
|
|
98
|
-
typePresent =
|
|
90
|
+
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
99
91
|
|
|
100
92
|
if (typePresent) {
|
|
101
|
-
|
|
93
|
+
context.trace(`The '${typeString}' type is already present.`, node);
|
|
102
94
|
} else {
|
|
103
95
|
typeVerifies = true;
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
98
|
|
|
107
99
|
if (typeVerifies) {
|
|
108
|
-
|
|
100
|
+
context.trace(`...verified the '${typeString}' complex type.`, node);
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
return typeVerifies;
|
|
@@ -114,20 +106,22 @@ export default define(class ComplexTypeDeclaration {
|
|
|
114
106
|
verifySuperType(superType) {
|
|
115
107
|
let superTypeVerifies = false;
|
|
116
108
|
|
|
117
|
-
const
|
|
109
|
+
const node = this.getNode(),
|
|
110
|
+
context = this.getContext(),
|
|
111
|
+
superTypeString = superType.getString();
|
|
118
112
|
|
|
119
|
-
|
|
113
|
+
context.trace(`Verifying the '${superTypeString}' super-type...`, node);
|
|
120
114
|
|
|
121
115
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
122
116
|
typeName = nominalTypeName, ///
|
|
123
117
|
typeNameMatches = this.type.matchTypeName(typeName);
|
|
124
118
|
|
|
125
119
|
if (typeNameMatches) {
|
|
126
|
-
|
|
120
|
+
context.trace(`The super-type's name matches the ${typeName}' complex type's name.`, node);
|
|
127
121
|
} else {
|
|
128
122
|
const oldSuperType = superType;
|
|
129
123
|
|
|
130
|
-
superType =
|
|
124
|
+
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
131
125
|
|
|
132
126
|
const superTypePresent = (superType !== null);
|
|
133
127
|
|
|
@@ -141,7 +135,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
141
135
|
}
|
|
142
136
|
|
|
143
137
|
if (superTypeVerifies) {
|
|
144
|
-
|
|
138
|
+
context.debug(`...verified the '${superTypeString}' super-type.`, node);
|
|
145
139
|
}
|
|
146
140
|
|
|
147
141
|
return superTypeVerifies;
|
|
@@ -150,16 +144,18 @@ export default define(class ComplexTypeDeclaration {
|
|
|
150
144
|
verifySuperTypes() {
|
|
151
145
|
let superTypesVerify;
|
|
152
146
|
|
|
153
|
-
const
|
|
147
|
+
const node = this.getNode(),
|
|
148
|
+
context = this.getContext(),
|
|
149
|
+
typeString = this.type.getString();
|
|
154
150
|
|
|
155
|
-
|
|
151
|
+
context.trace(`Verifying the '${typeString}' complex type's super-types...`, node);
|
|
156
152
|
|
|
157
153
|
const typeBasic = this.type.isBasic();
|
|
158
154
|
|
|
159
155
|
if (typeBasic) {
|
|
160
156
|
superTypesVerify = true;
|
|
161
157
|
|
|
162
|
-
|
|
158
|
+
context.trace(`The '${typeString}' complex type is basic.`, node)
|
|
163
159
|
} else {
|
|
164
160
|
const superTypes = this.type.getSuperTypes();
|
|
165
161
|
|
|
@@ -173,7 +169,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
173
169
|
}
|
|
174
170
|
|
|
175
171
|
if (superTypesVerify) {
|
|
176
|
-
|
|
172
|
+
context.debug(`...verified the '${typeString}' complex type's super-types.`, node);
|
|
177
173
|
}
|
|
178
174
|
|
|
179
175
|
return superTypesVerify;
|
|
@@ -182,9 +178,11 @@ export default define(class ComplexTypeDeclaration {
|
|
|
182
178
|
verifyProperty(property, properties) {
|
|
183
179
|
let propertyVerifies = false;
|
|
184
180
|
|
|
185
|
-
const
|
|
181
|
+
const node = this.getNode(),
|
|
182
|
+
context = this.getContext(),
|
|
183
|
+
propertyString = property.getString();
|
|
186
184
|
|
|
187
|
-
|
|
185
|
+
context.trace(`Verifying the '${propertyString}' property...`, node);
|
|
188
186
|
|
|
189
187
|
const propertyNameVerifies = this.verifyPropertyName(property, properties);
|
|
190
188
|
|
|
@@ -197,7 +195,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
if (propertyVerifies) {
|
|
200
|
-
|
|
198
|
+
context.debug(`...verified the '${propertyString}' property.`, node);
|
|
201
199
|
}
|
|
202
200
|
|
|
203
201
|
return propertyVerifies;
|
|
@@ -206,9 +204,11 @@ export default define(class ComplexTypeDeclaration {
|
|
|
206
204
|
verifyProperties() {
|
|
207
205
|
let propertiesVerify;
|
|
208
206
|
|
|
209
|
-
const
|
|
207
|
+
const node = this.getNode(),
|
|
208
|
+
context = this.getContext(),
|
|
209
|
+
typeString = this.type.getString();
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
context.trace(`Verifying the '${typeString}' complex type's properties...`, node);
|
|
212
212
|
|
|
213
213
|
const includeSuperTypes = false,
|
|
214
214
|
properties = this.type.getProperties(includeSuperTypes);
|
|
@@ -222,7 +222,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
if (propertiesVerify) {
|
|
225
|
-
|
|
225
|
+
context.debug(`...verified the '${typeString}' complex type's properties.`, node);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
return propertiesVerify;
|
|
@@ -231,9 +231,11 @@ export default define(class ComplexTypeDeclaration {
|
|
|
231
231
|
verifyPropertyName(property, properties) {
|
|
232
232
|
let propertyNameVerifies = false;
|
|
233
233
|
|
|
234
|
-
const
|
|
234
|
+
const node = this.getNode(),
|
|
235
|
+
context = this.getContext(),
|
|
236
|
+
propertyString = property.getString();
|
|
235
237
|
|
|
236
|
-
|
|
238
|
+
context.trace(`Verifying the '${propertyString}' property's name...`, node);
|
|
237
239
|
|
|
238
240
|
const propertyName = property.getName(),
|
|
239
241
|
count = properties.reduce((count, property) => {
|
|
@@ -247,7 +249,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
247
249
|
}, 0);
|
|
248
250
|
|
|
249
251
|
if (count > 1) {
|
|
250
|
-
|
|
252
|
+
context.debug(`The '${propertyString}' property appears more than once.`, node);
|
|
251
253
|
} else {
|
|
252
254
|
const superTypes = this.type.getSuperTypes(),
|
|
253
255
|
superType = superTypes.find((superType) => {
|
|
@@ -268,14 +270,14 @@ export default define(class ComplexTypeDeclaration {
|
|
|
268
270
|
if (superType !== null) {
|
|
269
271
|
const superTypeString = superType.getString();
|
|
270
272
|
|
|
271
|
-
|
|
273
|
+
context.debug(`The '${superTypeString}' super-type has the same property.`, node);
|
|
272
274
|
} else {
|
|
273
275
|
propertyNameVerifies = true;
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
if (propertyNameVerifies) {
|
|
278
|
-
|
|
280
|
+
context.debug(`...verified the '${propertyString}' property's name.`, node);
|
|
279
281
|
}
|
|
280
282
|
|
|
281
283
|
return propertyNameVerifies;
|
|
@@ -284,17 +286,19 @@ export default define(class ComplexTypeDeclaration {
|
|
|
284
286
|
verifyPropertyNominalTypeName(property) {
|
|
285
287
|
let propertyNominalTypeNameVerifies = false;
|
|
286
288
|
|
|
287
|
-
const
|
|
289
|
+
const node = this.getNode(),
|
|
290
|
+
context = this.getContext(),
|
|
291
|
+
propertyString = property.getString(),
|
|
288
292
|
nominalTypeName = property.getNominalTypeName();
|
|
289
293
|
|
|
290
|
-
|
|
294
|
+
context.trace(`Verifying the '${propertyString}' property's '${nominalTypeName}' nominal type name...`, node);
|
|
291
295
|
|
|
292
296
|
const nominalTypeNameMatches = this.type.matchNominalTypeName(nominalTypeName);
|
|
293
297
|
|
|
294
298
|
if (nominalTypeNameMatches) {
|
|
295
299
|
propertyNominalTypeNameVerifies = true;
|
|
296
300
|
} else {
|
|
297
|
-
const typePresent =
|
|
301
|
+
const typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
298
302
|
|
|
299
303
|
if (typePresent) {
|
|
300
304
|
propertyNominalTypeNameVerifies = true;
|
|
@@ -302,7 +306,7 @@ export default define(class ComplexTypeDeclaration {
|
|
|
302
306
|
}
|
|
303
307
|
|
|
304
308
|
if (propertyNominalTypeNameVerifies) {
|
|
305
|
-
|
|
309
|
+
context.debug(`...verifies the '${propertyString}' property's '${nominalTypeName}' nominal type name.`, node);
|
|
306
310
|
}
|
|
307
311
|
|
|
308
312
|
return propertyNominalTypeNameVerifies;
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
-
|
|
4
|
+
import Declaration from "../declaration";
|
|
5
5
|
import constructorVerifier from "../../verifier/constructor";
|
|
6
6
|
|
|
7
7
|
import { define } from "../../ontology";
|
|
8
8
|
|
|
9
|
-
export default define(class ConstructorDeclaration {
|
|
9
|
+
export default define(class ConstructorDeclaration extends Declaration {
|
|
10
10
|
constructor(context, node, string, constructor) {
|
|
11
|
-
|
|
12
|
-
this.node = node;
|
|
13
|
-
this.string = string;
|
|
14
|
-
this.constructor = constructor;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
getContext() {
|
|
18
|
-
return this.context;
|
|
19
|
-
}
|
|
11
|
+
super(context, node, string);
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
return this.node;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getString() {
|
|
26
|
-
return this.string;
|
|
13
|
+
this.constructor = constructor;
|
|
27
14
|
}
|
|
28
15
|
|
|
29
16
|
getConstructor() {
|
|
@@ -33,9 +20,11 @@ export default define(class ConstructorDeclaration {
|
|
|
33
20
|
verify() {
|
|
34
21
|
let verifies;
|
|
35
22
|
|
|
36
|
-
const
|
|
23
|
+
const node = this.getNode(),
|
|
24
|
+
context = this.getContext(),
|
|
25
|
+
constructorDeclarationString = this.getString(); ///
|
|
37
26
|
|
|
38
|
-
|
|
27
|
+
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`, node);
|
|
39
28
|
|
|
40
29
|
const constructorTypeVerifies = this.verifyConstructorType();
|
|
41
30
|
|
|
@@ -43,14 +32,14 @@ export default define(class ConstructorDeclaration {
|
|
|
43
32
|
const constructorVerifies = this.verifyConstructor();
|
|
44
33
|
|
|
45
34
|
if (constructorVerifies) {
|
|
46
|
-
|
|
35
|
+
context.addConstructor(this.constructor);
|
|
47
36
|
|
|
48
37
|
verifies = true;
|
|
49
38
|
}
|
|
50
39
|
}
|
|
51
40
|
|
|
52
41
|
if (verifies) {
|
|
53
|
-
|
|
42
|
+
context.debug(`...verified the '${constructorDeclarationString}' constructor declaration.`, node);
|
|
54
43
|
}
|
|
55
44
|
|
|
56
45
|
return verifies;
|
|
@@ -59,17 +48,19 @@ export default define(class ConstructorDeclaration {
|
|
|
59
48
|
verifyConstructor() {
|
|
60
49
|
let constructorVerifies;
|
|
61
50
|
|
|
62
|
-
const
|
|
51
|
+
const node = this.getNode(),
|
|
52
|
+
context = this.getContext(),
|
|
53
|
+
constructorString = this.constructor.getString();
|
|
63
54
|
|
|
64
|
-
|
|
55
|
+
context.trace(`Verifying the '${constructorString}' constructor...`, node);
|
|
65
56
|
|
|
66
57
|
const term = this.constructor.getTerm(),
|
|
67
58
|
termNode = term.getNode();
|
|
68
59
|
|
|
69
|
-
constructorVerifies = constructorVerifier.verifyTerm(termNode,
|
|
60
|
+
constructorVerifies = constructorVerifier.verifyTerm(termNode, context);
|
|
70
61
|
|
|
71
62
|
if (constructorVerifies) {
|
|
72
|
-
|
|
63
|
+
context.debug(`...verified the '${constructorString}' constructor.`, node);
|
|
73
64
|
}
|
|
74
65
|
|
|
75
66
|
return constructorVerifies;
|
|
@@ -78,22 +69,25 @@ export default define(class ConstructorDeclaration {
|
|
|
78
69
|
verifyConstructorType() {
|
|
79
70
|
let constructorTypeVerifies = false;
|
|
80
71
|
|
|
72
|
+
const node = this.getNode(),
|
|
73
|
+
context = this.getContext();
|
|
74
|
+
|
|
81
75
|
let type;
|
|
82
76
|
|
|
83
77
|
type = this.constructor.getType();
|
|
84
78
|
|
|
85
79
|
const typeString = type.getString();
|
|
86
80
|
|
|
87
|
-
|
|
81
|
+
context.trace(`Verifying the '${typeString}' type...`, node);
|
|
88
82
|
|
|
89
83
|
const nominalTypeName = type.getNominalTypeName();
|
|
90
84
|
|
|
91
|
-
type =
|
|
85
|
+
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
92
86
|
|
|
93
87
|
const typePresent = (type !== null)
|
|
94
88
|
|
|
95
89
|
if (!typePresent) {
|
|
96
|
-
|
|
90
|
+
context.debug(`The '${typeString}' type is not present.`, node);
|
|
97
91
|
} else {
|
|
98
92
|
const includeSupertypes = false,
|
|
99
93
|
provisional = type.isProvisional(includeSupertypes),
|
|
@@ -101,8 +95,8 @@ export default define(class ConstructorDeclaration {
|
|
|
101
95
|
|
|
102
96
|
if (!provisionalMatches) {
|
|
103
97
|
provisional ?
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
context.debug(`The '${typeString}' type is present but not provisional.`, node) :
|
|
99
|
+
context.debug(`The '${typeString}' type is present but provisional.`, node);
|
|
106
100
|
} else {
|
|
107
101
|
this.constructor.setType(type);
|
|
108
102
|
|
|
@@ -111,7 +105,7 @@ export default define(class ConstructorDeclaration {
|
|
|
111
105
|
}
|
|
112
106
|
|
|
113
107
|
if (constructorTypeVerifies) {
|
|
114
|
-
|
|
108
|
+
context.debug(`...verified the '${typeString}' type.`, node);
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
return constructorTypeVerifies;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ontology from "../../ontology";
|
|
4
|
+
import Declaration from "../declaration";
|
|
4
5
|
|
|
5
6
|
import { define } from "../../ontology";
|
|
6
7
|
|
|
7
|
-
export default define(class MetavariableDeclaration {
|
|
8
|
+
export default define(class MetavariableDeclaration extends Declaration {
|
|
8
9
|
constructor(context, node, string, metavariable) {
|
|
9
|
-
|
|
10
|
-
this.node = node;
|
|
11
|
-
this.string = string;
|
|
12
|
-
this.metavariable = metavariable;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
getContext() {
|
|
16
|
-
return this.context;
|
|
17
|
-
}
|
|
10
|
+
super(context, node, string);
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
return this.node;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getString() {
|
|
24
|
-
return this.string;
|
|
12
|
+
this.metavariable = metavariable;
|
|
25
13
|
}
|
|
26
14
|
|
|
27
15
|
getMetavariable() {
|
|
@@ -31,20 +19,22 @@ export default define(class MetavariableDeclaration {
|
|
|
31
19
|
verify() {
|
|
32
20
|
let verifies;
|
|
33
21
|
|
|
34
|
-
const
|
|
22
|
+
const node = this.getNode(),
|
|
23
|
+
context = this.getContext(),
|
|
24
|
+
metavariableDeclarationString = this.getString(); ///
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`, node);
|
|
37
27
|
|
|
38
28
|
const metavariableVerifies = this.verifyMetavariable(this.metavariable);
|
|
39
29
|
|
|
40
30
|
if (metavariableVerifies) {
|
|
41
|
-
|
|
31
|
+
context.addMetavariable(this.metavariable);
|
|
42
32
|
|
|
43
33
|
verifies = true;
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
if (verifies) {
|
|
47
|
-
|
|
37
|
+
context.debug(`...verified the '${metavariableDeclarationString}' metavariable declaration.`, node);
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
return verifies;
|
|
@@ -53,24 +43,27 @@ export default define(class MetavariableDeclaration {
|
|
|
53
43
|
verifyType(type) {
|
|
54
44
|
let typeVerifies;
|
|
55
45
|
|
|
46
|
+
const node = this.getNode(),
|
|
47
|
+
context = this.getContext();
|
|
48
|
+
|
|
56
49
|
if (type === null) {
|
|
57
50
|
typeVerifies = true;
|
|
58
51
|
} else {
|
|
59
52
|
const typeString = type.getString();
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
context.trace(`Verifying the '${typeString}' type...`, node);
|
|
62
55
|
|
|
63
56
|
const nominalTypeName = type.getNominalTypeName(),
|
|
64
|
-
typePresent =
|
|
57
|
+
typePresent = context.isTypePresentByNominalTypeName(nominalTypeName);
|
|
65
58
|
|
|
66
59
|
if (!typePresent) {
|
|
67
|
-
|
|
60
|
+
context.debug(`The '${typeString}' type is not present.`, node);
|
|
68
61
|
} else {
|
|
69
62
|
typeVerifies = true;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
if (typeVerifies) {
|
|
73
|
-
|
|
66
|
+
context.debug(`...verified the '${typeString}' type.`, node);
|
|
74
67
|
}
|
|
75
68
|
}
|
|
76
69
|
|
|
@@ -80,21 +73,23 @@ export default define(class MetavariableDeclaration {
|
|
|
80
73
|
verifyMetavariable(metavariable) {
|
|
81
74
|
let metavariableVerifies = false;
|
|
82
75
|
|
|
83
|
-
const
|
|
76
|
+
const node = this.getNode(),
|
|
77
|
+
context = this.getContext(),
|
|
78
|
+
metavariableString = metavariable.getString();
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
context.trace(`Verifying the '${metavariableString}' metavariable when declared...`, node);
|
|
86
81
|
|
|
87
82
|
const metavariableNode = metavariable.getNode(), ///
|
|
88
83
|
termNode = metavariableNode.getTermNode();
|
|
89
84
|
|
|
90
85
|
if (termNode !== null) {
|
|
91
|
-
|
|
86
|
+
context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`, node);
|
|
92
87
|
} else {
|
|
93
88
|
const metavariableName = metavariable.getName(),
|
|
94
|
-
metavariablePresent =
|
|
89
|
+
metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
|
|
95
90
|
|
|
96
91
|
if (metavariablePresent) {
|
|
97
|
-
|
|
92
|
+
context.debug(`The '${metavariableName}' metavariable is already present.`, node);
|
|
98
93
|
} else {
|
|
99
94
|
const type = metavariable.getType(),
|
|
100
95
|
typeVerifies = this.verifyType(type);
|
|
@@ -104,7 +99,7 @@ export default define(class MetavariableDeclaration {
|
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
if (metavariableVerifies) {
|
|
107
|
-
|
|
102
|
+
context.debug(`...verified the '${metavariableString}' metavariable when declared.`, node);
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
return metavariableVerifies;
|