occam-verify-cli 1.0.642 → 1.0.648
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/file/nominal.js +14 -14
- package/lib/context.js +22 -8
- package/lib/element/assertion/type.js +9 -6
- package/lib/element/combinator.js +11 -6
- package/lib/element/constructor.js +43 -8
- package/lib/element/declaration/combinator.js +25 -15
- package/lib/element/declaration/complexType.js +43 -33
- package/lib/element/declaration/constructor.js +45 -100
- package/lib/element/declaration/simpleType.js +77 -53
- package/lib/element/declaration/typePrefix.js +30 -20
- package/lib/element/declaration/variable.js +3 -5
- package/lib/element/term.js +1 -1
- package/lib/element/topLevelAssertion/axiom.js +2 -2
- package/lib/element/type.js +6 -5
- package/lib/node/declaration/complexType.js +1 -8
- package/lib/node/declaration/simpleType.js +1 -8
- package/lib/process/assign.js +11 -24
- package/lib/process/unify.js +41 -1
- package/lib/process/verify.js +61 -13
- package/lib/utilities/element.js +31 -19
- package/lib/utilities/type.js +3 -3
- package/package.json +1 -1
- package/src/context/file/nominal.js +13 -13
- package/src/context.js +24 -10
- package/src/element/assertion/type.js +10 -6
- package/src/element/combinator.js +11 -7
- package/src/element/constructor.js +54 -3
- package/src/element/declaration/combinator.js +5 -2
- package/src/element/declaration/complexType.js +9 -6
- package/src/element/declaration/constructor.js +33 -99
- package/src/element/declaration/simpleType.js +73 -44
- package/src/element/declaration/typePrefix.js +5 -2
- package/src/element/declaration/variable.js +3 -8
- package/src/element/term.js +7 -7
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/type.js +4 -3
- package/src/node/declaration/complexType.js +0 -7
- package/src/node/declaration/simpleType.js +0 -7
- package/src/process/assign.js +15 -23
- package/src/process/unify.js +32 -0
- package/src/process/verify.js +48 -18
- package/src/utilities/element.js +33 -18
- package/src/utilities/type.js +2 -3
|
@@ -4,28 +4,29 @@ import Declaration from "../declaration";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { superTypesStringFromSuperTypes } from "../../utilities/string";
|
|
7
|
+
import {baseTypeFromNothing} from "../../utilities/type";
|
|
7
8
|
|
|
8
9
|
export default define(class SimpleTypeDeclaration extends Declaration {
|
|
9
|
-
constructor(context, string, node, type,
|
|
10
|
+
constructor(context, string, node, type, superTypes, provisional) {
|
|
10
11
|
super(context, string, node);
|
|
11
12
|
|
|
12
13
|
this.type = type;
|
|
13
|
-
this.prefixed = prefixed;
|
|
14
14
|
this.superTypes = superTypes;
|
|
15
|
+
this.provisional = provisional;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
getType() {
|
|
18
19
|
return this.type;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
isPrefixed() {
|
|
22
|
-
return this.prefixed;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
22
|
getSuperTypes() {
|
|
26
23
|
return this.superTypes;
|
|
27
24
|
}
|
|
28
25
|
|
|
26
|
+
isProvisional() {
|
|
27
|
+
return this.provisional;
|
|
28
|
+
}
|
|
29
|
+
|
|
29
30
|
getSimpleTypeDeclarationNode() {
|
|
30
31
|
const node = this.getNode(),
|
|
31
32
|
simpleTypeDeclarationNode = node; ///
|
|
@@ -52,6 +53,8 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
52
53
|
typePresent = context.isTypePresentByPrefixedTypeName(prefixedTypeName);
|
|
53
54
|
|
|
54
55
|
if (!typePresent) {
|
|
56
|
+
this.type.setProvisional(this.provisional);
|
|
57
|
+
|
|
55
58
|
typeVerifies = true;
|
|
56
59
|
} else {
|
|
57
60
|
context.debug(`The '${typeString}' type is already present.`);
|
|
@@ -67,14 +70,14 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
67
70
|
return typeVerifies;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
verifySuperType(superType,
|
|
73
|
+
verifySuperType(superType, superTypes) {
|
|
71
74
|
let superTypeVerifies = false;
|
|
72
75
|
|
|
73
76
|
const context = this.getContext(),
|
|
74
77
|
superTypeString = superType.getString(),
|
|
75
78
|
simpleTypeDeclarationString = this.getString(); ///;
|
|
76
79
|
|
|
77
|
-
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-
|
|
80
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type...`);
|
|
78
81
|
|
|
79
82
|
const nominalTypeName = superType.getNominalTypeName(),
|
|
80
83
|
typeName = nominalTypeName, ///
|
|
@@ -84,7 +87,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
84
87
|
superType = context.findTypeByNominalTypeName(nominalTypeName);
|
|
85
88
|
|
|
86
89
|
if (superType !== null) {
|
|
87
|
-
|
|
90
|
+
superTypes.push(superType);
|
|
88
91
|
|
|
89
92
|
superTypeVerifies = true;
|
|
90
93
|
} else {
|
|
@@ -95,7 +98,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
if (superTypeVerifies) {
|
|
98
|
-
context.debug(`...verified the '${superTypeString}' super-type.`);
|
|
101
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type.`);
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
return superTypeVerifies;
|
|
@@ -104,66 +107,92 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
104
107
|
verifySuperTypes() {
|
|
105
108
|
let superTypesVerify;
|
|
106
109
|
|
|
107
|
-
const
|
|
110
|
+
const context = this.getContext(),
|
|
111
|
+
superTypes = [],
|
|
112
|
+
superTypesString = superTypesStringFromSuperTypes(this.superTypes),
|
|
113
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
simpleTypeDeclarationString = this.getString(); ///;
|
|
115
|
+
(superTypesString !== null) ?
|
|
116
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types...`) :
|
|
117
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's super-types...`);
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
superTypesVerify = this.superTypes.every((superType) => {
|
|
120
|
+
const superTypeVerifies = this.verifySuperType(superType, superTypes);
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
if (superTypeVerifies) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
});
|
|
127
|
+
if (superTypesVerify) {
|
|
128
|
+
const superTypesLength = superTypes.length;
|
|
123
129
|
|
|
124
|
-
if (
|
|
125
|
-
|
|
130
|
+
if (superTypesLength === 0) {
|
|
131
|
+
const baseType = baseTypeFromNothing(),
|
|
132
|
+
superTyupe = baseType; ///
|
|
133
|
+
|
|
134
|
+
superTypes.push(superTyupe);
|
|
126
135
|
}
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
|
|
137
|
+
this.type.setSuperTypes(superTypes);
|
|
138
|
+
|
|
139
|
+
(superTypesString !== null) ?
|
|
140
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${superTypesString}' super-types.`) :
|
|
141
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's super-types.`);
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
return superTypesVerify;
|
|
132
145
|
}
|
|
133
146
|
|
|
147
|
+
verifyTypePrefix() {
|
|
148
|
+
let typePrefixVerifies = false;
|
|
149
|
+
|
|
150
|
+
const context = this.getContext(),
|
|
151
|
+
typeString = this.type.getString(),
|
|
152
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
153
|
+
|
|
154
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix...`);
|
|
155
|
+
|
|
156
|
+
const typePrefixed = this.type.isPrefixed();
|
|
157
|
+
|
|
158
|
+
if (!typePrefixed) {
|
|
159
|
+
typePrefixVerifies = true;
|
|
160
|
+
} else {
|
|
161
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type is prefixed.`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (typePrefixVerifies) {
|
|
165
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix.`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return typePrefixVerifies;
|
|
169
|
+
}
|
|
170
|
+
|
|
134
171
|
async verify() {
|
|
135
172
|
let verifies = false;
|
|
136
173
|
|
|
137
|
-
const context = this.getContext()
|
|
138
|
-
simpleTypeDeclarationString = this.getString(); ///
|
|
174
|
+
const context = this.getContext();
|
|
139
175
|
|
|
140
|
-
|
|
176
|
+
await this.break(context);
|
|
141
177
|
|
|
142
|
-
|
|
143
|
-
const typeVerifies = this.verifyType();
|
|
178
|
+
const simpleTypeDeclarationString = this.getString(); ///
|
|
144
179
|
|
|
145
|
-
|
|
146
|
-
const superTypesVerify = this.verifySuperTypes();
|
|
180
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`);
|
|
147
181
|
|
|
148
|
-
|
|
149
|
-
const typePrefix = context.getTypePrefix();
|
|
182
|
+
const typeVerifies = this.verifyType();
|
|
150
183
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
prefixName = typePrefixName; ///
|
|
184
|
+
if (typeVerifies) {
|
|
185
|
+
const superTypesVerify = this.verifySuperTypes();
|
|
154
186
|
|
|
155
|
-
|
|
156
|
-
|
|
187
|
+
if (superTypesVerify) {
|
|
188
|
+
const typePrefixVerifies = this.verifyTypePrefix();
|
|
157
189
|
|
|
190
|
+
if (typePrefixVerifies) {
|
|
158
191
|
context.addType(this.type);
|
|
159
192
|
|
|
160
193
|
verifies = true;
|
|
161
194
|
}
|
|
162
195
|
}
|
|
163
|
-
} else {
|
|
164
|
-
const typeString = this.type.getString();
|
|
165
|
-
|
|
166
|
-
context.trace(`The '${typeString}' type is prefixed.`);
|
|
167
196
|
}
|
|
168
197
|
|
|
169
198
|
if (verifies) {
|
|
@@ -63,8 +63,11 @@ export default define(class TypePrefixDeclaration extends Declaration {
|
|
|
63
63
|
async verify() {
|
|
64
64
|
let verifies = false;
|
|
65
65
|
|
|
66
|
-
const context = this.getContext()
|
|
67
|
-
|
|
66
|
+
const context = this.getContext();
|
|
67
|
+
|
|
68
|
+
await this.break(context);
|
|
69
|
+
|
|
70
|
+
const typePrefixDeclarationString = this.getString(); ///
|
|
68
71
|
|
|
69
72
|
context.trace(`Verifying the '${typePrefixDeclarationString}' type prefix declaration...`);
|
|
70
73
|
|
|
@@ -79,20 +79,15 @@ export default define(class VariableDeclaration extends Declaration {
|
|
|
79
79
|
context.trace(`Verifying the '${variableDeclarationString}' variable declaration's '${variableString}' variable...`);
|
|
80
80
|
|
|
81
81
|
const variableIdentifier = this.variable.getIdentifier(),
|
|
82
|
-
|
|
83
|
-
variablePresent = (variable !== null);
|
|
82
|
+
variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentifier);
|
|
84
83
|
|
|
85
84
|
if (variablePresent) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
context.debug(`The '${variableIdentifier}' variable is already present.`);
|
|
85
|
+
context.debug(`The '${variableString}' variable is already present.`);
|
|
89
86
|
} else {
|
|
90
|
-
this.variable.setType(this.type);
|
|
91
|
-
|
|
92
87
|
variableVerifies = true;
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
if (
|
|
90
|
+
if (variableVerifies) {
|
|
96
91
|
context.debug(`...verified the '${variableDeclarationString}' variable declaration's '${variableString}' variable.`);
|
|
97
92
|
}
|
|
98
93
|
|
package/src/element/term.js
CHANGED
|
@@ -197,16 +197,16 @@ export default define(class Term extends Element {
|
|
|
197
197
|
context.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
198
198
|
|
|
199
199
|
const validates = this.validate(context, () => {
|
|
200
|
-
|
|
200
|
+
let validatesForwards;
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
if (typeEqualToOrSubTypeOfGivenTypeType) {
|
|
205
|
+
validatesForwards = true;
|
|
206
|
+
}
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
return validatesForwards;
|
|
209
|
+
});
|
|
210
210
|
|
|
211
211
|
if (validates) {
|
|
212
212
|
validatesGivenType = true;
|
package/src/element/type.js
CHANGED
|
@@ -233,12 +233,12 @@ export default define(class Type extends Element {
|
|
|
233
233
|
return comparesToTypeName;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
compareProvisional(provisional) {
|
|
236
|
+
compareProvisional(provisional, includeSupertypes = true) {
|
|
237
237
|
let comparesToProvisional;
|
|
238
238
|
|
|
239
239
|
const provisionalA = provisional; ///
|
|
240
240
|
|
|
241
|
-
provisional = this.isProvisional();
|
|
241
|
+
provisional = this.isProvisional(includeSupertypes);
|
|
242
242
|
|
|
243
243
|
const provisionalB = provisional; ///
|
|
244
244
|
|
|
@@ -326,12 +326,13 @@ export default define(class Type extends Element {
|
|
|
326
326
|
return type;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
static
|
|
329
|
+
static fromName(name, context) {
|
|
330
330
|
const string = name, ///
|
|
331
331
|
node = null,
|
|
332
332
|
prefixName = null,
|
|
333
333
|
superTypes = [],
|
|
334
334
|
properties = [],
|
|
335
|
+
provisional = false,
|
|
335
336
|
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
336
337
|
|
|
337
338
|
return type;
|
|
@@ -28,13 +28,6 @@ export default class ComplexTypeDeclarationNode extends DeclarationNode {
|
|
|
28
28
|
return provisional;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
isPrefixed() {
|
|
32
|
-
const typeNode = this.getTypeNode(),
|
|
33
|
-
prefixed = typeNode.isPrefixed();
|
|
34
|
-
|
|
35
|
-
return prefixed;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
31
|
getTypeName() {
|
|
39
32
|
const typeNode = this.getTypeNode(),
|
|
40
33
|
typeName = typeNode.getTypeName();
|
|
@@ -6,13 +6,6 @@ import { PROVISIONAL } from "../../constants";
|
|
|
6
6
|
import { TYPE_RULE_NAME, TYPES_RULE_NAME } from "../../ruleNames";
|
|
7
7
|
|
|
8
8
|
export default class SimpleTypeDeclarationNode extends DeclarationNode {
|
|
9
|
-
isPrefixed() {
|
|
10
|
-
const typeNode = this.getTypeNode(),
|
|
11
|
-
prefixed = typeNode.isPrefixed();
|
|
12
|
-
|
|
13
|
-
return prefixed;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
9
|
isProvisional() {
|
|
17
10
|
let provisional = false;
|
|
18
11
|
|
package/src/process/assign.js
CHANGED
|
@@ -55,32 +55,24 @@ export function rightVariableAssignmentFromEquality(equality, context) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function variableAssignmentFromTypeAssertion(typeAssertion, context) {
|
|
58
|
+
let variableAssignment = null;
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
const term = typeAssertion.getTerm(),
|
|
61
|
+
termSingular = term.isSingular();
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
// if (!provisional) {
|
|
70
|
-
// type = this.type;
|
|
71
|
-
// } else {
|
|
72
|
-
// provisional = false;
|
|
73
|
-
//
|
|
74
|
-
// type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
75
|
-
// }
|
|
76
|
-
//
|
|
77
|
-
// const singularVariableNode = termNode.getSingularVariableNode();
|
|
78
|
-
//
|
|
79
|
-
// if (singularVariableNode !== null) {
|
|
80
|
-
// const variableNode = singularVariableNode, ///
|
|
81
|
-
// variable = Variable.fromVariableNodeAndType(variableNode, type, context),
|
|
82
|
-
// variableAssignment = variableAssignmentFromVariable(variable),
|
|
63
|
+
if (termSingular) {
|
|
64
|
+
const variableIdentifier = term.getVariableIdentifier(),
|
|
65
|
+
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
66
|
+
|
|
67
|
+
if (variable !== null) {
|
|
68
|
+
const type = typeAssertion.getType(),
|
|
69
|
+
variableNode = variable.getNode();
|
|
83
70
|
|
|
71
|
+
variableAssignment = variableAssignmentFromVariableNodeAndType(variableNode, type, context);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return variableAssignment;
|
|
84
76
|
}
|
|
85
77
|
|
|
86
78
|
export function variableAssignmentFromPrepertyAssertion(propertyAssertion, context) {
|
package/src/process/unify.js
CHANGED
|
@@ -145,6 +145,22 @@ class MetaLevelPass extends ZipPass {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
class CombinatorPass extends ZipPass {
|
|
148
|
+
run(combinatorStatementNode, statementNode, stated, generalContext, specificContext) {
|
|
149
|
+
let success = false;
|
|
150
|
+
|
|
151
|
+
const specificnonTerminalNode = statementNode, ///
|
|
152
|
+
generalcnonTerminalNode = combinatorStatementNode, ///
|
|
153
|
+
specificChildNodes = specificnonTerminalNode.getChildNodes(), ///
|
|
154
|
+
generalcChildNodes = generalcnonTerminalNode.getChildNodes(), ///
|
|
155
|
+
descended = this.descend(generalcChildNodes, specificChildNodes, stated, generalContext, specificContext);
|
|
156
|
+
|
|
157
|
+
if (descended) {
|
|
158
|
+
success = true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return success;
|
|
162
|
+
}
|
|
163
|
+
|
|
148
164
|
static maps = [
|
|
149
165
|
{
|
|
150
166
|
generalNodeQuery: metaTypeNodeQuery,
|
|
@@ -236,6 +252,22 @@ class CombinatorPass extends ZipPass {
|
|
|
236
252
|
}
|
|
237
253
|
|
|
238
254
|
class ConstructorPass extends ZipPass {
|
|
255
|
+
run(constructorTermNode, termNode, generalContext, specificContext) {
|
|
256
|
+
let success = false;
|
|
257
|
+
|
|
258
|
+
const specificnonTerminalNode = termNode, ///
|
|
259
|
+
generalcnonTerminalNode = constructorTermNode, ///
|
|
260
|
+
specificChildNodes = specificnonTerminalNode.getChildNodes(), ///
|
|
261
|
+
generalcChildNodes = generalcnonTerminalNode.getChildNodes(), ///
|
|
262
|
+
descended = this.descend(generalcChildNodes, specificChildNodes, generalContext, specificContext);
|
|
263
|
+
|
|
264
|
+
if (descended) {
|
|
265
|
+
success = true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return success;
|
|
269
|
+
}
|
|
270
|
+
|
|
239
271
|
static maps = [
|
|
240
272
|
{
|
|
241
273
|
generalNodeQuery: typeNodeQuery,
|
package/src/process/verify.js
CHANGED
|
@@ -288,6 +288,20 @@ class TopLevelPass extends AsyncPass {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
class ConbinatorPass extends SimplePass {
|
|
291
|
+
run(statementNode, context) {
|
|
292
|
+
let success = false;
|
|
293
|
+
|
|
294
|
+
const nonTerminalNode = statementNode, ///
|
|
295
|
+
childNodes = nonTerminalNode.getChildNodes(), ///
|
|
296
|
+
descended = this.descend(childNodes, context);
|
|
297
|
+
|
|
298
|
+
if (descended) {
|
|
299
|
+
success = true;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return success;
|
|
303
|
+
}
|
|
304
|
+
|
|
291
305
|
static maps = [
|
|
292
306
|
{
|
|
293
307
|
nodeQuery: statementNodeQuery,
|
|
@@ -350,6 +364,20 @@ class ConbinatorPass extends SimplePass {
|
|
|
350
364
|
}
|
|
351
365
|
|
|
352
366
|
class ConstructorPass extends SimplePass {
|
|
367
|
+
run(termNode, context) {
|
|
368
|
+
let success = false;
|
|
369
|
+
|
|
370
|
+
const nonTerminalNode = termNode, ///
|
|
371
|
+
childNodes = nonTerminalNode.getChildNodes(), ///
|
|
372
|
+
descended = this.descend(childNodes, context);
|
|
373
|
+
|
|
374
|
+
if (descended) {
|
|
375
|
+
success = true;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return success;
|
|
379
|
+
}
|
|
380
|
+
|
|
353
381
|
static maps = [
|
|
354
382
|
{
|
|
355
383
|
nodeQuery: termNodeQuery,
|
|
@@ -408,26 +436,28 @@ export async function verifyFile(fileNode, context) {
|
|
|
408
436
|
return fileVerifies;
|
|
409
437
|
}
|
|
410
438
|
|
|
411
|
-
export function
|
|
412
|
-
|
|
413
|
-
statement = combintot.getStatement(),
|
|
414
|
-
statementNode = statement.getNode(),
|
|
415
|
-
nonTerminalNode = statementNode, ///
|
|
416
|
-
childNodes = nonTerminalNode.getChildNodes(),
|
|
417
|
-
descended = combinatorPass.descend(childNodes, context),
|
|
418
|
-
combinatorVerifies = descended; ///
|
|
439
|
+
export function verifyTermAsConstructor(term, context) {
|
|
440
|
+
let termVerifiesAsConstructor = false;
|
|
419
441
|
|
|
420
|
-
|
|
442
|
+
const termNode = term.getNode(),
|
|
443
|
+
success = constructorPass.run(termNode, context);
|
|
444
|
+
|
|
445
|
+
if (success) {
|
|
446
|
+
termVerifiesAsConstructor = true;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return termVerifiesAsConstructor;
|
|
421
450
|
}
|
|
422
451
|
|
|
423
|
-
export function
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
452
|
+
export function verifyStatementAsCombinator(statement, context) {
|
|
453
|
+
let statementVerifiesAsCombinator = false;
|
|
454
|
+
|
|
455
|
+
const statementNode = statement.getNode(),
|
|
456
|
+
success = combinatorPass.run(statementNode, context);
|
|
457
|
+
|
|
458
|
+
if (success) {
|
|
459
|
+
statementVerifiesAsCombinator = true;
|
|
460
|
+
}
|
|
431
461
|
|
|
432
|
-
return
|
|
462
|
+
return statementVerifiesAsCombinator;
|
|
433
463
|
}
|
package/src/utilities/element.js
CHANGED
|
@@ -741,9 +741,9 @@ export function simpleTypeDeclarationFromSimpleTypeDeclarationNode(simpleTypeDec
|
|
|
741
741
|
node = simpleTypeDeclarationNode, ///
|
|
742
742
|
string = context.nodeAsString(node),
|
|
743
743
|
type = typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
744
|
-
prefixed = prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
745
744
|
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
746
|
-
|
|
745
|
+
provisional = provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
746
|
+
simpleTypeDeclaration = new SimpleTypeDeclaration(context, string, node, type, superTypes, provisional);
|
|
747
747
|
|
|
748
748
|
return simpleTypeDeclaration;
|
|
749
749
|
}
|
|
@@ -789,8 +789,9 @@ export function complexTypeDeclarationFromComplexTypeDeclarationNode(complexType
|
|
|
789
789
|
node = complexTypeDeclarationNode, ///
|
|
790
790
|
string = context.nodeAsString(node),
|
|
791
791
|
type = typeFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
793
|
+
provisional = provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
794
|
+
complexTypeDeclaration = new ComplexTypeDeclaration(context, string, node, type, superTypes, provisional);
|
|
794
795
|
|
|
795
796
|
return complexTypeDeclaration;
|
|
796
797
|
}
|
|
@@ -1584,12 +1585,6 @@ export function suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, co
|
|
|
1584
1585
|
return suppositions;
|
|
1585
1586
|
}
|
|
1586
1587
|
|
|
1587
|
-
export function prefixedFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1588
|
-
const prefixed = simpleTypeDeclarationNode.isPrefixed();
|
|
1589
|
-
|
|
1590
|
-
return prefixed;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
1588
|
export function resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
1594
1589
|
const resolved = statementSubstitutionNode.isResolved();
|
|
1595
1590
|
|
|
@@ -1603,12 +1598,6 @@ export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode,
|
|
|
1603
1598
|
return deduction;
|
|
1604
1599
|
}
|
|
1605
1600
|
|
|
1606
|
-
export function prefixedFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1607
|
-
const prefixed = complexTypeDeclarationNode.isPrefixed();
|
|
1608
|
-
|
|
1609
|
-
return prefixed;
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
1601
|
export function procedureReferenceFromProcedureCallNode(procedureCallNode, context) {
|
|
1613
1602
|
const procedureReferenceNode = procedureCallNode.getProcedureReferenceNode(),
|
|
1614
1603
|
procedureReference = procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context);
|
|
@@ -1658,12 +1647,26 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
1658
1647
|
return metaType;
|
|
1659
1648
|
}
|
|
1660
1649
|
|
|
1661
|
-
export function
|
|
1662
|
-
const provisional =
|
|
1650
|
+
export function provisionalFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1651
|
+
const provisional = simpleTypeDeclarationNode.isProvisional();
|
|
1663
1652
|
|
|
1664
1653
|
return provisional;
|
|
1665
1654
|
}
|
|
1666
1655
|
|
|
1656
|
+
export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1657
|
+
let superTypes = [];
|
|
1658
|
+
|
|
1659
|
+
const typesNode = complexTypeDeclarationNode.getTypesNode();
|
|
1660
|
+
|
|
1661
|
+
if (typesNode !== null) {
|
|
1662
|
+
const types = typesFromTypesNode(typesNode, context);
|
|
1663
|
+
|
|
1664
|
+
superTypes = types; ///
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
return superTypes;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1667
1670
|
export function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
1668
1671
|
const replacementFrameNode = frameSubstitutionNode.getReplacementFrameNode(),
|
|
1669
1672
|
replacementFrame = frameFromFrameNode(replacementFrameNode, context);
|
|
@@ -1700,6 +1703,18 @@ export function constructorFromConstructorDeclarationNode(constructorDeclaration
|
|
|
1700
1703
|
return constructor;
|
|
1701
1704
|
}
|
|
1702
1705
|
|
|
1706
|
+
export function provisionalFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
1707
|
+
const provisional = constructorDeclarationNode.isProvisional();
|
|
1708
|
+
|
|
1709
|
+
return provisional;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
export function provisionalFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1713
|
+
const provisional = complexTypeDeclarationNode.isProvisional();
|
|
1714
|
+
|
|
1715
|
+
return provisional;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1703
1718
|
export function metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
1704
1719
|
const metavariableNode = metavariableDeclarationNode.getMetavariableNode(),
|
|
1705
1720
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
package/src/utilities/type.js
CHANGED
|
@@ -10,10 +10,9 @@ export function baseTypeFromNothing() {
|
|
|
10
10
|
if (baseType === null) {
|
|
11
11
|
const { Type } = elements,
|
|
12
12
|
name = BASE_TYPE_SYMBOL, ///
|
|
13
|
-
context = null
|
|
14
|
-
provisional = false;
|
|
13
|
+
context = null;
|
|
15
14
|
|
|
16
|
-
baseType = Type.
|
|
15
|
+
baseType = Type.fromName(name, context);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
return baseType;
|