occam-verify-cli 1.0.911 → 1.0.913
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/signature.js +2 -2
- package/lib/element/signature.js +27 -2
- package/lib/process/instantiate.js +8 -2
- package/lib/utilities/element.js +4 -17
- package/package.json +7 -7
- package/src/element/assertion/signature.js +3 -3
- package/src/element/signature.js +44 -2
- package/src/process/instantiate.js +4 -0
- package/src/utilities/element.js +8 -19
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.913",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.47",
|
|
14
14
|
"necessary": "^17.1.7",
|
|
15
|
-
"occam-furtle": "^3.0.
|
|
16
|
-
"occam-grammars": "^1.3.
|
|
17
|
-
"occam-languages": "^0.0.
|
|
15
|
+
"occam-furtle": "^3.0.195",
|
|
16
|
+
"occam-grammars": "^1.3.524",
|
|
17
|
+
"occam-languages": "^0.0.199",
|
|
18
18
|
"occam-lexers": "^23.1.44",
|
|
19
|
-
"occam-model": "^1.0.
|
|
20
|
-
"occam-nominal": "^1.0.
|
|
19
|
+
"occam-model": "^1.0.506",
|
|
20
|
+
"occam-nominal": "^1.0.103",
|
|
21
21
|
"occam-parsers": "^23.1.50",
|
|
22
|
-
"occam-server": "^7.0.
|
|
22
|
+
"occam-server": "^7.0.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@swc/core": "1.13.20",
|
|
@@ -5,7 +5,7 @@ import Assertion from "../assertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateSignatureAssertion } from "../../process/instantiate";
|
|
8
|
-
import {
|
|
8
|
+
import { signatureFromSignatureAssertionNode, referenceFromSignatureAssertionNode, signatureAssertionFromStatementNode } from "../../utilities/element";
|
|
9
9
|
|
|
10
10
|
export default define(class SignatureAssertion extends Assertion {
|
|
11
11
|
constructor(context, string, node, lineIndex, signature, reference) {
|
|
@@ -201,8 +201,8 @@ export default define(class SignatureAssertion extends Assertion {
|
|
|
201
201
|
const { string, lineIndex } = json,
|
|
202
202
|
definedAssertionNode = instantiateSignatureAssertion(string, context),
|
|
203
203
|
node = definedAssertionNode, ///
|
|
204
|
-
signature =
|
|
205
|
-
reference =
|
|
204
|
+
signature = signatureFromSignatureAssertionNode(definedAssertionNode, context),
|
|
205
|
+
reference = referenceFromSignatureAssertionNode(definedAssertionNode, context);
|
|
206
206
|
|
|
207
207
|
context = null;
|
|
208
208
|
|
package/src/element/signature.js
CHANGED
|
@@ -5,8 +5,8 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { instantiateSignature } from "../process/instantiate";
|
|
8
|
-
import {
|
|
9
|
-
import { attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
8
|
+
import { signatureFromSignatureNode } from "../utilities/element";
|
|
9
|
+
import { attempt, reconcile, serialise, unserialise, instantiate, ablate } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
const { match, compare, correlate } = arrayUtilities;
|
|
12
12
|
|
|
@@ -41,6 +41,22 @@ export default define(class Signature extends Element {
|
|
|
41
41
|
return term;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
isEqualTo(signature) {
|
|
45
|
+
const signatureNode = signature.getNode(),
|
|
46
|
+
signatureNodeMatches = this.matchSignatureNode(signatureNode),
|
|
47
|
+
equalTo = signatureNodeMatches; ///
|
|
48
|
+
|
|
49
|
+
return equalTo;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
matchSignatureNode(signatureNode) {
|
|
53
|
+
const node = signatureNode, ///
|
|
54
|
+
nodeMatches = this.matchNode(node),
|
|
55
|
+
signatureNodeMatches = nodeMatches; ///
|
|
56
|
+
|
|
57
|
+
return signatureNodeMatches;
|
|
58
|
+
}
|
|
59
|
+
|
|
44
60
|
findValidSignature(context) {
|
|
45
61
|
const signatureNode = this.getSignatureNode(),
|
|
46
62
|
signature = context.findSignatureBySignatureNode(signatureNode),
|
|
@@ -299,4 +315,30 @@ export default define(class Signature extends Element {
|
|
|
299
315
|
|
|
300
316
|
return signature;
|
|
301
317
|
}
|
|
318
|
+
|
|
319
|
+
static fromSignatureString(signatureString, context) {
|
|
320
|
+
let signature;
|
|
321
|
+
|
|
322
|
+
ablate((context) => {
|
|
323
|
+
instantiate((context) => {
|
|
324
|
+
const string = signatureString, ///
|
|
325
|
+
signatureNode = instantiateSignature(string, context);
|
|
326
|
+
|
|
327
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
328
|
+
}, context);
|
|
329
|
+
}, context);
|
|
330
|
+
|
|
331
|
+
return signature;
|
|
332
|
+
}
|
|
302
333
|
});
|
|
334
|
+
|
|
335
|
+
function termsFromSignatureNode(signatureNode, context) {
|
|
336
|
+
const termNodes = signatureNode.getTermNodes(),
|
|
337
|
+
terms = termNodes.map((termNode) => {
|
|
338
|
+
const term = context.findTermByTermNode(termNode);
|
|
339
|
+
|
|
340
|
+
return term;
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
return terms;
|
|
344
|
+
}
|
|
@@ -14,6 +14,7 @@ import { TERM_RULE_NAME,
|
|
|
14
14
|
PARAMETER_RULE_NAME,
|
|
15
15
|
STATEMENT_RULE_NAME,
|
|
16
16
|
REFERENCE_RULE_NAME,
|
|
17
|
+
SIGNATURE_RULE_NAME,
|
|
17
18
|
COMBINATOR_RULE_NAME,
|
|
18
19
|
CONCLUSION_RULE_NAME,
|
|
19
20
|
HYPOTHESIS_RULE_NAME,
|
|
@@ -51,6 +52,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
|
51
52
|
parameterPlaceholderRule = ruleFromRuleName(PARAMETER_RULE_NAME),
|
|
52
53
|
statementPlaceholderRule = ruleFromRuleName(STATEMENT_RULE_NAME),
|
|
53
54
|
referencePlaceholderRule = ruleFromRuleName(REFERENCE_RULE_NAME),
|
|
55
|
+
signaturePlaceholderRule = ruleFromRuleName(SIGNATURE_RULE_NAME),
|
|
54
56
|
combinatorPlaceholderRule = ruleFromRuleName(COMBINATOR_RULE_NAME),
|
|
55
57
|
conclusionPlaceholderRule = ruleFromRuleName(CONCLUSION_RULE_NAME),
|
|
56
58
|
hypothesisPlaceholderRule = ruleFromRuleName(HYPOTHESIS_RULE_NAME),
|
|
@@ -125,6 +127,8 @@ export function instantiateStatement(string, context) { return instantiate(state
|
|
|
125
127
|
|
|
126
128
|
export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
|
|
127
129
|
|
|
130
|
+
export function instantiateSignature(string, context) { return instantiate(signaturePlaceholderRule, string, context); }
|
|
131
|
+
|
|
128
132
|
export function instantiateCombinator(string, context) { return instantiate(combinatorPlaceholderRule, string, context); }
|
|
129
133
|
|
|
130
134
|
export function instantiateHypothesis(string, context) { return instantiate(hypothesisPlaceholderRule, string, context); }
|
package/src/utilities/element.js
CHANGED
|
@@ -1763,7 +1763,10 @@ export function signatureFromTopLevelAssertionNode(topLevelAsssertionNode, conte
|
|
|
1763
1763
|
const signatureNode = topLevelAsssertionNode.getSignatureNode();
|
|
1764
1764
|
|
|
1765
1765
|
if (signatureNode !== null) {
|
|
1766
|
-
|
|
1766
|
+
const { Signature } = elements,
|
|
1767
|
+
signatureString = context.nodeAsString(signatureNode);
|
|
1768
|
+
|
|
1769
|
+
signature = Signature.fromSignatureString(signatureString, context);
|
|
1767
1770
|
}
|
|
1768
1771
|
|
|
1769
1772
|
return signature;
|
|
@@ -1862,8 +1865,10 @@ export function statementFromContainedAssertionNode(containedAssertionNode, cont
|
|
|
1862
1865
|
}
|
|
1863
1866
|
|
|
1864
1867
|
export function signatureFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1868
|
+
const { Signature } = elements,
|
|
1869
|
+
signatureNode = signatureAssertionNode.getSignatureNode(),
|
|
1870
|
+
signatureString = context.nodeAsString(signatureNode),
|
|
1871
|
+
signature = Signature.fromSignatureString(signatureString, context);
|
|
1867
1872
|
|
|
1868
1873
|
return signature;
|
|
1869
1874
|
}
|
|
@@ -1902,22 +1907,6 @@ export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, co
|
|
|
1902
1907
|
return statement;
|
|
1903
1908
|
}
|
|
1904
1909
|
|
|
1905
|
-
export function signatureFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1906
|
-
const signatureNode = sasisfiesAssertionNode.getSignatureNode(),
|
|
1907
|
-
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1908
|
-
|
|
1909
|
-
return signature;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
export function referenceFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1913
|
-
const { Reference } = elements,
|
|
1914
|
-
referenceNode = sasisfiesAssertionNode.getReferenceNode(),
|
|
1915
|
-
referenceString = context.nodeAsString(referenceNode),
|
|
1916
|
-
reference = Reference.fromReferenceString(referenceString, context);
|
|
1917
|
-
|
|
1918
|
-
return reference;
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
1910
|
export function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
1922
1911
|
const targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
|
|
1923
1912
|
targetFrame = frameFromFrameNode(targetFrameNode, context);
|