occam-verify-cli 0.0.455 → 0.0.457
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/axiom.js +26 -46
- package/lib/combinator.js +2 -3
- package/lib/conclusion.js +2 -3
- package/lib/constructor.js +2 -3
- package/lib/context/file.js +5 -1
- package/lib/context/release/file.js +17 -4
- package/lib/label.js +2 -3
- package/lib/lemma.js +26 -46
- package/lib/premise.js +2 -3
- package/lib/ruleNames.js +5 -1
- package/lib/theorem.js +26 -46
- package/lib/utilities/string.js +46 -1
- package/lib/verify/assertion/type.js +55 -0
- package/lib/verify/axiom.js +10 -15
- package/lib/verify/equality.js +7 -1
- package/lib/verify/lemma.js +13 -22
- package/lib/verify/metastatement/qualified.js +4 -3
- package/lib/verify/metastatement/unqualified.js +14 -9
- package/lib/verify/metastatement.js +19 -0
- package/lib/verify/statement/qualified.js +14 -11
- package/lib/verify/statement/unqualified.js +13 -9
- package/lib/verify/statement.js +5 -8
- package/lib/verify/statementAsCombinator.js +3 -2
- package/lib/verify/term.js +6 -1
- package/lib/verify/termAsConstructor.js +5 -5
- package/lib/verify/theorem.js +10 -15
- package/lib/verify/type.js +8 -7
- package/lib/verify/variable.js +4 -3
- package/package.json +3 -3
- package/src/axiom.js +27 -54
- package/src/combinator.js +3 -3
- package/src/conclusion.js +3 -3
- package/src/constructor.js +3 -3
- package/src/context/file.js +6 -0
- package/src/context/release/file.js +17 -4
- package/src/label.js +3 -3
- package/src/lemma.js +28 -55
- package/src/premise.js +3 -3
- package/src/ruleNames.js +1 -0
- package/src/theorem.js +32 -59
- package/src/utilities/string.js +67 -0
- package/src/verify/assertion/type.js +32 -56
- package/src/verify/axiom.js +10 -24
- package/src/verify/equality.js +9 -0
- package/src/verify/lemma.js +14 -37
- package/src/verify/metastatement/qualified.js +5 -3
- package/src/verify/metastatement/unqualified.js +17 -10
- package/src/verify/metastatement.js +15 -0
- package/src/verify/statement/qualified.js +20 -8
- package/src/verify/statement/unqualified.js +16 -10
- package/src/verify/statement.js +5 -8
- package/src/verify/statementAsCombinator.js +4 -2
- package/src/verify/term.js +8 -0
- package/src/verify/termAsConstructor.js +5 -5
- package/src/verify/theorem.js +11 -25
- package/src/verify/type.js +9 -7
- package/src/verify/variable.js +5 -3
- package/lib/utilities/node.js +0 -45
- package/src/utilities/node.js +0 -50
|
@@ -14,25 +14,31 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, pro
|
|
|
14
14
|
|
|
15
15
|
proofContext.begin(unqualifiedStatementNode);
|
|
16
16
|
|
|
17
|
+
const unqualifiedStatementString = nodeAsString(unqualifiedStatementNode);
|
|
18
|
+
|
|
19
|
+
proofContext.debug(`Verifying the '${unqualifiedStatementString}' unqualified statement...`);
|
|
20
|
+
|
|
17
21
|
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
18
22
|
|
|
19
23
|
if (statementNode !== null) {
|
|
20
|
-
const
|
|
24
|
+
const statementVerified = verifyStatement(statementNode, proofContext);
|
|
21
25
|
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
assertionMatches = proofContext.matchAssertion(assertion);
|
|
26
|
+
if (statementVerified) {
|
|
27
|
+
const derived = proofContext.isDerived();
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
if (derived) {
|
|
30
|
+
const assertion = Assertion.fromStatementNode(statementNode),
|
|
31
|
+
assertionMatches = proofContext.matchAssertion(assertion);
|
|
32
|
+
|
|
33
|
+
unqualifiedStatementVerified = assertionMatches; ///
|
|
34
|
+
} else {
|
|
35
|
+
unqualifiedStatementVerified = true;
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
if (unqualifiedStatementVerified) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
proofContext.debug(`Verified the '${statementString}' unqualified statement.`);
|
|
41
|
+
proofContext.info(`Verified the '${unqualifiedStatementString}' unqualified statement.`);
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
unqualifiedStatementVerified ?
|
package/src/verify/statement.js
CHANGED
|
@@ -20,19 +20,16 @@ export default function verifyStatement(statementNode, proofContext) {
|
|
|
20
20
|
|
|
21
21
|
proofContext.debug(`Verifying the '${statementString}' statement...`);
|
|
22
22
|
|
|
23
|
-
if (
|
|
24
|
-
///
|
|
25
|
-
} else if (equalityNode !== null) {
|
|
23
|
+
if (equalityNode !== null) {
|
|
26
24
|
const equalityVerified = verifyEquality(equalityNode, proofContext);
|
|
27
25
|
|
|
28
26
|
statementVerified = equalityVerified; ///
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (typeAssertionNode !== null) {
|
|
30
|
+
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, proofContext);
|
|
32
31
|
|
|
33
32
|
statementVerified = typeAssertionVerified; ///
|
|
34
|
-
} else {
|
|
35
|
-
debugger
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
statementVerified ?
|
|
@@ -11,6 +11,10 @@ export default function verifyStatementAsCombinator(statementNode, fileContext)
|
|
|
11
11
|
|
|
12
12
|
fileContext.begin(statementNode);
|
|
13
13
|
|
|
14
|
+
const statementString = nodeAsString(statementNode);
|
|
15
|
+
|
|
16
|
+
fileContext.debug(`Verifying the '${statementString}' combinator....`);
|
|
17
|
+
|
|
14
18
|
const nonTerminalNode = statementNode, ///
|
|
15
19
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
16
20
|
childNodesVerified = verifyChildNodes(childNodes, fileContext);
|
|
@@ -24,8 +28,6 @@ export default function verifyStatementAsCombinator(statementNode, fileContext)
|
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
if (statementVerifiedAsCombinator) {
|
|
27
|
-
const statementString = nodeAsString(statementNode);
|
|
28
|
-
|
|
29
31
|
fileContext.info(`Verified the '${statementString}' combinator.`);
|
|
30
32
|
}
|
|
31
33
|
|
package/src/verify/term.js
CHANGED
|
@@ -14,6 +14,10 @@ export default function verifyTerm(termNode, types, context) {
|
|
|
14
14
|
|
|
15
15
|
context.begin(termNode);
|
|
16
16
|
|
|
17
|
+
const termString = nodeAsString(termNode);
|
|
18
|
+
|
|
19
|
+
context.debug(`Verifying the '${termString}' term...`);
|
|
20
|
+
|
|
17
21
|
const variables = [],
|
|
18
22
|
termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context);
|
|
19
23
|
|
|
@@ -33,6 +37,10 @@ export default function verifyTerm(termNode, types, context) {
|
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
if (termVerified) {
|
|
41
|
+
context.info(`Verified the '${termString}' term.`);
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
termVerified ?
|
|
37
45
|
context.complete(termNode) :
|
|
38
46
|
context.halt(termNode);
|
|
@@ -18,7 +18,11 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
18
18
|
let type = null;
|
|
19
19
|
|
|
20
20
|
const nonTerminalNode = termNode, ///
|
|
21
|
-
|
|
21
|
+
termString = nodeAsString(termNode);
|
|
22
|
+
|
|
23
|
+
fileContext.debug(`Verifying the '${termString}' constructor...`);
|
|
24
|
+
|
|
25
|
+
const childNodes = nonTerminalNode.getChildNodes(),
|
|
22
26
|
childNodesVerified = verifyChildNodes(childNodes, fileContext);
|
|
23
27
|
|
|
24
28
|
if (childNodesVerified) {
|
|
@@ -32,8 +36,6 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
32
36
|
if (type !== null) {
|
|
33
37
|
termVerifiedAsConstructor = true;
|
|
34
38
|
} else {
|
|
35
|
-
const termString = nodeAsString(termNode);
|
|
36
|
-
|
|
37
39
|
fileContext.error(`The '${termString}' constructor's '${typeName}' type is missing.`);
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -46,8 +48,6 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
if (termVerifiedAsConstructor) {
|
|
49
|
-
const termString = nodeAsString(termNode);
|
|
50
|
-
|
|
51
51
|
fileContext.info(`Verified the '${termString}' constructor.`);
|
|
52
52
|
}
|
|
53
53
|
|
package/src/verify/theorem.js
CHANGED
|
@@ -6,13 +6,10 @@ import ProofContext from "../context/proof";
|
|
|
6
6
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
7
7
|
import verifyIndicativeConditional from "../verify/indicativeConditional";
|
|
8
8
|
|
|
9
|
-
import { front, last } from "../utilities/array";
|
|
10
9
|
import { nodesAsString } from "../utilities/string";
|
|
11
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
11
|
|
|
13
12
|
const labelNodesQuery = nodesQuery("/theorem/label"),
|
|
14
|
-
statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
15
|
-
statementNodesQuery = nodesQuery("/indicativeConditional/unqualifiedStatement/statement!"),
|
|
16
13
|
unqualifiedStatementNodeQuery = nodeQuery("/theorem/unqualifiedStatement!"),
|
|
17
14
|
indicativeConditionalNodeQuery = nodeQuery("/theorem/indicativeConditional!");
|
|
18
15
|
|
|
@@ -28,40 +25,29 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
28
25
|
fileContext.debug(`Verifying the '${labelsString}' theorem...`);
|
|
29
26
|
|
|
30
27
|
const labels = [],
|
|
31
|
-
|
|
28
|
+
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
32
29
|
|
|
33
30
|
if (labelsVerified) {
|
|
34
31
|
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(theoremNode),
|
|
35
32
|
indicativeConditionalNode = indicativeConditionalNodeQuery(theoremNode);
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (unqualifiedStatementVerified) {
|
|
41
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
42
|
-
theorem = Theorem.fromLabelsAndStatementNode(labels, statementNode);
|
|
43
|
-
|
|
44
|
-
fileContext.addTheorem(theorem);
|
|
34
|
+
let unqualifiedStatementVerified = false,
|
|
35
|
+
indicativeConditionalVerified = false;
|
|
45
36
|
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
if (unqualifiedStatementNode !== null) {
|
|
38
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, proofContext);
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
if (indicativeConditionalNode !== null) {
|
|
51
|
-
|
|
42
|
+
indicativeConditionalVerified = verifyIndicativeConditional(indicativeConditionalNode, proofContext);
|
|
43
|
+
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
lastStatementNode = last(statementNodes),
|
|
56
|
-
frontStatementNodes = front(statementNodes),
|
|
57
|
-
consequentStatementNode = lastStatementNode, ///
|
|
58
|
-
suppositionStatementNodes = frontStatementNodes, ///
|
|
59
|
-
theorem = Theorem.fromLabelsSuppositionStatementNodesAndConsequentStatementNode(labels, suppositionStatementNodes, consequentStatementNode);
|
|
45
|
+
if (unqualifiedStatementVerified || indicativeConditionalVerified) {
|
|
46
|
+
const theorem = Theorem.fromLabelsUnqualifiedStatementNodeAndIndicativeConditionalNode(labels, unqualifiedStatementNode, indicativeConditionalNode);
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
fileContext.addTheorem(theorem);
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
}
|
|
50
|
+
theoremVerified = true;
|
|
65
51
|
}
|
|
66
52
|
}
|
|
67
53
|
|
package/src/verify/type.js
CHANGED
|
@@ -10,7 +10,9 @@ export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
|
10
10
|
|
|
11
11
|
fileContext.begin(typeNode);
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const typeString = nodeAsString(typeNode);
|
|
14
|
+
|
|
15
|
+
fileContext.debug(`Verifying the '${typeString}' type...`);
|
|
14
16
|
|
|
15
17
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
16
18
|
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
@@ -18,6 +20,8 @@ export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
|
18
20
|
if (typePresent) {
|
|
19
21
|
fileContext.error(`The type '${typeName}' is already present.`);
|
|
20
22
|
} else {
|
|
23
|
+
let type;
|
|
24
|
+
|
|
21
25
|
const superTypeName = typeNameFromTypeNode(superTypeNode);
|
|
22
26
|
|
|
23
27
|
if (superTypeName === null) {
|
|
@@ -31,17 +35,15 @@ export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
|
31
35
|
type = Type.fromTypeNameAndSuperType(typeName, superType);
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
if (type !== null) {
|
|
40
|
+
fileContext.addType(type);
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
typeVerified = true;
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
if (typeVerified) {
|
|
43
|
-
const typeString = nodeAsString(typeNode);
|
|
44
|
-
|
|
45
47
|
fileContext.info(`Verified the '${typeString}' type.`);
|
|
46
48
|
}
|
|
47
49
|
|
package/src/verify/variable.js
CHANGED
|
@@ -10,7 +10,9 @@ export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
|
10
10
|
|
|
11
11
|
fileContext.begin(variableNode);
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const variableString = nodeAsString(variableNode);
|
|
14
|
+
|
|
15
|
+
fileContext.debug(`Verifying the '${variableString}' variable...`);
|
|
14
16
|
|
|
15
17
|
const variableName = variableNameFromVariableNode(variableNode),
|
|
16
18
|
variablePresent = fileContext.isVariablePresentByVariableName(variableName);
|
|
@@ -18,6 +20,8 @@ export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
|
18
20
|
if (variablePresent) {
|
|
19
21
|
fileContext.error(`The variable '${variableName}' is already present.`);
|
|
20
22
|
} else {
|
|
23
|
+
let variable;
|
|
24
|
+
|
|
21
25
|
const typeName = typeNameFromTypeNode(typeNode);
|
|
22
26
|
|
|
23
27
|
if (typeName === null) {
|
|
@@ -45,8 +49,6 @@ export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
if (variableVerified) {
|
|
48
|
-
const variableString = nodeAsString(variableNode);
|
|
49
|
-
|
|
50
52
|
fileContext.info(`Verified the '${variableString}' variable.`);
|
|
51
53
|
}
|
|
52
54
|
|
package/lib/utilities/node.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
termNodeFromTermJSON: function() {
|
|
13
|
-
return termNodeFromTermJSON;
|
|
14
|
-
},
|
|
15
|
-
labelNodeFromLabelJSON: function() {
|
|
16
|
-
return labelNodeFromLabelJSON;
|
|
17
|
-
},
|
|
18
|
-
statementNodeFromStatementJSON: function() {
|
|
19
|
-
return statementNodeFromStatementJSON;
|
|
20
|
-
},
|
|
21
|
-
metastatementNodeFromMetastatementJSON: function() {
|
|
22
|
-
return metastatementNodeFromMetastatementJSON;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
var _query = require("../utilities/query");
|
|
26
|
-
var _ruleNames = require("../ruleNames");
|
|
27
|
-
var statementNodeQuery = (0, _query.nodeQuery)("/unqualifiedStatement/statement"), metastatementNodeQuery = (0, _query.nodeQuery)("/unqualifiedMetastatement/metastatement");
|
|
28
|
-
function termNodeFromTermJSON(termJSON, releaseContext) {
|
|
29
|
-
var ruleName = _ruleNames.TERM_RULE_NAME, content = termJSON, node = releaseContext.nodeFromContentAndRuleName(content, ruleName), termNode = node; ///
|
|
30
|
-
return termNode;
|
|
31
|
-
}
|
|
32
|
-
function labelNodeFromLabelJSON(labelJSON, releaseContext) {
|
|
33
|
-
var content = labelJSON, ruleName = _ruleNames.LABEL_RULE_NAME, node = releaseContext.nodeFromContentAndRuleName(content, ruleName), labelNode = node; ///
|
|
34
|
-
return labelNode;
|
|
35
|
-
}
|
|
36
|
-
function statementNodeFromStatementJSON(statementJSON, releaseContext) {
|
|
37
|
-
var ruleName = _ruleNames.UNQUALIFIED_STATEMENT_RULE_NAME, content = "".concat(statementJSON, "\n"), node = releaseContext.nodeFromContentAndRuleName(content, ruleName), unqualifiedStatementNode = node, statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
38
|
-
return statementNode;
|
|
39
|
-
}
|
|
40
|
-
function metastatementNodeFromMetastatementJSON(metastatementJSON, releaseContext) {
|
|
41
|
-
var ruleName = _ruleNames.UNQUALIFIED_METASTATEMENT_RULE_NAME, content = "".concat(metastatementJSON, "\n"), node = releaseContext.nodeFromContentAndRuleName(content, ruleName), unqualifiedMetastatementNode = node, metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
42
|
-
return metastatementNode;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvbm9kZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgbm9kZVF1ZXJ5IH0gZnJvbSBcIi4uL3V0aWxpdGllcy9xdWVyeVwiO1xuaW1wb3J0IHsgVEVSTV9SVUxFX05BTUUsXG4gICAgICAgICBMQUJFTF9SVUxFX05BTUUsXG4gICAgICAgICBVTlFVQUxJRklFRF9TVEFURU1FTlRfUlVMRV9OQU1FLFxuICAgICAgICAgVU5RVUF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
-
UNQUALIFIED_METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
8
|
-
|
|
9
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement"),
|
|
10
|
-
metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement");
|
|
11
|
-
|
|
12
|
-
export function termNodeFromTermJSON(termJSON, releaseContext) {
|
|
13
|
-
const ruleName = TERM_RULE_NAME,
|
|
14
|
-
content = termJSON, ///
|
|
15
|
-
node = releaseContext.nodeFromContentAndRuleName(content, ruleName),
|
|
16
|
-
termNode = node; ///
|
|
17
|
-
|
|
18
|
-
return termNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function labelNodeFromLabelJSON(labelJSON, releaseContext) {
|
|
22
|
-
const content = labelJSON, ///
|
|
23
|
-
ruleName = LABEL_RULE_NAME,
|
|
24
|
-
node = releaseContext.nodeFromContentAndRuleName(content, ruleName),
|
|
25
|
-
labelNode = node; ///
|
|
26
|
-
|
|
27
|
-
return labelNode;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function statementNodeFromStatementJSON(statementJSON, releaseContext) {
|
|
31
|
-
const ruleName = UNQUALIFIED_STATEMENT_RULE_NAME,
|
|
32
|
-
content = `${statementJSON}
|
|
33
|
-
`,
|
|
34
|
-
node = releaseContext.nodeFromContentAndRuleName(content, ruleName),
|
|
35
|
-
unqualifiedStatementNode = node, ///
|
|
36
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
37
|
-
|
|
38
|
-
return statementNode;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function metastatementNodeFromMetastatementJSON(metastatementJSON, releaseContext) {
|
|
42
|
-
const ruleName = UNQUALIFIED_METASTATEMENT_RULE_NAME,
|
|
43
|
-
content = `${metastatementJSON}
|
|
44
|
-
`,
|
|
45
|
-
node = releaseContext.nodeFromContentAndRuleName(content, ruleName),
|
|
46
|
-
unqualifiedMetastatementNode = node, ///
|
|
47
|
-
metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
48
|
-
|
|
49
|
-
return metastatementNode;
|
|
50
|
-
}
|