@eagleoutice/flowr 2.1.9 → 2.1.10
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/README.md +3 -0
- package/config.d.ts +21 -0
- package/config.js +19 -2
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.js +3 -2
- package/dataflow/environments/define.js +78 -0
- package/dataflow/environments/identifier.d.ts +11 -3
- package/dataflow/environments/resolve-by-name.d.ts +10 -5
- package/dataflow/environments/resolve-by-name.js +103 -5
- package/dataflow/graph/vertex.d.ts +56 -1
- package/dataflow/graph/vertex.js +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +141 -49
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +6 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +35 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +50 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +29 -1
- package/dataflow/internal/process/functions/call/common.js +15 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +3 -2
- package/documentation/print-interface-wiki.js +6 -1
- package/package.json +1 -1
- package/util/list-access.d.ts +48 -0
- package/util/list-access.js +115 -0
- package/util/version.js +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSingleIndex = resolveSingleIndex;
|
|
4
|
+
exports.filterIndices = filterIndices;
|
|
5
|
+
exports.constructNestedAccess = constructNestedAccess;
|
|
6
|
+
exports.addSubIndicesToLeafIndices = addSubIndicesToLeafIndices;
|
|
7
|
+
const resolve_by_name_1 = require("../dataflow/environments/resolve-by-name");
|
|
8
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
9
|
+
const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
10
|
+
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
11
|
+
/**
|
|
12
|
+
* Resolves {@link accessedArg} in the {@link environment} and filters its indices according to {@link accessArg}.
|
|
13
|
+
*
|
|
14
|
+
* @param accessedArg - The argument to resolve
|
|
15
|
+
* @param accessArg - The argument which is used to filter the indices
|
|
16
|
+
* @param environment - The environment in which {@link accessedArg} is resolved
|
|
17
|
+
* @returns The filtered {@link ContainerIndicesCollection} of the resolved {@link accessedArg}
|
|
18
|
+
*/
|
|
19
|
+
function resolveSingleIndex(accessedArg, accessArg, environment) {
|
|
20
|
+
const definitions = (0, resolve_by_name_1.resolveByName)(accessedArg.lexeme, environment);
|
|
21
|
+
const indicesCollection = definitions?.flatMap(def => def?.indicesCollection ?? []);
|
|
22
|
+
const accessedIndicesCollection = filterIndices(indicesCollection, accessArg);
|
|
23
|
+
return accessedIndicesCollection;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Filters the single indices of the {@link indicesCollection} according to the lexeme of the {@link accessArg}.
|
|
27
|
+
*
|
|
28
|
+
* @param indicesCollection - The {@link ContainerIndicesCollection} to filter
|
|
29
|
+
* @param accessArg - The argument which is used to filter {@link indicesCollection}
|
|
30
|
+
* @returns The filtered copy of {@link indicesCollection}
|
|
31
|
+
*/
|
|
32
|
+
function filterIndices(indicesCollection, accessArg) {
|
|
33
|
+
let accessedIndicesCollection = undefined;
|
|
34
|
+
for (const indices of indicesCollection ?? []) {
|
|
35
|
+
const filteredIndices = indices.indices.filter(index => accessArg.lexeme === index.lexeme);
|
|
36
|
+
if (filteredIndices.length == 0) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
accessedIndicesCollection ??= [];
|
|
40
|
+
accessedIndicesCollection.push({
|
|
41
|
+
indices: filteredIndices,
|
|
42
|
+
isContainer: indices.isContainer
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return accessedIndicesCollection;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Constructs the definition of a nested access.
|
|
49
|
+
*
|
|
50
|
+
* Example:
|
|
51
|
+
* ```r
|
|
52
|
+
* person$credentials$username
|
|
53
|
+
* ```
|
|
54
|
+
* would result in a list with the index `credentials`, which has the subIndex `username`.
|
|
55
|
+
*
|
|
56
|
+
* @param accessedArg - The top level argument that is accessed
|
|
57
|
+
* @param leafIndices - The index at the end of the nested access i.e. `c` in `a$b$c`.
|
|
58
|
+
* @returns The constructed nested access
|
|
59
|
+
*/
|
|
60
|
+
function constructNestedAccess(accessedArg, leafIndices) {
|
|
61
|
+
const accessed = accessedArg.accessed;
|
|
62
|
+
const accesses = accessedArg.access.filter(arg => arg !== r_function_call_1.EmptyArgument).map(arg => arg);
|
|
63
|
+
const indices = [];
|
|
64
|
+
for (const access of accesses) {
|
|
65
|
+
const newIndices = {
|
|
66
|
+
indices: [
|
|
67
|
+
{
|
|
68
|
+
lexeme: access.lexeme,
|
|
69
|
+
nodeId: access.info.id,
|
|
70
|
+
subIndices: [leafIndices],
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
isContainer: false,
|
|
74
|
+
};
|
|
75
|
+
if (accessed.type === type_1.RType.Access) {
|
|
76
|
+
const nestedIndices = constructNestedAccess(accessed, newIndices);
|
|
77
|
+
indices.push(...nestedIndices);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
indices.push(newIndices);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return indices;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Adds the passed list of {@link leafSubIndices} to the leaf (sub-)indices of {@link indicesCollection}.
|
|
87
|
+
*
|
|
88
|
+
* @param indicesCollection - Indices where to add the sub indices.
|
|
89
|
+
* @param leafSubIndices - Indices that are added to the leaf indices.
|
|
90
|
+
*/
|
|
91
|
+
function addSubIndicesToLeafIndices(indicesCollection, leafSubIndices) {
|
|
92
|
+
const result = [];
|
|
93
|
+
for (const indices of indicesCollection) {
|
|
94
|
+
const newIndices = [];
|
|
95
|
+
for (const index of indices.indices) {
|
|
96
|
+
let newSubIndices = [];
|
|
97
|
+
if ((0, vertex_1.isParentContainerIndex)(index)) {
|
|
98
|
+
newSubIndices = addSubIndicesToLeafIndices(index.subIndices, leafSubIndices);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
newSubIndices = leafSubIndices;
|
|
102
|
+
}
|
|
103
|
+
newIndices.push({
|
|
104
|
+
...index,
|
|
105
|
+
subIndices: newSubIndices,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
result.push({
|
|
109
|
+
...indices,
|
|
110
|
+
indices: newIndices,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=list-access.js.map
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.1.
|
|
6
|
+
const version = '2.1.10';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|