@eagleoutice/flowr 2.16.2 → 2.16.4
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 +15 -15
- package/abstract-interpretation/data-frame/arguments.js +4 -3
- package/abstract-interpretation/data-frame/dataframe-semantics.js +1 -2
- package/abstract-interpretation/data-frame/semantics.d.ts +2 -2
- package/abstract-interpretation/data-frame/semantics.js +2 -6
- package/benchmark/slicer.js +1 -3
- package/benchmark/summarizer/first-phase/input.js +1 -12
- package/benchmark/summarizer/second-phase/process.d.ts +7 -0
- package/benchmark/summarizer/second-phase/process.js +15 -12
- package/cli/repl/commands/repl-cfg.js +18 -49
- package/cli/repl/commands/repl-clipboard.d.ts +2 -0
- package/cli/repl/commands/repl-clipboard.js +5 -0
- package/cli/repl/commands/repl-commands.js +2 -2
- package/cli/repl/commands/repl-dataflow.js +21 -55
- package/cli/repl/commands/repl-normalize.js +15 -28
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +10 -10
- package/cli/repl/commands/repl-signature.js +4 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +8 -30
- package/cli/repl/server/messages/message-analysis.js +1 -1
- package/config.d.ts +6 -0
- package/config.js +7 -4
- package/control-flow/cfg-dead-code.js +5 -14
- package/control-flow/cfg-to-basic-blocks.js +1 -6
- package/control-flow/control-flow-graph.d.ts +2 -16
- package/control-flow/control-flow-graph.js +8 -66
- package/control-flow/diff-cfg.js +10 -23
- package/control-flow/semantic-cfg-guided-visitor.js +5 -11
- package/control-flow/simple-visitor.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +138 -138
- package/data/r-base-packages.generated.js +0 -1
- package/data/r-base-primitives.generated.js +0 -1
- package/data/r-s3-generics.generated.d.ts +5 -0
- package/data/r-s3-generics.generated.js +103 -0
- package/dataflow/cluster.js +2 -1
- package/dataflow/environments/append.d.ts +1 -0
- package/dataflow/environments/built-in-props.d.ts +10 -0
- package/dataflow/environments/built-in-props.js +25 -1
- package/dataflow/environments/built-in.js +15 -9
- package/dataflow/environments/clone.d.ts +1 -0
- package/dataflow/environments/clone.js +1 -0
- package/dataflow/environments/default-builtin-config.d.ts +188 -14
- package/dataflow/environments/default-builtin-config.js +125 -65
- package/dataflow/environments/define.d.ts +1 -0
- package/dataflow/environments/define.js +1 -0
- package/dataflow/environments/environment.d.ts +27 -0
- package/dataflow/environments/environment.js +37 -16
- package/dataflow/environments/frame-memory.d.ts +9 -1
- package/dataflow/environments/frame-memory.js +12 -1
- package/dataflow/environments/identifier.d.ts +0 -2
- package/dataflow/environments/identifier.js +5 -7
- package/dataflow/environments/overwrite.js +1 -0
- package/dataflow/environments/query-fn-props.js +4 -4
- package/dataflow/environments/scoping.d.ts +3 -0
- package/dataflow/environments/scoping.js +3 -0
- package/dataflow/eval/resolve/alias-tracking.js +3 -3
- package/dataflow/eval/resolve/resolve-argument.d.ts +7 -3
- package/dataflow/eval/resolve/resolve-argument.js +16 -11
- package/dataflow/eval/resolve/resolve-numbers.js +5 -2
- package/dataflow/eval/resolve/resolve-strings.d.ts +1 -1
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -2
- package/dataflow/eval/resolve/resolve.js +3 -8
- package/dataflow/eval/values/intervals/interval-constants.js +1 -6
- package/dataflow/eval/values/r-value.js +1 -6
- package/dataflow/extractor.js +17 -17
- package/dataflow/fn/argument-roles.js +15 -15
- package/dataflow/fn/class-declaration.js +7 -7
- package/dataflow/fn/frame-reflection.d.ts +1 -23
- package/dataflow/fn/frame-reflection.js +8 -95
- package/dataflow/fn/function-props.d.ts +0 -3
- package/dataflow/fn/function-props.js +9 -11
- package/dataflow/fn/function-semantics.d.ts +1 -0
- package/dataflow/fn/strict-function.js +15 -14
- package/dataflow/graph/call-graph.d.ts +8 -0
- package/dataflow/graph/call-graph.js +40 -25
- package/dataflow/graph/dataflowgraph-builder.d.ts +0 -60
- package/dataflow/graph/dataflowgraph-builder.js +15 -135
- package/dataflow/graph/df-helper.d.ts +56 -4
- package/dataflow/graph/df-helper.js +116 -1
- package/dataflow/graph/diff-dataflow-graph.js +13 -15
- package/dataflow/graph/graph-helper.d.ts +20 -0
- package/dataflow/graph/graph-helper.js +18 -0
- package/dataflow/graph/graph.js +3 -8
- package/dataflow/graph/match-args.d.ts +1 -1
- package/dataflow/graph/match-args.js +3 -3
- package/dataflow/internal/linker.d.ts +4 -10
- package/dataflow/internal/linker.js +21 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +5 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +39 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +3 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +6 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +14 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +27 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +33 -35
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +3 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +6 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +12 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +7 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +5 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +8 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +36 -38
- package/dataflow/internal/process/functions/call/common.d.ts +3 -1
- package/dataflow/internal/process/functions/call/common.js +6 -7
- package/dataflow/internal/process/functions/call/deferred.js +8 -8
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +11 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +11 -7
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/nse.js +4 -4
- package/dataflow/internal/process/functions/call/quoted.js +16 -14
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.js +2 -2
- package/dataflow/internal/process/process-named-call.js +1 -1
- package/dataflow/origin/dfg-get-origin.js +2 -2
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +3 -8
- package/documentation/data/faq/wiki-faq-store.js +2 -2
- package/documentation/doc-capabilities.js +2 -1
- package/documentation/doc-util/doc-functions.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +3 -1
- package/documentation/doc-util/doc-repl.js +4 -4
- package/documentation/doc-util/doc-timings.js +3 -2
- package/documentation/doc-util/doc-types.js +2 -2
- package/documentation/wiki-absint.js +2 -1
- package/documentation/wiki-cfg.js +2 -1
- package/documentation/wiki-create-linting-rules.js +2 -2
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-interface.js +3 -2
- package/documentation/wiki-linter.d.ts +14 -0
- package/documentation/wiki-linter.js +353 -88
- package/documentation/wiki-mk/doc-maker.js +1 -2
- package/documentation/wiki-query.js +25 -0
- package/documentation/wiki-search.js +2 -1
- package/documentation/wiki-signature-database.js +0 -2
- package/linter/linter-executor.js +4 -0
- package/linter/linter-rules.d.ts +552 -35
- package/linter/linter-rules.js +39 -1
- package/linter/linter-tags.d.ts +6 -0
- package/linter/linter-tags.js +6 -0
- package/linter/rules/absolute-path.d.ts +1 -1
- package/linter/rules/absolute-path.js +9 -6
- package/linter/rules/cmd-check/bogus-return.d.ts +29 -0
- package/linter/rules/cmd-check/bogus-return.js +63 -0
- package/linter/rules/cmd-check/call-arguments.d.ts +63 -0
- package/linter/rules/cmd-check/call-arguments.js +216 -0
- package/linter/rules/cmd-check/class-string-comparison.d.ts +48 -0
- package/linter/rules/cmd-check/class-string-comparison.js +135 -0
- package/linter/rules/cmd-check/cmd-check-util.d.ts +67 -0
- package/linter/rules/cmd-check/cmd-check-util.js +169 -0
- package/linter/rules/cmd-check/compiled-code.d.ts +86 -0
- package/linter/rules/cmd-check/compiled-code.js +350 -0
- package/linter/rules/cmd-check/conformance.d.ts +51 -0
- package/linter/rules/cmd-check/conformance.js +166 -0
- package/linter/rules/cmd-check/dependency-declaration.d.ts +95 -0
- package/linter/rules/cmd-check/dependency-declaration.js +299 -0
- package/linter/rules/cmd-check/description-metadata.d.ts +63 -0
- package/linter/rules/cmd-check/description-metadata.js +393 -0
- package/linter/rules/cmd-check/documentation-mismatch.d.ts +60 -0
- package/linter/rules/cmd-check/documentation-mismatch.js +407 -0
- package/linter/rules/cmd-check/file-checks.d.ts +29 -0
- package/linter/rules/cmd-check/file-checks.js +34 -0
- package/linter/rules/cmd-check/foreign-function-calls.d.ts +54 -0
- package/linter/rules/cmd-check/foreign-function-calls.js +115 -0
- package/linter/rules/cmd-check/global-environment-modification.d.ts +61 -0
- package/linter/rules/cmd-check/global-environment-modification.js +237 -0
- package/linter/rules/cmd-check/namespace-tampering.d.ts +52 -0
- package/linter/rules/cmd-check/namespace-tampering.js +162 -0
- package/linter/rules/cmd-check/non-ascii-code.d.ts +51 -0
- package/linter/rules/cmd-check/non-ascii-code.js +112 -0
- package/linter/rules/cmd-check/package-code.d.ts +30 -0
- package/linter/rules/cmd-check/package-code.js +141 -0
- package/linter/rules/cmd-check/package-data.d.ts +51 -0
- package/linter/rules/cmd-check/package-data.js +181 -0
- package/linter/rules/cmd-check/package-files.d.ts +41 -0
- package/linter/rules/cmd-check/package-files.js +157 -0
- package/linter/rules/cmd-check/package-hooks.d.ts +57 -0
- package/linter/rules/cmd-check/package-hooks.js +173 -0
- package/linter/rules/cmd-check/package-metafiles.d.ts +49 -0
- package/linter/rules/cmd-check/package-metafiles.js +292 -0
- package/linter/rules/cmd-check/package-runtime.d.ts +67 -0
- package/linter/rules/cmd-check/package-runtime.js +284 -0
- package/linter/rules/cmd-check/package-structure.d.ts +85 -0
- package/linter/rules/cmd-check/package-structure.js +320 -0
- package/linter/rules/cmd-check/rd-files.d.ts +83 -0
- package/linter/rules/cmd-check/rd-files.js +621 -0
- package/linter/rules/cmd-check/s-three-method-consistency.d.ts +72 -0
- package/linter/rules/cmd-check/s-three-method-consistency.js +206 -0
- package/linter/rules/cmd-check/true-false-abbreviation.d.ts +45 -0
- package/linter/rules/cmd-check/true-false-abbreviation.js +121 -0
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/dead-code.d.ts +4 -4
- package/linter/rules/dead-code.js +19 -4
- package/linter/rules/deprecated-functions.d.ts +1 -1
- package/linter/rules/deprecated-functions.js +5 -5
- package/linter/rules/file-path-validity.d.ts +6 -2
- package/linter/rules/file-path-validity.js +7 -3
- package/linter/rules/namespace-access.d.ts +3 -3
- package/linter/rules/namespace-access.js +12 -3
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +14 -15
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/no-leaked-credentials.d.ts +1 -1
- package/linter/rules/no-leaked-credentials.js +5 -5
- package/linter/rules/problematic-inputs.d.ts +2 -2
- package/linter/rules/problematic-inputs.js +4 -3
- package/linter/rules/roxygen-arguments.d.ts +2 -2
- package/linter/rules/roxygen-arguments.js +2 -2
- package/linter/rules/seeded-randomness.d.ts +2 -2
- package/linter/rules/seeded-randomness.js +7 -7
- package/linter/rules/software-has-license.d.ts +3 -3
- package/linter/rules/software-has-license.js +3 -3
- package/linter/rules/software-has-tests.d.ts +2 -2
- package/linter/rules/software-has-tests.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +3 -3
- package/linter/rules/stop-with-call-arg.js +21 -4
- package/linter/rules/syntactically-valid.d.ts +1 -1
- package/linter/rules/syntactically-valid.js +1 -1
- package/linter/rules/unclosed-connection.d.ts +2 -2
- package/linter/rules/unclosed-connection.js +5 -5
- package/linter/rules/undefined-symbol-util.js +16 -32
- package/linter/rules/undefined-symbol.d.ts +3 -1
- package/linter/rules/undefined-symbol.js +34 -4
- package/linter/rules/unescaped-arguments.d.ts +1 -1
- package/linter/rules/unescaped-arguments.js +11 -10
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/unused-definition.js +14 -20
- package/linter/rules/unused-import.d.ts +1 -1
- package/linter/rules/unused-import.js +1 -1
- package/linter/rules/useless-loop.d.ts +1 -1
- package/linter/rules/useless-loop.js +1 -1
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/context/flowr-analyzer-context.js +1 -1
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -2
- package/project/context/flowr-analyzer-environment-context.js +2 -1
- package/project/context/flowr-analyzer-files-context.d.ts +6 -0
- package/project/context/flowr-analyzer-files-context.js +15 -11
- package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +0 -2
- package/project/context/flowr-analyzer-incremental-analysis-context.js +0 -4
- package/project/context/flowr-file.d.ts +4 -0
- package/project/context/flowr-file.js +4 -0
- package/project/flowr-analyzer-builder.js +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-manifest-files.js +11 -14
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +3 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +25 -15
- package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +44 -0
- package/project/plugins/file-plugins/files/flowr-rd-file.js +130 -61
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +0 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +4 -16
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +4 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +4 -0
- package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +0 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -5
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +3 -7
- package/project/sigdb/build.js +16 -30
- package/project/sigdb/dict.d.ts +4 -6
- package/project/sigdb/dict.js +125 -31
- package/project/sigdb/reader.js +2 -18
- package/project/sigdb/sigdb-download.js +14 -23
- package/queries/base-query-format.d.ts +2 -0
- package/queries/base-query-format.js +10 -2
- package/queries/catalog/absint-query/absint-query-format.d.ts +1 -1
- package/queries/catalog/absint-query/absint-query-format.js +5 -7
- package/queries/catalog/call-context-query/call-context-query-executor.js +24 -32
- 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 +1 -3
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -4
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -4
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -3
- package/queries/catalog/config-query/config-query-format.js +3 -3
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -3
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -3
- package/queries/catalog/dependencies-query/data-flow.d.ts +45 -0
- package/queries/catalog/dependencies-query/data-flow.js +179 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +18 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +108 -12
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +17 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +14 -11
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +2 -1
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +13 -13
- package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
- package/queries/catalog/dependencies-query/function-info/remote-functions.js +3 -3
- package/queries/catalog/dependencies-query/function-info/source-functions.js +2 -2
- package/queries/catalog/dependencies-query/function-info/test-functions.js +8 -8
- package/queries/catalog/dependencies-query/function-info/transform-functions.d.ts +8 -0
- package/queries/catalog/dependencies-query/function-info/transform-functions.js +17 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +4 -0
- package/queries/catalog/dependencies-query/implicit-echo.d.ts +5 -3
- package/queries/catalog/dependencies-query/implicit-echo.js +36 -35
- package/queries/catalog/dependencies-query/link-devices.d.ts +3 -2
- package/queries/catalog/dependencies-query/link-devices.js +9 -6
- package/queries/catalog/dependencies-query/plot-description.d.ts +10 -0
- package/queries/catalog/dependencies-query/plot-description.js +119 -0
- package/queries/catalog/dependencies-query/plot-objects.d.ts +13 -0
- package/queries/catalog/dependencies-query/plot-objects.js +61 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +2 -2
- package/queries/catalog/dice-query/dice-query-format.js +3 -40
- package/queries/catalog/does-call-query/does-call-query-format.d.ts +1 -1
- package/queries/catalog/does-call-query/does-call-query-format.js +2 -2
- package/queries/catalog/function-info-query/function-info-query-format.js +2 -2
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.js +1 -3
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -3
- package/queries/catalog/input-sources-query/simple-input-classifier.js +28 -29
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +4 -7
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +1 -1
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +3 -2
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-executor.js +10 -3
- package/queries/catalog/linter-query/linter-query-format.d.ts +4 -1
- package/queries/catalog/linter-query/linter-query-format.js +32 -21
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -3
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -3
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.js +4 -5
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/provenance-query/provenance-query-format.js +2 -3
- 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 +4 -4
- package/queries/catalog/search-query/search-query-format.js +1 -3
- package/queries/catalog/signature-query/signature-query-executor.js +3 -3
- package/queries/catalog/signature-query/signature-query-format.js +2 -2
- package/queries/catalog/slice-query-options.d.ts +16 -0
- package/queries/catalog/slice-query-options.js +28 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -42
- package/queries/query-print.d.ts +4 -0
- package/queries/query-print.js +17 -1
- package/queries/query.d.ts +3 -3
- package/queries/query.js +3 -4
- package/r-bridge/lang-4.x/ast/model/model.d.ts +27 -3
- package/r-bridge/lang-4.x/ast/model/model.js +28 -1
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +20 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +25 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +18 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +15 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +17 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +20 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +1 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +1 -0
- package/r-bridge/lang-4.x/ast/model/operators.js +0 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -6
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +4 -3
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +4 -20
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.js +2 -9
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +2 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +2 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +3 -11
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -5
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +6 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +7 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +0 -10
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +30 -82
- package/r-bridge/retriever.d.ts +0 -4
- package/r-bridge/retriever.js +0 -13
- package/r-bridge/roxygen2/documentation-provider.js +3 -7
- package/r-bridge/shell.js +3 -8
- package/reconstruct/auto-select/magic-comments.js +8 -7
- package/reconstruct/inline/source-inline-map.d.ts +3 -0
- package/reconstruct/inline/source-inline-map.js +8 -7
- package/reconstruct/reconstruct.d.ts +1 -1
- package/reconstruct/reconstruct.js +33 -109
- package/search/flowr-search-printer.js +4 -15
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/filters/all-variables.js +1 -2
- package/slicing/static/fingerprint.js +11 -2
- package/slicing/static/slice-call.d.ts +2 -8
- package/slicing/static/slice-call.js +8 -18
- package/slicing/static/static-slicer.js +81 -6
- package/util/collections/arrays.js +1 -1
- package/util/collections/set.js +1 -1
- package/util/diff-graph.d.ts +4 -0
- package/util/diff-graph.js +12 -0
- package/util/files.js +2 -6
- package/util/json.js +1 -15
- package/util/mermaid/cfg.js +10 -17
- package/util/mermaid/dfg.js +6 -8
- package/util/objects.d.ts +1 -1
- package/util/quads.js +4 -13
- package/util/r-author.js +5 -5
- package/util/range.d.ts +9 -0
- package/util/range.js +11 -0
- package/util/schema.js +3 -3
- package/util/simple-df/dfg-view.js +2 -1
- package/util/text/ansi.js +1 -2
- package/util/text/playground-link.js +2 -1
- package/util/text/r-highlight.js +2 -1
- package/util/text/strings.d.ts +2 -0
- package/util/text/strings.js +5 -0
- package/util/text/time.js +1 -2
- package/util/version.js +4 -3
- package/dataflow/fn/recursive-function.d.ts +0 -6
- package/dataflow/fn/recursive-function.js +0 -32
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +0 -16
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +0 -27
|
@@ -16,11 +16,7 @@ function normalizeNumber(data, obj) {
|
|
|
16
16
|
const common = {
|
|
17
17
|
location,
|
|
18
18
|
lexeme: content,
|
|
19
|
-
info:
|
|
20
|
-
fullRange: data.currentRange,
|
|
21
|
-
adToks: [],
|
|
22
|
-
fullLexeme: data.currentLexeme
|
|
23
|
-
}
|
|
19
|
+
info: (0, normalize_meta_1.currentSourceInfo)(data)
|
|
24
20
|
};
|
|
25
21
|
/* the special symbol */
|
|
26
22
|
if ((0, convert_values_1.isNA)(content)) {
|
|
@@ -25,11 +25,7 @@ function normalizeString(data, obj) {
|
|
|
25
25
|
location,
|
|
26
26
|
content: convert_values_1.RStringValue.fromRLexeme(stringContent),
|
|
27
27
|
lexeme: stringContent,
|
|
28
|
-
info:
|
|
29
|
-
fullRange: data.currentRange,
|
|
30
|
-
adToks: [],
|
|
31
|
-
fullLexeme: data.currentLexeme
|
|
32
|
-
}
|
|
28
|
+
info: (0, normalize_meta_1.currentSourceInfo)(data)
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
31
|
//# sourceMappingURL=normalize-string.js.map
|
|
@@ -37,11 +37,7 @@ function tryNormalizeSymbol(data, objs) {
|
|
|
37
37
|
// remove backticks from symbol
|
|
38
38
|
content,
|
|
39
39
|
lexeme: meta.content,
|
|
40
|
-
info:
|
|
41
|
-
fullRange: data.currentRange,
|
|
42
|
-
adToks: [],
|
|
43
|
-
fullLexeme: data.currentLexeme
|
|
44
|
-
}
|
|
40
|
+
info: (0, normalize_meta_1.currentSourceInfo)(data)
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
//# sourceMappingURL=normalize-symbol.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { JsonEntry, NamedJsonEntry } from '../json/format';
|
|
2
2
|
import { SourceRange } from '../../../../../util/range';
|
|
3
3
|
import { type RawRType } from '../../model/type';
|
|
4
|
-
import type { RNode } from '../../model/model';
|
|
4
|
+
import type { RNode, Source } from '../../model/model';
|
|
5
|
+
import type { NormalizerData } from './normalizer-data';
|
|
5
6
|
import { RExpressionList } from '../../model/nodes/r-expression-list';
|
|
6
7
|
/**
|
|
7
8
|
* Given a JSON element, extract the source location of the corresponding element in the R-ast
|
|
@@ -48,3 +49,7 @@ export declare function ensureChildrenAreLhsAndRhsOrdered(first: JsonEntry, seco
|
|
|
48
49
|
* Ensure that the given node is an expression list. If it is not, wrap it in an expression list.
|
|
49
50
|
*/
|
|
50
51
|
export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;
|
|
52
|
+
/**
|
|
53
|
+
* The source information of the node currently normalized, as given by `data`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function currentSourceInfo(data: NormalizerData): Source;
|
|
@@ -8,6 +8,7 @@ exports.getWithTokenType = getWithTokenType;
|
|
|
8
8
|
exports.retrieveOpName = retrieveOpName;
|
|
9
9
|
exports.ensureChildrenAreLhsAndRhsOrdered = ensureChildrenAreLhsAndRhsOrdered;
|
|
10
10
|
exports.ensureExpressionList = ensureExpressionList;
|
|
11
|
+
exports.currentSourceInfo = currentSourceInfo;
|
|
11
12
|
const normalizer_data_1 = require("./normalizer-data");
|
|
12
13
|
const range_1 = require("../../../../../util/range");
|
|
13
14
|
const type_1 = require("../../model/type");
|
|
@@ -90,4 +91,10 @@ function ensureExpressionList(node) {
|
|
|
90
91
|
}
|
|
91
92
|
return node;
|
|
92
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The source information of the node currently normalized, as given by `data`.
|
|
96
|
+
*/
|
|
97
|
+
function currentSourceInfo(data) {
|
|
98
|
+
return { fullRange: data.currentRange, adToks: [], fullLexeme: data.currentLexeme };
|
|
99
|
+
}
|
|
93
100
|
//# sourceMappingURL=normalize-meta.js.map
|
|
@@ -10,13 +10,3 @@ export interface TreeSitterInfo {
|
|
|
10
10
|
* @param lax - Whether to use lax parsing (i.e., ignore errors) or strict parsing (i.e., fail on errors)
|
|
11
11
|
*/
|
|
12
12
|
export declare function normalizeTreeSitterTreeToAst(tree: ParseStepOutputSingleFile<Tree>[], lax?: boolean): RProject<TreeSitterInfo>;
|
|
13
|
-
/**
|
|
14
|
-
* Globally switch to lax parsing mode for tree-sitter normalization
|
|
15
|
-
* @see {@link makeTreeSitterStrict}
|
|
16
|
-
*/
|
|
17
|
-
export declare function makeTreeSitterLax(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Globally switch to strict parsing mode for tree-sitter normalization
|
|
20
|
-
* @see {@link makeTreeSitterLax}
|
|
21
|
-
*/
|
|
22
|
-
export declare function makeTreeSitterStrict(): void;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeTreeSitterTreeToAst = normalizeTreeSitterTreeToAst;
|
|
4
|
-
exports.makeTreeSitterLax = makeTreeSitterLax;
|
|
5
|
-
exports.makeTreeSitterStrict = makeTreeSitterStrict;
|
|
6
4
|
const normalizer_data_1 = require("../ast/parser/main/normalizer-data");
|
|
7
5
|
const tree_sitter_types_1 = require("./tree-sitter-types");
|
|
8
6
|
const type_1 = require("../ast/model/type");
|
|
9
7
|
const range_1 = require("../../../util/range");
|
|
10
|
-
const retriever_1 = require("../../retriever");
|
|
11
8
|
const convert_values_1 = require("../convert-values");
|
|
12
9
|
const normalize_meta_1 = require("../ast/parser/main/normalize-meta");
|
|
13
10
|
const arrays_1 = require("../../../util/collections/arrays");
|
|
14
11
|
const r_function_call_1 = require("../ast/model/nodes/r-function-call");
|
|
15
12
|
const r_string_1 = require("../ast/model/nodes/r-string");
|
|
16
|
-
const strings_1 = require("../../../util/text/strings");
|
|
17
|
-
const log_1 = require("../../../util/log");
|
|
18
13
|
const parser_1 = require("../ast/parser/json/parser");
|
|
19
14
|
const identifier_1 = require("../../../dataflow/environments/identifier");
|
|
20
15
|
const r_expression_list_1 = require("../ast/model/nodes/r-expression-list");
|
|
@@ -23,12 +18,7 @@ const r_expression_list_1 = require("../ast/model/nodes/r-expression-list");
|
|
|
23
18
|
* @param lax - Whether to use lax parsing (i.e., ignore errors) or strict parsing (i.e., fail on errors)
|
|
24
19
|
*/
|
|
25
20
|
function normalizeTreeSitterTreeToAst(tree, lax) {
|
|
26
|
-
|
|
27
|
-
makeTreeSitterLax();
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
makeTreeSitterStrict();
|
|
31
|
-
}
|
|
21
|
+
nonErrorChildren = lax ? nonErrorChildrenLax : nonErrorChildrenStrict;
|
|
32
22
|
const files = [];
|
|
33
23
|
for (const t of tree) {
|
|
34
24
|
rejectUnsupportedPipeBind(t.parsed.rootNode);
|
|
@@ -65,22 +55,6 @@ function nonErrorChildrenLax(node) {
|
|
|
65
55
|
return node.hasError ? node.children.filter(n => n.type !== tree_sitter_types_1.TreeSitterType.Error) : node.children;
|
|
66
56
|
}
|
|
67
57
|
let nonErrorChildren = nonErrorChildrenStrict;
|
|
68
|
-
/**
|
|
69
|
-
* Globally switch to lax parsing mode for tree-sitter normalization
|
|
70
|
-
* @see {@link makeTreeSitterStrict}
|
|
71
|
-
*/
|
|
72
|
-
function makeTreeSitterLax() {
|
|
73
|
-
log_1.log.info('[Tree-Sitter] Lax parsing active');
|
|
74
|
-
nonErrorChildren = nonErrorChildrenLax;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Globally switch to strict parsing mode for tree-sitter normalization
|
|
78
|
-
* @see {@link makeTreeSitterLax}
|
|
79
|
-
*/
|
|
80
|
-
function makeTreeSitterStrict() {
|
|
81
|
-
log_1.log.info('[Tree-Sitter] Strict parsing active');
|
|
82
|
-
nonErrorChildren = nonErrorChildrenStrict;
|
|
83
|
-
}
|
|
84
58
|
function makeDefaultInfo(node, fullRange, fullLexeme) {
|
|
85
59
|
return {
|
|
86
60
|
info: {
|
|
@@ -93,18 +67,7 @@ function makeDefaultInfo(node, fullRange, fullLexeme) {
|
|
|
93
67
|
}
|
|
94
68
|
function convertTreeNode(node) {
|
|
95
69
|
if (!node) {
|
|
96
|
-
return
|
|
97
|
-
type: type_1.RType.ExpressionList,
|
|
98
|
-
location: undefined,
|
|
99
|
-
lexeme: undefined,
|
|
100
|
-
children: [],
|
|
101
|
-
grouping: undefined,
|
|
102
|
-
info: {
|
|
103
|
-
fullRange: undefined,
|
|
104
|
-
adToks: [],
|
|
105
|
-
tsId: -1,
|
|
106
|
-
}
|
|
107
|
-
};
|
|
70
|
+
return emptyExpressionList();
|
|
108
71
|
}
|
|
109
72
|
try {
|
|
110
73
|
// generally, the grammar source file dictates what children a node has in what order:
|
|
@@ -123,7 +86,7 @@ function convertTreeNode(node) {
|
|
|
123
86
|
};
|
|
124
87
|
switch (node.type) {
|
|
125
88
|
case tree_sitter_types_1.TreeSitterType.Program: {
|
|
126
|
-
const [comments, children] =
|
|
89
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
127
90
|
const body = children.map(n => [n, convertTreeNode(n)]);
|
|
128
91
|
const remainingComments = linkCommentsToNextNodes(body, comments);
|
|
129
92
|
return {
|
|
@@ -139,7 +102,7 @@ function convertTreeNode(node) {
|
|
|
139
102
|
}
|
|
140
103
|
case tree_sitter_types_1.TreeSitterType.BracedExpression:
|
|
141
104
|
case tree_sitter_types_1.TreeSitterType.ParenthesizedExpression: {
|
|
142
|
-
const [comments, children] =
|
|
105
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
143
106
|
const opening = children[0];
|
|
144
107
|
const body = children.slice(1, -1).map(n => [n, convertTreeNode(n)]);
|
|
145
108
|
const remainingComments = linkCommentsToNextNodes(body, comments);
|
|
@@ -155,13 +118,13 @@ function convertTreeNode(node) {
|
|
|
155
118
|
{
|
|
156
119
|
type: type_1.RType.Symbol,
|
|
157
120
|
location: makeSourceRange(opening),
|
|
158
|
-
content:
|
|
121
|
+
content: r_string_1.RString.unquote(openText),
|
|
159
122
|
lexeme: openText,
|
|
160
123
|
...defaultInfo()
|
|
161
124
|
}, {
|
|
162
125
|
type: type_1.RType.Symbol,
|
|
163
126
|
location: makeSourceRange(closing),
|
|
164
|
-
content:
|
|
127
|
+
content: r_string_1.RString.unquote(closeText),
|
|
165
128
|
lexeme: closeText,
|
|
166
129
|
...defaultInfo()
|
|
167
130
|
}
|
|
@@ -176,7 +139,7 @@ function convertTreeNode(node) {
|
|
|
176
139
|
const children = nonErrorChildren(node);
|
|
177
140
|
const lhs = convertTreeNode(children[0]);
|
|
178
141
|
const rhs = convertTreeNode(children[children.length - 1]);
|
|
179
|
-
const [commentsBoth, [op]] =
|
|
142
|
+
const [commentsBoth, [op]] = splitCommentNodes(children.slice(1, -1));
|
|
180
143
|
const comments = commentsBoth.map(c => c[1]);
|
|
181
144
|
const opSource = makeSourceRange(op);
|
|
182
145
|
/* every `.text` re-slices the source, so read it once */
|
|
@@ -256,7 +219,7 @@ function convertTreeNode(node) {
|
|
|
256
219
|
}
|
|
257
220
|
}
|
|
258
221
|
case tree_sitter_types_1.TreeSitterType.UnaryOperator: {
|
|
259
|
-
const [comments, children] =
|
|
222
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
260
223
|
const [op, operand] = children;
|
|
261
224
|
const opText = op.text;
|
|
262
225
|
return {
|
|
@@ -272,7 +235,7 @@ function convertTreeNode(node) {
|
|
|
272
235
|
};
|
|
273
236
|
}
|
|
274
237
|
case tree_sitter_types_1.TreeSitterType.NamespaceOperator: {
|
|
275
|
-
const [comments, children] =
|
|
238
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
276
239
|
if (children.length < 3) {
|
|
277
240
|
break;
|
|
278
241
|
}
|
|
@@ -301,12 +264,12 @@ function convertTreeNode(node) {
|
|
|
301
264
|
return {
|
|
302
265
|
type: type_1.RType.Symbol,
|
|
303
266
|
location: range,
|
|
304
|
-
content:
|
|
267
|
+
content: r_string_1.RString.unquote(text()),
|
|
305
268
|
lexeme: text(),
|
|
306
269
|
...defaultInfo()
|
|
307
270
|
};
|
|
308
271
|
case tree_sitter_types_1.TreeSitterType.IfStatement: {
|
|
309
|
-
const [comments, children] =
|
|
272
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
310
273
|
const [ifNode, /* ( */ , condition, /* ) */ , then, /* else */ , ...otherwise] = children;
|
|
311
274
|
const filteredOtherwise = otherwise.filter(n => n.type !== tree_sitter_types_1.TreeSitterType.ElseStatement);
|
|
312
275
|
return {
|
|
@@ -323,20 +286,20 @@ function convertTreeNode(node) {
|
|
|
323
286
|
};
|
|
324
287
|
}
|
|
325
288
|
case tree_sitter_types_1.TreeSitterType.ForStatement: {
|
|
326
|
-
const [comments, children] =
|
|
289
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
327
290
|
const forNode = children[0]; // we follow with a (
|
|
328
291
|
const variable = getNodesUntil(children, 'in', 2); // we follow with the "in"
|
|
329
292
|
const sequence = getNodesUntil(children, ')', 2 + variable.length + 1); // we follow with a (
|
|
330
293
|
const body = children[2 + variable.length + 1 + sequence.length + 1];
|
|
331
|
-
const [variableComments, [variableNode]] =
|
|
332
|
-
const [sequenceComments, [sequenceNode]] =
|
|
294
|
+
const [variableComments, [variableNode]] = splitCommentNodes(variable);
|
|
295
|
+
const [sequenceComments, [sequenceNode]] = splitCommentNodes(sequence);
|
|
333
296
|
const variableText = variableNode.text;
|
|
334
297
|
return {
|
|
335
298
|
type: type_1.RType.ForLoop,
|
|
336
299
|
variable: {
|
|
337
300
|
type: type_1.RType.Symbol,
|
|
338
301
|
location: makeSourceRange(variableNode),
|
|
339
|
-
content:
|
|
302
|
+
content: r_string_1.RString.unquote(variableText),
|
|
340
303
|
lexeme: variableText,
|
|
341
304
|
info: {
|
|
342
305
|
fullRange: undefined,
|
|
@@ -358,7 +321,7 @@ function convertTreeNode(node) {
|
|
|
358
321
|
};
|
|
359
322
|
}
|
|
360
323
|
case tree_sitter_types_1.TreeSitterType.WhileStatement: {
|
|
361
|
-
const [comments, children] =
|
|
324
|
+
const [comments, children] = splitCommentNodes(nonErrorChildren(node));
|
|
362
325
|
const [whileNode, /* ( */ , condition, /* ) */ , body] = children;
|
|
363
326
|
return {
|
|
364
327
|
type: type_1.RType.WhileLoop,
|
|
@@ -373,7 +336,7 @@ function convertTreeNode(node) {
|
|
|
373
336
|
};
|
|
374
337
|
}
|
|
375
338
|
case tree_sitter_types_1.TreeSitterType.RepeatStatement: {
|
|
376
|
-
const [comments, [repeatNode, body]] =
|
|
339
|
+
const [comments, [repeatNode, body]] = splitCommentNodes(nonErrorChildren(node));
|
|
377
340
|
return {
|
|
378
341
|
type: type_1.RType.RepeatLoop,
|
|
379
342
|
body: (0, normalize_meta_1.ensureExpressionList)(convertTreeNode(body)),
|
|
@@ -395,7 +358,7 @@ function convertTreeNode(node) {
|
|
|
395
358
|
};
|
|
396
359
|
}
|
|
397
360
|
const rawArgs = nonErrorChildren(argsParentheses);
|
|
398
|
-
const [comments, noCommentrawArgs] =
|
|
361
|
+
const [comments, noCommentrawArgs] = splitCommentNodes(rawArgs);
|
|
399
362
|
const args = (0, arrays_1.splitArrayOn)(noCommentrawArgs.slice(1, -1), x => x.type === 'comma');
|
|
400
363
|
const funcRange = makeSourceRange(func);
|
|
401
364
|
const funcText = func.text;
|
|
@@ -416,7 +379,7 @@ function convertTreeNode(node) {
|
|
|
416
379
|
funcNode = {
|
|
417
380
|
...funcNode,
|
|
418
381
|
type: type_1.RType.Symbol,
|
|
419
|
-
content:
|
|
382
|
+
content: r_string_1.RString.unquote(funcText)
|
|
420
383
|
};
|
|
421
384
|
}
|
|
422
385
|
return {
|
|
@@ -445,7 +408,7 @@ function convertTreeNode(node) {
|
|
|
445
408
|
}
|
|
446
409
|
case tree_sitter_types_1.TreeSitterType.FunctionDefinition: {
|
|
447
410
|
const [name, paramsParens, body] = nonErrorChildren(node);
|
|
448
|
-
const [comments, noCommentRawParams] =
|
|
411
|
+
const [comments, noCommentRawParams] = splitCommentNodes(paramsParens.children.slice(1, -1));
|
|
449
412
|
const params = (0, arrays_1.splitArrayOn)(noCommentRawParams, x => x.type === 'comma');
|
|
450
413
|
return {
|
|
451
414
|
type: type_1.RType.FunctionDefinition,
|
|
@@ -508,7 +471,7 @@ function convertTreeNode(node) {
|
|
|
508
471
|
const [func, content] = nonErrorChildren(node);
|
|
509
472
|
// bracket is now [ or [[ and argsClosing is x] or x]]
|
|
510
473
|
const [bracket, ...argsClosing] = nonErrorChildren(content);
|
|
511
|
-
const [argsComments, argsNoComments] =
|
|
474
|
+
const [argsComments, argsNoComments] = splitCommentNodes(argsClosing.slice(0, -1));
|
|
512
475
|
const args = (0, arrays_1.splitArrayOn)(argsNoComments, x => x.type === 'comma');
|
|
513
476
|
const bracketText = bracket.text;
|
|
514
477
|
return {
|
|
@@ -587,7 +550,7 @@ function convertTreeNode(node) {
|
|
|
587
550
|
};
|
|
588
551
|
}
|
|
589
552
|
case tree_sitter_types_1.TreeSitterType.Argument: {
|
|
590
|
-
const [commentChildren, children] =
|
|
553
|
+
const [commentChildren, children] = splitCommentNodes(nonErrorChildren(node));
|
|
591
554
|
if (children.length === 1) {
|
|
592
555
|
const [arg] = children;
|
|
593
556
|
return {
|
|
@@ -613,8 +576,8 @@ function convertTreeNode(node) {
|
|
|
613
576
|
content: name.content.str
|
|
614
577
|
};
|
|
615
578
|
}
|
|
616
|
-
else
|
|
617
|
-
name.content = name.content
|
|
579
|
+
else {
|
|
580
|
+
name.content = r_string_1.RString.unquote(name.content);
|
|
618
581
|
}
|
|
619
582
|
const nameRange = makeSourceRange(nameNode);
|
|
620
583
|
const nameLexeme = nameNode.text;
|
|
@@ -641,31 +604,16 @@ function convertTreeNode(node) {
|
|
|
641
604
|
...defaultInfo()
|
|
642
605
|
};
|
|
643
606
|
case tree_sitter_types_1.TreeSitterType.Error:
|
|
644
|
-
return
|
|
645
|
-
type: type_1.RType.ExpressionList,
|
|
646
|
-
location: undefined,
|
|
647
|
-
lexeme: undefined,
|
|
648
|
-
children: [],
|
|
649
|
-
grouping: undefined,
|
|
650
|
-
...defaultInfo()
|
|
651
|
-
};
|
|
607
|
+
return emptyExpressionList(defaultInfo().info);
|
|
652
608
|
}
|
|
653
609
|
}
|
|
654
610
|
catch {
|
|
655
611
|
parser_1.parseLog.error(`[Tree-Sitter] Failed to convert node of type ${node.type} at ${JSON.stringify(makeSourceRange(node))}`);
|
|
656
612
|
}
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
children: [],
|
|
662
|
-
grouping: undefined,
|
|
663
|
-
info: {
|
|
664
|
-
fullRange: undefined,
|
|
665
|
-
adToks: [],
|
|
666
|
-
tsId: -1,
|
|
667
|
-
}
|
|
668
|
-
};
|
|
613
|
+
return emptyExpressionList();
|
|
614
|
+
}
|
|
615
|
+
function emptyExpressionList(info = { fullRange: undefined, adToks: [], tsId: -1 }) {
|
|
616
|
+
return { type: type_1.RType.ExpressionList, location: undefined, lexeme: undefined, children: [], grouping: undefined, info };
|
|
669
617
|
}
|
|
670
618
|
function makeSourceRange(node) {
|
|
671
619
|
if (!node) {
|
|
@@ -680,7 +628,7 @@ function makeSourceRange(node) {
|
|
|
680
628
|
(e?.row ?? -2) + 1, e?.column ?? -1
|
|
681
629
|
];
|
|
682
630
|
}
|
|
683
|
-
function
|
|
631
|
+
function splitCommentNodes(nodes) {
|
|
684
632
|
const comments = [];
|
|
685
633
|
const others = [];
|
|
686
634
|
for (const node of nodes) {
|
package/r-bridge/retriever.d.ts
CHANGED
|
@@ -53,10 +53,6 @@ export declare function retrieveParseDataFromRCode(request: RParseRequest, shell
|
|
|
53
53
|
* @useInstead {@link FlowrAnalyzer}
|
|
54
54
|
*/
|
|
55
55
|
export declare function retrieveNormalizedAstFromRCode(request: RParseRequest, shell: RShell): Promise<NormalizedAst>;
|
|
56
|
-
/**
|
|
57
|
-
* If the string has (R-)quotes around it, they will be removed; otherwise the string is returned unchanged.
|
|
58
|
-
*/
|
|
59
|
-
export declare function removeRQuotes(str: string): string;
|
|
60
56
|
/**
|
|
61
57
|
* Needs to be called *after* {@link retrieveParseDataFromRCode} (or {@link retrieveNormalizedAstFromRCode})
|
|
62
58
|
*/
|
package/r-bridge/retriever.js
CHANGED
|
@@ -6,9 +6,7 @@ exports.requestFromInput = requestFromInput;
|
|
|
6
6
|
exports.isEmptyRequest = isEmptyRequest;
|
|
7
7
|
exports.retrieveParseDataFromRCode = retrieveParseDataFromRCode;
|
|
8
8
|
exports.retrieveNormalizedAstFromRCode = retrieveNormalizedAstFromRCode;
|
|
9
|
-
exports.removeRQuotes = removeRQuotes;
|
|
10
9
|
exports.retrieveNumberOfRTokensOfLastParse = retrieveNumberOfRTokensOfLastParse;
|
|
11
|
-
const strings_1 = require("../util/text/strings");
|
|
12
10
|
const assert_1 = require("../util/assert");
|
|
13
11
|
const shell_executor_1 = require("./shell-executor");
|
|
14
12
|
const parser_1 = require("./lang-4.x/ast/parser/json/parser");
|
|
@@ -95,17 +93,6 @@ async function retrieveNormalizedAstFromRCode(request, shell) {
|
|
|
95
93
|
files: [{ parsed: data, filePath: request.request === 'file' ? request.content : undefined }]
|
|
96
94
|
}, (0, decorate_1.deterministicCountingIdGenerator)(0));
|
|
97
95
|
}
|
|
98
|
-
/**
|
|
99
|
-
* If the string has (R-)quotes around it, they will be removed; otherwise the string is returned unchanged.
|
|
100
|
-
*/
|
|
101
|
-
function removeRQuotes(str) {
|
|
102
|
-
if (str.length > 1 && ((0, strings_1.startAndEndsWith)(str, '\'') || (0, strings_1.startAndEndsWith)(str, '"'))) {
|
|
103
|
-
return str.slice(1, -1);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return str;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
96
|
/**
|
|
110
97
|
* Needs to be called *after* {@link retrieveParseDataFromRCode} (or {@link retrieveNormalizedAstFromRCode})
|
|
111
98
|
*/
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDocumentationOf = getDocumentationOf;
|
|
4
4
|
const roxygen_ast_1 = require("./roxygen-ast");
|
|
5
5
|
const type_1 = require("../lang-4.x/ast/model/type");
|
|
6
|
+
const model_1 = require("../lang-4.x/ast/model/model");
|
|
6
7
|
const roxygen_parse_1 = require("./roxygen-parse");
|
|
7
8
|
const CommentRetriever = {
|
|
8
9
|
[type_1.RType.Comment]: n => (0, roxygen_parse_1.parseRoxygenComment)([n.lexeme]),
|
|
@@ -13,12 +14,7 @@ const CommentRetriever = {
|
|
|
13
14
|
if (doc && paramName) {
|
|
14
15
|
if (Array.isArray(doc)) {
|
|
15
16
|
const res = doc.filter(t => t.type === roxygen_ast_1.KnownRoxygenTags.Param && t.value.name === paramName);
|
|
16
|
-
|
|
17
|
-
return res[0];
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
17
|
+
return res.length === 1 ? res[0] : res;
|
|
22
18
|
}
|
|
23
19
|
else {
|
|
24
20
|
if (doc.type === roxygen_ast_1.KnownRoxygenTags.Param && doc.value.name === paramName) {
|
|
@@ -80,7 +76,7 @@ function expandInheritsOfTags(tags, idMap) {
|
|
|
80
76
|
}
|
|
81
77
|
function getDocumentationOfByName(name, idMap) {
|
|
82
78
|
for (const [, node] of idMap) {
|
|
83
|
-
const nodeName =
|
|
79
|
+
const nodeName = model_1.RNode.ownLexeme(node);
|
|
84
80
|
if (nodeName !== name) {
|
|
85
81
|
continue;
|
|
86
82
|
}
|
package/r-bridge/shell.js
CHANGED
|
@@ -242,12 +242,7 @@ class RShell {
|
|
|
242
242
|
this._sendCommand(`cat("${marker}${this.options.eol}")`);
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
|
-
|
|
246
|
-
return output.map(line => line.trim());
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
return output;
|
|
250
|
-
}
|
|
245
|
+
return config.automaticallyTrimOutput ? output.map(line => line.trim()) : output;
|
|
251
246
|
}
|
|
252
247
|
/**
|
|
253
248
|
* execute multiple commands in order
|
|
@@ -454,7 +449,7 @@ class RShellSession {
|
|
|
454
449
|
this.bareSession.on('exit', callback);
|
|
455
450
|
this.bareSession.stdin.on('error', callback);
|
|
456
451
|
}
|
|
457
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
452
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the listener signature is dictated by node's EventEmitter
|
|
458
453
|
on(from, event, listener) {
|
|
459
454
|
const both = from === 'both';
|
|
460
455
|
if (both || from === 'stdout') {
|
|
@@ -464,7 +459,7 @@ class RShellSession {
|
|
|
464
459
|
this.sessionStdErr.on(event, listener);
|
|
465
460
|
}
|
|
466
461
|
}
|
|
467
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
462
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the listener signature is dictated by node's EventEmitter
|
|
468
463
|
removeListener(from, event, listener) {
|
|
469
464
|
const both = from === 'both';
|
|
470
465
|
if (both || from === 'stdout') {
|
|
@@ -3,25 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeMagicCommentHandler = makeMagicCommentHandler;
|
|
4
4
|
const r_comment_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-comment");
|
|
5
5
|
const assert_1 = require("../../util/assert");
|
|
6
|
+
const range_1 = require("../../util/range");
|
|
6
7
|
const r_project_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-project");
|
|
7
|
-
function
|
|
8
|
-
const loc =
|
|
8
|
+
function rangeOf(node) {
|
|
9
|
+
const loc = range_1.SourceRange.ownFromNode(node);
|
|
9
10
|
(0, assert_1.guard)(loc !== undefined, 'TODO: support location-less nodes!');
|
|
10
11
|
return loc;
|
|
11
12
|
}
|
|
12
13
|
const magicCommentIdMapper = {
|
|
13
14
|
'include_next_line': (n) => {
|
|
14
|
-
return [
|
|
15
|
+
return [rangeOf(n)[0] + 1];
|
|
15
16
|
},
|
|
16
17
|
'include_this_line': (n) => {
|
|
17
|
-
return [
|
|
18
|
+
return [rangeOf(n)[0]];
|
|
18
19
|
},
|
|
19
20
|
'include_start': (n, stack) => {
|
|
20
|
-
stack.push(
|
|
21
|
+
stack.push(rangeOf(n)[0] + 1);
|
|
21
22
|
return undefined;
|
|
22
23
|
},
|
|
23
24
|
'include_end': (n, stack) => {
|
|
24
|
-
const to =
|
|
25
|
+
const to = rangeOf(n)[0];
|
|
25
26
|
(0, assert_1.guard)(stack.length >= 1, `mismatched magic start and end at ${to}`);
|
|
26
27
|
const from = stack.pop();
|
|
27
28
|
const ret = new Array(to - from - 1);
|
|
@@ -75,7 +76,7 @@ function makeMagicCommentHandler(and) {
|
|
|
75
76
|
});
|
|
76
77
|
(0, assert_1.guard)(startLineStack.length === 0, `mismatched magic start and end at end of file (${JSON.stringify(startLineStack)})`);
|
|
77
78
|
}
|
|
78
|
-
const loc =
|
|
79
|
+
const loc = range_1.SourceRange.ownFromNode(node);
|
|
79
80
|
if (loc && lines.has(loc[0])) {
|
|
80
81
|
return true;
|
|
81
82
|
}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
8
8
|
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
9
9
|
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
10
|
+
import type { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
11
|
+
/** the string-literal path argument of a `source()`-like call node, if it has one (else `undefined`) */
|
|
12
|
+
export declare function sourcePathOf(node: RNode | undefined): string | undefined;
|
|
10
13
|
/**
|
|
11
14
|
* A warning raised while inlining `source()` calls during reconstruction.
|
|
12
15
|
* @see {@link reconstructToCode}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourcePathOf = sourcePathOf;
|
|
3
4
|
exports.buildSourceInlineMap = buildSourceInlineMap;
|
|
4
5
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
5
6
|
const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
|
|
6
7
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
|
+
const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
|
|
7
9
|
const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
|
|
8
10
|
/** the string-literal path argument of a `source()`-like call node, if it has one (else `undefined`) */
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
return arg !== undefined && arg !== r_function_call_1.EmptyArgument && r_string_1.RString.is(arg.value) ? arg.value.content.str : undefined;
|
|
11
|
+
function sourcePathOf(node) {
|
|
12
|
+
const path = r_function_call_1.RFunctionCall.is(node) ? r_argument_1.RArgument.valueOf(node.arguments[0]) : undefined;
|
|
13
|
+
return r_string_1.RString.is(path) ? path.content.str : undefined;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Connect each `source()` call node to the index of the file it sources in `ast.ast.files` (index 0 is main).
|
|
@@ -43,9 +44,9 @@ function buildSourceInlineMap(ast, graph) {
|
|
|
43
44
|
// dependency, the first vertex under it (its directly sourced block).
|
|
44
45
|
const sourceArgs = new Map();
|
|
45
46
|
const firstVertexByCd = new Map();
|
|
46
|
-
for (const [id, vertex] of graph.
|
|
47
|
-
if (
|
|
48
|
-
sourceArgs.set(id,
|
|
47
|
+
for (const [id, vertex] of graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
|
|
48
|
+
if (Array.isArray(vertex.origin) && vertex.origin.includes(built_in_proc_name_1.BuiltInProcName.Source)) {
|
|
49
|
+
sourceArgs.set(id, sourcePathOf(ast.idMap.get(id)));
|
|
49
50
|
}
|
|
50
51
|
const cds = vertex.cds;
|
|
51
52
|
if (cds && cds.length > 0 && !firstVertexByCd.has(cds[0].id)) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
7
7
|
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
8
8
|
import { type AutoSelectPredicate } from './auto-select/auto-select-defaults';
|
|
9
|
-
import type
|
|
9
|
+
import { type InlineWarning } from './inline/source-inline-map';
|
|
10
10
|
/**
|
|
11
11
|
* Whether to inline every file into a single self-contained text: `true` inlines them, `'banner'` additionally
|
|
12
12
|
* precedes each with a banner comment naming it.
|