occam-model 1.0.484
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/.swcrc +5 -0
- package/README.md +78 -0
- package/lib/constants.js +34 -0
- package/lib/dependencies.js +114 -0
- package/lib/dependency.js +81 -0
- package/lib/directory.js +107 -0
- package/lib/entries.js +245 -0
- package/lib/file.js +162 -0
- package/lib/fileNames.js +49 -0
- package/lib/files.js +121 -0
- package/lib/index.js +83 -0
- package/lib/mixins/bnf.js +43 -0
- package/lib/mixins/entries.js +99 -0
- package/lib/mixins/files.js +46 -0
- package/lib/mixins/metaJSON.js +36 -0
- package/lib/mixins/vocabulary.js +43 -0
- package/lib/multiplers.js +26 -0
- package/lib/project.js +98 -0
- package/lib/projects.js +112 -0
- package/lib/propertyNames.js +26 -0
- package/lib/release.js +152 -0
- package/lib/releases.js +112 -0
- package/lib/shortenedVersion.js +105 -0
- package/lib/types.js +22 -0
- package/lib/utilities/content.js +42 -0
- package/lib/utilities/filePath.js +105 -0
- package/lib/utilities/files.js +99 -0
- package/lib/utilities/metaJSON.js +197 -0
- package/lib/utilities/name.js +18 -0
- package/lib/utilities/query.js +36 -0
- package/lib/utilities/validate.js +26 -0
- package/lib/utilities/version.js +71 -0
- package/lib/version.js +160 -0
- package/license.txt +48 -0
- package/package.json +34 -0
- package/src/constants.js +7 -0
- package/src/dependencies.js +65 -0
- package/src/dependency.js +43 -0
- package/src/directory.js +60 -0
- package/src/entries.js +206 -0
- package/src/file.js +113 -0
- package/src/fileNames.js +18 -0
- package/src/files.js +66 -0
- package/src/index.js +18 -0
- package/src/mixins/bnf.js +51 -0
- package/src/mixins/entries.js +69 -0
- package/src/mixins/files.js +61 -0
- package/src/mixins/metaJSON.js +44 -0
- package/src/mixins/vocabulary.js +51 -0
- package/src/multiplers.js +5 -0
- package/src/project.js +63 -0
- package/src/projects.js +54 -0
- package/src/propertyNames.js +5 -0
- package/src/release.js +151 -0
- package/src/releases.js +54 -0
- package/src/shortenedVersion.js +71 -0
- package/src/types.js +4 -0
- package/src/utilities/content.js +22 -0
- package/src/utilities/filePath.js +66 -0
- package/src/utilities/files.js +114 -0
- package/src/utilities/metaJSON.js +254 -0
- package/src/utilities/name.js +13 -0
- package/src/utilities/query.js +25 -0
- package/src/utilities/validate.js +5 -0
- package/src/utilities/version.js +70 -0
- package/src/version.js +123 -0
package/src/release.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import File from "./file";
|
|
4
|
+
import Entries from "./entries";
|
|
5
|
+
import entriesMixins from "./mixins/entries";
|
|
6
|
+
|
|
7
|
+
import { DOUBLE_SPACE } from "./constants";
|
|
8
|
+
import { isMetaJSONFileValid } from "./utilities/metaJSON";
|
|
9
|
+
import { isFilePathReleaseFilePath } from "./utilities/filePath";
|
|
10
|
+
import { readmeFileFromFiles, metaJSONFileFromFiles } from "./utilities/files";
|
|
11
|
+
|
|
12
|
+
class Release {
|
|
13
|
+
constructor(name, entries) {
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.entries = entries;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getName() {
|
|
19
|
+
return this.name;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getEntries() {
|
|
23
|
+
return this.entries;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
updateVersion(version) {
|
|
27
|
+
let repository = this.getRepository(),
|
|
28
|
+
dependencies = this.getDependencies();
|
|
29
|
+
|
|
30
|
+
const versionString = version.toString(),
|
|
31
|
+
repositoryJSON = repository, ///
|
|
32
|
+
dependenciesJSON = dependencies.toJSON();
|
|
33
|
+
|
|
34
|
+
version = versionString; ///
|
|
35
|
+
repository = repositoryJSON; ///
|
|
36
|
+
dependencies = dependenciesJSON; ///
|
|
37
|
+
|
|
38
|
+
const metaJSONFile = this.getMetaJSONFile(),
|
|
39
|
+
json = {
|
|
40
|
+
version,
|
|
41
|
+
repository,
|
|
42
|
+
dependencies
|
|
43
|
+
},
|
|
44
|
+
jsonString = JSON.stringify(json, null, DOUBLE_SPACE),
|
|
45
|
+
file = metaJSONFile, ///
|
|
46
|
+
content = jsonString; ///
|
|
47
|
+
|
|
48
|
+
file.setContent(content);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
toJSON() {
|
|
52
|
+
const entriesJSON = this.entries.toJSON(),
|
|
53
|
+
name = this.name,
|
|
54
|
+
entries = entriesJSON, ///
|
|
55
|
+
json = {
|
|
56
|
+
name,
|
|
57
|
+
entries
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return json;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static fromJSON(json) {
|
|
64
|
+
let { entries } = json;
|
|
65
|
+
|
|
66
|
+
const { name } = json,
|
|
67
|
+
entriesJSON = entries; ///
|
|
68
|
+
|
|
69
|
+
json = entriesJSON; ///
|
|
70
|
+
|
|
71
|
+
entries = Entries.fromJSON(json); ///
|
|
72
|
+
|
|
73
|
+
const release = new Release(name, entries);
|
|
74
|
+
|
|
75
|
+
return release;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static fromProject(project) {
|
|
79
|
+
let release = null,
|
|
80
|
+
entries = project.getEntries();
|
|
81
|
+
|
|
82
|
+
const entriesReleasable = areEntriesReleasable(entries);
|
|
83
|
+
|
|
84
|
+
if (entriesReleasable) {
|
|
85
|
+
const name = project.getName(),
|
|
86
|
+
releasedEntries = releaseEntriesFromEntries(entries);
|
|
87
|
+
|
|
88
|
+
entries = releasedEntries; ///
|
|
89
|
+
|
|
90
|
+
release = new Release(name, entries);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return release;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static fromNameAndEntries(name, entries) {
|
|
97
|
+
let release = null;
|
|
98
|
+
|
|
99
|
+
const entriesReleasable = areEntriesReleasable(entries);
|
|
100
|
+
|
|
101
|
+
if (entriesReleasable) {
|
|
102
|
+
release = new Release(name, entries);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return release;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Object.assign(Release.prototype, entriesMixins);
|
|
110
|
+
|
|
111
|
+
export default Release;
|
|
112
|
+
|
|
113
|
+
function releaseEntriesFromEntries(entries) {
|
|
114
|
+
const releasedEntries = Entries.fromNothing(), ///
|
|
115
|
+
files = entries.getFiles();
|
|
116
|
+
|
|
117
|
+
files.forEachFile((file) => {
|
|
118
|
+
const filePath = file.getPath(),
|
|
119
|
+
filePathReleaseFilePath = isFilePathReleaseFilePath(filePath);
|
|
120
|
+
|
|
121
|
+
if (filePathReleaseFilePath) {
|
|
122
|
+
const path = filePath, ///
|
|
123
|
+
content = file.getContent(),
|
|
124
|
+
released = true;
|
|
125
|
+
|
|
126
|
+
file = File.fromPathContentAndReleased(path, content, released); ///
|
|
127
|
+
|
|
128
|
+
releasedEntries.addFile(file);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return releasedEntries;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function areEntriesReleasable(entries) {
|
|
136
|
+
let entriesReleasable = false;
|
|
137
|
+
|
|
138
|
+
const files = entries.getFiles(),
|
|
139
|
+
readmeFile = readmeFileFromFiles(files),
|
|
140
|
+
metaJSONFile = metaJSONFileFromFiles(files);
|
|
141
|
+
|
|
142
|
+
if ((readmeFile !== null) && (metaJSONFile !== null)) {
|
|
143
|
+
const metaJSONFileValid = isMetaJSONFileValid(metaJSONFile);
|
|
144
|
+
|
|
145
|
+
if (metaJSONFileValid) {
|
|
146
|
+
entriesReleasable = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return entriesReleasable;
|
|
151
|
+
}
|
package/src/releases.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { asynchronousUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
import Release from "./release";
|
|
6
|
+
|
|
7
|
+
const { forEach } = asynchronousUtilities;
|
|
8
|
+
|
|
9
|
+
export default class Releases {
|
|
10
|
+
constructor(array) {
|
|
11
|
+
this.array = array;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getLength() { return this.array.length; }
|
|
15
|
+
|
|
16
|
+
addRelease(release) { this.array.push(release); }
|
|
17
|
+
|
|
18
|
+
mapRelease(callback) { return this.array.map(callback); }
|
|
19
|
+
|
|
20
|
+
reduceRelease(callback, initialValue) { return this.array.reduce(callback, initialValue); }
|
|
21
|
+
|
|
22
|
+
forEachRelease(callback) { this.array.forEach(callback); }
|
|
23
|
+
|
|
24
|
+
asynchronousForEachRelease(callback, done) { forEach(this.array, callback, done); }
|
|
25
|
+
|
|
26
|
+
toJSON() {
|
|
27
|
+
const json = this.array.map((release) => {
|
|
28
|
+
const releaseJSON = release.toJSON();
|
|
29
|
+
|
|
30
|
+
return releaseJSON;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return json;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static fromJSON(json) {
|
|
37
|
+
const array = json.map((json) => { ///
|
|
38
|
+
const release = Release.fromJSON(json);
|
|
39
|
+
|
|
40
|
+
return release;
|
|
41
|
+
}),
|
|
42
|
+
releases = new Releases(array);
|
|
43
|
+
|
|
44
|
+
return releases;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static fromNothing() {
|
|
48
|
+
const array = [],
|
|
49
|
+
releases = new Releases(array);
|
|
50
|
+
|
|
51
|
+
return releases;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { MAJOR_NUMBER_MULTIPLIER, MINOR_NUMBER_MULTIPLIER } from "./multiplers";
|
|
4
|
+
import { majorNumberFromNumber, minorNumberFromNumber, majorNumberFromString, minorNumberFromString } from "./utilities/version";
|
|
5
|
+
|
|
6
|
+
export default class ShortenedVersion {
|
|
7
|
+
constructor(majorNumber, minorNumber) {
|
|
8
|
+
this.majorNumber = majorNumber;
|
|
9
|
+
this.minorNumber = minorNumber;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getMajorNumber() {
|
|
13
|
+
return this.majorNumber;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getMinorNumber() {
|
|
17
|
+
return this.minorNumber;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
toString() {
|
|
21
|
+
const string = `${this.majorNumber}.${this.minorNumber}`;
|
|
22
|
+
|
|
23
|
+
return string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
toVersionNumber() {
|
|
27
|
+
const versionNumber = this.majorNumber * MAJOR_NUMBER_MULTIPLIER + this.minorNumber * MINOR_NUMBER_MULTIPLIER;
|
|
28
|
+
|
|
29
|
+
return versionNumber;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getLeastMatchingVersionNumber() {
|
|
33
|
+
const versionNumber = this.toVersionNumber(),
|
|
34
|
+
leastMatchingVersionNumber = versionNumber; ///
|
|
35
|
+
|
|
36
|
+
return leastMatchingVersionNumber;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getGreatestMatchingVersionNumber() {
|
|
40
|
+
const majorNumber = this.majorNumber + 1,
|
|
41
|
+
minorNumber = 0,
|
|
42
|
+
shortenedVersion = ShortenedVersion.fromMajorNumberAndMinorNumber(majorNumber, minorNumber),
|
|
43
|
+
shortenedVersionNumber = shortenedVersion.toVersionNumber(),
|
|
44
|
+
greatestMatchingVersionNumber = shortenedVersionNumber - 1;
|
|
45
|
+
|
|
46
|
+
return greatestMatchingVersionNumber;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static fromString(string) {
|
|
50
|
+
const majorNumber = majorNumberFromString(string),
|
|
51
|
+
minorNumber = minorNumberFromString(string),
|
|
52
|
+
shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
53
|
+
|
|
54
|
+
return shortenedVersion;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static fromVersionNumber(versionNumber) {
|
|
58
|
+
const number = versionNumber, ///
|
|
59
|
+
majorNumber = majorNumberFromNumber(number),
|
|
60
|
+
minorNumber = minorNumberFromNumber(number),
|
|
61
|
+
shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
62
|
+
|
|
63
|
+
return shortenedVersion;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static fromMajorNumberAndMinorNumber(majorNumber, minorNumber) {
|
|
67
|
+
const shortenedVersion = new ShortenedVersion(majorNumber, minorNumber);
|
|
68
|
+
|
|
69
|
+
return shortenedVersion;
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/types.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DOUBLE_SPACE, EMPTY_STRING, ESCAPED_AMPERSAND, ESCAPED_LESS_THAN, ESCAPED_GREATER_THAN } from "../constants";
|
|
4
|
+
|
|
5
|
+
export function sanitiseContent(content) {
|
|
6
|
+
const sanitisedContent = content
|
|
7
|
+
.replace(/&/g, ESCAPED_AMPERSAND)
|
|
8
|
+
.replace(/</g, ESCAPED_LESS_THAN)
|
|
9
|
+
.replace(/>/g, ESCAPED_GREATER_THAN);
|
|
10
|
+
|
|
11
|
+
return sanitisedContent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function trimDoubleQuotes(content) { return content.replace(/(^"|"$)/g, EMPTY_STRING); } ///
|
|
15
|
+
|
|
16
|
+
export function convertContentTabsToWhitespace(content) { return content.replace(/\t/g, DOUBLE_SPACE); } ///
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
sanitiseContent,
|
|
20
|
+
trimDoubleQuotes,
|
|
21
|
+
convertContentTabsToWhitespace
|
|
22
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const readmeFilePathPattern = "^(?:[^\\/]+\\/){1}README\\.md$",
|
|
4
|
+
furtleFilePathPattern = "^(?:[^\\/]+\\/){1,}[^\\.]+\\.ftl$",
|
|
5
|
+
nominalFilePathPattern = "^(?:[^\\/]+\\/){1,}[^\\.]+\\.nml$",
|
|
6
|
+
markdownFilePathPattern = "^(?:[^\\/]+\\/){1,}[^\\.]+\\.md$",
|
|
7
|
+
metaJSONFilePathPattern = "^(?:[^\\/]+\\/){1}meta\\.json$",
|
|
8
|
+
indexJSONFilePathPattern = "^(?:[^\\/]+\\/){1}index\\.json$",
|
|
9
|
+
markdownStyleFilePathPattern = "^(?:[^\\/]+\\/){1,}[^\\.]+\\.mds$",
|
|
10
|
+
customGrammarBNFFilePathPattern = "^(?:[^\\/]+\\/){1}(term|statement)\\.bnf$",
|
|
11
|
+
defaultMarkdownStyleFilePathPattern = "^[^\\/]+\\/default\\.mds$",
|
|
12
|
+
customGrammarVocabularyFilePathPattern = "^(?:[^\\/]+\\/){1}(type|symbol)\\.vcb$",
|
|
13
|
+
releaseFilePathPattern = `${readmeFilePathPattern}|${furtleFilePathPattern}|${nominalFilePathPattern}|${metaJSONFilePathPattern}|${customGrammarBNFFilePathPattern}|${customGrammarVocabularyFilePathPattern}`,
|
|
14
|
+
recognisedFilePathPattern = `${releaseFilePathPattern}|${indexJSONFilePathPattern}|${markdownFilePathPattern}|${markdownStyleFilePathPattern}`;
|
|
15
|
+
|
|
16
|
+
const readmeFilePathRegularExpression = new RegExp(readmeFilePathPattern),
|
|
17
|
+
furtleFilePathRegularExpression = new RegExp(furtleFilePathPattern),
|
|
18
|
+
releaseFilePathRegularExpression = new RegExp(releaseFilePathPattern),
|
|
19
|
+
nominalFilePathRegularExpression = new RegExp(nominalFilePathPattern),
|
|
20
|
+
markdownFilePathRegularExpression = new RegExp(markdownFilePathPattern),
|
|
21
|
+
metaJSONFilePathRegularExpression = new RegExp(metaJSONFilePathPattern),
|
|
22
|
+
indexJSONFilePathRegularExpression = new RegExp(indexJSONFilePathPattern),
|
|
23
|
+
recognisedFilePathRegularExpression = new RegExp(recognisedFilePathPattern),
|
|
24
|
+
markdownStyleFilePathRegularExpression = new RegExp(markdownStyleFilePathPattern),
|
|
25
|
+
customGrammarBNFFilePathRegularExpression = new RegExp(customGrammarBNFFilePathPattern),
|
|
26
|
+
defaultMarkdownStyleFilePathRegularExpression = new RegExp(defaultMarkdownStyleFilePathPattern),
|
|
27
|
+
customGrammarVocabularyFilePathRegularExpression = new RegExp(customGrammarVocabularyFilePathPattern);
|
|
28
|
+
|
|
29
|
+
export function isFilePathReadmeFilePath(filePath) { return readmeFilePathRegularExpression.test(filePath); }
|
|
30
|
+
|
|
31
|
+
export function isFilePathFurtleFilePath(filePath) { return furtleFilePathRegularExpression.test(filePath); }
|
|
32
|
+
|
|
33
|
+
export function isFilePathReleaseFilePath(filePath) { return releaseFilePathRegularExpression.test(filePath); }
|
|
34
|
+
|
|
35
|
+
export function isFilePathNominalFilePath(filePath) { return nominalFilePathRegularExpression.test(filePath); }
|
|
36
|
+
|
|
37
|
+
export function isFilePathMarkdownFilePath(filePath) { return markdownFilePathRegularExpression.test(filePath); }
|
|
38
|
+
|
|
39
|
+
export function isFilePathMetaJSONFilePath(filePath) { return metaJSONFilePathRegularExpression.test(filePath); }
|
|
40
|
+
|
|
41
|
+
export function isFilePathIndexJSONFilePath(filePath) { return indexJSONFilePathRegularExpression.test(filePath); }
|
|
42
|
+
|
|
43
|
+
export function isFilePathRecognisedFilePath(filePath) { return recognisedFilePathRegularExpression.test(filePath); }
|
|
44
|
+
|
|
45
|
+
export function isFilePathMarkdownStyleFilePath(filePath) { return markdownStyleFilePathRegularExpression.test(filePath); }
|
|
46
|
+
|
|
47
|
+
export function isFilePathCustomGrammarBNFFilePath(filePath) { return customGrammarBNFFilePathRegularExpression.test(filePath); }
|
|
48
|
+
|
|
49
|
+
export function isFilePathDefaultMarkdownStyleFilePath(filePath) { return defaultMarkdownStyleFilePathRegularExpression.test(filePath); }
|
|
50
|
+
|
|
51
|
+
export function isFilePathCustomGrammarVocabularyFilePath(filePath) { return customGrammarVocabularyFilePathRegularExpression.test(filePath); }
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
isFilePathReadmeFilePath,
|
|
55
|
+
isFilePathFurtleFilePath,
|
|
56
|
+
isFilePathReleaseFilePath,
|
|
57
|
+
isFilePathNominalFilePath,
|
|
58
|
+
isFilePathMarkdownFilePath,
|
|
59
|
+
isFilePathMetaJSONFilePath,
|
|
60
|
+
isFilePathIndexJSONFilePath,
|
|
61
|
+
isFilePathRecognisedFilePath,
|
|
62
|
+
isFilePathMarkdownStyleFilePath,
|
|
63
|
+
isFilePathCustomGrammarBNFFilePath,
|
|
64
|
+
isFilePathDefaultMarkdownStyleFilePath,
|
|
65
|
+
isFilePathCustomGrammarVocabularyFilePath
|
|
66
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { isFilePathReadmeFilePath,
|
|
4
|
+
isFilePathFurtleFilePath,
|
|
5
|
+
isFilePathNominalFilePath,
|
|
6
|
+
isFilePathMetaJSONFilePath,
|
|
7
|
+
isFilePathCustomGrammarBNFFilePath,
|
|
8
|
+
isFilePathCustomGrammarVocabularyFilePath } from "../utilities/filePath";
|
|
9
|
+
|
|
10
|
+
export function readmeFileFromFiles(files) {
|
|
11
|
+
let readmeFile = null;
|
|
12
|
+
|
|
13
|
+
files.someFile((file) => {
|
|
14
|
+
const filePath = file.getPath(),
|
|
15
|
+
filePathReadmeFilePath = isFilePathReadmeFilePath(filePath);
|
|
16
|
+
|
|
17
|
+
if (filePathReadmeFilePath) {
|
|
18
|
+
readmeFile = file; ///
|
|
19
|
+
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return readmeFile;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function furtleFilesFromFiles(files) {
|
|
28
|
+
const furtleFiles = files.reduceFile((furtleFiles, file) => {
|
|
29
|
+
const filePath = file.getPath(),
|
|
30
|
+
filePathFurtleFilePath = isFilePathFurtleFilePath(filePath),
|
|
31
|
+
fileFurtleFile = filePathFurtleFilePath; ///
|
|
32
|
+
|
|
33
|
+
if (fileFurtleFile) {
|
|
34
|
+
const furtleFile = file; ///
|
|
35
|
+
|
|
36
|
+
furtleFiles.push(furtleFile);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return furtleFiles;
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
return furtleFiles;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function nominalFilesFromFiles(files) {
|
|
46
|
+
const nominalFiles = files.reduceFile((nominalFiles, file) => {
|
|
47
|
+
const filePath = file.getPath(),
|
|
48
|
+
filePathNominalFilePath = isFilePathNominalFilePath(filePath),
|
|
49
|
+
fileNominalFile = filePathNominalFilePath; ///
|
|
50
|
+
|
|
51
|
+
if (fileNominalFile) {
|
|
52
|
+
const nominalFile = file; ///
|
|
53
|
+
|
|
54
|
+
nominalFiles.push(nominalFile);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return nominalFiles;
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
return nominalFiles;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function metaJSONFileFromFiles(files) {
|
|
64
|
+
let metaJSONFile = null;
|
|
65
|
+
|
|
66
|
+
files.someFile((file) => {
|
|
67
|
+
const filePath = file.getPath(),
|
|
68
|
+
filePathMetaJSONFilePath = isFilePathMetaJSONFilePath(filePath);
|
|
69
|
+
|
|
70
|
+
if (filePathMetaJSONFilePath) {
|
|
71
|
+
metaJSONFile = file; ///
|
|
72
|
+
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return metaJSONFile;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function customGrammarBNFFilesFromFiles(files) {
|
|
81
|
+
const customGrammarBNFFiles = files.reduceFile((customGrammarBNFFiles, file) => {
|
|
82
|
+
const filePath = file.getPath(),
|
|
83
|
+
filePathCustomGrammarBNFFilePath = isFilePathCustomGrammarBNFFilePath(filePath),
|
|
84
|
+
fileCustomGrammarBNFFile = filePathCustomGrammarBNFFilePath; ///
|
|
85
|
+
|
|
86
|
+
if (fileCustomGrammarBNFFile) {
|
|
87
|
+
const customGrammarBNFFile = file; ///
|
|
88
|
+
|
|
89
|
+
customGrammarBNFFiles.push(customGrammarBNFFile);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return customGrammarBNFFiles;
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
return customGrammarBNFFiles;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function customGrammarVocabularyFilesFromFiles(files) {
|
|
99
|
+
const customGrammarVocabularyFiles = files.reduceFile((customGrammarVocabularyFiles, file) => {
|
|
100
|
+
const filePath = file.getPath(),
|
|
101
|
+
filePathCustomGrammarVocabularyFilePath = isFilePathCustomGrammarVocabularyFilePath(filePath),
|
|
102
|
+
fileCustomGrammarVocabularyFile = filePathCustomGrammarVocabularyFilePath; ///
|
|
103
|
+
|
|
104
|
+
if (fileCustomGrammarVocabularyFile) {
|
|
105
|
+
const customGrammarVocabularyFile = file; ///
|
|
106
|
+
|
|
107
|
+
customGrammarVocabularyFiles.push(customGrammarVocabularyFile);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return customGrammarVocabularyFiles;
|
|
111
|
+
}, []);
|
|
112
|
+
|
|
113
|
+
return customGrammarVocabularyFiles;
|
|
114
|
+
}
|