occam-verify-cli 1.0.230 → 1.0.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assignment/variable.js +4 -2
- package/lib/context/file.js +5 -5
- package/lib/context/local.js +19 -14
- package/lib/dom/axiom.js +36 -27
- package/lib/dom/combinator.js +5 -5
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/conjecture.js +9 -9
- package/lib/dom/constructor.js +5 -5
- package/lib/dom/declaration/combinator.js +14 -14
- package/lib/dom/declaration/complexType.js +35 -35
- package/lib/dom/declaration/constructor.js +19 -19
- package/lib/dom/declaration/metavariable.js +22 -22
- package/lib/dom/declaration/simpleType.js +23 -23
- package/lib/dom/declaration/variable.js +20 -20
- package/lib/dom/declaration.js +4 -2
- package/lib/dom/deduction.js +5 -5
- package/lib/dom/derivation.js +5 -5
- package/lib/dom/error.js +9 -9
- package/lib/dom/hypothesis.js +184 -0
- package/lib/dom/label.js +18 -24
- package/lib/dom/lemma.js +7 -7
- package/lib/dom/metaLemma.js +9 -9
- package/lib/dom/metaType.js +4 -10
- package/lib/dom/metatheorem.js +9 -9
- package/lib/dom/metavariable.js +7 -8
- package/lib/dom/parameter.js +2 -2
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +3 -3
- package/lib/dom/proof.js +3 -3
- package/lib/dom/property.js +9 -9
- package/lib/dom/reference.js +23 -22
- package/lib/dom/rule.js +24 -24
- package/lib/dom/section.js +248 -0
- package/lib/dom/signature.js +5 -5
- package/lib/dom/statement.js +25 -20
- package/lib/dom/step.js +3 -3
- package/lib/dom/subDerivation.js +5 -5
- package/lib/dom/subproof.js +7 -7
- package/lib/dom/substitution/statement.js +3 -3
- package/lib/dom/supposition.js +5 -5
- package/lib/dom/term.js +5 -6
- package/lib/dom/theorem.js +9 -9
- package/lib/dom/topLevelAssertion.js +123 -31
- package/lib/dom/topLevelMetaAssertion.js +13 -13
- package/lib/dom/type.js +21 -21
- package/lib/dom/variable.js +9 -15
- package/lib/index.js +3 -1
- package/lib/mixins/step/unify.js +11 -11
- package/lib/mixins/term/verify.js +6 -6
- package/lib/node/hypothesis.js +123 -0
- package/lib/node/section.js +144 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/context.js +1 -1
- package/lib/utilities/json.js +82 -59
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/subproof.js +10 -10
- package/lib/verifier/combinator.js +9 -10
- package/lib/verifier/constructor.js +10 -11
- package/lib/verifier/topLevel.js +38 -31
- package/package.json +2 -2
- package/src/assignment/variable.js +6 -4
- package/src/context/file.js +3 -3
- package/src/context/local.js +6 -14
- package/src/dom/axiom.js +47 -42
- package/src/dom/combinator.js +4 -4
- package/src/dom/conclusion.js +5 -5
- package/src/dom/conjecture.js +8 -8
- package/src/dom/constructor.js +4 -4
- package/src/dom/declaration/combinator.js +14 -14
- package/src/dom/declaration/complexType.js +35 -35
- package/src/dom/declaration/constructor.js +20 -20
- package/src/dom/declaration/metavariable.js +22 -22
- package/src/dom/declaration/simpleType.js +22 -22
- package/src/dom/declaration/variable.js +21 -21
- package/src/dom/declaration.js +5 -3
- package/src/dom/deduction.js +5 -5
- package/src/dom/derivation.js +5 -5
- package/src/dom/error.js +8 -8
- package/src/dom/hypothesis.js +119 -0
- package/src/dom/label.js +17 -19
- package/src/dom/lemma.js +8 -8
- package/src/dom/metaLemma.js +8 -8
- package/src/dom/metaType.js +2 -6
- package/src/dom/metatheorem.js +8 -8
- package/src/dom/metavariable.js +9 -12
- package/src/dom/parameter.js +1 -1
- package/src/dom/premise.js +8 -8
- package/src/dom/procedureCall.js +3 -3
- package/src/dom/proof.js +2 -2
- package/src/dom/property.js +8 -8
- package/src/dom/reference.js +23 -27
- package/src/dom/rule.js +29 -29
- package/src/dom/section.js +197 -0
- package/src/dom/signature.js +4 -5
- package/src/dom/statement.js +24 -32
- package/src/dom/step.js +4 -4
- package/src/dom/subDerivation.js +5 -5
- package/src/dom/subproof.js +8 -8
- package/src/dom/substitution/statement.js +5 -5
- package/src/dom/supposition.js +7 -7
- package/src/dom/term.js +3 -8
- package/src/dom/theorem.js +7 -7
- package/src/dom/topLevelAssertion.js +113 -40
- package/src/dom/topLevelMetaAssertion.js +19 -19
- package/src/dom/type.js +22 -22
- package/src/dom/variable.js +8 -11
- package/src/index.js +2 -0
- package/src/mixins/step/unify.js +10 -10
- package/src/mixins/term/verify.js +4 -5
- package/src/node/hypothesis.js +23 -0
- package/src/node/section.js +44 -0
- package/src/nonTerminalNodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/utilities/context.js +2 -2
- package/src/utilities/json.js +86 -58
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/subproof.js +10 -10
- package/src/verifier/combinator.js +6 -11
- package/src/verifier/constructor.js +9 -12
- package/src/verifier/topLevel.js +42 -30
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.234",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"occam-custom-grammars": "^5.0.1222",
|
|
16
16
|
"occam-entities": "^1.0.366",
|
|
17
17
|
"occam-file-system": "^6.0.384",
|
|
18
|
-
"occam-furtle": "^2.0.
|
|
18
|
+
"occam-furtle": "^2.0.175",
|
|
19
19
|
"occam-grammars": "^1.3.298",
|
|
20
20
|
"occam-lexers": "^23.0.47",
|
|
21
21
|
"occam-parsers": "^23.0.160",
|
|
@@ -10,11 +10,13 @@ export default class VariableAssignment {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
assign(context) {
|
|
13
|
-
const nested = false
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const nested = false;
|
|
14
|
+
|
|
15
|
+
context.addVariable(this.variable, nested);
|
|
16
|
+
|
|
17
|
+
const variableType = this.variable.getType(),
|
|
16
18
|
variableString = this.variable.getString(),
|
|
17
|
-
variableAssigned =
|
|
19
|
+
variableAssigned = true, ///
|
|
18
20
|
variableTypeString = variableType.getString();
|
|
19
21
|
|
|
20
22
|
variableAssigned ?
|
package/src/context/file.js
CHANGED
|
@@ -529,14 +529,14 @@ export default class FileContext {
|
|
|
529
529
|
return metaLemmaMetatheorems;
|
|
530
530
|
}
|
|
531
531
|
|
|
532
|
-
|
|
532
|
+
findAxiomLemmaTheoremOrConjectureByReference(reference) {
|
|
533
533
|
const axiom = this.findAxiomByReference(reference),
|
|
534
534
|
lemma = this.findLemmaByReference(reference),
|
|
535
535
|
theorem = this.findTheoremByReference(reference),
|
|
536
536
|
conjecture = this.findConjectureByReference(reference),
|
|
537
|
-
|
|
537
|
+
axiomLemmaTheoremOrConjecture = (axiom || lemma || theorem || conjecture);
|
|
538
538
|
|
|
539
|
-
return
|
|
539
|
+
return axiomLemmaTheoremOrConjecture;
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
findMetavariable(metavariable, generalContext, specificContext) {
|
package/src/context/local.js
CHANGED
|
@@ -116,7 +116,11 @@ class LocalContext {
|
|
|
116
116
|
|
|
117
117
|
getConstructors() { return this.context.getConstructors(); }
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
addAxiom(axiom) { this.context.addAxiom(axiom); }
|
|
120
|
+
|
|
121
|
+
addLemma(lemma) { this.context.addLemma(lemma); }
|
|
122
|
+
|
|
123
|
+
addTheorem(theorem) { this.context.addTheorem(theorem); }
|
|
120
124
|
|
|
121
125
|
addEquality(equality, context) {
|
|
122
126
|
let equalityAdded;
|
|
@@ -241,7 +245,7 @@ class LocalContext {
|
|
|
241
245
|
|
|
242
246
|
isMetaLemmaMetatheoremPresentByReference(reference) { return this.context.isMetaLemmaMetatheoremPresentByReference(reference); }
|
|
243
247
|
|
|
244
|
-
|
|
248
|
+
findAxiomLemmaTheoremOrConjectureByReference(reference) { return this.context.findAxiomLemmaTheoremOrConjectureByReference(reference); }
|
|
245
249
|
|
|
246
250
|
isMetavariablePresent(metavariable, generalContext, specificContext) { return this.context.isMetavariablePresent(metavariable, generalContext, specificContext); }
|
|
247
251
|
|
|
@@ -392,18 +396,6 @@ class LocalContext {
|
|
|
392
396
|
return localContext;
|
|
393
397
|
}
|
|
394
398
|
|
|
395
|
-
static fromFileContext(fileContext) {
|
|
396
|
-
const context = fileContext, ///
|
|
397
|
-
tokens = null,
|
|
398
|
-
variables = [],
|
|
399
|
-
judgements = [],
|
|
400
|
-
equivalences = Equivalences.fromNothing(),
|
|
401
|
-
stepsOrSubproofs = [],
|
|
402
|
-
localContext = new LocalContext(context, tokens, variables, judgements, equivalences, stepsOrSubproofs);
|
|
403
|
-
|
|
404
|
-
return localContext;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
399
|
static fromContextAndTokens(context, tokens) {
|
|
408
400
|
const variables = [],
|
|
409
401
|
judgements = [],
|
package/src/dom/axiom.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
3
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
5
4
|
|
|
6
5
|
import { domAssigned } from "../dom";
|
|
@@ -17,10 +16,10 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
17
16
|
let verifies;
|
|
18
17
|
|
|
19
18
|
const axiom = this, ///
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
context = this.getContext(),
|
|
20
|
+
axiomString = axiom.getString();
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
context.trace(`Verifying the '${axiomString}' axiom...`);
|
|
24
23
|
|
|
25
24
|
const signatureVerifies = this.verifySignature();
|
|
26
25
|
|
|
@@ -31,9 +30,9 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
31
30
|
if (verifies) {
|
|
32
31
|
const axiom = this; ///
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
context.addAxiom(axiom);
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
context.debug(`...verified the '${axiomString}' axiom.`);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
return verifies;
|
|
@@ -45,10 +44,8 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
45
44
|
const satisfiable = this.isSatisfiable();
|
|
46
45
|
|
|
47
46
|
if (satisfiable) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
51
|
-
context = localContext; ///
|
|
47
|
+
const context = this.getContext(),
|
|
48
|
+
signature = this.getSignature();
|
|
52
49
|
|
|
53
50
|
signatureVerifies = signature.verify(context);
|
|
54
51
|
} else {
|
|
@@ -68,13 +65,13 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
68
65
|
|
|
69
66
|
signature = this.getSignature()
|
|
70
67
|
|
|
71
|
-
const signatureB = signature
|
|
72
|
-
|
|
73
|
-
const fileContext = this.getFileContext(),
|
|
74
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
75
|
-
generalContext = localContext, ///
|
|
68
|
+
const signatureB = signature, ///
|
|
76
69
|
specificContext = context; ///
|
|
77
70
|
|
|
71
|
+
context = this.getContext();
|
|
72
|
+
|
|
73
|
+
const generalContext = context; ///
|
|
74
|
+
|
|
78
75
|
signatureMatches = signatureA.match(signatureB, substitutions, generalContext, specificContext);
|
|
79
76
|
}
|
|
80
77
|
|
|
@@ -95,10 +92,11 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
95
92
|
context.trace(`Cannot unify the '${stepString}' step with the '${axiomString}' axiom because the axiom is not unconditional.`);
|
|
96
93
|
} else {
|
|
97
94
|
const statement = step.getStatement(),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
specificContext = context; ///
|
|
96
|
+
|
|
97
|
+
context = this.getContext();
|
|
98
|
+
|
|
99
|
+
const generalContext = context, ///
|
|
102
100
|
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext);
|
|
103
101
|
|
|
104
102
|
if (statementUnifiesWithDeduction) {
|
|
@@ -150,10 +148,11 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
150
148
|
context.trace(`Cannot unify the '${subproofString}' subproof with the '${axiomString}' axiom because the axiom is unconditional.`);
|
|
151
149
|
} else {
|
|
152
150
|
const lastStep = subproof.getLastStep(),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
specificContext = context; ///
|
|
152
|
+
|
|
153
|
+
context = this.getContext();
|
|
154
|
+
|
|
155
|
+
const generalContext = context, ///
|
|
157
156
|
lastStepUnifies = this.unifyLastStep(lastStep, substitutions, generalContext, specificContext);
|
|
158
157
|
|
|
159
158
|
if (lastStepUnifies) {
|
|
@@ -235,41 +234,47 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
235
234
|
return suppositionsUnify;
|
|
236
235
|
}
|
|
237
236
|
|
|
238
|
-
|
|
239
|
-
let
|
|
237
|
+
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, substitutions, context) {
|
|
238
|
+
let axiomLemmaTheoremOrConjectureUnifies = false;
|
|
240
239
|
|
|
241
240
|
const axiomString = this.getString(),
|
|
242
|
-
|
|
241
|
+
axiomLemmaTheoremOrConjectureString = axiomLemmaTheoremOrConjecture.getString();
|
|
242
|
+
|
|
243
|
+
context.trace(`Unifying the '${axiomLemmaTheoremOrConjectureString}' axiom, lemma, theorem or conjecture with the '${axiomString}' axiom...`);
|
|
243
244
|
|
|
244
|
-
|
|
245
|
+
const hypothesesCorrelate = axiomLemmaTheoremOrConjecture.correlateHypotheses(context);
|
|
246
|
+
|
|
247
|
+
if (hypothesesCorrelate) {
|
|
248
|
+
const deduction = axiomLemmaTheoremOrConjecture.getDeduction(), ///
|
|
249
|
+
specificContext = context; ///
|
|
245
250
|
|
|
246
|
-
|
|
247
|
-
fileContext = this.getFileContext(),
|
|
248
|
-
generalContext = fileContext, ///
|
|
249
|
-
specificContext = context, ///
|
|
250
|
-
deductionUnifies = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
251
|
+
context = this.getContext();
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
suppositionsUnify = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
253
|
+
const generalContext = context, ///
|
|
254
|
+
deductionUnifies = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
if (deductionUnifies) {
|
|
257
|
+
const suppositions = axiomLemmaTheoremOrConjecture.getSuppositions(),
|
|
258
|
+
suppositionsUnify = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
259
|
+
|
|
260
|
+
axiomLemmaTheoremOrConjectureUnifies = suppositionsUnify; ///
|
|
261
|
+
}
|
|
257
262
|
}
|
|
258
263
|
|
|
259
|
-
if (
|
|
260
|
-
context.debug(`...unified the '${
|
|
264
|
+
if (axiomLemmaTheoremOrConjectureUnifies) {
|
|
265
|
+
context.debug(`...unified the '${axiomLemmaTheoremOrConjectureString}' axiom, lemma, theorem or conjecture with the '${axiomString}' axiom.`);
|
|
261
266
|
}
|
|
262
267
|
|
|
263
|
-
return
|
|
268
|
+
return axiomLemmaTheoremOrConjectureUnifies;
|
|
264
269
|
}
|
|
265
270
|
|
|
266
271
|
static name = "Axiom";
|
|
267
272
|
|
|
268
|
-
static fromJSON(json,
|
|
273
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Axiom, json, context); }
|
|
269
274
|
|
|
270
|
-
static fromAxiomNode(axiomNode,
|
|
275
|
+
static fromAxiomNode(axiomNode, context) {
|
|
271
276
|
const node = axiomNode, ///
|
|
272
|
-
axiom = TopLevelAssertion.fromNode(Axiom, node,
|
|
277
|
+
axiom = TopLevelAssertion.fromNode(Axiom, node, context);
|
|
273
278
|
|
|
274
279
|
return axiom;
|
|
275
280
|
}
|
package/src/dom/combinator.js
CHANGED
|
@@ -53,16 +53,16 @@ export default domAssigned(class Combinator {
|
|
|
53
53
|
return json;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
static fromJSON(json,
|
|
57
|
-
const statement = statementFromJSON(json,
|
|
56
|
+
static fromJSON(json, context) {
|
|
57
|
+
const statement = statementFromJSON(json, context),
|
|
58
58
|
combinator = new Combinator(statement);
|
|
59
59
|
|
|
60
60
|
return combinator;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
static fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
63
|
+
static fromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
|
|
64
64
|
const { Statement } = dom,
|
|
65
|
-
statement = Statement.fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
65
|
+
statement = Statement.fromCombinatorDeclarationNode(combinatorDeclarationNode, context),
|
|
66
66
|
combinator = new Combinator(statement);
|
|
67
67
|
|
|
68
68
|
return combinator;
|
package/src/dom/conclusion.js
CHANGED
|
@@ -74,19 +74,19 @@ export default domAssigned(class Conclusion {
|
|
|
74
74
|
|
|
75
75
|
static name = "Conclusion";
|
|
76
76
|
|
|
77
|
-
static fromJSON(json,
|
|
78
|
-
const statement = statementFromJSON(json,
|
|
77
|
+
static fromJSON(json, context) {
|
|
78
|
+
const statement = statementFromJSON(json, context),
|
|
79
79
|
string = statement.getString(),
|
|
80
80
|
conclusion = new Conclusion(string, statement);
|
|
81
81
|
|
|
82
82
|
return conclusion;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
static fromConclusionNode(conclusionNode,
|
|
85
|
+
static fromConclusionNode(conclusionNode, context) {
|
|
86
86
|
const { Statement } = dom,
|
|
87
87
|
node = conclusionNode, ///
|
|
88
|
-
string =
|
|
89
|
-
statement = Statement.fromConclusionNode(conclusionNode,
|
|
88
|
+
string = context.nodeAsString(node),
|
|
89
|
+
statement = Statement.fromConclusionNode(conclusionNode, context),
|
|
90
90
|
conclusion = new Conclusion(string, statement);
|
|
91
91
|
|
|
92
92
|
return conclusion;
|
package/src/dom/conjecture.js
CHANGED
|
@@ -8,20 +8,20 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const context = this.getContext(),
|
|
12
|
+
conjecture = this, ///
|
|
13
13
|
conjectureString = conjecture.getString();
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
context.trace(`Verifying the '${conjectureString}' conjecture...`);
|
|
16
16
|
|
|
17
17
|
verifies = super.verify();
|
|
18
18
|
|
|
19
19
|
if (verifies) {
|
|
20
20
|
const conjecture = this; ///
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
context.addConjecture(conjecture);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
context.debug(`...verified the '${conjectureString}' conjecture.`);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return verifies;
|
|
@@ -29,11 +29,11 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
29
29
|
|
|
30
30
|
static name = "Conjecture";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json,
|
|
32
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Conjecture, json, context); }
|
|
33
33
|
|
|
34
|
-
static fromConjectureNode(conjectureNode,
|
|
34
|
+
static fromConjectureNode(conjectureNode, context) {
|
|
35
35
|
const node = conjectureNode, ///
|
|
36
|
-
conjecture = TopLevelAssertion.fromNode(Conjecture, node,
|
|
36
|
+
conjecture = TopLevelAssertion.fromNode(Conjecture, node, context);
|
|
37
37
|
|
|
38
38
|
return conjecture;
|
|
39
39
|
}
|
package/src/dom/constructor.js
CHANGED
|
@@ -67,17 +67,17 @@ export default domAssigned(class Constructor {
|
|
|
67
67
|
return json;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
static fromJSON(json,
|
|
71
|
-
const term = termFromJSON(json,
|
|
70
|
+
static fromJSON(json, context) {
|
|
71
|
+
const term = termFromJSON(json, context),
|
|
72
72
|
string = stringFromTerm(term),
|
|
73
73
|
constructor = new Constructor(string, term);
|
|
74
74
|
|
|
75
75
|
return constructor;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
static fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
78
|
+
static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
79
79
|
const { Term } = dom,
|
|
80
|
-
term = Term.fromConstructorDeclarationNode(constructorDeclarationNode,
|
|
80
|
+
term = Term.fromConstructorDeclarationNode(constructorDeclarationNode, context),
|
|
81
81
|
string = stringFromTerm(term),
|
|
82
82
|
constructor = new Constructor(string, term);
|
|
83
83
|
|
|
@@ -7,14 +7,14 @@ import { domAssigned } from "../../dom";
|
|
|
7
7
|
import combinatorVerifier from "../../verifier/combinator";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class CombinatorDeclaration {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
10
|
+
constructor(context, string, combinator) {
|
|
11
|
+
this.context = context;
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.combinator = combinator;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
getContext() {
|
|
17
|
+
return this.context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getString() {
|
|
@@ -30,18 +30,18 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
30
30
|
|
|
31
31
|
const combinatorDeclarationString = this.getString(); ///
|
|
32
32
|
|
|
33
|
-
this.
|
|
33
|
+
this.context.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
34
34
|
|
|
35
35
|
const combinatorVerifies = this.verifyCombinator();
|
|
36
36
|
|
|
37
37
|
if (combinatorVerifies) {
|
|
38
|
-
this.
|
|
38
|
+
this.context.addCombinator(this.combinator);
|
|
39
39
|
|
|
40
40
|
verifies = true;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (verifies) {
|
|
44
|
-
this.
|
|
44
|
+
this.context.debug(`...verified the '${combinatorDeclarationString}' combinator declaration.`);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return verifies;
|
|
@@ -52,15 +52,15 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
52
52
|
|
|
53
53
|
const combinatorString = this.combinator.getString();
|
|
54
54
|
|
|
55
|
-
this.
|
|
55
|
+
this.context.trace(`Verifying the '${combinatorString}' combinator...`);
|
|
56
56
|
|
|
57
57
|
const statement = this.combinator.getStatement(),
|
|
58
58
|
statementNode = statement.getNode();
|
|
59
59
|
|
|
60
|
-
statementVerifies = combinatorVerifier.verifyStatement(statementNode, this.
|
|
60
|
+
statementVerifies = combinatorVerifier.verifyStatement(statementNode, this.context);
|
|
61
61
|
|
|
62
62
|
if (statementVerifies) {
|
|
63
|
-
this.
|
|
63
|
+
this.context.debug(`...verified the '${combinatorString}' combinator.`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return statementVerifies;
|
|
@@ -68,12 +68,12 @@ export default domAssigned(class CombinatorDeclaration {
|
|
|
68
68
|
|
|
69
69
|
static name = "CombinatorDeclaration";
|
|
70
70
|
|
|
71
|
-
static fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
71
|
+
static fromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
|
|
72
72
|
const { Combinator } = dom,
|
|
73
73
|
node = combinatorDeclarationNode, ///
|
|
74
|
-
string =
|
|
75
|
-
combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode,
|
|
76
|
-
combinatorDeclaration = new CombinatorDeclaration(
|
|
74
|
+
string = context.nodeAsString(node),
|
|
75
|
+
combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, context),
|
|
76
|
+
combinatorDeclaration = new CombinatorDeclaration(context, string, combinator);
|
|
77
77
|
|
|
78
78
|
return combinatorDeclaration;
|
|
79
79
|
}
|