@eagleoutice/flowr 2.15.5 → 2.15.8
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/config.js +1 -0
- package/dataflow/environments/default-builtin-config.d.ts +57 -0
- package/dataflow/environments/default-builtin-config.js +6 -2
- package/dataflow/environments/environment.d.ts +11 -19
- package/dataflow/environments/environment.js +17 -39
- package/dataflow/environments/frame-memory.d.ts +19 -73
- package/dataflow/environments/frame-memory.js +32 -207
- package/dataflow/environments/identifier.d.ts +5 -0
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/make-argument.js +17 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +12 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +5 -19
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/documentation/wiki-setup.js +28 -3
- package/package.json +1 -1
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/sigdb/decode.d.ts +5 -4
- package/project/sigdb/decode.js +13 -18
- package/project/sigdb/dict.d.ts +35 -0
- package/project/sigdb/dict.js +97 -0
- package/project/sigdb/hash.d.ts +7 -2
- package/project/sigdb/reader.d.ts +5 -4
- package/project/sigdb/reader.js +31 -24
- package/slicing/static/fingerprint.js +6 -12
- package/util/text/playground-link.d.ts +14 -5
- package/util/text/playground-link.js +32 -8
- package/util/version.js +2 -2
|
@@ -1,243 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* One environment frame's bindings, shared
|
|
4
|
-
*
|
|
5
|
-
* definitions retained memory in the square of them. The newest version is answered from a plain map, an older one
|
|
6
|
-
* from what the writes recorded.
|
|
3
|
+
* One environment frame's bindings, shared until something writes: the writer forks, so cloning is free and a
|
|
4
|
+
* definition pays for the copy.
|
|
7
5
|
* @module
|
|
8
6
|
*/
|
|
9
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.LazyBindings = exports.
|
|
8
|
+
exports.LazyBindings = exports.Frame = void 0;
|
|
11
9
|
const assert_1 = require("../../util/assert");
|
|
12
|
-
/**
|
|
13
|
-
function at(history, version) {
|
|
14
|
-
let low = 0;
|
|
15
|
-
let high = (history.length >> 1) - 1;
|
|
16
|
-
while (low <= high) {
|
|
17
|
-
const mid = (low + high) >> 1;
|
|
18
|
-
if (history[mid << 1] <= version) {
|
|
19
|
-
low = mid + 1;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
high = mid - 1;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return high < 0 ? -1 : (high << 1) + 1;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* One frame's bindings across its versions. A frame {@link Frame.of|taken from a map} is frozen: one state, never
|
|
29
|
-
* written, versioned only once {@link forWrite} forks it -- the built-in environment and the package layers.
|
|
30
|
-
*/
|
|
10
|
+
/** One frame's bindings. {@link Frame.of|Taken from a map} it is frozen, since the map is somebody else's. */
|
|
31
11
|
class Frame {
|
|
32
|
-
|
|
33
|
-
live;
|
|
34
|
-
/** whether {@link live} is this frame's own to write, see {@link Frame.of} */
|
|
12
|
+
bindings;
|
|
35
13
|
frozen;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/** when each name still on its first binding came in; a write-once name needs no more, and most are */
|
|
39
|
-
bornAt;
|
|
40
|
-
/** the last past version walked out into a map, so re-reading that snapshot skips the walk; one slot only */
|
|
41
|
-
walked;
|
|
42
|
-
/** the newest version written here, counting this frame's writes alone; only a snapshot at it may extend the frame */
|
|
43
|
-
version = 0;
|
|
44
|
-
constructor(live, frozen) {
|
|
45
|
-
this.live = live;
|
|
14
|
+
constructor(bindings, frozen) {
|
|
15
|
+
this.bindings = bindings;
|
|
46
16
|
this.frozen = frozen;
|
|
47
17
|
}
|
|
48
|
-
/** A frame
|
|
18
|
+
/** A frame over `map`, frozen, so a write forks rather than reaching back into it. */
|
|
49
19
|
static of(map) {
|
|
50
20
|
return new Frame(map, true);
|
|
51
21
|
}
|
|
52
|
-
/**
|
|
22
|
+
/** The empty frame, the same one every time, so an environment defining nothing allocates nothing. */
|
|
53
23
|
static empty() {
|
|
54
24
|
return EmptyFrame;
|
|
55
25
|
}
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
/** What `name` held at a version written past since. */
|
|
61
|
-
bound(name, version) {
|
|
62
|
-
const history = this.history?.get(name);
|
|
63
|
-
if (history !== undefined) {
|
|
64
|
-
const index = at(history, version);
|
|
65
|
-
return index < 0 ? undefined : history[index];
|
|
66
|
-
}
|
|
67
|
-
const born = this.bornAt?.get(name);
|
|
68
|
-
/* never rewritten, so it still holds what it held then -- unless it came in after then */
|
|
69
|
-
return born !== undefined && born > version ? undefined : this.live.get(name);
|
|
70
|
-
}
|
|
71
|
-
/** Whether `name` was bound at `version`. */
|
|
72
|
-
has(name, version) {
|
|
73
|
-
return (version === this.version ? this.live.get(name) : this.bound(name, version)) !== undefined;
|
|
74
|
-
}
|
|
75
|
-
/** The names `version` binds. */
|
|
76
|
-
keys(version) {
|
|
77
|
-
return (this.settledAt(version) ?? this.materialize(version)).keys();
|
|
78
|
-
}
|
|
79
|
-
/** What `version` binds, without the names. */
|
|
80
|
-
values(version) {
|
|
81
|
-
return (this.settledAt(version) ?? this.materialize(version)).values();
|
|
82
|
-
}
|
|
83
|
-
/** How many names `version` binds. */
|
|
84
|
-
size(version) {
|
|
85
|
-
return (this.settledAt(version) ?? this.materialize(version)).size;
|
|
86
|
-
}
|
|
87
|
-
/** What `version` binds, name by name. */
|
|
88
|
-
entries(version) {
|
|
89
|
-
return (this.settledAt(version) ?? this.materialize(version)).entries();
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* `version` as a map, `undefined` when it has to be walked out. A frame that never rewrote or took on a name has
|
|
93
|
-
* held the same bindings throughout, so {@link live} answers for any version of it.
|
|
94
|
-
*/
|
|
95
|
-
settledAt(version) {
|
|
96
|
-
if (version === this.version || (this.history === undefined && this.bornAt === undefined)) {
|
|
97
|
-
return this.live;
|
|
98
|
-
}
|
|
99
|
-
const walked = this.walked;
|
|
100
|
-
return walked !== undefined && walked.version === version ? walked.bindings : undefined;
|
|
101
|
-
}
|
|
102
|
-
/** `version` walked out into a map, kept in the {@link walked} slot. */
|
|
103
|
-
materialize(version) {
|
|
104
|
-
const bindings = new Map(this.recorded(version));
|
|
105
|
-
this.walked = { version, bindings };
|
|
106
|
-
return bindings;
|
|
107
|
-
}
|
|
108
|
-
/** What `version` bound; the rewritten names come first, since one dropped since is no longer in {@link live}. */
|
|
109
|
-
*recorded(version) {
|
|
110
|
-
const history = this.history;
|
|
111
|
-
if (history !== undefined) {
|
|
112
|
-
for (const name of history.keys()) {
|
|
113
|
-
const defs = this.bound(name, version);
|
|
114
|
-
if (defs !== undefined) {
|
|
115
|
-
yield [name, defs];
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
for (const [name, defs] of this.live) {
|
|
120
|
-
if (history?.has(name)) {
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
const born = this.bornAt?.get(name);
|
|
124
|
-
if (born === undefined || born <= version) {
|
|
125
|
-
yield [name, defs];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/** The frame a snapshot at `version` writes to: this one if it holds the newest version, a fork otherwise. */
|
|
130
|
-
forWrite(version) {
|
|
131
|
-
if (!this.frozen && version === this.version) {
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
return new Frame(new Map(this.settledAt(version) ?? this.materialize(version)), false);
|
|
26
|
+
/** A copy of these bindings that the caller owns. */
|
|
27
|
+
forWrite() {
|
|
28
|
+
return new Frame(new Map(this.bindings), false);
|
|
135
29
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return ++this.version;
|
|
140
|
-
}
|
|
141
|
-
/** Binds `name` at `version`, `undefined` removing it. Only the newest version may be written; snapshots hold the rest. */
|
|
142
|
-
set(name, defs, version) {
|
|
143
|
-
const live = this.live;
|
|
144
|
-
(0, assert_1.guard)(!this.frozen && version === this.version, () => `cannot write version ${version} of a frame standing at ${this.version}`);
|
|
145
|
-
const history = this.history?.get(name);
|
|
146
|
-
if (history !== undefined) {
|
|
147
|
-
if (history[history.length - 2] === version) {
|
|
148
|
-
history[history.length - 1] = defs;
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
history.push(version, defs);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
const before = live.get(name);
|
|
156
|
-
const born = this.bornAt?.get(name);
|
|
157
|
-
if (before === undefined && born === undefined) {
|
|
158
|
-
/* never held here, so when it came in is all an older snapshot needs */
|
|
159
|
-
(this.bornAt ??= new Map()).set(name, version);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
/* record what it is replacing before the write buries it */
|
|
163
|
-
this.bornAt?.delete(name);
|
|
164
|
-
(this.history ??= new Map()).set(name, [born ?? 0, before, version, defs]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (defs === undefined) {
|
|
168
|
-
live.delete(name);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
live.set(name, defs);
|
|
172
|
-
}
|
|
30
|
+
set(name, defs) {
|
|
31
|
+
(0, assert_1.guard)(!this.frozen, 'a frozen frame takes no writes, fork it with forWrite first');
|
|
32
|
+
this.bindings.set(name, defs);
|
|
173
33
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const EmptyFrame = Frame.of(new Map());
|
|
178
|
-
/** One environment's view of its {@link Frame}, as a {@link ReadonlyMap} so the old readers of the map still work. */
|
|
179
|
-
class MemoryView {
|
|
180
|
-
frame;
|
|
181
|
-
version;
|
|
182
|
-
constructor(frame, version) {
|
|
183
|
-
this.frame = frame;
|
|
184
|
-
this.version = version;
|
|
34
|
+
delete(name) {
|
|
35
|
+
(0, assert_1.guard)(!this.frozen, 'a frozen frame takes no writes, fork it with forWrite first');
|
|
36
|
+
this.bindings.delete(name);
|
|
185
37
|
}
|
|
186
38
|
get(name) {
|
|
187
|
-
return this.
|
|
39
|
+
return this.bindings.get(name);
|
|
188
40
|
}
|
|
189
41
|
has(name) {
|
|
190
|
-
return this.
|
|
42
|
+
return this.bindings.has(name);
|
|
191
43
|
}
|
|
192
44
|
get size() {
|
|
193
|
-
return this.
|
|
194
|
-
}
|
|
195
|
-
entries() {
|
|
196
|
-
return this.frame.entries(this.version);
|
|
197
|
-
}
|
|
198
|
-
[Symbol.iterator]() {
|
|
199
|
-
return this.frame.entries(this.version);
|
|
45
|
+
return this.bindings.size;
|
|
200
46
|
}
|
|
201
47
|
keys() {
|
|
202
|
-
return this.
|
|
48
|
+
return this.bindings.keys();
|
|
203
49
|
}
|
|
204
50
|
values() {
|
|
205
|
-
return this.
|
|
206
|
-
}
|
|
207
|
-
forEach(fn, thisArg) {
|
|
208
|
-
const settled = this.frame.settledAt(this.version);
|
|
209
|
-
if (settled !== undefined) {
|
|
210
|
-
settled.forEach(fn, thisArg);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
for (const [name, defs] of this.frame.entries(this.version)) {
|
|
214
|
-
fn.call(thisArg, defs, name, this);
|
|
215
|
-
}
|
|
51
|
+
return this.bindings.values();
|
|
216
52
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
/** The write end of a {@link Frame} at one version, standing in for the map writers used to get. */
|
|
220
|
-
class WritableMemory {
|
|
221
|
-
frame;
|
|
222
|
-
version;
|
|
223
|
-
constructor(frame, version) {
|
|
224
|
-
this.frame = frame;
|
|
225
|
-
this.version = version;
|
|
226
|
-
}
|
|
227
|
-
set(name, defs) {
|
|
228
|
-
this.frame.set(name, defs, this.version);
|
|
229
|
-
}
|
|
230
|
-
delete(name) {
|
|
231
|
-
this.frame.set(name, undefined, this.version);
|
|
53
|
+
entries() {
|
|
54
|
+
return this.bindings.entries();
|
|
232
55
|
}
|
|
233
|
-
|
|
234
|
-
return this.
|
|
56
|
+
[Symbol.iterator]() {
|
|
57
|
+
return this.bindings.entries();
|
|
235
58
|
}
|
|
236
|
-
|
|
237
|
-
|
|
59
|
+
forEach(fn, thisArg) {
|
|
60
|
+
this.bindings.forEach(fn, thisArg);
|
|
238
61
|
}
|
|
239
62
|
}
|
|
240
|
-
exports.
|
|
63
|
+
exports.Frame = Frame;
|
|
64
|
+
/** what every environment starts out on, until a write forks it one of its own */
|
|
65
|
+
const EmptyFrame = Frame.of(new Map());
|
|
241
66
|
/**
|
|
242
67
|
* The bindings of an attached package, built one name at a time. An attach used to materialize a definition per
|
|
243
68
|
* export, and a script attaching a handful of packages carries hundreds of thousands of them for the few dozen
|
|
@@ -176,6 +176,7 @@ export declare const enum PkgName {
|
|
|
176
176
|
Av = "av",
|
|
177
177
|
AwsS3 = "aws.s3",
|
|
178
178
|
Box = "box",
|
|
179
|
+
Brew = "brew",
|
|
179
180
|
Callr = "callr",
|
|
180
181
|
Car = "car",
|
|
181
182
|
Claddis = "Claddis",
|
|
@@ -269,6 +270,7 @@ export declare const enum PkgName {
|
|
|
269
270
|
RmethodsS3 = "R.methodsS3",
|
|
270
271
|
Rnetcdf = "RNetCDF",
|
|
271
272
|
Roo = "R.oo",
|
|
273
|
+
Rprintf = "rprintf",
|
|
272
274
|
RsConnect = "rsconnect",
|
|
273
275
|
Rstatix = "rstatix",
|
|
274
276
|
RstudioApi = "rstudioapi",
|
|
@@ -287,6 +289,7 @@ export declare const enum PkgName {
|
|
|
287
289
|
Sourcetools = "sourcetools",
|
|
288
290
|
Sqldf = "sqldf",
|
|
289
291
|
Stars = "stars",
|
|
292
|
+
Stringmagic = "stringmagic",
|
|
290
293
|
Stringr = "stringr",
|
|
291
294
|
SvDialogs = "svDialogs",
|
|
292
295
|
Svglite = "svglite",
|
|
@@ -304,7 +307,9 @@ export declare const enum PkgName {
|
|
|
304
307
|
UseThis = "usethis",
|
|
305
308
|
VisNetwork = "visNetwork",
|
|
306
309
|
Vroom = "vroom",
|
|
310
|
+
Whisker = "whisker",
|
|
307
311
|
Withr = "withr",
|
|
312
|
+
Wrapr = "wrapr",
|
|
308
313
|
Writexl = "writexl",
|
|
309
314
|
Xfun = "xfun",
|
|
310
315
|
XlConnect = "XLConnect",
|
|
@@ -10,4 +10,4 @@ export declare function toUnnamedArgument<OtherInfo>(node: RNode<OtherInfo & Par
|
|
|
10
10
|
/**
|
|
11
11
|
* Wraps the given nodes as unnamed arguments where necessary.
|
|
12
12
|
*/
|
|
13
|
-
export declare function wrapArgumentsUnnamed<OtherInfo>(nodes: readonly (RNode<OtherInfo & ParentInformation> | typeof EmptyArgument | undefined)[], idMap: AstIdMap<OtherInfo>): ("<>" | RArgument<OtherInfo & ParentInformation>)[];
|
|
13
|
+
export declare function wrapArgumentsUnnamed<OtherInfo>(nodes: readonly (RNode<OtherInfo & ParentInformation> | typeof EmptyArgument | undefined)[], idMap: AstIdMap<OtherInfo>): readonly ("<>" | RArgument<OtherInfo & ParentInformation>)[];
|
|
@@ -32,6 +32,22 @@ function toUnnamedArgument(node, idMap) {
|
|
|
32
32
|
* Wraps the given nodes as unnamed arguments where necessary.
|
|
33
33
|
*/
|
|
34
34
|
function wrapArgumentsUnnamed(nodes, idMap) {
|
|
35
|
-
|
|
35
|
+
let needsWrap = false;
|
|
36
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
37
|
+
const n = nodes[i];
|
|
38
|
+
if (!graph_1.FunctionArgument.isEmpty(n) && !r_argument_1.RArgument.is(n)) {
|
|
39
|
+
needsWrap = true;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!needsWrap) {
|
|
44
|
+
return nodes;
|
|
45
|
+
}
|
|
46
|
+
const result = new Array(nodes.length);
|
|
47
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
48
|
+
const n = nodes[i];
|
|
49
|
+
result[i] = graph_1.FunctionArgument.isEmpty(n) || r_argument_1.RArgument.is(n) ? n : toUnnamedArgument(n, idMap);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
36
52
|
}
|
|
37
53
|
//# sourceMappingURL=make-argument.js.map
|
|
@@ -34,6 +34,18 @@ function interpolationsOf(template, open, close, markup = false) {
|
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
const from = at + open.length;
|
|
37
|
+
if (close === '') {
|
|
38
|
+
/* no closing delimiter, as `rprintf` uses `$name`: the interpolation is just the identifier that follows */
|
|
39
|
+
const match = /^[A-Za-z._][A-Za-z0-9._]*/.exec(template.slice(from));
|
|
40
|
+
if (match) {
|
|
41
|
+
found.push(match[0]);
|
|
42
|
+
at = from + match[0].length;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
at = from;
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
37
49
|
let depth = 1, quote = undefined, i = from;
|
|
38
50
|
for (; i < template.length && depth > 0; i++) {
|
|
39
51
|
const c = template[i];
|
|
@@ -161,18 +161,11 @@ function* escapeTargetFrames(fdef) {
|
|
|
161
161
|
* dominated by the built-ins it holds, so filtering each frame once per pass saves the bulk of the work.
|
|
162
162
|
*/
|
|
163
163
|
function escapedDefinitions() {
|
|
164
|
-
/* keyed by frame and then by version: one frame answers differently at each, so the version has to be part of it */
|
|
165
164
|
const perFrame = new Map();
|
|
166
165
|
return (_id, fdef) => {
|
|
167
166
|
const defs = [];
|
|
168
167
|
for (const e of escapeTargetFrames(fdef)) {
|
|
169
|
-
|
|
170
|
-
let byVersion = perFrame.get(frame);
|
|
171
|
-
if (byVersion === undefined) {
|
|
172
|
-
byVersion = new Map();
|
|
173
|
-
perFrame.set(frame, byVersion);
|
|
174
|
-
}
|
|
175
|
-
let escaped = byVersion.get(version);
|
|
168
|
+
let escaped = perFrame.get(e.memory);
|
|
176
169
|
if (escaped === undefined) {
|
|
177
170
|
/* a package frame holds thousands of entries and keeps none of them, so this walks them in place
|
|
178
171
|
* rather than through a spread/flatMap/filter/map chain that allocates an array per step */
|
|
@@ -185,7 +178,7 @@ function escapedDefinitions() {
|
|
|
185
178
|
}
|
|
186
179
|
}
|
|
187
180
|
escaped = collected;
|
|
188
|
-
|
|
181
|
+
perFrame.set(e.memory, escaped);
|
|
189
182
|
}
|
|
190
183
|
for (const d of escaped) {
|
|
191
184
|
defs.push(d);
|
|
@@ -249,23 +242,16 @@ function propagateTransitivePackages(graph, environment, ctx) {
|
|
|
249
242
|
/** Maps each escaped definition's node id to its full (name-carrying) definition. */
|
|
250
243
|
function escapedDefinitionMap(graph) {
|
|
251
244
|
const map = new Map();
|
|
252
|
-
|
|
253
|
-
const seen = new Map();
|
|
245
|
+
const seen = new Set();
|
|
254
246
|
for (const [, vertex] of graph.vertices(true)) {
|
|
255
247
|
if (!vertex_1.FunctionDefinitionVertex.is(vertex)) {
|
|
256
248
|
continue;
|
|
257
249
|
}
|
|
258
250
|
for (const e of escapeTargetFrames(vertex)) {
|
|
259
|
-
|
|
260
|
-
let versions = seen.get(frame);
|
|
261
|
-
if (versions === undefined) {
|
|
262
|
-
versions = new Set();
|
|
263
|
-
seen.set(frame, versions);
|
|
264
|
-
}
|
|
265
|
-
else if (versions.has(version)) {
|
|
251
|
+
if (seen.has(e.memory)) {
|
|
266
252
|
continue; // a frame shared with an already-visited definition contributes the same entries
|
|
267
253
|
}
|
|
268
|
-
|
|
254
|
+
seen.add(e.memory);
|
|
269
255
|
for (const definitions of e.memory.values()) {
|
|
270
256
|
for (const def of definitions) {
|
|
271
257
|
if (!node_id_1.NodeId.isBuiltIn(def.nodeId) && def.name !== undefined) {
|
|
@@ -7,9 +7,9 @@ import type { Identifier } from '../../environments/identifier';
|
|
|
7
7
|
import { RBinaryOp } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op';
|
|
8
8
|
import { RPipe } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-pipe';
|
|
9
9
|
/**
|
|
10
|
-
* Helper function for {@link processNamedCall} using the given `
|
|
10
|
+
* Helper function for {@link processNamedCall} using the given `content` as the name of the function.
|
|
11
11
|
*/
|
|
12
|
-
export declare function processAsNamedCall<OtherInfo>({ info, lexeme, location }: RNode<OtherInfo & ParentInformation> & RAstNodeBase<OtherInfo> & Location, data: DataflowProcessorInformation<OtherInfo & ParentInformation>,
|
|
12
|
+
export declare function processAsNamedCall<OtherInfo>({ info, lexeme, location }: RNode<OtherInfo & ParentInformation> & RAstNodeBase<OtherInfo> & Location, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, content: Identifier, args: readonly (RNode<OtherInfo & ParentInformation> | typeof EmptyArgument | undefined)[]): DataflowInformation;
|
|
13
13
|
type RBinaryOpOrPipe<OtherInfo> = (RBinaryOp<OtherInfo & ParentInformation> | RPipe<OtherInfo & ParentInformation>) & RAstNodeBase<OtherInfo> & Location;
|
|
14
14
|
/** A named, infix-special call, e.g. magrittr's `lhs %>% rhs`: normalized as a {@link RType#FunctionCall}, not as {@link RType#BinaryOp}. */
|
|
15
15
|
type RInfixSpecialCall<OtherInfo> = RNamedFunctionCall<OtherInfo & ParentInformation>;
|
|
@@ -12,13 +12,13 @@ const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-bina
|
|
|
12
12
|
const r_pipe_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-pipe");
|
|
13
13
|
const assert_1 = require("../../../util/assert");
|
|
14
14
|
/**
|
|
15
|
-
* Helper function for {@link processNamedCall} using the given `
|
|
15
|
+
* Helper function for {@link processNamedCall} using the given `content` as the name of the function.
|
|
16
16
|
*/
|
|
17
|
-
function processAsNamedCall({ info, lexeme, location }, data,
|
|
17
|
+
function processAsNamedCall({ info, lexeme, location }, data, content, args) {
|
|
18
18
|
return (0, named_call_handling_1.processNamedCall)({
|
|
19
19
|
type: type_1.RType.Symbol,
|
|
20
20
|
info,
|
|
21
|
-
content
|
|
21
|
+
content,
|
|
22
22
|
lexeme,
|
|
23
23
|
location,
|
|
24
24
|
}, (0, make_argument_1.wrapArgumentsUnnamed)(args, data.completeAst.idMap), info.id, data);
|
|
@@ -4,6 +4,7 @@ exports.WikiSetup = void 0;
|
|
|
4
4
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
5
5
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
6
6
|
const node_version_1 = require("../util/node-version");
|
|
7
|
+
const doc_playground_1 = require("./doc-util/doc-playground");
|
|
7
8
|
/**
|
|
8
9
|
* https://github.com/flowr-analysis/flowr/wiki/Setup
|
|
9
10
|
*/
|
|
@@ -14,7 +15,8 @@ class WikiSetup extends doc_maker_1.DocMaker {
|
|
|
14
15
|
text({ ctx }) {
|
|
15
16
|
return `
|
|
16
17
|
There are several ways to use _flowR_.
|
|
17
|
-
|
|
18
|
+
Want to try it without installing anything? Run code straight away in the ${(0, doc_playground_1.linkToPlayground)('Playground', {})}, or search what _flowR_ knows about R packages in the [Signature Database](${doc_files_1.FlowrSiteBaseRef}/wiki/sigdb/).
|
|
19
|
+
Otherwise, you can download and build it from source, download the accompanying ${ctx.linkPage('flowr:docker', 'docker image')},
|
|
18
20
|
or use its ${ctx.linkPage('flowr:vscode', 'Visual Studio Code extension')} and ${ctx.linkPage('flowr:rstudio-addin', 'RStudio Addin')}.
|
|
19
21
|
|
|
20
22
|
- [🗒️ Using the Visual Studio Code Extension](#-using-the-visual-studio-code-extension)
|
|
@@ -24,7 +26,7 @@ or use its ${ctx.linkPage('flowr:vscode', 'Visual Studio Code extension')} and $
|
|
|
24
26
|
- [📜 Developing for _flowR_](#-developing-for-flowr)
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
If you want to develop for _flowR_, you want to see how to [build from scratch](#-building-from-scratch) and have a
|
|
29
|
+
If you want to develop for _flowR_, you want to see how to [build from scratch](#-building-from-scratch) and have a
|
|
28
30
|
look at the [Contributing Guidelines](${doc_files_1.RemoteFlowrFilePathBaseRef}.github/CONTRIBUTING.md).
|
|
29
31
|
|
|
30
32
|
## 🗒️ Using the Visual Studio Code Extension
|
|
@@ -111,7 +113,30 @@ For details on _how_ to contribute, please refer to the [CONTRIBUTING.md](${doc_
|
|
|
111
113
|
|
|
112
114
|
### 📦 The Signature Database
|
|
113
115
|
|
|
114
|
-
_flowR_
|
|
116
|
+
_flowR_ knows the exported functions of thousands of R packages, resolving \`library(pkg)\`/\`pkg::fn\` calls from a downloaded signature database (\`flowr-sigdb\`); no shards are committed (only the \`sigdb.remote.json\` pointer), everything else is fetched on demand. Search it live at [flowr-analysis.github.io/flowr/wiki/sigdb](${doc_files_1.FlowrSiteBaseRef}/wiki/sigdb/), try _flowR_ itself in the ${(0, doc_playground_1.linkToPlayground)('Playground', {})} without installing anything, or see the ${ctx.linkPage('wiki/Signature Database')} page for how the database works.
|
|
117
|
+
|
|
118
|
+
### 📦 Using _flowR_ as a Dependency in Another Project
|
|
119
|
+
|
|
120
|
+
_flowR_ is published as \`@eagleoutice/flowr\`, but you may want an unreleased branch or a local build instead. Plain \`npm install /path/to/flowr\` (or \`npm link\`) looks like it works, but skips resolving _flowR_'s own dependencies, so the bundled WASM parser fails at runtime with an \`ENOENT\` on \`tree-sitter.wasm\`. Package a tarball instead, which installs like any normal package:
|
|
121
|
+
|
|
122
|
+
\`\`\`shell
|
|
123
|
+
npm run build:dev
|
|
124
|
+
npm run pack-library
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
This produces \`eagleoutice-flowr-<version>.tgz\` in the repository root. Install it in your project:
|
|
128
|
+
|
|
129
|
+
\`\`\`shell
|
|
130
|
+
npm install /path/to/flowr/eagleoutice-flowr-<version>.tgz
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
You can also depend on a Git branch directly:
|
|
134
|
+
|
|
135
|
+
\`\`\`shell
|
|
136
|
+
npm install github:flowr-analysis/flowr#your-branch-name
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
npm clones the repository and runs its \`prepare\` script (\`build:dev\`) before installing it, so it arrives fully built with its own dependencies resolved. Some package managers (npm's own script-approval prompt included, plus pnpm and Yarn PnP) block install/lifecycle scripts by default; approve _flowR_'s if the install warns that they were skipped.
|
|
115
140
|
|
|
116
141
|
-----
|
|
117
142
|
<a id="note1" href="#note1ref"><1></a>: Currently, _flowR_ is only tested with R versions \`4.x\` and \`3.6.x\`.
|
package/package.json
CHANGED
|
@@ -219,9 +219,9 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
|
|
|
219
219
|
* Add a file to the context. If the file has a special role, it will be added to the corresponding list of special files.
|
|
220
220
|
* This method also applies any registered {@link FlowrAnalyzerFilePlugin}s to the file before adding it to the context.
|
|
221
221
|
*/
|
|
222
|
-
addFile(file: string | FlowrFileProvider | RParseRequestFromFile, roles?: readonly FileRole[]): FlowrFileProvider<{
|
|
222
|
+
addFile(file: string | FlowrFileProvider | RParseRequestFromFile | undefined, roles?: readonly FileRole[]): FlowrFileProvider<{
|
|
223
223
|
toString(): string;
|
|
224
|
-
}
|
|
224
|
+
}> | undefined;
|
|
225
225
|
hasCached(path: string): boolean;
|
|
226
226
|
hasFile(path: string): boolean;
|
|
227
227
|
exists(p: string, ignoreCase: boolean): string | undefined;
|
|
@@ -236,6 +236,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
|
|
|
236
236
|
* This method also applies any registered {@link FlowrAnalyzerFilePlugin}s to the file before adding it to the context.
|
|
237
237
|
*/
|
|
238
238
|
addFile(file, roles) {
|
|
239
|
+
if (file === undefined) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
239
242
|
const f = this.fileLoadPlugins(wrapFile(file, roles));
|
|
240
243
|
f.addOnInvalidate(c => {
|
|
241
244
|
this.context.analyzer?.receive(c);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* dependency records, and the {@link LibraryExports} export view. Pure -- no I/O, no mutation of inputs.
|
|
4
4
|
* Split out of `../sigdb` so the reader/writer there does not carry the per-record decoding.
|
|
5
5
|
*/
|
|
6
|
+
import type { SigDict } from './dict';
|
|
6
7
|
import { type DepType, type LibraryExports, type PkgBlob, type PkgBlobTuple, type SigClassInfo, type SigDbPkgMeta } from './schema';
|
|
7
8
|
import type { ArgProps } from '../../dataflow/environments/built-in-props';
|
|
8
9
|
/** the CRAN status of a version, used to build (or skip) its source-tarball link */
|
|
@@ -48,7 +49,7 @@ export interface DecodedFunction {
|
|
|
48
49
|
*/
|
|
49
50
|
export declare function transitiveCallees(functions: readonly DecodedFunction[], name: string): string[];
|
|
50
51
|
/** decode one of a blob's function records against the global string dictionary */
|
|
51
|
-
export declare function decodeFunction(strings:
|
|
52
|
+
export declare function decodeFunction(strings: SigDict, blob: Readonly<PkgBlob>, fnIdx: number): DecodedFunction;
|
|
52
53
|
/** a decoded package dependency of one version (`type` is the compact {@link DepType} enum; map to a label via {@link DepTypeNames}) */
|
|
53
54
|
export interface ResolvedDependency {
|
|
54
55
|
readonly name: string;
|
|
@@ -57,10 +58,10 @@ export interface ResolvedDependency {
|
|
|
57
58
|
readonly constraint?: string;
|
|
58
59
|
}
|
|
59
60
|
/** decode the declared dependencies of one blob version (empty when it declares none / the bundle omits them) */
|
|
60
|
-
export declare function decodeDependencies(strings:
|
|
61
|
+
export declare function decodeDependencies(strings: SigDict, blob: Readonly<PkgBlob>, ver: string): ResolvedDependency[];
|
|
61
62
|
/** the classes a package version declares, decoded from the blob's class pool */
|
|
62
|
-
export declare function decodeClasses(strings:
|
|
63
|
+
export declare function decodeClasses(strings: SigDict, blob: Readonly<PkgBlob>, ver: string): SigClassInfo[];
|
|
63
64
|
/** the function indices of a blob version (undoing the delta encoding) */
|
|
64
65
|
export declare function versionFnIndices(blob: Readonly<PkgBlob>, ver: string): number[] | undefined;
|
|
65
66
|
/** derive the {@link LibraryExports} export view of one package version from its blob + metadata */
|
|
66
|
-
export declare function deriveLibraryExports(strings:
|
|
67
|
+
export declare function deriveLibraryExports(strings: SigDict, blob: Readonly<PkgBlob>, meta: SigDbPkgMeta, pkg: string, version?: string, cranBase?: string): LibraryExports | undefined;
|