occam-verify-cli 1.0.172 → 1.0.176
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/release.js +2 -5
- package/lib/customGrammar/combined.js +149 -0
- package/lib/dom/constructor.js +11 -11
- package/lib/dom/declaration/combinator.js +3 -3
- package/lib/dom/declaration/complexType.js +41 -23
- package/lib/dom/declaration/constructor.js +35 -42
- package/lib/dom/declaration/type.js +26 -27
- package/lib/dom/declaration/variable.js +29 -44
- package/lib/dom/metaType.js +2 -3
- package/lib/dom/metavariable.js +4 -5
- package/lib/dom/property.js +3 -4
- package/lib/dom/statement.js +13 -62
- package/lib/dom/term.js +17 -14
- package/lib/dom/type.js +35 -102
- package/lib/dom/variable.js +8 -6
- package/lib/mixins/node.js +145 -0
- package/lib/node/assertion/contained.js +23 -1
- package/lib/node/assertion/defined.js +23 -1
- package/lib/node/assertion/property.js +23 -1
- package/lib/node/assertion/satisfies.js +23 -1
- package/lib/node/assertion/subproof.js +23 -1
- package/lib/node/assertion/type.js +23 -1
- package/lib/node/axiom.js +23 -1
- package/lib/node/combinator.js +23 -1
- package/lib/node/conclusion.js +23 -1
- package/lib/node/conjecture.js +23 -1
- package/lib/node/constructor.js +23 -1
- package/lib/node/declaration/combinator.js +34 -1
- package/lib/node/declaration/complexType.js +81 -1
- package/lib/node/declaration/constructor.js +62 -1
- package/lib/node/declaration/metavariable.js +23 -1
- package/lib/node/declaration/property.js +180 -0
- package/lib/node/declaration/type.js +67 -1
- package/lib/node/declaration/variable.js +78 -1
- package/lib/node/declaration.js +23 -1
- package/lib/node/deduction.js +23 -1
- package/lib/node/derivation.js +23 -1
- package/lib/node/equality.js +23 -1
- package/lib/node/error.js +23 -1
- package/lib/node/frame.js +23 -1
- package/lib/node/judgement.js +23 -1
- package/lib/node/label.js +23 -1
- package/lib/node/lemma.js +23 -1
- package/lib/node/metaLemma.js +23 -1
- package/lib/node/metaType.js +34 -1
- package/lib/node/metatheorem.js +23 -1
- package/lib/node/metavariable.js +34 -1
- package/lib/node/parameter.js +23 -1
- package/lib/node/premise.js +23 -1
- package/lib/node/procedureCall.js +23 -1
- package/lib/node/proof.js +23 -1
- package/lib/node/property.js +35 -1
- package/lib/node/propertyRelation.js +23 -1
- package/lib/node/reference.js +23 -1
- package/lib/node/rule.js +23 -1
- package/lib/node/statement.js +23 -1
- package/lib/node/step.js +23 -1
- package/lib/node/subDerivation.js +23 -1
- package/lib/node/subproof.js +23 -1
- package/lib/node/supposition.js +23 -1
- package/lib/node/term.js +23 -1
- package/lib/node/theorem.js +23 -1
- package/lib/node/topLevelAssertion.js +23 -1
- package/lib/node/topLevelMetaAssertion.js +23 -1
- package/lib/node/type.js +34 -1
- package/lib/node/variable.js +34 -1
- package/lib/node.js +73 -2
- package/lib/nodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/unifier/metavariable.js +2 -3
- package/lib/unifier/statementWithCombinator.js +2 -3
- package/lib/unifier/termWithConstructor.js +2 -3
- package/lib/utilities/customGrammar.js +9 -3
- package/lib/utilities/node.js +84 -0
- package/lib/verifier/combinator.js +2 -3
- package/lib/verifier/constructor.js +2 -3
- package/package.json +9 -9
- package/src/context/release.js +2 -6
- package/src/customGrammar/combined.js +36 -0
- package/src/dom/constructor.js +10 -12
- package/src/dom/declaration/combinator.js +2 -2
- package/src/dom/declaration/complexType.js +43 -52
- package/src/dom/declaration/constructor.js +49 -57
- package/src/dom/declaration/type.js +34 -37
- package/src/dom/declaration/variable.js +30 -54
- package/src/dom/metaType.js +1 -2
- package/src/dom/metavariable.js +3 -4
- package/src/dom/property.js +5 -7
- package/src/dom/statement.js +6 -24
- package/src/dom/term.js +8 -14
- package/src/dom/type.js +45 -165
- package/src/dom/variable.js +19 -11
- package/src/mixins/node.js +201 -0
- package/src/node/assertion/contained.js +3 -1
- package/src/node/assertion/defined.js +3 -1
- package/src/node/assertion/property.js +3 -1
- package/src/node/assertion/satisfies.js +3 -1
- package/src/node/assertion/subproof.js +3 -1
- package/src/node/assertion/type.js +3 -1
- package/src/node/axiom.js +3 -1
- package/src/node/combinator.js +3 -1
- package/src/node/conclusion.js +3 -1
- package/src/node/conjecture.js +3 -1
- package/src/node/constructor.js +3 -1
- package/src/node/declaration/combinator.js +13 -1
- package/src/node/declaration/complexType.js +73 -1
- package/src/node/declaration/constructor.js +47 -1
- package/src/node/declaration/metavariable.js +3 -1
- package/src/node/declaration/property.js +36 -0
- package/src/node/declaration/type.js +58 -1
- package/src/node/declaration/variable.js +67 -1
- package/src/node/declaration.js +3 -1
- package/src/node/deduction.js +3 -1
- package/src/node/derivation.js +3 -1
- package/src/node/equality.js +3 -1
- package/src/node/error.js +3 -1
- package/src/node/frame.js +3 -1
- package/src/node/judgement.js +3 -1
- package/src/node/label.js +3 -1
- package/src/node/lemma.js +3 -1
- package/src/node/metaLemma.js +3 -1
- package/src/node/metaType.js +15 -1
- package/src/node/metatheorem.js +3 -1
- package/src/node/metavariable.js +15 -1
- package/src/node/parameter.js +3 -1
- package/src/node/premise.js +3 -1
- package/src/node/procedureCall.js +3 -1
- package/src/node/proof.js +3 -1
- package/src/node/property.js +18 -1
- package/src/node/propertyRelation.js +3 -1
- package/src/node/reference.js +3 -1
- package/src/node/rule.js +3 -1
- package/src/node/statement.js +3 -1
- package/src/node/step.js +3 -1
- package/src/node/subDerivation.js +3 -1
- package/src/node/subproof.js +3 -1
- package/src/node/supposition.js +3 -1
- package/src/node/term.js +3 -1
- package/src/node/theorem.js +3 -1
- package/src/node/topLevelAssertion.js +3 -1
- package/src/node/topLevelMetaAssertion.js +3 -1
- package/src/node/type.js +15 -1
- package/src/node/variable.js +15 -1
- package/src/node.js +23 -1
- package/src/nodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/unifier/metavariable.js +1 -2
- package/src/unifier/statementWithCombinator.js +1 -2
- package/src/unifier/termWithConstructor.js +1 -2
- package/src/utilities/customGrammar.js +3 -1
- package/src/utilities/node.js +72 -0
- package/src/verifier/combinator.js +1 -2
- package/src/verifier/constructor.js +1 -2
- package/lib/utilities/name.js +0 -44
- package/lib/utilities/parser.js +0 -28
- package/src/utilities/name.js +0 -39
- package/src/utilities/parser.js +0 -21
package/src/dom/term.js
CHANGED
|
@@ -7,6 +7,7 @@ import LocalContext from "../context/local";
|
|
|
7
7
|
import verifyMixins from "../mixins/term/verify";
|
|
8
8
|
|
|
9
9
|
import { domAssigned } from "../dom";
|
|
10
|
+
import { termFromTermNode } from "../utilities/node";
|
|
10
11
|
import { nodeQuery, nodesQuery } from "../utilities/query"
|
|
11
12
|
import { termNodeFromTermString } from "../context/partial/term";
|
|
12
13
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
@@ -19,8 +20,7 @@ const variableNodesQuery = nodesQuery("//variable"),
|
|
|
19
20
|
definedAssertionTermNodeQuery = nodeQuery("/definedAssertion/term"),
|
|
20
21
|
propertyRelationTermNodeQuery = nodeQuery("/propertyRelation/term"),
|
|
21
22
|
propertyAssertionTermNodeQuery = nodeQuery("/propertyAssertion/term"),
|
|
22
|
-
containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term")
|
|
23
|
-
constructorDeclarationTermNodeQuery = nodeQuery("/constructorDeclaration/term");
|
|
23
|
+
containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term");
|
|
24
24
|
|
|
25
25
|
export default domAssigned(class Term {
|
|
26
26
|
constructor(string, node, type) {
|
|
@@ -79,6 +79,8 @@ export default domAssigned(class Term {
|
|
|
79
79
|
return termNodeMatches;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
isProvisional() { return this.type.isProvisional(); }
|
|
83
|
+
|
|
82
84
|
isEqualTo(term) {
|
|
83
85
|
const termString = term.getString(),
|
|
84
86
|
equalTo = (termString === this.string);
|
|
@@ -282,10 +284,11 @@ export default domAssigned(class Term {
|
|
|
282
284
|
return term;
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
287
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
|
|
286
288
|
const { Type } = dom,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
+
termNode = constructorDeclarationNode.getTermNode(),
|
|
290
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
291
|
+
context = localContext, ///
|
|
289
292
|
term = termFromTermNode(termNode, context),
|
|
290
293
|
type = Type.fromConstructorDeclarationNode(constructorDeclarationNode, context);
|
|
291
294
|
|
|
@@ -295,12 +298,3 @@ export default domAssigned(class Term {
|
|
|
295
298
|
}
|
|
296
299
|
});
|
|
297
300
|
|
|
298
|
-
function termFromTermNode(termNode, context) {
|
|
299
|
-
const { Term } = dom,
|
|
300
|
-
node = termNode, ///
|
|
301
|
-
string = context.nodeAsString(node),
|
|
302
|
-
type = null,
|
|
303
|
-
term = new Term(string, node, type);
|
|
304
|
-
|
|
305
|
-
return term;
|
|
306
|
-
}
|
package/src/dom/type.js
CHANGED
|
@@ -4,25 +4,16 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
6
|
|
|
7
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
8
9
|
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
9
|
-
import {
|
|
10
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
|
-
import { PROVISIONAL, PROVISIONALLY } from "../constants";
|
|
10
|
+
import { typeFromTypeNode } from "../utilities/node";
|
|
12
11
|
import { superTypesStringFromSuperTypes } from "../utilities/type";
|
|
13
12
|
import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, propertiesToPropertiesJSON } from "../utilities/json";
|
|
14
13
|
|
|
15
14
|
const { push, first } = arrayUtilities;
|
|
16
15
|
|
|
17
|
-
const typeAssertionTypeNodeQuery = nodeQuery("/typeAssertion/type")
|
|
18
|
-
typeDeclarationTypeNodeQuery = nodeQuery("/typeDeclaration|complexTypeDeclaration/type"),
|
|
19
|
-
propertyDeclarationNodesQuery = nodesQuery("/complexTypeDeclaration/propertyDeclaration"),
|
|
20
|
-
propertyDeclarationTypeNodeQuery = nodeQuery("/propertyDeclaration/type"),
|
|
21
|
-
variableDeclarationTypeNodeQuery = nodeQuery("/variableDeclaration/type"),
|
|
22
|
-
typeDeclarationSuperTypeNodesQuery = nodesQuery("/typeDeclaration|complexTypeDeclaration/types/type"),
|
|
23
|
-
constructorDeclarationSuperTypeNodeQuery = nodeQuery("/constructorDeclaration/type"),
|
|
24
|
-
firstTypeDeclarationPrimaryKeywordTerminalNodeQuery = nodeQuery("/typeDeclaration|complexTypeDeclaration/@primary-keyword[0]"),
|
|
25
|
-
lastVariableDeclarationSecondaryKeywordTerminalNodeQuery = nodeQuery("/variableDeclaration/@secondary-keyword[-1]");
|
|
16
|
+
const typeAssertionTypeNodeQuery = nodeQuery("/typeAssertion/type");
|
|
26
17
|
|
|
27
18
|
class Type {
|
|
28
19
|
constructor(string, name, superTypes, properties, provisional) {
|
|
@@ -100,7 +91,18 @@ class Type {
|
|
|
100
91
|
}
|
|
101
92
|
|
|
102
93
|
isBasic() {
|
|
103
|
-
|
|
94
|
+
let basic = false;
|
|
95
|
+
|
|
96
|
+
const superTypesLength = this.superTypes.length;
|
|
97
|
+
|
|
98
|
+
if (superTypesLength === 1) {
|
|
99
|
+
const firstSuperType = first(this.superTypes),
|
|
100
|
+
superType = firstSuperType; ///
|
|
101
|
+
|
|
102
|
+
if (superType === objectType) {
|
|
103
|
+
basic = true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
104
106
|
|
|
105
107
|
return basic;
|
|
106
108
|
}
|
|
@@ -258,9 +260,10 @@ class Type {
|
|
|
258
260
|
|
|
259
261
|
static fromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
260
262
|
const properties = [],
|
|
261
|
-
provisional =
|
|
263
|
+
provisional = typeDeclarationNode.isProvisional(),
|
|
264
|
+
typeName = typeDeclarationNode.getTypeName(),
|
|
265
|
+
name = typeName, ///
|
|
262
266
|
superTypes = superTypesFromTypeDeclarationNode(typeDeclarationNode, fileContext),
|
|
263
|
-
name = nameFromTypeDeclarationNode(typeDeclarationNode, fileContext),
|
|
264
267
|
string = stringFromNameAndSuperTypes(name, superTypes),
|
|
265
268
|
type = new Type(string, name, superTypes, properties, provisional);
|
|
266
269
|
|
|
@@ -268,37 +271,36 @@ class Type {
|
|
|
268
271
|
}
|
|
269
272
|
|
|
270
273
|
static fromPropertyDeclarationNode(propertyDeclarationNode, fileContext) {
|
|
271
|
-
const
|
|
272
|
-
typeNode = propertyDeclarationTypeNode, ///
|
|
274
|
+
const typeNode = propertyDeclarationNode.getTypeNode(),
|
|
273
275
|
type = typeFromTypeNode(typeNode, fileContext);
|
|
274
276
|
|
|
275
277
|
return type;
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
static
|
|
279
|
-
|
|
280
|
-
superTypes = null,
|
|
281
|
-
provisional = provisionalFromVariableDeclarationNode(variableDeclarationNode, fileContext),
|
|
282
|
-
name = nameFromVariableDeclarationNode(variableDeclarationNode, fileContext),
|
|
283
|
-
string = stringFromName(name),
|
|
284
|
-
type = new Type(string, name, superTypes, properties, provisional);
|
|
280
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
|
|
281
|
+
let type;
|
|
285
282
|
|
|
286
|
-
|
|
287
|
-
}
|
|
283
|
+
const typeNode = constructorDeclarationNode.getTypeNode();
|
|
288
284
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
285
|
+
if (typeNode === null) {
|
|
286
|
+
type = objectType;
|
|
287
|
+
} else {
|
|
288
|
+
const provisional = constructorDeclarationNode.isProvisional();
|
|
289
|
+
|
|
290
|
+
type = typeFromTypeNode(typeNode, fileContext);
|
|
291
|
+
|
|
292
|
+
type.setProvisional(provisional);
|
|
293
|
+
}
|
|
293
294
|
|
|
294
295
|
return type;
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
298
299
|
const properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
299
|
-
provisional =
|
|
300
|
+
provisional = complexTypeDeclarationNode.isProvisional(),
|
|
301
|
+
typeName = complexTypeDeclarationNode.getTypeName(),
|
|
302
|
+
name = typeName,
|
|
300
303
|
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
301
|
-
name = nameFromComplexTypeDeclaration(complexTypeDeclarationNode, fileContext),
|
|
302
304
|
string = stringFromNameAndSuperTypes(name, superTypes),
|
|
303
305
|
type = new Type(string, name, superTypes, properties, provisional);
|
|
304
306
|
|
|
@@ -308,51 +310,6 @@ class Type {
|
|
|
308
310
|
|
|
309
311
|
export default domAssigned(Type);
|
|
310
312
|
|
|
311
|
-
function stringFromName(name) {
|
|
312
|
-
const string = (name !== null) ?
|
|
313
|
-
name :
|
|
314
|
-
OBJECT_TYPE_NAME;
|
|
315
|
-
|
|
316
|
-
return string;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function typeFromTypeNode(typeNode, fileContext) {
|
|
320
|
-
let type;
|
|
321
|
-
|
|
322
|
-
if (typeNode === null) {
|
|
323
|
-
type = objectType;
|
|
324
|
-
} else {
|
|
325
|
-
const { Type } = dom,
|
|
326
|
-
typeName = typeNameFromTypeNode(typeNode),
|
|
327
|
-
name = typeName, ///
|
|
328
|
-
string = name, ///
|
|
329
|
-
superTypes = null,
|
|
330
|
-
properties = null,
|
|
331
|
-
provisional = null;
|
|
332
|
-
|
|
333
|
-
type = new Type(string, name, superTypes, properties, provisional);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return type;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
function basicFromSuperTypes(superTypes) {
|
|
340
|
-
let basic = false;
|
|
341
|
-
|
|
342
|
-
const superTypesLength = superTypes.length;
|
|
343
|
-
|
|
344
|
-
if (superTypesLength === 1) {
|
|
345
|
-
const firstSuperType = first(superTypes),
|
|
346
|
-
superType = firstSuperType; ///
|
|
347
|
-
|
|
348
|
-
if (superType === objectType) {
|
|
349
|
-
basic = true;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return basic;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
313
|
function stringFromNameAndSuperTypes(name, superTypes) {
|
|
357
314
|
let string;
|
|
358
315
|
|
|
@@ -369,44 +326,10 @@ function stringFromNameAndSuperTypes(name, superTypes) {
|
|
|
369
326
|
return string;
|
|
370
327
|
}
|
|
371
328
|
|
|
372
|
-
function nameFromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
373
|
-
const typeDeclarationTypeNode = typeDeclarationTypeNodeQuery(typeDeclarationNode),
|
|
374
|
-
typeNode = typeDeclarationTypeNode, ///
|
|
375
|
-
typeName = typeNameFromTypeNode(typeNode),
|
|
376
|
-
name = typeName; ///
|
|
377
|
-
|
|
378
|
-
return name;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function nameFromComplexTypeDeclaration(complexTypeDeclarationNode, fileContext) {
|
|
382
|
-
const typeDeclarationTypeNode = typeDeclarationTypeNodeQuery(complexTypeDeclarationNode),
|
|
383
|
-
typeNode = typeDeclarationTypeNode, ///
|
|
384
|
-
typeName = typeNameFromTypeNode(typeNode),
|
|
385
|
-
name = typeName; ///
|
|
386
|
-
|
|
387
|
-
return name;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function nameFromVariableDeclarationNode(variableDeclarationNode, fileContext) {
|
|
391
|
-
let name = null;
|
|
392
|
-
|
|
393
|
-
const variableDeclarationTypeNode = variableDeclarationTypeNodeQuery(variableDeclarationNode);
|
|
394
|
-
|
|
395
|
-
if (variableDeclarationTypeNode !== null) {
|
|
396
|
-
const typeNode = variableDeclarationTypeNode, ///
|
|
397
|
-
typeName = typeNameFromTypeNode(typeNode);
|
|
398
|
-
|
|
399
|
-
name = typeName; ///
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return name;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
329
|
function superTypesFromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
406
|
-
const
|
|
407
|
-
superTypes =
|
|
408
|
-
const
|
|
409
|
-
superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
330
|
+
const superTypeNodes = typeDeclarationNode.getSuperTypeNodes(),
|
|
331
|
+
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
332
|
+
const superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
410
333
|
|
|
411
334
|
return superType;
|
|
412
335
|
}),
|
|
@@ -419,35 +342,10 @@ function superTypesFromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
|
419
342
|
return superTypes;
|
|
420
343
|
}
|
|
421
344
|
|
|
422
|
-
function provisionalFromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
423
|
-
const firstTypeDeclarationPrimaryKeywordTerminalNode = firstTypeDeclarationPrimaryKeywordTerminalNodeQuery(typeDeclarationNode),
|
|
424
|
-
content = firstTypeDeclarationPrimaryKeywordTerminalNode.getContent(),
|
|
425
|
-
contentProvisional = (content === PROVISIONAL),
|
|
426
|
-
provisional = contentProvisional; ///
|
|
427
|
-
|
|
428
|
-
return provisional;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function provisionalFromVariableDeclarationNode(variableDeclarationNode, fileContext) {
|
|
432
|
-
let provisional = false;
|
|
433
|
-
|
|
434
|
-
const lastVariableDeclarationSecondaryKeywordTerminalNode = lastVariableDeclarationSecondaryKeywordTerminalNodeQuery(variableDeclarationNode);
|
|
435
|
-
|
|
436
|
-
if (lastVariableDeclarationSecondaryKeywordTerminalNode !== null) {
|
|
437
|
-
const content = lastVariableDeclarationSecondaryKeywordTerminalNode.getContent(),
|
|
438
|
-
contentProvisional = (content === PROVISIONALLY);
|
|
439
|
-
|
|
440
|
-
provisional = contentProvisional; ///
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
return provisional;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
345
|
function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
447
|
-
const
|
|
448
|
-
superTypes =
|
|
449
|
-
const
|
|
450
|
-
superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
346
|
+
const superTypeNodes = complexTypeDeclarationNode.getSuperTypeNodes(),
|
|
347
|
+
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
348
|
+
const superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
451
349
|
|
|
452
350
|
return superType;
|
|
453
351
|
}),
|
|
@@ -461,10 +359,10 @@ function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fi
|
|
|
461
359
|
}
|
|
462
360
|
|
|
463
361
|
function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
464
|
-
const
|
|
362
|
+
const { Property } = dom,
|
|
363
|
+
propertyDeclarationNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
|
|
465
364
|
properties = propertyDeclarationNodes.map((propertyDeclarationNode) => {
|
|
466
|
-
const
|
|
467
|
-
property = Property.fromPropertyDeclarationNode(propertyDeclarationNode, fileContext);
|
|
365
|
+
const property = Property.fromPropertyDeclarationNode(propertyDeclarationNode, fileContext);
|
|
468
366
|
|
|
469
367
|
return property;
|
|
470
368
|
});
|
|
@@ -473,27 +371,9 @@ function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fi
|
|
|
473
371
|
}
|
|
474
372
|
|
|
475
373
|
class ObjectType extends Type {
|
|
476
|
-
getProperties() {
|
|
477
|
-
const properties = [];
|
|
478
|
-
|
|
479
|
-
return properties;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// matchName(name) {
|
|
483
|
-
// const nameMatches = ((name === null) || (name === OBJECT_TYPE_NAME));
|
|
484
|
-
//
|
|
485
|
-
// return nameMatches;
|
|
486
|
-
// }
|
|
487
|
-
//
|
|
488
|
-
// matchTypeName(typeName) {
|
|
489
|
-
// const typeNameMatches = ((typeName === null) || (typeName === OBJECT_TYPE_NAME));
|
|
490
|
-
//
|
|
491
|
-
// return typeNameMatches;
|
|
492
|
-
// }
|
|
493
|
-
|
|
494
374
|
static fromNothing() {
|
|
495
|
-
const name =
|
|
496
|
-
string =
|
|
375
|
+
const name = OBJECT_TYPE_NAME,
|
|
376
|
+
string = name, ///
|
|
497
377
|
superTypes = [],
|
|
498
378
|
properties = [],
|
|
499
379
|
provisional = false,
|
package/src/dom/variable.js
CHANGED
|
@@ -8,12 +8,11 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
import { ObjectType } from "./type";
|
|
9
9
|
import { domAssigned } from "../dom";
|
|
10
10
|
import { EMPTY_STRING } from "../constants";
|
|
11
|
+
import { typeFromTypeNode } from "../utilities/node";
|
|
11
12
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
12
|
-
import { variableNameFromVariableNode } from "../utilities/name";
|
|
13
13
|
import { variableNodeFromVariableString } from "../context/partial/variable";
|
|
14
14
|
|
|
15
|
-
const termVariableNodeQuery = nodeQuery("/term/variable!")
|
|
16
|
-
variableDeclarationVariableNodeQuery = nodeQuery("/variableDeclaration/variable");
|
|
15
|
+
const termVariableNodeQuery = nodeQuery("/term/variable!");
|
|
17
16
|
|
|
18
17
|
export default domAssigned(class Variable {
|
|
19
18
|
constructor(string, node, name, type, propertyRelations) {
|
|
@@ -197,7 +196,7 @@ export default domAssigned(class Variable {
|
|
|
197
196
|
context = localContext, ///
|
|
198
197
|
variableString = string, ///
|
|
199
198
|
variableNode = variableNodeFromVariableString(variableString, context),
|
|
200
|
-
variableName =
|
|
199
|
+
variableName = variableNode.getVariableName(),
|
|
201
200
|
node = variableNode,
|
|
202
201
|
name = variableName, ///
|
|
203
202
|
type = typeFromJSON(json, fileContext),
|
|
@@ -245,13 +244,22 @@ export default domAssigned(class Variable {
|
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
static fromVariableDeclarationNode(variableDeclarationNode, fileContext) {
|
|
248
|
-
const {
|
|
249
|
-
variableDeclarationVariableNode = variableDeclarationVariableNodeQuery(variableDeclarationNode),
|
|
250
|
-
variableNode = variableDeclarationVariableNode, ///
|
|
247
|
+
const { Variable } = dom,
|
|
251
248
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
252
|
-
context = localContext,
|
|
253
|
-
|
|
254
|
-
|
|
249
|
+
context = localContext,
|
|
250
|
+
provisional = variableDeclarationNode.isProvisional(),
|
|
251
|
+
typeNode = variableDeclarationNode.getTypeNode(),
|
|
252
|
+
type = typeFromTypeNode(typeNode);
|
|
253
|
+
|
|
254
|
+
type.setProvisional(provisional);
|
|
255
|
+
|
|
256
|
+
const variableNode = variableDeclarationNode.getVariableNode(),
|
|
257
|
+
variableName = variableDeclarationNode.getVariableName(),
|
|
258
|
+
node = variableNode, ///
|
|
259
|
+
name = variableName, ///
|
|
260
|
+
string = context.nodeAsString(node),
|
|
261
|
+
propertyRelations = [],
|
|
262
|
+
variable = new Variable(string, node, name, type, propertyRelations);
|
|
255
263
|
|
|
256
264
|
return variable;
|
|
257
265
|
}
|
|
@@ -281,7 +289,7 @@ export default domAssigned(class Variable {
|
|
|
281
289
|
function variableFromVariableNodeAndType(variableNode, type, context) {
|
|
282
290
|
const { Variable } = dom,
|
|
283
291
|
node = variableNode, ///
|
|
284
|
-
variableName =
|
|
292
|
+
variableName = variableNode.getVariableName(),
|
|
285
293
|
string = context.nodeAsString(node),
|
|
286
294
|
name = variableName, ///
|
|
287
295
|
propertyRelations = [],
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function fromFirstChildNode(callback) {
|
|
4
|
+
let result;
|
|
5
|
+
|
|
6
|
+
const firstIndex = 0;
|
|
7
|
+
|
|
8
|
+
this.forwardsSomeChildNode((childNode, index) => {
|
|
9
|
+
if (index === firstIndex) {
|
|
10
|
+
const firstChildNode = childNode; ///
|
|
11
|
+
|
|
12
|
+
result = callback(firstChildNode);
|
|
13
|
+
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fromSecondChildNode(callback) {
|
|
22
|
+
let result;
|
|
23
|
+
|
|
24
|
+
const secondIndex = 1;
|
|
25
|
+
|
|
26
|
+
this.forwardsSomeChildNode((childNode, index) => {
|
|
27
|
+
if (index === secondIndex) {
|
|
28
|
+
const firstChildNode = childNode; ///
|
|
29
|
+
|
|
30
|
+
result = callback(firstChildNode);
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function fromThirdChildNode(callback) {
|
|
40
|
+
let result;
|
|
41
|
+
|
|
42
|
+
const thirdIndex = 2;
|
|
43
|
+
|
|
44
|
+
this.forwardsSomeChildNode((childNode, index) => {
|
|
45
|
+
if (index === thirdIndex) {
|
|
46
|
+
const thirdChildNode = childNode; ///
|
|
47
|
+
|
|
48
|
+
result = callback(thirdChildNode);
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function fromFourthChildNode(callback) {
|
|
58
|
+
let result;
|
|
59
|
+
|
|
60
|
+
const fourthIndex = 3;
|
|
61
|
+
|
|
62
|
+
this.forwardsSomeChildNode((childNode, index) => {
|
|
63
|
+
if (index === fourthIndex) {
|
|
64
|
+
const fourthChildNode = childNode; ///
|
|
65
|
+
|
|
66
|
+
result = callback(fourthChildNode);
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function fromFifthChildNode(callback) {
|
|
76
|
+
let result;
|
|
77
|
+
|
|
78
|
+
const fifthIndex = 4;
|
|
79
|
+
|
|
80
|
+
this.forwardsSomeChildNode((childNode, index) => {
|
|
81
|
+
if (index === fifthIndex) {
|
|
82
|
+
const fifthChildNode = childNode; ///
|
|
83
|
+
|
|
84
|
+
result = callback(fifthChildNode);
|
|
85
|
+
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function fromFirstLastChildNode(callback) {
|
|
94
|
+
let result;
|
|
95
|
+
|
|
96
|
+
const multiplicity = this.getMultiplicity(),
|
|
97
|
+
firstLastIndex = multiplicity - 1;
|
|
98
|
+
|
|
99
|
+
this.backwardsSomeChildNode((childNode, index) => {
|
|
100
|
+
if (index === firstLastIndex) {
|
|
101
|
+
const firstLastChildNode = childNode; ///
|
|
102
|
+
|
|
103
|
+
result = callback(firstLastChildNode);
|
|
104
|
+
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function fromSecondLastChildNode(callback) {
|
|
113
|
+
let result;
|
|
114
|
+
|
|
115
|
+
const multiplicity = this.getMultiplicity(),
|
|
116
|
+
secondLastIndex = multiplicity - 2;
|
|
117
|
+
|
|
118
|
+
this.backwardsSomeChildNode((childNode, index) => {
|
|
119
|
+
if (index === secondLastIndex) {
|
|
120
|
+
const secondLastChildNode = childNode; ///
|
|
121
|
+
|
|
122
|
+
result = callback(secondLastChildNode);
|
|
123
|
+
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function fromThirdLastChildNode(callback) {
|
|
132
|
+
let result;
|
|
133
|
+
|
|
134
|
+
const multiplicity = this.getMultiplicity(),
|
|
135
|
+
thirdLastIndex = multiplicity - 3;
|
|
136
|
+
|
|
137
|
+
this.backwardsSomeChildNode((childNode, index) => {
|
|
138
|
+
if (index === thirdLastIndex) {
|
|
139
|
+
const thirdLastChildNode = childNode; ///
|
|
140
|
+
|
|
141
|
+
result = callback(thirdLastChildNode);
|
|
142
|
+
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function fromFourthLastChildNode(callback) {
|
|
151
|
+
let result;
|
|
152
|
+
|
|
153
|
+
const multiplicity = this.getMultiplicity(),
|
|
154
|
+
fourthLastIndex = multiplicity - 4;
|
|
155
|
+
|
|
156
|
+
this.backwardsSomeChildNode((childNode, index) => {
|
|
157
|
+
if (index === fourthLastIndex) {
|
|
158
|
+
const fourthLastChildNode = childNode; ///
|
|
159
|
+
|
|
160
|
+
result = callback(fourthLastChildNode);
|
|
161
|
+
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function fromFifthLastChildNode(callback) {
|
|
170
|
+
let result;
|
|
171
|
+
|
|
172
|
+
const multiplicity = this.getMultiplicity(),
|
|
173
|
+
fifthLastIndex = multiplicity - 5;
|
|
174
|
+
|
|
175
|
+
this.backwardsSomeChildNode((childNode, index) => {
|
|
176
|
+
if (index === fifthLastIndex) {
|
|
177
|
+
const fifthLastChildNode = childNode; ///
|
|
178
|
+
|
|
179
|
+
result = callback(fifthLastChildNode);
|
|
180
|
+
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const nodeMixins = {
|
|
189
|
+
fromFirstChildNode,
|
|
190
|
+
fromSecondChildNode,
|
|
191
|
+
fromThirdChildNode,
|
|
192
|
+
fromFourthChildNode,
|
|
193
|
+
fromFifthChildNode,
|
|
194
|
+
fromFirstLastChildNode,
|
|
195
|
+
fromSecondLastChildNode,
|
|
196
|
+
fromThirdLastChildNode,
|
|
197
|
+
fromFourthLastChildNode,
|
|
198
|
+
fromFifthLastChildNode
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export default nodeMixins;
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class ContainedAssertionNode extends Node {
|
|
5
|
+
export default class ContainedAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(ContainedAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class DefinedAssertionNode extends Node {
|
|
5
|
+
export default class DefinedAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(DefinedAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class PropertyAssertionNode extends Node {
|
|
5
|
+
export default class PropertyAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(PropertyAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class SatisfiesAssertionNode extends Node {
|
|
5
|
+
export default class SatisfiesAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(SatisfiesAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class SubproofAssertionNode extends Node {
|
|
5
|
+
export default class SubproofAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(SubproofAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../../node";
|
|
4
4
|
|
|
5
|
-
export default class TypeAssertionNode extends Node {
|
|
5
|
+
export default class TypeAssertionNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(TypeAssertionNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
package/src/node/axiom.js
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../node";
|
|
4
4
|
|
|
5
|
-
export default class AxiomNode extends Node {
|
|
5
|
+
export default class AxiomNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(AxiomNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|
package/src/node/combinator.js
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Node from "../node";
|
|
4
4
|
|
|
5
|
-
export default class CombinatorNode extends Node {
|
|
5
|
+
export default class CombinatorNode extends Node {
|
|
6
|
+
static fromRuleNameChildNodesAndOpacity(ruleName, childNodes, opacity) { return Node.fromRuleNameChildNodesAndOpacity(CombinatorNode, ruleName, childNodes, opacity); }
|
|
7
|
+
}
|