@eagleoutice/flowr 2.1.11 → 2.2.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/benchmark/slicer.d.ts +5 -12
- package/benchmark/slicer.js +46 -28
- package/cli/benchmark-app.d.ts +2 -0
- package/cli/benchmark-app.js +2 -1
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +2 -2
- package/cli/common/options.js +3 -1
- package/cli/flowr-main-options.js +36 -2
- package/cli/flowr.d.ts +6 -0
- package/cli/flowr.js +51 -24
- package/cli/repl/commands/repl-cfg.js +2 -4
- package/cli/repl/commands/repl-dataflow.js +2 -4
- package/cli/repl/commands/repl-execute.d.ts +2 -2
- package/cli/repl/commands/repl-execute.js +15 -5
- package/cli/repl/commands/repl-lineage.js +2 -4
- package/cli/repl/commands/repl-main.d.ts +2 -2
- package/cli/repl/commands/repl-normalize.js +2 -4
- package/cli/repl/commands/repl-parse.js +2 -4
- package/cli/repl/commands/repl-query.js +7 -9
- package/cli/repl/commands/repl-version.d.ts +5 -4
- package/cli/repl/commands/repl-version.js +10 -9
- package/cli/repl/core.d.ts +5 -5
- package/cli/repl/core.js +8 -12
- package/cli/repl/print-version.d.ts +2 -2
- package/cli/repl/print-version.js +3 -3
- package/cli/repl/server/connection.d.ts +3 -3
- package/cli/repl/server/connection.js +6 -8
- package/cli/repl/server/messages/message-hello.js +2 -1
- package/cli/repl/server/server.d.ts +4 -3
- package/cli/repl/server/server.js +7 -5
- package/cli/slicer-app.js +1 -1
- package/config.d.ts +36 -4
- package/config.js +30 -1
- package/core/pipeline-executor.d.ts +1 -1
- package/core/pipeline-executor.js +1 -1
- package/core/steps/all/core/00-parse.d.ts +4 -18
- package/core/steps/all/core/00-parse.js +2 -11
- package/core/steps/all/core/01-parse-tree-sitter.d.ts +23 -0
- package/core/steps/all/core/01-parse-tree-sitter.js +19 -0
- package/core/steps/all/core/10-normalize.d.ts +3 -2
- package/core/steps/all/core/10-normalize.js +1 -0
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +25 -0
- package/core/steps/all/core/11-normalize-tree-sitter.js +27 -0
- package/core/steps/all/core/20-dataflow.d.ts +2 -0
- package/core/steps/all/core/20-dataflow.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +374 -23
- package/core/steps/pipeline/default-pipelines.js +48 -4
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/graph/vertex.d.ts +4 -0
- package/dataflow/graph/vertex.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -5
- package/dataflow/processor.d.ts +2 -0
- package/documentation/doc-util/doc-auto-gen.js +2 -1
- package/documentation/doc-util/doc-cfg.js +1 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +1 -0
- package/documentation/doc-util/doc-files.js +4 -0
- package/documentation/doc-util/doc-normalized-ast.js +2 -3
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-search.d.ts +25 -0
- package/documentation/doc-util/doc-search.js +121 -0
- package/documentation/doc-util/doc-types.d.ts +10 -2
- package/documentation/doc-util/doc-types.js +81 -3
- package/documentation/print-dataflow-graph-wiki.js +16 -16
- package/documentation/print-engines-wiki.d.ts +1 -0
- package/documentation/print-engines-wiki.js +82 -0
- package/documentation/print-interface-wiki.js +30 -20
- package/documentation/print-normalized-ast-wiki.js +5 -5
- package/documentation/print-query-wiki.js +22 -0
- package/documentation/print-search-wiki.d.ts +1 -0
- package/documentation/print-search-wiki.js +74 -0
- package/package.json +10 -5
- package/queries/base-query-format.d.ts +2 -2
- 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 +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-executor.js +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -4
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -4
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +5 -4
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -4
- package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-executor.js +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +5 -4
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -4
- package/queries/catalog/search-query/search-query-executor.d.ts +3 -0
- package/queries/catalog/search-query/search-query-executor.js +27 -0
- package/queries/catalog/search-query/search-query-format.d.ts +73 -0
- package/queries/catalog/search-query/search-query-format.js +29 -0
- 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 +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -4
- package/queries/query.d.ts +95 -29
- package/queries/query.js +3 -1
- package/r-bridge/lang-4.x/ast/model/type.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/type.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +4 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +5 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +18 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +57 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +541 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.d.ts +35 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.js +40 -0
- package/r-bridge/parser.d.ts +32 -0
- package/r-bridge/parser.js +14 -0
- package/r-bridge/shell-executor.d.ts +37 -1
- package/r-bridge/shell-executor.js +39 -0
- package/r-bridge/shell.d.ts +12 -6
- package/r-bridge/shell.js +15 -6
- package/search/flowr-search-builder.d.ts +193 -0
- package/search/flowr-search-builder.js +192 -0
- package/search/flowr-search-executor.d.ts +9 -0
- package/search/flowr-search-executor.js +16 -0
- package/search/flowr-search-filters.d.ts +74 -0
- package/search/flowr-search-filters.js +136 -0
- package/search/flowr-search-printer.d.ts +10 -0
- package/search/flowr-search-printer.js +85 -0
- package/search/flowr-search-traverse.d.ts +7 -0
- package/search/flowr-search-traverse.js +12 -0
- package/search/flowr-search.d.ts +58 -0
- package/search/flowr-search.js +29 -0
- package/search/search-executor/search-generators.d.ts +37 -0
- package/search/search-executor/search-generators.js +64 -0
- package/search/search-executor/search-transformer.d.ts +57 -0
- package/search/search-executor/search-transformer.js +99 -0
- package/search/search-optimizer/search-optimizer.d.ts +9 -0
- package/search/search-optimizer/search-optimizer.js +89 -0
- package/statistics/statistics.js +1 -1
- package/util/arrays.d.ts +13 -0
- package/util/assert.d.ts +1 -1
- package/util/mermaid/mermaid.js +17 -0
- package/util/version.js +1 -1
|
@@ -85,7 +85,7 @@ async function getVertexExplanations(shell, vertexType) {
|
|
|
85
85
|
/* we use the map to ensure order easily :D */
|
|
86
86
|
const vertexExplanations = new Map();
|
|
87
87
|
vertexExplanations.set(vertex_1.VertexType.Value, [{
|
|
88
|
-
shell
|
|
88
|
+
shell,
|
|
89
89
|
name: 'Value Vertex',
|
|
90
90
|
type: vertex_1.VertexType.Value,
|
|
91
91
|
description: `
|
|
@@ -113,7 +113,7 @@ ${(0, doc_structure_1.details)('Example: Semantics Create a Value', `In the foll
|
|
|
113
113
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().constant('0')
|
|
114
114
|
}, []]);
|
|
115
115
|
vertexExplanations.set(vertex_1.VertexType.Use, [{
|
|
116
|
-
shell
|
|
116
|
+
shell,
|
|
117
117
|
name: 'Use Vertex',
|
|
118
118
|
type: vertex_1.VertexType.Use,
|
|
119
119
|
description: `
|
|
@@ -160,7 +160,7 @@ ${(0, doc_structure_1.details)('Example: Reads Edge Identifying Multiple Definit
|
|
|
160
160
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().use('1@x', 'x')
|
|
161
161
|
}, []]);
|
|
162
162
|
vertexExplanations.set(vertex_1.VertexType.FunctionCall, [{
|
|
163
|
-
shell
|
|
163
|
+
shell,
|
|
164
164
|
name: 'Function Call Vertex',
|
|
165
165
|
type: vertex_1.VertexType.FunctionCall,
|
|
166
166
|
description: `
|
|
@@ -348,7 +348,7 @@ ${(0, doc_structure_1.details)('Example: Function Call with a Side-Effect', awai
|
|
|
348
348
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().call('1@foo', 'foo', [])
|
|
349
349
|
}, []]);
|
|
350
350
|
vertexExplanations.set(vertex_1.VertexType.VariableDefinition, [{
|
|
351
|
-
shell
|
|
351
|
+
shell,
|
|
352
352
|
name: 'Variable Definition Vertex',
|
|
353
353
|
type: vertex_1.VertexType.VariableDefinition,
|
|
354
354
|
description: `
|
|
@@ -392,7 +392,7 @@ As you can see, _flowR_ is able to recognize that the initial definition of \`x\
|
|
|
392
392
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().defineVariable('1@x', 'x')
|
|
393
393
|
}, []]);
|
|
394
394
|
vertexExplanations.set(vertex_1.VertexType.FunctionDefinition, [{
|
|
395
|
-
shell
|
|
395
|
+
shell,
|
|
396
396
|
name: 'Function Definition Vertex',
|
|
397
397
|
type: vertex_1.VertexType.FunctionDefinition,
|
|
398
398
|
description: `
|
|
@@ -484,7 +484,7 @@ Besides this being a theoretically "shorter" way of defining a function, this be
|
|
|
484
484
|
async function getEdgesExplanations(shell) {
|
|
485
485
|
const edgeExplanations = new Map();
|
|
486
486
|
edgeExplanations.set(edge_1.EdgeType.Reads, [{
|
|
487
|
-
shell
|
|
487
|
+
shell,
|
|
488
488
|
name: 'Reads Edge',
|
|
489
489
|
type: edge_1.EdgeType.Reads,
|
|
490
490
|
description: `
|
|
@@ -522,7 +522,7 @@ Please refer to the explanation of the respective vertices for more information.
|
|
|
522
522
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().reads('1:20', '1@x')
|
|
523
523
|
}]]);
|
|
524
524
|
edgeExplanations.set(edge_1.EdgeType.DefinedBy, [{
|
|
525
|
-
shell
|
|
525
|
+
shell,
|
|
526
526
|
name: 'DefinedBy Edge', /* concat for link generation */
|
|
527
527
|
type: edge_1.EdgeType.DefinedBy,
|
|
528
528
|
description: `
|
|
@@ -546,7 +546,7 @@ However, nested definitions can carry it (in the nested case, \`x\` is defined b
|
|
|
546
546
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().definedBy('1@x', '1:8')
|
|
547
547
|
}]]);
|
|
548
548
|
edgeExplanations.set(edge_1.EdgeType.Calls, [{
|
|
549
|
-
shell
|
|
549
|
+
shell,
|
|
550
550
|
name: 'Calls Edge',
|
|
551
551
|
type: edge_1.EdgeType.Calls,
|
|
552
552
|
description: 'Link the [function call](#function-call-vertex) to the [function definition](#function-definition-vertex) that is called.',
|
|
@@ -554,7 +554,7 @@ However, nested definitions can carry it (in the nested case, \`x\` is defined b
|
|
|
554
554
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().calls('2@foo', '1@function')
|
|
555
555
|
}, []]);
|
|
556
556
|
edgeExplanations.set(edge_1.EdgeType.Returns, [{
|
|
557
|
-
shell
|
|
557
|
+
shell,
|
|
558
558
|
name: 'Returns Edge',
|
|
559
559
|
type: edge_1.EdgeType.Returns,
|
|
560
560
|
description: 'Link the [function call](#function-call-vertex) to the exit points of the target definition (this may incorporate the call-context).',
|
|
@@ -568,7 +568,7 @@ f()
|
|
|
568
568
|
`.trim();
|
|
569
569
|
const dfInfo = await (0, doc_dfg_1.printDfGraphForCode)(shell, lateBindingExample, { switchCodeAndGraph: true, codeOpen: true, mark: new Set([1, '1->5', '9->5']) });
|
|
570
570
|
edgeExplanations.set(edge_1.EdgeType.DefinesOnCall, [{
|
|
571
|
-
shell
|
|
571
|
+
shell,
|
|
572
572
|
name: 'DefinesOnCall Edge',
|
|
573
573
|
type: edge_1.EdgeType.DefinesOnCall,
|
|
574
574
|
description: `*This edge is usually joined with ${linkEdgeName(edge_1.EdgeType.DefinedByOnCall)}!*
|
|
@@ -592,7 +592,7 @@ ${dfInfo}
|
|
|
592
592
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().definesOnCall('$11', '$1').definedByOnCall('$1', '$11')
|
|
593
593
|
}, []]);
|
|
594
594
|
edgeExplanations.set(edge_1.EdgeType.DefinedByOnCall, [{
|
|
595
|
-
shell
|
|
595
|
+
shell,
|
|
596
596
|
name: 'DefinedByOnCall Edge',
|
|
597
597
|
type: edge_1.EdgeType.DefinedByOnCall,
|
|
598
598
|
description: `*This edge is usually joined with ${linkEdgeName(edge_1.EdgeType.DefinesOnCall)}!*
|
|
@@ -602,7 +602,7 @@ ${dfInfo}
|
|
|
602
602
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().definesOnCall('$11', '$1').definedByOnCall('$1', '$11')
|
|
603
603
|
}, []]);
|
|
604
604
|
edgeExplanations.set(edge_1.EdgeType.Argument, [{
|
|
605
|
-
shell
|
|
605
|
+
shell,
|
|
606
606
|
name: 'Argument Edge',
|
|
607
607
|
type: edge_1.EdgeType.Argument,
|
|
608
608
|
description: `Links a [function call](#function-call-vertex) to the entry point of its arguments. If we do not know the target of such a call, we automatically assume that all arguments are read by the call as well!
|
|
@@ -613,7 +613,7 @@ The exception to this is the [function definition](#function-definition-vertex)
|
|
|
613
613
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().argument('1@f', '1@x').reads('1@f', '1@x').argument('1@f', '1@y').reads('1@f', '1@y')
|
|
614
614
|
}, []]);
|
|
615
615
|
edgeExplanations.set(edge_1.EdgeType.SideEffectOnCall, [{
|
|
616
|
-
shell
|
|
616
|
+
shell,
|
|
617
617
|
name: 'SideEffectOnCall Edge',
|
|
618
618
|
type: edge_1.EdgeType.SideEffectOnCall,
|
|
619
619
|
description: 'Links a global side effect to an affected function call (e.g., a super definition within the function body)',
|
|
@@ -621,7 +621,7 @@ The exception to this is the [function definition](#function-definition-vertex)
|
|
|
621
621
|
expectedSubgraph: (0, dataflowgraph_builder_1.emptyGraph)().sideEffectOnCall('1@x', '2@f')
|
|
622
622
|
}, []]);
|
|
623
623
|
edgeExplanations.set(edge_1.EdgeType.NonStandardEvaluation, [{
|
|
624
|
-
shell
|
|
624
|
+
shell,
|
|
625
625
|
name: 'NonStandardEvaluation Edge',
|
|
626
626
|
type: edge_1.EdgeType.NonStandardEvaluation,
|
|
627
627
|
description: `
|
|
@@ -668,7 +668,7 @@ ${(0, doc_structure_1.details)('Example: While-Loop Body', await (0, doc_dfg_1.p
|
|
|
668
668
|
async function dummyDataflow() {
|
|
669
669
|
const shell = new shell_1.RShell();
|
|
670
670
|
const result = await new pipeline_executor_1.PipelineExecutor(default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE, {
|
|
671
|
-
shell,
|
|
671
|
+
parser: shell,
|
|
672
672
|
request: (0, retriever_1.requestFromInput)('x <- 1\nx + 1')
|
|
673
673
|
}).allRemainingSteps();
|
|
674
674
|
shell.close();
|
|
@@ -689,7 +689,7 @@ async function getText(shell) {
|
|
|
689
689
|
});
|
|
690
690
|
return `${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'dataflow graph', rVersion: rversion })}
|
|
691
691
|
|
|
692
|
-
This page briefly summarizes flowR's dataflow graph, represented by ${
|
|
692
|
+
This page briefly summarizes flowR's dataflow graph, represented by ${(0, doc_types_1.shortLink)('DataflowGraph', vertexType.info)} in ${(0, doc_files_1.getFilePathMd)('../dataflow/graph/graph.ts')}.
|
|
693
693
|
In case you want to manually build such a graph (e.g., for testing), you can use the builder in ${(0, doc_files_1.getFilePathMd)('../dataflow/graph/dataflowgraph-builder.ts')}.
|
|
694
694
|
This wiki page focuses on explaining what such a dataflow graph looks like!
|
|
695
695
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const shell_1 = require("../r-bridge/shell");
|
|
7
|
+
const log_1 = require("../../test/functionality/_helper/log");
|
|
8
|
+
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
9
|
+
const doc_types_1 = require("./doc-util/doc-types");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const shell_executor_1 = require("../r-bridge/shell-executor");
|
|
12
|
+
const tree_sitter_executor_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
|
|
13
|
+
const doc_files_1 = require("./doc-util/doc-files");
|
|
14
|
+
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
15
|
+
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
16
|
+
async function getText(shell) {
|
|
17
|
+
const rversion = (await shell.usedRVersion())?.format() ?? 'unknown';
|
|
18
|
+
const types = (0, doc_types_1.getTypesFromFolderAsMermaid)({
|
|
19
|
+
rootFolder: path_1.default.resolve('src/r-bridge/lang-4.x/tree-sitter/'),
|
|
20
|
+
files: [path_1.default.resolve('./src/config.ts'), path_1.default.resolve('./src/r-bridge/shell.ts'), path_1.default.resolve('./src/r-bridge/shell-executor.ts')],
|
|
21
|
+
typeName: 'FlowrConfigOptions',
|
|
22
|
+
inlineTypes: doc_types_1.mermaidHide
|
|
23
|
+
});
|
|
24
|
+
return `${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'engines', rVersion: rversion })}
|
|
25
|
+
|
|
26
|
+
To analyze R scripts, flowR needs to parse the R code and for that, we require a parser.
|
|
27
|
+
Originally, flowR shipped with a ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)}, an asynchronous interface to the R interpreter, still available today.
|
|
28
|
+
Later we extended this with the ${(0, doc_types_1.shortLink)(shell_executor_1.RShellExecutor.name, types.info)}, the synchronous counterpart to the ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)}.
|
|
29
|
+
However, these interfaces are relatively slow as they require communication with an underlying R interpreter.
|
|
30
|
+
Using [tree-sitter](https://tree-sitter.github.io/tree-sitter/), with its [node bindings](https://github.com/tree-sitter/node-tree-sitter)
|
|
31
|
+
and [R grammar](https://github.com/r-lib/tree-sitter-r), we can provide the ${(0, doc_types_1.shortLink)(tree_sitter_executor_1.TreeSitterExecutor.name, types.info)} which
|
|
32
|
+
is synchronous, faster, and no longer needs an R installation, but requires the appropriate bindings.
|
|
33
|
+
To allow users of R to freely choose their backend between the R interpreter and the tree-sitter parser,
|
|
34
|
+
we provide the concept of engines.
|
|
35
|
+
|
|
36
|
+
Engines can be loaded with [flowR's configuration file](${doc_files_1.FlowrWikiBaseRef}/Interface#configuring-flowr). Additionally, they
|
|
37
|
+
are exposed with some command line options (e.g., when using the docker image of flowR):
|
|
38
|
+
|
|
39
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.r-shell.disabled', false)} to disable the ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)} engine
|
|
40
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.r-shell.r-path', false)} (which is the canonical version of ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'r-path')})
|
|
41
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.tree-sitter.disabled', false)} to disable the ${(0, doc_types_1.shortLink)(tree_sitter_executor_1.TreeSitterExecutor.name, types.info)} engine
|
|
42
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.tree-sitter.wasm-path', false)} pass the path to the wasm of the r grammar of tree-sitter (see [below](#tree-sitter))
|
|
43
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.tree-sitter.tree-sitter-wasm-path', false)} pass the path to the wasm of tree-sitter (see [below](#tree-sitter))
|
|
44
|
+
- ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'default-engine', false)} to set the default engine to use
|
|
45
|
+
|
|
46
|
+
<a id="tree-sitter"></a>
|
|
47
|
+
## Dealing with the Tree-Sitter Engine
|
|
48
|
+
|
|
49
|
+
${(0, doc_structure_1.block)({
|
|
50
|
+
type: 'WARNING',
|
|
51
|
+
content: 'As the tree-sitter engine is only for parsing, it cannot execute R code.'
|
|
52
|
+
})}
|
|
53
|
+
|
|
54
|
+
In general, there is no need for you to pass custom paths using either
|
|
55
|
+
${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.tree-sitter.wasm-path', false)} or
|
|
56
|
+
${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'engine.tree-sitter.tree-sitter-wasm-path', false)}.
|
|
57
|
+
However, you may want to experiment with the R grammar or provide a newer
|
|
58
|
+
one in case that of _flowR_ is outdated.
|
|
59
|
+
|
|
60
|
+
To use a newer [R grammar](https://github.com/r-lib/tree-sitter-r),
|
|
61
|
+
you first must build the new wasm file. For this you have to:
|
|
62
|
+
|
|
63
|
+
1. Install the dependencies with \`npm ci\` in the tree-sitter-r repository.
|
|
64
|
+
2. Build the wasm using \`tree-sitter build --wasm .\` the [tree sitter cli](https://github.com/tree-sitter/tree-sitter)
|
|
65
|
+
which should be a dev dependency.
|
|
66
|
+
3. Pass the \`tree-sitter-r.wasm\` to flowR.
|
|
67
|
+
|
|
68
|
+
For tree-sitter, please rely on the [releases](https://github.com/tree-sitter/tree-sitter/releases).
|
|
69
|
+
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
/** if we run this script, we want a Markdown representation of the capabilities */
|
|
73
|
+
if (require.main === module) {
|
|
74
|
+
(0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
|
|
75
|
+
const shell = new shell_1.RShell();
|
|
76
|
+
void getText(shell).then(str => {
|
|
77
|
+
console.log(str);
|
|
78
|
+
}).finally(() => {
|
|
79
|
+
shell.close();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=print-engines-wiki.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const shell_1 = require("../r-bridge/shell");
|
|
4
7
|
const log_1 = require("../../test/functionality/_helper/log");
|
|
@@ -19,6 +22,8 @@ const flowr_main_options_1 = require("../cli/flowr-main-options");
|
|
|
19
22
|
const doc_issue_1 = require("./doc-util/doc-issue");
|
|
20
23
|
const pipeline_executor_1 = require("../core/pipeline-executor");
|
|
21
24
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
25
|
+
const doc_types_1 = require("./doc-util/doc-types");
|
|
26
|
+
const path_1 = __importDefault(require("path"));
|
|
22
27
|
async function explainServer(shell) {
|
|
23
28
|
(0, doc_data_server_messages_1.documentAllServerMessages)();
|
|
24
29
|
return `
|
|
@@ -96,7 +101,7 @@ async function explainRepl(shell) {
|
|
|
96
101
|
return `
|
|
97
102
|
> [!NOTE]
|
|
98
103
|
> To execute arbitrary R commands with a repl request, _flowR_ has to be started explicitly with ${(0, doc_cli_option_1.getCliLongOptionOf)('flowr', 'r-session-access')}.
|
|
99
|
-
> Please be aware that this introduces a security risk.
|
|
104
|
+
> Please be aware that this introduces a security risk and note that this relies on the [\`r-shell\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines).
|
|
100
105
|
|
|
101
106
|
|
|
102
107
|
Although primarily meant for users to explore,
|
|
@@ -167,16 +172,16 @@ Within the REPL this works by running the following:
|
|
|
167
172
|
|
|
168
173
|
${(0, doc_code_1.codeBlock)('shell', ':query @config')}
|
|
169
174
|
|
|
170
|
-
|
|
171
175
|
The following summarizes the configuration options:
|
|
172
176
|
|
|
173
|
-
|
|
174
177
|
- \`ignoreSourceCalls\`: If set to \`true\`, _flowR_ will ignore source calls when analyzing the code, i.e., ignoring the inclusion of other files.
|
|
175
178
|
- \`rPath\`: The path to the R executable. If not set, _flowR_ will try to find the R executable in the system's PATH.
|
|
176
179
|
- \`semantics\`: allows to configure the way _flowR_ handles R, although we currently only support \`semantics/environment/overwriteBuiltIns\`.
|
|
177
180
|
You may use this to overwrite _flowR_'s handling of built-in function and even completely clear the preset definitions shipped with flowR.
|
|
178
181
|
See [Configure BuiltIn Semantics](#configure-builtin-semantics) for more information.
|
|
179
182
|
- \`solver\`: allows to configure how _flowR_ resolves variables and their values (currently we support: ${Object.values(config_1.VariableResolve).map(v => `\`${v}\``).join(', ')}), as well as if pointer analysis should be active.
|
|
183
|
+
- \`engines\`: allows to configure the engines used by _flowR_ to interact with R code. See the [Engines wiki page](${doc_files_1.FlowrWikiBaseRef}/Engines) for more information.
|
|
184
|
+
- \`defaultEngine\`: allows to specify the default engine to use for interacting with R code. If not set, an arbitrary engine from the specified list will be used.
|
|
180
185
|
|
|
181
186
|
So you can configure _flowR_ by adding a file like the following:
|
|
182
187
|
|
|
@@ -196,6 +201,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
|
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
203
|
},
|
|
204
|
+
engines: [{ type: 'r-shell' }],
|
|
199
205
|
solver: {
|
|
200
206
|
variables: config_1.VariableResolve.Alias,
|
|
201
207
|
pointerTracking: true
|
|
@@ -234,41 +240,45 @@ ${(0, schema_1.describeSchema)(config_1.flowrConfigFileSchema, ansi_1.markdownFo
|
|
|
234
240
|
`;
|
|
235
241
|
}
|
|
236
242
|
function explainWritingCode(shell) {
|
|
243
|
+
const types = (0, doc_types_1.getTypesFromFolderAsMermaid)({
|
|
244
|
+
rootFolder: path_1.default.resolve('./src/r-bridge/'),
|
|
245
|
+
files: [path_1.default.resolve('./src/core/pipeline-executor.ts'), path_1.default.resolve('./src/core/steps/pipeline/default-pipelines.ts')],
|
|
246
|
+
typeName: 'RShell',
|
|
247
|
+
inlineTypes: doc_types_1.mermaidHide
|
|
248
|
+
});
|
|
237
249
|
return `
|
|
238
|
-
|
|
239
|
-
|
|
240
250
|
_flowR_ can be used as a [module](${doc_files_1.FlowrNpmRef}) and offers several main classes and interfaces that are interesting for extension writers
|
|
241
251
|
(see the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the [core](${doc_files_1.FlowrWikiBaseRef}/Core) wiki page for more information).
|
|
242
252
|
|
|
243
|
-
### Using the
|
|
253
|
+
### Using the ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)} to Interact with R
|
|
244
254
|
|
|
245
|
-
The
|
|
246
|
-
|
|
255
|
+
The ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)} class allows interfacing with the \`R\` ecosystem installed on the host system.
|
|
256
|
+
Please have a look at [flowR's engines](${doc_files_1.FlowrWikiBaseRef}/Engines) for more information on alterantives.
|
|
247
257
|
|
|
248
258
|
> [!IMPORTANT]
|
|
249
|
-
> Each
|
|
259
|
+
> Each ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info)} controls a new instance of the R interpreter, make sure to call <code>${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info, false)}::${shell.close.name}()</code> when you’re done.
|
|
250
260
|
|
|
251
|
-
You can start a new "session" simply by constructing a new object with
|
|
261
|
+
You can start a new "session" simply by constructing a new object with <code>new ${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info, false)}()</code>.
|
|
252
262
|
|
|
253
|
-
However, there are several options
|
|
263
|
+
However, there are several options that may be of interest (e.g., to automatically revive the shell in case of errors or to control the name location of the R process on the system).
|
|
254
264
|
|
|
255
|
-
With a shell object (let's call it \`shell\`), you can execute R code by using
|
|
265
|
+
With a shell object (let's call it \`shell\`), you can execute R code by using <code>${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info, false)}::${shell.sendCommand.name}</code>,
|
|
256
266
|
for example \`shell.${shell.sendCommand.name}("1 + 1")\`.
|
|
257
|
-
However, this does not return anything, so if you want to collect the output of your command, use
|
|
267
|
+
However, this does not return anything, so if you want to collect the output of your command, use <code>${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info, false)}::${shell.sendCommandWithOutput.name}</code> instead.
|
|
258
268
|
|
|
259
|
-
Besides that, the command
|
|
269
|
+
Besides that, the command <code>${(0, doc_types_1.shortLink)(shell_1.RShell.name, types.info, false)}::${shell.tryToInjectHomeLibPath.name}</code> may be of interest, as it enables all libraries available on the host system.
|
|
260
270
|
|
|
261
271
|
### The Pipeline Executor
|
|
262
272
|
|
|
263
273
|
Once, in the beginning, _flowR_ was meant to produce a dataflow graph merely to provide *program slices*.
|
|
264
|
-
However, with continuous updates, the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow
|
|
274
|
+
However, with continuous updates, the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) repeatedly proves to be the more interesting part.
|
|
265
275
|
With this, we restructured _flowR_'s originally *hardcoded* pipeline to be far more flexible.
|
|
266
276
|
Now, it can be theoretically extended or replaced with arbitrary steps, optional steps, and what we call 'decorations' of these steps.
|
|
267
|
-
In short, if you still "just want to slice" you can do it like this:
|
|
277
|
+
In short, if you still "just want to slice" you can do it like this with the ${(0, doc_types_1.shortLink)(pipeline_executor_1.PipelineExecutor.name, types.info)}:
|
|
268
278
|
|
|
269
279
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
270
280
|
const slicer = new ${pipeline_executor_1.PipelineExecutor.name}(DEFAULT_SLICING_PIPELINE, {
|
|
271
|
-
|
|
281
|
+
parser: new ${shell_1.RShell.name}(),
|
|
272
282
|
request: ${retriever_1.requestFromInput.name}('x <- 1\\nx + 1'),
|
|
273
283
|
criterion: ['2@x']
|
|
274
284
|
})
|
|
@@ -281,9 +291,9 @@ const slice = await slicer.allRemainingSteps()
|
|
|
281
291
|
<summary style='color:gray'>More Information</summary>
|
|
282
292
|
|
|
283
293
|
If you compare this, with what you would have done with the old (and removed) \`SteppingSlicer\`,
|
|
284
|
-
this essentially just requires you to replace the \`SteppingSlicer\` with the
|
|
285
|
-
and to pass the
|
|
286
|
-
The
|
|
294
|
+
this essentially just requires you to replace the \`SteppingSlicer\` with the ${(0, doc_types_1.shortLink)(pipeline_executor_1.PipelineExecutor.name, types.info)}
|
|
295
|
+
and to pass the ${(0, doc_types_1.shortLink)('DEFAULT_SLICING_PIPELINE', types.info)} as the first argument.
|
|
296
|
+
The ${(0, doc_types_1.shortLink)(pipeline_executor_1.PipelineExecutor.name, types.info)}...
|
|
287
297
|
|
|
288
298
|
1. allows investigating the results of all intermediate steps
|
|
289
299
|
2. Can be executed step-by-step
|
|
@@ -24,7 +24,7 @@ async function getText(shell) {
|
|
|
24
24
|
const now = performance.now();
|
|
25
25
|
const types = (0, doc_types_1.getTypesFromFolderAsMermaid)({
|
|
26
26
|
rootFolder: path_1.default.resolve('./src/r-bridge/lang-4.x/ast/model/'),
|
|
27
|
-
files: [path_1.default.resolve('./src/abstract-interpretation/normalized-ast-fold.ts')],
|
|
27
|
+
files: [path_1.default.resolve('./src/abstract-interpretation/normalized-ast-fold.ts'), path_1.default.resolve('./src/core/steps/pipeline/default-pipelines.ts')],
|
|
28
28
|
typeName: 'RNode',
|
|
29
29
|
inlineTypes: doc_types_1.mermaidHide
|
|
30
30
|
});
|
|
@@ -77,7 +77,7 @@ ${(0, doc_code_1.codeBlock)('mermaid', types.text)}
|
|
|
77
77
|
_The generation of the class diagram required ${(0, time_1.printAsMs)(elapsed)}._
|
|
78
78
|
</details>
|
|
79
79
|
|
|
80
|
-
Node types are controlled by the
|
|
80
|
+
Node types are controlled by the ${(0, doc_types_1.shortLink)('RType', types.info)} enum (see ${(0, doc_files_1.getFilePathMd)('../r-bridge/lang-4.x/ast/model/type.ts')}),
|
|
81
81
|
which is used to distinguish between different types of nodes.
|
|
82
82
|
Additionally, every AST node is generic with respect to the \`Info\` type which allows for arbitrary decorations (e.g., parent inforamtion or dataflow constraints).
|
|
83
83
|
Most notably, the \`info\` field holds the \`id\` of the node, which is used to reference the node in the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph).
|
|
@@ -94,13 +94,13 @@ The following segments intend to give you an overview of how to work with the no
|
|
|
94
94
|
## How Get a Normalized AST
|
|
95
95
|
|
|
96
96
|
As explained alongside the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#the-pipeline-executor) wiki page, you can use the
|
|
97
|
-
\`${pipeline_executor_1.PipelineExecutor.name}\` to get the
|
|
98
|
-
a pipeline like the
|
|
97
|
+
\`${pipeline_executor_1.PipelineExecutor.name}\` to get the ${(0, doc_types_1.shortLink)('NormalizedAst', types.info)}. If you are only interested in the normalization,
|
|
98
|
+
a pipeline like the ${(0, doc_types_1.shortLink)('DEFAULT_NORMALIZE_PIPELINE', types.info)} suffices:
|
|
99
99
|
|
|
100
100
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
101
101
|
async function getAst(code: string): Promise<RNode> {
|
|
102
102
|
const result = await new ${pipeline_executor_1.PipelineExecutor.name}(DEFAULT_NORMALIZE_PIPELINE, {
|
|
103
|
-
|
|
103
|
+
parser: new ${shell_1.RShell.name}(),
|
|
104
104
|
request: ${retriever_1.requestFromInput.name}(code.trim())
|
|
105
105
|
}).allRemainingSteps();
|
|
106
106
|
return result.normalize.ast;
|
|
@@ -26,6 +26,9 @@ const doc_issue_1 = require("./doc-util/doc-issue");
|
|
|
26
26
|
const location_map_query_executor_1 = require("../queries/catalog/location-map-query/location-map-query-executor");
|
|
27
27
|
const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
28
28
|
const config_query_executor_1 = require("../queries/catalog/config-query/config-query-executor");
|
|
29
|
+
const search_query_executor_1 = require("../queries/catalog/search-query/search-query-executor");
|
|
30
|
+
const flowr_search_builder_1 = require("../search/flowr-search-builder");
|
|
31
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
29
32
|
(0, doc_query_1.registerQueryDocumentation)('call-context', {
|
|
30
33
|
name: 'Call-Context Query',
|
|
31
34
|
type: 'active',
|
|
@@ -191,6 +194,25 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
|
|
|
191
194
|
`;
|
|
192
195
|
}
|
|
193
196
|
});
|
|
197
|
+
(0, doc_query_1.registerQueryDocumentation)('search', {
|
|
198
|
+
name: 'Search Query',
|
|
199
|
+
type: 'active',
|
|
200
|
+
shortDescription: 'Provides access to flowR\'s search API',
|
|
201
|
+
functionName: search_query_executor_1.executeSearch.name,
|
|
202
|
+
functionFile: '../queries/catalog/search-query/search-query-executor.ts',
|
|
203
|
+
buildExplanation: async (shell) => {
|
|
204
|
+
const exampleCode = 'x + 1';
|
|
205
|
+
return `
|
|
206
|
+
With this query you can use the [Search API](${doc_files_1.FlowrWikiBaseRef}/Search%20API) to conduct searches on the flowR analysis result.
|
|
207
|
+
|
|
208
|
+
Using the example code \`${exampleCode}\`, the following query returns all uses of 'x' in the code:
|
|
209
|
+
${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
|
|
210
|
+
type: 'search',
|
|
211
|
+
search: flowr_search_builder_1.Q.var('x').filter(vertex_1.VertexType.Use).build()
|
|
212
|
+
}], { showCode: true, collapseQuery: false })}
|
|
213
|
+
`;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
194
216
|
(0, doc_query_1.registerQueryDocumentation)('id-map', {
|
|
195
217
|
name: 'Id-Map Query',
|
|
196
218
|
type: 'active',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const shell_1 = require("../r-bridge/shell");
|
|
7
|
+
const log_1 = require("../../test/functionality/_helper/log");
|
|
8
|
+
const doc_files_1 = require("./doc-util/doc-files");
|
|
9
|
+
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
10
|
+
const doc_search_1 = require("./doc-util/doc-search");
|
|
11
|
+
const flowr_search_builder_1 = require("../search/flowr-search-builder");
|
|
12
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
13
|
+
const doc_types_1 = require("./doc-util/doc-types");
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
async function getText(shell) {
|
|
16
|
+
const rversion = (await shell.usedRVersion())?.format() ?? 'unknown';
|
|
17
|
+
const types = (0, doc_types_1.getTypesFromFolderAsMermaid)({
|
|
18
|
+
rootFolder: path_1.default.resolve('./src/search/'),
|
|
19
|
+
typeName: 'FlowrSearchGenerator',
|
|
20
|
+
inlineTypes: doc_types_1.mermaidHide
|
|
21
|
+
});
|
|
22
|
+
return `${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'search API', rVersion: rversion })}
|
|
23
|
+
|
|
24
|
+
This page briefly summarizes flowR's search API which provides a set of functions to search for nodes in the [Dataflow Graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) and the
|
|
25
|
+
[Normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) of a given R code (the search will always consider both, with respect to your search query).
|
|
26
|
+
Please see the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on how to access this API.
|
|
27
|
+
Within code, you can execute a search using the ${(0, doc_types_1.shortLink)('runSearch', types.info)} function.
|
|
28
|
+
|
|
29
|
+
For an initial motivation, let's have a look at the following example:
|
|
30
|
+
|
|
31
|
+
${await (0, doc_search_1.showSearch)(shell, 'x <- x * x', flowr_search_builder_1.Q.var('x'))}
|
|
32
|
+
|
|
33
|
+
This returns all references to the variable \`x\` in the code.
|
|
34
|
+
However, the search API is not limited to simple variable references and can do much more.
|
|
35
|
+
|
|
36
|
+
For example, let's have every definition of \`x\` in the code but the first one:
|
|
37
|
+
|
|
38
|
+
${await (0, doc_search_1.showSearch)(shell, 'x <- x * x\nprint(x)\nx <- y <- 3\nprint(x)\nx <- 2', flowr_search_builder_1.Q.var('x').filter(vertex_1.VertexType.VariableDefinition).skip(1))}
|
|
39
|
+
|
|
40
|
+
In summary, every search has two parts. It is initialized with a _generator_ (such as \`Q.var('x')\`)
|
|
41
|
+
and can be further refined with _transformers_ or _modifiers_.
|
|
42
|
+
Such queries can be constructed starting from the ${(0, doc_types_1.shortLink)('Q', types.info)} object (backed by ${(0, doc_types_1.shortLink)('FlowrSearchGenerator', types.info)}) and
|
|
43
|
+
are fully serializable so you can use them when communicating with the [Query API](${doc_files_1.FlowrWikiBaseRef}/Query%20API).
|
|
44
|
+
|
|
45
|
+
We offer the following generators:
|
|
46
|
+
|
|
47
|
+
${Object.keys(flowr_search_builder_1.Q).sort().map(key => `- ${(0, doc_types_1.shortLink)(`FlowrSearchGenerator::${key}`, types.info)}\\\n${(0, doc_types_1.getDocumentationForType)(`FlowrSearchGenerator::${key}`, types.info)}`).join('\n')}
|
|
48
|
+
|
|
49
|
+
Likewise, we have a palette of _transformers_ and _modifiers_:
|
|
50
|
+
|
|
51
|
+
${
|
|
52
|
+
/* let's iterate over all methods of FlowrSearchBuilder */
|
|
53
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(new flowr_search_builder_1.FlowrSearchBuilder(undefined)))
|
|
54
|
+
.filter(n => n !== 'constructor').sort().map(key => `- ${(0, doc_types_1.shortLink)(`FlowrSearchBuilder::${key}`, types.info)}\\\n${(0, doc_types_1.getDocumentationForType)(`FlowrSearchBuilder::${key}`, types.info)}`).join('\n')}
|
|
55
|
+
|
|
56
|
+
Every search (and consequently the search pipeline) works with an array of ${(0, doc_types_1.shortLink)('FlowrSearchElement', types.info)} (neatly wrapped in ${(0, doc_types_1.shortLink)('FlowrSearchElements', types.info)}).
|
|
57
|
+
Hence, even operations such as \`.first\` or \`.last\` return an array of elements (albeit with a single or no element).
|
|
58
|
+
The search API does its best to stay typesafe wrt. to the return type and the transformers in use.
|
|
59
|
+
In addition, it offers optimizer passes to optimize the search pipeline before execution.
|
|
60
|
+
They are executed with \`.build\` which may happen automatically, whenever you want to run a search using ${(0, doc_types_1.shortLink)('runSearch', types.info)}.
|
|
61
|
+
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
/** if we run this script, we want a Markdown representation of the capabilities */
|
|
65
|
+
if (require.main === module) {
|
|
66
|
+
(0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
|
|
67
|
+
const shell = new shell_1.RShell();
|
|
68
|
+
void getText(shell).then(str => {
|
|
69
|
+
console.log(str);
|
|
70
|
+
}).finally(() => {
|
|
71
|
+
shell.close();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=print-search-wiki.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eagleoutice/flowr",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -21,17 +21,21 @@
|
|
|
21
21
|
"stats-helper": "ts-node src/cli/statistics-helper-app.ts",
|
|
22
22
|
"slicer": "ts-node src/cli/slicer-app.ts",
|
|
23
23
|
"benchmark-helper": "ts-node src/cli/benchmark-helper-app.ts",
|
|
24
|
-
"benchmark": "npm run build && node dist/src/cli/benchmark-app.js",
|
|
24
|
+
"benchmark": "npm run build && npm run build:copy-wasm && node dist/src/cli/benchmark-app.js",
|
|
25
25
|
"summarizer": "ts-node src/cli/summarizer-app.ts",
|
|
26
26
|
"export-quads": "ts-node src/cli/export-quads-app.ts",
|
|
27
27
|
"capabilities-markdown": "ts-node src/documentation/print-capabilities-markdown.ts",
|
|
28
28
|
"wiki:df-graph": "ts-node src/documentation/print-dataflow-graph-wiki.ts",
|
|
29
29
|
"wiki:normalized-ast": "ts-node src/documentation/print-normalized-ast-wiki.ts",
|
|
30
30
|
"wiki:query-api": "ts-node src/documentation/print-query-wiki.ts",
|
|
31
|
+
"wiki:engines": "ts-node src/documentation/print-engines-wiki.ts",
|
|
32
|
+
"wiki:search-api": "ts-node src/documentation/print-search-wiki.ts",
|
|
31
33
|
"wiki:linting-and-testing": "ts-node src/documentation/print-linting-and-testing-wiki.ts",
|
|
32
34
|
"wiki:interface": "ts-node src/documentation/print-interface-wiki.ts",
|
|
33
35
|
"build": "tsc --project .",
|
|
34
|
-
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --bundle --minify --target=node22 --outfile=dist/src/cli/flowr.min.js",
|
|
36
|
+
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --bundle --minify --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm-min",
|
|
37
|
+
"build:copy-wasm": "cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter-r.wasm dist/src/r-bridge/lang-4.x/tree-sitter/ && cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter.wasm dist/src/r-bridge/lang-4.x/tree-sitter/",
|
|
38
|
+
"build:copy-wasm-min": "cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter-r.wasm dist/src/cli && cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter.wasm dist/src/cli",
|
|
35
39
|
"lint-local": "npx eslint --version && npx eslint src/ test/ --rule \"no-warning-comments: off\"",
|
|
36
40
|
"lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/",
|
|
37
41
|
"license-compat": "license-checker --onlyAllow 'MIT;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
|
|
@@ -39,7 +43,7 @@
|
|
|
39
43
|
"test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
|
|
40
44
|
"test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
|
|
41
45
|
"test:coverage": "npm run test -- --coverage",
|
|
42
|
-
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3; cd ../../; }; func",
|
|
46
|
+
"performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
|
|
43
47
|
"test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
|
|
44
48
|
"detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
|
|
45
49
|
"checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm-run-all wiki:*"
|
|
@@ -162,7 +166,7 @@
|
|
|
162
166
|
"npm run lint",
|
|
163
167
|
"npm run test-full"
|
|
164
168
|
],
|
|
165
|
-
"after:bump": "npm run build",
|
|
169
|
+
"after:bump": "npm run build && npm run build:copy-wasm",
|
|
166
170
|
"after:git:release": "echo After git push, before github release",
|
|
167
171
|
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
|
|
168
172
|
},
|
|
@@ -219,6 +223,7 @@
|
|
|
219
223
|
"tmp": "^0.2.3",
|
|
220
224
|
"ts-essentials": "^10.0.2",
|
|
221
225
|
"tslog": "^4.9.3",
|
|
226
|
+
"web-tree-sitter": "^0.24.7",
|
|
222
227
|
"ws": "^8.18.0",
|
|
223
228
|
"xpath-ts2": "^1.4.2"
|
|
224
229
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataflowInformation } from '../dataflow/info';
|
|
3
3
|
export interface BaseQueryFormat {
|
|
4
4
|
/** used to select the query type :) */
|
|
5
5
|
readonly type: string;
|
|
@@ -13,5 +13,5 @@ export interface BaseQueryResult {
|
|
|
13
13
|
}
|
|
14
14
|
export interface BasicQueryData {
|
|
15
15
|
readonly ast: NormalizedAst;
|
|
16
|
-
readonly
|
|
16
|
+
readonly dataflow: DataflowInformation;
|
|
17
17
|
}
|
|
@@ -9,4 +9,4 @@ import type { BasicQueryData } from '../../base-query-format';
|
|
|
9
9
|
* This happens during the main resolution!
|
|
10
10
|
* 4. Attach `linkTo` calls to the respective calls.
|
|
11
11
|
*/
|
|
12
|
-
export declare function executeCallContextQueries({ graph, ast }: BasicQueryData, queries: readonly CallContextQuery[]): CallContextQueryResult;
|
|
12
|
+
export declare function executeCallContextQueries({ dataflow: { graph }, ast }: BasicQueryData, queries: readonly CallContextQuery[]): CallContextQueryResult;
|
|
@@ -158,7 +158,7 @@ function doesFilepathMatch(file, filter) {
|
|
|
158
158
|
* This happens during the main resolution!
|
|
159
159
|
* 4. Attach `linkTo` calls to the respective calls.
|
|
160
160
|
*/
|
|
161
|
-
function executeCallContextQueries({ graph, ast }, queries) {
|
|
161
|
+
function executeCallContextQueries({ dataflow: { graph }, ast }, queries) {
|
|
162
162
|
/* omit performance page load */
|
|
163
163
|
const now = Date.now();
|
|
164
164
|
/* the node id and call targets if present */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DataflowClusterQuery, DataflowClusterQueryResult } from './cluster-query-format';
|
|
2
2
|
import type { BasicQueryData } from '../../base-query-format';
|
|
3
|
-
export declare function executeDataflowClusterQuery({ graph }: BasicQueryData, queries: readonly DataflowClusterQuery[]): DataflowClusterQueryResult;
|
|
3
|
+
export declare function executeDataflowClusterQuery({ dataflow: { graph } }: BasicQueryData, queries: readonly DataflowClusterQuery[]): DataflowClusterQueryResult;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeDataflowClusterQuery = executeDataflowClusterQuery;
|
|
4
4
|
const log_1 = require("../../../util/log");
|
|
5
5
|
const cluster_1 = require("../../../dataflow/cluster");
|
|
6
|
-
function executeDataflowClusterQuery({ graph }, queries) {
|
|
6
|
+
function executeDataflowClusterQuery({ dataflow: { graph } }, queries) {
|
|
7
7
|
if (queries.length !== 1) {
|
|
8
8
|
log_1.log.warn('The dataflow cluster query expects only up to one query, but got', queries.length);
|
|
9
9
|
}
|