occam-verify-cli 0.0.334 → 0.0.336

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/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 { labelsAsString } from "./utilities/string";
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
- asString() {
65
- const string = labelsAsString(this.labels);
66
-
67
- return string;
68
- }
69
-
70
- asJSON(tokens) {
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,
@@ -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
 
@@ -2,13 +2,25 @@
2
2
 
3
3
  import verifyFile from "../verify/file";
4
4
 
5
- import { leftDifference } from "../utilities/array";
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