@eagleoutice/flowr 2.12.3 → 2.13.1
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 +42 -95
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
- package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
- package/abstract-interpretation/data-frame/semantics.js +12 -16
- package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
- package/abstract-interpretation/domains/abstract-domain.js +146 -6
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
- package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
- package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
- package/abstract-interpretation/domains/interval-domain.js +111 -146
- package/abstract-interpretation/domains/lattice.d.ts +3 -3
- package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
- package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
- package/abstract-interpretation/domains/partial-product-domain.js +21 -54
- package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
- package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
- package/abstract-interpretation/domains/product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/product-domain.js +4 -4
- package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
- package/abstract-interpretation/domains/set-range-domain.js +141 -200
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
- package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
- package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
- package/abstract-interpretation/domains/singleton-domain.js +33 -72
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
- package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
- package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
- package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
- package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
- package/benchmark/slicer.d.ts +2 -2
- package/benchmark/slicer.js +6 -5
- package/cli/common/options.d.ts +20 -0
- package/cli/common/options.js +4 -0
- package/cli/common/scripts-info.d.ts +20 -0
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +5 -0
- package/cli/flowr.d.ts +5 -0
- package/cli/flowr.js +15 -7
- package/cli/repl/commands/repl-commands.d.ts +8 -0
- package/cli/repl/commands/repl-commands.js +16 -3
- package/cli/repl/commands/repl-query.js +50 -20
- package/cli/repl/commands/repl-signature.js +2 -2
- package/cli/repl/core.d.ts +14 -5
- package/cli/repl/core.js +32 -17
- package/cli/repl/parser/slice-query-parser.d.ts +69 -8
- package/cli/repl/parser/slice-query-parser.js +82 -13
- package/cli/repl/path-input.d.ts +6 -0
- package/cli/repl/path-input.js +41 -0
- package/cli/repl/print-version.js +3 -5
- package/cli/slicer-app.d.ts +4 -0
- package/cli/slicer-app.js +4 -2
- package/config.d.ts +56 -6
- package/config.js +134 -12
- package/control-flow/control-flow-graph.d.ts +3 -2
- package/control-flow/control-flow-graph.js +34 -14
- package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
- package/control-flow/semantic-cfg-guided-visitor.js +3 -0
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
- package/data/r-base-packages.generated.d.ts +1 -1
- package/data/r-base-packages.generated.js +3 -3
- package/data/sigdb/sigdb.remote.json +53 -53
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +3 -5
- package/dataflow/environments/default-builtin-config.js +2 -2
- package/dataflow/environments/environment.d.ts +9 -0
- package/dataflow/environments/environment.js +28 -7
- package/dataflow/environments/identifier.d.ts +1 -2
- package/dataflow/environments/identifier.js +1 -5
- package/dataflow/extractor.js +1 -2
- package/dataflow/graph/dataflowgraph-builder.js +42 -3
- package/dataflow/graph/df-helper.d.ts +15 -0
- package/dataflow/graph/df-helper.js +20 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
- package/documentation/data/faq/faqs.js +12 -1
- package/documentation/doc-readme.js +1 -1
- package/documentation/doc-util/doc-files.d.ts +2 -2
- package/documentation/doc-util/doc-files.js +4 -7
- package/documentation/doc-util/doc-query.d.ts +12 -9
- package/documentation/doc-util/doc-query.js +63 -28
- package/documentation/wiki-absint.js +1 -4
- package/documentation/wiki-analyzer.js +8 -3
- package/documentation/wiki-cfg.js +3 -2
- package/documentation/wiki-dataflow-graph.js +14 -4
- package/documentation/wiki-interface.js +30 -16
- package/documentation/wiki-mk/doc-maker.js +1 -1
- package/documentation/wiki-query.js +190 -30
- package/documentation/wiki-signature-database.d.ts +1 -1
- package/documentation/wiki-signature-database.js +53 -27
- package/linter/linter-output.d.ts +24 -0
- package/linter/linter-output.js +117 -0
- package/linter/linter-rules.d.ts +2 -4
- package/linter/rules/dataframe-access-validation.js +4 -4
- package/linter/rules/deprecated-functions.d.ts +2 -4
- package/linter/rules/deprecated-functions.js +58 -3
- package/linter/rules/undefined-symbol.js +18 -10
- package/linter/rules/unused-definition.js +24 -0
- package/package.json +5 -2
- package/project/context/flowr-analyzer-context.d.ts +61 -1
- package/project/context/flowr-analyzer-context.js +124 -3
- package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
- package/project/context/flowr-analyzer-dependencies-context.js +33 -3
- package/project/context/flowr-analyzer-files-context.d.ts +40 -0
- package/project/context/flowr-analyzer-files-context.js +171 -14
- package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
- package/project/context/flowr-analyzer-loading-order-context.js +20 -0
- package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
- package/project/context/flowr-analyzer-meta-context.js +64 -23
- package/project/context/flowr-file.d.ts +7 -0
- package/project/context/flowr-file.js +7 -0
- package/project/context/project-kind.d.ts +22 -0
- package/project/context/project-kind.js +27 -0
- package/project/dependency-version-space.d.ts +168 -0
- package/project/dependency-version-space.js +570 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/flowr-analyzer.d.ts +7 -0
- package/project/flowr-analyzer.js +9 -0
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
- package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
- package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
- package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
- package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
- package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
- package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
- package/project/plugins/flowr-analyzer-plugin.js +5 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
- package/project/plugins/package-version-plugins/package.d.ts +4 -1
- package/project/plugins/package-version-plugins/package.js +8 -5
- package/project/plugins/plugin-registry.d.ts +11 -3
- package/project/plugins/plugin-registry.js +24 -5
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
- package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
- package/project/sigdb/build.js +12 -2
- package/project/sigdb/decode.d.ts +7 -0
- package/project/sigdb/decode.js +35 -4
- package/project/sigdb/decompress.d.ts +2 -0
- package/project/sigdb/decompress.js +5 -0
- package/project/sigdb/manifest.d.ts +5 -0
- package/project/sigdb/manifest.js +37 -6
- package/project/sigdb/reader.d.ts +82 -2
- package/project/sigdb/reader.js +226 -14
- package/project/sigdb/schema.d.ts +31 -5
- package/project/sigdb/schema.js +7 -3
- package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
- package/project/sigdb/sigdb-version.js +119 -0
- package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
- package/queries/catalog/absint-query/absint-query-format.js +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
- package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
- package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
- package/queries/catalog/config-query/config-query-executor.js +17 -5
- package/queries/catalog/config-query/config-query-format.d.ts +19 -3
- package/queries/catalog/config-query/config-query-format.js +258 -98
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
- package/queries/catalog/dice-query/dice-query-executor.js +6 -9
- package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
- package/queries/catalog/dice-query/dice-query-format.js +10 -6
- package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
- package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
- package/queries/catalog/files-query/files-query-format.d.ts +2 -0
- package/queries/catalog/files-query/files-query-format.js +2 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +293 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +121 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +345 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
- package/queries/catalog/linter-query/linter-query-executor.js +11 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
- package/queries/catalog/linter-query/linter-query-format.js +44 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +2 -0
- package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
- package/queries/catalog/project-query/project-query-executor.js +19 -62
- package/queries/catalog/project-query/project-query-format.d.ts +7 -18
- package/queries/catalog/project-query/project-query-format.js +3 -18
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
- package/queries/catalog/search-query/search-query-format.d.ts +1 -0
- package/queries/catalog/search-query/search-query-format.js +1 -0
- package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
- package/queries/catalog/signature-query/signature-query-executor.js +267 -57
- package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
- package/queries/catalog/signature-query/signature-query-format.js +41 -5
- package/queries/catalog/signature-query/signature-query-render.js +48 -6
- package/queries/catalog/slice-query-options.d.ts +49 -0
- package/queries/catalog/slice-query-options.js +50 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
- package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
- package/queries/query-print.js +3 -1
- package/queries/query.d.ts +62 -2
- package/queries/query.js +9 -2
- package/r-bridge/data/data.d.ts +16 -0
- package/r-bridge/data/data.js +20 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
- package/reconstruct/reconstruct.d.ts +18 -1
- package/reconstruct/reconstruct.js +42 -19
- package/slicing/criterion/parse.d.ts +4 -0
- package/slicing/criterion/parse.js +4 -0
- package/slicing/static/slice-call.js +17 -9
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +5 -4
- package/util/files.d.ts +19 -1
- package/util/files.js +45 -3
- package/util/glob.d.ts +19 -0
- package/util/glob.js +67 -0
- package/util/log.d.ts +12 -0
- package/util/log.js +17 -1
- package/util/logic.d.ts +6 -0
- package/util/logic.js +31 -1
- package/util/mermaid/dfg.js +17 -12
- package/util/mermaid/mermaid.js +2 -2
- package/util/objects.d.ts +5 -0
- package/util/objects.js +8 -0
- package/util/r-version.d.ts +9 -1
- package/util/r-version.js +27 -2
- package/util/schema.d.ts +18 -0
- package/util/schema.js +102 -4
- package/util/text/ansi.d.ts +4 -0
- package/util/text/ansi.js +27 -3
- package/util/text/strings.d.ts +9 -0
- package/util/text/strings.js +29 -0
- package/util/version.js +79 -6
- package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
- package/project/sigdb/version.js +0 -55
|
@@ -11,14 +11,44 @@ const signature_query_executor_1 = require("./signature-query-executor");
|
|
|
11
11
|
const signature_query_render_1 = require("./signature-query-render");
|
|
12
12
|
/** parse a signature-query repl line into a query: `pkg`, `pkg fn`, `pkg::fn`, `pkg@ver`, globs */
|
|
13
13
|
function signatureQueryLineParser(output, line, _config) {
|
|
14
|
-
|
|
14
|
+
// pull the `--param <name>` (repeatable, comma-separable) / `--required <n>` flags out, leaving the positional tokens
|
|
15
|
+
const parameters = [];
|
|
16
|
+
let requiredParameters;
|
|
17
|
+
let callGraph = false;
|
|
18
|
+
const positional = [];
|
|
19
|
+
for (let i = 0; i < line.length; i++) {
|
|
20
|
+
const tok = line[i];
|
|
21
|
+
if (tok.length === 0) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (tok === '--param' || tok === '-p') {
|
|
25
|
+
parameters.push(...(line[++i] ?? '').split(',').map(s => s.trim()).filter(s => s.length > 0));
|
|
26
|
+
}
|
|
27
|
+
else if (tok === '--required' || tok === '--req') {
|
|
28
|
+
requiredParameters = Number(line[++i]);
|
|
29
|
+
}
|
|
30
|
+
else if (tok === '--cg') {
|
|
31
|
+
callGraph = true;
|
|
32
|
+
}
|
|
33
|
+
else if (!tok.startsWith('--')) {
|
|
34
|
+
positional.push(tok);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// help only when it is the leading word or an explicit flag -- never for a package/function literally named `help`
|
|
15
38
|
if (positional[0] === 'help' || line.includes('--help') || line.includes('-h')) {
|
|
16
39
|
(0, signature_query_render_1.printSignatureHelp)(output);
|
|
17
40
|
return { query: [] };
|
|
18
41
|
}
|
|
42
|
+
const paramFilters = {
|
|
43
|
+
...(parameters.length > 0 ? { parameters } : {}),
|
|
44
|
+
...(requiredParameters !== undefined && !Number.isNaN(requiredParameters) ? { requiredParameters } : {}),
|
|
45
|
+
...(callGraph ? { callGraph: true } : {})
|
|
46
|
+
};
|
|
47
|
+
const hasParamFilter = parameters.length > 0 || (requiredParameters !== undefined && !Number.isNaN(requiredParameters));
|
|
19
48
|
const [first, second] = positional;
|
|
20
49
|
if (!first) {
|
|
21
|
-
|
|
50
|
+
// a bare parameter filter (`--param fuzz`) searches every package; otherwise summarize the databases
|
|
51
|
+
return { query: [{ type: 'signature', ...(hasParamFilter ? { package: '*' } : {}), ...paramFilters }] };
|
|
22
52
|
}
|
|
23
53
|
// `pkg::fn` shorthand, then `pkg@version`
|
|
24
54
|
const dbl = first.indexOf('::');
|
|
@@ -33,11 +63,13 @@ function signatureQueryLineParser(output, line, _config) {
|
|
|
33
63
|
type: 'signature',
|
|
34
64
|
...(pkg ? { package: pkg } : {}),
|
|
35
65
|
...(fn ? { function: fn } : {}),
|
|
36
|
-
...(version ? { version } : {})
|
|
66
|
+
...(version ? { version } : {}),
|
|
67
|
+
...paramFilters
|
|
37
68
|
}]
|
|
38
69
|
};
|
|
39
70
|
}
|
|
40
71
|
exports.SignatureQueryDefinition = {
|
|
72
|
+
title: 'Signature Query',
|
|
41
73
|
executor: signature_query_executor_1.executeSignatureQuery,
|
|
42
74
|
asciiSummarizer: (formatter, _analyzer, queryResults, result, _query) => {
|
|
43
75
|
const out = queryResults;
|
|
@@ -65,12 +97,16 @@ exports.SignatureQueryDefinition = {
|
|
|
65
97
|
},
|
|
66
98
|
fromLine: signatureQueryLineParser,
|
|
67
99
|
completer: signature_query_executor_1.signatureQueryCompleter,
|
|
100
|
+
syntax: '@signature [<pkg>[@<version>]] [<pkg>::<fn> | <fn>] [--param <name>[,...]] [--required <n>] [--cg] [--help]',
|
|
68
101
|
schema: joi_1.default.object({
|
|
69
102
|
type: joi_1.default.string().valid('signature').required().description('The type of the query.'),
|
|
70
103
|
package: joi_1.default.string().optional().description('The package to inspect (glob wildcards allowed); omit for a summary of the loaded databases.'),
|
|
71
104
|
function: joi_1.default.string().optional().description('A function/symbol to inspect (glob wildcards allowed).'),
|
|
72
|
-
version: joi_1.default.string().optional().description('A version spec: an exact version, a glob (3.*),
|
|
73
|
-
|
|
105
|
+
version: joi_1.default.string().optional().description('A version spec: an exact version, a glob (3.*), a semver range (>=3.0.0, 3.x), or a release-date bound (<=2026, >=2021.05 in YYYY.MM.DD).'),
|
|
106
|
+
parameters: joi_1.default.array().items(joi_1.default.string()).optional().description('Keep only functions that have a parameter matching every one of these names (glob wildcards allowed, position-independent).'),
|
|
107
|
+
requiredParameters: joi_1.default.number().integer().min(0).optional().description('Keep only functions with exactly this many required (no-default) parameters, excluding `...`.'),
|
|
108
|
+
callGraph: joi_1.default.boolean().optional().description('For a single function, also render its transitive call graph as a mermaid.live link (`--cg`).')
|
|
109
|
+
}).description('Inspects the loaded signature database(s): loaded databases, a package, a function, or wildcard matches (optionally filtered by parameter name or required-parameter count).'),
|
|
74
110
|
flattenInvolvedNodes: () => []
|
|
75
111
|
};
|
|
76
112
|
//# sourceMappingURL=signature-query-format.js.map
|
|
@@ -9,20 +9,27 @@ exports.pushSummary = pushSummary;
|
|
|
9
9
|
const ansi_1 = require("../../../util/text/ansi");
|
|
10
10
|
const signature_query_executor_1 = require("./signature-query-executor");
|
|
11
11
|
const r_base_packages_1 = require("../../../util/r-base-packages");
|
|
12
|
+
const arrays_1 = require("../../../util/collections/arrays");
|
|
12
13
|
/** print an in-repl usage guide for the signature query */
|
|
13
14
|
function printSignatureHelp(output) {
|
|
14
15
|
const f = output.formatter;
|
|
15
16
|
const ex = (cmd, desc) => output.stdout(` ${(0, ansi_1.bold)(cmd, f)}\n ${(0, ansi_1.italic)(desc, f)}`);
|
|
16
17
|
output.stdout((0, ansi_1.bold)('Signature Database Query', f) + (0, ansi_1.italic)(' (inspects the databases that resolve library()/`::` calls)', f));
|
|
17
18
|
output.stdout('');
|
|
18
|
-
output.stdout(`${(0, ansi_1.bold)('Usage', f)} :query @signature [<package>[@<version>][::<function>] [<function>]]`);
|
|
19
|
+
output.stdout(`${(0, ansi_1.bold)('Usage', f)} :query @signature [<package>[@<version>][::<function>] [<function>]] [--param <name>]... [--required <n>] [--cg]`);
|
|
19
20
|
output.stdout('');
|
|
20
21
|
output.stdout((0, ansi_1.bold)('Examples', f));
|
|
21
22
|
ex(':query @signature', 'summarize the loaded databases');
|
|
22
23
|
ex(':query @signature ggplot2', 'a package: version, exports, dependencies, links');
|
|
23
24
|
ex(':query @signature ggplot2::aes', 'one function (or `ggplot2 aes`, `ggplot2@3.5.0 aes`)');
|
|
24
25
|
ex(':query @signature gg* geom_*', 'glob search (versions also take ranges: >=4.0.0, 4.x)');
|
|
26
|
+
ex(':query @signature gg*@* geom_*', 'search every release in the history, not just the latest');
|
|
27
|
+
ex(':query @signature ggplot2@<=2021.05', 'select releases by date (YYYY.MM.DD: <=2026, >=2021.05)');
|
|
28
|
+
ex(':query @signature ggplot2 * --param data --param mapping', 'functions with both parameters (repeat/comma-separate --param; alone it searches all packages)');
|
|
29
|
+
ex(':query @signature stats * --required 3', 'functions with exactly 3 required parameters');
|
|
30
|
+
ex(':query @signature dplyr::lead --cg', 'a function plus its transitive call graph as a mermaid.live link');
|
|
25
31
|
output.stdout('');
|
|
32
|
+
output.stdout(`${(0, ansi_1.bold)('Signature', f)} ${(0, ansi_1.color)('required', 3 /* Colors.Yellow */, f)} params (no default) are yellow, ${(0, ansi_1.italic)('non-forced', f)} (lazily evaluated) italic, defaults dimmed`);
|
|
26
33
|
output.stdout((0, ansi_1.italic)(':query* dumps the full JSON (every function, the whole match set).', f));
|
|
27
34
|
}
|
|
28
35
|
/** how many names to show inline before an `+N more`: a short sample for a package's functions, more for lists */
|
|
@@ -38,10 +45,18 @@ function linkLocation(file, line, url, f) {
|
|
|
38
45
|
const text = `${file}${line !== undefined ? `:${line}` : ''}`;
|
|
39
46
|
return url ? f.hyperlink(text, url) : text;
|
|
40
47
|
}
|
|
41
|
-
/** render
|
|
48
|
+
/** render one parameter: required (no default) in yellow, non-forced (lazily evaluated) italicised, default dimmed */
|
|
49
|
+
function renderParameter(f, p) {
|
|
50
|
+
if (p.name === '...') {
|
|
51
|
+
return p.name;
|
|
52
|
+
}
|
|
53
|
+
const lazy = p.forced ? {} : { style: 3 /* FontStyles.Italic */ };
|
|
54
|
+
const name = p.default === undefined ? (0, ansi_1.color)(p.name, 3 /* Colors.Yellow */, f, lazy) : p.forced ? p.name : (0, ansi_1.italic)(p.name, f);
|
|
55
|
+
return p.default !== undefined ? `${name} = ${(0, ansi_1.faint)(p.default, f)}` : name;
|
|
56
|
+
}
|
|
57
|
+
/** render a function signature as `name(a, b = default, ...)`; see {@link renderParameter} for the per-parameter styling */
|
|
42
58
|
function renderSignature(f, fn) {
|
|
43
|
-
|
|
44
|
-
return `${(0, ansi_1.bold)(fn.name, f)}(${params})`;
|
|
59
|
+
return `${(0, ansi_1.bold)(fn.name, f)}(${fn.parameters.map(p => renderParameter(f, p)).join(', ')})`;
|
|
45
60
|
}
|
|
46
61
|
/** render the full view of a single function into `result` */
|
|
47
62
|
function pushFunction(result, f, fn) {
|
|
@@ -58,6 +73,9 @@ function pushFunction(result, f, fn) {
|
|
|
58
73
|
if (fn.docUrl) {
|
|
59
74
|
result.push(` ╰ ${(0, ansi_1.italic)('docs', f)} ${f.hyperlink(fn.docUrl, fn.docUrl)}`);
|
|
60
75
|
}
|
|
76
|
+
if (fn.s3method) {
|
|
77
|
+
result.push(` ╰ ${(0, ansi_1.italic)('S3 method of', f)} ${(0, ansi_1.color)(`${fn.s3method.package}::${fn.s3method.generic}`, 5 /* Colors.Magenta */, f)} ${(0, ansi_1.italic)(`(class ${fn.s3method.class})`, f)}`);
|
|
78
|
+
}
|
|
61
79
|
const listLine = (label, items, max) => {
|
|
62
80
|
if (!items.length) {
|
|
63
81
|
return;
|
|
@@ -67,6 +85,9 @@ function pushFunction(result, f, fn) {
|
|
|
67
85
|
};
|
|
68
86
|
listLine('dispatches to', fn.s3methods ?? [], MaxList);
|
|
69
87
|
listLine('calls', fn.callees, MaxList);
|
|
88
|
+
if (fn.callGraph) {
|
|
89
|
+
result.push(` ╰ ${(0, ansi_1.italic)('call graph', f)} ${f.hyperlink('mermaid', fn.callGraph)}`);
|
|
90
|
+
}
|
|
70
91
|
}
|
|
71
92
|
/** render the full view of a single package into `result` */
|
|
72
93
|
function pushPackage(result, f, p) {
|
|
@@ -122,11 +143,19 @@ function pushPackage(result, f, p) {
|
|
|
122
143
|
function pushMatches(result, f, out) {
|
|
123
144
|
const matches = out.matches ?? [];
|
|
124
145
|
const cap = out.truncated ? (0, ansi_1.italic)(` (capped at ${matches.length})`, f) : '';
|
|
125
|
-
|
|
146
|
+
const scanned = out.searched !== undefined && out.searched > (out.matchCount ?? matches.length)
|
|
147
|
+
? (0, ansi_1.faint)(` (of ${out.searched.toLocaleString()} searched)`, f) : '';
|
|
148
|
+
const onlyLatest = out.latestOnly && out.searched !== undefined
|
|
149
|
+
? (0, ansi_1.faint)(' latest versions only, add ', f) + (0, ansi_1.italic)('@*', f) + (0, ansi_1.faint)(' to the package to search the history', f) : '';
|
|
150
|
+
result.push(` ╰ ${(0, ansi_1.bold)(String(out.matchCount ?? matches.length), f)} function${matches.length === 1 ? '' : 's'} matched${scanned}${cap}${onlyLatest}`);
|
|
126
151
|
for (const m of matches) {
|
|
152
|
+
const matched = new Set(m.matchedParameters ?? []);
|
|
153
|
+
const params = m.parameters?.length
|
|
154
|
+
? `${(0, ansi_1.italic)('(', f)}${m.parameters.map(p => matched.has(p) ? (0, ansi_1.color)(p, 3 /* Colors.Yellow */, f, { style: 1 /* FontStyles.Bold */ }) : (0, ansi_1.italic)(p, f)).join((0, ansi_1.italic)(', ', f))}${(0, ansi_1.italic)(')', f)}`
|
|
155
|
+
: '';
|
|
127
156
|
const loc = m.file ? ` ${linkLocation(m.file, m.line, m.sourceUrl, f)}` : '';
|
|
128
157
|
const doc = m.docUrl ? ` ${f.hyperlink('docs', m.docUrl)}` : '';
|
|
129
|
-
result.push(` ╰ ${(0, ansi_1.color)(m.package, 6 /* Colors.Cyan */, f)}::${(0, ansi_1.bold)(m.name, f)}${m.version ? (0, ansi_1.italic)(` v${m.version}`, f) : ''}${loc}${doc}`);
|
|
158
|
+
result.push(` ╰ ${(0, ansi_1.color)(m.package, 6 /* Colors.Cyan */, f)}::${(0, ansi_1.bold)(m.name, f)}${params}${m.version ? (0, ansi_1.italic)(` v${m.version}`, f) : ''}${loc}${doc}`);
|
|
130
159
|
}
|
|
131
160
|
}
|
|
132
161
|
/** render the package hits of a wildcard package search into `result` */
|
|
@@ -151,5 +180,18 @@ function pushSummary(result, f, out) {
|
|
|
151
180
|
for (const db of out.databases) {
|
|
152
181
|
result.push(` ╰ ${(0, ansi_1.color)(db.scope, 6 /* Colors.Cyan */, f)}${db.version ? ` v${db.version}` : ''}${db.date ? (0, ansi_1.italic)(` (${db.date})`, f) : ''}`);
|
|
153
182
|
}
|
|
183
|
+
if (out.shards && out.shards.length > 0) {
|
|
184
|
+
const accessed = out.shards.filter(s => s.accessed).length;
|
|
185
|
+
const unpacked = out.shards.filter(s => s.unpacked).length;
|
|
186
|
+
result.push(` ╰ ${(0, ansi_1.italic)('shards', f)}: ${accessed}/${out.shards.length} accessed, ${unpacked}/${out.shards.length} unpacked`);
|
|
187
|
+
const byScope = [...(0, arrays_1.arraysGroupBy)(out.shards, s => s.id.split('-', 1)[0])].sort(([a], [b]) => a.localeCompare(b));
|
|
188
|
+
for (const [scope, inScope] of byScope) {
|
|
189
|
+
const list = inScope.map(s => {
|
|
190
|
+
const state = s.accessed ? (0, ansi_1.color)('accessed', 2 /* Colors.Green */, f) : s.unpacked ? (0, ansi_1.color)('unpacked', 3 /* Colors.Yellow */, f) : (0, ansi_1.faint)('on disk', f);
|
|
191
|
+
return `${(0, ansi_1.color)(s.id, 6 /* Colors.Cyan */, f)} ${state}`;
|
|
192
|
+
}).join(', ');
|
|
193
|
+
result.push(` ╰ ${(0, ansi_1.italic)(scope, f)}: ${list}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
154
196
|
}
|
|
155
197
|
//# sourceMappingURL=signature-query-render.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options shared by the queries that slice the dataflow graph (`static-slice` and `dice`), so both offer the
|
|
3
|
+
* same knobs without repeating their definition, schema, or reconstruction handling.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import Joi from 'joi';
|
|
7
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
|
+
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
9
|
+
import { SlicingCriteria } from '../../slicing/criterion/parse';
|
|
10
|
+
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
11
|
+
import { type InlineFull, type ReconstructionResult } from '../../reconstruct/reconstruct';
|
|
12
|
+
/** The options every slicing query understands, independent of how it picks the nodes to keep. */
|
|
13
|
+
export interface SliceQueryOptions {
|
|
14
|
+
/** do not reconstruct the slice into readable code */
|
|
15
|
+
readonly noReconstruction?: boolean;
|
|
16
|
+
/** Should the magic comments (force-including lines within the slice) be ignored? */
|
|
17
|
+
readonly noMagicComments?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Inline resolvable `source()` calls into the reconstruction so the result is a single self-contained R text.
|
|
20
|
+
* Cyclic and unresolvable `source()` calls are kept verbatim and reported via `reconstruct.inlineWarnings`.
|
|
21
|
+
*/
|
|
22
|
+
readonly inlineSources?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Inline _every_ file into the reconstruction, in flowR's loading order (which respects implicit sources),
|
|
25
|
+
* independent of whether it is sourced explicitly; `'banner'` additionally precedes each file with a banner
|
|
26
|
+
* comment naming it. Overrides {@link inlineSources}.
|
|
27
|
+
*/
|
|
28
|
+
readonly inlineFull?: InlineFull;
|
|
29
|
+
/**
|
|
30
|
+
* If set (and slicing backward), continue the slice past a function-definition boundary, also including
|
|
31
|
+
* the definition's binding and call sites. Defaults to `false`.
|
|
32
|
+
*/
|
|
33
|
+
readonly includeCallees?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** The Joi keys of {@link SliceQueryOptions}, to be spread into the schema of every slicing query. */
|
|
36
|
+
export declare const SliceQueryOptionsSchema: {
|
|
37
|
+
readonly noReconstruction: Joi.BooleanSchema<boolean>;
|
|
38
|
+
readonly noMagicComments: Joi.BooleanSchema<boolean>;
|
|
39
|
+
readonly inlineSources: Joi.BooleanSchema<boolean>;
|
|
40
|
+
readonly inlineFull: Joi.AlternativesSchema<string | boolean>;
|
|
41
|
+
readonly includeCallees: Joi.BooleanSchema<boolean>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Resolves the criteria to their node ids, reporting those that match no node: they would slice nothing,
|
|
45
|
+
* as {@link SlicingCriteria.convertAll} keeps them verbatim.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveSliceCriteria(criteria: SlicingCriteria, ast: NormalizedAst): NodeId[];
|
|
48
|
+
/** Reconstruct the given `nodes` of `ast`, honoring the inlining and magic-comment options. */
|
|
49
|
+
export declare function reconstructSlice(ast: NormalizedAst, graph: DataflowGraph, nodes: ReadonlySet<NodeId>, options: SliceQueryOptions): ReconstructionResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
exports.SliceQueryOptionsSchema = void 0;
|
|
7
|
+
exports.resolveSliceCriteria = resolveSliceCriteria;
|
|
8
|
+
exports.reconstructSlice = reconstructSlice;
|
|
9
|
+
/**
|
|
10
|
+
* The options shared by the queries that slice the dataflow graph (`static-slice` and `dice`), so both offer the
|
|
11
|
+
* same knobs without repeating their definition, schema, or reconstruction handling.
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
const joi_1 = __importDefault(require("joi"));
|
|
15
|
+
const parse_1 = require("../../slicing/criterion/parse");
|
|
16
|
+
const reconstruct_1 = require("../../reconstruct/reconstruct");
|
|
17
|
+
const source_inline_map_1 = require("../../reconstruct/inline/source-inline-map");
|
|
18
|
+
const auto_select_defaults_1 = require("../../reconstruct/auto-select/auto-select-defaults");
|
|
19
|
+
const magic_comments_1 = require("../../reconstruct/auto-select/magic-comments");
|
|
20
|
+
/** The Joi keys of {@link SliceQueryOptions}, to be spread into the schema of every slicing query. */
|
|
21
|
+
exports.SliceQueryOptionsSchema = {
|
|
22
|
+
noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'),
|
|
23
|
+
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?'),
|
|
24
|
+
inlineSources: joi_1.default.boolean().optional().description('Inline resolvable source() calls into the reconstruction so the result is a single self-contained R text.'),
|
|
25
|
+
inlineFull: joi_1.default.alternatives(joi_1.default.boolean(), joi_1.default.string().valid('banner')).optional().description('Inline all files into the reconstruction, in flowR\'s loading order and independent of whether they are sourced explicitly; "banner" precedes every file with a banner comment naming it.'),
|
|
26
|
+
includeCallees: joi_1.default.boolean().optional().description('If set (and slicing backward), continue the slice past a function-definition boundary, also including the definition\'s binding and call sites.')
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the criteria to their node ids, reporting those that match no node: they would slice nothing,
|
|
30
|
+
* as {@link SlicingCriteria.convertAll} keeps them verbatim.
|
|
31
|
+
*/
|
|
32
|
+
function resolveSliceCriteria(criteria, ast) {
|
|
33
|
+
const ids = parse_1.SlicingCriteria.convertAll(criteria, ast.idMap);
|
|
34
|
+
const unresolved = criteria.filter((_, i) => !ast.idMap.has(ids[i]));
|
|
35
|
+
if (unresolved.length > 0) {
|
|
36
|
+
throw new parse_1.CriteriaParseError(`the slicing criteria ${unresolved.map(c => `'${c}'`).join(', ')} match no element of the program`);
|
|
37
|
+
}
|
|
38
|
+
return ids;
|
|
39
|
+
}
|
|
40
|
+
/** Reconstruct the given `nodes` of `ast`, honoring the inlining and magic-comment options. */
|
|
41
|
+
function reconstructSlice(ast, graph, nodes, options) {
|
|
42
|
+
const { inlineSources, inlineFull, noMagicComments } = options;
|
|
43
|
+
return (0, reconstruct_1.reconstructToCode)(ast, {
|
|
44
|
+
nodes,
|
|
45
|
+
inlineSources,
|
|
46
|
+
inlineFull,
|
|
47
|
+
sourceMap: inlineSources || inlineFull ? source_inline_map_1.SourceInlineMap.build(ast, graph) : undefined
|
|
48
|
+
}, noMagicComments ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=slice-query-options.js.map
|
|
@@ -3,13 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fingerPrintOfQuery = fingerPrintOfQuery;
|
|
4
4
|
exports.executeStaticSliceQuery = executeStaticSliceQuery;
|
|
5
5
|
const static_slicer_1 = require("../../../slicing/static/static-slicer");
|
|
6
|
-
const
|
|
7
|
-
const source_inline_map_1 = require("../../../reconstruct/inline/source-inline-map");
|
|
8
|
-
const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
|
|
9
|
-
const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
|
|
6
|
+
const slice_query_options_1 = require("../slice-query-options");
|
|
10
7
|
const log_1 = require("../../../util/log");
|
|
11
8
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
12
|
-
const parse_1 = require("../../../slicing/criterion/parse");
|
|
13
9
|
/**
|
|
14
10
|
* Produce a fingerprint string for a static slice query
|
|
15
11
|
*/
|
|
@@ -30,22 +26,18 @@ async function executeStaticSliceQuery({ analyzer }, queries) {
|
|
|
30
26
|
if (results[key]) {
|
|
31
27
|
log_1.log.warn(`Duplicate Key for slicing-query: ${key}, skipping...`);
|
|
32
28
|
}
|
|
33
|
-
const { criteria, noReconstruction,
|
|
29
|
+
const { criteria, noReconstruction, includeCallees } = query;
|
|
34
30
|
const sliceStart = Date.now();
|
|
35
31
|
const n = await analyzer.normalize();
|
|
36
32
|
const df = await analyzer.dataflow();
|
|
37
|
-
const slice = (0, static_slicer_1.staticSlice)({ ctx: analyzer.inspectContext(), info: df, ast: n, ids:
|
|
33
|
+
const slice = (0, static_slicer_1.staticSlice)({ ctx: analyzer.inspectContext(), info: df, ast: n, ids: (0, slice_query_options_1.resolveSliceCriteria)(criteria, n), direction: query.direction ?? slice_direction_1.SliceDirection.Backward, threshold: analyzer.flowrConfig.solver.slicer?.threshold, includeCallees });
|
|
38
34
|
const sliceEnd = Date.now();
|
|
39
35
|
if (noReconstruction) {
|
|
40
36
|
results[key] = { slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } } };
|
|
41
37
|
}
|
|
42
38
|
else {
|
|
43
39
|
const reconstructStart = Date.now();
|
|
44
|
-
const reconstruct = (0,
|
|
45
|
-
nodes: slice.result,
|
|
46
|
-
inlineSources: inlineSources,
|
|
47
|
-
sourceMap: inlineSources ? source_inline_map_1.SourceInlineMap.build(n, df.graph) : undefined
|
|
48
|
-
}, noMagicComments ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
|
|
40
|
+
const reconstruct = (0, slice_query_options_1.reconstructSlice)(n, df.graph, slice.result, query);
|
|
49
41
|
const reconstructEnd = Date.now();
|
|
50
42
|
results[key] = {
|
|
51
43
|
slice: { ...slice, '.meta': { timing: sliceEnd - sliceStart } },
|
|
@@ -9,28 +9,15 @@ import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/nod
|
|
|
9
9
|
import type { ReplOutput } from '../../../cli/repl/commands/repl-main';
|
|
10
10
|
import type { FlowrConfig } from '../../../config';
|
|
11
11
|
import { criteriaQueryCompleter } from '../../../cli/repl/parser/slice-query-parser';
|
|
12
|
+
import { type SliceQueryOptions } from '../slice-query-options';
|
|
12
13
|
import { SliceDirection } from '../../../util/slice-direction';
|
|
13
14
|
/** Calculates and returns the static backward or forward slice from the given criteria */
|
|
14
|
-
export interface StaticSliceQuery extends BaseQueryFormat {
|
|
15
|
+
export interface StaticSliceQuery extends BaseQueryFormat, SliceQueryOptions {
|
|
15
16
|
readonly type: 'static-slice';
|
|
16
17
|
/** The slicing criteria to use */
|
|
17
18
|
readonly criteria: SlicingCriteria;
|
|
18
|
-
/** do not reconstruct the slice into readable code */
|
|
19
|
-
readonly noReconstruction?: boolean;
|
|
20
|
-
/** Should the magic comments (force-including lines within the slice) be ignored? */
|
|
21
|
-
readonly noMagicComments?: boolean;
|
|
22
19
|
/** The direction to slice in. Defaults to backward slicing if unset. */
|
|
23
20
|
readonly direction?: SliceDirection;
|
|
24
|
-
/**
|
|
25
|
-
* Inline resolvable `source()` calls into the reconstruction so the result is a single self-contained R text.
|
|
26
|
-
* Cyclic and unresolvable `source()` calls are kept verbatim and reported via `reconstruct.inlineWarnings`.
|
|
27
|
-
*/
|
|
28
|
-
readonly inlineSources?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* If set (and slicing backward), continue the slice past a function-definition boundary, also including
|
|
31
|
-
* the definition's binding and call sites. Defaults to `false`.
|
|
32
|
-
*/
|
|
33
|
-
readonly includeCallees?: boolean;
|
|
34
21
|
}
|
|
35
22
|
export interface StaticSliceQueryResult extends BaseQueryResult {
|
|
36
23
|
/**
|
|
@@ -44,10 +31,12 @@ export interface StaticSliceQueryResult extends BaseQueryResult {
|
|
|
44
31
|
}
|
|
45
32
|
declare function sliceQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'static-slice'>;
|
|
46
33
|
export declare const StaticSliceQueryDefinition: {
|
|
34
|
+
readonly title: "Static Slice Query";
|
|
47
35
|
readonly executor: typeof executeStaticSliceQuery;
|
|
48
36
|
readonly asciiSummarizer: (formatter: import("../../../util/text/ansi").OutputFormatter, _analyzer: import("../../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider<import("../../../r-bridge/parser").KnownParser>, queryResults: BaseQueryResult, result: string[]) => true;
|
|
49
37
|
readonly fromLine: typeof sliceQueryLineParser;
|
|
50
38
|
readonly completer: typeof criteriaQueryCompleter;
|
|
39
|
+
readonly syntax: "@static-slice (<crit>;...)[fiIcB] <code | file://path>";
|
|
51
40
|
readonly schema: Joi.ObjectSchema<any>;
|
|
52
41
|
readonly flattenInvolvedNodes: (queryResults: BaseQueryResult) => NodeId[];
|
|
53
42
|
};
|
|
@@ -10,6 +10,7 @@ const joi_1 = __importDefault(require("joi"));
|
|
|
10
10
|
const static_slice_query_executor_1 = require("./static-slice-query-executor");
|
|
11
11
|
const query_print_1 = require("../../query-print");
|
|
12
12
|
const slice_query_parser_1 = require("../../../cli/repl/parser/slice-query-parser");
|
|
13
|
+
const slice_query_options_1 = require("../slice-query-options");
|
|
13
14
|
const slice_direction_1 = require("../../../util/slice-direction");
|
|
14
15
|
const SliceCriterionHelp = [
|
|
15
16
|
'Each criterion picks one element of the program, separate multiple ones with ";":',
|
|
@@ -19,30 +20,30 @@ const SliceCriterionHelp = [
|
|
|
19
20
|
' <line>~<col> the innermost element containing line <line>, column <col> (e.g. 2~5)',
|
|
20
21
|
' $<id> the normalized node with the id <id> (e.g. $42)',
|
|
21
22
|
'A negative <line> counts from the end; a trailing (file-regex) restricts to a file (e.g. 2@x(tmp/.*)).',
|
|
22
|
-
|
|
23
|
+
`Append flags after the ")": ${(0, slice_query_parser_1.describeSliceFlags)(slice_query_parser_1.StaticSliceFlags)}.`,
|
|
23
24
|
'Example: :query @static-slice (2@x;3:1)fc'
|
|
24
25
|
].join('\n');
|
|
25
26
|
function sliceQueryLineParser(output, line, _config) {
|
|
26
27
|
const criteria = (0, slice_query_parser_1.sliceCriteriaParser)(line[0]);
|
|
27
28
|
const direction = (0, slice_query_parser_1.sliceDirectionParser)(line[0]);
|
|
28
|
-
const
|
|
29
|
-
const includeCallees = (0, slice_query_parser_1.sliceIncludeCalleesParser)(line[0]);
|
|
29
|
+
const options = (0, slice_query_parser_1.sliceQueryOptionsParser)(line[0]);
|
|
30
30
|
if (!criteria || criteria.length === 0) {
|
|
31
31
|
output.stderr(output.formatter.format('Invalid static-slice query format, slicing criteria must be given in the form "(criterion1;criterion2;...)"', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
|
|
32
32
|
output.stderr(SliceCriterionHelp);
|
|
33
33
|
return { query: [] };
|
|
34
34
|
}
|
|
35
|
+
(0, slice_query_parser_1.warnAboutSliceFlags)(output, line[0], slice_query_parser_1.StaticSliceFlags);
|
|
35
36
|
return { query: [
|
|
36
37
|
{
|
|
37
38
|
type: 'static-slice',
|
|
38
39
|
criteria: criteria,
|
|
39
40
|
direction: direction,
|
|
40
|
-
...
|
|
41
|
-
...(includeCallees ? { includeCallees: true } : {})
|
|
41
|
+
...options
|
|
42
42
|
}
|
|
43
|
-
], rCode: line
|
|
43
|
+
], rCode: (0, slice_query_parser_1.queryLineCode)(line) };
|
|
44
44
|
}
|
|
45
45
|
exports.StaticSliceQueryDefinition = {
|
|
46
|
+
title: 'Static Slice Query',
|
|
46
47
|
executor: static_slice_query_executor_1.executeStaticSliceQuery,
|
|
47
48
|
asciiSummarizer: (formatter, _analyzer, queryResults, result) => {
|
|
48
49
|
const out = queryResults;
|
|
@@ -80,14 +81,12 @@ exports.StaticSliceQueryDefinition = {
|
|
|
80
81
|
},
|
|
81
82
|
fromLine: sliceQueryLineParser,
|
|
82
83
|
completer: slice_query_parser_1.criteriaQueryCompleter,
|
|
84
|
+
syntax: '@static-slice (<crit>;...)[fiIcB] <code | file://path>',
|
|
83
85
|
schema: joi_1.default.object({
|
|
84
86
|
type: joi_1.default.string().valid('static-slice').required().description('The type of the query.'),
|
|
85
87
|
criteria: joi_1.default.array().items(joi_1.default.string()).min(0).required().description('The slicing criteria to use.'),
|
|
86
|
-
noReconstruction: joi_1.default.boolean().optional().description('Do not reconstruct the slice into readable code.'),
|
|
87
|
-
noMagicComments: joi_1.default.boolean().optional().description('Should the magic comments (force-including lines within the slice) be ignored?'),
|
|
88
88
|
direction: joi_1.default.string().valid(...Object.values(slice_direction_1.SliceDirection)).optional().description('The direction to slice in. Defaults to backward slicing if unset.'),
|
|
89
|
-
|
|
90
|
-
includeCallees: joi_1.default.boolean().optional().description('If set (and slicing backward), continue the slice past a function-definition boundary, also including the definition\'s binding and call sites.')
|
|
89
|
+
...slice_query_options_1.SliceQueryOptionsSchema
|
|
91
90
|
}).description('Slice query used to slice the dataflow graph'),
|
|
92
91
|
flattenInvolvedNodes: (queryResults) => {
|
|
93
92
|
const flattened = [];
|
package/queries/query-print.js
CHANGED
|
@@ -118,7 +118,9 @@ async function asciiSummaryOfQueryResult(formatter, totalInMs, results, analyzer
|
|
|
118
118
|
}
|
|
119
119
|
result.push(` - Took ${(0, time_1.printAsMs)(timing, 0)}`);
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
if (analyzer.flowrConfig.repl.queryStats !== false) {
|
|
122
|
+
result.push((0, ansi_1.italic)(`All queries together required ≈${(0, time_1.printAsMs)(results['.meta'].timing, 0)} (1ms accuracy, total ${(0, time_1.printAsMs)(totalInMs, 0)})`, formatter));
|
|
123
|
+
}
|
|
122
124
|
return formatter.format(result.join('\n'));
|
|
123
125
|
}
|
|
124
126
|
//# sourceMappingURL=query-print.js.map
|