@eagleoutice/flowr 2.10.9 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -38
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/options.d.ts +2 -108
- package/cli/common/options.js +3 -27
- package/cli/common/script.js +3 -2
- package/cli/common/scripts-info.d.ts +2 -123
- package/cli/common/scripts-info.js +0 -17
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +10 -0
- package/cli/flowr.js +48 -11
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/print-version.d.ts +3 -1
- package/cli/repl/print-version.js +21 -2
- package/cli/repl/server/connection.d.ts +3 -0
- package/cli/repl/server/connection.js +65 -31
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/summarizer-core.js +13 -32
- package/cli/wiki.d.ts +3 -1
- package/cli/wiki.js +6 -1
- package/config.d.ts +22 -10
- package/config.js +33 -7
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +2 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/data/pkgdb/pkgdb-latest.json.br +0 -0
- package/data/pkgdb/pkgdb-tiny.json.br +0 -0
- package/dataflow/environments/append.d.ts +2 -2
- package/dataflow/environments/append.js +4 -10
- package/dataflow/environments/apply-kill.d.ts +21 -0
- package/dataflow/environments/apply-kill.js +155 -0
- package/dataflow/environments/built-in-proc-name.d.ts +4 -0
- package/dataflow/environments/built-in-proc-name.js +4 -0
- package/dataflow/environments/built-in.d.ts +4 -0
- package/dataflow/environments/built-in.js +4 -0
- package/dataflow/environments/default-builtin-config.d.ts +183 -67
- package/dataflow/environments/default-builtin-config.js +358 -147
- package/dataflow/environments/environment.d.ts +49 -31
- package/dataflow/environments/environment.js +144 -25
- package/dataflow/environments/identifier.d.ts +65 -2
- package/dataflow/environments/identifier.js +37 -2
- package/dataflow/environments/overwrite.js +2 -10
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.d.ts +1 -1
- package/dataflow/environments/resolve-by-name.js +23 -9
- package/dataflow/environments/scoping.d.ts +9 -2
- package/dataflow/environments/scoping.js +15 -2
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +35 -4
- package/dataflow/graph/df-helper.d.ts +14 -0
- package/dataflow/graph/df-helper.js +41 -0
- package/dataflow/graph/graph.d.ts +4 -1
- package/dataflow/graph/graph.js +6 -2
- package/dataflow/info.d.ts +27 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +61 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +132 -25
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +11 -4
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +23 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +78 -57
- package/documentation/data/interface/doc-writing-code.js +4 -80
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-structure.js +1 -2
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +121 -32
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +112 -77
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +22 -8
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +16 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +4 -17
- package/documentation/wiki-package-database.d.ts +9 -0
- package/documentation/wiki-package-database.js +63 -0
- package/documentation/wiki-query.js +86 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +111 -86
- package/linter/linter-rules.js +9 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +8 -5
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/undefined-symbol.d.ts +39 -0
- package/linter/rules/undefined-symbol.js +80 -0
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +5 -5
- package/project/cache/flowr-analyzer-cache.d.ts +2 -0
- package/project/cache/flowr-analyzer-cache.js +9 -1
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
- package/project/context/flowr-analyzer-dependencies-context.js +36 -4
- package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
- package/project/context/flowr-analyzer-environment-context.js +3 -4
- package/project/context/flowr-analyzer-files-context.d.ts +13 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/flowr-analyzer-builder.js +3 -0
- package/project/flowr-analyzer.d.ts +2 -1
- package/project/flowr-analyzer.js +3 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
- package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +174 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
- package/project/plugins/package-version-plugins/package.d.ts +3 -0
- package/project/plugins/package-version-plugins/package.js +12 -0
- package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
- package/project/plugins/package-version-plugins/pkgdb.js +370 -0
- package/project/plugins/plugin-registry.d.ts +5 -1
- package/project/plugins/plugin-registry.js +10 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +62 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -2
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
- package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- 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 +1 -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 +1 -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 +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +8 -0
- 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 +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -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 +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +7 -2
- package/r-bridge/data/data.js +8 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +601 -1
- package/search/search-executor/search-enrichers.js +30 -6
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/mermaid/mermaid.d.ts +4 -0
- package/util/mermaid/mermaid.js +8 -1
- package/util/objects.d.ts +9 -0
- package/util/objects.js +54 -0
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +10 -2
- package/cli/common/features.d.ts +0 -9
- package/cli/common/features.js +0 -35
- package/cli/script-core/statistics-core.d.ts +0 -6
- package/cli/script-core/statistics-core.js +0 -103
- package/cli/script-core/statistics-helper-core.d.ts +0 -6
- package/cli/script-core/statistics-helper-core.js +0 -85
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -16
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -14
- package/statistics/features/common-syntax-probability.d.ts +0 -38
- package/statistics/features/common-syntax-probability.js +0 -169
- package/statistics/features/feature.d.ts +0 -179
- package/statistics/features/feature.js +0 -38
- package/statistics/features/post-processing.d.ts +0 -18
- package/statistics/features/post-processing.js +0 -26
- package/statistics/features/supported/assignments/assignments.d.ts +0 -12
- package/statistics/features/supported/assignments/assignments.js +0 -56
- package/statistics/features/supported/assignments/post-process.d.ts +0 -6
- package/statistics/features/supported/assignments/post-process.js +0 -126
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -143
- package/statistics/features/supported/comments/post-process.d.ts +0 -6
- package/statistics/features/supported/comments/post-process.js +0 -51
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -69
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
- package/statistics/features/supported/control-flow/post-process.js +0 -66
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -122
- package/statistics/features/supported/data-access/post-process.d.ts +0 -6
- package/statistics/features/supported/data-access/post-process.js +0 -108
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -168
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
- package/statistics/features/supported/expression-list/post-process.js +0 -45
- package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -81
- package/statistics/features/supported/loops/post-process.d.ts +0 -6
- package/statistics/features/supported/loops/post-process.js +0 -73
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -176
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -99
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
- package/statistics/features/supported/used-packages/post-process.js +0 -122
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -140
- package/statistics/features/supported/values/post-process.d.ts +0 -6
- package/statistics/features/supported/values/post-process.js +0 -73
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -111
- package/statistics/features/supported/variables/post-process.d.ts +0 -15
- package/statistics/features/supported/variables/post-process.js +0 -126
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -62
- package/statistics/meta-statistics.d.ts +0 -32
- package/statistics/meta-statistics.js +0 -16
- package/statistics/output/file-provider.d.ts +0 -36
- package/statistics/output/file-provider.js +0 -96
- package/statistics/output/print-stats.d.ts +0 -29
- package/statistics/output/print-stats.js +0 -81
- package/statistics/output/statistics-file.d.ts +0 -36
- package/statistics/output/statistics-file.js +0 -68
- package/statistics/statistics.d.ts +0 -29
- package/statistics/statistics.js +0 -108
- package/statistics/summarizer/auto-detect.d.ts +0 -5
- package/statistics/summarizer/auto-detect.js +0 -34
- package/statistics/summarizer/first-phase/process.d.ts +0 -6
- package/statistics/summarizer/first-phase/process.js +0 -81
- package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
- package/statistics/summarizer/post-process/clusterer.js +0 -40
- package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
- package/statistics/summarizer/post-process/file-based-count.js +0 -47
- package/statistics/summarizer/post-process/histogram.d.ts +0 -57
- package/statistics/summarizer/post-process/histogram.js +0 -126
- package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
- package/statistics/summarizer/post-process/post-process-output.js +0 -102
- package/statistics/summarizer/second-phase/process.d.ts +0 -15
- package/statistics/summarizer/second-phase/process.js +0 -118
- package/statistics/summarizer/summarizer.d.ts +0 -34
- package/statistics/summarizer/summarizer.js +0 -141
|
@@ -1,103 +0,0 @@
|
|
|
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.flowrScriptGetStats = flowrScriptGetStats;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const parallel_1 = require("../../util/parallel");
|
|
9
|
-
const files_1 = require("../../util/files");
|
|
10
|
-
const features_1 = require("../common/features");
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const statistics_file_1 = require("../../statistics/output/statistics-file");
|
|
13
|
-
const json_1 = require("../../util/json");
|
|
14
|
-
const log_1 = require("../../util/log");
|
|
15
|
-
const statistics_helper_core_1 = require("./statistics-helper-core");
|
|
16
|
-
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
17
|
-
const scripts_info_1 = require("../common/scripts-info");
|
|
18
|
-
const ansi_1 = require("../../util/text/ansi");
|
|
19
|
-
const testRegex = /[^/]*\/test/i;
|
|
20
|
-
const exampleRegex = /[^/]*\/example/i;
|
|
21
|
-
function getPrefixForFile(file) {
|
|
22
|
-
if (testRegex.test(file)) {
|
|
23
|
-
return 'test-';
|
|
24
|
-
}
|
|
25
|
-
else if (exampleRegex.test(file)) {
|
|
26
|
-
return 'example-';
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return '';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function getSuffixForFile(base, file) {
|
|
33
|
-
const subpath = path_1.default.relative(base, file);
|
|
34
|
-
return '--' + subpath.replace(/\//g, '/');
|
|
35
|
-
}
|
|
36
|
-
async function collectFileArguments(options, verboseAdd, dumpJson, features) {
|
|
37
|
-
const files = [];
|
|
38
|
-
let counter = 0;
|
|
39
|
-
let presentSteps = 5000;
|
|
40
|
-
let skipped = 0;
|
|
41
|
-
for await (const f of (0, files_1.allRFilesFrom)(options.input)) {
|
|
42
|
-
const outputDir = path_1.default.join(options['output-dir'], `${getPrefixForFile(f.content)}${getSuffixForFile(options.input.length === 1 ? options.input[0] : '', f.content)}`);
|
|
43
|
-
const target = (0, features_1.retrieveArchiveName)(outputDir);
|
|
44
|
-
if (fs_1.default.existsSync(target)) {
|
|
45
|
-
console.log(`Archive ${target} exists. Skip.`);
|
|
46
|
-
skipped++;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
files.push(['--input', f.content, '--output-dir', outputDir, '--compress', '--root-dir', options.input.length === 1 ? options.input[0] : '""', ...verboseAdd, ...features, ...dumpJson]);
|
|
50
|
-
if (++counter % presentSteps === 0) {
|
|
51
|
-
console.log(`Collected ${counter} files`);
|
|
52
|
-
if (counter >= 10 * presentSteps) {
|
|
53
|
-
presentSteps *= 5;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
console.log(`Total: ${counter} files (${skipped} skipped with archive existing)`);
|
|
58
|
-
return files;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* The core function for the 'flowr stats' script.
|
|
62
|
-
*/
|
|
63
|
-
async function flowrScriptGetStats(options, config) {
|
|
64
|
-
if (options.input.length === 0) {
|
|
65
|
-
console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
|
|
66
|
-
process.exit(0);
|
|
67
|
-
}
|
|
68
|
-
if (options['no-ansi']) {
|
|
69
|
-
log_1.log.info('disabling ansi colors');
|
|
70
|
-
(0, ansi_1.setFormatter)(ansi_1.voidFormatter);
|
|
71
|
-
}
|
|
72
|
-
const processedFeatures = (0, features_1.validateFeatures)(options.features);
|
|
73
|
-
(0, statistics_file_1.initFileProvider)(options['output-dir']);
|
|
74
|
-
console.log(`Processing features: ${JSON.stringify(processedFeatures, json_1.jsonReplacer)}`);
|
|
75
|
-
console.log(`Using ${options.parallel} parallel executors`);
|
|
76
|
-
const verboseAdd = options.verbose ? ['--verbose'] : [];
|
|
77
|
-
const features = [...processedFeatures].flatMap(s => ['--features', s]);
|
|
78
|
-
const dumpJson = options['dump-json'] ? ['--dump-json'] : [];
|
|
79
|
-
// we do not use the limit argument to be able to pick the limit randomly
|
|
80
|
-
const args = await collectFileArguments(options, verboseAdd, dumpJson, features);
|
|
81
|
-
if (options.limit) {
|
|
82
|
-
console.log('Shuffle...');
|
|
83
|
-
log_1.log.info(`limiting to ${options.limit} files`);
|
|
84
|
-
// shuffle and limit
|
|
85
|
-
args.sort(() => Math.random() - 0.5);
|
|
86
|
-
}
|
|
87
|
-
console.log('Prepare Pool...');
|
|
88
|
-
const limit = options.limit ?? args.length;
|
|
89
|
-
if (options.parallel > 0) {
|
|
90
|
-
const pool = new parallel_1.LimitedThreadPool(`${__dirname}/statistics-helper-app`, args, limit, options.parallel);
|
|
91
|
-
console.log('Run Pool...');
|
|
92
|
-
await pool.run();
|
|
93
|
-
const stats = pool.getStats();
|
|
94
|
-
console.log(`Processed ${stats.counter} files, skipped ${stats.skipped.length} files due to errors`);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
console.log('Run Sequentially as parallel <= 0...');
|
|
98
|
-
for (const arg of args) {
|
|
99
|
-
await (0, statistics_helper_core_1.getStatsForSingleFile)((0, command_line_args_1.default)(scripts_info_1.scripts['stats-helper'].options, { argv: arg }), config);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=statistics-core.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { StatsHelperCliOptions } from '../statistics-helper-app';
|
|
2
|
-
import { FlowrConfig } from '../../config';
|
|
3
|
-
/**
|
|
4
|
-
* Get statistics for a single file
|
|
5
|
-
*/
|
|
6
|
-
export declare function getStatsForSingleFile(options: StatsHelperCliOptions, config: FlowrConfig): Promise<void>;
|
|
@@ -1,85 +0,0 @@
|
|
|
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.getStatsForSingleFile = getStatsForSingleFile;
|
|
7
|
-
const features_1 = require("../common/features");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const shell_1 = require("../../r-bridge/shell");
|
|
10
|
-
const statistics_file_1 = require("../../statistics/output/statistics-file");
|
|
11
|
-
const statistics_1 = require("../../statistics/statistics");
|
|
12
|
-
const extract_cfg_1 = require("../../control-flow/extract-cfg");
|
|
13
|
-
const print_1 = require("../../core/print/print");
|
|
14
|
-
const _00_parse_1 = require("../../core/steps/all/core/00-parse");
|
|
15
|
-
const _10_normalize_1 = require("../../core/steps/all/core/10-normalize");
|
|
16
|
-
const _20_dataflow_1 = require("../../core/steps/all/core/20-dataflow");
|
|
17
|
-
const json_1 = require("../../util/json");
|
|
18
|
-
const log_1 = require("../../util/log");
|
|
19
|
-
const assert_1 = require("../../util/assert");
|
|
20
|
-
const time_1 = require("../../util/text/time");
|
|
21
|
-
const tar_1 = require("tar");
|
|
22
|
-
const ansi_1 = require("../../util/text/ansi");
|
|
23
|
-
const config_1 = require("../../config");
|
|
24
|
-
const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
|
|
25
|
-
function compressFolder(folder, target) {
|
|
26
|
-
return (0, tar_1.create)({
|
|
27
|
-
gzip: true,
|
|
28
|
-
file: target,
|
|
29
|
-
portable: true,
|
|
30
|
-
preservePaths: false
|
|
31
|
-
}, [folder]).then(() => {
|
|
32
|
-
// now, remove the folder
|
|
33
|
-
fs_1.default.rmSync(folder, { recursive: true, force: true });
|
|
34
|
-
}, () => {
|
|
35
|
-
console.log(`failed to compress ${folder}`);
|
|
36
|
-
}).catch((e) => {
|
|
37
|
-
console.error('Error during compression:', e);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get statistics for a single file
|
|
42
|
-
*/
|
|
43
|
-
async function getStatsForSingleFile(options, config) {
|
|
44
|
-
if (options['no-ansi']) {
|
|
45
|
-
log_1.log.info('disabling ansi colors');
|
|
46
|
-
(0, ansi_1.setFormatter)(ansi_1.voidFormatter);
|
|
47
|
-
}
|
|
48
|
-
let target = undefined;
|
|
49
|
-
if (options.compress) {
|
|
50
|
-
target = (0, features_1.retrieveArchiveName)(options['output-dir']);
|
|
51
|
-
if (fs_1.default.existsSync(target)) {
|
|
52
|
-
console.log(`Archive ${target} exists. Skip.`);
|
|
53
|
-
process.exit(0);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// assume correct
|
|
57
|
-
const processedFeatures = new Set(options.features);
|
|
58
|
-
const shell = new shell_1.RShell(config_1.FlowrConfig.getForEngine(config, 'r-shell'));
|
|
59
|
-
(0, statistics_file_1.initFileProvider)(options['output-dir']);
|
|
60
|
-
await shell.obtainTmpDir();
|
|
61
|
-
const stats = await (0, statistics_1.extractUsageStatistics)(shell, config, () => { }, processedFeatures, (0, statistics_1.staticRequests)({ request: 'file', content: options.input }), options['root-dir']);
|
|
62
|
-
// console.warn(`skipped ${stats.meta.failedRequests.length} requests due to errors (run with logs to get more info)`)
|
|
63
|
-
if (stats.outputs.size === 1) {
|
|
64
|
-
if (options['dump-json']) {
|
|
65
|
-
const [, output] = [...stats.outputs.entries()][0];
|
|
66
|
-
const cfg = (0, extract_cfg_1.extractCfg)(output.normalize, (0, flowr_analyzer_context_1.contextFromInput)('', config), output.dataflow.graph);
|
|
67
|
-
statistics_file_1.statisticsFileProvider.append('output-json', 'parse', await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, output.parse, 2 /* StepOutputFormat.Json */));
|
|
68
|
-
statistics_file_1.statisticsFileProvider.append('output-json', 'normalize', await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, output.normalize, 2 /* StepOutputFormat.Json */));
|
|
69
|
-
statistics_file_1.statisticsFileProvider.append('output-json', 'dataflow', await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, output.dataflow, 2 /* StepOutputFormat.Json */));
|
|
70
|
-
statistics_file_1.statisticsFileProvider.append('output-json', 'cfg', JSON.stringify(cfg, json_1.jsonReplacer));
|
|
71
|
-
}
|
|
72
|
-
statistics_file_1.statisticsFileProvider.append('meta', 'stats', JSON.stringify({ ...stats.meta, file: options.input }, json_1.jsonReplacer));
|
|
73
|
-
statistics_file_1.statisticsFileProvider.append('meta', 'features', JSON.stringify(stats.features, json_1.jsonReplacer));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
log_1.log.error(`expected exactly one output vs. ${stats.outputs.size}, got: ${JSON.stringify([...stats.outputs.keys()], json_1.jsonReplacer, 2)}`);
|
|
77
|
-
}
|
|
78
|
-
if (options.compress) {
|
|
79
|
-
(0, assert_1.guard)(target !== undefined, 'target must be defined given the compress option');
|
|
80
|
-
console.log(`[${(0, time_1.date2string)(new Date())}] Compressing ${options['output-dir']} to ${target}`);
|
|
81
|
-
await compressFolder(options['output-dir'], target);
|
|
82
|
-
}
|
|
83
|
-
shell.close();
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=statistics-helper-core.js.map
|
package/cli/statistics-app.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface StatsCliOptions {
|
|
2
|
-
readonly verbose: boolean;
|
|
3
|
-
readonly help: boolean;
|
|
4
|
-
readonly limit: number | undefined;
|
|
5
|
-
readonly input: string[];
|
|
6
|
-
readonly 'dump-json': boolean;
|
|
7
|
-
readonly 'output-dir': string;
|
|
8
|
-
readonly 'no-ansi': boolean;
|
|
9
|
-
readonly parallel: number;
|
|
10
|
-
readonly features: string[];
|
|
11
|
-
}
|
package/cli/statistics-app.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const script_1 = require("./common/script");
|
|
4
|
-
const statistics_core_1 = require("./script-core/statistics-core");
|
|
5
|
-
const config_1 = require("../config");
|
|
6
|
-
const scriptOptions = (0, script_1.processCommandLineArgs)('stats', [], {
|
|
7
|
-
subtitle: 'Given input files or folders, this will collect usage statistics for the given features and write them to a file',
|
|
8
|
-
examples: [
|
|
9
|
-
'{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
|
|
10
|
-
'{italic "folder1/"} {bold --features} {italic all} {bold --output-dir} {italic "output-folder/"}',
|
|
11
|
-
'{bold --post-process} {italic "output-folder"} {bold --features} {italic assignments}',
|
|
12
|
-
'{bold --help}'
|
|
13
|
-
]
|
|
14
|
-
});
|
|
15
|
-
void (0, statistics_core_1.flowrScriptGetStats)(scriptOptions, config_1.FlowrConfig.fromFile());
|
|
16
|
-
//# sourceMappingURL=statistics-app.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface StatsHelperCliOptions {
|
|
2
|
-
readonly verbose: boolean;
|
|
3
|
-
readonly help: boolean;
|
|
4
|
-
readonly input: string;
|
|
5
|
-
readonly compress: boolean;
|
|
6
|
-
readonly 'dump-json': boolean;
|
|
7
|
-
readonly 'output-dir': string;
|
|
8
|
-
readonly 'root-dir': string;
|
|
9
|
-
readonly 'no-ansi': boolean;
|
|
10
|
-
readonly features: string[];
|
|
11
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const script_1 = require("./common/script");
|
|
4
|
-
const statistics_helper_core_1 = require("./script-core/statistics-helper-core");
|
|
5
|
-
const config_1 = require("../config");
|
|
6
|
-
const scriptOptions = (0, script_1.processCommandLineArgs)('stats-helper', [], {
|
|
7
|
-
subtitle: 'Given a single input file, this will collect usage statistics for the given features and write them to a file',
|
|
8
|
-
examples: [
|
|
9
|
-
'{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
|
|
10
|
-
'{bold --help}'
|
|
11
|
-
]
|
|
12
|
-
});
|
|
13
|
-
void (0, statistics_helper_core_1.getStatsForSingleFile)(scriptOptions, config_1.FlowrConfig.fromFile());
|
|
14
|
-
//# sourceMappingURL=statistics-helper-app.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type SummarizedMeasurement } from '../../util/summarizer';
|
|
2
|
-
import { RFalse, RTrue } from '../../r-bridge/lang-4.x/convert-values';
|
|
3
|
-
import type { RArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-argument';
|
|
4
|
-
import type { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
|
|
5
|
-
export interface CommonSyntaxTypeCounts<Measurement = bigint> {
|
|
6
|
-
total: Measurement;
|
|
7
|
-
multiple: Measurement;
|
|
8
|
-
empty: Measurement;
|
|
9
|
-
withArgument: Measurement;
|
|
10
|
-
noValue: Measurement;
|
|
11
|
-
singleVar: Record<string, Measurement>;
|
|
12
|
-
number: Record<number, Measurement>;
|
|
13
|
-
integer: Record<number, Measurement>;
|
|
14
|
-
complex: Record<number, Measurement>;
|
|
15
|
-
string: Record<string, Measurement>;
|
|
16
|
-
logical: Record<typeof RTrue | typeof RFalse, Measurement>;
|
|
17
|
-
call: Record<string, Measurement>;
|
|
18
|
-
unnamedCall: Measurement;
|
|
19
|
-
binOp: Record<string, Measurement>;
|
|
20
|
-
unaryOp: Record<string, Measurement>;
|
|
21
|
-
other: Record<string, Measurement>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export declare function emptyCommonSyntaxTypeCounts<T = bigint>(init?: () => T): CommonSyntaxTypeCounts<T>;
|
|
27
|
-
/**
|
|
28
|
-
* Updates the given counts based on the type of the given node.
|
|
29
|
-
*/
|
|
30
|
-
export declare function updateCommonSyntaxTypeCounts(current: CommonSyntaxTypeCounts, ...nodes: (RNode | RArgument)[]): CommonSyntaxTypeCounts;
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export declare function appendCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>, b: CommonSyntaxTypeCounts): void;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export declare function summarizeCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>): CommonSyntaxTypeCounts<SummarizedMeasurement>;
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emptyCommonSyntaxTypeCounts = emptyCommonSyntaxTypeCounts;
|
|
4
|
-
exports.updateCommonSyntaxTypeCounts = updateCommonSyntaxTypeCounts;
|
|
5
|
-
exports.appendCommonSyntaxTypeCounter = appendCommonSyntaxTypeCounter;
|
|
6
|
-
exports.summarizeCommonSyntaxTypeCounter = summarizeCommonSyntaxTypeCounter;
|
|
7
|
-
/**
|
|
8
|
-
* Defines the type of syntax constructs that we track (e.g., true, false, 0, 1, T, F, conditions...)
|
|
9
|
-
*/
|
|
10
|
-
const numbers_1 = require("../../util/numbers");
|
|
11
|
-
const summarizer_1 = require("../../util/summarizer");
|
|
12
|
-
const convert_values_1 = require("../../r-bridge/lang-4.x/convert-values");
|
|
13
|
-
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
14
|
-
const identifier_1 = require("../../dataflow/environments/identifier");
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
function emptyCommonSyntaxTypeCounts(init = () => 0n) {
|
|
19
|
-
return {
|
|
20
|
-
total: init(),
|
|
21
|
-
multiple: init(),
|
|
22
|
-
empty: init(),
|
|
23
|
-
withArgument: init(),
|
|
24
|
-
noValue: init(),
|
|
25
|
-
singleVar: {},
|
|
26
|
-
number: {},
|
|
27
|
-
integer: {},
|
|
28
|
-
complex: {},
|
|
29
|
-
string: {},
|
|
30
|
-
logical: {},
|
|
31
|
-
call: {},
|
|
32
|
-
unnamedCall: init(),
|
|
33
|
-
binOp: {},
|
|
34
|
-
unaryOp: {},
|
|
35
|
-
other: {}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function incrementEntry(map, key) {
|
|
39
|
-
map[key] = (map[key] ?? 0n) + 1n;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Updates the given counts based on the type of the given node.
|
|
43
|
-
*/
|
|
44
|
-
function updateCommonSyntaxTypeCounts(current, ...nodes) {
|
|
45
|
-
current.total++;
|
|
46
|
-
if (nodes.length === 0) {
|
|
47
|
-
current.empty++;
|
|
48
|
-
return current;
|
|
49
|
-
}
|
|
50
|
-
else if (nodes.length > 1) {
|
|
51
|
-
current.multiple++;
|
|
52
|
-
return current;
|
|
53
|
-
}
|
|
54
|
-
let node = nodes[0];
|
|
55
|
-
if (node.type === type_1.RType.Argument) {
|
|
56
|
-
if (node.name !== undefined) {
|
|
57
|
-
current.withArgument++;
|
|
58
|
-
}
|
|
59
|
-
if (node.value !== undefined) {
|
|
60
|
-
node = node.value;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
current.noValue++;
|
|
64
|
-
return current;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
switch (node.type) {
|
|
68
|
-
case type_1.RType.String:
|
|
69
|
-
incrementEntry(current.string, node.content.str);
|
|
70
|
-
break;
|
|
71
|
-
case type_1.RType.Symbol:
|
|
72
|
-
incrementEntry(current.singleVar, identifier_1.Identifier.getName(node.content));
|
|
73
|
-
break;
|
|
74
|
-
case type_1.RType.Logical:
|
|
75
|
-
incrementEntry(current.logical, node.content ? convert_values_1.RTrue : convert_values_1.RFalse);
|
|
76
|
-
break;
|
|
77
|
-
case type_1.RType.Number:
|
|
78
|
-
if (node.content.complexNumber) {
|
|
79
|
-
incrementEntry(current.complex, node.content.num);
|
|
80
|
-
}
|
|
81
|
-
else if (node.content.markedAsInt) {
|
|
82
|
-
incrementEntry(current.integer, node.content.num);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
incrementEntry(current.number, node.content.num);
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
case type_1.RType.FunctionCall:
|
|
89
|
-
if (!node.named) {
|
|
90
|
-
current.unnamedCall++;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
incrementEntry(current.call, identifier_1.Identifier.getName(node.functionName.content));
|
|
94
|
-
}
|
|
95
|
-
break;
|
|
96
|
-
case type_1.RType.BinaryOp:
|
|
97
|
-
incrementEntry(current.binOp, node.operator);
|
|
98
|
-
break;
|
|
99
|
-
case type_1.RType.UnaryOp:
|
|
100
|
-
incrementEntry(current.unaryOp, node.operator);
|
|
101
|
-
break;
|
|
102
|
-
default:
|
|
103
|
-
// for space reasons, we do not record the full lexeme!
|
|
104
|
-
if (node.lexeme) {
|
|
105
|
-
incrementEntry(current.other, node.lexeme);
|
|
106
|
-
}
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
return current;
|
|
110
|
-
}
|
|
111
|
-
function appendRecord(a, b) {
|
|
112
|
-
for (const [key, val] of Object.entries(b)) {
|
|
113
|
-
const get = a[key];
|
|
114
|
-
// we guard with array, to guard against methods like `toString` which are given in js
|
|
115
|
-
if (!get || !Array.isArray(get)) {
|
|
116
|
-
a[key] = [[(0, numbers_1.bigint2number)(val)]];
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
get.push([(0, numbers_1.bigint2number)(val)]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
function appendCommonSyntaxTypeCounter(a, b) {
|
|
126
|
-
a.total.push([(0, numbers_1.bigint2number)(b.total)]);
|
|
127
|
-
a.empty.push([(0, numbers_1.bigint2number)(b.empty)]);
|
|
128
|
-
a.multiple.push([(0, numbers_1.bigint2number)(b.multiple)]);
|
|
129
|
-
a.withArgument.push([(0, numbers_1.bigint2number)(b.withArgument)]);
|
|
130
|
-
a.noValue.push([(0, numbers_1.bigint2number)(b.noValue)]);
|
|
131
|
-
a.unnamedCall.push([(0, numbers_1.bigint2number)(b.unnamedCall)]);
|
|
132
|
-
appendRecord(a.singleVar, b.singleVar);
|
|
133
|
-
appendRecord(a.number, b.number);
|
|
134
|
-
appendRecord(a.integer, b.integer);
|
|
135
|
-
appendRecord(a.complex, b.complex);
|
|
136
|
-
appendRecord(a.string, b.string);
|
|
137
|
-
appendRecord(a.logical, b.logical);
|
|
138
|
-
appendRecord(a.call, b.call);
|
|
139
|
-
appendRecord(a.binOp, b.binOp);
|
|
140
|
-
appendRecord(a.unaryOp, b.unaryOp);
|
|
141
|
-
appendRecord(a.other, b.other);
|
|
142
|
-
}
|
|
143
|
-
function summarizeRecord(a) {
|
|
144
|
-
return Object.fromEntries(Object.entries(a).map(([key, val]) => [key, (0, summarizer_1.summarizeMeasurement)(val.flat(), val.length)]));
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
function summarizeCommonSyntaxTypeCounter(a) {
|
|
150
|
-
return {
|
|
151
|
-
total: (0, summarizer_1.summarizeMeasurement)(a.total.flat(), a.total.length),
|
|
152
|
-
empty: (0, summarizer_1.summarizeMeasurement)(a.empty.flat(), a.empty.length),
|
|
153
|
-
multiple: (0, summarizer_1.summarizeMeasurement)(a.multiple.flat(), a.multiple.length),
|
|
154
|
-
withArgument: (0, summarizer_1.summarizeMeasurement)(a.withArgument.flat(), a.withArgument.length),
|
|
155
|
-
noValue: (0, summarizer_1.summarizeMeasurement)(a.noValue.flat(), a.noValue.length),
|
|
156
|
-
unnamedCall: (0, summarizer_1.summarizeMeasurement)(a.unnamedCall.flat(), a.unnamedCall.length),
|
|
157
|
-
singleVar: summarizeRecord(a.singleVar),
|
|
158
|
-
number: summarizeRecord(a.number),
|
|
159
|
-
integer: summarizeRecord(a.integer),
|
|
160
|
-
complex: summarizeRecord(a.complex),
|
|
161
|
-
string: summarizeRecord(a.string),
|
|
162
|
-
logical: summarizeRecord(a.logical),
|
|
163
|
-
call: summarizeRecord(a.call),
|
|
164
|
-
binOp: summarizeRecord(a.binOp),
|
|
165
|
-
unaryOp: summarizeRecord(a.unaryOp),
|
|
166
|
-
other: summarizeRecord(a.other)
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=common-syntax-probability.js.map
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module holds the definition of what a {@link Feature} that can be extracted from an R AST is.
|
|
3
|
-
*
|
|
4
|
-
* Furthermore, it contains the definition of all features that are known in {@link ALL_FEATURES}.
|
|
5
|
-
* @module
|
|
6
|
-
*/
|
|
7
|
-
import type { EvalOptions } from 'xpath-ts2/src/parse-api';
|
|
8
|
-
import type { MetaStatistics } from '../meta-statistics';
|
|
9
|
-
import type { StatisticsSummarizerConfiguration } from '../summarizer/summarizer';
|
|
10
|
-
import type { MergeableRecord } from '../../util/objects';
|
|
11
|
-
import type { DataflowInformation } from '../../dataflow/info';
|
|
12
|
-
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
13
|
-
import type { Document } from '@xmldom/xmldom';
|
|
14
|
-
/**
|
|
15
|
-
* Maps each sub-feature name to the number of occurrences of that sub-feature.
|
|
16
|
-
* Allows for one nesting level to denote hierarchical features.
|
|
17
|
-
* <p>
|
|
18
|
-
* Since we are writing to files {@link process}, we only count feature occurrences (some feature/parts are not written to file)
|
|
19
|
-
*/
|
|
20
|
-
export type FeatureInfo = Record<string, unknown> & MergeableRecord;
|
|
21
|
-
/**
|
|
22
|
-
* The information and context that a {@link FeatureProcessor} may operate in.
|
|
23
|
-
*/
|
|
24
|
-
export interface FeatureProcessorInput extends MergeableRecord {
|
|
25
|
-
/** The XML Document representing the parsed (non-normalized) R AST */
|
|
26
|
-
readonly parsedRAst: Document;
|
|
27
|
-
/** The R AST, after the normalization step */
|
|
28
|
-
readonly normalizedRAst: NormalizedAst;
|
|
29
|
-
/** The dataflow information for the given input */
|
|
30
|
-
readonly dataflow: DataflowInformation;
|
|
31
|
-
/** The filepath that the document originated from (if present, may be undefined if the input was provided as text). This can be relative to the common root directory of requests. */
|
|
32
|
-
readonly filepath: string | undefined;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* A function that processes the analysis results of a document and returns the feature information.
|
|
36
|
-
*/
|
|
37
|
-
export type FeatureProcessor<T extends FeatureInfo> = (existing: T, input: FeatureProcessorInput) => T;
|
|
38
|
-
/**
|
|
39
|
-
* A feature is something to be retrieved by the statistics.
|
|
40
|
-
* @typeParam T - The type of what should be collected for the feature
|
|
41
|
-
* @see ALL_FEATURES
|
|
42
|
-
*/
|
|
43
|
-
export interface Feature<T extends FeatureInfo> {
|
|
44
|
-
/** A descriptive, yet unique name of the feature */
|
|
45
|
-
readonly name: string;
|
|
46
|
-
/** A description of the feature */
|
|
47
|
-
readonly description: string;
|
|
48
|
-
/** A function that retrieves the feature in the document appends it to the existing feature set (we could use a monoid :D), the filepath corresponds to the active file (if any) */
|
|
49
|
-
process: FeatureProcessor<T>;
|
|
50
|
-
/**
|
|
51
|
-
* If present, this feature allows to post-process the results of the feature extraction (for the summarizer).
|
|
52
|
-
* <p>
|
|
53
|
-
* The extraction can use the output path to write files to, and should return the final output.
|
|
54
|
-
* @param featureRoot - The root path to the feature directory which should contain all the files the feature can write to (already merged for every file processed)
|
|
55
|
-
* @param info - The feature statistic maps each file name/context encountered to the feature information as well as the meta statistics for the file
|
|
56
|
-
* @param outputPath - The path to write the output to (besides what is collected in the output and meta information)
|
|
57
|
-
* @param config - The configuration for the summarizer (e.g., to obtain the number of folders to skip for the feature root)
|
|
58
|
-
*/
|
|
59
|
-
postProcess?: (featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration) => void;
|
|
60
|
-
/** Values to start the existing track from */
|
|
61
|
-
initialValue: T;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The source of truth for all features that are supported by the statistics.
|
|
65
|
-
*/
|
|
66
|
-
export declare const ALL_FEATURES: {
|
|
67
|
-
readonly usedPackages: Feature<import("ts-essentials").Writable<{
|
|
68
|
-
library: number;
|
|
69
|
-
require: number;
|
|
70
|
-
loadNamespace: number;
|
|
71
|
-
requireNamespace: number;
|
|
72
|
-
attachNamespace: number;
|
|
73
|
-
withinApply: number;
|
|
74
|
-
'::': number;
|
|
75
|
-
':::': number;
|
|
76
|
-
'<loadedByVariable>': number;
|
|
77
|
-
}>>;
|
|
78
|
-
readonly comments: Feature<import("ts-essentials").Writable<{
|
|
79
|
-
totalAmount: number;
|
|
80
|
-
roxygenComments: number;
|
|
81
|
-
import: number;
|
|
82
|
-
importFrom: number;
|
|
83
|
-
importMethodsFrom: number;
|
|
84
|
-
importClassesFrom: number;
|
|
85
|
-
useDynLib: number;
|
|
86
|
-
export: number;
|
|
87
|
-
exportClass: number;
|
|
88
|
-
exportMethod: number;
|
|
89
|
-
exportS3Method: number;
|
|
90
|
-
exportPattern: number;
|
|
91
|
-
}>>;
|
|
92
|
-
readonly definedFunctions: Feature<import("ts-essentials").Writable<{
|
|
93
|
-
total: number;
|
|
94
|
-
lambdasOnly: number;
|
|
95
|
-
assignedFunctions: number;
|
|
96
|
-
nestedFunctions: number;
|
|
97
|
-
recursive: number;
|
|
98
|
-
deepestNesting: number;
|
|
99
|
-
}>>;
|
|
100
|
-
readonly usedFunctions: Feature<import("ts-essentials").Writable<{
|
|
101
|
-
allFunctionCalls: number;
|
|
102
|
-
args: Record<number, bigint | import("./common-syntax-probability").CommonSyntaxTypeCounts>;
|
|
103
|
-
nestedFunctionCalls: number;
|
|
104
|
-
deepestNesting: number;
|
|
105
|
-
unnamedCalls: number;
|
|
106
|
-
}>>;
|
|
107
|
-
readonly values: Feature<import("ts-essentials").Writable<{
|
|
108
|
-
allNumerics: number;
|
|
109
|
-
imaginaryNumbers: number;
|
|
110
|
-
integers: number;
|
|
111
|
-
floatHex: number;
|
|
112
|
-
logical: number;
|
|
113
|
-
specialConstants: number;
|
|
114
|
-
strings: number;
|
|
115
|
-
}>>;
|
|
116
|
-
readonly assignments: Feature<import("ts-essentials").Writable<{
|
|
117
|
-
assignmentOperator: Record<string, bigint>;
|
|
118
|
-
assigned: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
119
|
-
deepestNesting: number;
|
|
120
|
-
nestedOperatorAssignment: number;
|
|
121
|
-
}>>;
|
|
122
|
-
readonly loops: Feature<import("ts-essentials").Writable<{
|
|
123
|
-
forLoops: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
124
|
-
forLoopVar: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
125
|
-
forBody: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
126
|
-
whileLoops: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
127
|
-
whileBody: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
128
|
-
repeatLoops: bigint;
|
|
129
|
-
repeatBody: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
130
|
-
breakStatements: number;
|
|
131
|
-
nextStatements: number;
|
|
132
|
-
implicitLoops: number;
|
|
133
|
-
nestedExplicitLoops: number;
|
|
134
|
-
deepestExplicitNesting: number;
|
|
135
|
-
}>>;
|
|
136
|
-
readonly controlflow: Feature<import("ts-essentials").Writable<{
|
|
137
|
-
ifThen: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
138
|
-
thenBody: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
139
|
-
ifThenElse: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
140
|
-
elseBody: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
141
|
-
nestedIfThen: number;
|
|
142
|
-
nestedIfThenElse: number;
|
|
143
|
-
deepestNesting: number;
|
|
144
|
-
switchCase: import("./common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
145
|
-
}>>;
|
|
146
|
-
readonly dataAccess: Feature<import("ts-essentials").Writable<{
|
|
147
|
-
singleBracket: Record<number, bigint | import("./common-syntax-probability").CommonSyntaxTypeCounts>;
|
|
148
|
-
doubleBracket: Record<number, bigint | import("./common-syntax-probability").CommonSyntaxTypeCounts>;
|
|
149
|
-
chainedOrNestedAccess: number;
|
|
150
|
-
longestChain: number;
|
|
151
|
-
deepestNesting: number;
|
|
152
|
-
byName: number;
|
|
153
|
-
bySlot: number;
|
|
154
|
-
}>>;
|
|
155
|
-
readonly expressionList: Feature<import("ts-essentials").Writable<{
|
|
156
|
-
allExpressionLists: number;
|
|
157
|
-
deepestNesting: number;
|
|
158
|
-
}>>;
|
|
159
|
-
readonly variables: Feature<import("ts-essentials").Writable<{
|
|
160
|
-
numberOfVariableUses: number;
|
|
161
|
-
numberOfDefinitions: number;
|
|
162
|
-
numberOfRedefinitions: number;
|
|
163
|
-
unknownVariables: number;
|
|
164
|
-
}>>;
|
|
165
|
-
};
|
|
166
|
-
export type FeatureKey = keyof typeof ALL_FEATURES;
|
|
167
|
-
export type FeatureValue<K extends FeatureKey> = ReturnType<typeof ALL_FEATURES[K]['process']>;
|
|
168
|
-
/** If the user passes `all`, this should be every feature present in {@link ALL_FEATURES} (see {@link allFeatureNames})*/
|
|
169
|
-
export type FeatureSelection = Set<FeatureKey>;
|
|
170
|
-
export declare const allFeatureNames: Set<FeatureKey>;
|
|
171
|
-
export type FeatureStatistics = {
|
|
172
|
-
[K in FeatureKey]: FeatureInfo;
|
|
173
|
-
};
|
|
174
|
-
export type FeatureStatisticsWithMeta = FeatureStatistics & {
|
|
175
|
-
stats: MetaStatistics;
|
|
176
|
-
};
|
|
177
|
-
export interface Query {
|
|
178
|
-
select(options?: EvalOptions): Node[];
|
|
179
|
-
}
|