@eagleoutice/flowr 2.9.11 → 2.9.13
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 +31 -31
- package/benchmark/slicer.d.ts +4 -2
- package/benchmark/slicer.js +20 -6
- package/benchmark/stats/print.js +12 -0
- package/benchmark/stats/stats.d.ts +3 -2
- package/benchmark/stats/stats.js +1 -1
- package/benchmark/summarizer/data.d.ts +1 -0
- package/benchmark/summarizer/second-phase/process.js +5 -0
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +1 -0
- package/cli/benchmark-helper-app.d.ts +2 -1
- package/cli/benchmark-helper-app.js +6 -3
- package/cli/common/options.d.ts +8 -0
- package/cli/common/options.js +3 -1
- package/cli/common/scripts-info.d.ts +8 -0
- package/cli/export-quads-app.js +1 -1
- package/cli/flowr.js +3 -3
- package/cli/repl/core.d.ts +3 -3
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/script-core/statistics-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -2
- package/cli/script-core/statistics-helper-core.js +1 -1
- package/cli/slicer-app.js +2 -2
- package/cli/statistics-app.js +1 -1
- package/cli/statistics-helper-app.js +1 -1
- package/cli/wiki.js +2 -2
- package/config.d.ts +65 -24
- package/config.js +197 -161
- package/control-flow/extract-cfg.js +5 -8
- package/core/steps/pipeline-step.d.ts +2 -2
- package/dataflow/cluster.js +12 -8
- package/dataflow/eval/resolve/alias-tracking.js +12 -15
- package/dataflow/graph/graph.js +8 -8
- package/dataflow/graph/quads.js +4 -7
- package/dataflow/internal/linker.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -9
- package/documentation/doc-readme.js +2 -2
- package/documentation/wiki-analyzer.js +7 -5
- package/documentation/wiki-core.js +1 -3
- package/documentation/wiki-dataflow-graph.js +87 -32
- package/documentation/wiki-engine.js +18 -0
- package/documentation/wiki-interface.js +5 -3
- package/documentation/wiki-linter.js +5 -5
- package/documentation/wiki-mk/doc-context.d.ts +44 -11
- package/documentation/wiki-mk/doc-context.js +19 -17
- package/engines.d.ts +2 -2
- package/engines.js +4 -4
- package/linter/rules/dataframe-access-validation.js +5 -5
- package/linter/rules/naming-convention.d.ts +1 -1
- package/linter/rules/naming-convention.js +7 -3
- package/package.json +3 -1
- package/project/context/flowr-analyzer-context.d.ts +6 -6
- package/project/context/flowr-analyzer-context.js +2 -2
- package/project/context/flowr-analyzer-files-context.d.ts +2 -2
- package/project/context/flowr-analyzer-files-context.js +28 -8
- package/project/flowr-analyzer-builder.d.ts +10 -6
- package/project/flowr-analyzer-builder.js +12 -3
- package/project/flowr-analyzer.d.ts +3 -3
- package/queries/catalog/config-query/config-query-format.d.ts +5 -5
- package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +9 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
- package/queries/catalog/files-query/files-query-format.d.ts +3 -3
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +3 -3
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +3 -3
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/query.d.ts +18 -18
- package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -2
- package/r-bridge/lang-4.x/ast/model/model.js +13 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -2
- package/statistics/statistics.d.ts +2 -2
- package/util/mermaid/dfg.d.ts +8 -0
- package/util/mermaid/dfg.js +4 -0
- package/util/objects.d.ts +12 -0
- package/util/objects.js +28 -0
- package/util/quads.js +14 -6
- package/util/range.d.ts +3 -0
- package/util/range.js +3 -0
- package/util/summarizer.js +1 -1
- package/util/version.js +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ It offers a wide variety of features, for example:
|
|
|
24
24
|
|
|
25
25
|
```shell
|
|
26
26
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
27
|
-
flowR repl using flowR v2.9.
|
|
27
|
+
flowR repl using flowR v2.9.12, R grammar v14 (tree-sitter engine)
|
|
28
28
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ It offers a wide variety of features, for example:
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
```text
|
|
36
|
-
Query: linter (
|
|
36
|
+
Query: linter (3 ms)
|
|
37
37
|
╰ Deprecated Functions (deprecated-functions):
|
|
38
38
|
╰ Metadata: totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0
|
|
39
39
|
╰ File Path Validity (file-path-validity):
|
|
@@ -45,7 +45,7 @@ It offers a wide variety of features, for example:
|
|
|
45
45
|
╰ Absolute Paths (absolute-file-paths):
|
|
46
46
|
╰ certain:
|
|
47
47
|
╰ Path `/root/x.txt` at 1.1-23
|
|
48
|
-
╰ Metadata: totalConsidered: 1, totalUnknown: 0, searchTimeMs:
|
|
48
|
+
╰ Metadata: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0
|
|
49
49
|
╰ Unused Definitions (unused-definitions):
|
|
50
50
|
╰ Metadata: totalConsidered: 0, searchTimeMs: 0, processTimeMs: 0
|
|
51
51
|
╰ Naming Convention (naming-convention):
|
|
@@ -58,7 +58,7 @@ It offers a wide variety of features, for example:
|
|
|
58
58
|
╰ Metadata: consideredNodes: 5, searchTimeMs: 0, processTimeMs: 0
|
|
59
59
|
╰ Useless Loops (useless-loop):
|
|
60
60
|
╰ Metadata: numOfUselessLoops: 0, searchTimeMs: 0, processTimeMs: 0
|
|
61
|
-
All queries together required ≈
|
|
61
|
+
All queries together required ≈3 ms (1ms accuracy, total 3 ms)
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
|
|
@@ -80,15 +80,15 @@ It offers a wide variety of features, for example:
|
|
|
80
80
|
|
|
81
81
|
_Results (prettified and summarized):_
|
|
82
82
|
|
|
83
|
-
Query: **linter** (
|
|
83
|
+
Query: **linter** (2 ms)\
|
|
84
84
|
╰ **Deprecated Functions** (deprecated-functions):\
|
|
85
|
-
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs:
|
|
85
|
+
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
86
86
|
╰ **File Path Validity** (file-path-validity):\
|
|
87
87
|
╰ certain:\
|
|
88
88
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
89
|
-
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs:
|
|
89
|
+
╰ _Metadata_: <code>totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0</code>\
|
|
90
90
|
╰ **Seeded Randomness** (seeded-randomness):\
|
|
91
|
-
╰ _Metadata_: <code>consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs:
|
|
91
|
+
╰ _Metadata_: <code>consumerCalls: 0, callsWithFunctionProducers: 0, callsWithAssignmentProducers: 0, callsWithNonConstantProducers: 0, callsWithOtherBranchProducers: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
92
92
|
╰ **Absolute Paths** (absolute-file-paths):\
|
|
93
93
|
╰ certain:\
|
|
94
94
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
@@ -100,16 +100,16 @@ It offers a wide variety of features, for example:
|
|
|
100
100
|
╰ **Network Functions** (network-functions):\
|
|
101
101
|
╰ _Metadata_: <code>totalCalls: 0, totalFunctionDefinitions: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
102
102
|
╰ **Dataframe Access Validation** (dataframe-access-validation):\
|
|
103
|
-
╰ _Metadata_: <code>numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs:
|
|
103
|
+
╰ _Metadata_: <code>numOperations: 0, numAccesses: 0, totalAccessed: 0, searchTimeMs: 0, processTimeMs: 1</code>\
|
|
104
104
|
╰ **Dead Code** (dead-code):\
|
|
105
|
-
╰ _Metadata_: <code>consideredNodes: 5, searchTimeMs: 0, processTimeMs:
|
|
105
|
+
╰ _Metadata_: <code>consideredNodes: 5, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
106
106
|
╰ **Useless Loops** (useless-loop):\
|
|
107
107
|
╰ _Metadata_: <code>numOfUselessLoops: 0, searchTimeMs: 0, processTimeMs: 0</code>\
|
|
108
|
-
_All queries together required ≈
|
|
108
|
+
_All queries together required ≈2 ms (1ms accuracy, total 2 ms)_
|
|
109
109
|
|
|
110
110
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
111
111
|
|
|
112
|
-
The analysis required _2.
|
|
112
|
+
The analysis required _2.1 ms_ (including parsing and normalization and the query) within the generation environment.
|
|
113
113
|
|
|
114
114
|
In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
|
|
115
115
|
Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
|
|
@@ -126,7 +126,7 @@ It offers a wide variety of features, for example:
|
|
|
126
126
|
".meta": {
|
|
127
127
|
"totalCalls": 0,
|
|
128
128
|
"totalFunctionDefinitions": 0,
|
|
129
|
-
"searchTimeMs":
|
|
129
|
+
"searchTimeMs": 0,
|
|
130
130
|
"processTimeMs": 0
|
|
131
131
|
}
|
|
132
132
|
},
|
|
@@ -149,7 +149,7 @@ It offers a wide variety of features, for example:
|
|
|
149
149
|
"totalUnknown": 0,
|
|
150
150
|
"totalWritesBeforeAlways": 0,
|
|
151
151
|
"totalValid": 0,
|
|
152
|
-
"searchTimeMs":
|
|
152
|
+
"searchTimeMs": 1,
|
|
153
153
|
"processTimeMs": 0
|
|
154
154
|
}
|
|
155
155
|
},
|
|
@@ -161,7 +161,7 @@ It offers a wide variety of features, for example:
|
|
|
161
161
|
"callsWithAssignmentProducers": 0,
|
|
162
162
|
"callsWithNonConstantProducers": 0,
|
|
163
163
|
"callsWithOtherBranchProducers": 0,
|
|
164
|
-
"searchTimeMs":
|
|
164
|
+
"searchTimeMs": 0,
|
|
165
165
|
"processTimeMs": 0
|
|
166
166
|
}
|
|
167
167
|
},
|
|
@@ -218,7 +218,7 @@ It offers a wide variety of features, for example:
|
|
|
218
218
|
"numAccesses": 0,
|
|
219
219
|
"totalAccessed": 0,
|
|
220
220
|
"searchTimeMs": 0,
|
|
221
|
-
"processTimeMs":
|
|
221
|
+
"processTimeMs": 1
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
224
|
"dead-code": {
|
|
@@ -226,7 +226,7 @@ It offers a wide variety of features, for example:
|
|
|
226
226
|
".meta": {
|
|
227
227
|
"consideredNodes": 5,
|
|
228
228
|
"searchTimeMs": 0,
|
|
229
|
-
"processTimeMs":
|
|
229
|
+
"processTimeMs": 0
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
"useless-loop": {
|
|
@@ -239,11 +239,11 @@ It offers a wide variety of features, for example:
|
|
|
239
239
|
}
|
|
240
240
|
},
|
|
241
241
|
".meta": {
|
|
242
|
-
"timing":
|
|
242
|
+
"timing": 2
|
|
243
243
|
}
|
|
244
244
|
},
|
|
245
245
|
".meta": {
|
|
246
|
-
"timing":
|
|
246
|
+
"timing": 2
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
```
|
|
@@ -308,7 +308,7 @@ It offers a wide variety of features, for example:
|
|
|
308
308
|
|
|
309
309
|
```shell
|
|
310
310
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
311
|
-
flowR repl using flowR v2.9.
|
|
311
|
+
flowR repl using flowR v2.9.12, R grammar v14 (tree-sitter engine)
|
|
312
312
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
313
313
|
```
|
|
314
314
|
|
|
@@ -322,7 +322,7 @@ It offers a wide variety of features, for example:
|
|
|
322
322
|
N <- 10
|
|
323
323
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
324
324
|
sum
|
|
325
|
-
All queries together required ≈
|
|
325
|
+
All queries together required ≈3 ms (1ms accuracy, total 4 ms)
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
|
|
@@ -338,7 +338,7 @@ It offers a wide variety of features, for example:
|
|
|
338
338
|
|
|
339
339
|
|
|
340
340
|
* 📚 **dependency analysis**\
|
|
341
|
-
Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/
|
|
341
|
+
Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/query-api) to get more information about your code.
|
|
342
342
|
An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/Query-API#dependencies-query), which shows you the library your project needs,
|
|
343
343
|
the data files it reads, the scripts it sources, and the data it outputs.
|
|
344
344
|
|
|
@@ -356,16 +356,16 @@ It offers a wide variety of features, for example:
|
|
|
356
356
|
|
|
357
357
|
|
|
358
358
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
359
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
359
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">97.7 ms</span></i> (as of Feb 19, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
360
360
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
361
|
-
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/
|
|
361
|
+
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph#perspectives-cg).
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
<details><summary>Example: Generating a dataflow graph with flowR</summary>
|
|
365
365
|
|
|
366
366
|
|
|
367
367
|
You can investigate flowR's analyses using the [REPL](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl).
|
|
368
|
-
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph, start with 'file://' to indicate a file (aliases: :d*, :df*)">`:dataflow*`</span> allow you to view a [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/
|
|
368
|
+
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph, start with 'file://' to indicate a file (aliases: :d*, :df*)">`:dataflow*`</span> allow you to view a [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for a given R script.
|
|
369
369
|
|
|
370
370
|
Let's have a look at the following example:
|
|
371
371
|
|
|
@@ -386,13 +386,13 @@ It offers a wide variety of features, for example:
|
|
|
386
386
|
```
|
|
387
387
|
|
|
388
388
|
|
|
389
|
-
To get the [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/
|
|
389
|
+
To get the [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/dataflow-graph) for this script, you can use the following command:
|
|
390
390
|
|
|
391
391
|
|
|
392
392
|
|
|
393
393
|
```shell
|
|
394
394
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
395
|
-
flowR repl using flowR v2.9.
|
|
395
|
+
flowR repl using flowR v2.9.12, R grammar v14 (tree-sitter engine)
|
|
396
396
|
R> :dataflow* test/testfiles/example.R
|
|
397
397
|
```
|
|
398
398
|
|
|
@@ -700,7 +700,7 @@ It offers a wide variety of features, for example:
|
|
|
700
700
|
```
|
|
701
701
|
|
|
702
702
|
|
|
703
|
-
(The analysis required
|
|
703
|
+
(The analysis required _1.5 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
|
|
704
704
|
|
|
705
705
|
|
|
706
706
|
|
|
@@ -727,8 +727,8 @@ If you are already using flowR and want to give feedback, please consider fillin
|
|
|
727
727
|
|
|
728
728
|
## ⭐ Getting Started
|
|
729
729
|
|
|
730
|
-
To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/
|
|
731
|
-
The [Setup](https://github.com/flowr-analysis/flowr/wiki/
|
|
730
|
+
To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/overview) wiki page.
|
|
731
|
+
The [Setup](https://github.com/flowr-analysis/flowr/wiki/setup) wiki page explains how you can download and setup _flowR_ on your system.
|
|
732
732
|
With docker 🐳️, the following line should be enough (and drop you directly into the read-eval-print loop):
|
|
733
733
|
|
|
734
734
|
|
|
@@ -865,7 +865,7 @@ please check out the following publications (if you find that a paper is missing
|
|
|
865
865
|
|
|
866
866
|
## 🚀 Contributing
|
|
867
867
|
|
|
868
|
-
We welcome every contribution! Please check out the [developer onboarding](https://github.com/flowr-analysis/flowr/wiki/
|
|
868
|
+
We welcome every contribution! Please check out the [developer onboarding](https://github.com/flowr-analysis/flowr/wiki/onboarding) section in the wiki for all the information you will need.
|
|
869
869
|
|
|
870
870
|
### Contributors
|
|
871
871
|
|
package/benchmark/slicer.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { type RParseRequestFromFile, type RParseRequestFromText } from '../r-bri
|
|
|
13
13
|
import { type SlicingCriteriaFilter } from '../slicing/criterion/collect-all';
|
|
14
14
|
import type { AutoSelectPredicate } from '../reconstruct/auto-select/auto-select-defaults';
|
|
15
15
|
import type { KnownParserName } from '../r-bridge/parser';
|
|
16
|
-
import {
|
|
16
|
+
import { FlowrConfig } from '../config';
|
|
17
17
|
/**
|
|
18
18
|
* The logger to be used for benchmarking as a global object.
|
|
19
19
|
*/
|
|
@@ -63,6 +63,7 @@ export declare class BenchmarkSlicer {
|
|
|
63
63
|
private dataflow;
|
|
64
64
|
private normalizedAst;
|
|
65
65
|
private controlFlow;
|
|
66
|
+
private callGraph;
|
|
66
67
|
private totalStopwatch;
|
|
67
68
|
private finished;
|
|
68
69
|
private executor;
|
|
@@ -72,7 +73,7 @@ export declare class BenchmarkSlicer {
|
|
|
72
73
|
* Initialize the slicer on the given request.
|
|
73
74
|
* Can only be called once for each instance.
|
|
74
75
|
*/
|
|
75
|
-
init(request: RParseRequestFromFile | RParseRequestFromText, config:
|
|
76
|
+
init(request: RParseRequestFromFile | RParseRequestFromText, config: FlowrConfig, autoSelectIf?: AutoSelectPredicate, threshold?: number): Promise<void>;
|
|
76
77
|
private calculateStatsAfterInit;
|
|
77
78
|
/**
|
|
78
79
|
* Slice for the given {@link SlicingCriteria}.
|
|
@@ -84,6 +85,7 @@ export declare class BenchmarkSlicer {
|
|
|
84
85
|
* Extract the control flow graph using {@link extractCFG}
|
|
85
86
|
*/
|
|
86
87
|
extractCFG(): void;
|
|
88
|
+
extractCG(): void;
|
|
87
89
|
/**
|
|
88
90
|
* Infer the shape of data frames using abstract interpretation with {@link inferDataFrameShapes}
|
|
89
91
|
* @returns The statistics of the data frame shape inference
|
package/benchmark/slicer.js
CHANGED
|
@@ -31,6 +31,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
31
31
|
const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
|
|
32
32
|
const r_project_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
33
33
|
const r_comment_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-comment");
|
|
34
|
+
const call_graph_1 = require("../dataflow/graph/call-graph");
|
|
34
35
|
/**
|
|
35
36
|
* The logger to be used for benchmarking as a global object.
|
|
36
37
|
*/
|
|
@@ -47,6 +48,7 @@ class BenchmarkSlicer {
|
|
|
47
48
|
dataflow;
|
|
48
49
|
normalizedAst;
|
|
49
50
|
controlFlow;
|
|
51
|
+
callGraph;
|
|
50
52
|
totalStopwatch;
|
|
51
53
|
finished = false;
|
|
52
54
|
// Yes, this is unclean, but we know that we assign the executor during the initialization and this saves us from having to check for nullability every time
|
|
@@ -65,10 +67,10 @@ class BenchmarkSlicer {
|
|
|
65
67
|
// we know these are in sync so we just cast to one of them
|
|
66
68
|
this.parser = await this.commonMeasurements.measure('initialize R session', async () => {
|
|
67
69
|
if (this.parserName === 'r-shell') {
|
|
68
|
-
return new shell_1.RShell(
|
|
70
|
+
return new shell_1.RShell(config_1.FlowrConfig.getForEngine(config, 'r-shell'));
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
71
|
-
await tree_sitter_executor_1.TreeSitterExecutor.initTreeSitter(
|
|
73
|
+
await tree_sitter_executor_1.TreeSitterExecutor.initTreeSitter(config_1.FlowrConfig.getForEngine(config, 'tree-sitter'));
|
|
72
74
|
return new tree_sitter_executor_1.TreeSitterExecutor();
|
|
73
75
|
}
|
|
74
76
|
});
|
|
@@ -228,6 +230,13 @@ class BenchmarkSlicer {
|
|
|
228
230
|
const ast = this.normalizedAst;
|
|
229
231
|
this.controlFlow = this.measureSimpleStep('extract control flow graph', () => (0, extract_cfg_1.extractCfg)(ast, this.context, undefined, undefined, true));
|
|
230
232
|
}
|
|
233
|
+
extractCG() {
|
|
234
|
+
exports.benchmarkLogger.trace('try to extract the call graph');
|
|
235
|
+
this.guardActive();
|
|
236
|
+
const g = this.dataflow?.graph;
|
|
237
|
+
(0, assert_1.guard)(g !== undefined, 'dataflow should be defined for call graph extraction');
|
|
238
|
+
this.callGraph = this.measureSimpleStep('extract call graph', () => (0, call_graph_1.computeCallGraph)(g));
|
|
239
|
+
}
|
|
231
240
|
/**
|
|
232
241
|
* Infer the shape of data frames using abstract interpretation with {@link inferDataFrameShapes}
|
|
233
242
|
* @returns The statistics of the data frame shape inference
|
|
@@ -422,6 +431,7 @@ class BenchmarkSlicer {
|
|
|
422
431
|
const normalizeTime = Number(this.stats.commonMeasurements.get('normalize R AST'));
|
|
423
432
|
const dataflowTime = Number(this.stats.commonMeasurements.get('produce dataflow information'));
|
|
424
433
|
const controlFlowTime = Number(this.stats.commonMeasurements.get('extract control flow graph'));
|
|
434
|
+
const callGraphTime = Number(this.stats.commonMeasurements.get('extract call graph'));
|
|
425
435
|
const dataFrameShapeTime = Number(this.stats.commonMeasurements.get('infer data frame shapes'));
|
|
426
436
|
this.stats.retrieveTimePerToken = {
|
|
427
437
|
raw: retrieveTime / this.stats.input.numberOfRTokens,
|
|
@@ -439,14 +449,18 @@ class BenchmarkSlicer {
|
|
|
439
449
|
raw: (retrieveTime + normalizeTime + dataflowTime) / this.stats.input.numberOfRTokens,
|
|
440
450
|
normalized: (retrieveTime + normalizeTime + dataflowTime) / this.stats.input.numberOfNormalizedTokens
|
|
441
451
|
};
|
|
442
|
-
this.stats.controlFlowTimePerToken =
|
|
452
|
+
this.stats.controlFlowTimePerToken = Number.isNaN(controlFlowTime) ? undefined : {
|
|
443
453
|
raw: controlFlowTime / this.stats.input.numberOfRTokens,
|
|
444
454
|
normalized: controlFlowTime / this.stats.input.numberOfNormalizedTokens,
|
|
445
|
-
}
|
|
446
|
-
this.stats.
|
|
455
|
+
};
|
|
456
|
+
this.stats.callGraphTimePerToken = Number.isNaN(callGraphTime) ? undefined : {
|
|
457
|
+
raw: callGraphTime / this.stats.input.numberOfRTokens,
|
|
458
|
+
normalized: callGraphTime / this.stats.input.numberOfNormalizedTokens,
|
|
459
|
+
};
|
|
460
|
+
this.stats.dataFrameShapeTimePerToken = Number.isNaN(dataFrameShapeTime) ? undefined : {
|
|
447
461
|
raw: dataFrameShapeTime / this.stats.input.numberOfRTokens,
|
|
448
462
|
normalized: dataFrameShapeTime / this.stats.input.numberOfNormalizedTokens,
|
|
449
|
-
}
|
|
463
|
+
};
|
|
450
464
|
return {
|
|
451
465
|
stats: this.stats,
|
|
452
466
|
parse: typeof this.loadedXml === 'string' ? this.loadedXml : JSON.stringify(this.loadedXml),
|
package/benchmark/stats/print.js
CHANGED
|
@@ -104,6 +104,12 @@ Total common time per R token: ${formatNanoseconds(stats.totalCommonTimeP
|
|
|
104
104
|
Control flow extraction: ${print(stats.commonMeasurements, 'extract control flow graph')}
|
|
105
105
|
Control flow extraction per token: ${formatNanoseconds(stats.controlFlowTimePerToken.normalized)}
|
|
106
106
|
Control flow extraction per R token: ${formatNanoseconds(stats.controlFlowTimePerToken.raw)}`;
|
|
107
|
+
}
|
|
108
|
+
if (stats.commonMeasurements.has('extract call graph') && stats.callGraphTimePerToken !== undefined) {
|
|
109
|
+
result += `
|
|
110
|
+
Call graph extraction: ${print(stats.commonMeasurements, 'extract call graph')}
|
|
111
|
+
Call graph extraction per token: ${formatNanoseconds(stats.callGraphTimePerToken.normalized)}
|
|
112
|
+
Call graph extraction per R token: ${formatNanoseconds(stats.callGraphTimePerToken.raw)}`;
|
|
107
113
|
}
|
|
108
114
|
if (stats.commonMeasurements.has('infer data frame shapes') && stats.dataFrameShapeTimePerToken !== undefined) {
|
|
109
115
|
result += `
|
|
@@ -210,6 +216,12 @@ Total common time per R token: ${formatSummarizedTimeMeasure(stats.totalC
|
|
|
210
216
|
Control flow extraction: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('extract control flow graph'))}
|
|
211
217
|
Control flow extraction per token: ${formatSummarizedTimeMeasure(stats.controlFlowTimePerToken.normalized)}
|
|
212
218
|
Control flow extraction per R token: ${formatSummarizedTimeMeasure(stats.controlFlowTimePerToken.raw)}`;
|
|
219
|
+
}
|
|
220
|
+
if (stats.commonMeasurements.has('extract call graph') && stats.callGraphTimePerToken !== undefined) {
|
|
221
|
+
result += `
|
|
222
|
+
Call graph extraction: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('extract call graph'))}
|
|
223
|
+
Call graph extraction per token: ${formatSummarizedTimeMeasure(stats.callGraphTimePerToken.normalized)}
|
|
224
|
+
Call graph extraction per R token: ${formatSummarizedTimeMeasure(stats.callGraphTimePerToken.raw)}`;
|
|
213
225
|
}
|
|
214
226
|
if (stats.commonMeasurements.has('infer data frame shapes') && stats.dataFrameShapeTimePerToken !== undefined) {
|
|
215
227
|
result += `
|
|
@@ -6,8 +6,8 @@ import type { TimePerToken } from '../summarizer/data';
|
|
|
6
6
|
import type { MergeableRecord } from '../../util/objects';
|
|
7
7
|
import type { DataFrameOperationName } from '../../abstract-interpretation/data-frame/semantics';
|
|
8
8
|
export declare const RequiredSlicerMeasurements: readonly ["initialize R session", "retrieve AST from R code", "normalize R AST", "produce dataflow information", "close R session", "total"];
|
|
9
|
-
export declare const OptionalSlicerMeasurements: readonly ["extract control flow graph", "infer data frame shapes"];
|
|
10
|
-
export declare const CommonSlicerMeasurements: readonly ["initialize R session", "retrieve AST from R code", "normalize R AST", "produce dataflow information", "close R session", "total", "extract control flow graph", "infer data frame shapes"];
|
|
9
|
+
export declare const OptionalSlicerMeasurements: readonly ["extract control flow graph", "infer data frame shapes", "extract call graph"];
|
|
10
|
+
export declare const CommonSlicerMeasurements: readonly ["initialize R session", "retrieve AST from R code", "normalize R AST", "produce dataflow information", "close R session", "total", "extract control flow graph", "infer data frame shapes", "extract call graph"];
|
|
11
11
|
export type CommonSlicerMeasurements = typeof CommonSlicerMeasurements[number];
|
|
12
12
|
export declare const PerSliceMeasurements: readonly ["static slicing", "reconstruct code", "total"];
|
|
13
13
|
export type PerSliceMeasurements = typeof PerSliceMeasurements[number];
|
|
@@ -91,5 +91,6 @@ export interface SlicerStats {
|
|
|
91
91
|
dataflowTimePerToken: TimePerToken<number>;
|
|
92
92
|
totalCommonTimePerToken: TimePerToken<number>;
|
|
93
93
|
controlFlowTimePerToken?: TimePerToken<number>;
|
|
94
|
+
callGraphTimePerToken?: TimePerToken<number>;
|
|
94
95
|
dataFrameShapeTimePerToken?: TimePerToken<number>;
|
|
95
96
|
}
|
package/benchmark/stats/stats.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PerSliceMeasurements = exports.CommonSlicerMeasurements = exports.OptionalSlicerMeasurements = exports.RequiredSlicerMeasurements = void 0;
|
|
4
4
|
exports.RequiredSlicerMeasurements = ['initialize R session', 'retrieve AST from R code', 'normalize R AST', 'produce dataflow information', 'close R session', 'total'];
|
|
5
|
-
exports.OptionalSlicerMeasurements = ['extract control flow graph', 'infer data frame shapes'];
|
|
5
|
+
exports.OptionalSlicerMeasurements = ['extract control flow graph', 'infer data frame shapes', 'extract call graph'];
|
|
6
6
|
exports.CommonSlicerMeasurements = [...exports.RequiredSlicerMeasurements, ...exports.OptionalSlicerMeasurements];
|
|
7
7
|
exports.PerSliceMeasurements = ['static slicing', 'reconstruct code', 'total'];
|
|
8
8
|
//# sourceMappingURL=stats.js.map
|
|
@@ -65,6 +65,7 @@ export interface UltimateSlicerStats {
|
|
|
65
65
|
dataflowTimePerToken: TimePerToken;
|
|
66
66
|
totalCommonTimePerToken: TimePerToken;
|
|
67
67
|
controlFlowTimePerToken?: TimePerToken;
|
|
68
|
+
callGraphTimePerToken?: TimePerToken;
|
|
68
69
|
dataFrameShapeTimePerToken?: TimePerToken;
|
|
69
70
|
sliceTimePerToken: TimePerToken;
|
|
70
71
|
reconstructTimePerToken: TimePerToken;
|
|
@@ -25,6 +25,7 @@ function summarizeAllSummarizedStats(stats) {
|
|
|
25
25
|
const dataflowTimesPerToken = [];
|
|
26
26
|
const totalCommonTimesPerToken = [];
|
|
27
27
|
const controlFlowTimePerToken = [];
|
|
28
|
+
const callGraphTimePerToken = [];
|
|
28
29
|
const dataFrameShapeTimePerToken = [];
|
|
29
30
|
const memory = new defaultmap_1.DefaultMap(() => []);
|
|
30
31
|
const reductions = [];
|
|
@@ -52,6 +53,9 @@ function summarizeAllSummarizedStats(stats) {
|
|
|
52
53
|
if (stat.controlFlowTimePerToken !== undefined) {
|
|
53
54
|
controlFlowTimePerToken.push(stat.controlFlowTimePerToken);
|
|
54
55
|
}
|
|
56
|
+
if (stat.callGraphTimePerToken !== undefined) {
|
|
57
|
+
callGraphTimePerToken.push(stat.callGraphTimePerToken);
|
|
58
|
+
}
|
|
55
59
|
if (stat.dataFrameShapeTimePerToken !== undefined) {
|
|
56
60
|
dataFrameShapeTimePerToken.push(stat.dataFrameShapeTimePerToken);
|
|
57
61
|
}
|
|
@@ -82,6 +86,7 @@ function summarizeAllSummarizedStats(stats) {
|
|
|
82
86
|
dataflowTimePerToken: (0, process_1.summarizeTimePerToken)(dataflowTimesPerToken),
|
|
83
87
|
totalCommonTimePerToken: (0, process_1.summarizeTimePerToken)(totalCommonTimesPerToken),
|
|
84
88
|
controlFlowTimePerToken: controlFlowTimePerToken.length > 0 ? (0, process_1.summarizeTimePerToken)(controlFlowTimePerToken) : undefined,
|
|
89
|
+
callGraphTimePerToken: callGraphTimePerToken.length > 0 ? (0, process_1.summarizeTimePerToken)(callGraphTimePerToken) : undefined,
|
|
85
90
|
dataFrameShapeTimePerToken: dataFrameShapeTimePerToken.length > 0 ? (0, process_1.summarizeTimePerToken)(dataFrameShapeTimePerToken) : undefined,
|
|
86
91
|
failedToRepParse,
|
|
87
92
|
timesHitThreshold,
|
package/cli/benchmark-app.d.ts
CHANGED
package/cli/benchmark-app.js
CHANGED
|
@@ -75,6 +75,7 @@ async function benchmark() {
|
|
|
75
75
|
'--sampling-strategy', options['sampling-strategy'],
|
|
76
76
|
...(options.seed ? ['--seed', options.seed] : []),
|
|
77
77
|
...(options.cfg ? ['--cfg'] : []),
|
|
78
|
+
...(options.cg ? ['--cg'] : [])
|
|
78
79
|
]);
|
|
79
80
|
const runs = options.runs ?? 1;
|
|
80
81
|
for (let i = 1; i <= runs; i++) {
|
|
@@ -10,7 +10,8 @@ export interface SingleBenchmarkCliOptions {
|
|
|
10
10
|
parser: KnownParserName;
|
|
11
11
|
'dataframe-shape-inference': boolean;
|
|
12
12
|
'max-slices': number;
|
|
13
|
-
|
|
13
|
+
cfg: boolean;
|
|
14
|
+
cg: boolean;
|
|
14
15
|
threshold?: number;
|
|
15
16
|
'sampling-strategy': string;
|
|
16
17
|
seed?: string;
|
|
@@ -31,14 +31,14 @@ async function benchmark() {
|
|
|
31
31
|
(0, assert_1.guard)(options.output !== undefined, 'No output file given');
|
|
32
32
|
(0, assert_1.guard)((options['file-id'] === undefined) === (options['run-num'] === undefined), 'When giving a file-id or run-num, both have to be given');
|
|
33
33
|
// prefix for printing to console, includes file id and run number if present
|
|
34
|
-
const prefix = `[${options.input}${options['file-id']
|
|
34
|
+
const prefix = `[${options.input}${options['file-id'] === undefined ? '' : ` (file ${options['file-id']}, run ${options['run-num']})`}]`;
|
|
35
35
|
console.log(`${prefix} Appending output to ${options.output}`);
|
|
36
36
|
const directory = path_1.default.parse(options.output).dir;
|
|
37
37
|
// ensure the directory exists if the path contains one
|
|
38
38
|
if (directory !== '') {
|
|
39
39
|
fs_1.default.mkdirSync(directory, { recursive: true });
|
|
40
40
|
}
|
|
41
|
-
const config =
|
|
41
|
+
const config = config_1.FlowrConfig.fromFile();
|
|
42
42
|
// ensure the file exists
|
|
43
43
|
const fileStat = fs_1.default.statSync(options.input);
|
|
44
44
|
(0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
|
|
@@ -58,7 +58,7 @@ async function benchmark() {
|
|
|
58
58
|
console.log(`${prefix} Skipping Slicing due to --slice=${options.slice}`);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
const limit = parseInt(options.slice);
|
|
61
|
+
const limit = Number.parseInt(options.slice);
|
|
62
62
|
console.log(`${prefix} Slicing up to ${limit} possible slices`);
|
|
63
63
|
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`), { sampleCount: limit, maxSliceCount: maxSlices, sampleStrategy: options['sampling-strategy'], seed: options.seed });
|
|
64
64
|
console.log(`${prefix} Completed Slicing`);
|
|
@@ -68,6 +68,9 @@ async function benchmark() {
|
|
|
68
68
|
if (options['cfg'] || options['dataframe-shape-inference']) {
|
|
69
69
|
slicer.extractCFG();
|
|
70
70
|
}
|
|
71
|
+
if (options['cg']) {
|
|
72
|
+
slicer.extractCG();
|
|
73
|
+
}
|
|
71
74
|
if (options['dataframe-shape-inference']) {
|
|
72
75
|
console.log(`${prefix} Performing shape inference for data frames`);
|
|
73
76
|
slicer.inferDataFrameShapes();
|
package/cli/common/options.d.ts
CHANGED
|
@@ -105,6 +105,10 @@ export declare const benchmarkOptions: [{
|
|
|
105
105
|
readonly alias: "c";
|
|
106
106
|
readonly type: BooleanConstructor;
|
|
107
107
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "cg";
|
|
110
|
+
readonly type: BooleanConstructor;
|
|
111
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
108
112
|
}];
|
|
109
113
|
export declare const benchmarkHelperOptions: [{
|
|
110
114
|
readonly name: "verbose";
|
|
@@ -146,6 +150,10 @@ export declare const benchmarkHelperOptions: [{
|
|
|
146
150
|
readonly alias: "c";
|
|
147
151
|
readonly type: BooleanConstructor;
|
|
148
152
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "cg";
|
|
155
|
+
readonly type: BooleanConstructor;
|
|
156
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
149
157
|
}, {
|
|
150
158
|
readonly name: "output";
|
|
151
159
|
readonly alias: "o";
|
package/cli/common/options.js
CHANGED
|
@@ -27,7 +27,8 @@ exports.benchmarkOptions = [
|
|
|
27
27
|
{ name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
28
28
|
{ name: 'per-file-time-limit', type: Number, description: 'Time limit in milliseconds to process single file (disabled by default)', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
29
29
|
{ name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
|
|
30
|
-
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' }
|
|
30
|
+
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' },
|
|
31
|
+
{ name: 'cg', type: Boolean, description: 'Extract the call graph of the file (benchmark it too)' }
|
|
31
32
|
];
|
|
32
33
|
exports.benchmarkHelperOptions = [
|
|
33
34
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
|
|
@@ -37,6 +38,7 @@ exports.benchmarkHelperOptions = [
|
|
|
37
38
|
{ name: 'run-num', alias: 'r', type: Number, description: 'The n-th time that the file with the given file-id is being benchmarked' },
|
|
38
39
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
39
40
|
{ name: 'cfg', alias: 'c', type: Boolean, description: 'Extract the control flow graph of the file (benchmark it too)' },
|
|
41
|
+
{ name: 'cg', type: Boolean, description: 'Extract the call graph of the file (benchmark it too)' },
|
|
40
42
|
{ name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
|
|
41
43
|
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' },
|
|
42
44
|
{ name: 'dataframe-shape-inference', type: Boolean, description: 'Infer the shape of data frames using abstract interpretation (includes control flow graph extraction)', defaultValue: false },
|
|
@@ -192,6 +192,10 @@ declare const _scripts: {
|
|
|
192
192
|
readonly alias: "c";
|
|
193
193
|
readonly type: BooleanConstructor;
|
|
194
194
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "cg";
|
|
197
|
+
readonly type: BooleanConstructor;
|
|
198
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
195
199
|
}];
|
|
196
200
|
};
|
|
197
201
|
'benchmark-helper': {
|
|
@@ -239,6 +243,10 @@ declare const _scripts: {
|
|
|
239
243
|
readonly alias: "c";
|
|
240
244
|
readonly type: BooleanConstructor;
|
|
241
245
|
readonly description: "Extract the control flow graph of the file (benchmark it too)";
|
|
246
|
+
}, {
|
|
247
|
+
readonly name: "cg";
|
|
248
|
+
readonly type: BooleanConstructor;
|
|
249
|
+
readonly description: "Extract the call graph of the file (benchmark it too)";
|
|
242
250
|
}, {
|
|
243
251
|
readonly name: "output";
|
|
244
252
|
readonly alias: "o";
|
package/cli/export-quads-app.js
CHANGED
|
@@ -18,7 +18,7 @@ const options = (0, script_1.processCommandLineArgs)('export-quads', [], {
|
|
|
18
18
|
'{bold --help}'
|
|
19
19
|
]
|
|
20
20
|
});
|
|
21
|
-
const shell = new shell_1.RShell(
|
|
21
|
+
const shell = new shell_1.RShell(config_1.FlowrConfig.getForEngine(config_1.FlowrConfig.fromFile(), 'r-shell'));
|
|
22
22
|
async function writeQuadForSingleFile(request, output) {
|
|
23
23
|
const normalized = await (0, retriever_1.retrieveNormalizedAstFromRCode)(request, shell);
|
|
24
24
|
const serialized = (0, quads_1.serialize2quads)(normalized.ast.files[0].root, { context: request.content });
|
package/cli/flowr.js
CHANGED
|
@@ -54,7 +54,7 @@ if (options['no-ansi']) {
|
|
|
54
54
|
function createConfig() {
|
|
55
55
|
let config;
|
|
56
56
|
if (options['config-json']) {
|
|
57
|
-
const passedConfig =
|
|
57
|
+
const passedConfig = config_1.FlowrConfig.parse(options['config-json']);
|
|
58
58
|
if (passedConfig) {
|
|
59
59
|
log_1.log.info(`Using passed config ${JSON.stringify(passedConfig)}`);
|
|
60
60
|
config = passedConfig;
|
|
@@ -68,10 +68,10 @@ function createConfig() {
|
|
|
68
68
|
process.exit(1);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
config =
|
|
71
|
+
config = config_1.FlowrConfig.fromFile(options['config-file'] ?? flowr_main_options_1.defaultConfigFile);
|
|
72
72
|
}
|
|
73
73
|
// for all options that we manually supply that have a config equivalent, set them in the config
|
|
74
|
-
config =
|
|
74
|
+
config = config_1.FlowrConfig.amend(config, c => {
|
|
75
75
|
c.engines ??= [];
|
|
76
76
|
if (!options['engine.r-shell.disabled']) {
|
|
77
77
|
c.engines.push({ type: 'r-shell', rPath: options['r-path'] || options['engine.r-shell.r-path'] });
|
package/cli/repl/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as readline from 'readline';
|
|
2
2
|
import { type ReplOutput } from './commands/repl-main';
|
|
3
3
|
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FlowrConfig } from '../../config';
|
|
5
5
|
import type { FlowrAnalyzer } from '../../project/flowr-analyzer';
|
|
6
6
|
/**
|
|
7
7
|
* Completion suggestions for a specific REPL command
|
|
@@ -18,11 +18,11 @@ export interface CommandCompletions {
|
|
|
18
18
|
/**
|
|
19
19
|
* Used by the repl to provide automatic completions for a given (partial) input line
|
|
20
20
|
*/
|
|
21
|
-
export declare function replCompleter(line: string, config:
|
|
21
|
+
export declare function replCompleter(line: string, config: FlowrConfig): [string[], string];
|
|
22
22
|
/**
|
|
23
23
|
* Produces default readline options for the flowR REPL
|
|
24
24
|
*/
|
|
25
|
-
export declare function makeDefaultReplReadline(config:
|
|
25
|
+
export declare function makeDefaultReplReadline(config: FlowrConfig): readline.ReadLineOptions;
|
|
26
26
|
/**
|
|
27
27
|
* Handles a string input for the REPL, returning the parsed string and any remaining input.
|
|
28
28
|
*/
|
|
@@ -3,7 +3,7 @@ import { type TREE_SITTER_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE } from '..
|
|
|
3
3
|
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
|
|
4
4
|
import type { DeepPartial } from 'ts-essentials';
|
|
5
5
|
import type { KnownParser, ParseStepOutput } from '../../../r-bridge/parser';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FlowrConfig } from '../../../config';
|
|
7
7
|
import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { DataflowInformation } from '../../../dataflow/info';
|
|
9
9
|
import type { Tree } from 'web-tree-sitter';
|
|
@@ -19,7 +19,7 @@ export declare class FlowRServerConnection {
|
|
|
19
19
|
private readonly allowRSessionAccess;
|
|
20
20
|
private readonly config;
|
|
21
21
|
private readonly fileMap;
|
|
22
|
-
constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config:
|
|
22
|
+
constructor(socket: Socket, name: string, parser: KnownParser, allowRSessionAccess: boolean, config: FlowrConfig);
|
|
23
23
|
private currentMessageBuffer;
|
|
24
24
|
private handleData;
|
|
25
25
|
private handleFileAnalysisRequest;
|