occam-verify-cli 1.0.948 → 1.0.949
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/element/assertion/contained.js +2 -2
- package/lib/element/assertion/defined.js +2 -2
- package/lib/element/assertion/property.js +2 -2
- package/lib/element/assertion/type.js +3 -3
- package/lib/element/constructor/bracketed.js +4 -4
- package/lib/element/constructor.js +3 -6
- package/lib/element/equality.js +3 -3
- package/lib/element/metavariable.js +2 -2
- package/lib/element/property.js +4 -4
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/signature.js +2 -2
- package/lib/element/substitution/term.js +3 -3
- package/lib/element/term.js +12 -8
- package/lib/pass/zip.js +2 -2
- package/lib/process/validate.js +3 -3
- package/lib/utilities/validation.js +8 -8
- package/package.json +4 -4
- package/src/element/assertion/contained.js +1 -1
- package/src/element/assertion/defined.js +1 -1
- package/src/element/assertion/property.js +1 -1
- package/src/element/assertion/type.js +2 -2
- package/src/element/constructor/bracketed.js +3 -3
- package/src/element/constructor.js +2 -9
- package/src/element/equality.js +2 -2
- package/src/element/metavariable.js +1 -1
- package/src/element/property.js +3 -3
- package/src/element/propertyRelation.js +1 -1
- package/src/element/signature.js +1 -1
- package/src/element/substitution/term.js +2 -2
- package/src/element/term.js +13 -7
- package/src/pass/zip.js +2 -2
- package/src/process/validate.js +2 -2
- package/src/utilities/validation.js +8 -8
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.949",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.47",
|
|
14
14
|
"necessary": "^17.1.7",
|
|
15
|
-
"occam-furtle": "^3.0.
|
|
15
|
+
"occam-furtle": "^3.0.206",
|
|
16
16
|
"occam-grammars": "^1.3.524",
|
|
17
|
-
"occam-languages": "^0.0.
|
|
17
|
+
"occam-languages": "^0.0.212",
|
|
18
18
|
"occam-lexers": "^23.1.44",
|
|
19
19
|
"occam-model": "^1.0.506",
|
|
20
|
-
"occam-nominal": "^1.0.
|
|
20
|
+
"occam-nominal": "^1.0.110",
|
|
21
21
|
"occam-parsers": "^23.1.50",
|
|
22
22
|
"occam-server": "^7.0.7"
|
|
23
23
|
},
|
|
@@ -113,7 +113,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
113
113
|
const termSingular = this.term.isSingular();
|
|
114
114
|
|
|
115
115
|
if (termSingular) {
|
|
116
|
-
const term = this.term.validate(context, (term) => {
|
|
116
|
+
const term = this.term.validate(context, (term, context) => {
|
|
117
117
|
const validatesForwards = true;
|
|
118
118
|
|
|
119
119
|
return validatesForwards;
|
|
@@ -104,7 +104,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
104
104
|
const termSingular = this.term.isSingular();
|
|
105
105
|
|
|
106
106
|
if (termSingular) {
|
|
107
|
-
const term = this.term.validate(context, (term) => {
|
|
107
|
+
const term = this.term.validate(context, (term, context) => {
|
|
108
108
|
const validatesForwards = true;
|
|
109
109
|
|
|
110
110
|
return validatesForwards;
|
|
@@ -127,7 +127,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
127
127
|
context.trace(`Validating the '${propertyAssertionString}' property assertion's term...`);
|
|
128
128
|
|
|
129
129
|
const type = this.getType(),
|
|
130
|
-
term = this.term.validate(context, (term) => {
|
|
130
|
+
term = this.term.validate(context, (term, context) => {
|
|
131
131
|
let validatesForwards = false;
|
|
132
132
|
|
|
133
133
|
const termType = term.getType(),
|
|
@@ -123,7 +123,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
123
123
|
|
|
124
124
|
context.trace(`Validating the '${typeAssertionString}' stated type assertion...`);
|
|
125
125
|
|
|
126
|
-
const term = this.term.validate(context, (term) => {
|
|
126
|
+
const term = this.term.validate(context, (term, context) => {
|
|
127
127
|
let validatesForwards = false;
|
|
128
128
|
|
|
129
129
|
const termType = term.getType(),
|
|
@@ -277,7 +277,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
277
277
|
|
|
278
278
|
function validateWhenDerived(term, type, context) {
|
|
279
279
|
if (term !== null) {
|
|
280
|
-
term = term.validate(context, (term) => {
|
|
280
|
+
term = term.validate(context, (term, context) => {
|
|
281
281
|
let validatesForwards = false;
|
|
282
282
|
|
|
283
283
|
const termType = term.getType(),
|
|
@@ -20,7 +20,7 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
20
20
|
|
|
21
21
|
context.trace(`Unifying the '${termString}' term with the bracketed constructor...`);
|
|
22
22
|
|
|
23
|
-
termUnifies = super.unifyTerm(term, context, (term) => {
|
|
23
|
+
termUnifies = super.unifyTerm(term, context, (term, context) => {
|
|
24
24
|
let validatesForwards = false;
|
|
25
25
|
|
|
26
26
|
const bracketedTerm = term, ///
|
|
@@ -34,7 +34,7 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
34
34
|
|
|
35
35
|
bracketlessTerm = termFromTermNode(bracketlessTermNode, context);
|
|
36
36
|
|
|
37
|
-
bracketlessTerm = bracketlessTerm.validate(context, (bracketlessTerm) => { ///
|
|
37
|
+
bracketlessTerm = bracketlessTerm.validate(context, (bracketlessTerm, context) => { ///
|
|
38
38
|
let validatesForwards;
|
|
39
39
|
|
|
40
40
|
const type = bracketlessTerm.getType(),
|
|
@@ -44,7 +44,7 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
44
44
|
|
|
45
45
|
bracketedTerm.setProvisional(provisional);
|
|
46
46
|
|
|
47
|
-
validatesForwards = validateForwards(bracketedTerm);
|
|
47
|
+
validatesForwards = validateForwards(bracketedTerm, context);
|
|
48
48
|
|
|
49
49
|
return validatesForwards;
|
|
50
50
|
});
|
|
@@ -8,7 +8,6 @@ import { instantiateConstructor } from "../process/instantiate";
|
|
|
8
8
|
import { termFromConstructorNode } from "../utilities/element";
|
|
9
9
|
import { unifyTermWithConstructor } from "../process/unify";
|
|
10
10
|
import { validateTermAsConstructor } from "../process/validate";
|
|
11
|
-
import { provisionallyStringFromProvisional } from "../utilities/string";
|
|
12
11
|
import { attempt, serialise, unserialise, instantiate } from "../utilities/context";
|
|
13
12
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
14
13
|
|
|
@@ -123,19 +122,13 @@ export default define(class Constructor extends Element {
|
|
|
123
122
|
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor, generalContext, specifiContext);
|
|
124
123
|
|
|
125
124
|
if (termUnifiesWithConstructor) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const typeString = this.type.getString(),
|
|
129
|
-
provisional = this.type.isProvisional(),
|
|
130
|
-
provisionallyString = provisionallyStringFromProvisional(provisional)
|
|
131
|
-
|
|
132
|
-
context.trace(`Setting the '${termString}' term's type to the '${constructorString}' constructor's '${typeString}' type${provisionallyString}.`);
|
|
125
|
+
const provisional = this.type.isProvisional();
|
|
133
126
|
|
|
134
127
|
term.setType(this.type);
|
|
135
128
|
|
|
136
129
|
term.setProvisional(provisional);
|
|
137
130
|
|
|
138
|
-
validatesForwards = validateForwards(term);
|
|
131
|
+
const validatesForwards = validateForwards(term, context);
|
|
139
132
|
|
|
140
133
|
if (validatesForwards) {
|
|
141
134
|
termUnifies = true;
|
package/src/element/equality.js
CHANGED
|
@@ -180,10 +180,10 @@ export default define(class Equality extends Element {
|
|
|
180
180
|
let leftTerm,
|
|
181
181
|
rightTerm;
|
|
182
182
|
|
|
183
|
-
leftTerm = this.leftTerm.validate(context, (leftTerm) => {
|
|
183
|
+
leftTerm = this.leftTerm.validate(context, (leftTerm, context) => {
|
|
184
184
|
let validatesForwards = false;
|
|
185
185
|
|
|
186
|
-
rightTerm = this.rightTerm.validate(context, (rightTerm) => {
|
|
186
|
+
rightTerm = this.rightTerm.validate(context, (rightTerm, context) => {
|
|
187
187
|
let validatesForwards = false;
|
|
188
188
|
|
|
189
189
|
const leftTermType = leftTerm.getType(),
|
|
@@ -279,7 +279,7 @@ export default define(class Metavariable extends Element {
|
|
|
279
279
|
}
|
|
280
280
|
} else {
|
|
281
281
|
if (!strict) {
|
|
282
|
-
term = this.term.validate(context, (term) => {
|
|
282
|
+
term = this.term.validate(context, (term, context) => {
|
|
283
283
|
const validatesForwards = true;
|
|
284
284
|
|
|
285
285
|
return validatesForwards;
|
package/src/element/property.js
CHANGED
|
@@ -138,7 +138,7 @@ export default define(class Property extends Element {
|
|
|
138
138
|
if (validProperty !== null) {
|
|
139
139
|
property = validProperty; ///
|
|
140
140
|
|
|
141
|
-
const validatesForward = validateForwards(property);
|
|
141
|
+
const validatesForward = validateForwards(property, context);
|
|
142
142
|
|
|
143
143
|
if (validatesForward) {
|
|
144
144
|
validates = true;
|
|
@@ -150,7 +150,7 @@ export default define(class Property extends Element {
|
|
|
150
150
|
} else {
|
|
151
151
|
{
|
|
152
152
|
const property = this, ///
|
|
153
|
-
validatesForward = validateForwards(property);
|
|
153
|
+
validatesForward = validateForwards(property, context);
|
|
154
154
|
|
|
155
155
|
if (validatesForward) {
|
|
156
156
|
validates = true;
|
|
@@ -181,7 +181,7 @@ export default define(class Property extends Element {
|
|
|
181
181
|
|
|
182
182
|
let validatesGivenType = false;
|
|
183
183
|
|
|
184
|
-
property = this.validate(context, (property) => {
|
|
184
|
+
property = this.validate(context, (property, context) => {
|
|
185
185
|
let validatesForwards = false;
|
|
186
186
|
|
|
187
187
|
const propertyName = property.getName(),
|
|
@@ -104,7 +104,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
104
104
|
|
|
105
105
|
context.trace(`Validating the '${propertyRelationString}' property relation's term...`);
|
|
106
106
|
|
|
107
|
-
const term = this.term.validate(context, (term) => {
|
|
107
|
+
const term = this.term.validate(context, (term, context) => {
|
|
108
108
|
const validatesForwards = true;
|
|
109
109
|
|
|
110
110
|
return validatesForwards;
|
package/src/element/signature.js
CHANGED
|
@@ -151,7 +151,7 @@ export default define(class Signature extends Element {
|
|
|
151
151
|
const terms = [];
|
|
152
152
|
|
|
153
153
|
termsValidate = this.terms.every((term) => {
|
|
154
|
-
term = term.validate(context, (term) => { ///
|
|
154
|
+
term = term.validate(context, (term, context) => { ///
|
|
155
155
|
const validatesForwards = true;
|
|
156
156
|
|
|
157
157
|
return validatesForwards;
|
|
@@ -140,7 +140,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
140
140
|
if (targetTermSingular) {
|
|
141
141
|
manifest((context) => {
|
|
142
142
|
descend((context) => {
|
|
143
|
-
const targetTerm = this.targetTerm.validate(context, (targetTerm) => {
|
|
143
|
+
const targetTerm = this.targetTerm.validate(context, (targetTerm, context) => {
|
|
144
144
|
const validatesForwards = true;
|
|
145
145
|
|
|
146
146
|
return validatesForwards;
|
|
@@ -175,7 +175,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
175
175
|
context.trace(`Validating the '${termSubstitutionString}' term substitution's replacement term...`);
|
|
176
176
|
|
|
177
177
|
descend((context) => {
|
|
178
|
-
const replacementTerm = this.replacementTerm.validate(context, (replacementTerm) => {
|
|
178
|
+
const replacementTerm = this.replacementTerm.validate(context, (replacementTerm, context) => {
|
|
179
179
|
const validatesForwards = true;
|
|
180
180
|
|
|
181
181
|
return validatesForwards;
|
package/src/element/term.js
CHANGED
|
@@ -195,7 +195,7 @@ export default define(class Term extends Element {
|
|
|
195
195
|
if (validTerm !== null) {
|
|
196
196
|
term = validTerm; ///
|
|
197
197
|
|
|
198
|
-
const validatesForward = validateForwards(term);
|
|
198
|
+
const validatesForward = validateForwards(term, context);
|
|
199
199
|
|
|
200
200
|
if (validatesForward) {
|
|
201
201
|
validates = true;
|
|
@@ -238,16 +238,22 @@ export default define(class Term extends Element {
|
|
|
238
238
|
|
|
239
239
|
let validatesGivenType = false;
|
|
240
240
|
|
|
241
|
-
term = this.validate(context, (term) => {
|
|
242
|
-
let validatesForwards;
|
|
241
|
+
term = this.validate(context, (term, context) => {
|
|
242
|
+
let validatesForwards = false;
|
|
243
243
|
|
|
244
|
-
const
|
|
244
|
+
const termType = term.getType(),
|
|
245
|
+
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
245
246
|
|
|
246
|
-
|
|
247
|
+
if (termTypeEqualToOrSubTypeOfType) {
|
|
248
|
+
validatesForwards = true;
|
|
247
249
|
|
|
248
|
-
|
|
250
|
+
const typeEstablished = type.isEstablished(),
|
|
251
|
+
termProvisional = term.isProvisional();
|
|
249
252
|
|
|
250
|
-
|
|
253
|
+
if (typeEstablished && termProvisional) {
|
|
254
|
+
validatesForwards = false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
251
257
|
|
|
252
258
|
return validatesForwards;
|
|
253
259
|
});
|
package/src/pass/zip.js
CHANGED
|
@@ -6,8 +6,8 @@ export default class ZipPass extends ZipPassBase {
|
|
|
6
6
|
run(generalNonTerminalNode, specificNonTerminalNode, ...remainingArguments) {
|
|
7
7
|
let success = false;
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const generalChildNodes = generalNonTerminalNode.getChildNodes(), ///
|
|
10
|
+
specificChildNodes = specificNonTerminalNode.getChildNodes(), ///
|
|
11
11
|
descended = this.descend(generalChildNodes, specificChildNodes, ...remainingArguments);
|
|
12
12
|
|
|
13
13
|
if (descended) {
|
package/src/process/validate.js
CHANGED
|
@@ -57,7 +57,7 @@ class CombinatorPass extends SimplePass {
|
|
|
57
57
|
|
|
58
58
|
term = termFromTermNode(termNode, context);
|
|
59
59
|
|
|
60
|
-
term = term.validate(context, (term) => { ///
|
|
60
|
+
term = term.validate(context, (term, context) => { ///
|
|
61
61
|
const validatesForwards = true;
|
|
62
62
|
|
|
63
63
|
return validatesForwards;
|
|
@@ -113,7 +113,7 @@ class ConstructorPass extends SimplePass {
|
|
|
113
113
|
|
|
114
114
|
term = termFromTermNode(termNode, context);
|
|
115
115
|
|
|
116
|
-
term = term.validate(context, (term) => { ///
|
|
116
|
+
term = term.validate(context, (term, context) => { ///
|
|
117
117
|
const validatesForwards = true;
|
|
118
118
|
|
|
119
119
|
return validatesForwards;
|
|
@@ -34,7 +34,7 @@ function validateTermAsVariable(term, context, validateForwards) {
|
|
|
34
34
|
|
|
35
35
|
term.setProvisional(provisional);
|
|
36
36
|
|
|
37
|
-
const validatesForwards = validateForwards(term);
|
|
37
|
+
const validatesForwards = validateForwards(term, context);
|
|
38
38
|
|
|
39
39
|
if (validatesForwards) {
|
|
40
40
|
termValidatesAsVariable = true;
|
|
@@ -50,24 +50,24 @@ function validateTermAsVariable(term, context, validateForwards) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function unifyTermWithConstructors(term, context, validateForwards) {
|
|
53
|
-
let termUnifiesWithConstructors
|
|
53
|
+
let termUnifiesWithConstructors;
|
|
54
54
|
|
|
55
55
|
const constructors = context.getConstructors();
|
|
56
56
|
|
|
57
|
-
constructors.some((constructor) => {
|
|
58
|
-
let
|
|
57
|
+
termUnifiesWithConstructors = constructors.some((constructor) => {
|
|
58
|
+
let termUnifiesWithConstructor = false;
|
|
59
59
|
|
|
60
60
|
choose((context) => {
|
|
61
|
-
termUnifies = constructor.unifyTerm(term, context, validateForwards);
|
|
61
|
+
const termUnifies = constructor.unifyTerm(term, context, validateForwards);
|
|
62
62
|
|
|
63
63
|
if (termUnifies) {
|
|
64
|
+
termUnifiesWithConstructor = true;
|
|
65
|
+
|
|
64
66
|
context.commit();
|
|
65
67
|
}
|
|
66
68
|
}, context);
|
|
67
69
|
|
|
68
|
-
if (
|
|
69
|
-
termUnifiesWithConstructors = true;
|
|
70
|
-
|
|
70
|
+
if (termUnifiesWithConstructor) {
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
73
|
});
|