@eagleoutice/flowr 2.5.0 → 2.6.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 +57 -42
- package/cli/flowr.js +3 -29
- package/cli/repl/commands/repl-cfg.d.ts +5 -5
- package/cli/repl/commands/repl-cfg.js +21 -22
- package/cli/repl/commands/repl-commands.d.ts +3 -3
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-dataflow.d.ts +5 -5
- package/cli/repl/commands/repl-dataflow.js +27 -30
- package/cli/repl/commands/repl-execute.js +1 -0
- package/cli/repl/commands/repl-lineage.js +1 -0
- package/cli/repl/commands/repl-main.d.ts +34 -3
- package/cli/repl/commands/repl-normalize.d.ts +3 -3
- package/cli/repl/commands/repl-normalize.js +15 -19
- package/cli/repl/commands/repl-parse.d.ts +2 -2
- package/cli/repl/commands/repl-parse.js +13 -8
- package/cli/repl/commands/repl-query.d.ts +3 -3
- package/cli/repl/commands/repl-query.js +29 -19
- package/cli/repl/commands/repl-quit.js +1 -0
- package/cli/repl/commands/repl-version.js +1 -0
- package/cli/repl/core.d.ts +4 -1
- package/cli/repl/core.js +21 -1
- package/cli/repl/server/connection.d.ts +7 -3
- package/cli/repl/server/connection.js +40 -48
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/slicer-app.js +1 -1
- package/config.d.ts +1 -1
- package/config.js +4 -1
- package/control-flow/extract-cfg.d.ts +1 -1
- package/control-flow/extract-cfg.js +1 -1
- package/core/pipeline-executor.d.ts +5 -0
- package/core/pipeline-executor.js +5 -0
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +42 -42
- package/core/steps/pipeline/default-pipelines.js +4 -1
- package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
- package/dataflow/graph/dataflowgraph-builder.js +6 -6
- package/documentation/doc-util/doc-query.d.ts +3 -6
- package/documentation/doc-util/doc-query.js +5 -17
- package/documentation/doc-util/doc-search.js +7 -10
- package/documentation/doc-util/doc-structure.d.ts +4 -0
- package/documentation/doc-util/doc-structure.js +28 -0
- package/documentation/doc-util/doc-types.d.ts +5 -1
- package/documentation/doc-util/doc-types.js +29 -3
- package/documentation/print-analyzer-wiki.d.ts +1 -0
- package/documentation/print-analyzer-wiki.js +137 -0
- package/documentation/print-core-wiki.d.ts +2 -1
- package/documentation/print-core-wiki.js +58 -4
- package/documentation/print-dataflow-graph-wiki.js +15 -22
- package/documentation/print-interface-wiki.js +18 -1
- package/documentation/print-linter-wiki.js +5 -1
- package/documentation/print-normalized-ast-wiki.js +6 -8
- package/engines.d.ts +9 -0
- package/engines.js +38 -0
- package/linter/linter-executor.d.ts +2 -8
- package/linter/linter-executor.js +9 -4
- package/linter/linter-format.d.ts +8 -9
- package/linter/linter-rules.d.ts +57 -15
- package/linter/linter-rules.js +2 -0
- package/linter/rules/absolute-path.d.ts +1 -0
- package/linter/rules/dataframe-access-validation.d.ts +4 -3
- package/linter/rules/dataframe-access-validation.js +7 -4
- package/linter/rules/dead-code.d.ts +2 -1
- package/linter/rules/deprecated-functions.d.ts +15 -28
- package/linter/rules/deprecated-functions.js +5 -43
- package/linter/rules/file-path-validity.d.ts +2 -1
- package/linter/rules/file-path-validity.js +1 -1
- package/linter/rules/function-finder-util.d.ts +51 -0
- package/linter/rules/function-finder-util.js +77 -0
- package/linter/rules/naming-convention.d.ts +2 -1
- package/linter/rules/network-functions.d.ts +40 -0
- package/linter/rules/network-functions.js +24 -0
- package/linter/rules/seeded-randomness.d.ts +2 -1
- package/linter/rules/unused-definition.d.ts +2 -1
- package/linter/rules/useless-loop.d.ts +3 -2
- package/linter/rules/useless-loop.js +4 -6
- package/package.json +2 -1
- package/project/cache/flowr-analyzer-cache.d.ts +93 -0
- package/project/cache/flowr-analyzer-cache.js +156 -0
- package/project/cache/flowr-cache.d.ts +28 -0
- package/project/cache/flowr-cache.js +49 -0
- package/project/context/abstract-flowr-analyzer-context.d.ts +35 -0
- package/project/context/abstract-flowr-analyzer-context.js +46 -0
- package/project/context/flowr-analyzer-context.d.ts +48 -0
- package/project/context/flowr-analyzer-context.js +47 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +38 -0
- package/project/context/flowr-analyzer-dependencies-context.js +39 -0
- package/project/context/flowr-analyzer-files-context.d.ts +86 -0
- package/project/context/flowr-analyzer-files-context.js +130 -0
- package/project/context/flowr-analyzer-loading-order-context.d.ts +76 -0
- package/project/context/flowr-analyzer-loading-order-context.js +90 -0
- package/project/context/flowr-file.d.ts +89 -0
- package/project/context/flowr-file.js +78 -0
- package/project/flowr-analyzer-builder.d.ts +106 -0
- package/project/flowr-analyzer-builder.js +197 -0
- package/project/flowr-analyzer.d.ts +125 -0
- package/project/flowr-analyzer.js +81 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
- package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
- package/project/plugins/file-plugins/flowr-description-file.js +38 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
- package/project/plugins/flowr-analyzer-plugin.js +82 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
- package/project/plugins/package-version-plugins/package.d.ts +15 -0
- package/project/plugins/package-version-plugins/package.js +56 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
- package/queries/base-query-format.d.ts +2 -8
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +20 -13
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +5 -5
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
- package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
- package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- 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 +1 -54
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
- package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
- package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
- package/queries/catalog/origin-query/origin-query-format.js +1 -1
- package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +2 -2
- package/queries/catalog/project-query/project-query-format.d.ts +1 -54
- package/queries/catalog/project-query/project-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +3 -3
- package/queries/catalog/search-query/search-query-format.d.ts +1 -54
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
- package/queries/query-print.d.ts +4 -4
- package/queries/query-print.js +12 -12
- package/queries/query.d.ts +29 -885
- package/queries/query.js +1 -1
- package/r-bridge/retriever.d.ts +6 -5
- package/r-bridge/retriever.js +9 -5
- package/search/flowr-search-executor.d.ts +3 -5
- package/search/flowr-search-executor.js +6 -4
- package/search/flowr-search-filters.d.ts +12 -6
- package/search/flowr-search-filters.js +1 -1
- package/search/flowr-search.d.ts +5 -16
- package/search/flowr-search.js +14 -5
- package/search/search-executor/search-enrichers.d.ts +37 -36
- package/search/search-executor/search-enrichers.js +4 -4
- package/search/search-executor/search-generators.d.ts +12 -12
- package/search/search-executor/search-generators.js +27 -19
- package/search/search-executor/search-mappers.d.ts +5 -5
- package/search/search-executor/search-transformer.d.ts +17 -17
- package/search/search-executor/search-transformer.js +14 -7
- package/util/collections/arrays.d.ts +1 -0
- package/util/collections/arrays.js +15 -0
- package/util/collections/objectmap.d.ts +17 -0
- package/util/collections/objectmap.js +28 -0
- package/util/containers.d.ts +0 -1
- package/util/containers.js +0 -1
- package/util/files.d.ts +17 -0
- package/util/files.js +65 -0
- package/util/formats/adapter.d.ts +4 -2
- package/util/formats/adapter.js +11 -4
- package/util/version.js +1 -1
package/cli/slicer-app.js
CHANGED
|
@@ -32,7 +32,7 @@ async function getSlice() {
|
|
|
32
32
|
(0, assert_1.guard)(options.criterion !== undefined, 'a slicing criterion must be given');
|
|
33
33
|
const config = (0, config_1.getConfig)();
|
|
34
34
|
await slicer.init(options['input-is-text']
|
|
35
|
-
?
|
|
35
|
+
? (0, adapter_1.requestFromText)(options.input.replaceAll('\\n', '\n'))
|
|
36
36
|
: (0, adapter_1.requestFromFile)(options.input), config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
37
37
|
let mappedSlices = [];
|
|
38
38
|
let reconstruct = undefined;
|
package/config.d.ts
CHANGED
|
@@ -209,7 +209,7 @@ export declare function parseConfig(jsonString: string): FlowrConfigOptions | un
|
|
|
209
209
|
/**
|
|
210
210
|
* Creates a new flowr config that has the updated values.
|
|
211
211
|
*/
|
|
212
|
-
export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions): FlowrConfigOptions;
|
|
212
|
+
export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions | void): FlowrConfigOptions;
|
|
213
213
|
export declare function cloneConfig(config: FlowrConfigOptions): FlowrConfigOptions;
|
|
214
214
|
export declare function getConfig(configFile?: string, configWorkingDirectory?: string): FlowrConfigOptions;
|
|
215
215
|
export declare function getEngineConfig<T extends EngineConfig['type']>(config: FlowrConfigOptions, engine: T): EngineConfig & {
|
package/config.js
CHANGED
|
@@ -162,8 +162,11 @@ function parseConfig(jsonString) {
|
|
|
162
162
|
/**
|
|
163
163
|
* Creates a new flowr config that has the updated values.
|
|
164
164
|
*/
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
165
166
|
function amendConfig(config, amendmentFunc) {
|
|
166
|
-
|
|
167
|
+
const newConfig = cloneConfig(config);
|
|
168
|
+
amendmentFunc(newConfig);
|
|
169
|
+
return newConfig;
|
|
167
170
|
}
|
|
168
171
|
function cloneConfig(config) {
|
|
169
172
|
return JSON.parse(JSON.stringify(config));
|
|
@@ -18,7 +18,7 @@ import type { FlowrConfigOptions } from '../config';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function extractCfg<Info = ParentInformation>(ast: NormalizedAst<Info & ParentInformation>, config: FlowrConfigOptions, graph?: DataflowGraph, simplifications?: readonly CfgSimplificationPassName[]): ControlFlowInformation;
|
|
20
20
|
/**
|
|
21
|
-
* A version of {@link extractCfg} that is much quicker and does not apply any
|
|
21
|
+
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
|
|
22
22
|
*/
|
|
23
23
|
export declare function extractCfgQuick<Info = ParentInformation>(ast: NormalizedAst<Info>): ControlFlowInformation<import("./control-flow-graph").CfgSimpleVertex>;
|
|
24
24
|
export declare const ResolvedCallSuffix = "-resolved-call-exit";
|
|
@@ -67,7 +67,7 @@ function extractCfg(ast, config, graph, simplifications) {
|
|
|
67
67
|
return (0, cfg_simplification_1.simplifyControlFlowInformation)((0, fold_1.foldAst)(ast.ast, graph ? dataflowCfgFolds(graph) : cfgFolds), { ast, dfg: graph, config }, simplifications);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* A version of {@link extractCfg} that is much quicker and does not apply any
|
|
70
|
+
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
|
|
71
71
|
*/
|
|
72
72
|
function extractCfgQuick(ast) {
|
|
73
73
|
return (0, fold_1.foldAst)(ast.ast, cfgFolds);
|
|
@@ -3,6 +3,10 @@ import { PipelineStepStage } from './steps/pipeline-step';
|
|
|
3
3
|
import type { Pipeline, PipelineInput, PipelineOutput, PipelinePerRequestInput, PipelineStepOutputWithName } from './steps/pipeline/pipeline';
|
|
4
4
|
import type { FlowrConfigOptions } from '../config';
|
|
5
5
|
/**
|
|
6
|
+
* **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
|
|
7
|
+
* and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
|
|
8
|
+
* to create and use an analyzer instance that is pre-configured for your use-case.
|
|
9
|
+
*
|
|
6
10
|
* The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
|
|
7
11
|
* If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
|
|
8
12
|
* to create one for yourself, based on the steps that you want to execute.
|
|
@@ -98,6 +102,7 @@ export declare class PipelineExecutor<P extends Pipeline> {
|
|
|
98
102
|
* The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
|
|
99
103
|
*
|
|
100
104
|
* Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
|
|
105
|
+
* And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
|
|
101
106
|
*
|
|
102
107
|
* @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
|
|
103
108
|
* @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PipelineExecutor = void 0;
|
|
4
4
|
const assert_1 = require("../util/assert");
|
|
5
5
|
/**
|
|
6
|
+
* **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
|
|
7
|
+
* and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
|
|
8
|
+
* to create and use an analyzer instance that is pre-configured for your use-case.
|
|
9
|
+
*
|
|
6
10
|
* The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
|
|
7
11
|
* If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
|
|
8
12
|
* to create one for yourself, based on the steps that you want to execute.
|
|
@@ -98,6 +102,7 @@ class PipelineExecutor {
|
|
|
98
102
|
* The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
|
|
99
103
|
*
|
|
100
104
|
* Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
|
|
105
|
+
* And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
|
|
101
106
|
*
|
|
102
107
|
* @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
|
|
103
108
|
* @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
|
|
@@ -27,7 +27,7 @@ function verifyAndBuildPipeline(steps) {
|
|
|
27
27
|
// now, we do the same for the per-request steps, keeping the per-file steps known
|
|
28
28
|
initializeSteps(perRequestSteps, perRequestStepMap, initsPerRequest, visited);
|
|
29
29
|
const sortedPerRequest = topologicalSort(initsPerRequest, perRequestStepMap, visited);
|
|
30
|
-
const sorted =
|
|
30
|
+
const sorted = sortedPerFile.concat(sortedPerRequest);
|
|
31
31
|
validateStepOutput(sorted, perRequestStepMap, steps);
|
|
32
32
|
return {
|
|
33
33
|
steps: perRequestStepMap,
|
|
@@ -8,20 +8,6 @@ import type { RShell } from '../../../r-bridge/shell';
|
|
|
8
8
|
import type { TreeSitterExecutor } from '../../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
|
|
9
9
|
import type { FlowrConfigOptions } from '../../../config';
|
|
10
10
|
export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
11
|
-
readonly name: "slice";
|
|
12
|
-
readonly humanReadableName: "static slice";
|
|
13
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
14
|
-
readonly processor: (results: {
|
|
15
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
16
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
17
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
18
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
19
|
-
readonly printer: {
|
|
20
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
21
|
-
};
|
|
22
|
-
readonly dependencies: readonly ["dataflow"];
|
|
23
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
24
|
-
} | {
|
|
25
11
|
readonly name: "parse";
|
|
26
12
|
readonly humanReadableName: "parse with R shell";
|
|
27
13
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -54,6 +40,20 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
|
54
40
|
};
|
|
55
41
|
readonly dependencies: readonly ["parse"];
|
|
56
42
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
43
|
+
} | {
|
|
44
|
+
readonly name: "slice";
|
|
45
|
+
readonly humanReadableName: "static slice";
|
|
46
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
47
|
+
readonly processor: (results: {
|
|
48
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
49
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
50
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
51
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
52
|
+
readonly printer: {
|
|
53
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
54
|
+
};
|
|
55
|
+
readonly dependencies: readonly ["dataflow"];
|
|
56
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
57
57
|
} | {
|
|
58
58
|
readonly humanReadableName: "dataflow";
|
|
59
59
|
readonly processor: (results: {
|
|
@@ -90,20 +90,6 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
|
|
|
90
90
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
91
91
|
}>;
|
|
92
92
|
export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
|
|
93
|
-
readonly name: "slice";
|
|
94
|
-
readonly humanReadableName: "static slice";
|
|
95
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
96
|
-
readonly processor: (results: {
|
|
97
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
98
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
99
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
100
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
101
|
-
readonly printer: {
|
|
102
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
103
|
-
};
|
|
104
|
-
readonly dependencies: readonly ["dataflow"];
|
|
105
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
106
|
-
} | {
|
|
107
93
|
readonly name: "parse";
|
|
108
94
|
readonly humanReadableName: "parse with R shell";
|
|
109
95
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -136,6 +122,20 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
|
|
|
136
122
|
};
|
|
137
123
|
readonly dependencies: readonly ["parse"];
|
|
138
124
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
125
|
+
} | {
|
|
126
|
+
readonly name: "slice";
|
|
127
|
+
readonly humanReadableName: "static slice";
|
|
128
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
129
|
+
readonly processor: (results: {
|
|
130
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
131
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
132
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
133
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
134
|
+
readonly printer: {
|
|
135
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
136
|
+
};
|
|
137
|
+
readonly dependencies: readonly ["dataflow"];
|
|
138
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
139
139
|
} | {
|
|
140
140
|
readonly humanReadableName: "dataflow";
|
|
141
141
|
readonly processor: (results: {
|
|
@@ -172,20 +172,6 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
|
|
|
172
172
|
readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
|
|
173
173
|
}>;
|
|
174
174
|
export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipeline").Pipeline<{
|
|
175
|
-
readonly name: "slice";
|
|
176
|
-
readonly humanReadableName: "static slice";
|
|
177
|
-
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
178
|
-
readonly processor: (results: {
|
|
179
|
-
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
180
|
-
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
181
|
-
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
182
|
-
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
183
|
-
readonly printer: {
|
|
184
|
-
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
185
|
-
};
|
|
186
|
-
readonly dependencies: readonly ["dataflow"];
|
|
187
|
-
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
188
|
-
} | {
|
|
189
175
|
readonly name: "parse";
|
|
190
176
|
readonly humanReadableName: "parse with R shell";
|
|
191
177
|
readonly description: "Parse the given R code into an AST";
|
|
@@ -218,6 +204,20 @@ export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipel
|
|
|
218
204
|
};
|
|
219
205
|
readonly dependencies: readonly ["parse"];
|
|
220
206
|
readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
|
|
207
|
+
} | {
|
|
208
|
+
readonly name: "slice";
|
|
209
|
+
readonly humanReadableName: "static slice";
|
|
210
|
+
readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
|
|
211
|
+
readonly processor: (results: {
|
|
212
|
+
dataflow?: import("../../../dataflow/info").DataflowInformation;
|
|
213
|
+
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
|
|
214
|
+
}, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>, _config: FlowrConfigOptions) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
|
|
215
|
+
readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
|
|
216
|
+
readonly printer: {
|
|
217
|
+
readonly 0: typeof import("../../print/print").internalPrinter;
|
|
218
|
+
};
|
|
219
|
+
readonly dependencies: readonly ["dataflow"];
|
|
220
|
+
readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
|
|
221
221
|
} | {
|
|
222
222
|
readonly humanReadableName: "dataflow";
|
|
223
223
|
readonly processor: (results: {
|
|
@@ -33,6 +33,7 @@ exports.TREE_SITTER_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_01_pars
|
|
|
33
33
|
exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
|
|
34
34
|
exports.TREE_SITTER_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP);
|
|
35
35
|
/**
|
|
36
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
36
37
|
* Returns either a {@link DEFAULT_PARSE_PIPELINE} or a {@link TREE_SITTER_PARSE_PIPELINE} depending on the parser used.
|
|
37
38
|
*
|
|
38
39
|
* @see {@link createNormalizePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
@@ -45,6 +46,7 @@ function createParsePipeline(parser, inputs, config) {
|
|
|
45
46
|
}, config);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
49
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
48
50
|
* Returns either a {@link DEFAULT_SLICING_PIPELINE} or a {@link TREE_SITTER_SLICING_PIPELINE} depending on the parser used.
|
|
49
51
|
*
|
|
50
52
|
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createDataflowPipeline}
|
|
@@ -57,6 +59,7 @@ function createSlicePipeline(parser, inputs, config) {
|
|
|
57
59
|
}, config);
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
62
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
60
63
|
* Returns either a {@link DEFAULT_NORMALIZE_PIPELINE} or a {@link TREE_SITTER_NORMALIZE_PIPELINE} depending on the parser used.
|
|
61
64
|
*
|
|
62
65
|
* @see {@link createParsePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
|
|
@@ -69,10 +72,10 @@ function createNormalizePipeline(parser, inputs, config) {
|
|
|
69
72
|
}, config);
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
75
|
+
* **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
|
|
72
76
|
* Returns either a {@link DEFAULT_DATAFLOW_PIPELINE} or a {@link TREE_SITTER_DATAFLOW_PIPELINE} depending on the parser used.
|
|
73
77
|
*
|
|
74
78
|
* @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createSlicePipeline}
|
|
75
|
-
*
|
|
76
79
|
*/
|
|
77
80
|
function createDataflowPipeline(parser, inputs, config) {
|
|
78
81
|
const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_DATAFLOW_PIPELINE : exports.DEFAULT_DATAFLOW_PIPELINE;
|
|
@@ -7,8 +7,7 @@ import type { DataflowGraphVertexAstLink, DataflowGraphVertexUse, FunctionOrigin
|
|
|
7
7
|
import type { ControlDependency } from '../info';
|
|
8
8
|
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
9
9
|
import type { FlowrSearchLike } from '../../search/flowr-search-builder';
|
|
10
|
-
import type {
|
|
11
|
-
import type { FlowrSearchInput } from '../../search/flowr-search';
|
|
10
|
+
import type { FlowrAnalysisProvider } from '../../project/flowr-analyzer';
|
|
12
11
|
export declare function emptyGraph(idMap?: AstIdMap): DataflowGraphBuilder;
|
|
13
12
|
export type DataflowGraphEdgeTarget = NodeId | (readonly NodeId[]);
|
|
14
13
|
/**
|
|
@@ -103,9 +102,9 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
103
102
|
*
|
|
104
103
|
* @param from - Either a node id or a query to find the node id.
|
|
105
104
|
* @param to - Either a node id or a query to find the node id.
|
|
106
|
-
* @param
|
|
105
|
+
* @param input - The input to search in i.e. the dataflow graph.
|
|
107
106
|
*/
|
|
108
|
-
readsQuery
|
|
107
|
+
readsQuery(from: FromQueryParam, to: ToQueryParam, input: FlowrAnalysisProvider): Promise<this>;
|
|
109
108
|
/**
|
|
110
109
|
* Adds a **defined-by edge** with from as defined variable, and to
|
|
111
110
|
* as a variable/function contributing to its definition.
|
|
@@ -118,7 +117,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
118
117
|
*
|
|
119
118
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
120
119
|
*/
|
|
121
|
-
definedByQuery
|
|
120
|
+
definedByQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
122
121
|
/**
|
|
123
122
|
* Adds a **call edge** with from as caller, and to as callee.
|
|
124
123
|
*
|
|
@@ -130,7 +129,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
130
129
|
*
|
|
131
130
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
132
131
|
*/
|
|
133
|
-
callsQuery
|
|
132
|
+
callsQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
134
133
|
/**
|
|
135
134
|
* Adds a **return edge** with from as function, and to as exit point.
|
|
136
135
|
*
|
|
@@ -142,7 +141,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
142
141
|
*
|
|
143
142
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
144
143
|
*/
|
|
145
|
-
returnsQuery
|
|
144
|
+
returnsQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
146
145
|
/**
|
|
147
146
|
* Adds a **defines-on-call edge** with from as variable, and to as its definition
|
|
148
147
|
*
|
|
@@ -154,7 +153,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
154
153
|
*
|
|
155
154
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
156
155
|
*/
|
|
157
|
-
definesOnCallQuery
|
|
156
|
+
definesOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
158
157
|
/**
|
|
159
158
|
* Adds a **defined-by-on-call edge** with from as definition, and to as variable.
|
|
160
159
|
*
|
|
@@ -166,7 +165,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
166
165
|
*
|
|
167
166
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
168
167
|
*/
|
|
169
|
-
definedByOnCallQuery
|
|
168
|
+
definedByOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
170
169
|
/**
|
|
171
170
|
* Adds an **argument edge** with from as function call, and to as argument.
|
|
172
171
|
*
|
|
@@ -178,7 +177,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
178
177
|
*
|
|
179
178
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
180
179
|
*/
|
|
181
|
-
argumentQuery
|
|
180
|
+
argumentQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
182
181
|
/**
|
|
183
182
|
* Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
|
|
184
183
|
*
|
|
@@ -190,7 +189,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
190
189
|
*
|
|
191
190
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
192
191
|
*/
|
|
193
|
-
nseQuery
|
|
192
|
+
nseQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
194
193
|
/**
|
|
195
194
|
* Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
|
|
196
195
|
*
|
|
@@ -202,7 +201,7 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
|
|
|
202
201
|
*
|
|
203
202
|
* @see {@link DataflowGraphBuilder#readsQuery|readsQuery} for parameters.
|
|
204
203
|
*/
|
|
205
|
-
sideEffectOnCallQuery
|
|
204
|
+
sideEffectOnCallQuery(from: FromQueryParam, to: ToQueryParam, data: FlowrAnalysisProvider): Promise<this>;
|
|
206
205
|
/**
|
|
207
206
|
* explicitly overwrite the root ids of the graph,
|
|
208
207
|
* this is just an easier variant in case you working with a lot of functions this saves you a lot of `false` flags.
|
|
@@ -174,13 +174,13 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
174
174
|
}
|
|
175
175
|
return this.addEdge((0, node_id_1.normalizeIdToNumberIfPossible)(from), (0, node_id_1.normalizeIdToNumberIfPossible)(to), type);
|
|
176
176
|
}
|
|
177
|
-
queryHelper(from, to, data, type) {
|
|
177
|
+
async queryHelper(from, to, data, type) {
|
|
178
178
|
let fromId;
|
|
179
179
|
if ('nodeId' in from) {
|
|
180
180
|
fromId = from.nodeId;
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
|
-
const result = (0, flowr_search_executor_1.runSearch)(from.query, data).getElements();
|
|
183
|
+
const result = (await (0, flowr_search_executor_1.runSearch)(from.query, data)).getElements();
|
|
184
184
|
(0, assert_1.guard)(result.length === 1, `from query result should yield exactly one node, but yielded ${result.length}`);
|
|
185
185
|
fromId = result[0].node.info.id;
|
|
186
186
|
}
|
|
@@ -189,7 +189,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
189
189
|
toIds = to.target;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
const result = (0, flowr_search_executor_1.runSearch)(to.query, data).getElements();
|
|
192
|
+
const result = (await (0, flowr_search_executor_1.runSearch)(to.query, data)).getElements();
|
|
193
193
|
toIds = result.map(r => r.node.info.id);
|
|
194
194
|
}
|
|
195
195
|
return this.edgeHelper(fromId, toIds, type);
|
|
@@ -209,10 +209,10 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
|
|
|
209
209
|
*
|
|
210
210
|
* @param from - Either a node id or a query to find the node id.
|
|
211
211
|
* @param to - Either a node id or a query to find the node id.
|
|
212
|
-
* @param
|
|
212
|
+
* @param input - The input to search in i.e. the dataflow graph.
|
|
213
213
|
*/
|
|
214
|
-
readsQuery(from, to,
|
|
215
|
-
return this.queryHelper(from, to,
|
|
214
|
+
readsQuery(from, to, input) {
|
|
215
|
+
return this.queryHelper(from, to, input, edge_1.EdgeType.Reads);
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* Adds a **defined-by edge** with from as defined variable, and to
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { RShell } from '../../r-bridge/shell';
|
|
2
|
-
import type { Queries,
|
|
3
|
-
import { DEFAULT_DATAFLOW_PIPELINE } from '../../core/steps/pipeline/default-pipelines';
|
|
2
|
+
import type { Queries, SupportedQueryTypes } from '../../queries/query';
|
|
4
3
|
import type { SupportedVirtualQueryTypes } from '../../queries/virtual-query/virtual-queries';
|
|
5
4
|
import type { VirtualCompoundConstraint } from '../../queries/virtual-query/compound-query';
|
|
6
|
-
|
|
7
|
-
export interface ShowQueryOptions<Base extends SupportedQueryTypes> {
|
|
5
|
+
export interface ShowQueryOptions {
|
|
8
6
|
readonly showCode?: boolean;
|
|
9
7
|
readonly collapseResult?: boolean;
|
|
10
8
|
readonly collapseQuery?: boolean;
|
|
11
|
-
readonly addOutput?: (result: QueryResults<Base>, pipeline: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>) => string;
|
|
12
9
|
}
|
|
13
|
-
export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(shell: RShell, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery
|
|
10
|
+
export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(shell: RShell, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery }?: ShowQueryOptions): Promise<string>;
|
|
14
11
|
export interface QueryDocumentation {
|
|
15
12
|
readonly name: string;
|
|
16
13
|
readonly type: 'virtual' | 'active';
|
|
@@ -6,9 +6,6 @@ exports.registerQueryDocumentation = registerQueryDocumentation;
|
|
|
6
6
|
exports.linkToQueryOfName = linkToQueryOfName;
|
|
7
7
|
exports.tocForQueryType = tocForQueryType;
|
|
8
8
|
exports.explainQueries = explainQueries;
|
|
9
|
-
const query_1 = require("../../queries/query");
|
|
10
|
-
const pipeline_executor_1 = require("../../core/pipeline-executor");
|
|
11
|
-
const default_pipelines_1 = require("../../core/steps/pipeline/default-pipelines");
|
|
12
9
|
const retriever_1 = require("../../r-bridge/retriever");
|
|
13
10
|
const json_1 = require("../../util/json");
|
|
14
11
|
const ansi_1 = require("../../util/text/ansi");
|
|
@@ -17,19 +14,12 @@ const doc_dfg_1 = require("./doc-dfg");
|
|
|
17
14
|
const doc_code_1 = require("./doc-code");
|
|
18
15
|
const time_1 = require("../../util/text/time");
|
|
19
16
|
const query_print_1 = require("../../queries/query-print");
|
|
17
|
+
const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
|
|
20
18
|
const doc_cli_option_1 = require("./doc-cli-option");
|
|
21
|
-
|
|
22
|
-
async function showQuery(shell, code, queries, { showCode, collapseResult, collapseQuery, addOutput = () => '' } = {}) {
|
|
19
|
+
async function showQuery(shell, code, queries, { showCode, collapseResult, collapseQuery } = {}) {
|
|
23
20
|
const now = performance.now();
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
request: (0, retriever_1.requestFromInput)(code)
|
|
27
|
-
}, config_1.defaultConfigOptions).allRemainingSteps();
|
|
28
|
-
const results = await Promise.resolve((0, query_1.executeQueries)({
|
|
29
|
-
dataflow: analysis.dataflow,
|
|
30
|
-
ast: analysis.normalize,
|
|
31
|
-
config: (0, config_1.cloneConfig)(config_1.defaultConfigOptions)
|
|
32
|
-
}, queries));
|
|
21
|
+
const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder((0, retriever_1.requestFromInput)(code)).setParser(shell).build();
|
|
22
|
+
const results = await analyzer.query(queries);
|
|
33
23
|
const duration = performance.now() - now;
|
|
34
24
|
const metaInfo = `
|
|
35
25
|
The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parsing and normalization and the query) within the generation environment.
|
|
@@ -52,7 +42,7 @@ ${collapseResult ? ' <details> <summary style="color:gray">Show Results</summary
|
|
|
52
42
|
|
|
53
43
|
_Results (prettified and summarized):_
|
|
54
44
|
|
|
55
|
-
${(0, query_print_1.asciiSummaryOfQueryResult)(ansi_1.markdownFormatter, duration, results,
|
|
45
|
+
${await (0, query_print_1.asciiSummaryOfQueryResult)(ansi_1.markdownFormatter, duration, results, analyzer, queries)}
|
|
56
46
|
|
|
57
47
|
<details> <summary style="color:gray">Show Detailed Results as Json</summary>
|
|
58
48
|
|
|
@@ -75,8 +65,6 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(shell, code, { switchCodeAndGraph: tr
|
|
|
75
65
|
|
|
76
66
|
${collapseResult ? '</details>' : ''}
|
|
77
67
|
|
|
78
|
-
${addOutput(results, analysis)}
|
|
79
|
-
|
|
80
68
|
`;
|
|
81
69
|
}
|
|
82
70
|
exports.RegisteredQueries = {
|
|
@@ -6,29 +6,26 @@ exports.registerQueryDocumentation = registerQueryDocumentation;
|
|
|
6
6
|
exports.linkToQueryOfName = linkToQueryOfName;
|
|
7
7
|
exports.tocForQueryType = tocForQueryType;
|
|
8
8
|
exports.explainQueries = explainQueries;
|
|
9
|
-
const pipeline_executor_1 = require("../../core/pipeline-executor");
|
|
10
|
-
const default_pipelines_1 = require("../../core/steps/pipeline/default-pipelines");
|
|
11
9
|
const retriever_1 = require("../../r-bridge/retriever");
|
|
12
10
|
const doc_files_1 = require("./doc-files");
|
|
13
11
|
const doc_dfg_1 = require("./doc-dfg");
|
|
14
12
|
const doc_code_1 = require("./doc-code");
|
|
15
13
|
const time_1 = require("../../util/text/time");
|
|
16
|
-
const flowr_search_executor_1 = require("../../search/flowr-search-executor");
|
|
17
14
|
const flowr_search_printer_1 = require("../../search/flowr-search-printer");
|
|
18
15
|
const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
|
|
19
16
|
const dfg_1 = require("../../util/mermaid/dfg");
|
|
20
|
-
const
|
|
17
|
+
const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
|
|
21
18
|
async function showSearch(shell, code, search, { collapseResult = true } = {}) {
|
|
22
19
|
const now = performance.now();
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const result = (0, flowr_search_executor_1.runSearch)(search, { ...analysis, config: config_1.defaultConfigOptions });
|
|
20
|
+
const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder((0, retriever_1.requestFromInput)(code))
|
|
21
|
+
.setParser(shell)
|
|
22
|
+
.build();
|
|
23
|
+
const result = await analyzer.runSearch(search);
|
|
28
24
|
const duration = performance.now() - now;
|
|
29
25
|
const metaInfo = `
|
|
30
26
|
The search required _${(0, time_1.printAsMs)(duration)}_ (including parsing and normalization and the query) within the generation environment.
|
|
31
27
|
`.trim();
|
|
28
|
+
const dataflow = await analyzer.dataflow();
|
|
32
29
|
return `
|
|
33
30
|
|
|
34
31
|
${(0, doc_code_1.codeBlock)('ts', (0, flowr_search_printer_1.flowrSearchToCode)(search))}
|
|
@@ -53,7 +50,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify(search, null, 2))}
|
|
|
53
50
|
${collapseResult ? ' <details> <summary style="color:gray">Show Results</summary>' : ''}
|
|
54
51
|
|
|
55
52
|
The query returns the following vetices (all references to \`x\` in the code):
|
|
56
|
-
${result.getElements().map(({ node }) => `<b>${node.info.id} ('${(0, node_id_1.recoverContent)(node.info.id,
|
|
53
|
+
${result.getElements().map(({ node }) => `<b>${node.info.id} ('${(0, node_id_1.recoverContent)(node.info.id, dataflow.graph)}')</b> at L${(0, dfg_1.formatRange)(node.location)}`).join(', ')}
|
|
57
54
|
|
|
58
55
|
${metaInfo}
|
|
59
56
|
|
|
@@ -11,3 +11,7 @@ export interface BlockOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function block({ type, content }: BlockOptions): string;
|
|
13
13
|
export declare function section(title: string, depth?: 1 | 2 | 3 | 4 | 5 | 6, anchor?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Supported pattern: `Name@link`
|
|
16
|
+
*/
|
|
17
|
+
export declare function collapsibleToc(content: Record<string, Record<string, Record<string, undefined> | undefined> | undefined>): string;
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.details = details;
|
|
4
4
|
exports.block = block;
|
|
5
5
|
exports.section = section;
|
|
6
|
+
exports.collapsibleToc = collapsibleToc;
|
|
6
7
|
const doc_general_1 = require("./doc-general");
|
|
7
8
|
const mermaid_1 = require("../../util/mermaid/mermaid");
|
|
9
|
+
const strings_1 = require("../../util/text/strings");
|
|
8
10
|
function details(title, content, { color, open = false, hideIfEmpty = true, prefixInit = '' } = {}) {
|
|
9
11
|
return hideIfEmpty && content.trim().length === 0 ? '' : `
|
|
10
12
|
${prefixInit}<details${open ? ' open' : ''}><summary style="${color ? 'color:' + color : ''}">${title}</summary>
|
|
@@ -23,4 +25,30 @@ ${(0, doc_general_1.prefixLines)(content, '> ')}
|
|
|
23
25
|
function section(title, depth = 2, anchor = (0, mermaid_1.escapeId)(title)) {
|
|
24
26
|
return `<h${depth} id="${anchor}">${title}</h${depth}>`;
|
|
25
27
|
}
|
|
28
|
+
function strToLink(str) {
|
|
29
|
+
const match = str.match(/^(.*?)@(.*)$/);
|
|
30
|
+
if (match) {
|
|
31
|
+
const [, name, link] = match;
|
|
32
|
+
return `[${name}](${link})`;
|
|
33
|
+
}
|
|
34
|
+
return `[${str}](#${(0, mermaid_1.escapeId)(str)})`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Supported pattern: `Name@link`
|
|
38
|
+
*/
|
|
39
|
+
function collapsibleToc(content) {
|
|
40
|
+
let output = '';
|
|
41
|
+
for (const [section, subsections] of Object.entries(content)) {
|
|
42
|
+
output += `- ${strToLink(section)}\n`;
|
|
43
|
+
if (subsections) {
|
|
44
|
+
for (const [subsection, items] of Object.entries(subsections)) {
|
|
45
|
+
output += ` - ${strToLink(subsection)} \n`;
|
|
46
|
+
if (items) {
|
|
47
|
+
output += ` ${(0, strings_1.joinWithLast)(Object.keys(items).map(strToLink))}\n`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
53
|
+
}
|
|
26
54
|
//# sourceMappingURL=doc-structure.js.map
|
|
@@ -62,8 +62,12 @@ export declare function printHierarchy({ program, info, root, collapseFromNestin
|
|
|
62
62
|
interface FnInfo {
|
|
63
63
|
info: TypeElementInSource[];
|
|
64
64
|
program: ts.Program;
|
|
65
|
+
dropLinesStart?: number;
|
|
66
|
+
dropLinesEnd?: number;
|
|
67
|
+
doNotAutoGobble?: boolean;
|
|
68
|
+
hideDefinedAt?: boolean;
|
|
65
69
|
}
|
|
66
|
-
export declare function printCodeOfElement({ program, info }: FnInfo, name: string): string;
|
|
70
|
+
export declare function printCodeOfElement({ program, info, dropLinesEnd, dropLinesStart, doNotAutoGobble, hideDefinedAt }: FnInfo, name: string): string;
|
|
67
71
|
/**
|
|
68
72
|
* Create a short link to a type in the documentation
|
|
69
73
|
* @param name - The name of the type, e.g. `MyType`, may include a container, e.g.,`MyContainer::MyType` (this works with function nestings too)
|
|
@@ -387,14 +387,40 @@ function printHierarchy({ program, info, root, collapseFromNesting = 1, initialN
|
|
|
387
387
|
return thisLine + (out ? '\n' + out : '');
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
function printCodeOfElement({ program, info }, name) {
|
|
390
|
+
function printCodeOfElement({ program, info, dropLinesEnd = 0, dropLinesStart = 0, doNotAutoGobble, hideDefinedAt }, name) {
|
|
391
391
|
const node = info.find(e => e.name === name);
|
|
392
392
|
if (!node) {
|
|
393
393
|
console.error(`Could not find node ${name} when resolving function!`);
|
|
394
394
|
return '';
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
let code = node.node.getFullText(program.getSourceFile(node.node.getSourceFile().fileName)).trim();
|
|
397
|
+
if (dropLinesStart > 0 || dropLinesEnd > 0) {
|
|
398
|
+
const lines = code.split(/\n/g);
|
|
399
|
+
if (dropLinesStart + dropLinesEnd >= lines.length) {
|
|
400
|
+
return '';
|
|
401
|
+
}
|
|
402
|
+
code = lines.slice(dropLinesStart, lines.length - dropLinesEnd).join('\n');
|
|
403
|
+
}
|
|
404
|
+
if (!doNotAutoGobble) {
|
|
405
|
+
// gobble leading spaces
|
|
406
|
+
const lines = code.replaceAll('\t', ' ').split(/\n/g);
|
|
407
|
+
let gobble = Number.POSITIVE_INFINITY;
|
|
408
|
+
for (const line of lines) {
|
|
409
|
+
const match = line.match(/^(\s+)\S+/);
|
|
410
|
+
if (match) {
|
|
411
|
+
gobble = Math.min(gobble, match[1].length);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (gobble !== Number.POSITIVE_INFINITY && gobble > 0) {
|
|
415
|
+
code = lines.map(line => line.startsWith(' '.repeat(gobble)) ? line.slice(gobble) : line).join('\n');
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (hideDefinedAt) {
|
|
419
|
+
return (0, doc_code_1.codeBlock)('ts', code);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
return `${(0, doc_code_1.codeBlock)('ts', code)}\n<i>Defined at <a href="${getTypePathLink(node)}">${getTypePathLink(node, '.')}</a></i>\n`;
|
|
423
|
+
}
|
|
398
424
|
}
|
|
399
425
|
function fuzzyCompare(a, b) {
|
|
400
426
|
const aStr = a.toLowerCase().replace(/[^a-z0-9]/g, '-').trim();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|