occam-verify-cli 0.0.334 → 0.0.335
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/bin/main.js +4 -3
- package/lib/axiom.js +13 -5
- package/lib/combinator.js +10 -1
- package/lib/conclusion.js +11 -1
- package/lib/constructor.js +11 -1
- package/lib/context/file.js +14 -12
- package/lib/context/release.js +5 -4
- package/lib/label.js +8 -1
- package/lib/premise.js +11 -1
- package/lib/rule.js +17 -10
- package/lib/type.js +11 -1
- package/lib/utilities/tokens.js +10 -1
- package/lib/verify/files.js +9 -1
- package/package.json +2 -2
- package/src/axiom.js +27 -4
- package/src/combinator.js +10 -0
- package/src/conclusion.js +11 -0
- package/src/constructor.js +15 -0
- package/src/context/file.js +26 -9
- package/src/context/release.js +6 -2
- package/src/label.js +8 -1
- package/src/premise.js +11 -0
- package/src/rule.js +25 -9
- package/src/type.js +14 -0
- package/src/utilities/tokens.js +14 -0
- package/src/verify/files.js +13 -1
package/src/rule.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { prune } from "./utilities/array";
|
|
4
4
|
import { someSubArray } from "./utilities/array";
|
|
5
|
-
import {
|
|
5
|
+
import { lineIndexFromLabelsAndTokens } from "./utilities/tokens";
|
|
6
6
|
|
|
7
7
|
export default class Rule {
|
|
8
8
|
constructor(labels, premises, conclusion) {
|
|
@@ -61,14 +61,30 @@ export default class Rule {
|
|
|
61
61
|
return metastatementNatches;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
toJSON(tokens) {
|
|
65
|
+
const lineIndex = lineIndexFromLabelsAndTokens(this.labels, tokens),
|
|
66
|
+
labelsJSON = this.labels.map((label) => {
|
|
67
|
+
const labelJSON = label.toJSON();
|
|
68
|
+
|
|
69
|
+
return labelJSON;
|
|
70
|
+
}),
|
|
71
|
+
premisesJSON = this.premises.map((premise) => {
|
|
72
|
+
const premiseJSON = premise.toJSON();
|
|
73
|
+
|
|
74
|
+
return premiseJSON;
|
|
75
|
+
}),
|
|
76
|
+
conclusionJSON = this.conclusion.toJSON(),
|
|
77
|
+
labels = labelsJSON, ///
|
|
78
|
+
premises = premisesJSON, ///
|
|
79
|
+
conclusion = conclusionJSON, ///
|
|
80
|
+
json = {
|
|
81
|
+
lineIndex,
|
|
82
|
+
labels,
|
|
83
|
+
premises,
|
|
84
|
+
conclusion
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return json;
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
static fromLabelsPremisesAndConclusion(labels, premises, conclusion) {
|
package/src/type.js
CHANGED
|
@@ -101,6 +101,20 @@ export default class Type {
|
|
|
101
101
|
return string;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
toJSON() {
|
|
105
|
+
const superTypeJSON = (this.superType === null) ?
|
|
106
|
+
null :
|
|
107
|
+
this.superType.toJSON(),
|
|
108
|
+
name = this.name,
|
|
109
|
+
superType = superTypeJSON, ///
|
|
110
|
+
json = {
|
|
111
|
+
name,
|
|
112
|
+
superType
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return json;
|
|
116
|
+
}
|
|
117
|
+
|
|
104
118
|
static fromTypeName(typeName) {
|
|
105
119
|
const name = typeName, ///
|
|
106
120
|
superType = null,
|
package/src/utilities/tokens.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
const { first } = arrayUtilities;
|
|
6
|
+
|
|
7
|
+
export function lineIndexFromLabelsAndTokens(labels, tokens) {
|
|
8
|
+
const firstLabel = first(labels),
|
|
9
|
+
label = firstLabel, ///
|
|
10
|
+
node = label.getNode(),
|
|
11
|
+
leastLineIndex = leastLineIndexFromNodeAndTokens(node, tokens),
|
|
12
|
+
lineIndex = leastLineIndex; ///
|
|
13
|
+
|
|
14
|
+
return lineIndex;
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
export function leastLineIndexFromNodeAndTokens(node, tokens) {
|
|
4
18
|
let leastLineIndex = undefined; ///
|
|
5
19
|
|
package/src/verify/files.js
CHANGED
|
@@ -2,13 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyFile from "../verify/file";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { filePathUtilities } from "occam-file-system";
|
|
6
|
+
|
|
7
|
+
import { filter, leftDifference } from "../utilities/array";
|
|
8
|
+
|
|
9
|
+
const { isFilePathFlorenceFilePath } = filePathUtilities;
|
|
6
10
|
|
|
7
11
|
export default function verifyFiles(releaseContext) {
|
|
8
12
|
let filesVerified = false;
|
|
9
13
|
|
|
10
14
|
const filePaths = releaseContext.getFilePaths();
|
|
11
15
|
|
|
16
|
+
filter(filePaths, (filePath) => {
|
|
17
|
+
const filePathFlorenceFilePath = isFilePathFlorenceFilePath(filePath);
|
|
18
|
+
|
|
19
|
+
if (filePathFlorenceFilePath) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
12
24
|
for (;;) {
|
|
13
25
|
const filePathsLength = filePaths.length;
|
|
14
26
|
|