@eagleoutice/flowr 2.0.25 → 2.1.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/benchmark/slicer.js +2 -1
- package/benchmark/stats/print.js +3 -4
- package/benchmark/stats/size-of.js +9 -7
- package/benchmark/summarizer/first-phase/input.d.ts +0 -1
- package/benchmark/summarizer/first-phase/input.js +2 -3
- package/benchmark/summarizer/first-phase/process.js +7 -7
- package/benchmark/summarizer/second-phase/graph.js +1 -2
- package/benchmark/summarizer/second-phase/process.d.ts +0 -1
- package/benchmark/summarizer/second-phase/process.js +4 -5
- package/benchmark/summarizer/summarizer.js +7 -1
- package/cli/benchmark-app.js +6 -1
- package/cli/common/features.js +2 -3
- package/cli/common/script.js +2 -3
- package/cli/common/scripts-info.d.ts +69 -1
- package/cli/common/scripts-info.js +6 -6
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +88 -0
- package/cli/flowr.d.ts +3 -3
- package/cli/flowr.js +22 -31
- package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
- package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
- package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
- package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
- package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
- package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
- package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
- package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
- package/cli/repl/commands/repl-lineage.d.ts +15 -0
- package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
- package/cli/repl/commands/{main.js → repl-main.js} +1 -1
- package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
- package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
- package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
- package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
- package/cli/repl/commands/repl-query.d.ts +8 -0
- package/cli/repl/commands/repl-query.js +155 -0
- package/cli/repl/commands/repl-quit.d.ts +2 -0
- package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
- package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
- package/cli/repl/commands/{version.js → repl-version.js} +4 -4
- package/cli/repl/core.d.ts +1 -2
- package/cli/repl/core.js +13 -13
- package/cli/repl/execute.d.ts +1 -2
- package/cli/repl/execute.js +2 -3
- package/cli/repl/print-version.js +3 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +45 -12
- package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
- package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
- package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
- package/cli/repl/server/messages/message-analysis.js +39 -0
- package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
- package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
- package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
- package/cli/repl/server/messages/message-hello.js +20 -0
- package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
- package/cli/repl/server/messages/message-lineage.js +25 -0
- package/cli/repl/server/messages/message-query.d.ts +16 -0
- package/cli/repl/server/messages/message-query.js +26 -0
- package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
- package/cli/repl/server/messages/message-repl.js +53 -0
- package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
- package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
- package/cli/repl/server/net.d.ts +0 -1
- package/cli/repl/server/send.d.ts +1 -1
- package/cli/repl/server/send.js +2 -3
- package/cli/repl/server/server.js +2 -2
- package/cli/repl/server/validate.d.ts +1 -1
- package/cli/repl/server/validate.js +5 -6
- package/cli/run-script.d.ts +8 -0
- package/cli/run-script.js +18 -0
- package/cli/script-core/statistics-core.d.ts +2 -0
- package/cli/script-core/statistics-core.js +100 -0
- package/cli/script-core/statistics-helper-core.d.ts +2 -0
- package/cli/script-core/statistics-helper-core.js +81 -0
- package/cli/script-core/summarizer-core.d.ts +2 -0
- package/cli/script-core/summarizer-core.js +51 -0
- package/cli/statistics-app.js +3 -87
- package/cli/statistics-helper-app.js +3 -77
- package/cli/summarizer-app.js +2 -48
- package/config.d.ts +20 -4
- package/config.js +62 -36
- package/core/pipeline-executor.js +11 -1
- package/core/print/dataflow-printer.js +4 -5
- package/core/print/normalize-printer.js +4 -5
- package/core/print/parse-printer.js +1 -2
- package/core/print/print.js +2 -3
- package/core/print/slice-diff-ansi.js +1 -2
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +18 -18
- package/core/steps/pipeline/pipeline.js +1 -2
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in-config.d.ts +47 -0
- package/dataflow/environments/built-in-config.js +83 -0
- package/dataflow/environments/built-in.d.ts +49 -6
- package/dataflow/environments/built-in.js +29 -97
- package/dataflow/environments/clone.js +2 -2
- package/dataflow/environments/default-builtin-config.d.ts +5 -0
- package/dataflow/environments/default-builtin-config.js +83 -0
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +5 -6
- package/dataflow/environments/environment.js +8 -7
- package/dataflow/environments/identifier.d.ts +39 -8
- package/dataflow/environments/identifier.js +33 -0
- package/dataflow/environments/overwrite.d.ts +6 -5
- package/dataflow/environments/overwrite.js +16 -9
- package/dataflow/environments/resolve-by-name.d.ts +3 -1
- package/dataflow/environments/resolve-by-name.js +40 -8
- package/dataflow/environments/scoping.js +2 -3
- package/dataflow/extractor.js +25 -24
- package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
- package/dataflow/graph/dataflowgraph-builder.js +247 -0
- package/dataflow/graph/diff.js +12 -11
- package/dataflow/graph/edge.d.ts +2 -2
- package/dataflow/graph/edge.js +46 -20
- package/dataflow/graph/graph.d.ts +14 -6
- package/dataflow/graph/graph.js +25 -21
- package/dataflow/graph/quads.js +1 -2
- package/dataflow/graph/resolve-graph.d.ts +7 -0
- package/dataflow/graph/resolve-graph.js +51 -0
- package/dataflow/graph/vertex.d.ts +12 -4
- package/dataflow/graph/vertex.js +19 -11
- package/dataflow/info.d.ts +3 -7
- package/dataflow/info.js +7 -8
- package/dataflow/internal/linker.d.ts +3 -1
- package/dataflow/internal/linker.js +77 -32
- package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
- package/dataflow/internal/process/functions/call/common.js +30 -19
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
- package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
- package/dataflow/internal/process/functions/process-argument.js +10 -8
- package/dataflow/internal/process/functions/process-parameter.js +8 -6
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/internal/process/process-symbol.js +5 -4
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
- package/dataflow/internal/process/process-value.js +5 -4
- package/dataflow/processor.js +1 -2
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
- package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
- package/documentation/data/query/example-query-code.d.ts +1 -0
- package/documentation/data/query/example-query-code.js +25 -0
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
- package/documentation/data/server/doc-data-server-messages.js +508 -0
- package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
- package/documentation/doc-util/doc-auto-gen.js +9 -0
- package/documentation/doc-util/doc-cfg.d.ts +7 -0
- package/documentation/doc-util/doc-cfg.js +18 -0
- package/documentation/doc-util/doc-cli-option.d.ts +8 -0
- package/documentation/doc-util/doc-cli-option.js +36 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +7 -0
- package/documentation/doc-util/doc-dfg.d.ts +21 -0
- package/documentation/doc-util/doc-dfg.js +93 -0
- package/documentation/doc-util/doc-docker.d.ts +1 -0
- package/documentation/doc-util/doc-docker.js +5 -0
- package/documentation/doc-util/doc-env.d.ts +2 -0
- package/documentation/doc-util/doc-env.js +20 -0
- package/documentation/doc-util/doc-files.d.ts +6 -0
- package/documentation/doc-util/doc-files.js +25 -0
- package/documentation/doc-util/doc-general.d.ts +2 -0
- package/documentation/doc-util/doc-general.js +16 -0
- package/documentation/doc-util/doc-hover-over.d.ts +1 -0
- package/documentation/doc-util/doc-hover-over.js +7 -0
- package/documentation/doc-util/doc-issue.d.ts +1 -0
- package/documentation/doc-util/doc-issue.js +6 -0
- package/documentation/doc-util/doc-ms.d.ts +1 -0
- package/documentation/doc-util/doc-ms.js +8 -0
- package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
- package/documentation/doc-util/doc-normalized-ast.js +71 -0
- package/documentation/doc-util/doc-query.d.ts +24 -0
- package/documentation/doc-util/doc-query.js +113 -0
- package/documentation/doc-util/doc-repl.d.ts +13 -0
- package/documentation/doc-util/doc-repl.js +79 -0
- package/documentation/doc-util/doc-server-message.d.ts +37 -0
- package/documentation/doc-util/doc-server-message.js +153 -0
- package/documentation/doc-util/doc-structure.d.ts +12 -0
- package/documentation/doc-util/doc-structure.js +21 -0
- package/documentation/doc-util/doc-types.d.ts +38 -0
- package/documentation/doc-util/doc-types.js +276 -0
- package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
- package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
- package/documentation/print-dataflow-graph-wiki.js +849 -0
- package/documentation/print-interface-wiki.d.ts +1 -0
- package/documentation/print-interface-wiki.js +401 -0
- package/documentation/print-normalized-ast-wiki.d.ts +1 -0
- package/documentation/print-normalized-ast-wiki.js +98 -0
- package/documentation/print-query-wiki.d.ts +1 -0
- package/documentation/print-query-wiki.js +215 -0
- package/package.json +29 -33
- package/queries/base-query-format.d.ts +11 -0
- package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
- package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
- package/queries/call-context-query/call-context-query-executor.js +255 -0
- package/queries/call-context-query/call-context-query-format.d.ts +72 -0
- package/queries/call-context-query/call-context-query-format.js +17 -0
- package/queries/query-schema.d.ts +7 -0
- package/queries/query-schema.js +31 -0
- package/queries/query.d.ts +35 -0
- package/queries/query.js +57 -0
- package/queries/two-layer-collector.d.ts +8 -0
- package/queries/two-layer-collector.js +31 -0
- package/queries/virtual-query/compound-query.d.ts +24 -0
- package/queries/virtual-query/compound-query.js +18 -0
- package/queries/virtual-query/virtual-queries.d.ts +15 -0
- package/queries/virtual-query/virtual-queries.js +8 -0
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/data/get.js +2 -3
- package/r-bridge/init.js +2 -2
- package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/type.js +221 -12
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
- package/r-bridge/lang-4.x/convert-values.js +7 -7
- package/r-bridge/retriever.js +12 -11
- package/r-bridge/shell.d.ts +0 -1
- package/r-bridge/shell.js +6 -1
- package/reconstruct/auto-select/auto-select-defaults.js +1 -2
- package/reconstruct/auto-select/magic-comments.js +3 -3
- package/reconstruct/reconstruct.js +4 -3
- package/slicing/criterion/collect-all.js +1 -2
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +6 -5
- package/slicing/static/fingerprint.js +2 -3
- package/slicing/static/slice-call.js +9 -9
- package/slicing/static/static-slicer.js +5 -4
- package/statistics/features/common-syntax-probability.js +13 -13
- package/statistics/features/feature.d.ts +5 -9
- package/statistics/features/feature.js +2 -2
- package/statistics/features/post-processing.js +2 -3
- package/statistics/features/supported/assignments/assignments.js +3 -2
- package/statistics/features/supported/assignments/post-process.js +1 -2
- package/statistics/features/supported/comments/post-process.js +1 -2
- package/statistics/features/supported/control-flow/control-flow.js +4 -3
- package/statistics/features/supported/control-flow/post-process.js +1 -2
- package/statistics/features/supported/data-access/data-access.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.js +3 -2
- package/statistics/features/supported/data-access/post-process.js +1 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
- package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -3
- package/statistics/features/supported/expression-list/post-process.js +1 -2
- package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
- package/statistics/features/supported/loops/loops.js +8 -7
- package/statistics/features/supported/loops/post-process.js +1 -2
- package/statistics/features/supported/used-functions/post-process.js +2 -3
- package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +4 -3
- package/statistics/features/supported/used-packages/post-process.js +1 -2
- package/statistics/features/supported/values/post-process.js +1 -2
- package/statistics/features/supported/variables/post-process.js +2 -3
- package/statistics/features/supported/variables/variables.js +2 -1
- package/statistics/meta-statistics.js +1 -2
- package/statistics/output/print-stats.js +4 -5
- package/statistics/output/statistics-file.js +5 -5
- package/statistics/statistics.js +2 -3
- package/statistics/summarizer/auto-detect.js +1 -2
- package/statistics/summarizer/post-process/clusterer.js +1 -2
- package/statistics/summarizer/post-process/file-based-count.js +2 -3
- package/statistics/summarizer/post-process/histogram.js +3 -4
- package/statistics/summarizer/post-process/post-process-output.js +2 -3
- package/statistics/summarizer/second-phase/process.d.ts +2 -0
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +8 -1
- package/util/ansi.d.ts +1 -0
- package/util/ansi.js +27 -4
- package/util/args.js +2 -3
- package/util/arrays.js +8 -9
- package/util/assert.js +5 -6
- package/util/bimap.d.ts +4 -4
- package/util/cfg/cfg.d.ts +1 -0
- package/util/cfg/cfg.js +8 -5
- package/util/cfg/visitor.d.ts +8 -13
- package/util/cfg/visitor.js +22 -56
- package/util/diff.js +1 -2
- package/util/files.d.ts +0 -1
- package/util/files.js +11 -8
- package/util/json.js +2 -3
- package/util/mermaid/ast.js +7 -7
- package/util/mermaid/cfg.js +2 -3
- package/util/mermaid/dfg.d.ts +12 -4
- package/util/mermaid/dfg.js +28 -16
- package/util/mermaid/mermaid.js +5 -4
- package/util/numbers.js +1 -2
- package/util/objects.d.ts +7 -0
- package/util/objects.js +13 -3
- package/util/os.js +1 -2
- package/util/quads.js +5 -5
- package/util/random.js +2 -2
- package/util/range.js +8 -9
- package/util/schema.d.ts +11 -0
- package/util/schema.js +75 -0
- package/util/set.js +2 -3
- package/util/strings.js +3 -4
- package/util/summarizer.js +4 -4
- package/util/text.d.ts +1 -0
- package/util/text.js +20 -0
- package/util/time.js +1 -2
- package/util/version.js +2 -3
- package/cli/repl/commands/lineage.d.ts +0 -15
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/lineage.js +0 -17
- package/cli/repl/server/messages/repl.js +0 -37
- /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
- /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
- /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultBuiltinConfig = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Contains the built-in definitions recognized by flowR
|
|
6
|
+
*/
|
|
7
|
+
exports.DefaultBuiltinConfig = [
|
|
8
|
+
{ type: 'constant', names: ['NULL', 'NA'], value: null, assumePrimitive: true },
|
|
9
|
+
{ type: 'constant', names: ['TRUE', 'T'], value: true, assumePrimitive: true },
|
|
10
|
+
{ type: 'constant', names: ['FALSE', 'F'], value: false, assumePrimitive: true },
|
|
11
|
+
{
|
|
12
|
+
type: 'function',
|
|
13
|
+
names: [
|
|
14
|
+
'~', '+', '-', '*', '/', '^', '!', '?', '**', '==', '!=', '>', '<', '>=', '<=', '%%', '%/%', '%*%', '%in%', ':', 'list', 'c',
|
|
15
|
+
'rep', 'seq', 'seq_len', 'seq_along', 'seq.int', 'gsub', 'which', 'class', 'dimnames', 'min', 'max',
|
|
16
|
+
'intersect', 'subset', 'match', 'sqrt', 'abs', 'round', 'floor', 'ceiling', 'signif', 'trunc', 'log', 'log10', 'log2', 'sum', 'mean',
|
|
17
|
+
'unique', 'paste', 'paste0', 'read.csv', 'stop', 'is.null', 'plot', 'numeric', 'as.character', 'as.integer', 'as.logical', 'as.numeric', 'as.matrix',
|
|
18
|
+
'rbind', 'nrow', 'ncol', 'tryCatch', 'expression', 'factor',
|
|
19
|
+
'missing', 'as.data.frame', 'data.frame', 'na.omit', 'rownames', 'names', 'order', 'length', 'any', 'dim', 'matrix', 'cbind', 'nchar', 't'
|
|
20
|
+
],
|
|
21
|
+
processor: 'builtin:default',
|
|
22
|
+
config: { readAllArguments: true },
|
|
23
|
+
assumePrimitive: false
|
|
24
|
+
},
|
|
25
|
+
{ type: 'function', names: ['options'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: 'all' }, assumePrimitive: false },
|
|
26
|
+
{ type: 'function', names: ['mapply', 'Mapply'], processor: 'builtin:apply', config: { indexOfFunction: 0, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
27
|
+
{ type: 'function', names: ['lapply', 'sapply', 'vapply'], processor: 'builtin:apply', config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
28
|
+
{ type: 'function', names: ['Lapply', 'Sapply', 'Vapply'], processor: 'builtin:apply', config: { indexOfFunction: 1, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false }, /* functool wrappers */
|
|
29
|
+
{ type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: 'builtin:apply', config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
30
|
+
{ type: 'function', names: ['print'], processor: 'builtin:default', config: { returnsNthArgument: 0, forceArgs: 'all' }, assumePrimitive: false },
|
|
31
|
+
{ type: 'function', names: ['('], processor: 'builtin:default', config: { returnsNthArgument: 0 }, assumePrimitive: true },
|
|
32
|
+
{ type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
|
|
33
|
+
{ type: 'function', names: ['eval', 'body', 'formals', 'environment'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
|
|
34
|
+
{ type: 'function', names: ['cat'], processor: 'builtin:default', config: { forceArgs: 'all' }, assumePrimitive: false },
|
|
35
|
+
{ type: 'function', names: ['switch'], processor: 'builtin:default', config: { forceArgs: [true] }, assumePrimitive: false },
|
|
36
|
+
{ type: 'function', names: ['return'], processor: 'builtin:default', config: { returnsNthArgument: 0, cfg: 1 /* ExitPointType.Return */ }, assumePrimitive: false },
|
|
37
|
+
{ type: 'function', names: ['break'], processor: 'builtin:default', config: { cfg: 2 /* ExitPointType.Break */ }, assumePrimitive: false },
|
|
38
|
+
{ type: 'function', names: ['next'], processor: 'builtin:default', config: { cfg: 3 /* ExitPointType.Next */ }, assumePrimitive: false },
|
|
39
|
+
{ type: 'function', names: ['{'], processor: 'builtin:expression-list', config: {}, assumePrimitive: true },
|
|
40
|
+
{ type: 'function', names: ['source'], processor: 'builtin:source', config: { includeFunctionCall: true, forceFollow: false }, assumePrimitive: false },
|
|
41
|
+
{ type: 'function', names: ['[', '[['], processor: 'builtin:access', config: { treatIndicesAsString: false }, assumePrimitive: true },
|
|
42
|
+
{ type: 'function', names: ['$', '@'], processor: 'builtin:access', config: { treatIndicesAsString: true }, assumePrimitive: true },
|
|
43
|
+
{ type: 'function', names: ['if', 'ifelse'], processor: 'builtin:if-then-else', config: {}, assumePrimitive: true },
|
|
44
|
+
{ type: 'function', names: ['get'], processor: 'builtin:get', config: {}, assumePrimitive: false },
|
|
45
|
+
{ type: 'function', names: ['library', 'require'], processor: 'builtin:library', config: {}, assumePrimitive: false },
|
|
46
|
+
{ type: 'function', names: ['<-', '='], processor: 'builtin:assignment', config: { canBeReplacement: true }, assumePrimitive: true },
|
|
47
|
+
{ type: 'function', names: [':=', 'assign'], processor: 'builtin:assignment', config: {}, assumePrimitive: true },
|
|
48
|
+
{ type: 'function', names: ['delayedAssign'], processor: 'builtin:assignment', config: { quoteSource: true }, assumePrimitive: true },
|
|
49
|
+
{ type: 'function', names: ['<<-'], processor: 'builtin:assignment', config: { superAssignment: true, canBeReplacement: true }, assumePrimitive: true },
|
|
50
|
+
{ type: 'function', names: ['->'], processor: 'builtin:assignment', config: { swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
51
|
+
{ type: 'function', names: ['->>'], processor: 'builtin:assignment', config: { superAssignment: true, swapSourceAndTarget: true, canBeReplacement: true }, assumePrimitive: true },
|
|
52
|
+
{ type: 'function', names: ['&&', '&'], processor: 'builtin:special-bin-op', config: { lazy: true, evalRhsWhen: true }, assumePrimitive: true },
|
|
53
|
+
{ type: 'function', names: ['||', '|'], processor: 'builtin:special-bin-op', config: { lazy: true, evalRhsWhen: false }, assumePrimitive: true },
|
|
54
|
+
{ type: 'function', names: ['|>', '%>%'], processor: 'builtin:pipe', config: {}, assumePrimitive: true },
|
|
55
|
+
{ type: 'function', names: ['function', '\\'], processor: 'builtin:function-definition', config: {}, assumePrimitive: true },
|
|
56
|
+
{ type: 'function', names: ['quote', 'substitute', 'bquote'], processor: 'builtin:quote', config: { quoteArgumentsWithIndex: 0 }, assumePrimitive: true },
|
|
57
|
+
{ type: 'function', names: ['for'], processor: 'builtin:for-loop', config: {}, assumePrimitive: true },
|
|
58
|
+
{ type: 'function', names: ['repeat'], processor: 'builtin:repeat-loop', config: {}, assumePrimitive: true },
|
|
59
|
+
{ type: 'function', names: ['while'], processor: 'builtin:while-loop', config: {}, assumePrimitive: true },
|
|
60
|
+
{ type: 'function', names: ['do.call'], processor: 'builtin:apply', config: { indexOfFunction: 0, unquoteFunction: true }, assumePrimitive: true },
|
|
61
|
+
{
|
|
62
|
+
type: 'function',
|
|
63
|
+
names: [
|
|
64
|
+
'on.exit', 'sys.on.exit', 'par', 'setnames', 'setNames', 'setkey', 'setkeyv', 'setindex', 'setindexv', 'setattr', 'sink',
|
|
65
|
+
/* library and require is handled above */
|
|
66
|
+
'requireNamespace', 'loadNamespace', 'attachNamespace', 'asNamespace',
|
|
67
|
+
/* downloader and installer functions (R, devtools, BiocManager) */
|
|
68
|
+
'library.dynam', 'install.packages', 'install', 'install_github', 'install_gitlab', 'install_bitbucket', 'install_url', 'install_git', 'install_svn', 'install_local', 'install_version', 'update_packages',
|
|
69
|
+
/* weird env attachments */
|
|
70
|
+
'attach', 'detach', 'unname', 'rm', 'remove'
|
|
71
|
+
],
|
|
72
|
+
processor: 'builtin:default',
|
|
73
|
+
config: { hasUnknownSideEffects: true },
|
|
74
|
+
assumePrimitive: false
|
|
75
|
+
},
|
|
76
|
+
/* they are all mapped to `<-` but we separate super assignments */
|
|
77
|
+
{
|
|
78
|
+
type: 'replacement',
|
|
79
|
+
suffixes: ['<-', '<<-'],
|
|
80
|
+
names: ['[', '[[', '$', '@', 'names', 'dimnames', 'attributes', 'attr', 'class', 'levels', 'rownames', 'colnames', 'body', 'environment', 'formals']
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
//# sourceMappingURL=default-builtin-config.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.define =
|
|
3
|
+
exports.define = define;
|
|
4
4
|
const assert_1 = require("../../util/assert");
|
|
5
5
|
const environment_1 = require("./environment");
|
|
6
6
|
const clone_1 = require("./clone");
|
|
@@ -47,5 +47,4 @@ function define(definition, superAssign, environment) {
|
|
|
47
47
|
}
|
|
48
48
|
return newEnvironment;
|
|
49
49
|
}
|
|
50
|
-
exports.define = define;
|
|
51
50
|
//# sourceMappingURL=define.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.diffIdentifierReferences = diffIdentifierReferences;
|
|
4
|
+
exports.diffEnvironment = diffEnvironment;
|
|
5
|
+
exports.diffEnvironmentInformation = diffEnvironmentInformation;
|
|
4
6
|
const diff_1 = require("../../util/diff");
|
|
5
7
|
const environment_1 = require("./environment");
|
|
6
8
|
const json_1 = require("../../util/json");
|
|
@@ -21,7 +23,6 @@ function diffIdentifierReferences(a, b, info) {
|
|
|
21
23
|
}
|
|
22
24
|
(0, info_1.diffControlDependencies)(a.controlDependencies, b.controlDependencies, info);
|
|
23
25
|
}
|
|
24
|
-
exports.diffIdentifierReferences = diffIdentifierReferences;
|
|
25
26
|
function diffMemory(a, b, info) {
|
|
26
27
|
for (const [key, value] of a.memory) {
|
|
27
28
|
const value2 = b.memory.get(key);
|
|
@@ -45,8 +46,8 @@ function diffMemory(a, b, info) {
|
|
|
45
46
|
if (aVal.definedAt !== bVal.definedAt) {
|
|
46
47
|
info.report.addComment(`${info.position}Different definition ids (definedAt) for ${key} (${aVal.nodeId}). ${info.leftname}: ${aVal.definedAt} vs. ${info.rightname}: ${bVal.definedAt}`);
|
|
47
48
|
}
|
|
48
|
-
if (aVal.
|
|
49
|
-
info.report.addComment(`${info.position}Different
|
|
49
|
+
if (aVal.type !== bVal.type) {
|
|
50
|
+
info.report.addComment(`${info.position}Different types for ${key} (${aVal.nodeId}). ${info.leftname}: ${aVal.type} vs. ${info.rightname}: ${bVal.type}`);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -72,7 +73,6 @@ function diffEnvironment(a, b, info, depth) {
|
|
|
72
73
|
diffMemory(a, b, { ...info, position: `${info.position}[at level: ${depth}] ` });
|
|
73
74
|
diffEnvironment(a.parent, b.parent, { ...info, position: `${info.position}Parents of ${a.id} & ${b.id}. ` }, depth--);
|
|
74
75
|
}
|
|
75
|
-
exports.diffEnvironment = diffEnvironment;
|
|
76
76
|
function diffEnvironmentInformation(a, b, info) {
|
|
77
77
|
if (a === undefined || b === undefined) {
|
|
78
78
|
if (a !== b) {
|
|
@@ -85,5 +85,4 @@ function diffEnvironmentInformation(a, b, info) {
|
|
|
85
85
|
}
|
|
86
86
|
diffEnvironment(a.current, b.current, info, Math.max(a.level, b.level));
|
|
87
87
|
}
|
|
88
|
-
exports.diffEnvironmentInformation = diffEnvironmentInformation;
|
|
89
88
|
//# sourceMappingURL=diff.js.map
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BuiltInEnvironment = exports.Environment = void 0;
|
|
4
|
+
exports.makeReferenceMaybe = makeReferenceMaybe;
|
|
5
|
+
exports.makeAllMaybe = makeAllMaybe;
|
|
6
|
+
exports.initializeCleanEnvironments = initializeCleanEnvironments;
|
|
7
|
+
exports.builtInEnvJsonReplacer = builtInEnvJsonReplacer;
|
|
8
|
+
const identifier_1 = require("./identifier");
|
|
4
9
|
const built_in_1 = require("./built-in");
|
|
5
10
|
const resolve_by_name_1 = require("./resolve-by-name");
|
|
6
11
|
const json_1 = require("../../util/json");
|
|
7
12
|
function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = undefined) {
|
|
8
13
|
const node = graph.get(ref.nodeId, true);
|
|
9
14
|
if (includeDefs) {
|
|
10
|
-
const definitions = ref.name ? (0, resolve_by_name_1.resolveByName)(ref.name, environments) : undefined;
|
|
15
|
+
const definitions = ref.name ? (0, resolve_by_name_1.resolveByName)(ref.name, environments, ref.type) : undefined;
|
|
11
16
|
for (const definition of definitions ?? []) {
|
|
12
|
-
if (definition.
|
|
17
|
+
if (definition.type !== identifier_1.ReferenceType.BuiltInFunction && definition.type !== identifier_1.ReferenceType.BuiltInConstant) {
|
|
13
18
|
if (definition.controlDependencies && defaultCd && !definition.controlDependencies.find(c => c.id === defaultCd.id)) {
|
|
14
19
|
definition.controlDependencies.push(defaultCd);
|
|
15
20
|
}
|
|
@@ -30,14 +35,12 @@ function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = u
|
|
|
30
35
|
}
|
|
31
36
|
return { ...ref, controlDependencies: [...ref.controlDependencies ?? [], ...(defaultCd ? [defaultCd] : [])] };
|
|
32
37
|
}
|
|
33
|
-
exports.makeReferenceMaybe = makeReferenceMaybe;
|
|
34
38
|
function makeAllMaybe(references, graph, environments, includeDefs, defaultCd = undefined) {
|
|
35
39
|
if (references === undefined) {
|
|
36
40
|
return [];
|
|
37
41
|
}
|
|
38
42
|
return references.map(ref => makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd));
|
|
39
43
|
}
|
|
40
|
-
exports.makeAllMaybe = makeAllMaybe;
|
|
41
44
|
let environmentIdCounter = 0;
|
|
42
45
|
class Environment {
|
|
43
46
|
id = environmentIdCounter++;
|
|
@@ -65,7 +68,6 @@ function initializeCleanEnvironments(fullBuiltIns = true) {
|
|
|
65
68
|
level: 0
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
|
-
exports.initializeCleanEnvironments = initializeCleanEnvironments;
|
|
69
71
|
function builtInEnvJsonReplacer(k, v) {
|
|
70
72
|
if (v === exports.BuiltInEnvironment) {
|
|
71
73
|
return '<BuiltInEnvironment>';
|
|
@@ -77,5 +79,4 @@ function builtInEnvJsonReplacer(k, v) {
|
|
|
77
79
|
return (0, json_1.jsonReplacer)(k, v);
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
exports.builtInEnvJsonReplacer = builtInEnvJsonReplacer;
|
|
81
82
|
//# sourceMappingURL=environment.js.map
|
|
@@ -4,15 +4,35 @@ import type { ControlDependency } from '../info';
|
|
|
4
4
|
export type Identifier = string & {
|
|
5
5
|
__brand?: 'identifier';
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Each reference only has exactly one reference type, stored as the respective number.
|
|
9
|
+
* However, wenn checking we may want to allow for one of several types,
|
|
10
|
+
* allowing the combination of the respective bitmasks.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ReferenceType {
|
|
13
|
+
/** The identifier type is unknown */
|
|
14
|
+
Unknown = 1,
|
|
15
|
+
/** The identifier is defined by a function (includes built-in function) */
|
|
16
|
+
Function = 2,
|
|
17
|
+
/** The identifier is defined by a variable (includes parameter and argument) */
|
|
18
|
+
Variable = 4,
|
|
19
|
+
/** The identifier is defined by a constant (includes built-in constant) */
|
|
20
|
+
Constant = 8,
|
|
21
|
+
/** The identifier is defined by a parameter (which we know nothing about at the moment) */
|
|
22
|
+
Parameter = 16,
|
|
23
|
+
/** The identifier is defined by an argument (which we know nothing about at the moment) */
|
|
24
|
+
Argument = 32,
|
|
25
|
+
/** The identifier is defined by a built-in value/constant */
|
|
26
|
+
BuiltInConstant = 64,
|
|
27
|
+
/** The identifier is defined by a built-in function */
|
|
28
|
+
BuiltInFunction = 128
|
|
11
29
|
}
|
|
30
|
+
export declare const ReferenceTypeReverseMapping: Map<ReferenceType, string>;
|
|
12
31
|
/**
|
|
13
|
-
*
|
|
32
|
+
* Check if the reference types have an overlapping type!
|
|
14
33
|
*/
|
|
15
|
-
export
|
|
34
|
+
export declare function isReferenceType(t: ReferenceType, target: ReferenceType): boolean;
|
|
35
|
+
export type InGraphReferenceType = Exclude<ReferenceType, ReferenceType.BuiltInConstant | ReferenceType.BuiltInFunction>;
|
|
16
36
|
/**
|
|
17
37
|
* Something like `a` in `b <- a`.
|
|
18
38
|
* Without any surrounding information, `a` will produce the identifier reference `a`.
|
|
@@ -23,10 +43,21 @@ export interface IdentifierReference {
|
|
|
23
43
|
readonly nodeId: NodeId;
|
|
24
44
|
/** Name the reference is identified by (e.g., the name of the variable), undefined if the reference is "artificial" (e.g., anonymous) */
|
|
25
45
|
readonly name: Identifier | undefined;
|
|
46
|
+
/** Type of the reference to be resolved */
|
|
47
|
+
readonly type: ReferenceType;
|
|
26
48
|
/**
|
|
27
|
-
* If the reference is only effective if,
|
|
28
|
-
* As a
|
|
49
|
+
* If the reference is only effective, if, for example, an if-then-else condition is true, this references the root of the `if`.
|
|
50
|
+
* As a hacky intermediate solution (until we have pointer-analysis), an empty array may indicate a `maybe` which is due to pointer access (e.g., in `a[x] <- 3`).
|
|
29
51
|
*/
|
|
30
52
|
controlDependencies: ControlDependency[] | undefined;
|
|
31
53
|
}
|
|
54
|
+
interface InGraphIdentifierDefinition extends IdentifierReference {
|
|
55
|
+
readonly type: InGraphReferenceType;
|
|
56
|
+
/** The assignment (or whatever, like `assign` function call) node which ultimately defined this identifier */
|
|
57
|
+
readonly definedAt: NodeId;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Stores the definition of an identifier within an {@link IEnvironment}
|
|
61
|
+
*/
|
|
62
|
+
export type IdentifierDefinition = InGraphIdentifierDefinition | BuiltInIdentifierDefinition | BuiltInIdentifierConstant;
|
|
32
63
|
export {};
|
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferenceTypeReverseMapping = exports.ReferenceType = void 0;
|
|
4
|
+
exports.isReferenceType = isReferenceType;
|
|
5
|
+
/**
|
|
6
|
+
* Each reference only has exactly one reference type, stored as the respective number.
|
|
7
|
+
* However, wenn checking we may want to allow for one of several types,
|
|
8
|
+
* allowing the combination of the respective bitmasks.
|
|
9
|
+
*/
|
|
10
|
+
var ReferenceType;
|
|
11
|
+
(function (ReferenceType) {
|
|
12
|
+
/** The identifier type is unknown */
|
|
13
|
+
ReferenceType[ReferenceType["Unknown"] = 1] = "Unknown";
|
|
14
|
+
/** The identifier is defined by a function (includes built-in function) */
|
|
15
|
+
ReferenceType[ReferenceType["Function"] = 2] = "Function";
|
|
16
|
+
/** The identifier is defined by a variable (includes parameter and argument) */
|
|
17
|
+
ReferenceType[ReferenceType["Variable"] = 4] = "Variable";
|
|
18
|
+
/** The identifier is defined by a constant (includes built-in constant) */
|
|
19
|
+
ReferenceType[ReferenceType["Constant"] = 8] = "Constant";
|
|
20
|
+
/** The identifier is defined by a parameter (which we know nothing about at the moment) */
|
|
21
|
+
ReferenceType[ReferenceType["Parameter"] = 16] = "Parameter";
|
|
22
|
+
/** The identifier is defined by an argument (which we know nothing about at the moment) */
|
|
23
|
+
ReferenceType[ReferenceType["Argument"] = 32] = "Argument";
|
|
24
|
+
/** The identifier is defined by a built-in value/constant */
|
|
25
|
+
ReferenceType[ReferenceType["BuiltInConstant"] = 64] = "BuiltInConstant";
|
|
26
|
+
/** The identifier is defined by a built-in function */
|
|
27
|
+
ReferenceType[ReferenceType["BuiltInFunction"] = 128] = "BuiltInFunction";
|
|
28
|
+
})(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
|
|
29
|
+
exports.ReferenceTypeReverseMapping = new Map(Object.entries(ReferenceType).map(([k, v]) => [v, k]));
|
|
30
|
+
/**
|
|
31
|
+
* Check if the reference types have an overlapping type!
|
|
32
|
+
*/
|
|
33
|
+
function isReferenceType(t, target) {
|
|
34
|
+
return (t & target) !== 0;
|
|
35
|
+
}
|
|
3
36
|
//# sourceMappingURL=identifier.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { REnvironmentInformation, IEnvironment } from './environment';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function overwriteEnvironment(base: REnvironmentInformation | undefined,
|
|
5
|
-
export declare function overwriteEnvironment(base: undefined, next:
|
|
6
|
-
export declare function overwriteEnvironment(base:
|
|
2
|
+
import type { ControlDependency } from '../info';
|
|
3
|
+
export declare function overwriteIEnvironmentWith(base: IEnvironment | undefined, next: IEnvironment | undefined, includeParent?: boolean, applyCds?: readonly ControlDependency[]): IEnvironment;
|
|
4
|
+
export declare function overwriteEnvironment(base: REnvironmentInformation, next: REnvironmentInformation | undefined, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
|
|
5
|
+
export declare function overwriteEnvironment(base: REnvironmentInformation | undefined, next: REnvironmentInformation, applyCds?: readonly ControlDependency[]): REnvironmentInformation;
|
|
6
|
+
export declare function overwriteEnvironment(base: undefined, next: undefined, applyCds?: readonly ControlDependency[]): undefined;
|
|
7
|
+
export declare function overwriteEnvironment(base: REnvironmentInformation | undefined, next: REnvironmentInformation | undefined, applyCds?: readonly ControlDependency[]): REnvironmentInformation | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.overwriteIEnvironmentWith = overwriteIEnvironmentWith;
|
|
4
|
+
exports.overwriteEnvironment = overwriteEnvironment;
|
|
4
5
|
const assert_1 = require("../../util/assert");
|
|
5
6
|
const environment_1 = require("./environment");
|
|
6
7
|
function anyIsMaybeOrEmpty(values) {
|
|
@@ -14,11 +15,11 @@ function anyIsMaybeOrEmpty(values) {
|
|
|
14
15
|
}
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
17
|
-
function overwriteIEnvironmentWith(base, next, includeParent = true) {
|
|
18
|
+
function overwriteIEnvironmentWith(base, next, includeParent = true, applyCds) {
|
|
18
19
|
(0, assert_1.guard)(base !== undefined && next !== undefined, 'can not overwrite environments with undefined');
|
|
19
20
|
const map = new Map(base.memory);
|
|
20
21
|
for (const [key, values] of next.memory) {
|
|
21
|
-
const hasMaybe = anyIsMaybeOrEmpty(values);
|
|
22
|
+
const hasMaybe = applyCds?.length === 0 || applyCds !== undefined ? true : anyIsMaybeOrEmpty(values);
|
|
22
23
|
if (hasMaybe) {
|
|
23
24
|
const old = map.get(key);
|
|
24
25
|
// we need to make a copy to avoid side effects for old reference in other environments
|
|
@@ -26,7 +27,15 @@ function overwriteIEnvironmentWith(base, next, includeParent = true) {
|
|
|
26
27
|
for (const v of values) {
|
|
27
28
|
const index = updatedOld.findIndex(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt);
|
|
28
29
|
if (index < 0) {
|
|
29
|
-
|
|
30
|
+
if (applyCds !== undefined) {
|
|
31
|
+
updatedOld.push({
|
|
32
|
+
...v,
|
|
33
|
+
controlDependencies: [...applyCds, ...v.controlDependencies ?? []]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
updatedOld.push(v);
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
41
|
map.set(key, [...updatedOld]);
|
|
@@ -37,7 +46,7 @@ function overwriteIEnvironmentWith(base, next, includeParent = true) {
|
|
|
37
46
|
}
|
|
38
47
|
let parent;
|
|
39
48
|
if (includeParent) {
|
|
40
|
-
parent = base.parent.id === environment_1.BuiltInEnvironment.id ? environment_1.BuiltInEnvironment : overwriteIEnvironmentWith(base.parent, next.parent);
|
|
49
|
+
parent = base.parent.id === environment_1.BuiltInEnvironment.id ? environment_1.BuiltInEnvironment : overwriteIEnvironmentWith(base.parent, next.parent, includeParent, applyCds);
|
|
41
50
|
}
|
|
42
51
|
else {
|
|
43
52
|
parent = base.parent;
|
|
@@ -46,12 +55,11 @@ function overwriteIEnvironmentWith(base, next, includeParent = true) {
|
|
|
46
55
|
out.memory = map;
|
|
47
56
|
return out;
|
|
48
57
|
}
|
|
49
|
-
exports.overwriteIEnvironmentWith = overwriteIEnvironmentWith;
|
|
50
58
|
/**
|
|
51
59
|
* Assumes, that all definitions within next replace those within base (given the same name).
|
|
52
60
|
* <b>But</b> if all definitions within next are maybe, then they are appended to the base definitions (updating them to be `maybe` from now on as well), similar to {@link appendEnvironment}.
|
|
53
61
|
*/
|
|
54
|
-
function overwriteEnvironment(base, next) {
|
|
62
|
+
function overwriteEnvironment(base, next, applyCds) {
|
|
55
63
|
if (base === undefined) {
|
|
56
64
|
return next;
|
|
57
65
|
}
|
|
@@ -60,9 +68,8 @@ function overwriteEnvironment(base, next) {
|
|
|
60
68
|
}
|
|
61
69
|
(0, assert_1.guard)(next.level === base.level, `cannot overwrite environments with differently nested local scopes, base ${base.level} vs. next ${next.level}. This should not happen.`);
|
|
62
70
|
return {
|
|
63
|
-
current: overwriteIEnvironmentWith(base.current, next.current),
|
|
71
|
+
current: overwriteIEnvironmentWith(base.current, next.current, true, applyCds),
|
|
64
72
|
level: base.level
|
|
65
73
|
};
|
|
66
74
|
}
|
|
67
|
-
exports.overwriteEnvironment = overwriteEnvironment;
|
|
68
75
|
//# sourceMappingURL=overwrite.js.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { REnvironmentInformation } from './environment';
|
|
2
2
|
import { Ternary } from '../../util/logic';
|
|
3
3
|
import type { Identifier, IdentifierDefinition } from './identifier';
|
|
4
|
+
import { ReferenceType } from './identifier';
|
|
4
5
|
/**
|
|
5
6
|
* Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
|
|
6
7
|
*
|
|
7
8
|
* @param name - The name of the identifier to resolve
|
|
8
9
|
* @param environment - The current environment used for name resolution
|
|
10
|
+
* @param target - The target (meta) type of the identifier to resolve
|
|
9
11
|
*
|
|
10
12
|
* @returns A list of possible definitions of the identifier (one if the definition location is exactly and always known), or `undefined` if the identifier is undefined in the current scope/with the current environment information.
|
|
11
13
|
*/
|
|
12
|
-
export declare function resolveByName(name: Identifier, environment: REnvironmentInformation): IdentifierDefinition[] | undefined;
|
|
14
|
+
export declare function resolveByName(name: Identifier, environment: REnvironmentInformation, target?: ReferenceType): IdentifierDefinition[] | undefined;
|
|
13
15
|
export declare function resolvesToBuiltInConstant(name: Identifier | undefined, environment: REnvironmentInformation, wantedValue: unknown): Ternary;
|
|
@@ -1,39 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolveByName = resolveByName;
|
|
4
|
+
exports.resolvesToBuiltInConstant = resolvesToBuiltInConstant;
|
|
4
5
|
const environment_1 = require("./environment");
|
|
6
|
+
const identifier_1 = require("./identifier");
|
|
7
|
+
const info_1 = require("../info");
|
|
8
|
+
const FunctionTargetTypes = identifier_1.ReferenceType.Function | identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Parameter;
|
|
9
|
+
const VariableTargetTypes = identifier_1.ReferenceType.Variable | identifier_1.ReferenceType.Parameter | identifier_1.ReferenceType.Argument | identifier_1.ReferenceType.Unknown;
|
|
10
|
+
const ConstantTargetTypes = identifier_1.ReferenceType.Constant | identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
|
|
11
|
+
const BuiltInConstantTargetTypes = identifier_1.ReferenceType.BuiltInConstant | identifier_1.ReferenceType.Unknown;
|
|
12
|
+
const BuiltInFunctionTargetTypes = identifier_1.ReferenceType.BuiltInFunction | identifier_1.ReferenceType.Unknown;
|
|
13
|
+
const TargetTypePredicate = {
|
|
14
|
+
[identifier_1.ReferenceType.Unknown]: () => true,
|
|
15
|
+
[identifier_1.ReferenceType.Function]: ({ type }) => (0, identifier_1.isReferenceType)(type, FunctionTargetTypes),
|
|
16
|
+
[identifier_1.ReferenceType.Variable]: ({ type }) => (0, identifier_1.isReferenceType)(type, VariableTargetTypes),
|
|
17
|
+
[identifier_1.ReferenceType.Constant]: ({ type }) => (0, identifier_1.isReferenceType)(type, ConstantTargetTypes),
|
|
18
|
+
[identifier_1.ReferenceType.Parameter]: () => true,
|
|
19
|
+
[identifier_1.ReferenceType.Argument]: () => true,
|
|
20
|
+
[identifier_1.ReferenceType.BuiltInConstant]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInConstantTargetTypes),
|
|
21
|
+
[identifier_1.ReferenceType.BuiltInFunction]: ({ type }) => (0, identifier_1.isReferenceType)(type, BuiltInFunctionTargetTypes)
|
|
22
|
+
};
|
|
5
23
|
/**
|
|
6
24
|
* Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
|
|
7
25
|
*
|
|
8
26
|
* @param name - The name of the identifier to resolve
|
|
9
27
|
* @param environment - The current environment used for name resolution
|
|
28
|
+
* @param target - The target (meta) type of the identifier to resolve
|
|
10
29
|
*
|
|
11
30
|
* @returns A list of possible definitions of the identifier (one if the definition location is exactly and always known), or `undefined` if the identifier is undefined in the current scope/with the current environment information.
|
|
12
31
|
*/
|
|
13
|
-
function resolveByName(name, environment) {
|
|
32
|
+
function resolveByName(name, environment, target = identifier_1.ReferenceType.Unknown) {
|
|
14
33
|
let current = environment.current;
|
|
34
|
+
let definitions = undefined;
|
|
35
|
+
const wantedType = TargetTypePredicate[target];
|
|
15
36
|
do {
|
|
16
37
|
const definition = current.memory.get(name);
|
|
17
38
|
if (definition !== undefined) {
|
|
18
|
-
|
|
39
|
+
const filtered = definition.filter(wantedType);
|
|
40
|
+
if (filtered.length === definition.length && definition.every(d => (0, info_1.happensInEveryBranch)(d.controlDependencies))) {
|
|
41
|
+
return definition;
|
|
42
|
+
}
|
|
43
|
+
else if (filtered.length > 0) {
|
|
44
|
+
definitions ??= [];
|
|
45
|
+
definitions.push(...filtered);
|
|
46
|
+
}
|
|
19
47
|
}
|
|
20
48
|
current = current.parent;
|
|
21
49
|
} while (current.id !== environment_1.BuiltInEnvironment.id);
|
|
22
|
-
|
|
50
|
+
const builtIns = current.memory.get(name);
|
|
51
|
+
if (definitions) {
|
|
52
|
+
return builtIns === undefined ? definitions : [...definitions, ...builtIns];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return builtIns;
|
|
56
|
+
}
|
|
23
57
|
}
|
|
24
|
-
exports.resolveByName = resolveByName;
|
|
25
58
|
function resolvesToBuiltInConstant(name, environment, wantedValue) {
|
|
26
59
|
if (name === undefined) {
|
|
27
60
|
return 2 /* Ternary.Never */;
|
|
28
61
|
}
|
|
29
|
-
const definition = resolveByName(name, environment);
|
|
62
|
+
const definition = resolveByName(name, environment, identifier_1.ReferenceType.Constant);
|
|
30
63
|
if (definition === undefined) {
|
|
31
64
|
return 2 /* Ternary.Never */;
|
|
32
65
|
}
|
|
33
66
|
let all = true;
|
|
34
67
|
let some = false;
|
|
35
68
|
for (const def of definition) {
|
|
36
|
-
if (def.
|
|
69
|
+
if (def.type === identifier_1.ReferenceType.BuiltInConstant && def.value === wantedValue) {
|
|
37
70
|
some = true;
|
|
38
71
|
}
|
|
39
72
|
else {
|
|
@@ -47,5 +80,4 @@ function resolvesToBuiltInConstant(name, environment, wantedValue) {
|
|
|
47
80
|
return some ? 1 /* Ternary.Maybe */ : 2 /* Ternary.Never */;
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
|
-
exports.resolvesToBuiltInConstant = resolvesToBuiltInConstant;
|
|
51
83
|
//# sourceMappingURL=resolve-by-name.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.pushLocalEnvironment = pushLocalEnvironment;
|
|
4
|
+
exports.popLocalEnvironment = popLocalEnvironment;
|
|
4
5
|
const environment_1 = require("./environment");
|
|
5
6
|
const assert_1 = require("../../util/assert");
|
|
6
7
|
/** Add a new local environment scope to the stack, returns the modified variant - sharing the original environments in the stack (no deep-clone) */
|
|
@@ -10,7 +11,6 @@ function pushLocalEnvironment(base) {
|
|
|
10
11
|
level: base.level + 1
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
exports.pushLocalEnvironment = pushLocalEnvironment;
|
|
14
14
|
function popLocalEnvironment(base) {
|
|
15
15
|
(0, assert_1.guard)(base.level > 0, 'cannot remove the global/root environment');
|
|
16
16
|
const parent = base.current.parent;
|
|
@@ -20,5 +20,4 @@ function popLocalEnvironment(base) {
|
|
|
20
20
|
level: base.level - 1
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
exports.popLocalEnvironment = popLocalEnvironment;
|
|
24
23
|
//# sourceMappingURL=scoping.js.map
|
package/dataflow/extractor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.processors = void 0;
|
|
4
|
+
exports.produceDataFlowGraph = produceDataFlowGraph;
|
|
4
5
|
const processor_1 = require("./processor");
|
|
5
6
|
const process_uninteresting_leaf_1 = require("./internal/process/process-uninteresting-leaf");
|
|
6
7
|
const process_symbol_1 = require("./internal/process/process-symbol");
|
|
@@ -12,32 +13,33 @@ const process_value_1 = require("./internal/process/process-value");
|
|
|
12
13
|
const named_call_handling_1 = require("./internal/process/functions/call/named-call-handling");
|
|
13
14
|
const make_argument_1 = require("./internal/process/functions/call/argument/make-argument");
|
|
14
15
|
const range_1 = require("../util/range");
|
|
16
|
+
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
15
17
|
const retriever_1 = require("../r-bridge/retriever");
|
|
16
18
|
const environment_1 = require("./environments/environment");
|
|
17
19
|
const built_in_source_1 = require("./internal/process/functions/call/built-in/built-in-source");
|
|
18
20
|
exports.processors = {
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
type:
|
|
21
|
+
[type_1.RType.Number]: process_value_1.processValue,
|
|
22
|
+
[type_1.RType.String]: process_value_1.processValue,
|
|
23
|
+
[type_1.RType.Logical]: process_value_1.processValue,
|
|
24
|
+
[type_1.RType.Comment]: process_uninteresting_leaf_1.processUninterestingLeaf,
|
|
25
|
+
[type_1.RType.LineDirective]: process_uninteresting_leaf_1.processUninterestingLeaf,
|
|
26
|
+
[type_1.RType.Symbol]: process_symbol_1.processSymbol,
|
|
27
|
+
[type_1.RType.Access]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.accessed, ...n.access]),
|
|
28
|
+
[type_1.RType.BinaryOp]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.lhs, n.rhs]),
|
|
29
|
+
[type_1.RType.Pipe]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.lhs, n.rhs]),
|
|
30
|
+
[type_1.RType.UnaryOp]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.operator, [n.operand]),
|
|
31
|
+
[type_1.RType.ForLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.variable, n.vector, n.body]),
|
|
32
|
+
[type_1.RType.WhileLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.condition, n.body]),
|
|
33
|
+
[type_1.RType.RepeatLoop]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.body]),
|
|
34
|
+
[type_1.RType.IfThenElse]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [n.condition, n.then, n.otherwise]),
|
|
35
|
+
[type_1.RType.Break]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, []),
|
|
36
|
+
[type_1.RType.Next]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, []),
|
|
37
|
+
[type_1.RType.FunctionCall]: default_call_handling_1.processFunctionCall,
|
|
38
|
+
[type_1.RType.FunctionDefinition]: (n, d) => (0, process_named_call_1.processAsNamedCall)(n, d, n.lexeme, [...n.parameters, n.body]),
|
|
39
|
+
[type_1.RType.Parameter]: process_parameter_1.processFunctionParameter,
|
|
40
|
+
[type_1.RType.Argument]: process_argument_1.processFunctionArgument,
|
|
41
|
+
[type_1.RType.ExpressionList]: (n, d) => (0, named_call_handling_1.processNamedCall)({
|
|
42
|
+
type: type_1.RType.Symbol,
|
|
41
43
|
info: n.info,
|
|
42
44
|
content: n.grouping?.[0].content ?? '{',
|
|
43
45
|
lexeme: n.grouping?.[0].lexeme ?? '{',
|
|
@@ -70,5 +72,4 @@ function produceDataFlowGraph(request, ast) {
|
|
|
70
72
|
}
|
|
71
73
|
return df;
|
|
72
74
|
}
|
|
73
|
-
exports.produceDataFlowGraph = produceDataFlowGraph;
|
|
74
75
|
//# sourceMappingURL=extractor.js.map
|