@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
|
@@ -89,8 +89,10 @@ const options = {
|
|
|
89
89
|
*/
|
|
90
90
|
function getTypeScriptSourceFiles(fileNames) {
|
|
91
91
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// keeps wiki/doc links consistent across OSes (Windows uses backslashes)
|
|
93
|
+
const normalizedFileNames = fileNames.map(doc_files_1.toPosixPath);
|
|
94
|
+
const program = typescript_1.default.createProgram(normalizedFileNames, options);
|
|
95
|
+
return { program, files: normalizedFileNames.map(fileName => program.getSourceFile(fileName)).filter(file => !!file) };
|
|
94
96
|
}
|
|
95
97
|
catch (err) {
|
|
96
98
|
console.error('Failed to get source files', err);
|
|
@@ -352,7 +354,7 @@ function getTypePathForTypeScript({ filePath }) {
|
|
|
352
354
|
}
|
|
353
355
|
/**
|
|
354
356
|
* Return the link to the type in the source code.
|
|
355
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
357
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
356
358
|
*/
|
|
357
359
|
function getTypePathLink(elem, relative = false) {
|
|
358
360
|
const fromSource = getTypePathForTypeScript(elem);
|
|
@@ -492,7 +494,7 @@ function implSnippet(node, program, showName = true, nesting = 0, open = false,
|
|
|
492
494
|
exports.mermaidHide = ['MergeableRecord', 'Leaf', 'Location', 'Namespace', 'Base', 'WithChildren', 'Partial', 'RAccessBase'];
|
|
493
495
|
/**
|
|
494
496
|
* Print the hierarchy of types starting from the given root.
|
|
495
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
497
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
496
498
|
*/
|
|
497
499
|
function printHierarchy({ program, info, root, ignoredTypes, collapseFromNesting = 1, initialNesting = 0, maxDepth = 20, skipNesting = 0, openTop, showImplSnippet = true, reverse = false }) {
|
|
498
500
|
if (initialNesting > maxDepth) {
|
|
@@ -532,7 +534,7 @@ function printHierarchy({ program, info, root, ignoredTypes, collapseFromNesting
|
|
|
532
534
|
}
|
|
533
535
|
/**
|
|
534
536
|
* Print an element from the info as code block.
|
|
535
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
537
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
536
538
|
*
|
|
537
539
|
* This is great to show examples that are directly taken from the source code.
|
|
538
540
|
*/
|
|
@@ -547,12 +549,12 @@ function printCodeOfElement(info, name) {
|
|
|
547
549
|
}
|
|
548
550
|
/**
|
|
549
551
|
* Print a source file as code block.
|
|
550
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
552
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
551
553
|
*
|
|
552
554
|
* This is great to show examples that are directly taken from the source code.
|
|
553
555
|
*/
|
|
554
556
|
function printCodeOfFile(info, relativePath) {
|
|
555
|
-
const fullPath = path_1.default.resolve(__dirname, `../../../${relativePath}`);
|
|
557
|
+
const fullPath = (0, doc_files_1.toPosixPath)(path_1.default.resolve(__dirname, `../../../${relativePath}`));
|
|
556
558
|
const code = info.program.getSourceFile(fullPath)?.getFullText().trim();
|
|
557
559
|
if (!code) {
|
|
558
560
|
console.error(`Could not find source file ${relativePath}!`);
|
|
@@ -649,7 +651,7 @@ function shortLink(name, hierarchy, codeStyle = true, realNameWrapper = 'b', fuz
|
|
|
649
651
|
}
|
|
650
652
|
/**
|
|
651
653
|
* Create a short link to a type in the documentation.
|
|
652
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
654
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
653
655
|
* @param name - The name of the type, e.g. `MyType`, may include a container, e.g.,`MyContainer::MyType` (this works with function nestings too)
|
|
654
656
|
* Use `:::` if you want to access a scoped function, but the name should be displayed without the scope
|
|
655
657
|
* @param hierarchy - The hierarchy of types to search in
|
|
@@ -665,7 +667,7 @@ function shortLinkFile(name, hierarchy) {
|
|
|
665
667
|
}
|
|
666
668
|
/**
|
|
667
669
|
* Retrieve documentation comments for a type.
|
|
668
|
-
* If you create a wiki, please refer to the functions provided by the {@link
|
|
670
|
+
* If you create a wiki, please refer to the functions provided by the {@link GeneralDocContext}.
|
|
669
671
|
* @param name - The name of the type, e.g. `MyType`, may include a container, e.g.,`MyContainer::MyType` (this works with function nestings too)
|
|
670
672
|
* Use `:::` if you want to access a scoped function, but the name should be displayed without the scope
|
|
671
673
|
* @param hierarchy - The hierarchy of types to search in
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IssueLintingRule = void 0;
|
|
4
4
|
const linter_tags_1 = require("../linter/linter-tags");
|
|
5
5
|
const doc_general_1 = require("./doc-util/doc-general");
|
|
6
|
-
const doc_files_1 = require("./doc-util/doc-files");
|
|
7
6
|
const linter_rules_1 = require("../linter/linter-rules");
|
|
8
7
|
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
9
8
|
/* this prints the yaml configuration for the GitHub issue template to request a new linter rule / an update */
|
|
@@ -30,7 +29,7 @@ body:
|
|
|
30
29
|
- type: markdown
|
|
31
30
|
attributes:
|
|
32
31
|
value: |
|
|
33
|
-
Thank you for suggesting a new linting rule or an improvement to an existing one. Please provide as much detail as possible to help us understand your request. See the
|
|
32
|
+
Thank you for suggesting a new linting rule or an improvement to an existing one. Please provide as much detail as possible to help us understand your request. See the ${ctx.linkPage('wiki/Linter', 'Linter Wiki Page')} for more information.
|
|
34
33
|
- type: textarea
|
|
35
34
|
id: description
|
|
36
35
|
attributes:
|
|
@@ -94,14 +94,14 @@ ${(0, doc_structure_1.section)('Overview', 2)}
|
|
|
94
94
|
No matter whether you want to analyze a single R script, a couple of R notebooks, a complete project, or an R package,
|
|
95
95
|
your journey starts with the ${ctx.link(flowr_analyzer_builder_1.FlowrAnalyzerBuilder)} (further described in [Builder Configuration](#builder-configuration) below).
|
|
96
96
|
This builder allows you to configure the analysis in many different ways, for example, by specifying which [plugins](#Plugins) to use or
|
|
97
|
-
what
|
|
97
|
+
what ${ctx.linkPage('wiki/Engines', 'engine')} to use for the analysis.
|
|
98
98
|
|
|
99
99
|
When building the ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} instance, the builder will take care to
|
|
100
100
|
|
|
101
101
|
* load the [requested plugins](#Plugins)
|
|
102
102
|
* setup an initial [context](#Context_Information)
|
|
103
103
|
* create a [cache](#Caching) for speeding up future analyses
|
|
104
|
-
* initialize the
|
|
104
|
+
* initialize the ${ctx.linkPage('wiki/Engines', 'engine')} (e.g., TreeSitter) if needed
|
|
105
105
|
|
|
106
106
|
The builder provides two methods for building the analyzer:
|
|
107
107
|
|
|
@@ -141,19 +141,19 @@ Please make sure to add all of the files, folder, and projects you want to analy
|
|
|
141
141
|
${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'addRequest')} method (or ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'addFile')} for virtual files).
|
|
142
142
|
Afterwards, you can request different kinds of analysis results, such as:
|
|
143
143
|
|
|
144
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'parse')} to get the parsed information by the respective
|
|
144
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'parse')} to get the parsed information by the respective ${ctx.linkPage('wiki/Engines', 'engine')}\\
|
|
145
145
|
You can also use ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'peekParse', { codeFont: true, realNameWrapper: 'i' })} to inspect the parse information if it was already computed (but without triggering a computation).
|
|
146
146
|
With ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'parserInformation', { codeFont: true, realNameWrapper: 'i' })}, you get additional information on the parser used for the analysis.
|
|
147
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'normalize')} to compute the
|
|
147
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'normalize')} to compute the ${ctx.linkPage('wiki/Normalized AST', 'Normalized AST')}\\
|
|
148
148
|
Likewise, ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'peekNormalize', { codeFont: true, realNameWrapper: 'i' })} returns the normalized AST if it was already computed but without triggering a computation.
|
|
149
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'dataflow')} to compute the
|
|
149
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'dataflow')} to compute the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph')}\\
|
|
150
150
|
Again, ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'peekDataflow', { codeFont: true, realNameWrapper: 'i' })} allows you to inspect the dataflow graph if it was already computed (but without triggering a computation).
|
|
151
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'controlflow')} to compute the
|
|
151
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'controlflow')} to compute the ${ctx.linkPage('wiki/Control Flow Graph', 'Control Flow Graph')}\\
|
|
152
152
|
Also, ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'peekControlflow', { codeFont: true, realNameWrapper: 'i' })} returns the control flow graph if it was already computed but without triggering a computation.
|
|
153
153
|
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'callGraph')} to compute the ${ctx.linkPage('wiki/Dataflow Graph', 'call graph', 'perspectives-cg')} of the analyzed code\\
|
|
154
154
|
Likewise, ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'peekCallGraph', { codeFont: true, realNameWrapper: 'i' })} allows you to inspect the call graph if it was already computed (but without triggering a computation).
|
|
155
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'query')} to run
|
|
156
|
-
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'runSearch')} to run a search query on the analyzed code using the
|
|
155
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'query')} to run ${ctx.linkPage('wiki/Query API', 'queries')} on the analyzed code.
|
|
156
|
+
* ${ctx.linkM(flowr_analyzer_1.FlowrAnalyzer, 'runSearch')} to run a search query on the analyzed code using the ${ctx.linkPage('wiki/Search API', 'search API')}
|
|
157
157
|
|
|
158
158
|
We work on providing a set of example repositories that demonstrate how to use the analyzer in different scenarios:
|
|
159
159
|
|
|
@@ -171,7 +171,7 @@ The following sections highlight some of the most important configuration option
|
|
|
171
171
|
|
|
172
172
|
${(0, doc_structure_1.section)('Configuring flowR', 3)}
|
|
173
173
|
|
|
174
|
-
You can fundamentally change the behavior of flowR using the
|
|
174
|
+
You can fundamentally change the behavior of flowR using the ${ctx.linkPage('wiki/Interface', 'config file', 'configuring-flowr')},
|
|
175
175
|
embedded in the interface ${ctx.link(config_1.FlowrConfig)}.
|
|
176
176
|
With the builder you can either provide a complete configuration or amend the default configuration using:
|
|
177
177
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WikiCfg = void 0;
|
|
4
|
-
const doc_files_1 = require("./doc-util/doc-files");
|
|
5
4
|
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
6
5
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
7
6
|
const doc_cfg_1 = require("./doc-util/doc-cfg");
|
|
@@ -120,18 +119,18 @@ class WikiCfg extends doc_maker_1.DocMaker {
|
|
|
120
119
|
}
|
|
121
120
|
async text({ ctx, shell }) {
|
|
122
121
|
return `
|
|
123
|
-
_flowR_ produces three main perspectives of the program: 1) a
|
|
124
|
-
and 2) a
|
|
125
|
-
flowR uses this CFG interweaved with its data flow analysis and for some of its queries (e.g., to link to the last call in a
|
|
122
|
+
_flowR_ produces three main perspectives of the program: 1) a ${ctx.linkPage('wiki/Normalized AST', 'normalized version of the AST')}
|
|
123
|
+
and 2) a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, and 3) a control flow graph (CFG).
|
|
124
|
+
flowR uses this CFG interweaved with its data flow analysis and for some of its queries (e.g., to link to the last call in a ${ctx.linkPage('wiki/Query API', 'Call-Context Query', 'call-context-query')}).
|
|
126
125
|
|
|
127
|
-
Please note that, mostly due to historical reasons, the
|
|
126
|
+
Please note that, mostly due to historical reasons, the ${ctx.linkPage('wiki/Dataflow Graph', 'control dependencies', 'control-dependencies')} that are stored directly within the
|
|
128
127
|
DFG provide only a partial view of the CFG. While they provide you with information on the conditional execution of vertices, they do not encode the order of execution.
|
|
129
128
|
In contrast, the CFG describes a complete view of the program's control flow.
|
|
130
129
|
|
|
131
130
|
${(0, doc_structure_1.block)({
|
|
132
131
|
type: 'TIP',
|
|
133
132
|
content: `If you want to investigate the Control Flow Graph,
|
|
134
|
-
you can use the ${(0, doc_cli_option_1.getReplCommand)('controlflow*')} command in the REPL (see the
|
|
133
|
+
you can use the ${(0, doc_cli_option_1.getReplCommand)('controlflow*')} command in the REPL (see the ${ctx.linkPage('wiki/Interface', 'Interface wiki page')} for more information).
|
|
135
134
|
By default, this view does _not_ use basic blocks as, for example, R allows unconditional jumps to occur in spots where conventional languages would assume expressions (e.g., if-conditions).
|
|
136
135
|
Yet, by using ${(0, doc_cli_option_1.getReplCommand)('controlflowbb*')} you can inspect the CFG with basic blocks (although you have to keep in mind that now, there can be a value flow between basic blocks)`
|
|
137
136
|
})}
|
|
@@ -163,39 +162,39 @@ ${(0, doc_code_1.codeBlock)('r', 'x <- 2 * 3 + 1')}
|
|
|
163
162
|
|
|
164
163
|
The corresponding CFG is a directed, labeled graph with two types of edges (control and flow dependencies).
|
|
165
164
|
|
|
166
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
|
|
165
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', ctx })}
|
|
167
166
|
|
|
168
167
|
${(0, doc_structure_1.block)({
|
|
169
168
|
type: 'IMPORTANT',
|
|
170
169
|
content: 'As the edges describe dependencies they point in the inverse order of execution (which is very helpful for backward analyses)! The [visitors](#cfg-working) abstract away from this and there is no harm in considering an inverted CFG. Yet, you should keep this in mind!'
|
|
171
170
|
})}
|
|
172
171
|
|
|
173
|
-
Every normalized node of the
|
|
174
|
-
execution is added and automatically linked using its id (similarly to vertices of the
|
|
172
|
+
Every normalized node of the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} that has any relevance to the
|
|
173
|
+
execution is added and automatically linked using its id (similarly to vertices of the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}).
|
|
175
174
|
Expressions, such as \`2 * 3\` get an additional node with an artificial id that ends in \`-exit\` to mark whenever their calculation is over.
|
|
176
175
|
|
|
177
176
|
To gain a better understanding, let's have a look at a simple program with a single branching structure:
|
|
178
177
|
|
|
179
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, openCode: false, prefix: 'flowchart RL\n' })}
|
|
178
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, openCode: false, prefix: 'flowchart RL\n', ctx })}
|
|
180
179
|
|
|
181
180
|
Here, you can see the \`if\` node followed by the condition (in this case merely \`u\`) that then splits into two branches for the two possible outcomes.
|
|
182
181
|
The \`if\` structure is terminated by the corresponding \`-exit\` node (see the [structure](#cfg-structure) section for more details).
|
|
183
182
|
|
|
184
183
|
For you to compare, the following shows the CFG of an \`if\` without an \`else\` branch:
|
|
185
184
|
|
|
186
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n' })}
|
|
185
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', ctx })}
|
|
187
186
|
|
|
188
187
|
Activating the calculation of basic blocks produces the following:
|
|
189
188
|
|
|
190
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'] })}
|
|
189
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], ctx })}
|
|
191
190
|
|
|
192
191
|
Which is probably much more readable if compacted (although the reconstucted code can sometimes be slightly mislieading as flowR tries its best to make it syntactically correct and hence add closing braces etc. which are technically not part of the respective block):
|
|
193
192
|
|
|
194
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true })}
|
|
193
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'if(u || v) 3', { showCode: true, openCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
|
|
195
194
|
|
|
196
195
|
The control flow graph also harmonizes with function definitions, and calls:
|
|
197
196
|
|
|
198
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showCode: true, openCode: true, prefix: 'flowchart RL\n' })}
|
|
197
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showCode: true, openCode: true, prefix: 'flowchart RL\n', ctx })}
|
|
199
198
|
|
|
200
199
|
${(0, doc_structure_1.section)('Structure of the Control Flow Graph', 2, 'cfg-structure')}
|
|
201
200
|
|
|
@@ -237,7 +236,7 @@ Blocks are visualized as boxes around the contained vertices.
|
|
|
237
236
|
${(0, doc_structure_1.block)({
|
|
238
237
|
type: 'NOTE',
|
|
239
238
|
content: `
|
|
240
|
-
Every CFG vertex has a ${ctx.link('NodeId')} that links it to the
|
|
239
|
+
Every CFG vertex has a ${ctx.link('NodeId')} that links it to the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} (although basic blocks will find no counterpart as they are a structuring element of the CFG).
|
|
241
240
|
Additionally, it may provide information on the called functions (in case that the current element is a function call).
|
|
242
241
|
Have a look at the ${ctx.link('CfgBaseVertexWithMarker')} interface for more information.
|
|
243
242
|
`.trim()
|
|
@@ -253,7 +252,7 @@ ${(0, doc_structure_1.section)('Flow Dependencies', 4, 'cfg-flow-dependency')}
|
|
|
253
252
|
The most common edge is the flow dependency (FD) which simply signals that the source vertex happens _after_ the target vertex in the control flow.
|
|
254
253
|
So \`x; y\` would produce a flow dependency from \`y\` to \`x\` (additionally to the program-enveloping root expression list):
|
|
255
254
|
|
|
256
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'x; y', { showCode: false, prefix: 'flowchart RL\n' })}
|
|
255
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'x; y', { showCode: false, prefix: 'flowchart RL\n', ctx })}
|
|
257
256
|
|
|
258
257
|
${(0, doc_structure_1.section)('Control Dependencies', 4, 'cfg-control-dependency')}
|
|
259
258
|
|
|
@@ -266,12 +265,12 @@ The extra \`caused\` link signals the vertex that caused the control flow influe
|
|
|
266
265
|
|
|
267
266
|
|
|
268
267
|
${await (async () => {
|
|
269
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n' });
|
|
268
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n', ctx });
|
|
270
269
|
return (0, doc_structure_1.details)('Example: if-else', exa);
|
|
271
270
|
})()}
|
|
272
271
|
|
|
273
272
|
${await (async () => {
|
|
274
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n' });
|
|
273
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n', ctx });
|
|
275
274
|
return (0, doc_structure_1.details)('Example: while-loop', exa);
|
|
276
275
|
})()}
|
|
277
276
|
<br/>
|
|
@@ -281,12 +280,12 @@ Additionally, the control flow graph does not have to be connected. If you use a
|
|
|
281
280
|
the corresponding exit markers are not reachable from the entry:
|
|
282
281
|
|
|
283
282
|
${await (async () => {
|
|
284
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n' });
|
|
283
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n', ctx });
|
|
285
284
|
return (0, doc_structure_1.details)('Example: repeat-loop (infinite)', exa);
|
|
286
285
|
})()}
|
|
287
286
|
|
|
288
287
|
${await (async () => {
|
|
289
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n' });
|
|
288
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n', ctx });
|
|
290
289
|
return (0, doc_structure_1.details)('Example: repeat-loop (with break)', exa);
|
|
291
290
|
})()}
|
|
292
291
|
<br/>
|
|
@@ -294,22 +293,22 @@ ${await (async () => {
|
|
|
294
293
|
In the context of a for-loop, the control dependency refer to whether the respective vector still has values to iterate over.
|
|
295
294
|
|
|
296
295
|
${await (async () => {
|
|
297
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n' });
|
|
296
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n', ctx });
|
|
298
297
|
return (0, doc_structure_1.details)('Example: for-loop', exa);
|
|
299
298
|
})()}
|
|
300
299
|
|
|
301
300
|
${(0, doc_structure_1.section)('Extra: Call Links', 4, 'cfg-call-links')}
|
|
302
301
|
|
|
303
302
|
If you generate the CFG with the ${ctx.link(extract_cfg_1.extractCfg)} function you can (and, if you want to gain inter-procedural information, should)
|
|
304
|
-
pass a matching
|
|
303
|
+
pass a matching ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} to it to incorporate the dataflow perspective into the CFG.
|
|
305
304
|
|
|
306
305
|
The difference becomes obvious when we look at the code \`f <- function() b; f()\` first without the dataflow graph:
|
|
307
306
|
|
|
308
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: false })}
|
|
307
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: false, ctx })}
|
|
309
308
|
|
|
310
309
|
And now, including dataflow information:
|
|
311
310
|
|
|
312
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: true })}
|
|
311
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() b; f()', { showCode: true, prefix: 'flowchart RL\n', useDfg: true, ctx })}
|
|
313
312
|
|
|
314
313
|
There are two important additions:
|
|
315
314
|
|
|
@@ -317,14 +316,14 @@ There are two important additions:
|
|
|
317
316
|
This marker always follows the exit marker of the function call and links not just the call but also the exit points of the function definition.
|
|
318
317
|
2. A new _calls_ attribute attached to the function call vertex. This holds the ${ctx.link('NodeId')} of the function definitions that are called from this vertex.
|
|
319
318
|
|
|
320
|
-
For built-in functions that are provided by flowR's built-in configuration (see the
|
|
319
|
+
For built-in functions that are provided by flowR's built-in configuration (see the ${ctx.linkPage('wiki/Interface', 'interface wiki page')}) the CFG does not contain
|
|
321
320
|
the additional information directly:
|
|
322
321
|
|
|
323
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'print(3)', { showCode: true, prefix: 'flowchart RL\n' })}
|
|
322
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'print(3)', { showCode: true, prefix: 'flowchart RL\n', ctx })}
|
|
324
323
|
|
|
325
|
-
This is due to the fact that the
|
|
324
|
+
This is due to the fact that the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} does contain the required call information (and there are no new control vertices to add as the built-in call has no target in the source code):
|
|
326
325
|
|
|
327
|
-
${await (0, doc_dfg_1.printDfGraphForCode)(shell, 'print(3)', { showCode: true })}
|
|
326
|
+
${await (0, doc_dfg_1.printDfGraphForCode)(shell, 'print(3)', { showCode: true, ctx })}
|
|
328
327
|
|
|
329
328
|
${(0, doc_structure_1.section)('Adding Basic Blocks', 3, 'cfg-basic-blocks')}
|
|
330
329
|
|
|
@@ -335,16 +334,16 @@ Yet, we can request basic blocks or transform an existing CFG into basic blocks
|
|
|
335
334
|
|
|
336
335
|
Any program without any (un-)conditional jumps now contains a single basic block:
|
|
337
336
|
|
|
338
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: true, openCode: true, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true })}
|
|
337
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: true, openCode: true, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
|
|
339
338
|
|
|
340
339
|
While the CFG without basic blocks is much bigger:
|
|
341
340
|
|
|
342
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
|
|
341
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', ctx })}
|
|
343
342
|
|
|
344
343
|
In a way, using the basic blocks perspective does not remove any of these vertices (we just usually visualize them compacted as their execution order should be "obvious").
|
|
345
344
|
The vertices are still there, as elems of the ${ctx.link('CfgBasicBlockVertex')}:
|
|
346
345
|
|
|
347
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: false })}
|
|
346
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: false, ctx })}
|
|
348
347
|
|
|
349
348
|
The benefit (for comprehensibility and algorithms) becomes more apparent when we look at a more complicated program:
|
|
350
349
|
|
|
@@ -352,12 +351,12 @@ ${(0, doc_code_1.codeBlock)('r', CfgLongExample)}
|
|
|
352
351
|
|
|
353
352
|
With basic blocks, this code looks like this:
|
|
354
353
|
|
|
355
|
-
${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true })}
|
|
354
|
+
${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: true, ctx })}
|
|
356
355
|
|
|
357
356
|
Now, without basic blocks, this is a different story...
|
|
358
357
|
|
|
359
358
|
${await (async () => {
|
|
360
|
-
const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n' });
|
|
359
|
+
const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n', ctx });
|
|
361
360
|
return (0, doc_structure_1.details)('The full CFG', exa);
|
|
362
361
|
})()}
|
|
363
362
|
|
|
@@ -365,7 +364,7 @@ And again it should be noted that even though the example code is more complicat
|
|
|
365
364
|
|
|
366
365
|
${(0, doc_structure_1.section)('Working with the CFG', 2, 'cfg-working')}
|
|
367
366
|
|
|
368
|
-
There is a plethora of functions that you can use the traverse the
|
|
367
|
+
There is a plethora of functions that you can use the traverse the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} and the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}.
|
|
369
368
|
Similarly, flowR provides you with a set of utility functions and classes that you can use to interact with the control flow graph:
|
|
370
369
|
|
|
371
370
|
* ${ctx.link(simple_visitor_1.visitCfgInOrder)} and ${ctx.link(simple_visitor_1.visitCfgInReverseOrder)} for simple traversals
|
|
@@ -392,7 +391,7 @@ ${await (async () => {
|
|
|
392
391
|
})()}
|
|
393
392
|
|
|
394
393
|
A more useful appearance of these visitors occurs with ${ctx.link(happens_before_1.happensBefore)} which uses the CFG to determine whether the execution
|
|
395
|
-
of one vertex always, maybe, or never happens before another vertex (see the corresponding
|
|
394
|
+
of one vertex always, maybe, or never happens before another vertex (see the corresponding ${ctx.linkPage('wiki/Query API', 'query documentation', 'happens-before-query')} for more information).
|
|
396
395
|
|
|
397
396
|
|
|
398
397
|
${(0, doc_structure_1.section)('Diffing and Testing', 3, 'cfg-diff-and-test')}
|
|
@@ -417,9 +416,9 @@ visitors that incorporate various alternative perspectives:
|
|
|
417
416
|
- [Basic CFG Visitor](#cfg-traversal-basic):\\
|
|
418
417
|
As a class-based version of the [simple traversal](#cfg-traversal-basic) functions
|
|
419
418
|
- [Syntax-Aware CFG Visitor](#cfg-traversal-syntax):\\
|
|
420
|
-
If you want directly incorporate the type of the respective vertex in the
|
|
419
|
+
If you want directly incorporate the type of the respective vertex in the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} into your visitor
|
|
421
420
|
- [Dataflow-Aware CFG Visitor](#cfg-traversal-dfg):\\
|
|
422
|
-
If you require the
|
|
421
|
+
If you require the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow information')} as well (e.g., to track built-in function calls, ...)
|
|
423
422
|
- [Semantic CFG Visitor](#cfg-traversal-semantic):\\
|
|
424
423
|
Currently the most advanced visitor that combines syntactic with dataflow information.
|
|
425
424
|
|
|
@@ -446,7 +445,7 @@ ${await (async () => {
|
|
|
446
445
|
|
|
447
446
|
${(0, doc_structure_1.section)('Syntax-Aware CFG Visitor', 4, 'cfg-traversal-syntax')}
|
|
448
447
|
|
|
449
|
-
The ${ctx.link(syntax_cfg_guided_visitor_1.SyntaxAwareCfgGuidedVisitor)} class incorporates knowledge of the
|
|
448
|
+
The ${ctx.link(syntax_cfg_guided_visitor_1.SyntaxAwareCfgGuidedVisitor)} class incorporates knowledge of the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} into the CFG traversal and
|
|
450
449
|
directly provides specialized visitors for the various node types.
|
|
451
450
|
Now, our running example of collecting all numbers simplifies to this:
|
|
452
451
|
|
|
@@ -464,7 +463,7 @@ ${await (async () => {
|
|
|
464
463
|
|
|
465
464
|
${(0, doc_structure_1.section)('Dataflow-Aware CFG Visitor', 4, 'cfg-traversal-dfg')}
|
|
466
465
|
|
|
467
|
-
There is a lot of benefit in incorporating the
|
|
466
|
+
There is a lot of benefit in incorporating the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow information')} into the CFG traversal, as it contains
|
|
468
467
|
information about overwritten function calls, definition targets, and so on.
|
|
469
468
|
Our best friend is the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} function which provides the important information about the origin of a vertex in the dataflow graph.
|
|
470
469
|
The ${ctx.link(dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor)} class does some of the basic lifting for us.
|
|
@@ -530,7 +529,7 @@ ${await (async function () {
|
|
|
530
529
|
(0, assert_1.guard)(control_flow_graph_1.CfgVertex.isExpression(plusVertex));
|
|
531
530
|
const numOfExits = control_flow_graph_1.CfgVertex.getEnd(plusVertex)?.length ?? 0;
|
|
532
531
|
(0, assert_1.guard)(numOfExits === 1);
|
|
533
|
-
return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n' })}
|
|
532
|
+
return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n', ctx })}
|
|
534
533
|
|
|
535
534
|
Looking at the binary operation vertex for \`+\` (with id \`${plusVertexId}\`) we see that it is linked to a single exit ("end marker") point: \`${control_flow_graph_1.CfgVertex.getEnd(plusVertex)?.[0] ?? '??'}\`.
|
|
536
535
|
Checking this vertex essentially reveals all exit points of the expression ‐ in this case, this simply refers to the operands of the addition.
|
|
@@ -545,7 +544,7 @@ ${(0, doc_structure_1.details)('Example: Exit Points for an if', await (async fu
|
|
|
545
544
|
(0, assert_1.guard)(control_flow_graph_1.CfgVertex.isStatement(ifVertex));
|
|
546
545
|
const numOfExits = control_flow_graph_1.CfgVertex.getEnd(ifVertex)?.length ?? 0;
|
|
547
546
|
(0, assert_1.guard)(numOfExits === 1);
|
|
548
|
-
return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n' })}
|
|
547
|
+
return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n', ctx })}
|
|
549
548
|
|
|
550
549
|
Looking at the if vertex for (with id \`${ifVertexId}\`) we see that it is again linked to a single exit point: \`${control_flow_graph_1.CfgVertex.getEnd(ifVertex)?.[0] ?? '??'}\`.
|
|
551
550
|
Yet, now this exit vertex is linked to the two branches of the if statement (the \`then\` and \`else\` branch).
|