@eagleoutice/flowr 2.13.16 → 2.14.0
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/abstract-interpretation/absint-visitor.js +1 -1
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +4 -4
- package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +18 -17
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +6 -6
- package/abstract-interpretation/data-frame/resolve-args.d.ts +9 -4
- package/abstract-interpretation/data-frame/resolve-args.js +10 -5
- package/benchmark/calibration.d.ts +12 -5
- package/benchmark/calibration.js +42 -14
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +5 -4
- package/benchmark/stats/size-of.js +1 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -0
- package/benchmark/summarizer/first-phase/process.js +2 -0
- package/cli/common/options.d.ts +0 -31
- package/cli/common/options.js +1 -8
- package/cli/common/scripts-info.d.ts +0 -38
- package/cli/common/scripts-info.js +0 -8
- package/cli/repl/core.js +1 -1
- package/cli/repl/parser/slice-query-parser.js +1 -1
- package/cli/repl/print-version.js +2 -2
- package/config.d.ts +16 -0
- package/config.js +79 -0
- package/control-flow/extract-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/control-flow/useless-loop.js +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/cluster.js +2 -2
- package/dataflow/environments/built-in-props.d.ts +8 -1
- package/dataflow/environments/built-in-props.js +18 -0
- package/dataflow/environments/built-in.d.ts +7 -1
- package/dataflow/environments/built-in.js +42 -3
- package/dataflow/environments/default-builtin-config.d.ts +442 -10
- package/dataflow/environments/default-builtin-config.js +188 -18
- package/dataflow/environments/environment.d.ts +1 -1
- package/dataflow/environments/identifier.d.ts +7 -2
- package/dataflow/environments/identifier.js +6 -1
- package/dataflow/environments/query-fn-props.js +2 -2
- package/dataflow/environments/reference-to-maybe.js +5 -5
- package/dataflow/environments/resolve-by-name.d.ts +3 -0
- package/dataflow/environments/resolve-by-name.js +30 -5
- package/dataflow/environments/resolve-helper.d.ts +6 -0
- package/dataflow/environments/resolve-helper.js +6 -0
- package/dataflow/eval/resolve/alias-tracking.d.ts +5 -0
- package/dataflow/eval/resolve/alias-tracking.js +21 -14
- package/dataflow/eval/resolve/node-value.d.ts +6 -0
- package/dataflow/eval/resolve/node-value.js +15 -9
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/resolve/resolve-numbers.js +2 -2
- package/dataflow/eval/resolve/resolve-operators.js +4 -3
- package/dataflow/eval/resolve/resolve-strings.js +3 -3
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -1
- package/dataflow/eval/resolve/resolve.d.ts +5 -5
- package/dataflow/eval/resolve/resolve.js +10 -11
- package/dataflow/eval/values/general.d.ts +4 -1
- package/dataflow/eval/values/general.js +1 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/fn/exceptions-of-function.js +5 -4
- package/dataflow/fn/higher-order-function.js +5 -4
- package/dataflow/graph/call-graph.js +14 -14
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +10 -4
- package/dataflow/graph/diff-dataflow-graph.js +6 -6
- package/dataflow/graph/edge.d.ts +27 -0
- package/dataflow/graph/edge.js +33 -0
- package/dataflow/graph/graph-helper.d.ts +3 -4
- package/dataflow/graph/graph-helper.js +4 -5
- package/dataflow/graph/graph.d.ts +11 -1
- package/dataflow/graph/graph.js +16 -5
- package/dataflow/graph/vertex.d.ts +42 -6
- package/dataflow/graph/vertex.js +42 -6
- package/dataflow/internal/linker.d.ts +1 -0
- package/dataflow/internal/linker.js +11 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +19 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +15 -12
- package/dataflow/internal/process/functions/call/common.d.ts +9 -1
- package/dataflow/internal/process/functions/call/common.js +17 -6
- package/dataflow/internal/process/functions/call/deferred.js +2 -1
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +6 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +44 -12
- package/dataflow/internal/process/functions/call/nse.d.ts +33 -5
- package/dataflow/internal/process/functions/call/nse.js +113 -6
- package/dataflow/internal/process/functions/call/quoted.d.ts +5 -0
- package/dataflow/internal/process/functions/call/quoted.js +21 -9
- package/dataflow/origin/dfg-get-origin.d.ts +1 -0
- package/dataflow/origin/dfg-get-origin.js +9 -6
- package/documentation/data/faq/faqs.js +88 -88
- package/documentation/data/faq/recommended-configs.js +1 -1
- package/documentation/data/faq/wiki-faq-store.js +1 -1
- package/documentation/doc-capabilities.js +1 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-auto-gen.js +6 -2
- package/documentation/doc-util/doc-functions.js +1 -1
- package/documentation/wiki-cfg.js +2 -2
- package/documentation/wiki-create-linting-rules.js +45 -45
- package/documentation/wiki-dataflow-graph.js +17 -18
- package/documentation/wiki-linting-and-testing.js +93 -5
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-overview.js +12 -1
- package/documentation/wiki-signature-database.js +3 -0
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.js +1 -1
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/no-leaked-credentials.js +2 -1
- package/linter/rules/stop-with-call-arg.js +4 -4
- package/linter/rules/undefined-symbol-util.d.ts +1 -1
- package/linter/rules/undefined-symbol-util.js +5 -4
- package/linter/rules/undefined-symbol.js +3 -3
- package/linter/rules/unused-definition.js +2 -1
- package/package.json +35 -45
- package/project/context/flowr-analyzer-environment-context.d.ts +23 -0
- package/project/context/flowr-analyzer-environment-context.js +25 -0
- package/project/dependency-version-space.js +1 -2
- package/project/flowr-analyzer.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +3 -3
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +3 -1
- package/project/sigdb/build.js +16 -16
- package/project/sigdb/codec.d.ts +1 -1
- package/project/sigdb/codec.js +13 -13
- package/project/sigdb/decompress.d.ts +1 -1
- package/project/sigdb/decompress.js +33 -33
- package/project/sigdb/index-format.js +2 -2
- package/project/sigdb/manifest.js +21 -21
- package/project/sigdb/memory-source.d.ts +64 -0
- package/project/sigdb/memory-source.js +133 -0
- package/project/sigdb/reader.js +13 -13
- package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/dependencies-query/link-devices.js +2 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -1
- package/queries/catalog/input-sources-query/simple-input-classifier.js +4 -4
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -0
- package/queries/catalog/signature-query/signature-query-executor.js +3 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/retriever.d.ts +2 -1
- package/r-bridge/retriever.js +3 -2
- package/r-bridge/roxygen2/documentation-provider.d.ts +1 -0
- package/r-bridge/roxygen2/documentation-provider.js +1 -0
- package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
- package/r-bridge/roxygen2/roxygen-parse.js +1 -1
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-filters.js +2 -2
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.js +3 -3
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +2 -2
- package/slicing/static/static-slicer.js +4 -3
- package/util/assert.js +1 -1
- package/util/log.d.ts +4 -1
- package/util/log.js +15 -2
- package/util/logic.js +2 -2
- package/util/mermaid/cfg.js +1 -1
- package/util/mermaid/dfg.js +6 -6
- package/util/mermaid/mermaid.js +3 -1
- package/util/quads.js +19 -6
- package/util/schema.js +2 -2
- package/util/text/ansi.d.ts +2 -0
- package/util/text/ansi.js +8 -0
- package/util/text/name-rank.d.ts +29 -0
- package/util/text/name-rank.js +39 -0
- package/util/text/url-encoding.d.ts +15 -0
- package/util/text/url-encoding.js +59 -0
- package/util/version.js +1 -1
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -44
|
@@ -6,6 +6,7 @@ const r_unary_op_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r
|
|
|
6
6
|
const r_function_call_1 = require("../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
7
7
|
const identifier_1 = require("../../../../environments/identifier");
|
|
8
8
|
const data_masking_functions_1 = require("../../../../environments/data-masking-functions");
|
|
9
|
+
const graph_1 = require("../../../../graph/graph");
|
|
9
10
|
const vertex_1 = require("../../../../graph/vertex");
|
|
10
11
|
const edge_1 = require("../../../../graph/edge");
|
|
11
12
|
/** The escape a quoting function offers, a property of the function: `quote(!!x)` negates, `expr(!!x)` splices. */
|
|
@@ -39,6 +40,45 @@ function unquotedOperandOf(node, style) {
|
|
|
39
40
|
function isNegation(node) {
|
|
40
41
|
return r_unary_op_1.RUnaryOp.is(node) && node.operator === '!';
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether the definition is a bare function: the vertex itself, or a variable bound straight to a function
|
|
45
|
+
* definition. A binding that anything was done to on the way (`structure(f, class = "cls")`, `class(f) <- `)
|
|
46
|
+
* is not one, and deliberately so: such a closure carries a class, `>` may dispatch on it, and flowR cannot
|
|
47
|
+
* tell that it does not. Only where nothing at all can be attached is a function ruled out as an operand.
|
|
48
|
+
*/
|
|
49
|
+
function definesAFunction(graph, id) {
|
|
50
|
+
const vertex = graph.getVertex(id);
|
|
51
|
+
if (vertex_1.FunctionDefinitionVertex.is(vertex)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
else if (!vertex_1.VariableDefinitionVertex.is(vertex)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
58
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy) && vertex_1.FunctionDefinitionVertex.is(graph.getVertex(target))) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether `id` reads something and everything it reads is a bare function. In a data mask such a name is a
|
|
66
|
+
* column after all: R asks the data first, and a plain closure is not what `id > 2` compares. A closure that
|
|
67
|
+
* was given a class is left alone, see {@link definesAFunction}.
|
|
68
|
+
*/
|
|
69
|
+
function readsOnlyFunctions(graph, id) {
|
|
70
|
+
let reads = false;
|
|
71
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
72
|
+
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
else if (!definesAFunction(graph, target)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
reads = true;
|
|
79
|
+
}
|
|
80
|
+
return reads;
|
|
81
|
+
}
|
|
42
82
|
/** The parts of a call R does not evaluate the standard way. */
|
|
43
83
|
exports.Nse = {
|
|
44
84
|
name: 'Nse',
|
|
@@ -65,24 +105,91 @@ exports.Nse = {
|
|
|
65
105
|
isUnquote(node, style) {
|
|
66
106
|
return style !== Unquote.None && unquotedOperandOf(node, style) !== undefined;
|
|
67
107
|
},
|
|
68
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Drops the mask mark from names the caller binds to a value: while `filter(d, k)` is processed `k` has no
|
|
110
|
+
* read yet. A name bound to a function keeps its mark, as `filter(d, id > 2)` next to `id <- function(...)`
|
|
111
|
+
* still means the column. Hands back the masking call and the names it just unmarked, `undefined` when
|
|
112
|
+
* `name` does not mask at all, so {@link linkMasksToData} need not ask a second time.
|
|
113
|
+
*/
|
|
69
114
|
dropResolvedMask(graph, id, name) {
|
|
70
|
-
if (data_masking_functions_1.DataMaskingFunctionNames.has(identifier_1.Identifier.getName(name))) {
|
|
71
|
-
|
|
115
|
+
if (!data_masking_functions_1.DataMaskingFunctionNames.has(identifier_1.Identifier.getName(name))) {
|
|
116
|
+
return undefined;
|
|
72
117
|
}
|
|
118
|
+
return { id, bound: exports.Nse.unmark(graph, id, target => !exports.Nse.suppliedByMask(graph, target) && !readsOnlyFunctions(graph, target)) };
|
|
73
119
|
},
|
|
74
|
-
/** Drops the non-standard-evaluation mark from the outgoing edges of `id` that `which` accepts. */
|
|
120
|
+
/** Drops the non-standard-evaluation mark from the outgoing edges of `id` that `which` accepts, and reports them. */
|
|
75
121
|
unmark(graph, id, which = () => true) {
|
|
76
|
-
const
|
|
77
|
-
for (const [target, edge] of
|
|
122
|
+
const dropped = [];
|
|
123
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
78
124
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation) && which(target)) {
|
|
79
125
|
graph.removeEdgeType(id, target, edge_1.EdgeType.NonStandardEvaluation);
|
|
126
|
+
dropped.push(target);
|
|
80
127
|
}
|
|
81
128
|
}
|
|
129
|
+
return dropped;
|
|
130
|
+
},
|
|
131
|
+
/** Whether the vertex is a name a data mask may supply, which is every name appearing in the mask. */
|
|
132
|
+
maskCandidate(vertex) {
|
|
133
|
+
return vertex_1.UseVertex.is(vertex);
|
|
82
134
|
},
|
|
83
135
|
/** Whether `id` is a name the data mask supplies, i.e. a use the caller does not bind itself. */
|
|
84
136
|
suppliedByMask(graph, id, vertex = graph.getVertex(id)) {
|
|
85
137
|
return vertex_1.UseVertex.is(vertex) && !graph.outgoingEdges(id)?.values().some(e => edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads));
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Whether `id` is a name a data mask supplied, which the mark the masking call carries is what records.
|
|
141
|
+
* Unlike {@link suppliedByMask} this survives {@link linkMasksToData}, so ask this one after the dataflow
|
|
142
|
+
* is complete and that one while a call is still being processed.
|
|
143
|
+
*/
|
|
144
|
+
maskedName(graph, id) {
|
|
145
|
+
for (const [source, edge] of graph.ingoingEdges(id) ?? graph_1.NoEdges) {
|
|
146
|
+
const call = edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation) ? graph.getVertex(source) : undefined;
|
|
147
|
+
if (vertex_1.FunctionCallVertex.is(call) && call.name !== undefined && data_masking_functions_1.DataMaskingFunctionNames.has(identifier_1.Identifier.getName(call.name))) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Links every name the data masks of `calls` supply to the data it comes from: `id` in `filter(df, id > 2)`
|
|
155
|
+
* is a column of `df`, so it reads `df`. Run once every mark has settled, as adding the read makes
|
|
156
|
+
* {@link suppliedByMask} false for the name; a call whose first argument is masked too has no data to link
|
|
157
|
+
* against.
|
|
158
|
+
*/
|
|
159
|
+
linkMasksToData(graph, calls) {
|
|
160
|
+
const links = [];
|
|
161
|
+
for (const { id, bound } of calls) {
|
|
162
|
+
const call = graph.getVertex(id);
|
|
163
|
+
const data = vertex_1.FunctionCallVertex.is(call) ? call.args.find(a => a !== r_function_call_1.EmptyArgument) : undefined;
|
|
164
|
+
if (data === undefined) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
/* what is still marked are the names the data supplies, the unmarked ones mean the binding too */
|
|
168
|
+
const masked = new Set(bound);
|
|
169
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
170
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)) {
|
|
171
|
+
masked.add(target);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/* a call masking its first argument too, like `aes(x, y)`, has no data to link against */
|
|
175
|
+
if (masked.has(data.nodeId)) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
for (const target of masked) {
|
|
179
|
+
/* a function of that name is not what the mask means, so the column takes its place */
|
|
180
|
+
if (readsOnlyFunctions(graph, target)) {
|
|
181
|
+
for (const [definition, edge] of graph.outgoingEdges(target) ?? graph_1.NoEdges) {
|
|
182
|
+
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads)) {
|
|
183
|
+
graph.removeEdgeType(target, definition, edge_1.EdgeType.Reads);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
links.push([target, data.nodeId]);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
for (const [from, to] of links) {
|
|
191
|
+
graph.addEdge(from, to, edge_1.EdgeType.Reads);
|
|
192
|
+
}
|
|
86
193
|
}
|
|
87
194
|
};
|
|
88
195
|
//# sourceMappingURL=nse.js.map
|
|
@@ -6,6 +6,11 @@ import { linkExpressionIn } from '../../../linker';
|
|
|
6
6
|
/**
|
|
7
7
|
* A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
|
|
8
8
|
* in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* Quoted.capturedBy(graph, id); // the expression a `quote(...)` holds on to
|
|
12
|
+
* Quoted.sourcesOf(graph, id); // every expression the value at `id` may hold
|
|
13
|
+
* ```
|
|
9
14
|
*/
|
|
10
15
|
export declare const Quoted: {
|
|
11
16
|
readonly name: "Quoted";
|
|
@@ -12,6 +12,7 @@ const vertex_1 = require("../../../../graph/vertex");
|
|
|
12
12
|
const linker_1 = require("../../../linker");
|
|
13
13
|
const nse_1 = require("./nse");
|
|
14
14
|
const deferred_1 = require("./deferred");
|
|
15
|
+
const vertex_2 = require("../../../../graph/vertex");
|
|
15
16
|
/** Calls capturing a language object. */
|
|
16
17
|
const CapturingProcessors = [built_in_proc_name_1.BuiltInProcName.Quote];
|
|
17
18
|
/** Calls capturing an expression as a promise, forced at some later read of the variable they bind. */
|
|
@@ -26,6 +27,11 @@ function hasOrigin(vertex, of) {
|
|
|
26
27
|
/**
|
|
27
28
|
* A language object reads nothing where it is written and everything where it reaches `eval`, with the bindings
|
|
28
29
|
* in effect there. Working on the finished graph makes assignments, branches, loops, and calls one traversal.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* Quoted.capturedBy(graph, id); // the expression a `quote(...)` holds on to
|
|
33
|
+
* Quoted.sourcesOf(graph, id); // every expression the value at `id` may hold
|
|
34
|
+
* ```
|
|
29
35
|
*/
|
|
30
36
|
exports.Quoted = {
|
|
31
37
|
name: 'Quoted',
|
|
@@ -46,7 +52,7 @@ exports.Quoted = {
|
|
|
46
52
|
found.push({ expr: captured, at: current });
|
|
47
53
|
continue;
|
|
48
54
|
}
|
|
49
|
-
for (const [target, edge] of graph.outgoingEdges(current) ??
|
|
55
|
+
for (const [target, edge] of graph.outgoingEdges(current) ?? graph_1.NoEdges) {
|
|
50
56
|
if (edge_1.DfEdge.includesType(edge, ValueFlow) && !seen.has(target)) {
|
|
51
57
|
seen.add(target);
|
|
52
58
|
pending.push(target);
|
|
@@ -66,8 +72,12 @@ exports.Quoted = {
|
|
|
66
72
|
let names = undefined;
|
|
67
73
|
let cfg = null;
|
|
68
74
|
const cfgOnce = () => (cfg === null ? (cfg = controlFlow()) : cfg);
|
|
75
|
+
const masking = [];
|
|
69
76
|
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
70
|
-
nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
|
|
77
|
+
const masks = nse_1.Nse.dropResolvedMask(graph, id, vertex.name);
|
|
78
|
+
if (masks !== undefined) {
|
|
79
|
+
masking.push(masks);
|
|
80
|
+
}
|
|
71
81
|
if (DelayingCalls.has(identifier_1.Identifier.getName(vertex.name))) {
|
|
72
82
|
const promise = capturedArgumentOf(graph, id);
|
|
73
83
|
const binding = promise === undefined ? undefined : boundBy(graph, id);
|
|
@@ -89,11 +99,13 @@ exports.Quoted = {
|
|
|
89
99
|
}
|
|
90
100
|
}
|
|
91
101
|
}
|
|
102
|
+
/* only once every mark has settled: the read a column gets makes it look bound from here on */
|
|
103
|
+
nse_1.Nse.linkMasksToData(graph, masking);
|
|
92
104
|
}
|
|
93
105
|
};
|
|
94
106
|
/** The name a delaying call binds, which is the definition its reads have to go through. */
|
|
95
107
|
function boundBy(graph, id) {
|
|
96
|
-
for (const [target, edge] of graph.ingoingEdges(id) ??
|
|
108
|
+
for (const [target, edge] of graph.ingoingEdges(id) ?? graph_1.NoEdges) {
|
|
97
109
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy) && vertex_1.VariableDefinitionVertex.is(graph.getVertex(target))) {
|
|
98
110
|
return target;
|
|
99
111
|
}
|
|
@@ -102,7 +114,7 @@ function boundBy(graph, id) {
|
|
|
102
114
|
}
|
|
103
115
|
/** The argument a call takes but does not evaluate, which is the one it captured. */
|
|
104
116
|
function capturedArgumentOf(graph, id) {
|
|
105
|
-
for (const [target, edge] of graph.outgoingEdges(id) ??
|
|
117
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
106
118
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Argument) && edge_1.DfEdge.includesType(edge, edge_1.EdgeType.NonStandardEvaluation)) {
|
|
107
119
|
return target;
|
|
108
120
|
}
|
|
@@ -137,23 +149,23 @@ function resolveEvaluation(graph, call, environment, idMap, names, cfg) {
|
|
|
137
149
|
* body itself (what `force` is for) is settled during the call and stays where it is.
|
|
138
150
|
*/
|
|
139
151
|
function* escapingArguments(graph, id) {
|
|
140
|
-
for (const [target, edge] of graph.outgoingEdges(id) ??
|
|
152
|
+
for (const [target, edge] of graph.outgoingEdges(id) ?? graph_1.NoEdges) {
|
|
141
153
|
if (!edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Calls)) {
|
|
142
154
|
continue;
|
|
143
155
|
}
|
|
144
156
|
const callee = graph.getVertex(target);
|
|
145
|
-
if (
|
|
157
|
+
if (!vertex_2.FunctionDefinitionVertex.is(callee)) {
|
|
146
158
|
continue;
|
|
147
159
|
}
|
|
148
160
|
for (const exit of callee.exitPoints) {
|
|
149
161
|
const closure = graph.getVertex(exit.nodeId);
|
|
150
|
-
if (
|
|
162
|
+
if (!vertex_2.FunctionDefinitionVertex.is(closure)) {
|
|
151
163
|
continue;
|
|
152
164
|
}
|
|
153
165
|
for (const key of Object.keys(callee.params)) {
|
|
154
166
|
const parameter = node_id_1.NodeId.normalize(key);
|
|
155
167
|
let escapes = true;
|
|
156
|
-
for (const [reader, edge] of graph.ingoingEdges(parameter) ??
|
|
168
|
+
for (const [reader, edge] of graph.ingoingEdges(parameter) ?? graph_1.NoEdges) {
|
|
157
169
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.Reads) && !closure.subflow.graph.has(reader)) {
|
|
158
170
|
escapes = false;
|
|
159
171
|
break;
|
|
@@ -162,7 +174,7 @@ function* escapingArguments(graph, id) {
|
|
|
162
174
|
if (!escapes) {
|
|
163
175
|
continue;
|
|
164
176
|
}
|
|
165
|
-
for (const [argument, edge] of graph.outgoingEdges(parameter) ??
|
|
177
|
+
for (const [argument, edge] of graph.outgoingEdges(parameter) ?? graph_1.NoEdges) {
|
|
166
178
|
if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedByOnCall)) {
|
|
167
179
|
yield argument;
|
|
168
180
|
}
|
|
@@ -75,6 +75,7 @@ export type Origin = SimpleOrigin | FunctionCallOrigin | BuiltInFunctionOrigin;
|
|
|
75
75
|
* Similarly, requesting the origin of `print` returns a {@link BuiltInFunctionOrigin|`BuiltInFunctionOrigin`}.
|
|
76
76
|
*
|
|
77
77
|
* This returns undefined only if there is no dataflow correspondence (e.g. in case of unevaluated non-standard eval).
|
|
78
|
+
* @useInstead {@link Dataflow.origin}
|
|
78
79
|
*/
|
|
79
80
|
export declare function getOriginInDfg(this: void, dfg: DataflowGraph, id: NodeId): Origin[] | undefined;
|
|
80
81
|
export {};
|
|
@@ -6,6 +6,8 @@ const vertex_1 = require("../graph/vertex");
|
|
|
6
6
|
const edge_1 = require("../graph/edge");
|
|
7
7
|
const linker_1 = require("../internal/linker");
|
|
8
8
|
const assert_1 = require("../../util/assert");
|
|
9
|
+
const vertex_2 = require("../graph/vertex");
|
|
10
|
+
const graph_1 = require("../graph/graph");
|
|
9
11
|
/**
|
|
10
12
|
* Obtain the (dataflow) origin of a given node in the dfg.
|
|
11
13
|
* @example consider the following code:
|
|
@@ -21,6 +23,7 @@ const assert_1 = require("../../util/assert");
|
|
|
21
23
|
* Similarly, requesting the origin of `print` returns a {@link BuiltInFunctionOrigin|`BuiltInFunctionOrigin`}.
|
|
22
24
|
*
|
|
23
25
|
* This returns undefined only if there is no dataflow correspondence (e.g. in case of unevaluated non-standard eval).
|
|
26
|
+
* @useInstead {@link Dataflow.origin}
|
|
24
27
|
*/
|
|
25
28
|
function getOriginInDfg(dfg, id) {
|
|
26
29
|
const vtx = dfg.getVertex(id);
|
|
@@ -44,7 +47,7 @@ const UnwantedVariableTypes = edge_1.EdgeType.NonStandardEvaluation;
|
|
|
44
47
|
function getVariableUseOrigin(dfg, use) {
|
|
45
48
|
// to identify the origins we have to track read edges and definitions on function calls
|
|
46
49
|
const origins = [];
|
|
47
|
-
for (const [target, e] of dfg.outgoingEdges(use.id) ??
|
|
50
|
+
for (const [target, e] of dfg.outgoingEdges(use.id) ?? graph_1.NoEdges) {
|
|
48
51
|
if (edge_1.DfEdge.doesNotIncludeType(e, WantedVariableTypes) || edge_1.DfEdge.includesType(e, UnwantedVariableTypes)) {
|
|
49
52
|
continue;
|
|
50
53
|
}
|
|
@@ -52,7 +55,7 @@ function getVariableUseOrigin(dfg, use) {
|
|
|
52
55
|
if (!targetVtx) {
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
55
|
-
if (
|
|
58
|
+
if (vertex_2.VariableDefinitionVertex.is(targetVtx)) {
|
|
56
59
|
origins.push({
|
|
57
60
|
type: 0 /* OriginType.ReadVariableOrigin */,
|
|
58
61
|
id: target
|
|
@@ -63,14 +66,14 @@ function getVariableUseOrigin(dfg, use) {
|
|
|
63
66
|
}
|
|
64
67
|
function getVariableDefinitionOrigin(dfg, vtx) {
|
|
65
68
|
const pool = [{ type: 1 /* OriginType.WriteVariableOrigin */, id: vtx.id }];
|
|
66
|
-
const outgoingReads = dfg.outgoingEdges(vtx.id) ??
|
|
69
|
+
const outgoingReads = dfg.outgoingEdges(vtx.id) ?? graph_1.NoEdges;
|
|
67
70
|
for (const [target, e] of outgoingReads) {
|
|
68
71
|
if (edge_1.DfEdge.includesType(e, edge_1.EdgeType.Reads)) {
|
|
69
72
|
const targetVtx = dfg.getVertex(target);
|
|
70
73
|
if (!targetVtx) {
|
|
71
74
|
continue;
|
|
72
75
|
}
|
|
73
|
-
if (
|
|
76
|
+
if (vertex_2.VariableDefinitionVertex.is(targetVtx)) {
|
|
74
77
|
pool.push({
|
|
75
78
|
type: 0 /* OriginType.ReadVariableOrigin */,
|
|
76
79
|
id: target
|
|
@@ -104,11 +107,11 @@ function getCallTarget(dfg, call) {
|
|
|
104
107
|
};
|
|
105
108
|
}
|
|
106
109
|
const get = dfg.getVertex(target);
|
|
107
|
-
if (
|
|
110
|
+
if (!vertex_2.FunctionDefinitionVertex.is(get) && !vertex_2.VariableDefinitionVertex.is(get)) {
|
|
108
111
|
return undefined;
|
|
109
112
|
}
|
|
110
113
|
return {
|
|
111
|
-
type:
|
|
114
|
+
type: vertex_2.FunctionDefinitionVertex.is(get) ? 2 /* OriginType.FunctionCallOrigin */ : 0 /* OriginType.ReadVariableOrigin */,
|
|
112
115
|
id: target
|
|
113
116
|
};
|
|
114
117
|
}).filter(assert_1.isNotUndefined));
|
|
@@ -15,119 +15,119 @@ const log_2 = require("../../../util/log");
|
|
|
15
15
|
function registerFaqs(ctx) {
|
|
16
16
|
const wikiFaq = new wiki_faq_store_1.FaqStore();
|
|
17
17
|
wikiFaq.withTopic('flowr.development')
|
|
18
|
-
.addFaq('What are *test labels*?', `
|
|
19
|
-
Tests are labeled based on the *flowR* capabilities that they test for.
|
|
20
|
-
The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
|
|
21
|
-
For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
|
|
18
|
+
.addFaq('What are *test labels*?', `
|
|
19
|
+
Tests are labeled based on the *flowR* capabilities that they test for.
|
|
20
|
+
The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
|
|
21
|
+
For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
|
|
22
22
|
`)
|
|
23
|
-
.addFaq('How do I run *all checks* before pushing?', `
|
|
24
|
-
Run \`npm run checkup\`: it runs the linter, the functionality and system tests, the wiki generation, and the docker image build + smoke test concurrently, then prints one pass/fail summary.
|
|
25
|
-
Run a subset with the job ids (e.g. \`npm run checkup -- lint tests\`) or skip the container build with \`npm run checkup -- --no-docker\`.
|
|
23
|
+
.addFaq('How do I run *all checks* before pushing?', `
|
|
24
|
+
Run \`npm run checkup\`: it runs the linter, the functionality and system tests, the wiki generation, and the docker image build + smoke test concurrently, then prints one pass/fail summary.
|
|
25
|
+
Run a subset with the job ids (e.g. \`npm run checkup -- lint tests\`) or skip the container build with \`npm run checkup -- --no-docker\`.
|
|
26
26
|
`)
|
|
27
|
-
.addFaq('How to get a REPL with debug-info/*hot-reload*?', `
|
|
28
|
-
To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
|
|
29
|
-
this will use an unminified build (keeping debug info) and also watches the source files for changes.
|
|
30
|
-
In case of a change, this mode automatically recompiles.
|
|
31
|
-
Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
|
|
27
|
+
.addFaq('How to get a REPL with debug-info/*hot-reload*?', `
|
|
28
|
+
To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
|
|
29
|
+
this will use an unminified build (keeping debug info) and also watches the source files for changes.
|
|
30
|
+
In case of a change, this mode automatically recompiles.
|
|
31
|
+
Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
|
|
32
32
|
`)
|
|
33
|
-
.addFaq('How to generate *mermaid diagrams*?', `
|
|
34
|
-
There are several ways to generate mermaid diagrams based on the input data that you want to use.
|
|
35
|
-
- From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
|
|
36
|
-
- From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
|
|
37
|
-
- From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
|
|
33
|
+
.addFaq('How to generate *mermaid diagrams*?', `
|
|
34
|
+
There are several ways to generate mermaid diagrams based on the input data that you want to use.
|
|
35
|
+
- From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
|
|
36
|
+
- From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
|
|
37
|
+
- From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
|
|
38
38
|
`)
|
|
39
|
-
.addFaq('How to create *new wiki* pages?', `
|
|
40
|
-
To create an automatically generated wiki page, you can follow these steps:
|
|
41
|
-
- Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
|
|
42
|
-
- Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
|
|
43
|
-
|
|
44
|
-
You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
|
|
45
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
|
|
46
|
-
Alternatively use the following to generate a specific wiki page:
|
|
47
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
|
|
48
|
-
Or, activate the watch mode to automatically regenerate the wiki on changes:
|
|
49
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
|
|
50
|
-
|
|
39
|
+
.addFaq('How to create *new wiki* pages?', `
|
|
40
|
+
To create an automatically generated wiki page, you can follow these steps:
|
|
41
|
+
- Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
|
|
42
|
+
- Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
|
|
43
|
+
|
|
44
|
+
You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
|
|
45
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
|
|
46
|
+
Alternatively use the following to generate a specific wiki page:
|
|
47
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
|
|
48
|
+
Or, activate the watch mode to automatically regenerate the wiki on changes:
|
|
49
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
|
|
50
|
+
|
|
51
51
|
`)
|
|
52
|
-
.addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
|
|
53
|
-
With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
|
|
54
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run flowr -- --help')}
|
|
52
|
+
.addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
|
|
53
|
+
With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
|
|
54
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run flowr -- --help')}
|
|
55
55
|
`)
|
|
56
|
-
.addFaq('How to do *logging* in flowR?', `
|
|
57
|
-
Check out the ${ctx.linkPage('wiki/Linting and Testing', 'Logging Section in the Linting and Testing wiki page', 'logging')} for more information on how to do logging in *flowR*.
|
|
56
|
+
.addFaq('How to do *logging* in flowR?', `
|
|
57
|
+
Check out the ${ctx.linkPage('wiki/Linting and Testing', 'Logging Section in the Linting and Testing wiki page', 'logging')} for more information on how to do logging in *flowR*.
|
|
58
58
|
`)
|
|
59
|
-
.addFaq('How to get flowR to *talk*?', `
|
|
60
|
-
When using flowR from the CLI, you can use the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} option to get more information about what flowR is doing.
|
|
61
|
-
While coding, however, you can use the ${ctx.link(log_1.setMinLevelOfAllLogs)} function to set the minimum level of logs to be displayed (this works with the ${ctx.link(log_2.FlowrLogger)} abstraction).
|
|
62
|
-
In general, you can configure the levels of individual logs, such as the general \`log\` (obtained with ${ctx.link('getActiveLog')}) or the ${ctx.link('parseLog')}.
|
|
63
|
-
Please note that flowR makes no guarantees that log outputs are persistent across versions, and it is up to the implementors to provide sensible logging.
|
|
64
|
-
If you are an implementor and want to add logging, please make sure there are no larger runtime implications when logging is disabled.
|
|
65
|
-
Have a look at the ${ctx.link(log_2.expensiveTrace)} function for example, which uses a function to generate the log message only when the log level is reached.
|
|
59
|
+
.addFaq('How to get flowR to *talk*?', `
|
|
60
|
+
When using flowR from the CLI, you can use the ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'verbose')} option to get more information about what flowR is doing.
|
|
61
|
+
While coding, however, you can use the ${ctx.link(log_1.setMinLevelOfAllLogs)} function to set the minimum level of logs to be displayed (this works with the ${ctx.link(log_2.FlowrLogger)} abstraction).
|
|
62
|
+
In general, you can configure the levels of individual logs, such as the general \`log\` (obtained with ${ctx.link('getActiveLog')}) or the ${ctx.link('parseLog')}.
|
|
63
|
+
Please note that flowR makes no guarantees that log outputs are persistent across versions, and it is up to the implementors to provide sensible logging.
|
|
64
|
+
If you are an implementor and want to add logging, please make sure there are no larger runtime implications when logging is disabled.
|
|
65
|
+
Have a look at the ${ctx.link(log_2.expensiveTrace)} function for example, which uses a function to generate the log message only when the log level is reached.
|
|
66
66
|
`)
|
|
67
|
-
.addFaq('How to run *tests* with *verbose* logging?', `
|
|
68
|
-
Use the dedicated npm script to run all tests with trace-level log output:
|
|
69
|
-
${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
|
|
70
|
-
Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
|
|
71
|
-
${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
|
|
72
|
-
Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
|
|
67
|
+
.addFaq('How to run *tests* with *verbose* logging?', `
|
|
68
|
+
Use the dedicated npm script to run all tests with trace-level log output:
|
|
69
|
+
${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
|
|
70
|
+
Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
|
|
71
|
+
${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
|
|
72
|
+
Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
|
|
73
73
|
`)
|
|
74
|
-
.addFaq('How to add a *linting rule*?', `
|
|
75
|
-
To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
|
|
74
|
+
.addFaq('How to add a *linting rule*?', `
|
|
75
|
+
To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
|
|
76
76
|
`);
|
|
77
77
|
wikiFaq.withTopic('flowr.use')
|
|
78
|
-
.addFaq('How to *watch* a file for changes in the REPL?', `
|
|
79
|
-
Replace the \`file://\` prefix with \`watch://\` when passing a path to any REPL command.
|
|
80
|
-
flowR will run the command immediately and then re-run it every time the file (or any file inside the specified folder) changes.
|
|
81
|
-
Press Ctrl+C or enter any other command to leave watch mode.
|
|
82
|
-
${(0, doc_code_1.codeBlock)('shell', ':df watch://path/to/analysis.R')}
|
|
83
|
-
For a folder, flowR uses the same project discovery as with \`file://\`:
|
|
84
|
-
${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
|
|
78
|
+
.addFaq('How to *watch* a file for changes in the REPL?', `
|
|
79
|
+
Replace the \`file://\` prefix with \`watch://\` when passing a path to any REPL command.
|
|
80
|
+
flowR will run the command immediately and then re-run it every time the file (or any file inside the specified folder) changes.
|
|
81
|
+
Press Ctrl+C or enter any other command to leave watch mode.
|
|
82
|
+
${(0, doc_code_1.codeBlock)('shell', ':df watch://path/to/analysis.R')}
|
|
83
|
+
For a folder, flowR uses the same project discovery as with \`file://\`:
|
|
84
|
+
${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
|
|
85
85
|
`)
|
|
86
|
-
.addFaq('How to *query* an R project?', `
|
|
87
|
-
For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
|
|
88
|
-
If you want to create your own project using flowR as a library, check out the
|
|
89
|
-
[${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
|
|
86
|
+
.addFaq('How to *query* an R project?', `
|
|
87
|
+
For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
|
|
88
|
+
If you want to create your own project using flowR as a library, check out the
|
|
89
|
+
[${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
|
|
90
90
|
`)
|
|
91
|
-
.addFaq('How to configure flowR *per kind of project*?', `
|
|
92
|
-
Use ${ctx.linkConfig('specializeConfig')}: it overwrites (parts of) the configuration depending on the kind of project flowR detects (e.g. \`${project_kind_1.ProjectKind.ShinyApp}\`).
|
|
93
|
-
This is how a shiny app gets its ${ctx.linkConfig('project.implicitSources')} out of the box, as shiny loads these files without any \`source()\` call:
|
|
91
|
+
.addFaq('How to configure flowR *per kind of project*?', `
|
|
92
|
+
Use ${ctx.linkConfig('specializeConfig')}: it overwrites (parts of) the configuration depending on the kind of project flowR detects (e.g. \`${project_kind_1.ProjectKind.ShinyApp}\`).
|
|
93
|
+
This is how a shiny app gets its ${ctx.linkConfig('project.implicitSources')} out of the box, as shiny loads these files without any \`source()\` call:
|
|
94
94
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify({
|
|
95
95
|
specializeConfig: {
|
|
96
96
|
[project_kind_1.ProjectKind.ShinyApp]: { project: { implicitSources: ['global.R', 'ui.R', 'server.R', 'app.R'] } }
|
|
97
97
|
}
|
|
98
|
-
}, null, 2))}
|
|
99
|
-
Anything you configure directly wins over the value the project kind defaults to, so setting \`project.implicitSources\` yourself overrides the list above.
|
|
98
|
+
}, null, 2))}
|
|
99
|
+
Anything you configure directly wins over the value the project kind defaults to, so setting \`project.implicitSources\` yourself overrides the list above.
|
|
100
100
|
`);
|
|
101
101
|
wikiFaq.withTopic('r.packages')
|
|
102
|
-
.addFaq('What is the R *prelude* and R *base* package?', `
|
|
103
|
-
The base package contains lots of base functions like \`source\` for example.
|
|
104
|
-
The R prelude includes the base package along with several other packages.
|
|
105
|
-
Packages that were loaded by the prelude can be called without prefixing the
|
|
106
|
-
function call with the package name and the \`::\` operator.
|
|
107
|
-
|
|
108
|
-
The packages loaded by the R prelude can be seen in the \`attached base packages\`
|
|
109
|
-
sections in the output of \`sessionInfo()\`.
|
|
102
|
+
.addFaq('What is the R *prelude* and R *base* package?', `
|
|
103
|
+
The base package contains lots of base functions like \`source\` for example.
|
|
104
|
+
The R prelude includes the base package along with several other packages.
|
|
105
|
+
Packages that were loaded by the prelude can be called without prefixing the
|
|
106
|
+
function call with the package name and the \`::\` operator.
|
|
107
|
+
|
|
108
|
+
The packages loaded by the R prelude can be seen in the \`attached base packages\`
|
|
109
|
+
sections in the output of \`sessionInfo()\`.
|
|
110
110
|
`)
|
|
111
|
-
.addFaq('How to get *documentation* for a function or package?', `
|
|
112
|
-
There are a couple of ways to get documentation for a function or package.
|
|
113
|
-
|
|
114
|
-
🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
|
|
115
|
-
relevant documentation. If you don't know the origin of the package, you can use
|
|
116
|
-
\`??<function name>\` in an R shell to fuzzy find all documentations containing
|
|
117
|
-
\`<function name>\` or something similar.
|
|
118
|
-
|
|
119
|
-
🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
|
|
120
|
-
or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
|
|
121
|
-
be downloaded directly from [cran](https://cran.r-project.org/).
|
|
111
|
+
.addFaq('How to get *documentation* for a function or package?', `
|
|
112
|
+
There are a couple of ways to get documentation for a function or package.
|
|
113
|
+
|
|
114
|
+
🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
|
|
115
|
+
relevant documentation. If you don't know the origin of the package, you can use
|
|
116
|
+
\`??<function name>\` in an R shell to fuzzy find all documentations containing
|
|
117
|
+
\`<function name>\` or something similar.
|
|
118
|
+
|
|
119
|
+
🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
|
|
120
|
+
or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
|
|
121
|
+
be downloaded directly from [cran](https://cran.r-project.org/).
|
|
122
122
|
`)
|
|
123
|
-
.addFaq('How does flowR know a *package\'s exports*?', `
|
|
124
|
-
See the ${ctx.linkPage('wiki/Signature Database', 'Signature Database')} wiki page.
|
|
123
|
+
.addFaq('How does flowR know a *package\'s exports*?', `
|
|
124
|
+
See the ${ctx.linkPage('wiki/Signature Database', 'Signature Database')} wiki page.
|
|
125
125
|
`);
|
|
126
126
|
wikiFaq.withTopic('editor.configs')
|
|
127
|
-
.addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
|
|
127
|
+
.addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
|
|
128
128
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedZedConfig, null, 2))}`);
|
|
129
129
|
wikiFaq.withTopic('editor.configs')
|
|
130
|
-
.addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
|
|
130
|
+
.addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
|
|
131
131
|
${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedVsCodeTask, null, 2))}`);
|
|
132
132
|
return wikiFaq;
|
|
133
133
|
}
|
|
@@ -25,7 +25,7 @@ class FaqStore {
|
|
|
25
25
|
(0, assert_1.guard)(this.currTopic !== undefined, 'Current topic is not set use withTopic first');
|
|
26
26
|
question = question.replace(/\*([^*]+)\*/g, '<b>$1</b>');
|
|
27
27
|
const store = this.faqs.get(this.currTopic);
|
|
28
|
-
if (store.
|
|
28
|
+
if (store.some(([q]) => q === question)) {
|
|
29
29
|
throw new Error(`FAQ for question "${question}" in topic "${this.currTopic}" already exists`);
|
|
30
30
|
}
|
|
31
31
|
store.push([question, answer]);
|
|
@@ -162,7 +162,7 @@ class DocCapabilities extends doc_maker_1.DocMaker {
|
|
|
162
162
|
async text({ treeSitter }) {
|
|
163
163
|
/* check if the detailed test data is available */
|
|
164
164
|
if (!fs_1.default.existsSync(detailedInfoFile)) {
|
|
165
|
-
console.warn('\x1b[31mNo detailed test data available. Run the full tests (npm run test
|
|
165
|
+
console.warn('\x1b[31mNo detailed test data available. Run the full tests (npm run test:full) to generate it.\x1b[m');
|
|
166
166
|
}
|
|
167
167
|
return getPreamble() + await printAsMarkdown({ parser: treeSitter, info: obtainDetailedInfos() }, data_1.flowrCapabilities.capabilities);
|
|
168
168
|
}
|
|
@@ -133,7 +133,7 @@ class DocReadme extends doc_maker_1.DocMaker {
|
|
|
133
133
|
async text({ treeSitter, ctx }) {
|
|
134
134
|
const dateOptions = { year: 'numeric', month: 'short', day: 'numeric' };
|
|
135
135
|
return `
|
|
136
|
-
[](${doc_files_1.
|
|
136
|
+
[](${doc_files_1.FlowrSiteBaseRef}/)\\
|
|
137
137
|
[](${doc_files_1.FlowrGithubBaseRef}/flowr/actions/workflows/qa.yaml)
|
|
138
138
|
[](https://codecov.io/gh/flowr-analysis/flowr)
|
|
139
139
|
[](${doc_files_1.FlowrDockerRef})
|
|
@@ -8,13 +8,17 @@ const doc_files_1 = require("./doc-files");
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
function autoGenHeader({ rVersion, filename, purpose, currentDateAndTime = new Date().toISOString().replace('T', ', ').replace(/\.\d+Z$/, ' UTC') }) {
|
|
11
|
-
|
|
11
|
+
/* what the page is about only shows on hover: the line above every page should be short */
|
|
12
|
+
return `_<span title="an overview of flowR's ${purpose}">Generated</span> from`
|
|
13
|
+
+ ` '${fileNameForGenHeader(filename)}' on ${currentDateAndTime} (v${(0, version_1.flowrVersion)().format()}${rVersion ? ', R v' + rVersion : ''}),`
|
|
14
|
+
+ ' please do not edit directly._';
|
|
12
15
|
}
|
|
13
16
|
/**
|
|
14
17
|
*
|
|
15
18
|
*/
|
|
16
19
|
function fileNameForGenHeader(filename) {
|
|
17
20
|
const shortenFilename = filename.replace(/^.*src\//, 'src/');
|
|
18
|
-
|
|
21
|
+
/* the line above every page stays short: only the file name shows, the path waits in the tooltip */
|
|
22
|
+
return `[${shortenFilename.split('/').pop() ?? shortenFilename}](${(0, doc_files_1.flowrSourceFileUrl)(shortenFilename)} "${shortenFilename}")`;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=doc-auto-gen.js.map
|
|
@@ -19,7 +19,7 @@ function collectHierarchyInformation(sourceFiles, options, fname) {
|
|
|
19
19
|
const name = node.expression.getText(sourceFile);
|
|
20
20
|
if (!fname || fname.test(name)) {
|
|
21
21
|
const comments = typescript_1.default.getLeadingCommentRanges(sourceFile.getText(sourceFile), node.getFullStart())?.map(c => {
|
|
22
|
-
return (0, doc_types_1.removeCommentSymbolsFromTypeScriptComment)(sourceFile.getText(sourceFile).
|
|
22
|
+
return (0, doc_types_1.removeCommentSymbolsFromTypeScriptComment)(sourceFile.getText(sourceFile).slice(c.pos, c.end).trim());
|
|
23
23
|
});
|
|
24
24
|
hierarchyList.push({
|
|
25
25
|
name: (0, doc_types_1.dropGenericsFromTypeName)(name),
|