occam-verify-cli 0.0.1035 → 0.0.1037
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/assertion/subproof.js +73 -49
- package/lib/assertion/type.js +5 -5
- package/lib/context/file.js +6 -20
- package/lib/context/release.js +24 -84
- package/lib/equality.js +5 -5
- package/lib/metavariable.js +51 -6
- package/lib/mixins/statement/verify.js +3 -3
- package/lib/premise.js +23 -32
- package/lib/substitution/statementForMetavariable.js +12 -4
- package/lib/substitution/termForVariable.js +2 -2
- package/lib/supposition.js +48 -57
- package/lib/unifier/metaLevel.js +3 -4
- package/lib/unifier/statementWithCombinator.js +1 -2
- package/lib/variable.js +13 -6
- package/lib/verify/assertion/subproof.js +1 -49
- package/package.json +1 -1
- package/src/assertion/subproof.js +95 -56
- package/src/assertion/type.js +4 -4
- package/src/context/file.js +2 -48
- package/src/context/release.js +27 -65
- package/src/equality.js +4 -4
- package/src/metavariable.js +69 -6
- package/src/mixins/statement/verify.js +3 -2
- package/src/premise.js +32 -46
- package/src/substitution/statementForMetavariable.js +20 -3
- package/src/substitution/termForVariable.js +1 -1
- package/src/supposition.js +64 -78
- package/src/unifier/metaLevel.js +11 -5
- package/src/unifier/statementWithCombinator.js +0 -1
- package/src/variable.js +12 -5
- package/src/verify/assertion/subproof.js +0 -63
- package/lib/unify/conclusionWithStatement.js +0 -34
- package/lib/unify/consequentWithStatement.js +0 -34
- package/lib/unify/metavariableWithStatement.js +0 -40
- package/lib/unify/suppositionWithProffStep.js +0 -41
- package/lib/unify/suppositionsWithProofSteps.js +0 -31
- package/lib/unify/unqualifiedStatement.js +0 -25
- package/lib/verify/file.js +0 -35
- package/lib/verify/subDerivation.js +0 -31
- package/src/unify/conclusionWithStatement.js +0 -34
- package/src/unify/consequentWithStatement.js +0 -34
- package/src/unify/metavariableWithStatement.js +0 -40
- package/src/unify/suppositionWithProffStep.js +0 -54
- package/src/unify/suppositionsWithProofSteps.js +0 -23
- package/src/unify/unqualifiedStatement.js +0 -24
- package/src/verify/file.js +0 -29
- package/src/verify/subDerivation.js +0 -24
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return verifySubproofAssertion;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
5
|
var _metaLevel = /*#__PURE__*/ _interop_require_default(require("../../verifier/metaLevel"));
|
|
12
6
|
function _interop_require_default(obj) {
|
|
13
7
|
return obj && obj.__esModule ? obj : {
|
|
@@ -18,47 +12,5 @@ var verifySubproofAssertionFunctions = [
|
|
|
18
12
|
verifyDerivedSubproofAssertion,
|
|
19
13
|
verifyStatedSubproofAssertion
|
|
20
14
|
];
|
|
21
|
-
function verifySubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
22
|
-
var subproofAssertionVerified = false;
|
|
23
|
-
var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
24
|
-
assignments = null; ///
|
|
25
|
-
stated = true; ///
|
|
26
|
-
localContext.trace("Verifying the '".concat(subproofAssertionString, "' subproof assertion..."), subproofAssertionNode);
|
|
27
|
-
var verified = _metaLevel.default.verify(subproofAssertionNode, assignments, stated, localContext);
|
|
28
|
-
if (verified) {
|
|
29
|
-
subproofAssertionVerified = verifySubproofAssertionFunctions.some(function(verifySubproofAssertionFunction) {
|
|
30
|
-
var subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments, stated, localContext);
|
|
31
|
-
if (subproofAssertionVerified) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (subproofAssertionVerified) {
|
|
37
|
-
localContext.debug("...verified the '".concat(subproofAssertionString, "' subproof assertion."), subproofAssertionNode);
|
|
38
|
-
}
|
|
39
|
-
return subproofAssertionVerified;
|
|
40
|
-
}
|
|
41
|
-
function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
42
|
-
var derivedSubproofAssertionVerified;
|
|
43
|
-
if (!stated) {
|
|
44
|
-
var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
45
|
-
localContext.trace("Verifying the '".concat(subproofAssertionString, "' derived subproof assertion..."), subproofAssertionNode);
|
|
46
|
-
derivedSubproofAssertionVerified = false;
|
|
47
|
-
localContext.debug("The '".concat(subproofAssertionString, "' derived subproof assertion cannot be verified."), subproofAssertionNode);
|
|
48
|
-
}
|
|
49
|
-
return derivedSubproofAssertionVerified;
|
|
50
|
-
}
|
|
51
|
-
function verifyStatedSubproofAssertion(subproofAssertionNode, assignments, stated, localContext) {
|
|
52
|
-
var statedSubproofAssertionVerified;
|
|
53
|
-
if (stated) {
|
|
54
|
-
var subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
55
|
-
localContext.trace("Verifying the '".concat(subproofAssertionString, "' stated subproof assertion..."), subproofAssertionNode);
|
|
56
|
-
statedSubproofAssertionVerified = true;
|
|
57
|
-
if (statedSubproofAssertionVerified) {
|
|
58
|
-
localContext.debug("...verified the '".concat(subproofAssertionString, "' stated subproof assertion."), subproofAssertionNode);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return statedSubproofAssertionVerified;
|
|
62
|
-
}
|
|
63
15
|
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy92ZXJpZnkvYXNzZXJ0aW9uL3N1YnByb29mLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgbWV0YUxldmVsVmVyaWZpZXIgZnJvbSBcIi4uLy4uL3ZlcmlmaWVyL21ldGFMZXZlbFwiO1xuXG5jb25zdCB2ZXJpZnlTdWJwcm9vZkFzc2VydGlvbkZ1bmN0aW9ucyA9IFtcbiAgdmVyaWZ5RGVyaXZlZFN1YnByb29mQXNzZXJ0aW9uLFxuICB2ZXJpZnlTdGF0ZWRTdWJwcm9vZkFzc2VydGlvblxuXTtcblxuIl0sIm5hbWVzIjpbInZlcmlmeVN1YnByb29mQXNzZXJ0aW9uRnVuY3Rpb25zIiwidmVyaWZ5RGVyaXZlZFN1YnByb29mQXNzZXJ0aW9uIiwidmVyaWZ5U3RhdGVkU3VicHJvb2ZBc3NlcnRpb24iXSwibWFwcGluZ3MiOiJBQUFBOzs7O2dFQUU4Qjs7Ozs7O0FBRTlCLElBQU1BLG1DQUFtQztJQUN2Q0M7SUFDQUM7Q0FDRCJ9
|
package/package.json
CHANGED
|
@@ -3,25 +3,20 @@
|
|
|
3
3
|
import shim from "../shim";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
5
|
import metaLevelUnifier from "../unifier/metaLevel";
|
|
6
|
+
import metaLevelVerifier from "../verifier/metaLevel";
|
|
6
7
|
|
|
7
8
|
import { front, last, match } from "../utilities/array";
|
|
8
9
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
11
|
+
const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
|
|
12
12
|
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
|
|
13
13
|
|
|
14
14
|
export default class SubproofAssertion {
|
|
15
|
-
constructor(
|
|
16
|
-
this.fileContext = fileContext;
|
|
15
|
+
constructor(string, statements) {
|
|
17
16
|
this.string = string;
|
|
18
17
|
this.statements = statements;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
getFileContext() {
|
|
22
|
-
return this.fileContext;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
20
|
getString() {
|
|
26
21
|
return this.string;
|
|
27
22
|
}
|
|
@@ -30,7 +25,70 @@ export default class SubproofAssertion {
|
|
|
30
25
|
return this.statements;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
verify(assignments, stated, localContext) {
|
|
29
|
+
let verified;
|
|
30
|
+
|
|
31
|
+
const subproofAssertionString = this.string; ///
|
|
32
|
+
|
|
33
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`);
|
|
34
|
+
|
|
35
|
+
let verifiedWhenStated = false,
|
|
36
|
+
verifiedWhenDerived = false;
|
|
37
|
+
|
|
38
|
+
if (stated) {
|
|
39
|
+
verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
|
|
40
|
+
} else {
|
|
41
|
+
verifiedWhenDerived = this.verifyWhenDerived(localContext);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
45
|
+
assignments = null; ///
|
|
46
|
+
|
|
47
|
+
stated = true; ///
|
|
48
|
+
|
|
49
|
+
const subproofAssertionNode = this.node; ///
|
|
50
|
+
|
|
51
|
+
verified = metaLevelVerifier.verify(subproofAssertionNode, assignments, stated, localContext);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (verified) {
|
|
55
|
+
localContext.debug(`...verified the '${subproofAssertionString}' subproof assertion.`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return verified;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
verifyWhenStated(localContext) {
|
|
62
|
+
let verifiedWhenStated;
|
|
63
|
+
|
|
64
|
+
const subproofAssertionString = this.string; ///
|
|
65
|
+
|
|
66
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`);
|
|
67
|
+
|
|
68
|
+
verifiedWhenStated = true;
|
|
69
|
+
|
|
70
|
+
if (verifiedWhenStated) {
|
|
71
|
+
localContext.debug(`...verified the '${subproofAssertionString}' stated subproof assertion.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return verifiedWhenStated;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
verifyWhenDerived(localContext) {
|
|
78
|
+
let derivedSubproofAssertionVerified;
|
|
79
|
+
|
|
80
|
+
const subproofAssertionString = this.string; ///
|
|
81
|
+
|
|
82
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' derived subproof assertion...`);
|
|
83
|
+
|
|
84
|
+
derivedSubproofAssertionVerified = false;
|
|
85
|
+
|
|
86
|
+
localContext.debug(`The '${subproofAssertionString}' derived subproof assertion cannot be verified.`);
|
|
87
|
+
|
|
88
|
+
return derivedSubproofAssertionVerified;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
unifySubproof(subproof, substitutions, fileContext, localContext) {
|
|
34
92
|
let subproofUnified;
|
|
35
93
|
|
|
36
94
|
const subproofString = subproof.getString(),
|
|
@@ -44,7 +102,7 @@ export default class SubproofAssertion {
|
|
|
44
102
|
subproofStatementNode = subproofStatement.getNode(),
|
|
45
103
|
nodeA = statementNode, ///
|
|
46
104
|
nodeB = subproofStatementNode, ///
|
|
47
|
-
fileContextA =
|
|
105
|
+
fileContextA = fileContext, ///
|
|
48
106
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
49
107
|
localContextB = localContext, ///
|
|
50
108
|
unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
@@ -61,59 +119,40 @@ export default class SubproofAssertion {
|
|
|
61
119
|
return subproofUnified;
|
|
62
120
|
}
|
|
63
121
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const statementString = statement.getString();
|
|
67
|
-
|
|
68
|
-
return statementString;
|
|
69
|
-
}),
|
|
70
|
-
statements = statementStings, ///
|
|
71
|
-
json = {
|
|
72
|
-
statements
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return json;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static fromJSON(json, fileContext) {
|
|
79
|
-
let { statements } = json;
|
|
122
|
+
static fromStatement(statement, fileContext) {
|
|
123
|
+
let subproofAssertion = null;
|
|
80
124
|
|
|
81
|
-
const
|
|
125
|
+
const statementNode = statement.getNode(),
|
|
126
|
+
subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
|
|
82
127
|
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
128
|
+
if (subproofAssertionNode !== null) {
|
|
129
|
+
const { Statement } = shim,
|
|
130
|
+
statementNodes = statementNodesQuery(subproofAssertionNode),
|
|
131
|
+
statementString = statement.getString(),
|
|
132
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
133
|
+
statements = statementNodes.map((statementNode) => {
|
|
134
|
+
const statement = Statement.fromStatementNode(statementNode, localContext);
|
|
86
135
|
|
|
87
|
-
|
|
88
|
-
|
|
136
|
+
return statement;
|
|
137
|
+
}),
|
|
138
|
+
string = statementString; ///
|
|
89
139
|
|
|
90
|
-
|
|
91
|
-
|
|
140
|
+
subproofAssertion = new SubproofAssertion(string, statements);
|
|
141
|
+
}
|
|
92
142
|
|
|
93
143
|
return subproofAssertion;
|
|
94
144
|
}
|
|
95
145
|
|
|
96
|
-
static
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
|
|
146
|
+
static fromSubproofAssertionNode(subproofAssertionNode, localContext) {
|
|
147
|
+
const { Statement } = shim,
|
|
148
|
+
statementNodes = statementNodesQuery(subproofAssertionNode),
|
|
149
|
+
statements = statementNodes.map((statementNode) => {
|
|
150
|
+
const statement = Statement.fromStatementNode(statementNode, localContext);
|
|
102
151
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
statements = statementNodes.map((statementNode) => {
|
|
108
|
-
const statement = Statement.fromStatementNode(statementNode, localContext);
|
|
109
|
-
|
|
110
|
-
return statement;
|
|
111
|
-
}),
|
|
112
|
-
string = stringFromStatements(statements);
|
|
113
|
-
|
|
114
|
-
subproofAssertion = new SubproofAssertion(fileContext, string, statements);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
152
|
+
return statement;
|
|
153
|
+
}),
|
|
154
|
+
string = stringFromStatements(statements),
|
|
155
|
+
subproofAssertion = new SubproofAssertion(string, statements);
|
|
117
156
|
|
|
118
157
|
return subproofAssertion;
|
|
119
158
|
}
|
|
@@ -122,14 +161,14 @@ export default class SubproofAssertion {
|
|
|
122
161
|
function stringFromStatements(statements) {
|
|
123
162
|
const frontStatements = front(statements),
|
|
124
163
|
lastStatement = last(statements),
|
|
125
|
-
frontStatementsString =
|
|
164
|
+
frontStatementsString = statementsStringFromStatements(frontStatements),
|
|
126
165
|
lastStatementString = lastStatement.getString(),
|
|
127
166
|
string = `[${frontStatementsString}] ... ${lastStatementString}`;
|
|
128
167
|
|
|
129
168
|
return string;
|
|
130
169
|
}
|
|
131
170
|
|
|
132
|
-
function
|
|
171
|
+
function statementsStringFromStatements(statements) {
|
|
133
172
|
const statementsString = statements.reduce((statementsString, statement) => {
|
|
134
173
|
const statementString = statement.getString();
|
|
135
174
|
|
package/src/assertion/type.js
CHANGED
|
@@ -84,7 +84,7 @@ export default class TypeAssertion {
|
|
|
84
84
|
|
|
85
85
|
const typeAssertionString = this.string; ///
|
|
86
86
|
|
|
87
|
-
localContext.trace(`Verifying the
|
|
87
|
+
localContext.trace(`Verifying the '${typeAssertionString}' stated type assertion...`);
|
|
88
88
|
|
|
89
89
|
const typeVerified = this.verifyType(localContext);
|
|
90
90
|
|
|
@@ -115,7 +115,7 @@ export default class TypeAssertion {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (verifiedWhenStated) {
|
|
118
|
-
localContext.debug(`...verified the
|
|
118
|
+
localContext.debug(`...verified the '${typeAssertionString}' stated type assertion.`);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
return verifiedWhenStated;
|
|
@@ -126,7 +126,7 @@ export default class TypeAssertion {
|
|
|
126
126
|
|
|
127
127
|
const typeAssertionString = this.string; ///
|
|
128
128
|
|
|
129
|
-
localContext.trace(`Verifying the
|
|
129
|
+
localContext.trace(`Verifying the '${typeAssertionString}' derived type assertion...`);
|
|
130
130
|
|
|
131
131
|
const typeVerified = this.verifyType(localContext);
|
|
132
132
|
|
|
@@ -146,7 +146,7 @@ export default class TypeAssertion {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
if (verifiedWhenDerived) {
|
|
149
|
-
localContext.debug(`...verified the
|
|
149
|
+
localContext.debug(`...verified the '${typeAssertionString}' derived type assertion.`);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
return verifiedWhenDerived;
|
package/src/context/file.js
CHANGED
|
@@ -54,7 +54,7 @@ export default class FileContext {
|
|
|
54
54
|
return this.node;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
findFile(filePath) { return this.releaseContext.findFile(filePath); }
|
|
58
58
|
|
|
59
59
|
getLexer() { return this.releaseContext.getLexer(); }
|
|
60
60
|
|
|
@@ -877,28 +877,7 @@ export default class FileContext {
|
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
static
|
|
881
|
-
const { filePath } = json,
|
|
882
|
-
tokens = null,
|
|
883
|
-
node = null,
|
|
884
|
-
types = [],
|
|
885
|
-
rules = [],
|
|
886
|
-
axioms = [],
|
|
887
|
-
lemmas = [],
|
|
888
|
-
theorems = [],
|
|
889
|
-
variables = [],
|
|
890
|
-
metaLemmas = [],
|
|
891
|
-
conjectures = [],
|
|
892
|
-
combinators = [],
|
|
893
|
-
constructors = [],
|
|
894
|
-
metatheorems = [],
|
|
895
|
-
metavariables = [],
|
|
896
|
-
fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, metaLemmas, theorems, conjectures, combinators, constructors, metatheorems, metavariables);
|
|
897
|
-
|
|
898
|
-
return fileContext;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
static fromFileAndReleaseContext(file, releaseContext) {
|
|
880
|
+
static fromFile(file, releaseContext) {
|
|
902
881
|
const lexer = releaseContext.getLexer(),
|
|
903
882
|
parser = releaseContext.getParser(),
|
|
904
883
|
filePath = file.getPath(),
|
|
@@ -922,29 +901,4 @@ export default class FileContext {
|
|
|
922
901
|
|
|
923
902
|
return fileContext;
|
|
924
903
|
}
|
|
925
|
-
|
|
926
|
-
static fromFilePathAndReleaseContext(filePath, releaseContext) {
|
|
927
|
-
const file = releaseContext.getFile(filePath),
|
|
928
|
-
lexer = releaseContext.getLexer(),
|
|
929
|
-
parser = releaseContext.getParser(),
|
|
930
|
-
fileContent = file.getContent(),
|
|
931
|
-
content = fileContent, ////
|
|
932
|
-
tokens = lexer.tokenise(content),
|
|
933
|
-
node = parser.parse(tokens),
|
|
934
|
-
types = [],
|
|
935
|
-
rules = [],
|
|
936
|
-
axioms = [],
|
|
937
|
-
lemmas = [],
|
|
938
|
-
theorems = [],
|
|
939
|
-
variables = [],
|
|
940
|
-
metaLemmas = [],
|
|
941
|
-
conjectures = [],
|
|
942
|
-
combinators = [],
|
|
943
|
-
constructors = [],
|
|
944
|
-
metatheorems = [],
|
|
945
|
-
metavariables = [],
|
|
946
|
-
fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, metaLemmas, theorems, conjectures, combinators, constructors, metatheorems, metavariables);
|
|
947
|
-
|
|
948
|
-
return fileContext;
|
|
949
|
-
}
|
|
950
904
|
}
|
package/src/context/release.js
CHANGED
|
@@ -15,7 +15,7 @@ const { isFilePathNominalFilePath } = filePathUtilities,
|
|
|
15
15
|
{ nominalParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
16
16
|
|
|
17
17
|
export default class ReleaseContext {
|
|
18
|
-
constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar,
|
|
18
|
+
constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts) {
|
|
19
19
|
this.log = log;
|
|
20
20
|
this.name = name;
|
|
21
21
|
this.json = json;
|
|
@@ -26,7 +26,6 @@ export default class ReleaseContext {
|
|
|
26
26
|
this.initialised = initialised;
|
|
27
27
|
this.fileContexts = fileContexts;
|
|
28
28
|
this.customGrammar = customGrammar;
|
|
29
|
-
this.verifiedFileContexts = verifiedFileContexts;
|
|
30
29
|
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -70,52 +69,20 @@ export default class ReleaseContext {
|
|
|
70
69
|
return this.customGrammar;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
getVerifiedFileContexts() {
|
|
74
|
-
return this.verifiedFileContexts;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
72
|
getDependencyReleaseContexts() {
|
|
78
73
|
return this.dependencyReleaseContexts;
|
|
79
74
|
}
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
this.
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
setName(name) {
|
|
86
|
-
this.name = name;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
setEntries(entries) {
|
|
90
|
-
this.entries = entries;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
setLexer(lexer) {
|
|
94
|
-
this.lexer = lexer;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setParser(parser) {
|
|
98
|
-
this.parser = parser;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
setVerified(verified) {
|
|
102
|
-
this.verified = verified;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
setInitialised(initialised) {
|
|
106
|
-
return this.initialised = initialised;
|
|
107
|
-
}
|
|
76
|
+
isReleased() {
|
|
77
|
+
const released = (this.json !== null);
|
|
108
78
|
|
|
109
|
-
|
|
110
|
-
this.fileContexts = fileContexts;
|
|
79
|
+
return released;
|
|
111
80
|
}
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
82
|
+
findFile(filePath) {
|
|
83
|
+
const file = this.entries.getFile(filePath);
|
|
116
84
|
|
|
117
|
-
|
|
118
|
-
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
85
|
+
return file;
|
|
119
86
|
}
|
|
120
87
|
|
|
121
88
|
findFileContext(filePath) {
|
|
@@ -130,12 +97,6 @@ export default class ReleaseContext {
|
|
|
130
97
|
return fileContext;
|
|
131
98
|
}
|
|
132
99
|
|
|
133
|
-
isReleased() {
|
|
134
|
-
const released = (this.json !== null);
|
|
135
|
-
|
|
136
|
-
return released;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
100
|
getLabels(includeDependencies = true) {
|
|
140
101
|
const labels = [];
|
|
141
102
|
|
|
@@ -438,9 +399,11 @@ export default class ReleaseContext {
|
|
|
438
399
|
|
|
439
400
|
this.parser = nominalParser; ///
|
|
440
401
|
|
|
402
|
+
clear(this.fileContexts);
|
|
403
|
+
|
|
441
404
|
released ?
|
|
442
|
-
|
|
443
|
-
|
|
405
|
+
fileContextsFromJSONAndEntries(this.json, this.entries, this.fileContexts, releaseContext) :
|
|
406
|
+
fileContextsFromEntries(this.entries, this.fileContexts, releaseContext);
|
|
444
407
|
|
|
445
408
|
this.initialised = true;
|
|
446
409
|
}
|
|
@@ -448,11 +411,12 @@ export default class ReleaseContext {
|
|
|
448
411
|
verify() {
|
|
449
412
|
let verified = false;
|
|
450
413
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
const fileContextsVerified = verifyFileContexts(this.fileContexts, this.verifiedFileContexts);
|
|
414
|
+
const verifiedFileContexts = [],
|
|
415
|
+
fileContextsVerified = verifyFileContexts(this.fileContexts, verifiedFileContexts);
|
|
454
416
|
|
|
455
417
|
if (fileContextsVerified) {
|
|
418
|
+
this.fileContexts = verifiedFileContexts; ///
|
|
419
|
+
|
|
456
420
|
this.verified = true;
|
|
457
421
|
|
|
458
422
|
verified = true;
|
|
@@ -462,12 +426,12 @@ export default class ReleaseContext {
|
|
|
462
426
|
}
|
|
463
427
|
|
|
464
428
|
toJSON() {
|
|
465
|
-
const
|
|
466
|
-
const
|
|
429
|
+
const fileContextsJSON = this.fileContexts.map((fileContext) => {
|
|
430
|
+
const fileContextJSON = fileContext.toJSON();
|
|
467
431
|
|
|
468
|
-
return
|
|
432
|
+
return fileContextJSON;
|
|
469
433
|
}),
|
|
470
|
-
json =
|
|
434
|
+
json = fileContextsJSON; ///
|
|
471
435
|
|
|
472
436
|
return json;
|
|
473
437
|
}
|
|
@@ -479,20 +443,20 @@ export default class ReleaseContext {
|
|
|
479
443
|
initialised = false,
|
|
480
444
|
fileContexts = [],
|
|
481
445
|
customGrammar = customGrammarFromNameAndEntries(name, entries),
|
|
482
|
-
verifiedFileContexts = [],
|
|
483
446
|
dependencyReleaseContexts = null,
|
|
484
|
-
releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar,
|
|
447
|
+
releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts);
|
|
485
448
|
|
|
486
449
|
return releaseContext;
|
|
487
450
|
}
|
|
488
451
|
}
|
|
489
452
|
|
|
490
|
-
function
|
|
453
|
+
function fileContextsFromJSONAndEntries(json, entries, fileContexts, releaseContext) {
|
|
491
454
|
const fileContextsJSON = json; ///
|
|
492
455
|
|
|
493
456
|
fileContextsJSON.forEach((fileContextJSON) => {
|
|
494
|
-
const
|
|
495
|
-
|
|
457
|
+
const { filePath } = fileContextJSON,
|
|
458
|
+
file = entries.getFile(filePath),
|
|
459
|
+
fileContext = FileContext.fromFile(file, releaseContext);
|
|
496
460
|
|
|
497
461
|
fileContext.initialise(fileContextJSON);
|
|
498
462
|
|
|
@@ -500,19 +464,17 @@ function fileContextsFromJSONAndReleaseContext(json, fileContexts, releaseContex
|
|
|
500
464
|
});
|
|
501
465
|
}
|
|
502
466
|
|
|
503
|
-
function
|
|
467
|
+
function fileContextsFromEntries(entries, fileContexts, releaseContext) {
|
|
504
468
|
entries.forEachFile((file) => {
|
|
505
469
|
const filePath = file.getPath(),
|
|
506
470
|
filePathNominalFilePath = isFilePathNominalFilePath(filePath);
|
|
507
471
|
|
|
508
472
|
if (filePathNominalFilePath) {
|
|
509
|
-
const fileContext = FileContext.
|
|
473
|
+
const fileContext = FileContext.fromFile(file, releaseContext);
|
|
510
474
|
|
|
511
475
|
fileContexts.push(fileContext);
|
|
512
476
|
}
|
|
513
477
|
});
|
|
514
|
-
|
|
515
|
-
return fileContexts;
|
|
516
478
|
}
|
|
517
479
|
|
|
518
480
|
function verifyFileContexts(fileContexts, verifiedFileContexts) {
|
|
@@ -562,7 +524,7 @@ function verifyFileContext(fileContext) {
|
|
|
562
524
|
|
|
563
525
|
if (tokens === null) {
|
|
564
526
|
const filePath = fileContext.getFilePath(),
|
|
565
|
-
file = fileContext.
|
|
527
|
+
file = fileContext.findFile(filePath),
|
|
566
528
|
lexer = fileContext.getLexer(),
|
|
567
529
|
parser = fileContext.getParser(),
|
|
568
530
|
content = file.getContent(),
|
package/src/equality.js
CHANGED
|
@@ -121,14 +121,14 @@ export default class Equality {
|
|
|
121
121
|
|
|
122
122
|
const equalityString = this.string; ///
|
|
123
123
|
|
|
124
|
-
localContext.trace(`Verifying the
|
|
124
|
+
localContext.trace(`Verifying the '${equalityString}' stated equality...`);
|
|
125
125
|
|
|
126
126
|
const termsVerified = this.verifyTerms(localContext);
|
|
127
127
|
|
|
128
128
|
verifiedWhenStated = termsVerified; ///
|
|
129
129
|
|
|
130
130
|
if (verifiedWhenStated) {
|
|
131
|
-
localContext.debug(`...verified the
|
|
131
|
+
localContext.debug(`...verified the '${equalityString}' stated equality.`);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
return verifiedWhenStated;
|
|
@@ -139,7 +139,7 @@ export default class Equality {
|
|
|
139
139
|
|
|
140
140
|
const equalityString = this.string; ///
|
|
141
141
|
|
|
142
|
-
localContext.trace(`Verifying the
|
|
142
|
+
localContext.trace(`Verifying the '${equalityString}' derived equality...`);
|
|
143
143
|
|
|
144
144
|
const termsVerified = this.verifyTerms(localContext);
|
|
145
145
|
|
|
@@ -150,7 +150,7 @@ export default class Equality {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
if (verifiedWhenDerived) {
|
|
153
|
-
localContext.debug(`...verified the
|
|
153
|
+
localContext.debug(`...verified the '${equalityString}' derived equality.`);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
return verifiedWhenDerived;
|