occam-verify-cli 1.0.317 → 1.0.320
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.js +44 -17
- package/lib/context/local.js +15 -2
- package/lib/context/release.js +33 -2
- package/lib/dom/declaration/combinator.js +2 -2
- package/lib/dom/declaration/complexType.js +25 -15
- package/lib/dom/declaration/constructor.js +2 -2
- package/lib/dom/declaration/simpleType.js +26 -16
- package/lib/dom/declaration/typePrefix.js +176 -0
- package/lib/dom/property.js +3 -3
- package/lib/dom/topLevelAssertion.js +1 -43
- package/lib/dom/type.js +53 -17
- package/lib/dom/typePrefix.js +100 -0
- package/lib/dom/variable.js +2 -2
- package/lib/index.js +3 -1
- package/lib/node/declaration/complexType.js +15 -1
- package/lib/node/declaration/simpleType.js +15 -1
- package/lib/node/declaration/typePrefix.js +123 -0
- package/lib/node/type.js +27 -17
- package/lib/node/typePrefix.js +6 -6
- package/lib/nonTerminalNodeMap.js +6 -4
- package/lib/ruleNames.js +11 -3
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/node.js +10 -4
- package/lib/utilities/type.js +10 -5
- package/lib/verifier/topLevel.js +9 -2
- package/package.json +1 -1
- package/src/context/file.js +47 -24
- package/src/context/local.js +5 -1
- package/src/context/release.js +41 -1
- package/src/dom/declaration/combinator.js +1 -1
- package/src/dom/declaration/complexType.js +29 -19
- package/src/dom/declaration/constructor.js +1 -1
- package/src/dom/declaration/simpleType.js +29 -20
- package/src/dom/declaration/typePrefix.js +102 -0
- package/src/dom/property.js +1 -1
- package/src/dom/topLevelAssertion.js +3 -15
- package/src/dom/type.js +77 -20
- package/src/dom/typePrefix.js +54 -0
- package/src/dom/variable.js +1 -1
- package/src/index.js +2 -0
- package/src/node/declaration/complexType.js +14 -0
- package/src/node/declaration/simpleType.js +14 -0
- package/src/node/declaration/typePrefix.js +24 -0
- package/src/node/type.js +29 -17
- package/src/node/typePrefix.js +4 -4
- package/src/nonTerminalNodeMap.js +45 -39
- package/src/ruleNames.js +4 -2
- package/src/utilities/json.js +1 -1
- package/src/utilities/node.js +13 -4
- package/src/utilities/type.js +12 -5
- package/src/verifier/topLevel.js +11 -0
package/src/dom/property.js
CHANGED
|
@@ -28,7 +28,7 @@ export default domAssigned(class Property {
|
|
|
28
28
|
this.type = type;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
matchTypeName(typeName) { return this.type.matchTypeName(typeName); }
|
|
31
|
+
matchTypeName(typeName, prefixed, context) { return this.type.matchTypeName(typeName, prefixed, context); }
|
|
32
32
|
|
|
33
33
|
matchPropertyName(propertyName) {
|
|
34
34
|
const propertyNameMatches = (this.name === propertyName);
|
|
@@ -68,21 +68,9 @@ export default class TopLevelAssertion {
|
|
|
68
68
|
return this.hypotheses;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
setLabels(labels) { this.labels = labels; }
|
|
76
|
-
|
|
77
|
-
setSuppositions(suppositions) { this.suppositions = suppositions; }
|
|
78
|
-
|
|
79
|
-
setDeduction(deduction) { this.deduction = deduction; }
|
|
80
|
-
|
|
81
|
-
setProof(proof) { this.proof = proof; }
|
|
82
|
-
|
|
83
|
-
setSignature(signature) { this.signature = signature; }
|
|
84
|
-
|
|
85
|
-
setHypotheses(hypotheses) { this.hypotheses = hypotheses; }
|
|
71
|
+
setHypotheses(hypotheses) {
|
|
72
|
+
this.hypotheses = hypotheses;
|
|
73
|
+
}
|
|
86
74
|
|
|
87
75
|
getStatement() { return this.deduction.getStatement(); }
|
|
88
76
|
|
package/src/dom/type.js
CHANGED
|
@@ -7,13 +7,14 @@ import dom from "../dom";
|
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
8
|
import { OBJECT_TYPE_NAME } from "../constants";
|
|
9
9
|
import { typeFromTypeNode } from "../utilities/node";
|
|
10
|
-
import {
|
|
10
|
+
import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../utilities/type";
|
|
11
11
|
import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, propertiesToPropertiesJSON } from "../utilities/json";
|
|
12
12
|
|
|
13
13
|
const { push, first } = arrayUtilities;
|
|
14
14
|
|
|
15
15
|
class Type {
|
|
16
|
-
constructor(string, name, superTypes, properties, provisional) {
|
|
16
|
+
constructor(context, string, name, superTypes, properties, provisional) {
|
|
17
|
+
this.context = context;
|
|
17
18
|
this.string = string;
|
|
18
19
|
this.name = name;
|
|
19
20
|
this.superTypes = superTypes;
|
|
@@ -21,6 +22,10 @@ class Type {
|
|
|
21
22
|
this.provisional = provisional;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
getContext() {
|
|
26
|
+
return this.context;
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
getString() {
|
|
25
30
|
return this.string;
|
|
26
31
|
}
|
|
@@ -67,10 +72,6 @@ class Type {
|
|
|
67
72
|
return provisional;
|
|
68
73
|
}
|
|
69
74
|
|
|
70
|
-
setString(string) {
|
|
71
|
-
this.string = string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
75
|
setName(name) {
|
|
75
76
|
this.name = name;
|
|
76
77
|
}
|
|
@@ -87,6 +88,42 @@ class Type {
|
|
|
87
88
|
this.provisional = provisional;
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
getPrefix() {
|
|
92
|
+
let prefix = null;
|
|
93
|
+
|
|
94
|
+
if (this.context !== null) {
|
|
95
|
+
const typePrefix = this.context.getTypePrefix();
|
|
96
|
+
|
|
97
|
+
prefix = typePrefix; ///
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return prefix;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
isInternal(context) {
|
|
104
|
+
let internal,
|
|
105
|
+
fileContext,
|
|
106
|
+
releaseContext;
|
|
107
|
+
|
|
108
|
+
if (this.context !== null) {
|
|
109
|
+
fileContext = this.context; ///
|
|
110
|
+
|
|
111
|
+
releaseContext = fileContext.getReleaseContext();
|
|
112
|
+
|
|
113
|
+
const internalReleaseContext = releaseContext; ///
|
|
114
|
+
|
|
115
|
+
fileContext = context; ///
|
|
116
|
+
|
|
117
|
+
releaseContext = fileContext.getReleaseContext();
|
|
118
|
+
|
|
119
|
+
internal = (internalReleaseContext === releaseContext); ///
|
|
120
|
+
} else {
|
|
121
|
+
internal = false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return internal;
|
|
125
|
+
}
|
|
126
|
+
|
|
90
127
|
isBasic() {
|
|
91
128
|
let basic = false;
|
|
92
129
|
|
|
@@ -182,8 +219,22 @@ class Type {
|
|
|
182
219
|
return equalToOrSuperTypeOf;
|
|
183
220
|
}
|
|
184
221
|
|
|
185
|
-
matchTypeName(typeName) {
|
|
186
|
-
|
|
222
|
+
matchTypeName(typeName, prefixed, context) {
|
|
223
|
+
let typeNameMatches;
|
|
224
|
+
|
|
225
|
+
const naked = !prefixed,
|
|
226
|
+
internal = this.isInternal(context);
|
|
227
|
+
|
|
228
|
+
if (naked || internal) {
|
|
229
|
+
typeNameMatches = (this.name === typeName);
|
|
230
|
+
} else {
|
|
231
|
+
const prefix = this.getPrefix(),
|
|
232
|
+
name = (prefix !== null) ?
|
|
233
|
+
`${prefix}${this.name}` :
|
|
234
|
+
this.name;
|
|
235
|
+
|
|
236
|
+
typeNameMatches = (name === typeName);
|
|
237
|
+
}
|
|
187
238
|
|
|
188
239
|
return typeNameMatches;
|
|
189
240
|
}
|
|
@@ -226,8 +277,9 @@ class Type {
|
|
|
226
277
|
properties = propertiesFromJSON(json, context),
|
|
227
278
|
superTypes = superTypesFromJSON(json, context),
|
|
228
279
|
typeName = name, ///
|
|
229
|
-
|
|
230
|
-
|
|
280
|
+
typePrefixName = null,
|
|
281
|
+
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
282
|
+
type = new Type(context, string, name, superTypes, properties, provisional);
|
|
231
283
|
|
|
232
284
|
return type;
|
|
233
285
|
}
|
|
@@ -246,16 +298,18 @@ class Type {
|
|
|
246
298
|
}
|
|
247
299
|
|
|
248
300
|
static fromTypeAndProvisional(type, provisional) {
|
|
249
|
-
const
|
|
301
|
+
const context = type.getContext(),
|
|
302
|
+
name = type.getName(),
|
|
250
303
|
superType = type, ///
|
|
251
304
|
typeName = name, ///
|
|
305
|
+
typePrefixName = null,
|
|
252
306
|
superTypes = [
|
|
253
307
|
superType
|
|
254
308
|
],
|
|
255
|
-
string =
|
|
309
|
+
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
256
310
|
properties = type.getProperties();
|
|
257
311
|
|
|
258
|
-
type = new Type(string, name, superTypes, properties, provisional); ///
|
|
312
|
+
type = new Type(context, string, name, superTypes, properties, provisional); ///
|
|
259
313
|
|
|
260
314
|
return type;
|
|
261
315
|
}
|
|
@@ -271,10 +325,11 @@ class Type {
|
|
|
271
325
|
const properties = [],
|
|
272
326
|
provisional = simpleTypeDeclarationNode.isProvisional(),
|
|
273
327
|
typeName = simpleTypeDeclarationNode.getTypeName(),
|
|
328
|
+
typePrefixName = simpleTypeDeclarationNode.getTypePrefixName(),
|
|
274
329
|
name = typeName, ///
|
|
275
330
|
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
|
|
276
|
-
string =
|
|
277
|
-
type = new Type(string, name, superTypes, properties, provisional);
|
|
331
|
+
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
332
|
+
type = new Type(context, string, name, superTypes, properties, provisional);
|
|
278
333
|
|
|
279
334
|
return type;
|
|
280
335
|
}
|
|
@@ -282,11 +337,12 @@ class Type {
|
|
|
282
337
|
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
283
338
|
const provisional = complexTypeDeclarationNode.isProvisional(),
|
|
284
339
|
typeName = complexTypeDeclarationNode.getTypeName(),
|
|
285
|
-
|
|
340
|
+
typePrefixName = complexTypeDeclarationNode.getTypePrefixName(),
|
|
341
|
+
name = typeName, ///
|
|
286
342
|
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
287
343
|
properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
|
|
288
|
-
string =
|
|
289
|
-
type = new Type(string, name, superTypes, properties, provisional);
|
|
344
|
+
string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
|
|
345
|
+
type = new Type(context, string, name, superTypes, properties, provisional);
|
|
290
346
|
|
|
291
347
|
return type;
|
|
292
348
|
}
|
|
@@ -348,12 +404,13 @@ function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, co
|
|
|
348
404
|
|
|
349
405
|
class ObjectType extends Type {
|
|
350
406
|
static fromNothing() {
|
|
351
|
-
const
|
|
407
|
+
const context = null,
|
|
408
|
+
name = OBJECT_TYPE_NAME,
|
|
352
409
|
string = name, ///
|
|
353
410
|
superTypes = [],
|
|
354
411
|
properties = [],
|
|
355
412
|
provisional = false,
|
|
356
|
-
objectType = new ObjectType(string, name, superTypes, properties, provisional);
|
|
413
|
+
objectType = new ObjectType(context, string, name, superTypes, properties, provisional);
|
|
357
414
|
|
|
358
415
|
return objectType;
|
|
359
416
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { domAssigned } from "../dom";
|
|
4
|
+
|
|
5
|
+
class TypePrefix {
|
|
6
|
+
constructor(string, name) {
|
|
7
|
+
this.string = string;
|
|
8
|
+
this.name = name;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getString() {
|
|
12
|
+
return this.string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getName() {
|
|
16
|
+
return this.name;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
matchTypePrefixName(typePrefixName) {
|
|
20
|
+
const typePrefixNameMatches = (this.name === typePrefixName);
|
|
21
|
+
|
|
22
|
+
return typePrefixNameMatches;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
toJSON() {
|
|
26
|
+
const name = this.name,
|
|
27
|
+
json = {
|
|
28
|
+
name
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return json;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static name = "TypePrefix";
|
|
35
|
+
|
|
36
|
+
static fromJSON(json, context) {
|
|
37
|
+
const { name } = json,
|
|
38
|
+
string = name, ///
|
|
39
|
+
typePrefix = new TypePrefix(string, name);
|
|
40
|
+
|
|
41
|
+
return typePrefix;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static fromTypePrefixDeclarationNode(typePrefixDeclarationNode, context) {
|
|
45
|
+
const typePrefix = typePrefixDeclarationNode.getTypePrefix(),
|
|
46
|
+
name = typePrefix, ///
|
|
47
|
+
string = name, ///
|
|
48
|
+
type = new TypePrefix(string, name);
|
|
49
|
+
|
|
50
|
+
return type;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default domAssigned(TypePrefix);
|
package/src/dom/variable.js
CHANGED
|
@@ -217,7 +217,7 @@ export default domAssigned(class Variable {
|
|
|
217
217
|
const { Variable } = dom,
|
|
218
218
|
provisional = variableDeclarationNode.isProvisional(),
|
|
219
219
|
typeNode = variableDeclarationNode.getTypeNode(),
|
|
220
|
-
type = typeFromTypeNode(typeNode);
|
|
220
|
+
type = typeFromTypeNode(typeNode, context);
|
|
221
221
|
|
|
222
222
|
type.setProvisional(provisional);
|
|
223
223
|
|
package/src/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import Judgement from "./dom/judgement";
|
|
|
25
25
|
import MetaLemma from "./dom/metaLemma";
|
|
26
26
|
import Deduction from "./dom/deduction";
|
|
27
27
|
import Signature from "./dom/signature";
|
|
28
|
+
import TypePrefix from "./dom/typePrefix";
|
|
28
29
|
import Conjecture from "./dom/conjecture";
|
|
29
30
|
import Conclusion from "./dom/conclusion";
|
|
30
31
|
import Derivation from "./dom/derivation";
|
|
@@ -53,6 +54,7 @@ import SimpleTypeDeclaration from "./dom/declaration/simpleType";
|
|
|
53
54
|
import StatementSubstitution from "./dom/substitution/statement";
|
|
54
55
|
import ReferenceSubstitution from "./dom/substitution/reference";
|
|
55
56
|
import CombinatorDeclaration from "./dom/declaration/combinator";
|
|
57
|
+
import TypePrefixDeclaration from "./dom/declaration/typePrefix";
|
|
56
58
|
import ConstructorDeclaration from "./dom/declaration/constructor";
|
|
57
59
|
import ComplexTypeDeclaration from "./dom/declaration/complexType";
|
|
58
60
|
import MetavariableDeclaration from "./dom/declaration/metavariable";
|
|
@@ -28,6 +28,13 @@ export default class ComplexTypeDeclarationNode extends NonTerminalNode {
|
|
|
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
|
+
|
|
31
38
|
getTypeName() {
|
|
32
39
|
const typeNode = this.getTypeNode(),
|
|
33
40
|
typeName = typeNode.getTypeName();
|
|
@@ -63,6 +70,13 @@ export default class ComplexTypeDeclarationNode extends NonTerminalNode {
|
|
|
63
70
|
return superTypeNodes;
|
|
64
71
|
}
|
|
65
72
|
|
|
73
|
+
getTypePrefixName() {
|
|
74
|
+
const typeNode = this.getTypeNode(),
|
|
75
|
+
typePrefixName = typeNode.getTypePrefixName();
|
|
76
|
+
|
|
77
|
+
return typePrefixName;
|
|
78
|
+
}
|
|
79
|
+
|
|
66
80
|
getPropertyDeclarationNodes() {
|
|
67
81
|
const ruleName = PROPERTY_DECLARATION_RULE_NAME,
|
|
68
82
|
propertyDeclarationNodes = this.getNodesByRuleName(ruleName);
|
|
@@ -28,6 +28,13 @@ export default class SimpleTypeDeclarationNode extends NonTerminalNode {
|
|
|
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
|
+
|
|
31
38
|
getTypeName() {
|
|
32
39
|
let typeName = null;
|
|
33
40
|
|
|
@@ -54,6 +61,13 @@ export default class SimpleTypeDeclarationNode extends NonTerminalNode {
|
|
|
54
61
|
return typesNode;
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
getTypePrefixName() {
|
|
65
|
+
const typeNode = this.getTypeNode(),
|
|
66
|
+
typePrefixName = typeNode.getTypePrefixName();
|
|
67
|
+
|
|
68
|
+
return typePrefixName;
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
getSuperTypeNodes() {
|
|
58
72
|
let superTypeNodes = [];
|
|
59
73
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NonTerminalNode from "../../node/nonTerminal";
|
|
4
|
+
|
|
5
|
+
import { TYPE_PREFIX_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class TypePrefixDeclarationNode extends NonTerminalNode {
|
|
8
|
+
getTypePrefix() {
|
|
9
|
+
const typePrefixNode = this.getTypePrefixNode(),
|
|
10
|
+
typePrefixName = typePrefixNode.getTypePrefixName();
|
|
11
|
+
|
|
12
|
+
return typePrefixName;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getTypePrefixNode() {
|
|
16
|
+
const ruleName = TYPE_PREFIX_RULE_NAME,
|
|
17
|
+
typePrefixNode = this.getNodeByRuleName(ruleName);
|
|
18
|
+
|
|
19
|
+
return typePrefixNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypePrefixDeclarationNode, ruleName, childNodes, opacity, precedence); }
|
|
23
|
+
}
|
|
24
|
+
|
package/src/node/type.js
CHANGED
|
@@ -3,15 +3,23 @@
|
|
|
3
3
|
import NonTerminalNode from "../node/nonTerminal";
|
|
4
4
|
|
|
5
5
|
export default class TypeNode extends NonTerminalNode {
|
|
6
|
+
isPrefixed() {
|
|
7
|
+
const multiplicity = this.getMultiplicity(),
|
|
8
|
+
prefixed = (multiplicity > 1);
|
|
9
|
+
|
|
10
|
+
return prefixed;
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
getTypeName() {
|
|
7
14
|
let typeName;
|
|
8
15
|
|
|
9
|
-
this.
|
|
10
|
-
|
|
16
|
+
const prefixed = this.isPrefixed(),
|
|
17
|
+
nameIndex = prefixed ? 2 : 0;
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
this.someChildNode((childNode, index) => {
|
|
20
|
+
if (index === nameIndex) {
|
|
21
|
+
const typeTerminalNode = childNode, ///
|
|
22
|
+
content = typeTerminalNode.getContent();
|
|
15
23
|
|
|
16
24
|
typeName = content; ///
|
|
17
25
|
|
|
@@ -22,23 +30,27 @@ export default class TypeNode extends NonTerminalNode {
|
|
|
22
30
|
return typeName;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
let
|
|
33
|
+
getTypePrefixName() {
|
|
34
|
+
let typePrefixName = null;
|
|
27
35
|
|
|
28
|
-
this.
|
|
29
|
-
const childNodeTerminalNode = childNode.isTerminalNode();
|
|
36
|
+
const prefixed = this.isPrefixed();
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
content = terminalNode.getContent();
|
|
38
|
+
if (prefixed) {
|
|
39
|
+
const prefixIndex = 0;
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
this.someChildNode((childNode, index) => {
|
|
42
|
+
if (index === prefixIndex) {
|
|
43
|
+
const typeTerminalNode = childNode, ///
|
|
44
|
+
content = typeTerminalNode.getContent();
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
typePrefixName = content; ///
|
|
47
|
+
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
40
52
|
|
|
41
|
-
return
|
|
53
|
+
return typePrefixName;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypeNode, ruleName, childNodes, opacity, precedence); }
|
package/src/node/typePrefix.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import NonTerminalNode from "../node/nonTerminal";
|
|
4
4
|
|
|
5
5
|
export default class TypePrefixNode extends NonTerminalNode {
|
|
6
|
-
|
|
7
|
-
let
|
|
6
|
+
getTypePrefixName() {
|
|
7
|
+
let typePrefixName;
|
|
8
8
|
|
|
9
9
|
this.someChildNode((childNode) => {
|
|
10
10
|
const childNodeTerminalNode = childNode.isTerminalNode();
|
|
@@ -13,13 +13,13 @@ export default class TypePrefixNode extends NonTerminalNode {
|
|
|
13
13
|
const terminalNode = childNode, ///
|
|
14
14
|
content = terminalNode.getContent();
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
typePrefixName = content; ///
|
|
17
17
|
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return typePrefixName;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypePrefixNode, ruleName, childNodes, opacity, precedence); }
|
|
@@ -22,7 +22,7 @@ import PropertyNode from "./node/property";
|
|
|
22
22
|
import MetaTypeNode from "./node/metaType";
|
|
23
23
|
import EqualityNode from "./node/equality";
|
|
24
24
|
import VariableNode from "./node/variable";
|
|
25
|
-
import
|
|
25
|
+
import RuleBodyNode from "./node/body/rule";
|
|
26
26
|
import StatementNode from "./node/statement";
|
|
27
27
|
import ReferenceNode from "./node/reference";
|
|
28
28
|
import DeductionNode from "./node/deduction";
|
|
@@ -30,37 +30,38 @@ import JudgementNode from "./node/judgement";
|
|
|
30
30
|
import MetaLemmaNode from "./node/metaLemma";
|
|
31
31
|
import ParameterNode from "./node/parameter";
|
|
32
32
|
import SignatureNode from "./node/signature";
|
|
33
|
-
import
|
|
34
|
-
import
|
|
33
|
+
import AxiomBodyNode from "./node/body/axiom";
|
|
34
|
+
import LemmaBodyNode from "./node/body/lemma";
|
|
35
35
|
import DerivationNode from "./node/derivation";
|
|
36
36
|
import CombinatorNode from "./node/combinator";
|
|
37
37
|
import ConclusionNode from "./node/conclusion";
|
|
38
38
|
import ConjectureNode from "./node/conjecture";
|
|
39
39
|
import HypothesisNode from "./node/hypothesis";
|
|
40
|
-
import
|
|
40
|
+
import TypePrefixNode from "./node/typePrefix";
|
|
41
|
+
import RuleHeaderNode from "./node/header/rule";
|
|
41
42
|
import SuppositionNode from "./node/supposition";
|
|
42
43
|
import ConstructorNode from "./node/constructor";
|
|
43
44
|
import DeclarationNode from "./node/declaration";
|
|
44
45
|
import MetatheoremNode from "./node/metatheorem";
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
46
|
+
import TheoremBodyNode from "./node/body/theorem";
|
|
47
|
+
import AxiomHeaderNode from "./node/header/axiom";
|
|
48
|
+
import LemmaHeaderNode from "./node/header/lemma";
|
|
48
49
|
import MetaArgumentNode from "./node/metaArgument";
|
|
49
50
|
import MetavariableNode from "./node/metavariable";
|
|
50
51
|
import QualificationNode from "./node/qualification";
|
|
51
|
-
import theoremHeaderNode from "./node/header/theorem";
|
|
52
|
-
import metaLemmaBodyNode from "./node/body/metaLemma";
|
|
53
52
|
import ProcedureCallNode from "./node/procedureCall";
|
|
54
53
|
import SubDerivationNode from "./node/subDerivation";
|
|
54
|
+
import TheoremHeaderNode from "./node/header/theorem";
|
|
55
|
+
import MetaLemmaBodyNode from "./node/body/metaLemma";
|
|
55
56
|
import TypeAssertionNode from "./node/assertion/type";
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
57
|
+
import ConjectureBodyNode from "./node/body/conjecture";
|
|
58
|
+
import MetatheoremBodyNode from "./node/body/metatheorem";
|
|
59
|
+
import MetaLemmaHeaderNode from "./node/header/metaLemma";
|
|
59
60
|
import PropertyRelationNode from "./node/propertyRelation"
|
|
60
61
|
import DefinedAssertionNode from "./node/assertion/defined";
|
|
61
62
|
import TermSubstitutionNode from "./node/substitution/term";
|
|
62
|
-
import
|
|
63
|
-
import
|
|
63
|
+
import ConjectureHeaderNode from "./node/header/conjecture";
|
|
64
|
+
import MetatheoremHeaderNode from "./node/header/metatheorem";
|
|
64
65
|
import PropertyAssertionNode from "./node/assertion/property";
|
|
65
66
|
import SubproofAssertionNode from "./node/assertion/subproof";
|
|
66
67
|
import FrameSubstitutionNode from "./node/substitution/frame";
|
|
@@ -69,13 +70,14 @@ import ContainedAssertionNode from "./node/assertion/contained";
|
|
|
69
70
|
import SatisfiesAssertionNode from "./node/assertion/satisfies";
|
|
70
71
|
import ParenthesisedLabelsNode from "./node/parenthesisedLabels"
|
|
71
72
|
import PropertyDeclarationNode from "./node/declaration/property";
|
|
72
|
-
import
|
|
73
|
+
import VariableDeclarationNode from "./node/declaration/variable";
|
|
73
74
|
import StatementSubstitutionNode from "./node/substitution/statement";
|
|
74
75
|
import SimpleTypeDeclarationNode from "./node/declaration/simpleType";
|
|
75
|
-
import
|
|
76
|
-
import
|
|
77
|
-
import
|
|
78
|
-
import
|
|
76
|
+
import CombinatorDeclarationNode from "./node/declaration/combinator";
|
|
77
|
+
import TypePrefixDeclarationNode from "./node/declaration/typePrefix";
|
|
78
|
+
import ComplexTypeDeclarationNode from "./node/declaration/complexType";
|
|
79
|
+
import DonstructorDeclarationNode from "./node/declaration/constructor";
|
|
80
|
+
import MetavariableDeclarationNode from "./node/declaration/metavariable";
|
|
79
81
|
|
|
80
82
|
import { RULE_RULE_NAME,
|
|
81
83
|
STEP_RULE_NAME,
|
|
@@ -114,10 +116,11 @@ import { RULE_RULE_NAME,
|
|
|
114
116
|
HYPOTHESIS_RULE_NAME,
|
|
115
117
|
AXIOM_BODY_RULE_NAME,
|
|
116
118
|
LEMMA_BODY_RULE_NAME,
|
|
119
|
+
TYPE_PREFIX_RULE_NAME,
|
|
120
|
+
SUPPOSITION_RULE_NAME,
|
|
117
121
|
RULE_HEADER_RULE_NAME,
|
|
118
122
|
CONSTRUCTOR_RULE_NAME,
|
|
119
123
|
DECLARATION_RULE_NAME,
|
|
120
|
-
SUPPOSITION_RULE_NAME,
|
|
121
124
|
METATHEOREM_RULE_NAME,
|
|
122
125
|
AXIOM_HEADER_RULE_NAME,
|
|
123
126
|
LEMMA_HEADER_RULE_NAME,
|
|
@@ -151,6 +154,7 @@ import { RULE_RULE_NAME,
|
|
|
151
154
|
COMBINATOR_DECLARATION_RULE_NAME,
|
|
152
155
|
SIMPLE_TYPE_DECLARATION_RULE_NAME,
|
|
153
156
|
CONSTRUCTOR_DECLARATION_RULE_NAME,
|
|
157
|
+
TYPE_PREFIX_DECLARATION_RULE_NAME,
|
|
154
158
|
COMPLEX_TYPE_DECLARATION_RULE_NAME,
|
|
155
159
|
METAVARIABLE_DECLARATION_RULE_NAME } from "./ruleNames";
|
|
156
160
|
|
|
@@ -176,7 +180,7 @@ const NonTerminalNodeMap = {
|
|
|
176
180
|
[EQUALITY_RULE_NAME]: EqualityNode,
|
|
177
181
|
[VARIABLE_RULE_NAME]: VariableNode,
|
|
178
182
|
[NONSENSE_RULE_NAME]: NonsenseNode,
|
|
179
|
-
[RULE_BODY_RULE_NAME]:
|
|
183
|
+
[RULE_BODY_RULE_NAME]: RuleBodyNode,
|
|
180
184
|
[META_TYPE_RULE_NAME]: MetaTypeNode,
|
|
181
185
|
[SIGNATURE_RULE_NAME]: SignatureNode,
|
|
182
186
|
[REFERENCE_RULE_NAME]: ReferenceNode,
|
|
@@ -184,38 +188,39 @@ const NonTerminalNodeMap = {
|
|
|
184
188
|
[DEDUCTION_RULE_NAME]: DeductionNode,
|
|
185
189
|
[PARAMETER_RULE_NAME]: ParameterNode,
|
|
186
190
|
[STATEMENT_RULE_NAME]: StatementNode,
|
|
187
|
-
[AXIOM_BODY_RULE_NAME]:
|
|
188
|
-
[LEMMA_BODY_RULE_NAME]:
|
|
191
|
+
[AXIOM_BODY_RULE_NAME]: AxiomBodyNode,
|
|
192
|
+
[LEMMA_BODY_RULE_NAME]: LemmaBodyNode,
|
|
189
193
|
[META_LEMMA_RULE_NAME]: MetaLemmaNode,
|
|
190
194
|
[COMBINATOR_RULE_NAME]: CombinatorNode,
|
|
191
195
|
[CONCLUSION_RULE_NAME]: ConclusionNode,
|
|
192
196
|
[CONJECTURE_RULE_NAME]: ConjectureNode,
|
|
193
197
|
[DERIVATION_RULE_NAME]: DerivationNode,
|
|
194
198
|
[HYPOTHESIS_RULE_NAME]: HypothesisNode,
|
|
195
|
-
[RULE_HEADER_RULE_NAME]:
|
|
199
|
+
[RULE_HEADER_RULE_NAME]: RuleHeaderNode,
|
|
200
|
+
[TYPE_PREFIX_RULE_NAME]: TypePrefixNode,
|
|
196
201
|
[SUPPOSITION_RULE_NAME]: SuppositionNode,
|
|
197
202
|
[CONSTRUCTOR_RULE_NAME]: ConstructorNode,
|
|
198
203
|
[DECLARATION_RULE_NAME]: DeclarationNode,
|
|
199
204
|
[METATHEOREM_RULE_NAME]: MetatheoremNode,
|
|
200
|
-
[AXIOM_HEADER_RULE_NAME]:
|
|
201
|
-
[LEMMA_HEADER_RULE_NAME]:
|
|
202
|
-
[THEOREM_BODY_RULE_NAME]:
|
|
205
|
+
[AXIOM_HEADER_RULE_NAME]: AxiomHeaderNode,
|
|
206
|
+
[LEMMA_HEADER_RULE_NAME]: LemmaHeaderNode,
|
|
207
|
+
[THEOREM_BODY_RULE_NAME]: TheoremBodyNode,
|
|
203
208
|
[METAVARIABLE_RULE_NAME]: MetavariableNode,
|
|
204
209
|
[META_ARGUMENT_RULE_NAME]: MetaArgumentNode,
|
|
205
210
|
[QUALIFICATION_RULE_NAME]: QualificationNode,
|
|
206
211
|
[TYPE_ASSERTION_RULE_NAME]: TypeAssertionNode,
|
|
207
212
|
[PROCEDURE_CALL_RULE_NAME]: ProcedureCallNode,
|
|
208
213
|
[SUB_DERIVATION_RULE_NAME]: SubDerivationNode,
|
|
209
|
-
[THEOREM_HEADER_RULE_NAME]:
|
|
210
|
-
[META_LEMMA_BODY_RULE_NAME]:
|
|
211
|
-
[CONJECTURE_BODY_RULE_NAME]:
|
|
212
|
-
[METATHEOREM_BODY_RULE_NAME]:
|
|
213
|
-
[META_LEMMA_HEADER_RULE_NAME]:
|
|
214
|
-
[CONJECTURE_HEADER_RULE_NAME]:
|
|
214
|
+
[THEOREM_HEADER_RULE_NAME]: TheoremHeaderNode,
|
|
215
|
+
[META_LEMMA_BODY_RULE_NAME]: MetaLemmaBodyNode,
|
|
216
|
+
[CONJECTURE_BODY_RULE_NAME]: ConjectureBodyNode,
|
|
217
|
+
[METATHEOREM_BODY_RULE_NAME]: MetatheoremBodyNode,
|
|
218
|
+
[META_LEMMA_HEADER_RULE_NAME]: MetaLemmaHeaderNode,
|
|
219
|
+
[CONJECTURE_HEADER_RULE_NAME]: ConjectureHeaderNode,
|
|
215
220
|
[PROPERTY_RELATION_RULE_NAME]: PropertyRelationNode,
|
|
216
221
|
[DEFINED_ASSERTION_RULE_NAME]: DefinedAssertionNode,
|
|
217
222
|
[TERM_SUBSTITUTION_RULE_NAME]: TermSubstitutionNode,
|
|
218
|
-
[METATHEOREM_HEADER_RULE_NAME]:
|
|
223
|
+
[METATHEOREM_HEADER_RULE_NAME]: MetatheoremHeaderNode,
|
|
219
224
|
[SUBPROOF_ASSERTION_RULE_NAME]: SubproofAssertionNode,
|
|
220
225
|
[PROPERTY_ASSERTION_RULE_NAME]: PropertyAssertionNode,
|
|
221
226
|
[FRAME_SUBSTITUTION_RULE_NAME]: FrameSubstitutionNode,
|
|
@@ -223,14 +228,15 @@ const NonTerminalNodeMap = {
|
|
|
223
228
|
[SATISFIES_ASSERTION_RULE_NAME]: SatisfiesAssertionNode,
|
|
224
229
|
[CONTAINED_ASSERTION_RULE_NAME]: ContainedAssertionNode,
|
|
225
230
|
[PARENTHESISED_LABELS_RULE_NAME]: ParenthesisedLabelsNode,
|
|
226
|
-
[VARIABLE_DECLARATION_RULE_NAME]:
|
|
231
|
+
[VARIABLE_DECLARATION_RULE_NAME]: VariableDeclarationNode,
|
|
227
232
|
[PROPERTY_DECLARATION_RULE_NAME]: PropertyDeclarationNode,
|
|
228
233
|
[STATEMENT_SUBSTITUTION_RULE_NAME]: StatementSubstitutionNode,
|
|
229
|
-
[COMBINATOR_DECLARATION_RULE_NAME]:
|
|
234
|
+
[COMBINATOR_DECLARATION_RULE_NAME]: CombinatorDeclarationNode,
|
|
230
235
|
[SIMPLE_TYPE_DECLARATION_RULE_NAME]: SimpleTypeDeclarationNode,
|
|
231
|
-
[
|
|
232
|
-
[
|
|
233
|
-
[
|
|
236
|
+
[TYPE_PREFIX_DECLARATION_RULE_NAME]: TypePrefixDeclarationNode,
|
|
237
|
+
[CONSTRUCTOR_DECLARATION_RULE_NAME]: DonstructorDeclarationNode,
|
|
238
|
+
[COMPLEX_TYPE_DECLARATION_RULE_NAME]: ComplexTypeDeclarationNode,
|
|
239
|
+
[METAVARIABLE_DECLARATION_RULE_NAME]: MetavariableDeclarationNode
|
|
234
240
|
};
|
|
235
241
|
|
|
236
242
|
export default NonTerminalNodeMap;
|