@eagleoutice/flowr 2.6.2 → 2.6.3
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 +36 -34
- package/abstract-interpretation/data-frame/absint-visitor.js +3 -3
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +20 -16
- package/abstract-interpretation/data-frame/semantics.js +8 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
- package/abstract-interpretation/data-frame/shape-inference.js +3 -3
- package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
- package/benchmark/slicer.d.ts +1 -0
- package/benchmark/slicer.js +13 -12
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
- package/benchmark/summarizer/second-phase/graph.js +3 -1
- package/cli/export-quads-app.js +1 -1
- package/cli/repl/commands/repl-dataflow.js +2 -1
- package/cli/repl/commands/repl-parse.js +16 -4
- package/cli/repl/commands/repl-query.js +1 -1
- package/cli/repl/core.js +16 -13
- package/cli/repl/server/connection.js +2 -1
- package/cli/script-core/statistics-helper-core.js +2 -1
- package/cli/slicer-app.js +3 -4
- package/cli/wiki.d.ts +4 -0
- package/cli/wiki.js +165 -0
- package/config.d.ts +4 -0
- package/config.js +6 -0
- package/control-flow/cfg-dead-code.js +13 -3
- package/control-flow/cfg-simplification.d.ts +5 -2
- package/control-flow/cfg-simplification.js +3 -0
- package/control-flow/extract-cfg.d.ts +9 -3
- package/control-flow/extract-cfg.js +44 -4
- package/control-flow/semantic-cfg-guided-visitor.d.ts +2 -2
- package/control-flow/simple-visitor.js +2 -2
- package/control-flow/useless-loop.d.ts +3 -3
- package/control-flow/useless-loop.js +14 -5
- package/core/pipeline-executor.d.ts +3 -6
- package/core/pipeline-executor.js +4 -7
- package/core/print/normalize-printer.d.ts +1 -1
- package/core/print/normalize-printer.js +2 -2
- package/core/steps/all/core/00-parse.d.ts +1 -1
- package/core/steps/all/core/00-parse.js +1 -1
- package/core/steps/all/core/10-normalize.d.ts +3 -9
- package/core/steps/all/core/10-normalize.js +1 -16
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -3
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -3
- package/core/steps/all/core/20-dataflow.d.ts +3 -4
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +1 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +8 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +4 -1
- package/core/steps/pipeline/default-pipelines.d.ts +55 -56
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/dataflow/environments/clone.d.ts +0 -1
- package/dataflow/environments/clone.js +12 -2
- package/dataflow/environments/diff.js +2 -2
- package/dataflow/environments/overwrite.d.ts +1 -5
- package/dataflow/environments/overwrite.js +3 -19
- package/dataflow/environments/scoping.d.ts +6 -2
- package/dataflow/environments/scoping.js +6 -2
- package/dataflow/eval/resolve/resolve-argument.js +2 -2
- package/dataflow/eval/values/string/string-constants.d.ts +9 -3
- package/dataflow/eval/values/string/string-constants.js +9 -3
- package/dataflow/extractor.d.ts +2 -3
- package/dataflow/extractor.js +25 -22
- package/dataflow/graph/graph.d.ts +3 -9
- package/dataflow/graph/graph.js +0 -13
- package/dataflow/graph/unknown-replacement.d.ts +4 -2
- package/dataflow/graph/unknown-replacement.js +4 -2
- package/dataflow/info.d.ts +7 -0
- package/dataflow/info.js +21 -0
- package/dataflow/internal/linker.js +7 -4
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -2
- package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +6 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +15 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +78 -75
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/common.d.ts +1 -1
- package/dataflow/internal/process/functions/call/common.js +4 -4
- package/dataflow/internal/process/functions/call/default-call-handling.d.ts +3 -1
- package/dataflow/internal/process/functions/call/default-call-handling.js +3 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +3 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
- package/dataflow/internal/process/functions/process-parameter.js +4 -4
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
- package/dataflow/processor.d.ts +6 -11
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +0 -2
- package/documentation/data/faq/faqs.js +27 -18
- package/documentation/data/faq/recommended-configs.d.ts +36 -0
- package/documentation/data/faq/recommended-configs.js +40 -0
- package/documentation/data/faq/wiki-faq-store.d.ts +1 -0
- package/documentation/data/faq/wiki-faq-store.js +10 -2
- package/documentation/data/server/doc-data-server-messages.js +1 -1
- package/documentation/doc-capabilities.d.ts +9 -0
- package/documentation/{print-capabilities-markdown.js → doc-capabilities.js} +18 -21
- package/documentation/doc-readme.d.ts +9 -0
- package/documentation/{print-readme.js → doc-readme.js} +31 -35
- package/documentation/doc-util/doc-benchmarks.d.ts +6 -4
- package/documentation/doc-util/doc-benchmarks.js +6 -4
- package/documentation/doc-util/doc-cfg.js +5 -8
- package/documentation/doc-util/doc-dfg.d.ts +7 -7
- package/documentation/doc-util/doc-dfg.js +13 -13
- package/documentation/doc-util/doc-escape.d.ts +6 -0
- package/documentation/doc-util/doc-escape.js +11 -0
- package/documentation/doc-util/doc-general.d.ts +22 -2
- package/documentation/doc-util/doc-general.js +22 -2
- package/documentation/doc-util/doc-normalized-ast.d.ts +10 -5
- package/documentation/doc-util/doc-normalized-ast.js +12 -9
- package/documentation/doc-util/doc-query.d.ts +12 -4
- package/documentation/doc-util/doc-query.js +18 -11
- package/documentation/doc-util/doc-search.d.ts +0 -30
- package/documentation/doc-util/doc-search.js +2 -73
- package/documentation/doc-util/doc-server-message.d.ts +5 -5
- package/documentation/doc-util/doc-server-message.js +4 -4
- package/documentation/doc-util/doc-types.d.ts +69 -32
- package/documentation/doc-util/doc-types.js +108 -61
- package/documentation/index.d.ts +9 -9
- package/documentation/index.js +9 -9
- package/documentation/issue-linting-rule.d.ts +9 -0
- package/documentation/{print-linter-issue.js → issue-linting-rule.js} +20 -23
- package/documentation/wiki-analyzer.d.ts +9 -0
- package/documentation/wiki-analyzer.js +412 -0
- package/documentation/wiki-cfg.d.ts +9 -0
- package/documentation/{print-cfg-wiki.js → wiki-cfg.js} +144 -160
- package/documentation/wiki-core.d.ts +14 -0
- package/documentation/{print-core-wiki.js → wiki-core.js} +164 -175
- package/documentation/wiki-dataflow-graph.d.ts +9 -0
- package/documentation/{print-dataflow-graph-wiki.js → wiki-dataflow-graph.js} +142 -172
- package/documentation/wiki-engine.d.ts +9 -0
- package/documentation/{print-engines-wiki.js → wiki-engine.js} +27 -42
- package/documentation/wiki-faq.d.ts +8 -0
- package/documentation/wiki-faq.js +22 -0
- package/documentation/wiki-interface.d.ts +9 -0
- package/documentation/{print-interface-wiki.js → wiki-interface.js} +59 -56
- package/documentation/wiki-linter.d.ts +9 -0
- package/documentation/{print-linter-wiki.js → wiki-linter.js} +52 -48
- package/documentation/wiki-linting-and-testing.d.ts +9 -0
- package/documentation/{print-linting-and-testing-wiki.js → wiki-linting-and-testing.js} +25 -32
- package/documentation/wiki-mk/doc-context.d.ts +186 -0
- package/documentation/wiki-mk/doc-context.js +84 -0
- package/documentation/wiki-mk/doc-maker.d.ts +95 -0
- package/documentation/wiki-mk/doc-maker.js +133 -0
- package/documentation/wiki-normalized-ast.d.ts +9 -0
- package/documentation/{print-normalized-ast-wiki.js → wiki-normalized-ast.js} +64 -47
- package/documentation/wiki-onboarding.d.ts +8 -0
- package/documentation/{print-onboarding-wiki.js → wiki-onboarding.js} +18 -15
- package/documentation/wiki-query.d.ts +9 -0
- package/documentation/{print-query-wiki.js → wiki-query.js} +62 -47
- package/documentation/wiki-search.d.ts +9 -0
- package/documentation/wiki-search.js +61 -0
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +2 -2
- package/linter/linter-rules.d.ts +13 -17
- package/linter/rules/absolute-path.d.ts +1 -2
- package/linter/rules/absolute-path.js +2 -2
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +12 -8
- package/linter/rules/dead-code.d.ts +1 -1
- package/linter/rules/deprecated-functions.d.ts +1 -5
- package/linter/rules/file-path-validity.d.ts +1 -1
- package/linter/rules/file-path-validity.js +4 -4
- package/linter/rules/function-finder-util.d.ts +1 -5
- package/linter/rules/naming-convention.d.ts +2 -2
- package/linter/rules/naming-convention.js +1 -1
- package/linter/rules/network-functions.d.ts +1 -1
- package/linter/rules/network-functions.js +1 -1
- package/linter/rules/seeded-randomness.d.ts +3 -2
- package/linter/rules/seeded-randomness.js +33 -13
- package/linter/rules/unused-definition.d.ts +1 -1
- package/linter/rules/useless-loop.d.ts +2 -2
- package/linter/rules/useless-loop.js +2 -2
- package/package.json +6 -17
- package/project/cache/flowr-analyzer-cache.d.ts +7 -10
- package/project/cache/flowr-analyzer-cache.js +17 -38
- package/project/cache/flowr-analyzer-controlflow-cache.d.ts +34 -0
- package/project/cache/flowr-analyzer-controlflow-cache.js +79 -0
- package/project/context/flowr-analyzer-context.d.ts +30 -5
- package/project/context/flowr-analyzer-context.js +48 -4
- package/project/context/flowr-analyzer-files-context.d.ts +63 -13
- package/project/context/flowr-analyzer-files-context.js +110 -39
- package/project/context/flowr-file.d.ts +32 -10
- package/project/context/flowr-file.js +30 -9
- package/project/flowr-analyzer-builder.d.ts +22 -28
- package/project/flowr-analyzer-builder.js +32 -70
- package/project/flowr-analyzer.d.ts +55 -14
- package/project/flowr-analyzer.js +53 -8
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +7 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +13 -5
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +3 -3
- package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +11 -5
- package/project/plugins/file-plugins/flowr-description-file.d.ts +3 -3
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +33 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.d.ts +20 -0
- package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.js +42 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.d.ts +59 -0
- package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.js +132 -0
- package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
- package/project/plugins/file-plugins/notebooks/notebook.js +2 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.d.ts +5 -0
- package/project/plugins/flowr-analyzer-plugin-defaults.js +23 -0
- package/project/plugins/flowr-analyzer-plugin.d.ts +2 -0
- package/project/plugins/flowr-analyzer-plugin.js +2 -0
- package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
- package/project/plugins/plugin-registry.d.ts +34 -0
- package/project/plugins/plugin-registry.js +62 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +4 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -18
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-format.js +6 -5
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +13 -2
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -1
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-executor.js +3 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- 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 +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +13 -1
- package/queries/query.d.ts +26 -18
- package/queries/query.js +21 -1
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/collect.js +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +29 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +15 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +5 -7
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +24 -11
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/type.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +9 -8
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +11 -10
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +4 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +20 -11
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -3
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +5 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +14 -5
- package/r-bridge/parser.d.ts +15 -5
- package/r-bridge/parser.js +27 -13
- package/r-bridge/retriever.d.ts +9 -15
- package/r-bridge/retriever.js +14 -5
- package/r-bridge/shell.d.ts +1 -1
- package/r-bridge/shell.js +1 -1
- package/reconstruct/auto-select/auto-select-defaults.d.ts +0 -1
- package/reconstruct/auto-select/magic-comments.js +1 -1
- package/reconstruct/reconstruct.d.ts +17 -9
- package/reconstruct/reconstruct.js +19 -8
- package/search/flowr-search.d.ts +12 -0
- package/search/search-executor/search-enrichers.d.ts +9 -2
- package/search/search-executor/search-enrichers.js +1 -3
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-generators.js +9 -4
- package/slicing/criterion/collect-all.d.ts +3 -2
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/criterion/parse.js +4 -4
- package/statistics/features/supported/assignments/assignments.js +1 -1
- package/statistics/features/supported/control-flow/control-flow.js +1 -1
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
- package/statistics/features/supported/expression-list/statistics-expression-list.js +1 -1
- package/statistics/features/supported/loops/loops.js +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +1 -1
- package/statistics/features/supported/variables/variables.js +1 -1
- package/statistics/statistics.js +3 -2
- package/util/assert.d.ts +4 -0
- package/util/assert.js +4 -0
- package/util/files.d.ts +1 -1
- package/util/files.js +1 -1
- package/util/mermaid/ast.d.ts +4 -3
- package/util/mermaid/ast.js +36 -8
- package/util/mermaid/cfg.js +1 -1
- package/util/version.js +1 -1
- package/documentation/print-analyzer-wiki.d.ts +0 -1
- package/documentation/print-analyzer-wiki.js +0 -141
- package/documentation/print-capabilities-markdown.d.ts +0 -1
- package/documentation/print-cfg-wiki.d.ts +0 -1
- package/documentation/print-core-wiki.d.ts +0 -5
- package/documentation/print-dataflow-graph-wiki.d.ts +0 -1
- package/documentation/print-engines-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.d.ts +0 -1
- package/documentation/print-faq-wiki.js +0 -18
- package/documentation/print-interface-wiki.d.ts +0 -1
- package/documentation/print-linter-issue.d.ts +0 -1
- package/documentation/print-linter-wiki.d.ts +0 -1
- package/documentation/print-linting-and-testing-wiki.d.ts +0 -1
- package/documentation/print-normalized-ast-wiki.d.ts +0 -1
- package/documentation/print-onboarding-wiki.d.ts +0 -1
- package/documentation/print-query-wiki.d.ts +0 -1
- package/documentation/print-readme.d.ts +0 -1
- package/documentation/print-search-wiki.d.ts +0 -1
- package/documentation/print-search-wiki.js +0 -74
- package/util/formats/adapter-format.d.ts +0 -6
- package/util/formats/adapter-format.js +0 -3
- package/util/formats/adapter.d.ts +0 -27
- package/util/formats/adapter.js +0 -58
- package/util/formats/adapters/r-adapter.d.ts +0 -4
- package/util/formats/adapters/r-adapter.js +0 -7
- package/util/formats/adapters/rmd-adapter.d.ts +0 -35
- package/util/formats/adapters/rmd-adapter.js +0 -100
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { PathLike } from 'fs';
|
|
2
|
+
import type { GeneralDocContext } from './doc-context';
|
|
3
|
+
import type { RShell } from '../../r-bridge/shell';
|
|
4
|
+
import type { TreeSitterExecutor } from '../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
|
|
5
|
+
import type { AsyncOrSync } from 'ts-essentials';
|
|
6
|
+
export interface DocMakerArgs {
|
|
7
|
+
/** Overwrite existing wiki files, even if nothing changes */
|
|
8
|
+
readonly force?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The general documentation context to use for generating links and headers
|
|
11
|
+
*/
|
|
12
|
+
readonly ctx: GeneralDocContext;
|
|
13
|
+
/**
|
|
14
|
+
* The RShell engine to use for R code execution and retrieval
|
|
15
|
+
*/
|
|
16
|
+
readonly shell: RShell;
|
|
17
|
+
/**
|
|
18
|
+
* The TreeSitter engine to use for R code parsing
|
|
19
|
+
*/
|
|
20
|
+
readonly treeSitter: TreeSitterExecutor;
|
|
21
|
+
}
|
|
22
|
+
export interface DocMakerOutputArgs {
|
|
23
|
+
writeFileSync(path: PathLike, data: string): void;
|
|
24
|
+
readFileSync(path: PathLike): string | Buffer<ArrayBufferLike> | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare enum WikiChangeType {
|
|
27
|
+
Changed = 0,
|
|
28
|
+
UnimportantChange = 1,
|
|
29
|
+
Identical = 2
|
|
30
|
+
}
|
|
31
|
+
export interface DocMakerLike {
|
|
32
|
+
make(args: DocMakerArgs & DocMakerOutputArgs): Promise<boolean>;
|
|
33
|
+
getTarget(): string;
|
|
34
|
+
getProducer(): string;
|
|
35
|
+
getWrittenSubfiles(): Set<string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Abstract base class for generating wiki files.
|
|
39
|
+
* **Please make sure to register your WikiMaker implementation in the CLI wiki tool to have it executed:
|
|
40
|
+
* `src/cli/wiki.ts`.**
|
|
41
|
+
*
|
|
42
|
+
* If this wiki page produces multiple pages ("sub files"), you can use `writeSubFile` inside the `text` method
|
|
43
|
+
* to write those additional files.
|
|
44
|
+
*/
|
|
45
|
+
export declare abstract class DocMaker implements DocMakerLike {
|
|
46
|
+
private readonly target;
|
|
47
|
+
private readonly filename;
|
|
48
|
+
private readonly purpose;
|
|
49
|
+
private readonly printHeader;
|
|
50
|
+
private currentArgs?;
|
|
51
|
+
private writtenSubfiles;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new WikiMaker instance.
|
|
54
|
+
* @param target - The target path where the wiki file will be generated.
|
|
55
|
+
* @param filename - The name of the file being generated. Probably use `module.filename`.
|
|
56
|
+
* @param purpose - The purpose of the file, e.g., 'wiki context for types'.
|
|
57
|
+
* @param printHeader - Whether to print the auto-generation header. Default is `true`. Only mark this `false` if you plan to add it yourself.
|
|
58
|
+
* @protected
|
|
59
|
+
*/
|
|
60
|
+
protected constructor(target: PathLike, filename: string, purpose: string, printHeader?: boolean);
|
|
61
|
+
/**
|
|
62
|
+
* Gets the target path where the wiki file will be generated.
|
|
63
|
+
*/
|
|
64
|
+
getTarget(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Gets the name of the producer of this wiki file.
|
|
67
|
+
*/
|
|
68
|
+
getProducer(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the set of subfiles written during the last `make` call.
|
|
71
|
+
*/
|
|
72
|
+
getWrittenSubfiles(): Set<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Generates or updates the wiki file at the given target location.
|
|
75
|
+
* @returns `true` if the file was created or updated, `false` if it was identical and not changed.
|
|
76
|
+
*/
|
|
77
|
+
make(args: DocMakerArgs & DocMakerOutputArgs): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Please note that for subfiles you have to always add your own header
|
|
80
|
+
*/
|
|
81
|
+
protected writeSubFile(path: PathLike, data: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Normalizes the given wiki text for comparison.
|
|
84
|
+
*/
|
|
85
|
+
protected normalizeText(text: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Determines the type of change between the old and new text.
|
|
88
|
+
*/
|
|
89
|
+
protected didUpdate(path: PathLike, newText: string, oldText: string | undefined): WikiChangeType;
|
|
90
|
+
/**
|
|
91
|
+
* Generates the wiki text for the given arguments.
|
|
92
|
+
* The text will be automatically prefixed with metadata including filename and purpose.
|
|
93
|
+
*/
|
|
94
|
+
protected abstract text(args: DocMakerArgs): AsyncOrSync<string>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocMaker = exports.WikiChangeType = void 0;
|
|
4
|
+
var WikiChangeType;
|
|
5
|
+
(function (WikiChangeType) {
|
|
6
|
+
WikiChangeType[WikiChangeType["Changed"] = 0] = "Changed";
|
|
7
|
+
WikiChangeType[WikiChangeType["UnimportantChange"] = 1] = "UnimportantChange";
|
|
8
|
+
WikiChangeType[WikiChangeType["Identical"] = 2] = "Identical";
|
|
9
|
+
})(WikiChangeType || (exports.WikiChangeType = WikiChangeType = {}));
|
|
10
|
+
const DefaultReplacementPatterns = [
|
|
11
|
+
// eslint-disable-next-line no-irregular-whitespace -- we may produce it in output
|
|
12
|
+
[/[0-9]+(\.[0-9]+)?( |\s*)?ms/g, ''],
|
|
13
|
+
[/tmp[%A-Za-z0-9-]+/g, ''],
|
|
14
|
+
[/"(timing|searchTimeMs|processTimeMs|id|treeSitterId)":\s*[0-9]+(\.[0-9])?,?/g, ''],
|
|
15
|
+
[/"format":"compact".+/gmius, ''],
|
|
16
|
+
[/%%\s*\d*-+/g, ''],
|
|
17
|
+
[/"[rR]": "\d+\.\d+\.\d+.*?"/g, ''],
|
|
18
|
+
[/R\s*\d+\.\d+\.\d+/g, ''],
|
|
19
|
+
// async wrapper depends on whether the promise got forfilled already
|
|
20
|
+
[/%20async%20/g, ' ']
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Abstract base class for generating wiki files.
|
|
24
|
+
* **Please make sure to register your WikiMaker implementation in the CLI wiki tool to have it executed:
|
|
25
|
+
* `src/cli/wiki.ts`.**
|
|
26
|
+
*
|
|
27
|
+
* If this wiki page produces multiple pages ("sub files"), you can use `writeSubFile` inside the `text` method
|
|
28
|
+
* to write those additional files.
|
|
29
|
+
*/
|
|
30
|
+
class DocMaker {
|
|
31
|
+
target;
|
|
32
|
+
filename;
|
|
33
|
+
purpose;
|
|
34
|
+
printHeader;
|
|
35
|
+
currentArgs;
|
|
36
|
+
writtenSubfiles = new Set();
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new WikiMaker instance.
|
|
39
|
+
* @param target - The target path where the wiki file will be generated.
|
|
40
|
+
* @param filename - The name of the file being generated. Probably use `module.filename`.
|
|
41
|
+
* @param purpose - The purpose of the file, e.g., 'wiki context for types'.
|
|
42
|
+
* @param printHeader - Whether to print the auto-generation header. Default is `true`. Only mark this `false` if you plan to add it yourself.
|
|
43
|
+
* @protected
|
|
44
|
+
*/
|
|
45
|
+
constructor(target, filename, purpose, printHeader = true) {
|
|
46
|
+
this.filename = filename;
|
|
47
|
+
this.purpose = purpose;
|
|
48
|
+
this.target = target;
|
|
49
|
+
this.printHeader = printHeader;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the target path where the wiki file will be generated.
|
|
53
|
+
*/
|
|
54
|
+
getTarget() {
|
|
55
|
+
return this.target.toString();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the name of the producer of this wiki file.
|
|
59
|
+
*/
|
|
60
|
+
getProducer() {
|
|
61
|
+
return this.filename;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Gets the set of subfiles written during the last `make` call.
|
|
65
|
+
*/
|
|
66
|
+
getWrittenSubfiles() {
|
|
67
|
+
return this.writtenSubfiles;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generates or updates the wiki file at the given target location.
|
|
71
|
+
* @returns `true` if the file was created or updated, `false` if it was identical and not changed.
|
|
72
|
+
*/
|
|
73
|
+
async make(args) {
|
|
74
|
+
this.currentArgs = args;
|
|
75
|
+
this.writtenSubfiles = new Set();
|
|
76
|
+
const newText = (this.printHeader ? (await args.ctx.header(this.filename, this.purpose)) + '\n' : '') + await this.text(args);
|
|
77
|
+
if (args.force || this.didUpdate(this.target, newText, args.readFileSync(this.target)?.toString()) === WikiChangeType.Changed) {
|
|
78
|
+
args.writeFileSync(this.target, newText);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return this.writtenSubfiles.size > 0;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Please note that for subfiles you have to always add your own header
|
|
85
|
+
*/
|
|
86
|
+
writeSubFile(path, data) {
|
|
87
|
+
if (!this.currentArgs) {
|
|
88
|
+
throw new Error('DocMaker: writeSubFile called outside of make()');
|
|
89
|
+
}
|
|
90
|
+
if (this.currentArgs.force || this.didUpdate(path, data, this.currentArgs.readFileSync(path)?.toString()) === WikiChangeType.Changed) {
|
|
91
|
+
this.currentArgs.writeFileSync(path.toString(), data);
|
|
92
|
+
this.writtenSubfiles.add(path.toString());
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Normalizes the given wiki text for comparison.
|
|
99
|
+
*/
|
|
100
|
+
normalizeText(text) {
|
|
101
|
+
// drop first two meta lines
|
|
102
|
+
let result = text.split('\n').slice(2).join('\n');
|
|
103
|
+
for (const [pattern, replacement] of DefaultReplacementPatterns) {
|
|
104
|
+
result = result.replace(pattern, replacement);
|
|
105
|
+
}
|
|
106
|
+
return result.trim();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Determines the type of change between the old and new text.
|
|
110
|
+
*/
|
|
111
|
+
didUpdate(path, newText, oldText) {
|
|
112
|
+
if (oldText === newText) {
|
|
113
|
+
return WikiChangeType.Identical;
|
|
114
|
+
}
|
|
115
|
+
const normOld = this.normalizeText(oldText ?? '');
|
|
116
|
+
const normNew = this.normalizeText(newText);
|
|
117
|
+
const same = normOld === normNew;
|
|
118
|
+
if (!same) {
|
|
119
|
+
// find first diff
|
|
120
|
+
for (let i = 0; i < Math.min(normOld.length, normNew.length); i++) {
|
|
121
|
+
if (normOld[i] !== normNew[i]) {
|
|
122
|
+
const contextOld = normOld.slice(Math.max(0, i - 20), Math.min(normOld.length, i + 20));
|
|
123
|
+
const contextNew = normNew.slice(Math.max(0, i - 20), Math.min(normNew.length, i + 20));
|
|
124
|
+
console.log(` [${path.toString()}] First diff at pos ${i}:\n - Old: ...${contextOld}...\n + New: ...${contextNew}...`);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return same ? WikiChangeType.UnimportantChange : WikiChangeType.Changed;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.DocMaker = DocMaker;
|
|
133
|
+
//# sourceMappingURL=doc-maker.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocMakerArgs } from './wiki-mk/doc-maker';
|
|
2
|
+
import { DocMaker } from './wiki-mk/doc-maker';
|
|
3
|
+
/**
|
|
4
|
+
* https://github.com/flowr-analysis/flowr/wiki/Normalized-AST
|
|
5
|
+
*/
|
|
6
|
+
export declare class WikiNormalizedAst extends DocMaker {
|
|
7
|
+
constructor();
|
|
8
|
+
protected text({ ctx, treeSitter }: DocMakerArgs): Promise<string>;
|
|
9
|
+
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WikiNormalizedAst = void 0;
|
|
6
4
|
const shell_1 = require("../r-bridge/shell");
|
|
7
|
-
const log_1 = require("../../test/functionality/_helper/log");
|
|
8
|
-
const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
|
|
9
5
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
10
6
|
const doc_normalized_ast_1 = require("./doc-util/doc-normalized-ast");
|
|
11
|
-
const doc_types_1 = require("./doc-util/doc-types");
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
7
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
14
8
|
const doc_cli_option_1 = require("./doc-util/doc-cli-option");
|
|
15
|
-
const time_1 = require("../util/text/time");
|
|
16
9
|
const doc_structure_1 = require("./doc-util/doc-structure");
|
|
17
10
|
const pipeline_executor_1 = require("../core/pipeline-executor");
|
|
18
11
|
const retriever_1 = require("../r-bridge/retriever");
|
|
@@ -21,17 +14,29 @@ const collect_1 = require("../r-bridge/lang-4.x/ast/model/collect");
|
|
|
21
14
|
const normalized_ast_fold_1 = require("../abstract-interpretation/normalized-ast-fold");
|
|
22
15
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
23
16
|
const flowr_analyzer_1 = require("../project/flowr-analyzer");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
|
|
18
|
+
const flowr_file_1 = require("../project/context/flowr-file");
|
|
19
|
+
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
20
|
+
async function quickNormalizedAstMultipleFiles() {
|
|
21
|
+
const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
|
|
22
|
+
.setEngine('tree-sitter')
|
|
23
|
+
.build();
|
|
24
|
+
analyzer.addFile(new flowr_file_1.FlowrInlineTextFile('foo.R', 'x <- 12; source("a.R")'));
|
|
25
|
+
analyzer.addFile(new flowr_file_1.FlowrInlineTextFile('a.R', 'y <- x + 3'));
|
|
26
|
+
analyzer.addFile(new flowr_file_1.FlowrInlineTextFile('b.R', 'print(x, y)'));
|
|
27
|
+
analyzer.addRequest({ request: 'file', content: 'a.R' }, { request: 'file', content: 'b.R' }, { request: 'file', content: 'foo.R' });
|
|
28
|
+
const n = await analyzer.normalize();
|
|
29
|
+
return n;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* https://github.com/flowr-analysis/flowr/wiki/Normalized-AST
|
|
33
|
+
*/
|
|
34
|
+
class WikiNormalizedAst extends doc_maker_1.DocMaker {
|
|
35
|
+
constructor() {
|
|
36
|
+
super('wiki/Normalized AST.md', module.filename, 'normalized ast');
|
|
37
|
+
}
|
|
38
|
+
async text({ ctx, treeSitter }) {
|
|
39
|
+
return `
|
|
35
40
|
_flowR_ produces a normalized version of R's abstract syntax tree (AST),
|
|
36
41
|
offering the following benefits:
|
|
37
42
|
|
|
@@ -48,14 +53,15 @@ ${(0, doc_code_1.codeBlock)('r', 'x <- 2 * 3 + 1')}
|
|
|
48
53
|
Each node in the AST contains the type, the id, and the lexeme (if applicable).
|
|
49
54
|
Each edge is labeled with the type of the parent-child relationship (the "role").
|
|
50
55
|
|
|
51
|
-
${await (0, doc_normalized_ast_1.printNormalizedAstForCode)(
|
|
56
|
+
${await (0, doc_normalized_ast_1.printNormalizedAstForCode)(treeSitter, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart LR\n' })}
|
|
52
57
|
|
|
53
58
|
> [!TIP]
|
|
54
59
|
> If you want to investigate the normalized AST,
|
|
55
60
|
> you can either use the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the ${(0, doc_cli_option_1.getReplCommand)('normalize*')}
|
|
56
61
|
> command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
|
|
57
62
|
|
|
58
|
-
Indicative of the normalization is the root
|
|
63
|
+
Indicative of the normalization is the root ${ctx.link('RProject')} node, which is present in every normalized AST
|
|
64
|
+
and provides the ${ctx.link('RExpressionList')} nodes for each file in the project.
|
|
59
65
|
In general, we provide node types for:
|
|
60
66
|
|
|
61
67
|
1. literals (e.g., numbers and strings)
|
|
@@ -71,19 +77,18 @@ In general, we provide node types for:
|
|
|
71
77
|
Every node is a link, which directly refers to the implementation in the source code.
|
|
72
78
|
Grayed-out parts are used for structuring the AST, grouping together related nodes.
|
|
73
79
|
|
|
74
|
-
${(0, doc_code_1.codeBlock)('mermaid',
|
|
80
|
+
${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid('RNode'))}
|
|
75
81
|
|
|
76
|
-
_The generation of the class diagram required ${(0, time_1.printAsMs)(elapsed)}._
|
|
77
82
|
</details>
|
|
78
83
|
|
|
79
|
-
Node types are controlled by the ${
|
|
84
|
+
Node types are controlled by the ${ctx.link('RType')} enum (see ${(0, doc_files_1.getFilePathMd)('../r-bridge/lang-4.x/ast/model/type.ts')}),
|
|
80
85
|
which is used to distinguish between different types of nodes.
|
|
81
86
|
Additionally, every AST node is generic with respect to the \`Info\` type which allows for arbitrary decorations (e.g., parent inforamtion or dataflow constraints).
|
|
82
87
|
Most notably, the \`info\` field holds the \`id\` of the node, which is used to reference the node in the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph).
|
|
83
88
|
|
|
84
89
|
In summary, we have the following types:
|
|
85
90
|
|
|
86
|
-
${(0, doc_structure_1.details)('Normalized AST Node Types',
|
|
91
|
+
${(0, doc_structure_1.details)('Normalized AST Node Types', ctx.hierarchy('RNode', { collapseFromNesting: Number.MAX_VALUE }))}
|
|
87
92
|
|
|
88
93
|
The following segments intend to give you an overview of how to work with the normalized AST:
|
|
89
94
|
|
|
@@ -93,7 +98,7 @@ The following segments intend to give you an overview of how to work with the no
|
|
|
93
98
|
## How to Get a Normalized AST
|
|
94
99
|
|
|
95
100
|
As explained alongside the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface#creating-flowr-analyses) wiki page, you can use an instance of
|
|
96
|
-
${
|
|
101
|
+
${ctx.link(flowr_analyzer_1.FlowrAnalyzer)} to get the ${ctx.link('NormalizedAst')}:
|
|
97
102
|
|
|
98
103
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
99
104
|
async function getAst(code: string): Promise<RNode> {
|
|
@@ -104,17 +109,37 @@ async function getAst(code: string): Promise<RNode> {
|
|
|
104
109
|
|
|
105
110
|
From the REPL, you can use the ${(0, doc_cli_option_1.getReplCommand)('normalize')} command.
|
|
106
111
|
|
|
112
|
+
### Multi-File Projects
|
|
113
|
+
|
|
114
|
+
With the ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)}, you can analyze multiple files at once:
|
|
115
|
+
|
|
116
|
+
${ctx.code(quickNormalizedAstMultipleFiles, { dropLinesStart: 1, dropLinesEnd: 2, hideDefinedAt: true })}
|
|
117
|
+
|
|
118
|
+
Visualizing the resulting AST yields the following.
|
|
119
|
+
|
|
120
|
+
<details>
|
|
121
|
+
|
|
122
|
+
<summary style="color:gray">Mermaid Diagram</summary>
|
|
123
|
+
|
|
124
|
+
${(0, doc_normalized_ast_1.printNormalizedAst)((await quickNormalizedAstMultipleFiles()).ast, 'flowchart LR\n')}
|
|
125
|
+
|
|
126
|
+
</details>
|
|
127
|
+
|
|
128
|
+
|
|
107
129
|
## Traversing the Normalized AST
|
|
108
130
|
|
|
109
131
|
We provide two ways to traverse the normalized AST: [Visitors](#visitors) and [Folds](#folds).
|
|
132
|
+
Please note, that they usually operate on the ${ctx.link('RExpressionList')} level, and it is up to
|
|
133
|
+
you to decide how you want to traverse multiple files with a ${ctx.link('RProject')} in the AST (you can, for example, simplify flat-map over the files).
|
|
134
|
+
The ${ctx.link('RProject')} node cannot appear nested within other nodes, so you can safely assume that any child of a node is not an ${ctx.link('RProject')}.
|
|
110
135
|
|
|
111
136
|
### Visitors
|
|
112
137
|
|
|
113
|
-
If you want a simple visitor which traverses the AST, the ${
|
|
138
|
+
If you want a simple visitor which traverses the AST, the ${ctx.link(visitor_1.visitAst)} function is a good starting point.
|
|
114
139
|
You may specify functions to be called whenever you enter and exit a node during the traversal, and any
|
|
115
140
|
computation is to be done by side effects.
|
|
116
141
|
For example, if you want to collect all the \`id\`s present within a normalized (sub-)AST,
|
|
117
|
-
as it is done by the ${
|
|
142
|
+
as it is done by the ${ctx.link(collect_1.collectAllIds)} function, you can use the following visitor:
|
|
118
143
|
|
|
119
144
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
120
145
|
const ids = new Set<NodeId>();
|
|
@@ -126,12 +151,12 @@ return ids;
|
|
|
126
151
|
|
|
127
152
|
### Folds
|
|
128
153
|
|
|
129
|
-
We formulate a fold with the base class ${
|
|
154
|
+
We formulate a fold with the base class ${ctx.link(normalized_ast_fold_1.DefaultNormalizedAstFold)} in ${(0, doc_files_1.getFilePathMd)('../abstract-interpretation/normalized-ast-fold.ts')}.
|
|
130
155
|
Using this class, you can create your own fold behavior by overwriting the default methods.
|
|
131
156
|
By default, the class provides a monoid abstraction using the _empty_ from the constructor and the _concat_ method.
|
|
132
157
|
|
|
133
158
|
|
|
134
|
-
${
|
|
159
|
+
${ctx.hierarchy(normalized_ast_fold_1.DefaultNormalizedAstFold)}
|
|
135
160
|
|
|
136
161
|
Now, of course, we could provide hundreds of examples here, but we use tests to verify that the fold behaves as expected
|
|
137
162
|
and happily point to them at ${(0, doc_files_1.getFilePathMd)('../../test/functionality/r-bridge/normalize-ast-fold.test.ts')}.
|
|
@@ -168,7 +193,7 @@ class MyMathFold<Info> extends ${normalized_ast_fold_1.DefaultNormalizedAstFold.
|
|
|
168
193
|
}
|
|
169
194
|
`)}
|
|
170
195
|
|
|
171
|
-
Now, we can use the ${
|
|
196
|
+
Now, we can use the ${ctx.link(pipeline_executor_1.PipelineExecutor)} to get the normalized AST and apply the fold:
|
|
172
197
|
|
|
173
198
|
${(0, doc_code_1.codeBlock)('ts', `
|
|
174
199
|
const shell = new ${shell_1.RShell.name}();
|
|
@@ -181,23 +206,15 @@ console.log(result); // -> 7
|
|
|
181
206
|
`)}
|
|
182
207
|
|
|
183
208
|
${(0, doc_structure_1.block)({
|
|
184
|
-
|
|
185
|
-
|
|
209
|
+
type: 'NOTE',
|
|
210
|
+
content: `
|
|
186
211
|
If you want to retrieve the normalized AST with the [Tree-Sitter Engine](${doc_files_1.FlowrWikiBaseRef}/Engines),
|
|
187
|
-
you may use the ${
|
|
188
|
-
helper functions like ${
|
|
212
|
+
you may use the ${ctx.link('TREE_SITTER_NORMALIZE_PIPELINE')} or directly rely on one of the
|
|
213
|
+
helper functions like ${ctx.link(default_pipelines_1.createNormalizePipeline)}.
|
|
189
214
|
`
|
|
190
|
-
|
|
215
|
+
})}
|
|
191
216
|
`;
|
|
217
|
+
}
|
|
192
218
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
(0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
|
|
196
|
-
const shell = new shell_1.RShell();
|
|
197
|
-
void getText(shell).then(str => {
|
|
198
|
-
console.log(str);
|
|
199
|
-
}).finally(() => {
|
|
200
|
-
shell.close();
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
//# sourceMappingURL=print-normalized-ast-wiki.js.map
|
|
219
|
+
exports.WikiNormalizedAst = WikiNormalizedAst;
|
|
220
|
+
//# sourceMappingURL=wiki-normalized-ast.js.map
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.WikiOnboarding = void 0;
|
|
4
4
|
const doc_files_1 = require("./doc-util/doc-files");
|
|
5
5
|
const doc_code_1 = require("./doc-util/doc-code");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const doc_maker_1 = require("./wiki-mk/doc-maker");
|
|
7
|
+
/**
|
|
8
|
+
* https://github.com/flowr-analysis/flowr/wiki/Onboarding
|
|
9
|
+
*/
|
|
10
|
+
class WikiOnboarding extends doc_maker_1.DocMaker {
|
|
11
|
+
constructor() {
|
|
12
|
+
super('wiki/Onboarding.md', module.filename, 'developer onboarding process');
|
|
13
|
+
}
|
|
14
|
+
text() {
|
|
15
|
+
return `To get started developing on *flowR*, we recommend carefully reading the following pages:
|
|
16
|
+
- 💻 [Setting up the *flowR* development environment](${doc_files_1.FlowrWikiBaseRef}/Setup#%EF%B8%8F-building-from-scratch).\\
|
|
12
17
|
This page explains how to install **R** and **Node.js**.
|
|
13
|
-
- 💖 [Contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md)
|
|
18
|
+
- 💖 [Contributing guidelines](${doc_files_1.FlowrGithubBaseRef}/flowr/tree/main/.github/CONTRIBUTING.md).\\
|
|
14
19
|
This page also includes information about how to set up **git-lfs** and several **git hooks**.
|
|
15
20
|
|
|
16
21
|
If you have any questions, please check out the [FAQ](${doc_files_1.FlowrWikiBaseRef}/FAQ) first, but if the question
|
|
17
|
-
is not answered there (or in the wiki in general), feel free to ask a question.
|
|
18
|
-
|
|
22
|
+
is not answered there (or in the wiki in general), feel free to ask a question.
|
|
23
|
+
The [FAQ](${doc_files_1.FlowrWikiBaseRef}/FAQ) also includes information about how you can configure your editor.
|
|
19
24
|
|
|
20
25
|
## ⌛ TL;DR
|
|
21
26
|
|
|
@@ -38,9 +43,7 @@ git config --local core.hooksPath .githooks/
|
|
|
38
43
|
git push --dry-run
|
|
39
44
|
`)}
|
|
40
45
|
`.trim();
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.log(print());
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=print-onboarding-wiki.js.map
|
|
48
|
+
exports.WikiOnboarding = WikiOnboarding;
|
|
49
|
+
//# sourceMappingURL=wiki-onboarding.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocMakerArgs } from './wiki-mk/doc-maker';
|
|
2
|
+
import { DocMaker } from './wiki-mk/doc-maker';
|
|
3
|
+
/**
|
|
4
|
+
* https://github.com/flowr-analysis/flowr/wiki/Query-API
|
|
5
|
+
*/
|
|
6
|
+
export declare class WikiQuery extends DocMaker {
|
|
7
|
+
constructor();
|
|
8
|
+
protected text({ ctx, shell }: DocMakerArgs): Promise<string>;
|
|
9
|
+
}
|