@eagleoutice/flowr 2.13.9 → 2.13.11
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 +40 -40
- package/config.d.ts +50 -2
- package/config.js +37 -6
- package/dataflow/environments/apply-kill.js +4 -4
- package/dataflow/environments/built-in-props.d.ts +28 -4
- package/dataflow/environments/built-in-props.js +31 -8
- package/dataflow/environments/built-in.d.ts +7 -2
- package/dataflow/environments/built-in.js +10 -12
- package/dataflow/environments/default-builtin-config.d.ts +46 -6
- package/dataflow/environments/default-builtin-config.js +30 -16
- package/dataflow/environments/environment.d.ts +16 -0
- package/dataflow/environments/environment.js +114 -26
- package/dataflow/environments/identifier.d.ts +6 -0
- package/dataflow/environments/identifier.js +18 -5
- package/dataflow/environments/query-fn-props.js +34 -2
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/environments/resolve-by-name.js +16 -6
- package/dataflow/environments/resolve-helper.d.ts +43 -0
- package/dataflow/environments/resolve-helper.js +47 -0
- package/dataflow/eval/resolve/alias-tracking.js +45 -1
- package/dataflow/eval/resolve/resolve-argument.js +25 -17
- package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
- package/dataflow/eval/resolve/resolve-strings.js +16 -9
- package/dataflow/eval/resolve/resolve.js +3 -1
- package/dataflow/graph/call-graph.d.ts +7 -0
- package/dataflow/graph/call-graph.js +103 -0
- package/dataflow/graph/df-helper.d.ts +50 -1
- package/dataflow/graph/df-helper.js +63 -0
- package/dataflow/graph/graph.d.ts +5 -8
- package/dataflow/graph/graph.js +24 -13
- package/dataflow/internal/linker.d.ts +5 -5
- package/dataflow/internal/linker.js +31 -92
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
- package/documentation/data/faq/faqs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +3 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +5 -0
- package/documentation/doc-util/doc-files.js +13 -3
- package/documentation/doc-util/doc-sigdb.d.ts +9 -0
- package/documentation/doc-util/doc-sigdb.js +32 -0
- package/documentation/wiki-analyzer.js +10 -10
- package/documentation/wiki-core.js +1 -1
- package/documentation/wiki-dataflow-graph.js +3 -3
- package/documentation/wiki-interface.js +13 -2
- package/documentation/wiki-linting-and-testing.js +13 -13
- package/documentation/wiki-mk/doc-context.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.js +9 -5
- package/documentation/wiki-normalized-ast.js +1 -1
- package/documentation/wiki-overview.js +2 -2
- package/documentation/wiki-query.js +4 -1
- package/documentation/wiki-setup.js +3 -3
- package/documentation/wiki-signature-database.js +2 -5
- package/gas.d.ts +6 -0
- package/gas.js +7 -1
- package/linter/linter-rules.d.ts +1 -1
- package/linter/rules/syntactically-valid.d.ts +12 -1
- package/linter/rules/syntactically-valid.js +88 -17
- package/package.json +7 -8
- package/project/attached-packages.d.ts +13 -0
- package/project/attached-packages.js +30 -0
- package/project/context/flowr-analyzer-context.d.ts +15 -0
- package/project/context/flowr-analyzer-context.js +14 -3
- package/project/context/flowr-analyzer-files-context.d.ts +11 -0
- package/project/context/flowr-analyzer-files-context.js +3 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
- package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +8 -0
- package/project/context/flowr-analyzer-loading-order-context.js +23 -2
- package/project/dependency-version-space.d.ts +33 -11
- package/project/dependency-version-space.js +58 -32
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +2 -0
- package/project/sigdb/manifest.js +9 -5
- package/project/sigdb/reader.d.ts +20 -0
- package/project/sigdb/reader.js +93 -10
- package/project/sigdb/signature-match.d.ts +5 -18
- package/project/sigdb/signature-match.js +5 -18
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +11 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +25 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
- package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
- package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
- package/queries/catalog/dependencies-query/link-devices.d.ts +16 -0
- package/queries/catalog/dependencies-query/link-devices.js +104 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +14 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +18 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
- package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
- package/queries/catalog/input-sources-query/input-types.js +10 -0
- package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
- package/queries/catalog/signature-query/signature-query-executor.js +3 -0
- package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
- package/queries/catalog/slice-query-options.d.ts +11 -1
- package/queries/catalog/slice-query-options.js +8 -4
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -1
- package/queries/query.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +23 -2
- package/r-bridge/lang-4.x/ast/model/model.js +44 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +8 -8
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
- package/reconstruct/reconstruct.d.ts +9 -0
- package/reconstruct/reconstruct.js +1 -0
- package/search/flowr-search-filters.d.ts +25 -1
- package/search/flowr-search-filters.js +42 -7
- package/search/search-executor/search-generators.js +7 -2
- package/search/search-executor/search-transformer.js +4 -1
- package/slicing/criterion/parse.d.ts +5 -25
- package/slicing/criterion/parse.js +15 -20
- package/slicing/static/fingerprint.js +18 -6
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/slicer-types.d.ts +10 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +29 -6
- package/slicing/static/visiting-queue.d.ts +12 -2
- package/slicing/static/visiting-queue.js +28 -3
- package/util/arg-matching.d.ts +18 -0
- package/util/arg-matching.js +70 -0
- package/util/collections/bimap.d.ts +21 -1
- package/util/collections/bimap.js +43 -7
- package/util/r-regex.js +19 -1
- package/util/range.d.ts +7 -8
- package/util/range.js +10 -11
- package/util/version.js +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ and [Docker](https://hub.docker.com/r/eagleoutice/flowr).
|
|
|
13
13
|
It offers a wide variety of features, for example:
|
|
14
14
|
|
|
15
15
|
* 📚 **dependency analysis**\
|
|
16
|
-
Given your analysis project, flowR offers a plethora of so-called [queries](https://github.com/flowr-analysis/flowr/wiki/
|
|
16
|
+
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.
|
|
17
17
|
An important query is the [dependencies query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Dependencies), which shows you the library your project needs,
|
|
18
18
|
the data files it reads, the scripts it sources, and the data it outputs.
|
|
19
19
|
Building on it, the [guess dependency versions query](https://github.com/flowr-analysis/flowr/wiki/%5BQuery%5D-Guess-Dependency-Versions) narrows down the version range each
|
|
@@ -32,18 +32,18 @@ It offers a wide variety of features, for example:
|
|
|
32
32
|
</details>
|
|
33
33
|
|
|
34
34
|
* 🐞 **code linting**\
|
|
35
|
-
Analyze your R scripts for common issues and potential bugs (see the [wiki page](https://github.com/flowr-analysis/flowr/wiki/
|
|
35
|
+
Analyze your R scripts for common issues and potential bugs (see the [wiki page](https://github.com/flowr-analysis/flowr/wiki/Linter) for more information on the currently supported linters).
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
<details><summary>Example: Linting code with flowR</summary>
|
|
39
39
|
|
|
40
|
-
To lint your code, you can use the [REPL](https://github.com/flowr-analysis/flowr/wiki/
|
|
40
|
+
To lint your code, you can use the [REPL](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl) or the [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr) (see [vscode-flowr#283](https://github.com/flowr-analysis/vscode-flowr/pull/283)).
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
```shell
|
|
45
45
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
46
|
-
flowR repl v2.13.
|
|
46
|
+
flowR repl v2.13.10, R grammar v14 (tree-sitter engine)
|
|
47
47
|
R> :query @linter "read.csv(\"/root/x.txt\")"
|
|
48
48
|
```
|
|
49
49
|
|
|
@@ -52,7 +52,7 @@ It offers a wide variety of features, for example:
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
```text
|
|
55
|
-
Query: linter (
|
|
55
|
+
Query: linter (10 ms)
|
|
56
56
|
╰ Deprecated Functions (deprecated-functions): no findings
|
|
57
57
|
╰ File Path Validity (file-path-validity):
|
|
58
58
|
╰ certain:
|
|
@@ -73,7 +73,7 @@ It offers a wide variety of features, for example:
|
|
|
73
73
|
╰ Roxygen Arguments (roxygen-arguments): no findings
|
|
74
74
|
╰ No Leaked Credentials (no-leaked-credentials): no findings
|
|
75
75
|
╰ Undefined Symbol (undefined-symbol): no findings
|
|
76
|
-
All queries together required ≈
|
|
76
|
+
All queries together required ≈10 ms (1ms accuracy, total 11 ms)
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
|
|
@@ -95,17 +95,17 @@ It offers a wide variety of features, for example:
|
|
|
95
95
|
|
|
96
96
|
_Results (prettified and summarized):_
|
|
97
97
|
|
|
98
|
-
Query: **linter** (
|
|
98
|
+
Query: **linter** (246 ms)\
|
|
99
99
|
╰ **Deprecated Functions** (deprecated-functions): _no findings_\
|
|
100
100
|
╰ **File Path Validity** (file-path-validity):\
|
|
101
101
|
╰ certain:\
|
|
102
102
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
103
|
-
╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs:
|
|
103
|
+
╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 3, processTimeMs: 1\
|
|
104
104
|
╰ **Seeded Randomness** (seeded-randomness): _no findings_\
|
|
105
105
|
╰ **Absolute Paths** (absolute-file-paths):\
|
|
106
106
|
╰ certain:\
|
|
107
107
|
╰ Path `/root/x.txt` at 1.1-23\
|
|
108
|
-
╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs:
|
|
108
|
+
╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 1\
|
|
109
109
|
╰ **Unused Definitions** (unused-definitions): _no findings_\
|
|
110
110
|
╰ **Network Functions** (network-functions): _no findings_\
|
|
111
111
|
╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
|
|
@@ -116,11 +116,11 @@ It offers a wide variety of features, for example:
|
|
|
116
116
|
╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
|
|
117
117
|
╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
|
|
118
118
|
╰ **Undefined Symbol** (undefined-symbol): _no findings_\
|
|
119
|
-
_All queries together required ≈
|
|
119
|
+
_All queries together required ≈246 ms (1ms accuracy, total 248 ms)_
|
|
120
120
|
|
|
121
121
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
122
122
|
|
|
123
|
-
The analysis required
|
|
123
|
+
The analysis required _248.0 ms_ (including parsing and normalization and the query) within the generation environment.
|
|
124
124
|
|
|
125
125
|
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.
|
|
126
126
|
Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
|
|
@@ -137,8 +137,8 @@ It offers a wide variety of features, for example:
|
|
|
137
137
|
".meta": {
|
|
138
138
|
"totalCalls": 0,
|
|
139
139
|
"totalFunctionDefinitions": 0,
|
|
140
|
-
"searchTimeMs":
|
|
141
|
-
"processTimeMs":
|
|
140
|
+
"searchTimeMs": 46,
|
|
141
|
+
"processTimeMs": 167
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
"file-path-validity": {
|
|
@@ -160,7 +160,7 @@ It offers a wide variety of features, for example:
|
|
|
160
160
|
"totalUnknown": 0,
|
|
161
161
|
"totalWritesBeforeAlways": 0,
|
|
162
162
|
"totalValid": 0,
|
|
163
|
-
"searchTimeMs":
|
|
163
|
+
"searchTimeMs": 3,
|
|
164
164
|
"processTimeMs": 1
|
|
165
165
|
}
|
|
166
166
|
},
|
|
@@ -172,7 +172,7 @@ It offers a wide variety of features, for example:
|
|
|
172
172
|
"callsWithAssignmentProducers": 0,
|
|
173
173
|
"callsWithNonConstantProducers": 0,
|
|
174
174
|
"callsWithOtherBranchProducers": 0,
|
|
175
|
-
"searchTimeMs":
|
|
175
|
+
"searchTimeMs": 1,
|
|
176
176
|
"processTimeMs": 0
|
|
177
177
|
}
|
|
178
178
|
},
|
|
@@ -192,7 +192,7 @@ It offers a wide variety of features, for example:
|
|
|
192
192
|
".meta": {
|
|
193
193
|
"totalConsidered": 1,
|
|
194
194
|
"totalUnknown": 0,
|
|
195
|
-
"searchTimeMs":
|
|
195
|
+
"searchTimeMs": 1,
|
|
196
196
|
"processTimeMs": 1
|
|
197
197
|
}
|
|
198
198
|
},
|
|
@@ -210,7 +210,7 @@ It offers a wide variety of features, for example:
|
|
|
210
210
|
"totalCalls": 0,
|
|
211
211
|
"totalFunctionDefinitions": 0,
|
|
212
212
|
"searchTimeMs": 0,
|
|
213
|
-
"processTimeMs":
|
|
213
|
+
"processTimeMs": 1
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
"dataframe-access-validation": {
|
|
@@ -220,13 +220,13 @@ It offers a wide variety of features, for example:
|
|
|
220
220
|
"numAccesses": 0,
|
|
221
221
|
"totalAccessed": 0,
|
|
222
222
|
"searchTimeMs": 0,
|
|
223
|
-
"processTimeMs":
|
|
223
|
+
"processTimeMs": 2
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
"dead-code": {
|
|
227
227
|
"results": [],
|
|
228
228
|
".meta": {
|
|
229
|
-
"searchTimeMs":
|
|
229
|
+
"searchTimeMs": 1,
|
|
230
230
|
"processTimeMs": 0
|
|
231
231
|
}
|
|
232
232
|
},
|
|
@@ -242,7 +242,7 @@ It offers a wide variety of features, for example:
|
|
|
242
242
|
"results": [],
|
|
243
243
|
".meta": {
|
|
244
244
|
"searchTimeMs": 0,
|
|
245
|
-
"processTimeMs":
|
|
245
|
+
"processTimeMs": 1
|
|
246
246
|
}
|
|
247
247
|
},
|
|
248
248
|
"stop-call": {
|
|
@@ -281,16 +281,16 @@ It offers a wide variety of features, for example:
|
|
|
281
281
|
"subscript": 0
|
|
282
282
|
},
|
|
283
283
|
"searchTimeMs": 0,
|
|
284
|
-
"processTimeMs":
|
|
284
|
+
"processTimeMs": 21
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
".meta": {
|
|
289
|
-
"timing":
|
|
289
|
+
"timing": 246
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
".meta": {
|
|
293
|
-
"timing":
|
|
293
|
+
"timing": 246
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
```
|
|
@@ -324,11 +324,11 @@ It offers a wide variety of features, for example:
|
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
The simplest way to retrieve slices is with flowR's [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr).
|
|
327
|
-
However, you can slice using the [REPL](https://github.com/flowr-analysis/flowr/wiki/
|
|
327
|
+
However, you can slice using the [REPL](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl) as well.
|
|
328
328
|
This can help you if you want to reuse specific parts of an existing analysis within another context or if you want to understand
|
|
329
329
|
what is happening in the code.
|
|
330
330
|
|
|
331
|
-
For this, let's have a look at the example file, located at [test/testfiles/example.R](https://github.com/flowr-analysis/flowr/tree/main
|
|
331
|
+
For this, let's have a look at the example file, located at [test/testfiles/example.R](https://github.com/flowr-analysis/flowr/tree/main/test/testfiles/example.R):
|
|
332
332
|
|
|
333
333
|
|
|
334
334
|
```r
|
|
@@ -354,7 +354,7 @@ It offers a wide variety of features, for example:
|
|
|
354
354
|
|
|
355
355
|
```shell
|
|
356
356
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
357
|
-
flowR repl v2.13.
|
|
357
|
+
flowR repl v2.13.10, R grammar v14 (tree-sitter engine)
|
|
358
358
|
R> :query @static-slice (11@sum) file://test/testfiles/example.R
|
|
359
359
|
```
|
|
360
360
|
|
|
@@ -368,7 +368,7 @@ It offers a wide variety of features, for example:
|
|
|
368
368
|
N <- 10
|
|
369
369
|
for(i in 1:(N-1)) sum <- sum + i + w
|
|
370
370
|
sum
|
|
371
|
-
All queries together required ≈
|
|
371
|
+
All queries together required ≈27 ms (1ms accuracy, total 27 ms)
|
|
372
372
|
```
|
|
373
373
|
|
|
374
374
|
|
|
@@ -383,16 +383,16 @@ It offers a wide variety of features, for example:
|
|
|
383
383
|
</details>
|
|
384
384
|
|
|
385
385
|
* 🚀 **fast call-graph, data-, and control-flow graphs**\
|
|
386
|
-
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
386
|
+
Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">107.6 ms</span></i> (as of Aug 8, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
|
|
387
387
|
_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,
|
|
388
|
-
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/
|
|
388
|
+
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).
|
|
389
389
|
|
|
390
390
|
|
|
391
391
|
<details><summary>Example: Generating a dataflow graph with flowR</summary>
|
|
392
392
|
|
|
393
393
|
|
|
394
|
-
You can investigate flowR's analyses using the [REPL](https://github.com/flowr-analysis/flowr/wiki/
|
|
395
|
-
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph (aliases: :d*, :df*)">`:dataflow*`</span> allow you to view a [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/
|
|
394
|
+
You can investigate flowR's analyses using the [REPL](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl).
|
|
395
|
+
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph (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.
|
|
396
396
|
|
|
397
397
|
Let's have a look at the following example:
|
|
398
398
|
|
|
@@ -413,13 +413,13 @@ It offers a wide variety of features, for example:
|
|
|
413
413
|
```
|
|
414
414
|
|
|
415
415
|
|
|
416
|
-
To get the [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/
|
|
416
|
+
To get the [dataflow graph](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for this script, you can use the following command:
|
|
417
417
|
|
|
418
418
|
|
|
419
419
|
|
|
420
420
|
```shell
|
|
421
421
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
422
|
-
flowR repl v2.13.
|
|
422
|
+
flowR repl v2.13.10, R grammar v14 (tree-sitter engine)
|
|
423
423
|
R> :dataflow* test/testfiles/example.R
|
|
424
424
|
```
|
|
425
425
|
|
|
@@ -692,7 +692,7 @@ It offers a wide variety of features, for example:
|
|
|
692
692
|
```
|
|
693
693
|
|
|
694
694
|
|
|
695
|
-
(The analysis required _2.
|
|
695
|
+
(The analysis required _2.6 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
|
|
696
696
|
|
|
697
697
|
|
|
698
698
|
|
|
@@ -709,7 +709,7 @@ If you want to use flowR and the features it provides, feel free to check out th
|
|
|
709
709
|
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr)/[Positron](https://open-vsx.org/extension/code-inspect/vscode-flowr): provides access to flowR directly in VS Code and Positron (or [vscode.dev](https://vscode.dev/))
|
|
710
710
|
- [RStudio Addin](https://github.com/flowr-analysis/rstudio-addin-flowr): integrates flowR into [RStudio](https://posit.co/downloads/)
|
|
711
711
|
- [R package](https://github.com/flowr-analysis/flowr-r-adapter): use flowR in your R scripts
|
|
712
|
-
- [Docker image](https://hub.docker.com/r/eagleoutice/flowr): run flowR in a container, this also includes [flowR's server](https://github.com/flowr-analysis/flowr/wiki/
|
|
712
|
+
- [Docker image](https://hub.docker.com/r/eagleoutice/flowr): run flowR in a container, this also includes [flowR's server](https://github.com/flowr-analysis/flowr/wiki/Interface#communicating-with-the-server)
|
|
713
713
|
- [NPM package](https://www.npmjs.com/package/@eagleoutice/flowr): include flowR in your TypeScript and JavaScript projects
|
|
714
714
|
|
|
715
715
|
|
|
@@ -718,8 +718,8 @@ If you are already using flowR and want to give feedback, please consider fillin
|
|
|
718
718
|
|
|
719
719
|
## ⭐ Getting Started
|
|
720
720
|
|
|
721
|
-
To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/
|
|
722
|
-
The [Setup](https://github.com/flowr-analysis/flowr/wiki/
|
|
721
|
+
To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/Overview) wiki page.
|
|
722
|
+
The [Setup](https://github.com/flowr-analysis/flowr/wiki/Setup) wiki page explains how you can download and setup _flowR_ on your system.
|
|
723
723
|
With docker 🐳️, the following line should be enough (and drop you directly into the read-eval-print loop):
|
|
724
724
|
|
|
725
725
|
|
|
@@ -747,7 +747,7 @@ If you want to use the same commands:
|
|
|
747
747
|
## 📜 More Information
|
|
748
748
|
|
|
749
749
|
For more details on how to use _flowR_ please refer to the [wiki pages](https://github.com/flowr-analysis/flowr/wiki),
|
|
750
|
-
as well as the deployed [code documentation](https://flowr-analysis.github.io/flowr/
|
|
750
|
+
as well as the deployed [code documentation](https://flowr-analysis.github.io/flowr/doc/).
|
|
751
751
|
To cite flowR, please check out the publications below. To specifically refer to the source code,
|
|
752
752
|
please check out flowR's [Zenodo archive](https://zenodo.org/doi/10.5281/zenodo.13319290).
|
|
753
753
|
|
|
@@ -873,7 +873,7 @@ please check out the following publications (if you find that a paper is missing
|
|
|
873
873
|
|
|
874
874
|
## 🚀 Contributing
|
|
875
875
|
|
|
876
|
-
We welcome every contribution! Please check out the [developer onboarding](https://github.com/flowr-analysis/flowr/wiki/
|
|
876
|
+
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.
|
|
877
877
|
|
|
878
878
|
### Contributors
|
|
879
879
|
|
|
@@ -892,6 +892,6 @@ and received an unrestricted gift from [Posit](https://posit.co/), the open-sour
|
|
|
892
892
|
|
|
893
893
|
### Generation Notice
|
|
894
894
|
|
|
895
|
-
Please notice that this file was generated automatically using the file [src/documentation/doc-readme.ts](https://github.com/flowr-analysis/flowr/tree/main
|
|
895
|
+
Please notice that this file was generated automatically using the file [src/documentation/doc-readme.ts](https://github.com/flowr-analysis/flowr/tree/main/src/documentation/doc-readme.ts) as a source.\
|
|
896
896
|
If you want to make changes please edit the source file (the CI will take care of the rest).
|
|
897
897
|
In fact, many files in the [wiki](https://github.com/flowr-analysis/flowr/wiki) are generated, so make sure to check for the source file if you want to make changes.
|
package/config.d.ts
CHANGED
|
@@ -276,6 +276,25 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
276
276
|
readonly versionSelection?: VersionSelection;
|
|
277
277
|
/** Force an exact version for specific packages (mapping a package name to a version), overriding both the project constraint and the {@link versionSelection} policy; a version missing from the database falls back with a warning (default `{}`). */
|
|
278
278
|
readonly versionOverrides?: Record<string, string>;
|
|
279
|
+
/**
|
|
280
|
+
* Recovering a package no signature database knows (a CRAN-archived one like `maptools`) from the copy
|
|
281
|
+
* installed on this machine: its `DESCRIPTION` states the version, its `NAMESPACE` the exports. Opt-in,
|
|
282
|
+
* as it reads directories outside the analyzed project and ties the analysis to what is installed here.
|
|
283
|
+
*/
|
|
284
|
+
readonly installedLibrary?: {
|
|
285
|
+
/** Consult installed packages at all (default `false`). */
|
|
286
|
+
readonly enabled: boolean;
|
|
287
|
+
/** The library directories to search; when empty they are discovered as configured below (default `[]`). */
|
|
288
|
+
readonly paths?: string[];
|
|
289
|
+
/** Search the libraries `R_LIBS_USER`/`R_LIBS`/`R_LIBS_SITE` name (default `true`, ignored when {@link paths} is given). */
|
|
290
|
+
readonly useEnvironment?: boolean;
|
|
291
|
+
/** Search a project-local `renv`/`packrat` library (default `true`, ignored when {@link paths} is given). */
|
|
292
|
+
readonly useProjectLibrary?: boolean;
|
|
293
|
+
/** How far to descend into the nested layout of a project-local library (default `3`). */
|
|
294
|
+
readonly maxDepth?: number;
|
|
295
|
+
/** Only recover packages whose name matches one of these regular expressions; empty means any (default `[]`). */
|
|
296
|
+
readonly packages?: string[];
|
|
297
|
+
};
|
|
279
298
|
};
|
|
280
299
|
/** Policies for reasoning about dependency versions (independent of how the signature database is loaded). */
|
|
281
300
|
readonly versionManagement?: {
|
|
@@ -342,8 +361,37 @@ export interface FlowrConfig extends MergeableRecord {
|
|
|
342
361
|
};
|
|
343
362
|
};
|
|
344
363
|
};
|
|
345
|
-
readonly
|
|
346
|
-
|
|
364
|
+
readonly incremental: {
|
|
365
|
+
/**
|
|
366
|
+
* Always take the incremental path, regardless of heuristics
|
|
367
|
+
*/
|
|
368
|
+
readonly alwaysIncremental: boolean;
|
|
369
|
+
readonly parsing: {
|
|
370
|
+
readonly activated: boolean;
|
|
371
|
+
readonly heuristics: {
|
|
372
|
+
readonly activated: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Skip reparsing entirely if the file's modification time is unchanged since the last parse
|
|
375
|
+
*/
|
|
376
|
+
readonly mtime: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Only consider incremental parsing for files with at least this many lines
|
|
379
|
+
*/
|
|
380
|
+
readonly linesFrom: number;
|
|
381
|
+
/**
|
|
382
|
+
* Only consider incremental parsing for files with at least this many bytes
|
|
383
|
+
*/
|
|
384
|
+
readonly bytesFrom: number;
|
|
385
|
+
/**
|
|
386
|
+
* Always take the incremental path whenever there is a computed edit region, regardless of the other thresholds
|
|
387
|
+
*/
|
|
388
|
+
readonly alwaysWithEdits: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Only apply these heuristics once the project has at least this many files loaded
|
|
391
|
+
*/
|
|
392
|
+
readonly minFiles: number;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
347
395
|
};
|
|
348
396
|
/**
|
|
349
397
|
* Resource-usage guard (gas) configuration.
|
package/config.js
CHANGED
|
@@ -100,6 +100,7 @@ exports.FlowrDefaultPlugins = [
|
|
|
100
100
|
'file:description',
|
|
101
101
|
'versions:description',
|
|
102
102
|
'versions:sigdb',
|
|
103
|
+
'versions:library',
|
|
103
104
|
'versions:namespace',
|
|
104
105
|
'versions:renv',
|
|
105
106
|
'versions:rv',
|
|
@@ -240,7 +241,7 @@ exports.FlowrConfig = {
|
|
|
240
241
|
variables: VariableResolve.Alias,
|
|
241
242
|
evalStrings: true,
|
|
242
243
|
trackEnvironments: true,
|
|
243
|
-
sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {} },
|
|
244
|
+
sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, assumedRVersion: 'auto', linkBaseR: false, linkDescriptionDependencies: false, linkBaseRCalls: false, linkPackageCalls: false, warmInBackground: false, additionalPaths: [], autoSync: false, versionSelection: VersionSelection.Newest, versionOverrides: {}, installedLibrary: { enabled: false, paths: [], useEnvironment: true, useProjectLibrary: true, maxDepth: 3, packages: [] } },
|
|
244
245
|
versionManagement: { linkedVersionGroups: [] },
|
|
245
246
|
resolveSource: {
|
|
246
247
|
dropPaths: DropPathsOption.No,
|
|
@@ -268,8 +269,19 @@ exports.FlowrConfig = {
|
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
271
|
},
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
incremental: {
|
|
273
|
+
alwaysIncremental: false,
|
|
274
|
+
parsing: {
|
|
275
|
+
activated: false,
|
|
276
|
+
heuristics: {
|
|
277
|
+
activated: true,
|
|
278
|
+
mtime: true,
|
|
279
|
+
linesFrom: 500,
|
|
280
|
+
bytesFrom: 50_000,
|
|
281
|
+
alwaysWithEdits: false,
|
|
282
|
+
minFiles: 1,
|
|
283
|
+
}
|
|
284
|
+
}
|
|
273
285
|
},
|
|
274
286
|
gas: {
|
|
275
287
|
thresholds: {
|
|
@@ -367,6 +379,14 @@ exports.FlowrConfig = {
|
|
|
367
379
|
additionalPaths: joi_1.default.array().items(joi_1.default.string()).optional().description('Extra directories or bundle/manifest files searched for signature databases (alongside the shipped default and $FLOWR_SIGDB_DIR); a downloaded full-history bundle placed here is mounted automatically.'),
|
|
368
380
|
downloadRepo: joi_1.default.string().optional().description('GitHub owner/repo the full-history bundle is downloaded from via ":signature download" (default "flowr-analysis/flowr", release tag "sigdb-v<flowR-version>").'),
|
|
369
381
|
autoSync: joi_1.default.boolean().optional().description('On startup, re-download shards whose committed sigdb.remote.json hash no longer matches the cache, in the background (default false; opt-in network sync after a git pull).'),
|
|
382
|
+
installedLibrary: joi_1.default.object({
|
|
383
|
+
enabled: joi_1.default.boolean().required().description('Recover packages no signature database knows from their installed copy (default false).'),
|
|
384
|
+
paths: joi_1.default.array().items(joi_1.default.string()).optional().description('Library directories to search; when empty they are discovered from the environment and the project.'),
|
|
385
|
+
useEnvironment: joi_1.default.boolean().optional().description('Search the libraries R_LIBS_USER/R_LIBS/R_LIBS_SITE name (default true).'),
|
|
386
|
+
useProjectLibrary: joi_1.default.boolean().optional().description('Search a project-local renv/packrat library (default true).'),
|
|
387
|
+
maxDepth: joi_1.default.number().optional().description('How far to descend into the nested layout of a project-local library (default 3).'),
|
|
388
|
+
packages: joi_1.default.array().items(joi_1.default.string()).optional().description('Only recover packages whose name matches one of these regular expressions; empty means any.')
|
|
389
|
+
}).optional().description('Recovering packages no signature database knows from the copy installed on this machine.'),
|
|
370
390
|
versionSelection: joi_1.default.string().valid(...Object.values(VersionSelection)).optional().description('When a project constrains a dependency, resolve to the newest (default), oldest, or system-installed version satisfying it; system needs R and falls back to newest. Base-R packages always resolve against the assumed R version.'),
|
|
371
391
|
versionOverrides: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.string()).optional().description('Force an exact version for specific packages (name -> version), overriding both the project constraint and the versionSelection policy (default {}).')
|
|
372
392
|
}).description('Resolving library exports from a signature database.'),
|
|
@@ -400,8 +420,19 @@ exports.FlowrConfig = {
|
|
|
400
420
|
}).description('Configuration options for reading data frame shapes from loaded external data files, such as CSV files.')
|
|
401
421
|
}).description('The configuration of the shape inference for data frames.')
|
|
402
422
|
}).description('The configuration options for abstract interpretation.'),
|
|
403
|
-
|
|
404
|
-
|
|
423
|
+
incremental: joi_1.default.object({
|
|
424
|
+
alwaysIncremental: joi_1.default.boolean().description('Always take the incremental path, regardless of heuristics.'),
|
|
425
|
+
parsing: joi_1.default.object({
|
|
426
|
+
activated: joi_1.default.boolean().description('If set, incremental parsing will be used.'),
|
|
427
|
+
heuristics: joi_1.default.object({
|
|
428
|
+
activated: joi_1.default.boolean().optional().description('If set, the heuristics for incremental parsing will be used.'),
|
|
429
|
+
mtime: joi_1.default.boolean().optional().description('Skip reparsing entirely if the file\'s modification time is unchanged since the last parse.'),
|
|
430
|
+
linesFrom: joi_1.default.number().min(0).optional().description('Only consider incremental parsing for files with at least this many lines.'),
|
|
431
|
+
bytesFrom: joi_1.default.number().min(0).optional().description('Only consider incremental parsing for files with at least this many bytes.'),
|
|
432
|
+
alwaysWithEdits: joi_1.default.boolean().optional().description('Always take the incremental path whenever there is a computed edit region, regardless of the other thresholds.'),
|
|
433
|
+
minFiles: joi_1.default.number().min(1).optional().description('Only apply these heuristics once the project has at least this many files loaded.'),
|
|
434
|
+
}),
|
|
435
|
+
}),
|
|
405
436
|
}),
|
|
406
437
|
gas: joi_1.default.object({
|
|
407
438
|
thresholds: joi_1.default.object({
|
|
@@ -414,7 +445,7 @@ exports.FlowrConfig = {
|
|
|
414
445
|
critical: joi_1.default.number().min(0).optional().description('Elapsed ms above which Critical is returned.')
|
|
415
446
|
}).optional().description('Elapsed analysis time thresholds in milliseconds.')
|
|
416
447
|
}).optional().description('Shared thresholds for all gas checks (scaled by per-feature factor).'),
|
|
417
|
-
features: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.number().min(0).optional()).optional().description('Per-feature sensitivity factors. 0 or absent disables gas checking for that feature. A factor of 2 makes the feature twice as sensitive. Recognised keys: `source`, `side-effect-linking`, `linter`.'),
|
|
448
|
+
features: joi_1.default.object().pattern(joi_1.default.string(), joi_1.default.number().min(0).optional()).optional().description('Per-feature sensitivity factors. 0 or absent disables gas checking for that feature. A factor of 2 makes the feature twice as sensitive. Recognised keys: `source`, `side-effect-linking`, `linter`, `slicer`.'),
|
|
418
449
|
heapProvider: joi_1.default.function().optional().description('Custom heap statistics source (programmatic configs only), overriding the built-in v8/performance.memory detection.')
|
|
419
450
|
}).optional().description(`Resource-usage guard (gas) configuration. All feature factors default to 0 (disabled). See ${gas_1.GasWikiRef}.`)
|
|
420
451
|
}).description('The configuration file format for flowR.'),
|
|
@@ -46,7 +46,7 @@ function weakenName(env, name, cds) {
|
|
|
46
46
|
if (ns === undefined || current.n === ns) {
|
|
47
47
|
const defs = current.memory.get(plainName);
|
|
48
48
|
if (defs !== undefined && defs.some(d => !isBuiltInDef(d))) {
|
|
49
|
-
current.
|
|
49
|
+
current.writableMemory.set(plainName, defs.map(d => isBuiltInDef(d) ? d : weakenDefinition(d, cds)));
|
|
50
50
|
current.cache?.delete(plainName);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -60,7 +60,7 @@ function weakenAll(env, cds) {
|
|
|
60
60
|
}
|
|
61
61
|
for (const [key, defs] of env.memory) {
|
|
62
62
|
if (defs.some(d => !isBuiltInDef(d))) {
|
|
63
|
-
env.
|
|
63
|
+
env.writableMemory.set(key, defs.map(d => isBuiltInDef(d) ? d : weakenDefinition(d, cds)));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
env.cache?.clear();
|
|
@@ -76,10 +76,10 @@ function removeAllInFrame(env) {
|
|
|
76
76
|
}
|
|
77
77
|
const kept = defs.filter(isBuiltInDef);
|
|
78
78
|
if (kept.length === 0) {
|
|
79
|
-
env.
|
|
79
|
+
env.writableMemory.delete(key);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
env.
|
|
82
|
+
env.writableMemory.set(key, kept);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
env.cache?.clear();
|
|
@@ -91,7 +91,18 @@ export declare enum CallProp {
|
|
|
91
91
|
* argument marked {@link ArgProp.Bounds}. So nothing an argument carries reaches the result, which is what
|
|
92
92
|
* lets the input-sources query stop tracing at `length(x)` or `match.arg(arg, choices)`.
|
|
93
93
|
*/
|
|
94
|
-
Narrows = 4194304
|
|
94
|
+
Narrows = 4194304,
|
|
95
|
+
/**
|
|
96
|
+
* sets ambient state later calls read back: the working directory, environment variables, options, the
|
|
97
|
+
* locale, the RNG seed. The counterpart of {@link CallProp.Ambient}; a call doing both states both.
|
|
98
|
+
*/
|
|
99
|
+
Configures = 8388608,
|
|
100
|
+
/** ends what an opener started: a graphics device, a connection, a sink. Narrower than {@link CallProp.Graphics}. */
|
|
101
|
+
Closes = 16777216,
|
|
102
|
+
/** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
|
|
103
|
+
Glob = 33554432,
|
|
104
|
+
/** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
|
|
105
|
+
CommandLine = 67108864
|
|
95
106
|
}
|
|
96
107
|
/**
|
|
97
108
|
* The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
|
|
@@ -135,6 +146,18 @@ export type CallProps = number;
|
|
|
135
146
|
* by their full name only.
|
|
136
147
|
*/
|
|
137
148
|
export type FnSig = [name: string, props: ArgProps][];
|
|
149
|
+
/**
|
|
150
|
+
* Utility functions for {@link FnSig|function signatures}.
|
|
151
|
+
*/
|
|
152
|
+
export declare const FnSig: {
|
|
153
|
+
readonly name: "FnSig";
|
|
154
|
+
/** The positional view of a signature; see {@link sigLayout}. */
|
|
155
|
+
readonly layout: typeof sigLayout;
|
|
156
|
+
/** The roles of the argument at a position; see {@link argProp}. */
|
|
157
|
+
readonly propAt: typeof argProp;
|
|
158
|
+
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
159
|
+
readonly posWith: typeof argsWith;
|
|
160
|
+
};
|
|
138
161
|
/**
|
|
139
162
|
* Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
|
|
140
163
|
* have a home: the exit behavior in `cfg`, whether flowR can fold the call in the `evalHandler` of the
|
|
@@ -161,11 +184,11 @@ export interface SigLayout {
|
|
|
161
184
|
* The positional view of a {@link FnSig}, computed on first use and cached per signature object,
|
|
162
185
|
* so declaring a signature costs nothing until a call actually needs it.
|
|
163
186
|
*/
|
|
164
|
-
|
|
187
|
+
declare function sigLayout(this: void, sig: FnSig): SigLayout;
|
|
165
188
|
/** The {@link ArgProp} bits of the argument at `index`, with `...` covering every position from where it appears. */
|
|
166
|
-
|
|
189
|
+
declare function argProp(this: void, { props, rest }: SigLayout, index: number): ArgProps;
|
|
167
190
|
/** The positions of the first `count` arguments that carry any of `prop`. */
|
|
168
|
-
|
|
191
|
+
declare function argsWith(this: void, layout: SigLayout, count: number, prop: ArgProps): number[];
|
|
169
192
|
/**
|
|
170
193
|
* The part of a {@link BuiltInFnInfo} that the signature database already knows: the parameter names in order
|
|
171
194
|
* (`...` included) with the ones R always forces, plus the properties listed in {@link SigDbProps}. Everything
|
|
@@ -173,3 +196,4 @@ export declare function argsWith(layout: SigLayout, count: number, prop: ArgProp
|
|
|
173
196
|
* dropped, and anything it cannot see (purity, resources, what an argument is used for) stays unset.
|
|
174
197
|
*/
|
|
175
198
|
export declare function fnInfoFromSignature(fn: DecodedFunction): BuiltInFnInfo;
|
|
199
|
+
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropagatedProps = exports.FileInputProps = exports.SigDbInferable = exports.InputProps = exports.ExclusiveCallProps = exports.ImpureProps = exports.CallProp = exports.ArgProp = void 0;
|
|
4
|
-
exports.sigLayout = sigLayout;
|
|
5
|
-
exports.argProp = argProp;
|
|
6
|
-
exports.argsWith = argsWith;
|
|
3
|
+
exports.FnSig = exports.PropagatedProps = exports.FileInputProps = exports.SigDbInferable = exports.InputProps = exports.ExclusiveCallProps = exports.ImpureProps = exports.CallProp = exports.ArgProp = void 0;
|
|
7
4
|
exports.fnInfoFromSignature = fnInfoFromSignature;
|
|
8
5
|
/**
|
|
9
6
|
* What a single argument of a call is used for, as a bitmask.
|
|
@@ -100,6 +97,17 @@ var CallProp;
|
|
|
100
97
|
* lets the input-sources query stop tracing at `length(x)` or `match.arg(arg, choices)`.
|
|
101
98
|
*/
|
|
102
99
|
CallProp[CallProp["Narrows"] = 4194304] = "Narrows";
|
|
100
|
+
/**
|
|
101
|
+
* sets ambient state later calls read back: the working directory, environment variables, options, the
|
|
102
|
+
* locale, the RNG seed. The counterpart of {@link CallProp.Ambient}; a call doing both states both.
|
|
103
|
+
*/
|
|
104
|
+
CallProp[CallProp["Configures"] = 8388608] = "Configures";
|
|
105
|
+
/** ends what an opener started: a graphics device, a connection, a sink. Narrower than {@link CallProp.Graphics}. */
|
|
106
|
+
CallProp[CallProp["Closes"] = 16777216] = "Closes";
|
|
107
|
+
/** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
|
|
108
|
+
CallProp[CallProp["Glob"] = 33554432] = "Glob";
|
|
109
|
+
/** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
|
|
110
|
+
CallProp[CallProp["CommandLine"] = 67108864] = "CommandLine";
|
|
103
111
|
})(CallProp || (exports.CallProp = CallProp = {}));
|
|
104
112
|
/**
|
|
105
113
|
* The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
|
|
@@ -107,7 +115,8 @@ var CallProp;
|
|
|
107
115
|
*/
|
|
108
116
|
exports.ImpureProps = CallProp.MayPure | CallProp.Scope | CallProp.NonDet | CallProp.Random | CallProp.Ambient
|
|
109
117
|
| CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang
|
|
110
|
-
| CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints
|
|
118
|
+
| CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints
|
|
119
|
+
| CallProp.Configures | CallProp.Closes | CallProp.CommandLine;
|
|
111
120
|
/**
|
|
112
121
|
* Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
|
|
113
122
|
* that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}
|
|
@@ -124,7 +133,8 @@ exports.ExclusiveCallProps = [
|
|
|
124
133
|
* looks for.
|
|
125
134
|
*/
|
|
126
135
|
exports.InputProps = CallProp.NonDet | CallProp.Random | CallProp.Ambient | CallProp.File
|
|
127
|
-
| CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang | CallProp.User
|
|
136
|
+
| CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang | CallProp.User
|
|
137
|
+
| CallProp.CommandLine;
|
|
128
138
|
/**
|
|
129
139
|
* The {@link CallProp} bits the signature database states itself, so {@link fnInfoFromSignature} can read them
|
|
130
140
|
* off any package function without anyone writing them down.
|
|
@@ -141,7 +151,20 @@ exports.FileInputProps = CallProp.File | CallProp.Reads;
|
|
|
141
151
|
*/
|
|
142
152
|
exports.PropagatedProps = CallProp.Throws | CallProp.Scope | CallProp.NonDet | CallProp.Prints
|
|
143
153
|
| CallProp.Random | CallProp.Ambient | CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process
|
|
144
|
-
| CallProp.Ffi | CallProp.Lang | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes
|
|
154
|
+
| CallProp.Ffi | CallProp.Lang | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes
|
|
155
|
+
| CallProp.Configures | CallProp.CommandLine;
|
|
156
|
+
/**
|
|
157
|
+
* Utility functions for {@link FnSig|function signatures}.
|
|
158
|
+
*/
|
|
159
|
+
exports.FnSig = {
|
|
160
|
+
name: 'FnSig',
|
|
161
|
+
/** The positional view of a signature; see {@link sigLayout}. */
|
|
162
|
+
layout: sigLayout,
|
|
163
|
+
/** The roles of the argument at a position; see {@link argProp}. */
|
|
164
|
+
propAt: argProp,
|
|
165
|
+
/** The positions carrying any of the given roles; see {@link argsWith}. */
|
|
166
|
+
posWith: argsWith
|
|
167
|
+
};
|
|
145
168
|
const layouts = new WeakMap();
|
|
146
169
|
/**
|
|
147
170
|
* The positional view of a {@link FnSig}, computed on first use and cached per signature object,
|
|
@@ -169,7 +192,7 @@ function argProp({ props, rest }, index) {
|
|
|
169
192
|
function argsWith(layout, count, prop) {
|
|
170
193
|
const found = [];
|
|
171
194
|
for (let i = 0; i < count; i++) {
|
|
172
|
-
if ((
|
|
195
|
+
if ((exports.FnSig.propAt(layout, i) & prop) !== 0) {
|
|
173
196
|
found.push(i);
|
|
174
197
|
}
|
|
175
198
|
}
|