@eagleoutice/flowr 2.2.11 → 2.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -20
- package/benchmark/slicer.d.ts +49 -22
- package/benchmark/slicer.js +89 -29
- package/benchmark/stats/print.js +16 -10
- package/benchmark/stats/size-of.js +18 -1
- package/benchmark/stats/stats.d.ts +3 -0
- package/benchmark/summarizer/first-phase/input.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +3 -3
- package/benchmark/summarizer/second-phase/process.js +9 -3
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/benchmark-app.d.ts +5 -0
- package/cli/benchmark-app.js +49 -6
- package/cli/benchmark-helper-app.d.ts +4 -0
- package/cli/benchmark-helper-app.js +20 -4
- package/cli/common/options.js +15 -6
- package/cli/common/script.js +1 -1
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-cfg.d.ts +2 -0
- package/cli/repl/commands/repl-cfg.js +38 -24
- package/cli/repl/commands/repl-commands.js +6 -2
- package/cli/repl/commands/repl-dataflow.d.ts +2 -0
- package/cli/repl/commands/repl-dataflow.js +37 -3
- package/cli/repl/commands/repl-execute.js +1 -1
- package/cli/repl/commands/repl-main.d.ts +1 -1
- package/cli/repl/commands/repl-main.js +1 -1
- package/cli/repl/commands/repl-normalize.js +1 -1
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +1 -1
- package/cli/repl/prompt.js +1 -1
- package/cli/repl/server/connection.js +4 -4
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/cli/script-core/statistics-core.js +1 -1
- package/cli/script-core/statistics-helper-core.js +4 -4
- package/config.d.ts +60 -21
- package/config.js +24 -4
- package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
- package/control-flow/basic-cfg-guided-visitor.js +114 -0
- package/control-flow/cfg-properties.d.ts +26 -0
- package/control-flow/cfg-properties.js +100 -0
- package/control-flow/cfg-simplification.d.ts +18 -0
- package/control-flow/cfg-simplification.js +55 -0
- package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
- package/control-flow/cfg-to-basic-blocks.js +81 -0
- package/control-flow/control-flow-graph.d.ts +247 -0
- package/control-flow/control-flow-graph.js +290 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
- package/control-flow/dfg-cfg-guided-visitor.js +71 -0
- package/control-flow/diff-cfg.d.ts +11 -0
- package/control-flow/diff-cfg.js +161 -0
- package/control-flow/extract-cfg.d.ts +30 -0
- package/control-flow/extract-cfg.js +475 -0
- package/control-flow/happens-before.d.ts +7 -0
- package/{util/cfg → control-flow}/happens-before.js +3 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
- package/control-flow/semantic-cfg-guided-visitor.js +492 -0
- package/control-flow/simple-visitor.d.ts +25 -0
- package/control-flow/simple-visitor.js +80 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
- package/control-flow/syntax-cfg-guided-visitor.js +166 -0
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/environments/built-in-config.d.ts +5 -2
- package/dataflow/environments/built-in-config.js +17 -8
- package/dataflow/environments/built-in.d.ts +16 -5
- package/dataflow/environments/built-in.js +55 -6
- package/dataflow/environments/clone.d.ts +5 -0
- package/dataflow/environments/clone.js +5 -0
- package/dataflow/environments/default-builtin-config.d.ts +2 -0
- package/dataflow/environments/default-builtin-config.js +164 -13
- package/dataflow/environments/define.d.ts +5 -1
- package/dataflow/environments/define.js +36 -10
- package/dataflow/environments/overwrite.js +4 -0
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +24 -0
- package/dataflow/environments/resolve-by-name.js +16 -5
- package/dataflow/extractor.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
- package/dataflow/graph/dataflowgraph-builder.js +106 -8
- package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
- package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
- package/dataflow/graph/graph.d.ts +17 -4
- package/dataflow/graph/graph.js +51 -12
- package/dataflow/graph/vertex.d.ts +59 -4
- package/dataflow/graph/vertex.js +32 -0
- package/dataflow/internal/linker.d.ts +3 -2
- package/dataflow/internal/linker.js +36 -25
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +5 -2
- package/dataflow/internal/process/functions/call/common.js +9 -5
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
- package/dataflow/internal/process/process-named-call.d.ts +4 -1
- package/dataflow/internal/process/process-named-call.js +8 -5
- package/dataflow/origin/dfg-get-origin.d.ts +82 -0
- package/dataflow/origin/dfg-get-origin.js +116 -0
- package/documentation/doc-util/doc-cfg.d.ts +20 -4
- package/documentation/doc-util/doc-cfg.js +41 -7
- package/documentation/doc-util/doc-cli-option.js +4 -2
- package/documentation/doc-util/doc-code.js +10 -2
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-escape.d.ts +7 -0
- package/documentation/doc-util/doc-escape.js +19 -0
- package/documentation/doc-util/doc-files.d.ts +1 -0
- package/documentation/doc-util/doc-files.js +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +3 -3
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -1
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/doc-util/doc-server-message.js +2 -2
- package/documentation/doc-util/doc-structure.d.ts +1 -0
- package/documentation/doc-util/doc-structure.js +5 -0
- package/documentation/doc-util/doc-types.d.ts +7 -1
- package/documentation/doc-util/doc-types.js +13 -2
- package/documentation/print-capabilities-markdown.js +28 -2
- package/documentation/print-cfg-wiki.d.ts +1 -0
- package/documentation/print-cfg-wiki.js +572 -0
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-dataflow-graph-wiki.js +180 -25
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-faq-wiki.d.ts +1 -0
- package/documentation/print-faq-wiki.js +75 -0
- package/documentation/print-interface-wiki.js +2 -1
- package/documentation/print-linting-and-testing-wiki.js +52 -36
- package/documentation/print-normalized-ast-wiki.js +1 -1
- package/documentation/print-onboarding-wiki.d.ts +1 -0
- package/documentation/print-onboarding-wiki.js +42 -0
- package/documentation/print-query-wiki.js +23 -3
- package/documentation/print-readme.js +10 -3
- package/package.json +10 -6
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
- package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
- package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
- 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 +4 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.js +2 -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 +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
- package/queries/catalog/origin-query/origin-query-executor.js +33 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
- package/queries/catalog/origin-query/origin-query-format.js +27 -0
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -4
- package/queries/query.d.ts +61 -2
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
- package/r-bridge/retriever.js +1 -1
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-transformer.d.ts +1 -1
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/static/slice-call.js +13 -3
- package/statistics/features/supported/assignments/post-process.js +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -2
- package/statistics/features/supported/used-functions/post-process.js +1 -1
- package/statistics/features/supported/used-packages/post-process.js +2 -2
- package/statistics/features/supported/values/post-process.js +2 -2
- package/statistics/output/print-stats.js +2 -2
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.js +1 -1
- package/statistics/summarizer/post-process/histogram.js +3 -3
- package/statistics/summarizer/post-process/post-process-output.js +3 -3
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +2 -2
- package/util/assert.js +36 -1
- package/util/cfg/cfg.d.ts +0 -80
- package/util/cfg/cfg.js +0 -549
- package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
- package/util/{arrays.js → collections/arrays.js} +44 -3
- package/util/collections/set.js +17 -0
- package/util/{list-access.d.ts → containers.d.ts} +24 -4
- package/util/{list-access.js → containers.js} +42 -12
- package/util/diff-graph.d.ts +47 -0
- package/util/diff-graph.js +61 -0
- package/util/diff.d.ts +6 -6
- package/util/diff.js +1 -1
- package/util/mermaid/ast.js +12 -1
- package/util/mermaid/cfg.d.ts +9 -2
- package/util/mermaid/cfg.js +65 -13
- package/util/mermaid/dfg.d.ts +2 -1
- package/util/mermaid/dfg.js +26 -10
- package/util/mermaid/mermaid.d.ts +2 -0
- package/util/mermaid/mermaid.js +6 -0
- package/util/parallel.d.ts +2 -1
- package/util/parallel.js +11 -2
- package/util/prefix.d.ts +13 -0
- package/util/prefix.js +34 -0
- package/util/quads.js +1 -1
- package/util/schema.d.ts +1 -1
- package/util/schema.js +1 -1
- package/util/summarizer.js +1 -1
- package/util/{text.js → text/text.js} +1 -1
- package/util/{time.js → text/time.js} +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/diff.d.ts +0 -36
- package/util/cfg/happens-before.d.ts +0 -7
- package/util/cfg/visitor.d.ts +0 -9
- package/util/cfg/visitor.js +0 -30
- package/util/set.js +0 -31
- /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
- /package/util/{bimap.js → collections/bimap.js} +0 -0
- /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
- /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
- /package/util/{set.d.ts → collections/set.d.ts} +0 -0
- /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
- /package/util/{ansi.js → text/ansi.js} +0 -0
- /package/util/{args.d.ts → text/args.d.ts} +0 -0
- /package/util/{args.js → text/args.js} +0 -0
- /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
- /package/util/{strings.js → text/strings.js} +0 -0
- /package/util/{text.d.ts → text/text.d.ts} +0 -0
- /package/util/{time.d.ts → text/time.d.ts} +0 -0
|
@@ -43,16 +43,16 @@ exports.summarizeSummarizedTimePerToken = summarizeSummarizedTimePerToken;
|
|
|
43
43
|
exports.summarizeTimePerToken = summarizeTimePerToken;
|
|
44
44
|
const tmp = __importStar(require("tmp"));
|
|
45
45
|
const fs_1 = __importDefault(require("fs"));
|
|
46
|
-
const defaultmap_1 = require("../../../util/defaultmap");
|
|
46
|
+
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
47
47
|
const log_1 = require("../../../util/log");
|
|
48
|
-
const strings_1 = require("../../../util/strings");
|
|
48
|
+
const strings_1 = require("../../../util/text/strings");
|
|
49
49
|
const summarizer_1 = require("../../../util/summarizer");
|
|
50
50
|
const assert_1 = require("../../../util/assert");
|
|
51
51
|
const shell_1 = require("../../../r-bridge/shell");
|
|
52
52
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
53
53
|
const visitor_1 = require("../../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
54
54
|
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
55
|
-
const arrays_1 = require("../../../util/arrays");
|
|
55
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
56
56
|
const tempfile = (() => {
|
|
57
57
|
let _tempfile = undefined;
|
|
58
58
|
return () => {
|
|
@@ -5,7 +5,7 @@ exports.summarizeAllUltimateStats = summarizeAllUltimateStats;
|
|
|
5
5
|
exports.processNextSummary = processNextSummary;
|
|
6
6
|
exports.processNextUltimateSummary = processNextUltimateSummary;
|
|
7
7
|
const process_1 = require("../first-phase/process");
|
|
8
|
-
const defaultmap_1 = require("../../../util/defaultmap");
|
|
8
|
+
const defaultmap_1 = require("../../../util/collections/defaultmap");
|
|
9
9
|
const summarizer_1 = require("../../../util/summarizer");
|
|
10
10
|
const assert_1 = require("../../../util/assert");
|
|
11
11
|
const stats_1 = require("../../stats/stats");
|
|
@@ -85,7 +85,10 @@ function summarizeAllSummarizedStats(stats) {
|
|
|
85
85
|
numberOfFunctionDefinitions: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.numberOfFunctionDefinitions)),
|
|
86
86
|
numberOfCalls: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.numberOfCalls)),
|
|
87
87
|
numberOfEdges: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.numberOfEdges)),
|
|
88
|
-
sizeOfObject: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.sizeOfObject))
|
|
88
|
+
sizeOfObject: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.sizeOfObject)),
|
|
89
|
+
storedVertexIndices: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.storedVertexIndices)),
|
|
90
|
+
storedEnvIndices: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.storedEnvIndices)),
|
|
91
|
+
overwrittenIndices: (0, summarizer_1.summarizeMeasurement)(dataflows.map(d => d.overwrittenIndices)),
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
}
|
|
@@ -125,7 +128,10 @@ function summarizeAllUltimateStats(stats) {
|
|
|
125
128
|
numberOfFunctionDefinitions: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfFunctionDefinitions)),
|
|
126
129
|
numberOfCalls: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfCalls)),
|
|
127
130
|
numberOfEdges: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfEdges)),
|
|
128
|
-
sizeOfObject: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.sizeOfObject))
|
|
131
|
+
sizeOfObject: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.sizeOfObject)),
|
|
132
|
+
storedVertexIndices: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.storedVertexIndices)),
|
|
133
|
+
storedEnvIndices: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.storedEnvIndices)),
|
|
134
|
+
overwrittenIndices: (0, process_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.overwrittenIndices)),
|
|
129
135
|
}
|
|
130
136
|
};
|
|
131
137
|
}
|
|
@@ -13,7 +13,7 @@ const summarizer_1 = require("../../util/summarizer");
|
|
|
13
13
|
const files_1 = require("../../util/files");
|
|
14
14
|
const json_1 = require("../../util/json");
|
|
15
15
|
const print_1 = require("../stats/print");
|
|
16
|
-
const defaultmap_1 = require("../../util/defaultmap");
|
|
16
|
+
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
17
17
|
const log_1 = require("../../util/log");
|
|
18
18
|
class BenchmarkSummarizer extends summarizer_1.Summarizer {
|
|
19
19
|
constructor(config) {
|
package/cli/benchmark-app.d.ts
CHANGED
|
@@ -9,4 +9,9 @@ export interface BenchmarkCliOptions {
|
|
|
9
9
|
limit?: number;
|
|
10
10
|
runs?: number;
|
|
11
11
|
parser: KnownParserName;
|
|
12
|
+
'enable-pointer-tracking': boolean;
|
|
13
|
+
'max-file-slices': number;
|
|
14
|
+
threshold?: number;
|
|
15
|
+
'per-file-time-limit'?: number;
|
|
16
|
+
'sampling-strategy': string;
|
|
12
17
|
}
|
package/cli/benchmark-app.js
CHANGED
|
@@ -42,10 +42,17 @@ async function benchmark() {
|
|
|
42
42
|
console.log(`Using ${options.parallel} parallel executors`);
|
|
43
43
|
// we do not use the limit argument to be able to pick the limit randomly
|
|
44
44
|
const files = [];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const firstFile = options.input[0];
|
|
46
|
+
// Check whether input is single JSON file containing a list of paths
|
|
47
|
+
if (options.input.length === 1 && fs_1.default.statSync(firstFile).isFile() && firstFile.endsWith('.json')) {
|
|
48
|
+
console.log('Input is a single JSON file. Assuming it contains a list of files to process');
|
|
49
|
+
const content = fs_1.default.readFileSync(firstFile, 'utf8');
|
|
50
|
+
const paths = JSON.parse(content);
|
|
51
|
+
const baseDir = findCommonBaseDir(paths);
|
|
52
|
+
await collectFiles(files, paths, () => baseDir);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
await collectFiles(files, options.input, (p) => p);
|
|
49
56
|
}
|
|
50
57
|
if (options.limit) {
|
|
51
58
|
log_1.log.info(`limiting to ${options.limit} files`);
|
|
@@ -59,18 +66,54 @@ async function benchmark() {
|
|
|
59
66
|
'--file-id', `${i}`,
|
|
60
67
|
'--output', path_1.default.join(options.output, path_1.default.relative(f.baseDir, `${f.request.content}.json`)),
|
|
61
68
|
'--slice', options.slice, ...verboseAdd,
|
|
62
|
-
'--parser', options.parser
|
|
69
|
+
'--parser', options.parser,
|
|
70
|
+
...(options['enable-pointer-tracking'] ? ['--enable-pointer-tracking'] : []),
|
|
71
|
+
'--max-slices', `${options['max-file-slices']}`,
|
|
72
|
+
...(options.threshold ? ['--threshold', `${options.threshold}`] : []),
|
|
73
|
+
'--sampling-strategy', options['sampling-strategy'],
|
|
63
74
|
]);
|
|
64
75
|
const runs = options.runs ?? 1;
|
|
65
76
|
for (let i = 1; i <= runs; i++) {
|
|
66
77
|
console.log(`Run ${i} of ${runs}`);
|
|
67
78
|
const pool = new parallel_1.LimitedThreadPool(`${__dirname}/benchmark-helper-app`,
|
|
68
79
|
// we reverse here "for looks", since the helper pops from the end, and we want file ids to be ascending :D
|
|
69
|
-
args.map(a => [...a, '--run-num', `${i}`]).reverse(), limit, options.parallel);
|
|
80
|
+
args.map(a => [...a, '--run-num', `${i}`]).reverse(), limit, options.parallel, options['per-file-time-limit']);
|
|
70
81
|
await pool.run();
|
|
71
82
|
const stats = pool.getStats();
|
|
72
83
|
console.log(`Run ${i} of ${runs}: Benchmarked ${stats.counter} files, skipped ${stats.skipped.length} files due to errors`);
|
|
73
84
|
}
|
|
74
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Collect all R files from the given paths.
|
|
88
|
+
*
|
|
89
|
+
* @param files - list of files to append to
|
|
90
|
+
* @param paths - list of paths to search for R files
|
|
91
|
+
* @param getBaseDir - function to get the base directory of a path
|
|
92
|
+
*/
|
|
93
|
+
async function collectFiles(files, paths, getBaseDir) {
|
|
94
|
+
for (const input of paths) {
|
|
95
|
+
for await (const file of (0, files_1.allRFiles)(input)) {
|
|
96
|
+
files.push({ request: file, baseDir: getBaseDir(input) });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Find the common base directory of a list of paths.
|
|
102
|
+
*
|
|
103
|
+
* @param paths - list of paths
|
|
104
|
+
* @returns the common base directory
|
|
105
|
+
*/
|
|
106
|
+
function findCommonBaseDir(paths) {
|
|
107
|
+
const baseDirs = paths.map(f => path_1.default.dirname(f));
|
|
108
|
+
return baseDirs.reduce((acc, dir) => {
|
|
109
|
+
const split = dir.split(path_1.default.sep);
|
|
110
|
+
const accSplit = acc.split(path_1.default.sep);
|
|
111
|
+
let i = 0;
|
|
112
|
+
while (i < split.length && i < accSplit.length && split[i] === accSplit[i]) {
|
|
113
|
+
i++;
|
|
114
|
+
}
|
|
115
|
+
return split.slice(0, i).join(path_1.default.sep);
|
|
116
|
+
}, baseDirs[0]);
|
|
117
|
+
}
|
|
75
118
|
void benchmark();
|
|
76
119
|
//# sourceMappingURL=benchmark-app.js.map
|
|
@@ -11,6 +11,7 @@ const script_1 = require("./common/script");
|
|
|
11
11
|
const slicer_1 = require("../benchmark/slicer");
|
|
12
12
|
const all_variables_1 = require("../slicing/criterion/filters/all-variables");
|
|
13
13
|
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const config_1 = require("../config");
|
|
14
15
|
const options = (0, script_1.processCommandLineArgs)('benchmark-helper', [], {
|
|
15
16
|
subtitle: 'Will slice for all possible variables, signal by exit code if slicing was successful, and can be run standalone',
|
|
16
17
|
examples: [
|
|
@@ -23,6 +24,7 @@ if (options.verbose) {
|
|
|
23
24
|
}
|
|
24
25
|
const numberRegex = /^\d+$/;
|
|
25
26
|
(0, assert_1.guard)(options.slice === 'all' || options.slice === 'no' || numberRegex.test(options.slice), 'slice must be either all, no, or a number');
|
|
27
|
+
(0, assert_1.guard)(options['sampling-strategy'] === 'random' || options['sampling-strategy'] === 'equidistant', 'sample-strategy must be either random or equidistant');
|
|
26
28
|
async function benchmark() {
|
|
27
29
|
// we do not use the limit argument to be able to pick the limit randomly
|
|
28
30
|
(0, assert_1.guard)(options.input !== undefined, 'No input file given');
|
|
@@ -31,18 +33,31 @@ async function benchmark() {
|
|
|
31
33
|
// prefix for printing to console, includes file id and run number if present
|
|
32
34
|
const prefix = `[${options.input}${options['file-id'] !== undefined ? ` (file ${options['file-id']}, run ${options['run-num']})` : ''}]`;
|
|
33
35
|
console.log(`${prefix} Appending output to ${options.output}`);
|
|
34
|
-
|
|
36
|
+
const directory = path_1.default.parse(options.output).dir;
|
|
37
|
+
// ensure the directory exists if path contains one
|
|
38
|
+
if (directory !== '') {
|
|
39
|
+
fs_1.default.mkdirSync(directory, { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
// Enable pointer analysis if requested, otherwise disable it
|
|
42
|
+
if (options['enable-pointer-tracking']) {
|
|
43
|
+
(0, config_1.amendConfig)({ solver: { ...(0, config_1.getConfig)().solver, pointerTracking: true, } });
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
(0, config_1.amendConfig)({ solver: { ...(0, config_1.getConfig)().solver, pointerTracking: false, } });
|
|
47
|
+
}
|
|
35
48
|
// ensure the file exists
|
|
36
49
|
const fileStat = fs_1.default.statSync(options.input);
|
|
37
50
|
(0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
|
|
38
51
|
const request = { request: 'file', content: options.input };
|
|
52
|
+
const maxSlices = options['max-slices'] ?? -1;
|
|
39
53
|
const slicer = new slicer_1.BenchmarkSlicer(options.parser);
|
|
40
54
|
try {
|
|
41
|
-
await slicer.init(request);
|
|
55
|
+
await slicer.init(request, undefined, options.threshold);
|
|
42
56
|
// ${escape}1F${escape}1G${escape}2K for line reset
|
|
43
57
|
if (options.slice === 'all') {
|
|
44
|
-
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`));
|
|
58
|
+
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`), { maxSliceCount: maxSlices });
|
|
45
59
|
console.log(`${prefix} Completed Slicing`);
|
|
60
|
+
(0, assert_1.guard)(count >= 0, `Number of slices exceeded limit of ${maxSlices} with ${-count} slices, skipping in count`);
|
|
46
61
|
(0, assert_1.guard)(count > 0, `No possible slices found for ${options.input}, skipping in count`);
|
|
47
62
|
}
|
|
48
63
|
else if (options.slice === 'no') {
|
|
@@ -51,8 +66,9 @@ async function benchmark() {
|
|
|
51
66
|
else {
|
|
52
67
|
const limit = parseInt(options.slice);
|
|
53
68
|
console.log(`${prefix} Slicing up to ${limit} possible slices`);
|
|
54
|
-
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`), limit);
|
|
69
|
+
const count = await slicer.sliceForAll(all_variables_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`), { sampleCount: limit, maxSliceCount: maxSlices, sampleStrategy: options['sampling-strategy'] });
|
|
55
70
|
console.log(`${prefix} Completed Slicing`);
|
|
71
|
+
(0, assert_1.guard)(count >= 0, `Number of slices exceeded limit of ${maxSlices} with ${-count} slices, skipping in count`);
|
|
56
72
|
(0, assert_1.guard)(count > 0, `No possible slices found for ${options.input}, skipping in count`);
|
|
57
73
|
}
|
|
58
74
|
const { stats } = slicer.finish();
|
package/cli/common/options.js
CHANGED
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.summarizerOptions = exports.statisticHelperOptions = exports.statisticOptions = exports.slicerOptions = exports.exportQuadsOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
|
-
const time_1 = require("../../util/time");
|
|
8
|
+
const time_1 = require("../../util/text/time");
|
|
9
9
|
const feature_1 = require("../../statistics/features/feature");
|
|
10
10
|
/**
|
|
11
|
-
* This string contains a string representation of the
|
|
11
|
+
* This string contains a string representation of the time this module was loaded.
|
|
12
12
|
*/
|
|
13
13
|
const StartTimeString = (0, time_1.date2string)(new Date());
|
|
14
14
|
exports.benchmarkOptions = [
|
|
@@ -16,11 +16,16 @@ exports.benchmarkOptions = [
|
|
|
16
16
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
17
17
|
{ name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process (if given, this will choose these files randomly and add the chosen names to the output' },
|
|
18
18
|
{ name: 'runs', alias: 'r', type: Number, description: 'The amount of benchmark runs that should be done, out of which an average will be calculated' },
|
|
19
|
-
{ name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
|
|
19
|
+
{ name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from. Alternatively, pass a single JSON file that contains a list of paths.', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
|
|
20
20
|
{ name: 'parallel', alias: 'p', type: String, description: 'Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})', defaultValue: Math.max(os_1.default.cpus().length - 1, 1), typeLabel: '{underline number}' },
|
|
21
21
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
22
|
-
{ name: 'output', alias: 'o', type: String, description: `
|
|
23
|
-
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' }
|
|
22
|
+
{ name: 'output', alias: 'o', type: String, description: `Folder to write all the measurements to in a per-file-basis (defaults to {italic benchmark-${StartTimeString}})`, defaultValue: `benchmark-${StartTimeString}`, typeLabel: '{underline folder}' },
|
|
23
|
+
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' },
|
|
24
|
+
{ name: 'enable-pointer-tracking', type: Boolean, description: 'Run dataflow analysis with pointer tracking', defaultValue: false },
|
|
25
|
+
{ name: 'max-file-slices', type: Number, description: 'If file has more than passed number of slices, the file is not processed', defaultValue: -1, typeLabel: '{underline number}' },
|
|
26
|
+
{ name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
27
|
+
{ name: 'per-file-time-limit', type: Number, description: 'Time limit in milliseconds to process single file (disabled by default)', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
28
|
+
{ name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
|
|
24
29
|
];
|
|
25
30
|
exports.benchmarkHelperOptions = [
|
|
26
31
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
|
|
@@ -30,7 +35,11 @@ exports.benchmarkHelperOptions = [
|
|
|
30
35
|
{ name: 'run-num', alias: 'r', type: Number, description: 'The n-th time that the file with the given file-id is being benchmarked' },
|
|
31
36
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
32
37
|
{ name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
|
|
33
|
-
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' }
|
|
38
|
+
{ name: 'parser', type: String, description: 'The parser to use for the benchmark', defaultValue: 'r-shell', typeLabel: '{underline parser}' },
|
|
39
|
+
{ name: 'enable-pointer-tracking', type: Boolean, description: 'Run dataflow analysis with pointer tracking', defaultValue: false },
|
|
40
|
+
{ name: 'max-slices', type: Number, description: 'If file has more than passed number of slices, the file is not processed', defaultValue: -1, typeLabel: '{underline number}' },
|
|
41
|
+
{ name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
|
|
42
|
+
{ name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
|
|
34
43
|
];
|
|
35
44
|
exports.exportQuadsOptions = [
|
|
36
45
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
|
package/cli/common/script.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.processCommandLineArgs = processCommandLineArgs;
|
|
|
13
13
|
const scripts_info_1 = require("./scripts-info");
|
|
14
14
|
const command_line_usage_1 = __importDefault(require("command-line-usage"));
|
|
15
15
|
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
16
|
-
const ansi_1 = require("../../util/ansi");
|
|
16
|
+
const ansi_1 = require("../../util/text/ansi");
|
|
17
17
|
const log_1 = require("../../util/log");
|
|
18
18
|
/**
|
|
19
19
|
* Automatically generates a uniform help from a given script (see {@link scripts}).
|
package/cli/flowr.js
CHANGED
|
@@ -9,7 +9,7 @@ const net_1 = require("./repl/server/net");
|
|
|
9
9
|
const version_1 = require("../util/version");
|
|
10
10
|
const command_line_usage_1 = __importDefault(require("command-line-usage"));
|
|
11
11
|
const log_1 = require("../util/log");
|
|
12
|
-
const ansi_1 = require("../util/ansi");
|
|
12
|
+
const ansi_1 = require("../util/text/ansi");
|
|
13
13
|
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
14
14
|
const config_1 = require("../config");
|
|
15
15
|
const assert_1 = require("../util/assert");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ReplCommand } from './repl-main';
|
|
2
2
|
export declare const controlflowCommand: ReplCommand;
|
|
3
3
|
export declare const controlflowStarCommand: ReplCommand;
|
|
4
|
+
export declare const controlflowBBCommand: ReplCommand;
|
|
5
|
+
export declare const controlflowBBStarCommand: ReplCommand;
|
|
@@ -33,12 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.controlflowStarCommand = exports.controlflowCommand = void 0;
|
|
37
|
-
const
|
|
36
|
+
exports.controlflowBBStarCommand = exports.controlflowBBCommand = exports.controlflowStarCommand = exports.controlflowCommand = void 0;
|
|
37
|
+
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
38
38
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
39
39
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
40
|
-
const
|
|
41
|
-
const ansi_1 = require("../../../util/ansi");
|
|
40
|
+
const cfg_1 = require("../../../util/mermaid/cfg");
|
|
41
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
42
|
+
const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
|
|
42
43
|
async function controlflow(parser, remainingLine) {
|
|
43
44
|
return await (0, default_pipelines_1.createDataflowPipeline)(parser, {
|
|
44
45
|
request: (0, retriever_1.requestFromInput)(remainingLine.trim())
|
|
@@ -50,22 +51,26 @@ function handleString(code) {
|
|
|
50
51
|
function formatInfo(out, type) {
|
|
51
52
|
return out.formatter.format(`Copied ${type} to clipboard.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
|
|
52
53
|
}
|
|
54
|
+
async function produceAndPrintCfg(shell, remainingLine, output, simplifications, cfgConverter) {
|
|
55
|
+
const result = await controlflow(shell, handleString(remainingLine));
|
|
56
|
+
const cfg = (0, extract_cfg_1.extractCFG)(result.normalize, result.dataflow.graph, [...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
|
|
57
|
+
const mermaid = cfgConverter(cfg, result.normalize);
|
|
58
|
+
output.stdout(mermaid);
|
|
59
|
+
try {
|
|
60
|
+
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
61
|
+
clipboard.default.writeSync(mermaid);
|
|
62
|
+
output.stdout(formatInfo(output, 'mermaid code'));
|
|
63
|
+
}
|
|
64
|
+
catch { /* do nothing this is a service thing */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
53
67
|
exports.controlflowCommand = {
|
|
54
68
|
description: `Get mermaid code for the control-flow graph of R code, start with '${retriever_1.fileProtocol}' to indicate a file`,
|
|
55
69
|
usageExample: ':controlflow',
|
|
56
70
|
aliases: ['cfg', 'cf'],
|
|
57
71
|
script: false,
|
|
58
72
|
fn: async (output, shell, remainingLine) => {
|
|
59
|
-
|
|
60
|
-
const cfg = (0, cfg_1.extractCFG)(result.normalize, result.dataflow.graph);
|
|
61
|
-
const mermaid = (0, cfg_2.cfgToMermaid)(cfg, result.normalize);
|
|
62
|
-
output.stdout(mermaid);
|
|
63
|
-
try {
|
|
64
|
-
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
65
|
-
clipboard.default.writeSync(mermaid);
|
|
66
|
-
output.stdout(formatInfo(output, 'mermaid code'));
|
|
67
|
-
}
|
|
68
|
-
catch { /* do nothing this is a service thing */ }
|
|
73
|
+
await produceAndPrintCfg(shell, remainingLine, output, [], cfg_1.cfgToMermaid);
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
76
|
exports.controlflowStarCommand = {
|
|
@@ -74,16 +79,25 @@ exports.controlflowStarCommand = {
|
|
|
74
79
|
aliases: ['cfg*', 'cf*'],
|
|
75
80
|
script: false,
|
|
76
81
|
fn: async (output, shell, remainingLine) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
await produceAndPrintCfg(shell, remainingLine, output, [], cfg_1.cfgToMermaidUrl);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.controlflowBBCommand = {
|
|
86
|
+
description: `Get mermaid code for the control-flow graph with basic blocks, start with '${retriever_1.fileProtocol}' to indicate a file`,
|
|
87
|
+
usageExample: ':controlflowbb',
|
|
88
|
+
aliases: ['cfgb', 'cfb'],
|
|
89
|
+
script: false,
|
|
90
|
+
fn: async (output, shell, remainingLine) => {
|
|
91
|
+
await produceAndPrintCfg(shell, remainingLine, output, ['to-basic-blocks'], cfg_1.cfgToMermaid);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.controlflowBBStarCommand = {
|
|
95
|
+
description: 'Returns the URL to mermaid.live',
|
|
96
|
+
usageExample: ':controlflowbb*',
|
|
97
|
+
aliases: ['cfgb*', 'cfb*'],
|
|
98
|
+
script: false,
|
|
99
|
+
fn: async (output, shell, remainingLine) => {
|
|
100
|
+
await produceAndPrintCfg(shell, remainingLine, output, ['to-basic-blocks'], cfg_1.cfgToMermaidUrl);
|
|
87
101
|
}
|
|
88
102
|
};
|
|
89
103
|
//# sourceMappingURL=repl-cfg.js.map
|
|
@@ -16,8 +16,8 @@ const repl_execute_1 = require("./repl-execute");
|
|
|
16
16
|
const repl_normalize_1 = require("./repl-normalize");
|
|
17
17
|
const repl_dataflow_1 = require("./repl-dataflow");
|
|
18
18
|
const repl_cfg_1 = require("./repl-cfg");
|
|
19
|
-
const ansi_1 = require("../../../util/ansi");
|
|
20
|
-
const args_1 = require("../../../util/args");
|
|
19
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
20
|
+
const args_1 = require("../../../util/text/args");
|
|
21
21
|
const assert_1 = require("../../../util/assert");
|
|
22
22
|
const scripts_info_1 = require("../../common/scripts-info");
|
|
23
23
|
const repl_lineage_1 = require("./repl-lineage");
|
|
@@ -81,8 +81,12 @@ const _commands = {
|
|
|
81
81
|
'normalize*': repl_normalize_1.normalizeStarCommand,
|
|
82
82
|
'dataflow': repl_dataflow_1.dataflowCommand,
|
|
83
83
|
'dataflow*': repl_dataflow_1.dataflowStarCommand,
|
|
84
|
+
'dataflowsimple': repl_dataflow_1.dataflowSimplifiedCommand,
|
|
85
|
+
'dataflowsimple*': repl_dataflow_1.dataflowSimpleStarCommand,
|
|
84
86
|
'controlflow': repl_cfg_1.controlflowCommand,
|
|
85
87
|
'controlflow*': repl_cfg_1.controlflowStarCommand,
|
|
88
|
+
'controlflowbb': repl_cfg_1.controlflowBBCommand,
|
|
89
|
+
'controlflowbb*': repl_cfg_1.controlflowBBStarCommand,
|
|
86
90
|
'lineage': repl_lineage_1.lineageCommand,
|
|
87
91
|
'query': repl_query_1.queryCommand,
|
|
88
92
|
'query*': repl_query_1.queryStarCommand
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ReplCommand } from './repl-main';
|
|
2
2
|
export declare const dataflowCommand: ReplCommand;
|
|
3
3
|
export declare const dataflowStarCommand: ReplCommand;
|
|
4
|
+
export declare const dataflowSimplifiedCommand: ReplCommand;
|
|
5
|
+
export declare const dataflowSimpleStarCommand: ReplCommand;
|
|
@@ -33,11 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.dataflowStarCommand = exports.dataflowCommand = void 0;
|
|
36
|
+
exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
|
|
37
37
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
38
38
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
39
39
|
const dfg_1 = require("../../../util/mermaid/dfg");
|
|
40
|
-
const ansi_1 = require("../../../util/ansi");
|
|
40
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
41
41
|
/**
|
|
42
42
|
* Obtain the dataflow graph using a known parser (such as the {@link RShell} or {@link TreeSitterExecutor}).
|
|
43
43
|
*/
|
|
@@ -53,7 +53,7 @@ function formatInfo(out, type, timing) {
|
|
|
53
53
|
return out.formatter.format(`Copied ${type} to clipboard (dataflow: ${timing}ms).`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
|
|
54
54
|
}
|
|
55
55
|
exports.dataflowCommand = {
|
|
56
|
-
description: `Get mermaid code for the dataflow graph
|
|
56
|
+
description: `Get mermaid code for the dataflow graph, start with '${retriever_1.fileProtocol}' to indicate a file`,
|
|
57
57
|
usageExample: ':dataflow',
|
|
58
58
|
aliases: ['d', 'df'],
|
|
59
59
|
script: false,
|
|
@@ -86,4 +86,38 @@ exports.dataflowStarCommand = {
|
|
|
86
86
|
catch { /* do nothing this is a service thing */ }
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
+
exports.dataflowSimplifiedCommand = {
|
|
90
|
+
description: `Get mermaid code for the simplified dataflow graph, start with '${retriever_1.fileProtocol}' to indicate a file`,
|
|
91
|
+
usageExample: ':dataflowsimple',
|
|
92
|
+
aliases: ['ds', 'dfs'],
|
|
93
|
+
script: false,
|
|
94
|
+
fn: async (output, shell, remainingLine) => {
|
|
95
|
+
const result = await replGetDataflow(shell, handleString(remainingLine));
|
|
96
|
+
const mermaid = (0, dfg_1.graphToMermaid)({ graph: result.dataflow.graph, includeEnvironments: false, simplified: true }).string;
|
|
97
|
+
output.stdout(mermaid);
|
|
98
|
+
try {
|
|
99
|
+
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
100
|
+
clipboard.default.writeSync(mermaid);
|
|
101
|
+
output.stdout(formatInfo(output, 'mermaid code', result.dataflow['.meta'].timing));
|
|
102
|
+
}
|
|
103
|
+
catch { /* do nothing this is a service thing */ }
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
exports.dataflowSimpleStarCommand = {
|
|
107
|
+
description: 'Returns the URL to mermaid.live',
|
|
108
|
+
usageExample: ':dataflowsimple*',
|
|
109
|
+
aliases: ['ds*', 'dfs*'],
|
|
110
|
+
script: false,
|
|
111
|
+
fn: async (output, shell, remainingLine) => {
|
|
112
|
+
const result = await replGetDataflow(shell, handleString(remainingLine));
|
|
113
|
+
const mermaid = (0, dfg_1.graphToMermaidUrl)(result.dataflow.graph, false, undefined, true);
|
|
114
|
+
output.stdout(mermaid);
|
|
115
|
+
try {
|
|
116
|
+
const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
|
|
117
|
+
clipboard.default.writeSync(mermaid);
|
|
118
|
+
output.stdout(formatInfo(output, 'mermaid url', result.dataflow['.meta'].timing));
|
|
119
|
+
}
|
|
120
|
+
catch { /* do nothing this is a service thing */ }
|
|
121
|
+
}
|
|
122
|
+
};
|
|
89
123
|
//# sourceMappingURL=repl-dataflow.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeCommand = void 0;
|
|
4
4
|
exports.tryExecuteRShellCommand = tryExecuteRShellCommand;
|
|
5
|
-
const ansi_1 = require("../../../util/ansi");
|
|
5
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
6
6
|
const shell_1 = require("../../../r-bridge/shell");
|
|
7
7
|
async function tryExecuteRShellCommand(output, parser, statement, allowRSessionAccess) {
|
|
8
8
|
if (!allowRSessionAccess) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.standardReplOutput = void 0;
|
|
4
|
-
const ansi_1 = require("../../../util/ansi");
|
|
4
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
5
5
|
/**
|
|
6
6
|
* Default repl output that redirects everything to the stdout and stderror channels (linked to `console`).
|
|
7
7
|
* @see ReplOutput
|
|
@@ -37,7 +37,7 @@ exports.normalizeStarCommand = exports.normalizeCommand = void 0;
|
|
|
37
37
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
38
38
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
39
39
|
const ast_1 = require("../../../util/mermaid/ast");
|
|
40
|
-
const ansi_1 = require("../../../util/ansi");
|
|
40
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
41
41
|
async function normalize(parser, remainingLine) {
|
|
42
42
|
return await (0, default_pipelines_1.createNormalizePipeline)(parser, {
|
|
43
43
|
request: (0, retriever_1.requestFromInput)(remainingLine.trim())
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.queryStarCommand = exports.queryCommand = void 0;
|
|
4
4
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
5
5
|
const retriever_1 = require("../../../r-bridge/retriever");
|
|
6
|
-
const args_1 = require("../../../util/args");
|
|
7
|
-
const ansi_1 = require("../../../util/ansi");
|
|
6
|
+
const args_1 = require("../../../util/text/args");
|
|
7
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
8
8
|
const schema_1 = require("../../../util/schema");
|
|
9
9
|
const query_1 = require("../../../queries/query");
|
|
10
10
|
const json_1 = require("../../../util/json");
|
package/cli/repl/core.js
CHANGED
|
@@ -52,7 +52,7 @@ const repl_execute_1 = require("./commands/repl-execute");
|
|
|
52
52
|
const os_1 = __importDefault(require("os"));
|
|
53
53
|
const path_1 = __importDefault(require("path"));
|
|
54
54
|
const fs_1 = __importDefault(require("fs"));
|
|
55
|
-
const args_1 = require("../../util/args");
|
|
55
|
+
const args_1 = require("../../util/text/args");
|
|
56
56
|
const repl_commands_1 = require("./commands/repl-commands");
|
|
57
57
|
const scripts_info_1 = require("../common/scripts-info");
|
|
58
58
|
const retriever_1 = require("../../r-bridge/retriever");
|
package/cli/repl/prompt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prompt = exports.rawPrompt = void 0;
|
|
4
|
-
const ansi_1 = require("../../util/ansi");
|
|
4
|
+
const ansi_1 = require("../../util/text/ansi");
|
|
5
5
|
exports.rawPrompt = 'R>';
|
|
6
6
|
// is a function as the 'formatter' is configured only after the cli options have been read
|
|
7
7
|
const prompt = () => `${ansi_1.formatter.format(exports.rawPrompt, { color: 6 /* Colors.Cyan */, effect: ansi_1.ColorEffect.Foreground })} `;
|
|
@@ -45,10 +45,10 @@ const message_slice_1 = require("./messages/message-slice");
|
|
|
45
45
|
const server_1 = require("./server");
|
|
46
46
|
const message_repl_1 = require("./messages/message-repl");
|
|
47
47
|
const core_1 = require("../core");
|
|
48
|
-
const
|
|
48
|
+
const extract_cfg_1 = require("../../../control-flow/extract-cfg");
|
|
49
49
|
const quads_1 = require("../../../util/quads");
|
|
50
50
|
const print_1 = require("../../../core/print/print");
|
|
51
|
-
const ansi_1 = require("../../../util/ansi");
|
|
51
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
52
52
|
const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
|
|
53
53
|
const graph_1 = require("../../../dataflow/graph/graph");
|
|
54
54
|
const tmp = __importStar(require("tmp"));
|
|
@@ -160,7 +160,7 @@ class FlowRServerConnection {
|
|
|
160
160
|
async sendFileAnalysisResponse(slicer, results, message) {
|
|
161
161
|
let cfg = undefined;
|
|
162
162
|
if (message.cfg) {
|
|
163
|
-
cfg = (0,
|
|
163
|
+
cfg = (0, extract_cfg_1.extractCFG)(results.normalize, results.dataflow?.graph);
|
|
164
164
|
}
|
|
165
165
|
const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
|
|
166
166
|
const sanitizedResults = sanitizeAnalysisResults(results);
|
|
@@ -174,7 +174,7 @@ class FlowRServerConnection {
|
|
|
174
174
|
type: 'response-file-analysis',
|
|
175
175
|
format: 'n-quads',
|
|
176
176
|
id: message.id,
|
|
177
|
-
cfg: cfg ? (0,
|
|
177
|
+
cfg: cfg ? (0, extract_cfg_1.cfg2quads)(cfg, config()) : undefined,
|
|
178
178
|
results: {
|
|
179
179
|
parse: await (0, print_1.printStepResult)(parseStep, sanitizedResults.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
|
|
180
180
|
normalize: await (0, print_1.printStepResult)(normalizedStep, sanitizedResults.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IdMessageBase, MessageDefinition } from './all-messages';
|
|
2
|
-
import type { ControlFlowInformation } from '../../../../util/cfg/cfg';
|
|
3
2
|
import type { DEFAULT_DATAFLOW_PIPELINE } from '../../../../core/steps/pipeline/default-pipelines';
|
|
4
3
|
import type { PipelineOutput } from '../../../../core/steps/pipeline/pipeline';
|
|
4
|
+
import type { ControlFlowInformation } from '../../../../control-flow/control-flow-graph';
|
|
5
5
|
/**
|
|
6
6
|
* Send by the client to request an analysis of a given file.
|
|
7
7
|
* Answered by either an {@link FlowrErrorMessage} or a {@link FileAnalysisResponseMessageJson}.
|
|
@@ -15,7 +15,7 @@ const log_1 = require("../../util/log");
|
|
|
15
15
|
const statistics_helper_core_1 = require("./statistics-helper-core");
|
|
16
16
|
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
17
17
|
const scripts_info_1 = require("../common/scripts-info");
|
|
18
|
-
const ansi_1 = require("../../util/ansi");
|
|
18
|
+
const ansi_1 = require("../../util/text/ansi");
|
|
19
19
|
const testRegex = /[^/]*\/test/i;
|
|
20
20
|
const exampleRegex = /[^/]*\/example/i;
|
|
21
21
|
function getPrefixForFile(file) {
|