occam-verify-cli 1.0.631 → 1.0.633
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/defined.js +3 -3
- package/lib/element/assertion/type.js +4 -2
- package/lib/element/constructor/bracketed.js +13 -53
- package/lib/element/constructor.js +5 -5
- package/lib/element/declaration/constructor.js +5 -2
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/signature.js +5 -5
- package/lib/element/substitution/term.js +3 -3
- package/lib/element/term.js +6 -6
- package/lib/process/validate.js +6 -6
- package/lib/ruleNames.js +5 -1
- package/lib/utilities/validation.js +3 -3
- package/package.json +4 -4
- package/src/element/assertion/defined.js +2 -2
- package/src/element/assertion/type.js +3 -1
- package/src/element/constructor/bracketed.js +11 -12
- package/src/element/constructor.js +4 -4
- package/src/element/declaration/constructor.js +5 -1
- package/src/element/propertyRelation.js +2 -2
- package/src/element/signature.js +4 -4
- package/src/element/substitution/term.js +2 -2
- package/src/element/term.js +4 -3
- package/src/process/validate.js +4 -4
- package/src/ruleNames.js +1 -0
- package/src/utilities/validation.js +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "../../elements";
|
|
4
3
|
import Constructor from "../constructor";
|
|
5
4
|
|
|
6
5
|
import { define } from "../../elements";
|
|
6
|
+
import { termFromTermNode } from "../../utilities/element";
|
|
7
7
|
|
|
8
8
|
export default define(class BracketedConstructor extends Constructor {
|
|
9
9
|
getBracketedConstructorNode() {
|
|
@@ -13,7 +13,7 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
13
13
|
return bracketedConstructorNode;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
unifyTerm(term, context,
|
|
16
|
+
unifyTerm(term, context, validateForwards) {
|
|
17
17
|
let termUnifies;
|
|
18
18
|
|
|
19
19
|
const termString = term.getString();
|
|
@@ -21,34 +21,33 @@ export default define(class BracketedConstructor extends Constructor {
|
|
|
21
21
|
context.trace(`Unifying the '${termString}' term with the bracketed constructor...`);
|
|
22
22
|
|
|
23
23
|
termUnifies = super.unifyTerm(term, context, () => {
|
|
24
|
-
let
|
|
24
|
+
let validatesForwards = false;
|
|
25
25
|
|
|
26
|
-
const
|
|
27
|
-
bracketedTerm = term, ///
|
|
26
|
+
const bracketedTerm = term, ///
|
|
28
27
|
bracketedTermNode = bracketedTerm.getNode(),
|
|
29
28
|
singularTermNode = bracketedTermNode.getSingularTermNode();
|
|
30
29
|
|
|
31
30
|
if (singularTermNode !== null) {
|
|
32
31
|
const termNode = singularTermNode; ///
|
|
33
32
|
|
|
34
|
-
term =
|
|
33
|
+
term = termFromTermNode(termNode, context);
|
|
35
34
|
|
|
36
|
-
const
|
|
37
|
-
let
|
|
35
|
+
const termValidates = term.validate(context, () => {
|
|
36
|
+
let validatesForwards;
|
|
38
37
|
|
|
39
38
|
const type = term.getType();
|
|
40
39
|
|
|
41
40
|
bracketedTerm.setType(type);
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
validatesForwards = validateForwards();
|
|
44
43
|
|
|
45
|
-
return
|
|
44
|
+
return validatesForwards;
|
|
46
45
|
});
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
validatesForwards = termValidates; ///
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
return
|
|
50
|
+
return validatesForwards;
|
|
52
51
|
});
|
|
53
52
|
|
|
54
53
|
if (termUnifies) {
|
|
@@ -30,7 +30,7 @@ export default define(class Constructor extends Element {
|
|
|
30
30
|
|
|
31
31
|
setType(type) { this.term.setType(type); }
|
|
32
32
|
|
|
33
|
-
unifyTerm(term, context,
|
|
33
|
+
unifyTerm(term, context, validateForwards) {
|
|
34
34
|
let termUnifies = false;
|
|
35
35
|
|
|
36
36
|
const termString = term.getString(),
|
|
@@ -42,15 +42,15 @@ export default define(class Constructor extends Element {
|
|
|
42
42
|
termUnifiesWithConstructor = unifyTermWithConstructor(term, constructor, context);
|
|
43
43
|
|
|
44
44
|
if (termUnifiesWithConstructor) {
|
|
45
|
-
let
|
|
45
|
+
let validatesForwards;
|
|
46
46
|
|
|
47
47
|
const type = this.getType();
|
|
48
48
|
|
|
49
49
|
term.setType(type);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
validatesForwards = validateForwards();
|
|
52
52
|
|
|
53
|
-
termUnifies =
|
|
53
|
+
termUnifies = validatesForwards; ///
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (termUnifies) {
|
|
@@ -33,7 +33,11 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
33
33
|
|
|
34
34
|
const term = this.constructor.getTerm(),
|
|
35
35
|
termNode = term.getNode(),
|
|
36
|
-
termValidates = validateTerm(termNode, context)
|
|
36
|
+
termValidates = validateTerm(termNode, context, () => {
|
|
37
|
+
const validatesFormards = true;
|
|
38
|
+
|
|
39
|
+
return validatesFormards;
|
|
40
|
+
});
|
|
37
41
|
|
|
38
42
|
if (termValidates) {
|
|
39
43
|
constructorValidates = true;
|
|
@@ -57,9 +57,9 @@ export default define(class PropertyRelation extends Element {
|
|
|
57
57
|
context.trace(`Validating the '${termString}' term...`);
|
|
58
58
|
|
|
59
59
|
termValidates = this.term.validate(context, () => {
|
|
60
|
-
const
|
|
60
|
+
const validatesForwards = true;
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return validatesForwards;
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
if (termValidates) {
|
package/src/element/signature.js
CHANGED
|
@@ -35,13 +35,13 @@ export default define(class Signature extends Element {
|
|
|
35
35
|
context.trace(`Verifying the '${signatureString}' signature...`);
|
|
36
36
|
|
|
37
37
|
verifies = this.terms.every((term) => {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const termValidates = term.validate(context, () => {
|
|
39
|
+
const validatesForwards = true;
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return validatesForwards;
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
if (
|
|
44
|
+
if (termValidates) {
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -126,9 +126,9 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
126
126
|
|
|
127
127
|
if (targetTermSingular) {
|
|
128
128
|
targetTermValidates = this.targetTerm.validate(context, () => {
|
|
129
|
-
const
|
|
129
|
+
const validatesForwards = true;
|
|
130
130
|
|
|
131
|
-
return
|
|
131
|
+
return validatesForwards;
|
|
132
132
|
});
|
|
133
133
|
} else {
|
|
134
134
|
context.debug(`The '${termSubstitutionString}' term subtitution's '${targetTermString}' target term is not singular.`);
|
package/src/element/term.js
CHANGED
|
@@ -148,7 +148,7 @@ export default define(class Term extends Element {
|
|
|
148
148
|
return comparesToParamter;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
validate(context,
|
|
151
|
+
validate(context, validateForwards) {
|
|
152
152
|
let validates;
|
|
153
153
|
|
|
154
154
|
const termString = this.getString(); ///
|
|
@@ -162,9 +162,10 @@ export default define(class Term extends Element {
|
|
|
162
162
|
|
|
163
163
|
context.debug(`...the '${termString}' term is already valid.`);
|
|
164
164
|
} else {
|
|
165
|
+
const term = this; ///
|
|
166
|
+
|
|
165
167
|
validates = validateTerms.some((validateTerm) => { ///
|
|
166
|
-
const
|
|
167
|
-
termValidates = validateTerm(term, context, verifyForwards);
|
|
168
|
+
const termValidates = validateTerm(term, context, validateForwards);
|
|
168
169
|
|
|
169
170
|
if (termValidates) {
|
|
170
171
|
return true;
|
package/src/process/validate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { ForwardPass } from "occam-languages";
|
|
4
3
|
import { queryUtilities } from "occam-languages";
|
|
4
|
+
import { SimplePass, ForwardPass } from "occam-languages";
|
|
5
5
|
|
|
6
6
|
import { termFromTermNode, statementFromStatementNode } from "../utilities/element";
|
|
7
7
|
|
|
@@ -70,7 +70,7 @@ class TermPass extends ForwardPass {
|
|
|
70
70
|
];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
class StatementPass extends
|
|
73
|
+
class StatementPass extends SimplePass {
|
|
74
74
|
run(statementNode, context) {
|
|
75
75
|
let success = false;
|
|
76
76
|
|
|
@@ -143,11 +143,11 @@ class StatementPass extends ForwardPass {
|
|
|
143
143
|
const termPass = new TermPass(),
|
|
144
144
|
statementPass = new StatementPass();
|
|
145
145
|
|
|
146
|
-
export function validateTerm(termNode, context) {
|
|
146
|
+
export function validateTerm(termNode, context, validateForwards) {
|
|
147
147
|
let termValidates = false;
|
|
148
148
|
|
|
149
149
|
const node = termNode, ///
|
|
150
|
-
sucess = termPass.run(node, context);
|
|
150
|
+
sucess = termPass.run(node, context, validateForwards);
|
|
151
151
|
|
|
152
152
|
if (sucess) {
|
|
153
153
|
termValidates = true;
|
package/src/ruleNames.js
CHANGED
|
@@ -76,6 +76,7 @@ export const PARENTHESISED_LABELS_RULE_NAME = "parenthesisedLabels";
|
|
|
76
76
|
export const PROPERTY_DECLARATION_RULE_NAME = "propertyDeclaration";
|
|
77
77
|
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
78
78
|
export const STATEMENT_SUBSTITUTION_RULE_NAME = "statementSubstitution";
|
|
79
|
+
export const REFERENCE_SUBSTITUTION_RULE_NAME = "referenceSubstitution";
|
|
79
80
|
export const COMBINATOR_DECLARATION_RULE_NAME = "combinatorDeclaration";
|
|
80
81
|
export const TYPE_PREFIX_DECLARATION_RULE_NAME = "typePrefixDeclaration";
|
|
81
82
|
export const SIMPLE_TYPE_DECLARATION_RULE_NAME = "simpleTypeDeclaration";
|
|
@@ -31,9 +31,9 @@ function validateTermAsVariable(term, context, validateForwards) {
|
|
|
31
31
|
|
|
32
32
|
term.setType(type);
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const validatesForwards = validateForwards();
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (validatesForwards) {
|
|
37
37
|
termValidatesAsVariable = true;
|
|
38
38
|
}
|
|
39
39
|
}
|