occam-furtle 2.0.340 → 3.0.1
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/example.js +6319 -2036
- package/lib/context/block.js +81 -41
- package/lib/context/file/furtle.js +260 -0
- package/lib/context/file/nominal.js +956 -0
- package/lib/context/file.js +146 -271
- package/lib/context/release.js +675 -0
- package/lib/context.js +210 -0
- package/lib/element/assignment/array.js +117 -15
- package/lib/element/assignment/object.js +119 -17
- package/lib/element/assignment/variable.js +121 -14
- package/lib/element/assignments/variable.js +120 -13
- package/lib/element/declaration/procedure.js +120 -12
- package/lib/element/error.js +118 -13
- package/lib/element/every.js +116 -13
- package/lib/element/expression.js +134 -68
- package/lib/element/label.js +119 -12
- package/lib/element/nodeQuery.js +120 -18
- package/lib/element/nodesQuery.js +120 -18
- package/lib/element/parameter/named.js +117 -15
- package/lib/element/parameter.js +116 -14
- package/lib/element/parameters/named.js +116 -14
- package/lib/element/parameters.js +115 -13
- package/lib/element/primitive.js +115 -63
- package/lib/element/procedure/anonymous.js +118 -16
- package/lib/element/procedure.js +118 -16
- package/lib/element/procedureCall.js +116 -14
- package/lib/element/reduce.js +116 -14
- package/lib/element/reference.js +119 -12
- package/lib/element/returnBlock.js +116 -14
- package/lib/element/some.js +117 -15
- package/lib/element/statement/return.js +120 -13
- package/lib/element/step.js +121 -14
- package/lib/element/term/bracketed.js +120 -13
- package/lib/element/term/comparison.js +117 -15
- package/lib/element/term/logical.js +119 -17
- package/lib/element/term/negated.js +119 -15
- package/lib/element/term.js +131 -45
- package/lib/element/terms.js +125 -14
- package/lib/element/ternary.js +118 -16
- package/lib/element/variable.js +127 -19
- package/lib/element.js +1 -8
- package/lib/index.js +9 -1
- package/lib/log.js +13 -12
- package/lib/metaTypeNames.js +26 -0
- package/lib/metaTypes.js +66 -0
- package/lib/node/expression.js +8 -15
- package/lib/nodeProperties.js +17 -21
- package/lib/nodeProperty.js +4 -7
- package/lib/utilities/context.js +8 -37
- package/lib/utilities/customGrammar.js +49 -0
- package/lib/utilities/element.js +110 -60
- package/lib/utilities/lineIndex.js +26 -0
- package/lib/utilities/primitive.js +14 -5
- package/lib/utilities/string.js +41 -37
- package/lib/utilities/term.js +14 -5
- package/lib/utilities/terms.js +7 -3
- package/package.json +2 -2
- package/src/context/block.js +20 -32
- package/src/context/file/furtle.js +141 -0
- package/src/context/file/nominal.js +946 -0
- package/src/context/file.js +32 -209
- package/src/context/release.js +653 -0
- package/src/context.js +74 -0
- package/src/element/assignment/array.js +8 -9
- package/src/element/assignment/object.js +12 -11
- package/src/element/assignment/variable.js +7 -8
- package/src/element/assignments/variable.js +7 -8
- package/src/element/declaration/procedure.js +6 -6
- package/src/element/error.js +4 -6
- package/src/element/every.js +5 -6
- package/src/element/expression.js +13 -33
- package/src/element/label.js +6 -7
- package/src/element/nodeQuery.js +12 -14
- package/src/element/nodesQuery.js +12 -14
- package/src/element/parameter/named.js +7 -8
- package/src/element/parameter.js +6 -8
- package/src/element/parameters/named.js +8 -9
- package/src/element/parameters.js +6 -8
- package/src/element/primitive.js +5 -57
- package/src/element/procedure/anonymous.js +7 -9
- package/src/element/procedure.js +6 -8
- package/src/element/procedureCall.js +6 -8
- package/src/element/reduce.js +5 -7
- package/src/element/reference.js +6 -7
- package/src/element/returnBlock.js +5 -7
- package/src/element/some.js +9 -9
- package/src/element/statement/return.js +7 -8
- package/src/element/step.js +6 -7
- package/src/element/term/bracketed.js +7 -8
- package/src/element/term/comparison.js +6 -8
- package/src/element/term/logical.js +12 -12
- package/src/element/term/negated.js +11 -9
- package/src/element/term.js +16 -17
- package/src/element/terms.js +16 -9
- package/src/element/ternary.js +8 -9
- package/src/element/variable.js +24 -14
- package/src/element.js +0 -8
- package/src/index.js +2 -0
- package/src/log.js +11 -11
- package/src/metaTypeNames.js +5 -0
- package/src/metaTypes.js +71 -0
- package/src/node/expression.js +9 -17
- package/src/nodeProperties.js +23 -32
- package/src/nodeProperty.js +5 -10
- package/src/utilities/context.js +7 -45
- package/src/utilities/customGrammar.js +40 -0
- package/src/utilities/element.js +181 -94
- package/src/utilities/lineIndex.js +21 -0
- package/src/utilities/primitive.js +22 -5
- package/src/utilities/string.js +42 -36
- package/src/utilities/term.js +22 -5
- package/src/utilities/terms.js +12 -4
- package/test/helpers/furtle.js +1 -1
- package/test/helpers/nominal.js +2 -3
- package/test/main.js +4 -3
- package/test/context/file.js +0 -127
- package/test/context/release.js +0 -151
- package/test/helpers/constants.js +0 -17
package/src/utilities/string.js
CHANGED
|
@@ -33,6 +33,20 @@ export function primtiveStringFromNodes(nodes, context) {
|
|
|
33
33
|
return primtiveString;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export function termStringFromProperties(properties) {
|
|
37
|
+
let termString;
|
|
38
|
+
|
|
39
|
+
properties.forEach((property) => {
|
|
40
|
+
if (property !== null) {
|
|
41
|
+
const propertyString = property.getString();
|
|
42
|
+
|
|
43
|
+
termString = propertyString; ///
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return termString;
|
|
48
|
+
}
|
|
49
|
+
|
|
36
50
|
export function primtiveStringFromBoolean(boolean) {
|
|
37
51
|
const expresssionString = `${boolean}`;
|
|
38
52
|
|
|
@@ -53,6 +67,20 @@ export function termsStringFromTermsArray(termsArray) {
|
|
|
53
67
|
return termsString;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
export function expressionStringFromProperties(properties) {
|
|
71
|
+
let expressionString;
|
|
72
|
+
|
|
73
|
+
properties.forEach((property) => {
|
|
74
|
+
if (property !== null) {
|
|
75
|
+
const propertyString = property.getString();
|
|
76
|
+
|
|
77
|
+
expressionString = propertyString; ///
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return expressionString;
|
|
82
|
+
}
|
|
83
|
+
|
|
56
84
|
export function primtiveStringFromStringLiteral(stringLiteral) {
|
|
57
85
|
const string = stringFromStringLiteral(stringLiteral),
|
|
58
86
|
primtiveString = string; ///
|
|
@@ -60,26 +88,12 @@ export function primtiveStringFromStringLiteral(stringLiteral) {
|
|
|
60
88
|
return primtiveString;
|
|
61
89
|
}
|
|
62
90
|
|
|
63
|
-
export function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
///
|
|
68
|
-
} else if (primitive !== null) {
|
|
69
|
-
const primitiveString = primitive.getString();
|
|
70
|
-
|
|
71
|
-
termString = primitiveString; ///
|
|
72
|
-
} else {
|
|
73
|
-
properties.forEach((property) => {
|
|
74
|
-
if (property !== null) {
|
|
75
|
-
const propertyString = property.getString();
|
|
76
|
-
|
|
77
|
-
termString = propertyString; ///
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
91
|
+
export function nodePropertyStringFromNameAndType(name, type) {
|
|
92
|
+
const typeString = type, ///
|
|
93
|
+
nameString = name, ///
|
|
94
|
+
nodePropertyString = `${typeString} ${nameString}`;
|
|
81
95
|
|
|
82
|
-
return
|
|
96
|
+
return nodePropertyString;
|
|
83
97
|
}
|
|
84
98
|
|
|
85
99
|
export function procedureDeclarationStringFromProcedure(procedure) {
|
|
@@ -102,26 +116,18 @@ export function returnBlockStringFromReturnStatementNode(returnStatement) {
|
|
|
102
116
|
return returnBlockString;
|
|
103
117
|
}
|
|
104
118
|
|
|
105
|
-
export function
|
|
106
|
-
|
|
119
|
+
export function nodePropertiesStringFromNodePropertiesArray(nodePropertiesArray) {
|
|
120
|
+
const nodePropertiesString = nodePropertiesArray.reduce((nodePropertiesString, nodeProperty) => {
|
|
121
|
+
const nodePropertyString = nodeProperty.getString();
|
|
107
122
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const primitiveString = primitive.getString();
|
|
123
|
+
nodePropertiesString = (nodePropertiesString === null) ?
|
|
124
|
+
nodePropertyString :
|
|
125
|
+
`${nodePropertiesString}, ${nodePropertyString}`;
|
|
112
126
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
properties.forEach((property) => {
|
|
116
|
-
if (property !== null) {
|
|
117
|
-
const propertyString = property.getString();
|
|
127
|
+
return nodePropertiesString;
|
|
128
|
+
}, null);
|
|
118
129
|
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return expressionString;
|
|
130
|
+
return nodePropertiesString;
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
export function variableAssignmentStringFromTypeAndVariable(type, variable) {
|
package/src/utilities/term.js
CHANGED
|
@@ -8,8 +8,13 @@ export function termFromNode(node, context) {
|
|
|
8
8
|
const { Term } = elements,
|
|
9
9
|
variable = null,
|
|
10
10
|
primitive = primitiveFromNode(node, context),
|
|
11
|
-
string = primitive.getString()
|
|
12
|
-
|
|
11
|
+
string = primitive.getString();
|
|
12
|
+
|
|
13
|
+
node = null;
|
|
14
|
+
|
|
15
|
+
context = null;
|
|
16
|
+
|
|
17
|
+
const term = new Term(context, string, node, variable, primitive);
|
|
13
18
|
|
|
14
19
|
return term;
|
|
15
20
|
}
|
|
@@ -19,7 +24,11 @@ export function termFromNodes(nodes, context) {
|
|
|
19
24
|
variable = null,
|
|
20
25
|
primitive = primitiveFromNodes(nodes, context),
|
|
21
26
|
string = primitive.getString(),
|
|
22
|
-
|
|
27
|
+
node = null;
|
|
28
|
+
|
|
29
|
+
context = null;
|
|
30
|
+
|
|
31
|
+
const term = new Term(context, string, node, variable, primitive);
|
|
23
32
|
|
|
24
33
|
return term;
|
|
25
34
|
}
|
|
@@ -29,7 +38,11 @@ export function termFromBoolean(boolean, context) {
|
|
|
29
38
|
variable = null,
|
|
30
39
|
primitive = primitiveFromBoolean(boolean, context),
|
|
31
40
|
string = primitive.getString(),
|
|
32
|
-
|
|
41
|
+
node = null;
|
|
42
|
+
|
|
43
|
+
context = null;
|
|
44
|
+
|
|
45
|
+
const term = new Term(context, string, node, variable, primitive);
|
|
33
46
|
|
|
34
47
|
return term;
|
|
35
48
|
}
|
|
@@ -39,7 +52,11 @@ export function termFromStringLiteral(stringLiteral, context) {
|
|
|
39
52
|
variable = null,
|
|
40
53
|
primitive = primitiveFromStringLiteral(stringLiteral, context),
|
|
41
54
|
string = primitive.getString(),
|
|
42
|
-
|
|
55
|
+
node = null;
|
|
56
|
+
|
|
57
|
+
context = null;
|
|
58
|
+
|
|
59
|
+
const term = new Term(context, string, node, variable, primitive);
|
|
43
60
|
|
|
44
61
|
return term;
|
|
45
62
|
}
|
package/src/utilities/terms.js
CHANGED
|
@@ -10,8 +10,12 @@ export function termsFromNodes(nodes, context) {
|
|
|
10
10
|
termsArray = termsArrayFromNodes(nodes, context),
|
|
11
11
|
termsString = termsStringFromTermsArray(termsArray),
|
|
12
12
|
string = termsString, ///
|
|
13
|
-
array = termsArray,
|
|
14
|
-
|
|
13
|
+
array = termsArray, ///
|
|
14
|
+
node = null;
|
|
15
|
+
|
|
16
|
+
context = null;
|
|
17
|
+
|
|
18
|
+
const terms = new Terms(context, string, node, array);
|
|
15
19
|
|
|
16
20
|
return terms;
|
|
17
21
|
}
|
|
@@ -23,8 +27,12 @@ export function termsFromExpression(term, context) {
|
|
|
23
27
|
],
|
|
24
28
|
termsString = termsStringFromTermsArray(termsArray),
|
|
25
29
|
string = termsString, ///
|
|
26
|
-
array = termsArray,
|
|
27
|
-
|
|
30
|
+
array = termsArray, ///
|
|
31
|
+
node = null;
|
|
32
|
+
|
|
33
|
+
context = null;
|
|
34
|
+
|
|
35
|
+
const terms = new Primitives(context, string, node, array);
|
|
28
36
|
|
|
29
37
|
return terms;
|
|
30
38
|
}
|
package/test/helpers/furtle.js
CHANGED
package/test/helpers/nominal.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { NominalFileContext } = require("../../lib/index"); ///
|
|
3
4
|
const { lexersUtilities, parsersUtilities } = require("occam-custom-grammars");
|
|
4
5
|
|
|
5
|
-
const FileContext = require("../context/file");
|
|
6
|
-
|
|
7
6
|
const { combinedCustomGrammarFromNothing } = require("../helpers/grammar");
|
|
8
7
|
|
|
9
8
|
const { nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
@@ -21,7 +20,7 @@ function nominalFileContextFromReleaseContext(releaseContext) {
|
|
|
21
20
|
node = parser.parse(tokens),
|
|
22
21
|
context = releaseContext, ///
|
|
23
22
|
filePath = "lemmas.nml",
|
|
24
|
-
fileContext =
|
|
23
|
+
fileContext = NominalFileContext.fromFilePathNodeAndTokens(filePath, tokens, node, context),
|
|
25
24
|
nominalFileContext = fileContext; ///
|
|
26
25
|
|
|
27
26
|
return nominalFileContext;
|
package/test/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const ReleaseContext = require("
|
|
3
|
+
const { ReleaseContext } = require("../lib/index"); ///
|
|
4
4
|
|
|
5
5
|
const { termsFromFileContext } = require("./helpers/terms"),
|
|
6
6
|
{ furtleFileFromNothing } = require("./helpers/furtle"),
|
|
@@ -31,8 +31,9 @@ const free = true,
|
|
|
31
31
|
|
|
32
32
|
// try {
|
|
33
33
|
const context = fileContext, ///
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
term = procedure.call(terms, context),
|
|
35
|
+
primitiveValue = term.getPrimitiveValue(),
|
|
36
|
+
boolean = primitiveValue; ///
|
|
36
37
|
|
|
37
38
|
console.log(boolean);
|
|
38
39
|
// } catch (exception) {
|
package/test/context/file.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { nodeUtilities, contextUtilities } = require("../../lib/index");
|
|
4
|
-
|
|
5
|
-
const { nodeAsString, nodesAsString } = nodeUtilities,
|
|
6
|
-
{ chainContext, lineIndexFromNodeAndTokens } = contextUtilities;
|
|
7
|
-
|
|
8
|
-
class FileContext {
|
|
9
|
-
constructor(context, filePath, lineIndex, node, tokens) {
|
|
10
|
-
this.context = context;
|
|
11
|
-
this.filePath = filePath;
|
|
12
|
-
this.lineIndex = lineIndex;
|
|
13
|
-
this.node = node;
|
|
14
|
-
this.tokens = tokens;
|
|
15
|
-
|
|
16
|
-
return chainContext(this);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getContext() {
|
|
20
|
-
return this.context;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getFilePath() {
|
|
24
|
-
return this.filePath;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getLineIndex() {
|
|
28
|
-
return this.lineIndex;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getNode() {
|
|
32
|
-
return this.node;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getTokens() {
|
|
36
|
-
return this.tokens;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getVariables() {
|
|
40
|
-
const variables = [];
|
|
41
|
-
|
|
42
|
-
return variables;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getProcedures() {
|
|
46
|
-
const procedures = [];
|
|
47
|
-
|
|
48
|
-
return procedures;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
nodeAsString(node) {
|
|
52
|
-
const string = nodeAsString(node, this.tokens);
|
|
53
|
-
|
|
54
|
-
return string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
nodesAsString(nodes) {
|
|
58
|
-
const string = nodesAsString(nodes, this.tokens);
|
|
59
|
-
|
|
60
|
-
return string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
trace(message, node = null) {
|
|
64
|
-
const level = TRACE_LEVEL;
|
|
65
|
-
|
|
66
|
-
this.writeToLog(level, message, node);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
debug(message, node = null) {
|
|
70
|
-
const level = DEBUG_LEVEL;
|
|
71
|
-
|
|
72
|
-
this.writeToLog(level, message, node);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
info(message, node = null) {
|
|
76
|
-
const level = INFO_LEVEL;
|
|
77
|
-
|
|
78
|
-
this.writeToLog(level, message, node);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
warning(message, node = null) {
|
|
82
|
-
const level = WARNING_LEVEL;
|
|
83
|
-
|
|
84
|
-
this.writeToLog(level, message, node);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
error(message, node = null) {
|
|
88
|
-
const level = ERROR_LEVEL;
|
|
89
|
-
|
|
90
|
-
this.writeToLog(level, message, node);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
writeToLog(level, message, node) {
|
|
94
|
-
const lineIndex = lineIndexFromNodeAndTokens(node, this.tokens, this.lineIndex),
|
|
95
|
-
filePath = (lineIndex === null) ?
|
|
96
|
-
this.filePath :
|
|
97
|
-
null;
|
|
98
|
-
|
|
99
|
-
this.context.writeToLog(level, message, filePath, lineIndex);
|
|
100
|
-
|
|
101
|
-
this.lineIndex = lineIndex;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
getFileContext() {
|
|
105
|
-
const fileContext = this; ///
|
|
106
|
-
|
|
107
|
-
return fileContext;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
getDepth() {
|
|
111
|
-
let depth = this.context.getDepth();
|
|
112
|
-
|
|
113
|
-
depth++;
|
|
114
|
-
|
|
115
|
-
return depth;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static fromNodeTokensAndFilePath(node, tokens, filePath, context) {
|
|
119
|
-
const lineIndex = null,
|
|
120
|
-
fileContext = new FileContext(context, filePath, lineIndex, node, tokens);
|
|
121
|
-
|
|
122
|
-
return fileContext;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
module.exports = FileContext;
|
|
127
|
-
|
package/test/context/release.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { arrayUtilities } =require("necessary");
|
|
4
|
-
|
|
5
|
-
const { Log, FileContext } =require("../../lib/index"); ///
|
|
6
|
-
|
|
7
|
-
const { LEVELS } =require("../helpers/constants");
|
|
8
|
-
|
|
9
|
-
const { push } = arrayUtilities,
|
|
10
|
-
[ TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARNING_LEVEL, ERROR_LEVEL ] = LEVELS;
|
|
11
|
-
|
|
12
|
-
class ReleaseContext {
|
|
13
|
-
constructor(log, files, fileContexts) {
|
|
14
|
-
this.log = log;
|
|
15
|
-
this.files = files;
|
|
16
|
-
this.fileContexts = fileContexts;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getLog() {
|
|
20
|
-
return this.log;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getFiles() {
|
|
24
|
-
return this.files;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getFileContexts() {
|
|
28
|
-
return this.fileContexts;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
addFile(file) {
|
|
32
|
-
this.files.push(file);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
addFileContext(fileContext) {
|
|
36
|
-
this.fileContexts.push(fileContext);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getProcedures(includeDependencies = true) {
|
|
40
|
-
const procedures = [];
|
|
41
|
-
|
|
42
|
-
this.fileContexts.forEach((fileContext) => {
|
|
43
|
-
const includeRelease = false,
|
|
44
|
-
fileContextProcedures = fileContext.getProcedures(includeRelease);
|
|
45
|
-
|
|
46
|
-
push(procedures, fileContextProcedures);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return procedures;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
findFile(filePath) {
|
|
53
|
-
const file = this.files.find((file) => {
|
|
54
|
-
const filePathMatches = file.matchFilePath(filePath);
|
|
55
|
-
|
|
56
|
-
if (filePathMatches) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
}) || null;
|
|
60
|
-
|
|
61
|
-
return file;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
findProcedureByName(name) {
|
|
65
|
-
const procedures = this.getProcedures(),
|
|
66
|
-
procedure = procedures.find((procedure) => {
|
|
67
|
-
const nameMatches = procedure.matchName(name);
|
|
68
|
-
|
|
69
|
-
if (nameMatches) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
}) || null;
|
|
73
|
-
|
|
74
|
-
return procedure;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
isProcedurePresentByName(name) {
|
|
78
|
-
const procedure = this.findProcedureByName(name),
|
|
79
|
-
procedurePresent = (procedure !== null);
|
|
80
|
-
|
|
81
|
-
return procedurePresent;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
trace(message, filePath = null, lineIndex = null) {
|
|
85
|
-
const level = TRACE_LEVEL;
|
|
86
|
-
|
|
87
|
-
this.writeToLog(level, message, filePath, lineIndex);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
debug(message, filePath = null, lineIndex = null) {
|
|
91
|
-
const level = DEBUG_LEVEL
|
|
92
|
-
|
|
93
|
-
this.writeToLog(level, message, filePath, lineIndex);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
info(message, filePath = null, lineIndex = null) {
|
|
97
|
-
const level = INFO_LEVEL;
|
|
98
|
-
|
|
99
|
-
this.writeToLog(level, message, filePath, lineIndex);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
warning(message, filePath = null, lineIndex = null) {
|
|
103
|
-
const level = WARNING_LEVEL;
|
|
104
|
-
|
|
105
|
-
this.writeToLog(level, message, filePath, lineIndex);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
error(message, filePath = null, lineIndex = null) {
|
|
109
|
-
const level = ERROR_LEVEL;
|
|
110
|
-
|
|
111
|
-
this.writeToLog(level, message, filePath, lineIndex);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
writeToLog(level, message, filePath, lineIndex) {
|
|
115
|
-
this.log.write(level, message, filePath, lineIndex);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
getFileContext() {
|
|
119
|
-
const fileContext = null;
|
|
120
|
-
|
|
121
|
-
return fileContext;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
getDepth() {
|
|
125
|
-
const depth = -1;
|
|
126
|
-
|
|
127
|
-
return depth;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
verify() {
|
|
131
|
-
this.files.forEach((file) => {
|
|
132
|
-
const context = this, ///
|
|
133
|
-
fileContext = FileContext.fromFile(file, context);
|
|
134
|
-
|
|
135
|
-
fileContext.verify();
|
|
136
|
-
|
|
137
|
-
this.fileContexts.push(fileContext);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
static fromNothing() {
|
|
142
|
-
const log = Log.fromNothing(),
|
|
143
|
-
files = [],
|
|
144
|
-
fileContexts = [],
|
|
145
|
-
releaseContext = new ReleaseContext(log, files, fileContexts);
|
|
146
|
-
|
|
147
|
-
return releaseContext;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
module.exports = ReleaseContext;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { levels } = require("necessary");
|
|
4
|
-
|
|
5
|
-
const { TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARNING_LEVEL, ERROR_LEVEL } = levels;
|
|
6
|
-
|
|
7
|
-
const LEVELS = [
|
|
8
|
-
TRACE_LEVEL,
|
|
9
|
-
DEBUG_LEVEL,
|
|
10
|
-
INFO_LEVEL,
|
|
11
|
-
WARNING_LEVEL,
|
|
12
|
-
ERROR_LEVEL
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
LEVELS
|
|
17
|
-
};
|