occam-verify-cli 0.0.523 → 0.0.525
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/equality.js +130 -7
- package/lib/ruleNames.js +4 -4
- package/lib/utilities/string.js +3 -17
- package/lib/verify/derivation.js +3 -3
- package/lib/verify/metastatement/qualified.js +6 -7
- package/lib/verify/metastatement/unqualified.js +2 -2
- package/lib/verify/metastatement.js +2 -2
- package/lib/verify/ruleDerivation.js +3 -3
- package/lib/verify/statement/qualified.js +3 -3
- package/lib/verify/statement/unqualified.js +2 -2
- package/lib/verify/statement.js +53 -35
- package/lib/verify/statementAsCombinator.js +27 -16
- package/lib/verify/termAsConstructor.js +17 -17
- package/package.json +1 -1
- package/src/equality.js +202 -5
- package/src/ruleNames.js +1 -1
- package/src/utilities/string.js +11 -27
- package/src/verify/derivation.js +4 -2
- package/src/verify/metastatement/qualified.js +5 -8
- package/src/verify/metastatement/unqualified.js +1 -1
- package/src/verify/metastatement.js +1 -1
- package/src/verify/ruleDerivation.js +4 -2
- package/src/verify/statement/qualified.js +3 -3
- package/src/verify/statement/unqualified.js +2 -1
- package/src/verify/statement.js +64 -35
- package/src/verify/statementAsCombinator.js +47 -24
- package/src/verify/termAsConstructor.js +22 -23
package/src/verify/statement.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Equality from "../equality";
|
|
3
4
|
import verifyTerm from "../verify/term";
|
|
4
5
|
import equalityCombinator from "../ocmbinator/equality";
|
|
5
6
|
import bracketedCombinator from "../ocmbinator/bracketed";
|
|
@@ -10,6 +11,7 @@ import { objectType } from "../type";
|
|
|
10
11
|
import { nodeAsString } from "../utilities/string";
|
|
11
12
|
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
12
13
|
import { STATEMENT_META_TYPE } from "../metaTypes";
|
|
14
|
+
import { MAXIMUM_INDEXES_LENGTH } from "../constants";
|
|
13
15
|
import { nodeQuery, typeNameFromTypeNode } from "../utilities/query";
|
|
14
16
|
import { ARGUMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
15
17
|
|
|
@@ -19,56 +21,65 @@ const termNodeQuery = nodeQuery("/argument/term!"),
|
|
|
19
21
|
statementNodeQuery = nodeQuery("/metaArgument/statement!"),
|
|
20
22
|
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!");
|
|
21
23
|
|
|
22
|
-
export default function verifyStatement(statementNode, assertions,
|
|
24
|
+
export default function verifyStatement(statementNode, assertions, derived, context) {
|
|
23
25
|
let statementVerified = false;
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
context.begin(statementNode);
|
|
26
28
|
|
|
27
29
|
if (!statementVerified) {
|
|
28
|
-
const statementVerifiedAsEquality = verifyStatementAsEquality(statementNode,
|
|
30
|
+
const statementVerifiedAsEquality = verifyStatementAsEquality(statementNode, derived, context);
|
|
29
31
|
|
|
30
32
|
statementVerified = statementVerifiedAsEquality; //
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
if (!statementVerified) {
|
|
34
|
-
const statementVerifiedAsTypeAssertion = verifyStatementAsTypeAssertion(statementNode, assertions,
|
|
36
|
+
const statementVerifiedAsTypeAssertion = verifyStatementAsTypeAssertion(statementNode, assertions, context);
|
|
35
37
|
|
|
36
38
|
statementVerified = statementVerifiedAsTypeAssertion; ///
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
if (!statementVerified) {
|
|
40
|
-
const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode,
|
|
42
|
+
const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode, context);
|
|
41
43
|
|
|
42
44
|
statementVerified = statementVerifiedAgainstCombinators; ///
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
statementVerified ?
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
context.complete(statementNode) :
|
|
49
|
+
context.halt(statementNode);
|
|
48
50
|
|
|
49
51
|
return statementVerified;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
function verifyStatementAsEquality(statementNode,
|
|
54
|
+
function verifyStatementAsEquality(statementNode, derived, context) {
|
|
53
55
|
let statementVerifiedAsEquality = false;
|
|
54
56
|
|
|
55
57
|
const combinator = equalityCombinator, ///
|
|
56
|
-
statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator,
|
|
58
|
+
statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, context);
|
|
57
59
|
|
|
58
60
|
if (statementVerifiedAgainstCombinator) {
|
|
59
61
|
statementVerifiedAsEquality = true;
|
|
62
|
+
|
|
63
|
+
if (derived) {
|
|
64
|
+
const equality = Equality.fromStatementNode(statementNode),
|
|
65
|
+
proofSteps = context.getProofSteps(),
|
|
66
|
+
equalities = equalitiesFromProofSteps(proofSteps),
|
|
67
|
+
equalityEquates = equality.equate(equalities);
|
|
68
|
+
|
|
69
|
+
statementVerifiedAsEquality = equalityEquates; ///
|
|
70
|
+
}
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
return statementVerifiedAsEquality;
|
|
63
74
|
}
|
|
64
75
|
|
|
65
|
-
function verifyStatementAsTypeAssertion(statementNode, assertions,
|
|
76
|
+
function verifyStatementAsTypeAssertion(statementNode, assertions, context) {
|
|
66
77
|
let statementVerifiedAsTypeAssertion = false;
|
|
67
78
|
|
|
68
79
|
const typeAssertionNode = typeAssertionNodeQuery(statementNode);
|
|
69
80
|
|
|
70
81
|
if (typeAssertionNode !== null) {
|
|
71
|
-
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assertions,
|
|
82
|
+
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assertions, context);
|
|
72
83
|
|
|
73
84
|
statementVerifiedAsTypeAssertion = typeAssertionVerified; ///
|
|
74
85
|
}
|
|
@@ -76,10 +87,10 @@ function verifyStatementAsTypeAssertion(statementNode, assertions, proofContext)
|
|
|
76
87
|
return statementVerifiedAsTypeAssertion;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
function verifyStatementAgainstCombinators(statementNode,
|
|
90
|
+
function verifyStatementAgainstCombinators(statementNode, context) {
|
|
80
91
|
let statementVerifiedAgainstCombinators = false;
|
|
81
92
|
|
|
82
|
-
let combinators =
|
|
93
|
+
let combinators = context.getCombinators();
|
|
83
94
|
|
|
84
95
|
combinators = [ ///
|
|
85
96
|
bracketedCombinator,
|
|
@@ -87,7 +98,7 @@ function verifyStatementAgainstCombinators(statementNode, proofContext) {
|
|
|
87
98
|
];
|
|
88
99
|
|
|
89
100
|
const combinator = combinators.find((combinator) => {
|
|
90
|
-
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator,
|
|
101
|
+
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, context);
|
|
91
102
|
|
|
92
103
|
if (statementVerifiedAgainstCombinator) {
|
|
93
104
|
return true;
|
|
@@ -101,17 +112,17 @@ function verifyStatementAgainstCombinators(statementNode, proofContext) {
|
|
|
101
112
|
return statementVerifiedAgainstCombinators;
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
function verifyStatementAgainstCombinator(statementNode, combinator,
|
|
115
|
+
function verifyStatementAgainstCombinator(statementNode, combinator, context) {
|
|
105
116
|
const combinatorStatementNode = combinator.getStatementNode(),
|
|
106
117
|
node = statementNode, ///
|
|
107
118
|
combinatorNode = combinatorStatementNode, ///
|
|
108
|
-
nodeVerified = verifyNode(node, combinatorNode,
|
|
119
|
+
nodeVerified = verifyNode(node, combinatorNode, context),
|
|
109
120
|
statementVerifiedAgainstCombinator = nodeVerified; ///
|
|
110
121
|
|
|
111
122
|
return statementVerifiedAgainstCombinator;
|
|
112
123
|
}
|
|
113
124
|
|
|
114
|
-
function verifyNode(node, combinatorNode,
|
|
125
|
+
function verifyNode(node, combinatorNode, context) {
|
|
115
126
|
let nodeVerified;
|
|
116
127
|
|
|
117
128
|
const nodeTerminalNode = node.isTerminalNode(),
|
|
@@ -121,13 +132,13 @@ function verifyNode(node, combinatorNode, proofContext) {
|
|
|
121
132
|
if (nodeTerminalNode) {
|
|
122
133
|
const terminalNode = node, ///
|
|
123
134
|
combinatorTerminalNode = combinatorNode, ///
|
|
124
|
-
terminalNodeVerified = verifyTerminalNode(terminalNode, combinatorTerminalNode,
|
|
135
|
+
terminalNodeVerified = verifyTerminalNode(terminalNode, combinatorTerminalNode, context);
|
|
125
136
|
|
|
126
137
|
nodeVerified = terminalNodeVerified; ///
|
|
127
138
|
} else {
|
|
128
139
|
const nonTerminalNode = node, ///
|
|
129
140
|
combinatorNonTerminalNode = combinatorNode, ///
|
|
130
|
-
nonTerminalNodeVerified = verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode,
|
|
141
|
+
nonTerminalNodeVerified = verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, context);
|
|
131
142
|
|
|
132
143
|
nodeVerified = nonTerminalNodeVerified; ///
|
|
133
144
|
}
|
|
@@ -136,7 +147,7 @@ function verifyNode(node, combinatorNode, proofContext) {
|
|
|
136
147
|
return nodeVerified;
|
|
137
148
|
}
|
|
138
149
|
|
|
139
|
-
function verifyNodes(nodes, combinatorNodes,
|
|
150
|
+
function verifyNodes(nodes, combinatorNodes, context) {
|
|
140
151
|
let nodesVerified = false;
|
|
141
152
|
|
|
142
153
|
const nodesLength = nodes.length,
|
|
@@ -145,7 +156,7 @@ function verifyNodes(nodes, combinatorNodes, proofContext) {
|
|
|
145
156
|
if (nodesLength === combinatorNodesLength) {
|
|
146
157
|
nodesVerified = nodes.every((node, index) => {
|
|
147
158
|
const combinatorNode = combinatorNodes[index],
|
|
148
|
-
nodeVerified = verifyNode(node, combinatorNode,
|
|
159
|
+
nodeVerified = verifyNode(node, combinatorNode, context);
|
|
149
160
|
|
|
150
161
|
if (nodeVerified) {
|
|
151
162
|
return true;
|
|
@@ -156,7 +167,7 @@ function verifyNodes(nodes, combinatorNodes, proofContext) {
|
|
|
156
167
|
return nodesVerified;
|
|
157
168
|
}
|
|
158
169
|
|
|
159
|
-
function verifyTerminalNode(terminalNode, combinatorTerminalNode,
|
|
170
|
+
function verifyTerminalNode(terminalNode, combinatorTerminalNode, context) {
|
|
160
171
|
let terminalNodeVerified = false;
|
|
161
172
|
|
|
162
173
|
const matches = terminalNode.match(combinatorTerminalNode);
|
|
@@ -168,7 +179,7 @@ function verifyTerminalNode(terminalNode, combinatorTerminalNode, proofContext)
|
|
|
168
179
|
return terminalNodeVerified;
|
|
169
180
|
}
|
|
170
181
|
|
|
171
|
-
function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode,
|
|
182
|
+
function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, context) {
|
|
172
183
|
let nonTerminalNodeVerified = false;
|
|
173
184
|
|
|
174
185
|
const ruleName = nonTerminalNode.getRuleName(), ///
|
|
@@ -179,7 +190,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proof
|
|
|
179
190
|
case ARGUMENT_RULE_NAME: {
|
|
180
191
|
const argumentNode = nonTerminalNode, ///
|
|
181
192
|
combinatorArgumentNode = combinatorNonTerminalNode, ///
|
|
182
|
-
argumentNodeVerified = verifyArgumentNode(argumentNode, combinatorArgumentNode,
|
|
193
|
+
argumentNodeVerified = verifyArgumentNode(argumentNode, combinatorArgumentNode, context);
|
|
183
194
|
|
|
184
195
|
nonTerminalNodeVerified = argumentNodeVerified; ///
|
|
185
196
|
|
|
@@ -189,7 +200,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proof
|
|
|
189
200
|
case META_ARGUMENT_RULE_NAME: {
|
|
190
201
|
const metaArgumentNode = nonTerminalNode, ///
|
|
191
202
|
combinatorMetaargumentNode = combinatorNonTerminalNode, ///
|
|
192
|
-
metaArgumentNodeVerified = verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode,
|
|
203
|
+
metaArgumentNodeVerified = verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, context);
|
|
193
204
|
|
|
194
205
|
nonTerminalNodeVerified = metaArgumentNodeVerified; ///
|
|
195
206
|
|
|
@@ -201,7 +212,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proof
|
|
|
201
212
|
combinatorChildNodes = combinatorNonTerminalNode.getChildNodes(),
|
|
202
213
|
nodes = childNodes, ///
|
|
203
214
|
combinatorNodes = combinatorChildNodes, ///
|
|
204
|
-
nodesVerified = verifyNodes(nodes, combinatorNodes,
|
|
215
|
+
nodesVerified = verifyNodes(nodes, combinatorNodes, context);
|
|
205
216
|
|
|
206
217
|
nonTerminalNodeVerified = nodesVerified; ///
|
|
207
218
|
|
|
@@ -213,7 +224,7 @@ function verifyNonTerminalNode(nonTerminalNode, combinatorNonTerminalNode, proof
|
|
|
213
224
|
return nonTerminalNodeVerified;
|
|
214
225
|
}
|
|
215
226
|
|
|
216
|
-
function verifyArgumentNode(argumentNode, combinatorArgumentNode,
|
|
227
|
+
function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
217
228
|
let argumentNodeVerified = false;
|
|
218
229
|
|
|
219
230
|
const termNode = termNodeQuery(argumentNode);
|
|
@@ -221,10 +232,9 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, proofContext)
|
|
|
221
232
|
if (termNode === null) {
|
|
222
233
|
const argumentString = nodeAsString(argumentNode);
|
|
223
234
|
|
|
224
|
-
|
|
235
|
+
context.error(`The ${argumentString} argument should be a term, not a type`);
|
|
225
236
|
} else {
|
|
226
237
|
const types = [],
|
|
227
|
-
context = proofContext, ///
|
|
228
238
|
termVerified = verifyTerm(termNode, types, context);
|
|
229
239
|
|
|
230
240
|
if (termVerified) {
|
|
@@ -234,7 +244,7 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, proofContext)
|
|
|
234
244
|
typeName = typeNameFromTypeNode(typeNode),
|
|
235
245
|
type = (typeName === OBJECT_TYPE_NAME) ?
|
|
236
246
|
objectType : ///
|
|
237
|
-
|
|
247
|
+
context.findTypeByTypeName(typeName),
|
|
238
248
|
statementTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(type);
|
|
239
249
|
|
|
240
250
|
if (statementTypeEqualToOrSubTypeOfType) {
|
|
@@ -246,7 +256,7 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, proofContext)
|
|
|
246
256
|
return argumentNodeVerified;
|
|
247
257
|
}
|
|
248
258
|
|
|
249
|
-
function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode,
|
|
259
|
+
function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, context) {
|
|
250
260
|
let metaArgumentNodeVerified = false;
|
|
251
261
|
|
|
252
262
|
const statementNode = statementNodeQuery(metaArgumentNode);
|
|
@@ -254,10 +264,11 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, pr
|
|
|
254
264
|
if (statementNode === null) {
|
|
255
265
|
const metaArgumentString = nodeAsString(metaArgumentNode);
|
|
256
266
|
|
|
257
|
-
|
|
267
|
+
context.error(`The '${metaArgumentString}' meta-argument should be a statement, not a meta-type.`);
|
|
258
268
|
} else {
|
|
259
|
-
const
|
|
260
|
-
|
|
269
|
+
const derived = false,
|
|
270
|
+
assertions = null,
|
|
271
|
+
statementVerified = verifyStatement(statementNode, assertions, derived, context);
|
|
261
272
|
|
|
262
273
|
if (statementVerified) {
|
|
263
274
|
const combinatorMetaTYpeNode = metaTypeNodeQuery(combinatorMetaargumentNode);
|
|
@@ -273,10 +284,28 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, pr
|
|
|
273
284
|
if (!metaArgumentNodeVerified) {
|
|
274
285
|
const combinatorMetaargumentString = nodeAsString(combinatorMetaargumentNode);
|
|
275
286
|
|
|
276
|
-
|
|
287
|
+
context.error(`The '${combinatorMetaargumentString}' combinator meta-argument should be the 'Statement' meta-type.`);
|
|
277
288
|
}
|
|
278
289
|
}
|
|
279
290
|
}
|
|
280
291
|
|
|
281
292
|
return metaArgumentNodeVerified;
|
|
282
293
|
}
|
|
294
|
+
|
|
295
|
+
function equalitiesFromProofSteps(proofSteps) {
|
|
296
|
+
const start = -MAXIMUM_INDEXES_LENGTH; ///
|
|
297
|
+
|
|
298
|
+
proofSteps = proofSteps.slice(start); ///
|
|
299
|
+
|
|
300
|
+
const equalities = proofSteps.reduce((equalities, proofStep, index) => {
|
|
301
|
+
const equality = Equality.fromProofStep(proofStep);
|
|
302
|
+
|
|
303
|
+
if (equality !== null) {
|
|
304
|
+
equalities.push(equality);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return equalities;
|
|
308
|
+
}, []);
|
|
309
|
+
|
|
310
|
+
return equalities;
|
|
311
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Combinator from "../combinator";
|
|
4
|
+
import verifyTerm from "../verify/term";
|
|
5
|
+
import verifyStatement from "../verify/statement";
|
|
4
6
|
|
|
5
7
|
import { nodeAsString } from "../utilities/string";
|
|
6
8
|
import { typeNameFromTypeNode } from "../utilities/query";
|
|
7
|
-
import { TERM_RULE_NAME,
|
|
9
|
+
import { TYPE_RULE_NAME, TERM_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
|
|
8
10
|
|
|
9
11
|
export default function verifyStatementAsCombinator(statementNode, fileContext) {
|
|
10
12
|
let statementVerifiedAsCombinator = false;
|
|
@@ -58,29 +60,6 @@ function verifyNode(node, fileContext) {
|
|
|
58
60
|
return nodeVerified;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
function verifyTypeNode(typeNode, fileContext) {
|
|
62
|
-
let typeNodeVerified = false;
|
|
63
|
-
|
|
64
|
-
const typeName = typeNameFromTypeNode(typeNode),
|
|
65
|
-
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
66
|
-
|
|
67
|
-
if (!typePresent) {
|
|
68
|
-
fileContext.error(`The type '${typeName}' is missing.`);
|
|
69
|
-
} else {
|
|
70
|
-
typeNodeVerified = true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return typeNodeVerified;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function verifyTermNode(termNode, fileContext) {
|
|
77
|
-
let termNodeVerified = false;
|
|
78
|
-
|
|
79
|
-
debugger
|
|
80
|
-
|
|
81
|
-
return termNodeVerified;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
63
|
function verifyChildNodes(childNodes, fileContext) {
|
|
85
64
|
const childNodesVerified = childNodes.every((childNode) => {
|
|
86
65
|
const node = childNode, ///
|
|
@@ -124,6 +103,15 @@ function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
|
124
103
|
break;
|
|
125
104
|
}
|
|
126
105
|
|
|
106
|
+
case STATEMENT_RULE_NAME: {
|
|
107
|
+
const statmentNode = nonTerminalNode, ///
|
|
108
|
+
statmentNodeVerified = verifyStatementNode(statmentNode, fileContext);
|
|
109
|
+
|
|
110
|
+
nonTerminalNodeVerified = statmentNodeVerified; ///
|
|
111
|
+
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
|
|
127
115
|
default: {
|
|
128
116
|
const childNodes = nonTerminalNode.getChildNodes(),
|
|
129
117
|
childNodesVerified = verifyChildNodes(childNodes, fileContext);
|
|
@@ -136,3 +124,38 @@ function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
|
136
124
|
|
|
137
125
|
return nonTerminalNodeVerified;
|
|
138
126
|
}
|
|
127
|
+
|
|
128
|
+
function verifyTypeNode(typeNode, fileContext) {
|
|
129
|
+
let typeNodeVerified = false;
|
|
130
|
+
|
|
131
|
+
const typeName = typeNameFromTypeNode(typeNode),
|
|
132
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
133
|
+
|
|
134
|
+
if (!typePresent) {
|
|
135
|
+
fileContext.error(`The type '${typeName}' is missing.`);
|
|
136
|
+
} else {
|
|
137
|
+
typeNodeVerified = true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return typeNodeVerified;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function verifyTermNode(termNode, fileContext) {
|
|
144
|
+
const types = [],
|
|
145
|
+
context = fileContext, ///
|
|
146
|
+
termVerified = verifyTerm(termNode, types, context),
|
|
147
|
+
termNodeVerified = termVerified; ///
|
|
148
|
+
|
|
149
|
+
return termNodeVerified;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function verifyStatementNode(statementNode, fileContext) {
|
|
153
|
+
const context = fileContext, ///
|
|
154
|
+
derived = false,
|
|
155
|
+
assertions = [],
|
|
156
|
+
statementVerified = verifyStatement(statementNode, assertions, derived, context),
|
|
157
|
+
statementNodeVerified = statementVerified; ///
|
|
158
|
+
|
|
159
|
+
return statementNodeVerified;
|
|
160
|
+
}
|
|
161
|
+
|
|
@@ -97,29 +97,6 @@ function verifyTerminalNode(terminalNode, fileContext) {
|
|
|
97
97
|
return terminalNodeVerified;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function verifyArgumentNode(argumentNode, fileContext) {
|
|
101
|
-
let typeNodeVerified = false;
|
|
102
|
-
|
|
103
|
-
const typeNode = typeNodeQuery(argumentNode);
|
|
104
|
-
|
|
105
|
-
if (typeNode === null) {
|
|
106
|
-
const argumentString = nodeAsString(argumentNode);
|
|
107
|
-
|
|
108
|
-
fileContext.error(`The ${argumentString} argument should be a type.`);
|
|
109
|
-
} else {
|
|
110
|
-
const typeName = typeNameFromTypeNode(typeNode),
|
|
111
|
-
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
112
|
-
|
|
113
|
-
if (!typePresent) {
|
|
114
|
-
fileContext.error(`The type '${typeName}' is missing.`);
|
|
115
|
-
} else {
|
|
116
|
-
typeNodeVerified = true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return typeNodeVerified;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
100
|
function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
124
101
|
let nonTerminalNodeVerified;
|
|
125
102
|
|
|
@@ -170,3 +147,25 @@ function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
|
170
147
|
return nonTerminalNodeVerified;
|
|
171
148
|
}
|
|
172
149
|
|
|
150
|
+
function verifyArgumentNode(argumentNode, fileContext) {
|
|
151
|
+
let typeNodeVerified = false;
|
|
152
|
+
|
|
153
|
+
const typeNode = typeNodeQuery(argumentNode);
|
|
154
|
+
|
|
155
|
+
if (typeNode === null) {
|
|
156
|
+
const argumentString = nodeAsString(argumentNode);
|
|
157
|
+
|
|
158
|
+
fileContext.error(`The ${argumentString} argument should be a type.`);
|
|
159
|
+
} else {
|
|
160
|
+
const typeName = typeNameFromTypeNode(typeNode),
|
|
161
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
162
|
+
|
|
163
|
+
if (!typePresent) {
|
|
164
|
+
fileContext.error(`The type '${typeName}' is missing.`);
|
|
165
|
+
} else {
|
|
166
|
+
typeNodeVerified = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return typeNodeVerified;
|
|
171
|
+
}
|