@eagleoutice/flowr 1.5.2 → 2.0.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/abstract-interpretation/handler/binop/binop.d.ts +3 -4
- package/abstract-interpretation/handler/binop/binop.js +4 -2
- package/abstract-interpretation/handler/binop/operators.d.ts +2 -2
- package/abstract-interpretation/handler/binop/operators.js +14 -28
- package/abstract-interpretation/processor.d.ts +3 -2
- package/abstract-interpretation/processor.js +2 -2
- package/benchmark/slicer.d.ts +101 -0
- package/benchmark/slicer.js +214 -0
- package/benchmark/stats/print.d.ts +7 -0
- package/benchmark/stats/print.js +151 -0
- package/benchmark/stats/stats.d.ts +42 -0
- package/benchmark/stats/stats.js +6 -0
- package/benchmark/stopwatch.d.ts +35 -0
- package/benchmark/stopwatch.js +79 -0
- package/benchmark/summarizer/data.d.ts +54 -0
- package/benchmark/summarizer/first-phase/input.d.ts +3 -0
- package/benchmark/summarizer/first-phase/input.js +76 -0
- package/benchmark/summarizer/first-phase/process.d.ts +11 -0
- package/benchmark/summarizer/first-phase/process.js +205 -0
- package/benchmark/summarizer/second-phase/graph.d.ts +2 -0
- package/benchmark/summarizer/second-phase/graph.js +54 -0
- package/benchmark/summarizer/second-phase/process.d.ts +6 -0
- package/benchmark/summarizer/second-phase/process.js +127 -0
- package/benchmark/summarizer/summarizer.d.ts +31 -0
- package/benchmark/summarizer/summarizer.js +58 -0
- package/cli/benchmark-app.d.ts +10 -0
- package/cli/benchmark-app.js +67 -0
- package/cli/benchmark-helper-app.d.ts +9 -0
- package/cli/benchmark-helper-app.js +69 -0
- package/cli/common/features.d.ts +3 -0
- package/cli/common/features.js +30 -0
- package/cli/common/options.d.ts +20 -0
- package/cli/common/options.js +85 -0
- package/cli/common/script.d.ts +21 -0
- package/cli/common/script.js +61 -0
- package/cli/common/scripts-info.d.ts +25 -0
- package/cli/common/scripts-info.js +83 -0
- package/cli/export-quads-app.d.ts +7 -0
- package/cli/export-quads-app.js +43 -0
- package/cli/flowr.d.ts +29 -0
- package/cli/flowr.js +141 -0
- package/cli/repl/commands/cfg.d.ts +3 -0
- package/cli/repl/commands/cfg.js +37 -0
- package/cli/repl/commands/commands.d.ts +13 -0
- package/cli/repl/commands/commands.js +142 -0
- package/cli/repl/commands/dataflow.d.ts +3 -0
- package/cli/repl/commands/dataflow.js +34 -0
- package/cli/repl/commands/execute.d.ts +4 -0
- package/cli/repl/commands/execute.js +27 -0
- package/cli/repl/commands/main.d.ts +39 -0
- package/cli/repl/commands/main.js +14 -0
- package/cli/repl/commands/normalize.d.ts +3 -0
- package/cli/repl/commands/normalize.js +34 -0
- package/cli/repl/commands/parse.d.ts +2 -0
- package/cli/repl/commands/parse.js +110 -0
- package/cli/repl/commands/quit.d.ts +2 -0
- package/cli/repl/commands/quit.js +15 -0
- package/cli/repl/commands/version.d.ts +16 -0
- package/cli/repl/commands/version.js +28 -0
- package/cli/repl/core.d.ts +36 -0
- package/cli/repl/core.js +174 -0
- package/cli/repl/execute.d.ts +28 -0
- package/cli/repl/execute.js +79 -0
- package/cli/repl/print-version.d.ts +2 -0
- package/cli/repl/print-version.js +10 -0
- package/cli/repl/prompt.d.ts +2 -0
- package/cli/repl/prompt.js +9 -0
- package/cli/repl/server/connection.d.ts +21 -0
- package/cli/repl/server/connection.js +218 -0
- package/cli/repl/server/messages/analysis.d.ts +72 -0
- package/cli/repl/server/messages/analysis.js +21 -0
- package/cli/repl/server/messages/error.d.ts +11 -0
- package/{core/input.js → cli/repl/server/messages/error.js} +1 -1
- package/cli/repl/server/messages/hello.d.ts +20 -0
- package/{core/output.js → cli/repl/server/messages/hello.js} +1 -1
- package/cli/repl/server/messages/messages.d.ts +35 -0
- package/cli/repl/server/messages/messages.js +40 -0
- package/cli/repl/server/messages/repl.d.ts +33 -0
- package/cli/repl/server/messages/repl.js +37 -0
- package/cli/repl/server/messages/slice.d.ts +26 -0
- package/cli/repl/server/messages/slice.js +37 -0
- package/cli/repl/server/net.d.ts +49 -0
- package/cli/repl/server/net.js +63 -0
- package/cli/repl/server/send.d.ts +4 -0
- package/cli/repl/server/send.js +18 -0
- package/cli/repl/server/server.d.ts +20 -0
- package/cli/repl/server/server.js +66 -0
- package/cli/repl/server/validate.d.ts +15 -0
- package/cli/repl/server/validate.js +34 -0
- package/cli/slicer-app.d.ts +11 -0
- package/cli/slicer-app.js +83 -0
- package/cli/statistics-app.d.ts +11 -0
- package/cli/statistics-app.js +99 -0
- package/cli/statistics-helper-app.d.ts +11 -0
- package/cli/statistics-helper-app.js +87 -0
- package/cli/summarizer-app.d.ts +18 -0
- package/cli/summarizer-app.js +66 -0
- package/core/pipeline-executor.d.ts +154 -0
- package/core/pipeline-executor.js +221 -0
- package/core/print/dataflow-printer.d.ts +3 -4
- package/core/print/dataflow-printer.js +5 -5
- package/core/print/normalize-printer.d.ts +1 -1
- package/core/print/normalize-printer.js +3 -3
- package/core/print/parse-printer.js +3 -3
- package/core/print/print.d.ts +13 -4
- package/core/print/print.js +13 -2
- package/core/print/slice-diff-ansi.d.ts +3 -2
- package/core/print/slice-diff-ansi.js +4 -4
- package/core/steps/all/core/00-parse.d.ts +28 -0
- package/core/steps/all/core/00-parse.js +24 -0
- package/core/steps/all/core/10-normalize.d.ts +29 -0
- package/core/steps/all/core/10-normalize.js +26 -0
- package/core/steps/all/core/20-dataflow.d.ts +27 -0
- package/core/steps/all/core/20-dataflow.js +29 -0
- package/core/steps/all/static-slicing/00-slice.d.ts +28 -0
- package/core/steps/all/static-slicing/00-slice.js +21 -0
- package/core/steps/all/static-slicing/10-reconstruct.d.ts +25 -0
- package/core/steps/all/static-slicing/10-reconstruct.js +21 -0
- package/core/steps/pipeline/create-pipeline.d.ts +6 -0
- package/core/steps/pipeline/create-pipeline.js +130 -0
- package/core/steps/pipeline/default-pipelines.d.ts +251 -0
- package/core/steps/pipeline/default-pipelines.js +18 -0
- package/core/steps/pipeline/invalid-pipeline-error.d.ts +6 -0
- package/core/steps/pipeline/invalid-pipeline-error.js +14 -0
- package/core/steps/pipeline/pipeline.d.ts +60 -0
- package/core/steps/pipeline/pipeline.js +28 -0
- package/core/steps/pipeline-step.d.ts +85 -0
- package/core/steps/pipeline-step.js +8 -0
- package/dataflow/environments/append.d.ts +4 -4
- package/dataflow/environments/append.js +4 -4
- package/dataflow/environments/built-in.d.ts +25 -0
- package/dataflow/environments/built-in.js +123 -0
- package/dataflow/environments/clone.d.ts +2 -0
- package/dataflow/environments/clone.js +23 -0
- package/dataflow/environments/{register.d.ts → define.d.ts} +3 -3
- package/dataflow/environments/define.js +51 -0
- package/dataflow/environments/diff.d.ts +6 -0
- package/dataflow/environments/diff.js +85 -0
- package/dataflow/environments/environment.d.ts +10 -43
- package/dataflow/environments/environment.js +32 -138
- package/dataflow/environments/identifier.d.ts +31 -0
- package/dataflow/environments/identifier.js +3 -0
- package/dataflow/environments/overwrite.d.ts +4 -4
- package/dataflow/environments/overwrite.js +9 -22
- package/dataflow/environments/resolve-by-name.d.ts +7 -6
- package/dataflow/environments/resolve-by-name.js +35 -19
- package/dataflow/environments/scoping.js +1 -4
- package/dataflow/extractor.d.ts +6 -6
- package/dataflow/extractor.js +47 -57
- package/dataflow/graph/diff.d.ts +24 -7
- package/dataflow/graph/diff.js +114 -74
- package/dataflow/graph/edge.d.ts +66 -20
- package/dataflow/graph/edge.js +73 -27
- package/dataflow/graph/graph.d.ts +53 -29
- package/dataflow/graph/graph.js +84 -89
- package/dataflow/graph/quads.js +2 -2
- package/dataflow/graph/vertex.d.ts +37 -34
- package/dataflow/info.d.ts +49 -0
- package/dataflow/info.js +29 -0
- package/dataflow/internal/linker.d.ts +11 -10
- package/dataflow/internal/linker.js +64 -90
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +6 -0
- package/dataflow/internal/process/functions/call/argument/make-argument.js +31 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +3 -0
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +18 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +82 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +29 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +167 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +165 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +97 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +165 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +36 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +100 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +32 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-logical-bin-op.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-logical-bin-op.js +35 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +35 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +9 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +29 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +32 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +45 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +11 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +72 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +61 -0
- package/dataflow/internal/process/functions/call/common.d.ts +35 -0
- package/dataflow/internal/process/functions/call/common.js +70 -0
- package/dataflow/internal/process/functions/call/default-call-handling.d.ts +5 -0
- package/dataflow/internal/process/functions/call/default-call-handling.js +15 -0
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +26 -0
- package/dataflow/internal/process/functions/call/known-call-handling.js +62 -0
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +7 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +53 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +6 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +58 -0
- package/dataflow/internal/process/functions/process-argument.d.ts +9 -0
- package/dataflow/internal/process/functions/{argument.js → process-argument.js} +25 -20
- package/dataflow/internal/process/functions/{parameter.d.ts → process-parameter.d.ts} +3 -2
- package/dataflow/internal/process/functions/{parameter.js → process-parameter.js} +10 -13
- package/dataflow/internal/process/process-named-call.d.ts +6 -0
- package/dataflow/internal/process/process-named-call.js +17 -0
- package/dataflow/internal/process/process-symbol.d.ts +5 -0
- package/dataflow/internal/process/process-symbol.js +26 -0
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +4 -0
- package/dataflow/internal/process/process-uninteresting-leaf.js +9 -0
- package/dataflow/internal/process/process-value.d.ts +4 -0
- package/dataflow/internal/process/process-value.js +22 -0
- package/dataflow/logger.d.ts +1 -0
- package/dataflow/logger.js +6 -0
- package/dataflow/processor.d.ts +18 -13
- package/dataflow/processor.js +1 -1
- package/package.json +48 -85
- package/r-bridge/data/data.d.ts +603 -0
- package/r-bridge/data/data.js +753 -0
- package/r-bridge/data/get.d.ts +19 -0
- package/r-bridge/data/get.js +51 -0
- package/r-bridge/data/print.d.ts +1 -0
- package/r-bridge/data/print.js +58 -0
- package/r-bridge/data/types.d.ts +33 -0
- package/r-bridge/data/types.js +3 -0
- package/r-bridge/init.d.ts +3 -0
- package/r-bridge/init.js +22 -0
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/model/collect.js +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +26 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +4 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +0 -17
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +0 -11
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +6 -18
- package/r-bridge/lang-4.x/ast/model/operators.js +36 -48
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +19 -15
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +59 -54
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +8 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +18 -0
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +28 -17
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +7 -34
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +5 -2
- package/r-bridge/lang-4.x/ast/model/type.js +13 -6
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +4 -1
- package/r-bridge/lang-4.x/ast/parser/json/format.js +9 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +22 -27
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +10 -7
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +19 -11
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/{if-then-else.d.ts → normalize-if-then-else.d.ts} +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/{if-then-else.js → normalize-if-then-else.js} +10 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/{if-then.d.ts → normalize-if-then.d.ts} +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/{if-then.js → normalize-if-then.js} +9 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +64 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{argument.d.ts → normalize-argument.d.ts} +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{argument.js → normalize-argument.js} +13 -17
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{call.d.ts → normalize-call.d.ts} +6 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{call.js → normalize-call.js} +24 -29
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.d.ts +12 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{definition.js → normalize-definition.js} +14 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{parameter.d.ts → normalize-parameter.d.ts} +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/{parameter.js → normalize-parameter.js} +12 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/{break.js → normalize-break.js} +6 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/{for.js → normalize-for.js} +18 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/{next.js → normalize-next.js} +6 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.d.ts +13 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/{repeat.js → normalize-repeat.js} +13 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/{while.js → normalize-while.js} +10 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/{access.d.ts → normalize-access.d.ts} +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/{access.js → normalize-access.js} +44 -45
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/{binary.d.ts → normalize-binary.d.ts} +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/{binary.js → normalize-binary.js} +23 -73
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.d.ts +13 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +47 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.d.ts +11 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/{comment.js → normalize-comment.js} +5 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.d.ts +13 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/{line-directive.js → normalize-line-directive.js} +7 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +15 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +182 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +34 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.d.ts +13 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +59 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.d.ts +16 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/{number.js → normalize-number.js} +12 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.d.ts +11 -0
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/{string.js → normalize-string.js} +7 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/{symbol.d.ts → normalize-symbol.d.ts} +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/{symbol.js → normalize-symbol.js} +12 -15
- package/r-bridge/lang-4.x/ast/parser/xml/{internal/meta.d.ts → normalize-meta.d.ts} +5 -3
- package/r-bridge/lang-4.x/ast/parser/xml/{internal/meta.js → normalize-meta.js} +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/{data.d.ts → normalizer-data.d.ts} +1 -5
- package/r-bridge/lang-4.x/ast/parser/xml/normalizer-data.js +3 -0
- package/r-bridge/lang-4.x/{values.d.ts → convert-values.d.ts} +2 -2
- package/r-bridge/lang-4.x/{values.js → convert-values.js} +5 -5
- package/r-bridge/retriever.d.ts +5 -5
- package/r-bridge/retriever.js +11 -24
- package/r-bridge/shell-executor.d.ts +0 -1
- package/r-bridge/shell-executor.js +7 -12
- package/r-bridge/shell.d.ts +14 -12
- package/r-bridge/shell.js +52 -47
- package/reconstruct/reconstruct.d.ts +4 -2
- package/reconstruct/reconstruct.js +193 -185
- package/slicing/criterion/collect-all.d.ts +4 -3
- package/slicing/criterion/collect-all.js +5 -1
- package/slicing/criterion/filters/all-variables.js +14 -22
- package/slicing/criterion/parse.d.ts +4 -2
- package/slicing/criterion/parse.js +13 -11
- package/slicing/static/fingerprint.d.ts +5 -0
- package/slicing/static/fingerprint.js +17 -0
- package/slicing/static/slice-call.d.ts +10 -0
- package/slicing/static/slice-call.js +86 -0
- package/slicing/static/slicer-types.d.ts +33 -0
- package/slicing/static/slicer-types.js +3 -0
- package/slicing/static/static-slicer.d.ts +6 -24
- package/slicing/static/static-slicer.js +54 -155
- package/slicing/static/visiting-queue.d.ts +23 -0
- package/slicing/static/visiting-queue.js +53 -0
- package/statistics/features/common-syntax-probability.d.ts +29 -0
- package/statistics/features/common-syntax-probability.js +159 -0
- package/statistics/features/feature.d.ts +182 -0
- package/statistics/features/feature.js +39 -0
- package/statistics/features/post-processing.d.ts +12 -0
- package/statistics/features/post-processing.js +21 -0
- package/statistics/features/supported/assignments/assignments.d.ts +12 -0
- package/statistics/features/supported/assignments/assignments.js +55 -0
- package/statistics/features/supported/assignments/post-process.d.ts +3 -0
- package/statistics/features/supported/assignments/post-process.js +124 -0
- package/statistics/features/supported/comments/comments.d.ts +18 -0
- package/statistics/features/supported/comments/comments.js +133 -0
- package/statistics/features/supported/comments/post-process.d.ts +3 -0
- package/statistics/features/supported/comments/post-process.js +49 -0
- package/statistics/features/supported/control-flow/control-flow.d.ts +17 -0
- package/statistics/features/supported/control-flow/control-flow.js +68 -0
- package/statistics/features/supported/control-flow/post-process.d.ts +3 -0
- package/statistics/features/supported/control-flow/post-process.js +64 -0
- package/statistics/features/supported/data-access/data-access.d.ts +15 -0
- package/statistics/features/supported/data-access/data-access.js +120 -0
- package/statistics/features/supported/data-access/post-process.d.ts +3 -0
- package/statistics/features/supported/data-access/post-process.js +106 -0
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +34 -0
- package/statistics/features/supported/defined-functions/defined-functions.js +142 -0
- package/statistics/features/supported/defined-functions/post-process.d.ts +6 -0
- package/statistics/features/supported/defined-functions/post-process.js +169 -0
- package/statistics/features/supported/expression-list/expression-list.d.ts +9 -0
- package/statistics/features/supported/expression-list/expression-list.js +36 -0
- package/statistics/features/supported/expression-list/post-process.d.ts +3 -0
- package/statistics/features/supported/expression-list/post-process.js +43 -0
- package/statistics/features/supported/loops/loops.d.ts +20 -0
- package/statistics/features/supported/loops/loops.js +79 -0
- package/statistics/features/supported/loops/post-process.d.ts +3 -0
- package/statistics/features/supported/loops/post-process.js +71 -0
- package/statistics/features/supported/used-functions/post-process.d.ts +6 -0
- package/statistics/features/supported/used-functions/post-process.js +178 -0
- package/statistics/features/supported/used-functions/used-functions.d.ts +24 -0
- package/statistics/features/supported/used-functions/used-functions.js +97 -0
- package/statistics/features/supported/used-packages/post-process.d.ts +3 -0
- package/statistics/features/supported/used-packages/post-process.js +120 -0
- package/statistics/features/supported/used-packages/used-packages.d.ts +16 -0
- package/statistics/features/supported/used-packages/used-packages.js +130 -0
- package/statistics/features/supported/values/post-process.d.ts +3 -0
- package/statistics/features/supported/values/post-process.js +71 -0
- package/statistics/features/supported/values/values.d.ts +14 -0
- package/statistics/features/supported/values/values.js +101 -0
- package/statistics/features/supported/variables/post-process.d.ts +9 -0
- package/statistics/features/supported/variables/post-process.js +121 -0
- package/statistics/features/supported/variables/variables.d.ts +15 -0
- package/statistics/features/supported/variables/variables.js +60 -0
- package/statistics/meta-statistics.d.ts +33 -0
- package/statistics/meta-statistics.js +17 -0
- package/statistics/output/file-provider.d.ts +37 -0
- package/statistics/output/file-provider.js +97 -0
- package/statistics/output/print-stats.d.ts +17 -0
- package/statistics/output/print-stats.js +69 -0
- package/statistics/output/statistics-file.d.ts +37 -0
- package/statistics/output/statistics-file.js +69 -0
- package/statistics/statistics.d.ts +28 -0
- package/statistics/statistics.js +108 -0
- package/statistics/summarizer/auto-detect.d.ts +2 -0
- package/statistics/summarizer/auto-detect.js +32 -0
- package/statistics/summarizer/first-phase/process.d.ts +6 -0
- package/statistics/summarizer/first-phase/process.js +81 -0
- package/statistics/summarizer/post-process/clusterer.d.ts +26 -0
- package/statistics/summarizer/post-process/clusterer.js +43 -0
- package/statistics/summarizer/post-process/file-based-count.d.ts +17 -0
- package/statistics/summarizer/post-process/file-based-count.js +49 -0
- package/statistics/summarizer/post-process/histogram.d.ts +59 -0
- package/statistics/summarizer/post-process/histogram.js +128 -0
- package/statistics/summarizer/post-process/post-process-output.d.ts +16 -0
- package/statistics/summarizer/post-process/post-process-output.js +105 -0
- package/statistics/summarizer/second-phase/process.d.ts +11 -0
- package/statistics/summarizer/second-phase/process.js +116 -0
- package/statistics/summarizer/summarizer.d.ts +35 -0
- package/statistics/summarizer/summarizer.js +135 -0
- package/util/ansi.d.ts +2 -2
- package/util/ansi.js +2 -2
- package/util/arrays.d.ts +11 -1
- package/util/arrays.js +34 -1
- package/util/assert.d.ts +1 -0
- package/util/assert.js +5 -1
- package/util/cfg/cfg.d.ts +3 -2
- package/util/cfg/cfg.js +17 -28
- package/util/cfg/visitor.d.ts +1 -1
- package/util/defaultmap.d.ts +1 -1
- package/util/defaultmap.js +1 -1
- package/util/diff.d.ts +4 -4
- package/util/files.d.ts +2 -2
- package/util/files.js +1 -1
- package/util/log.d.ts +1 -0
- package/util/log.js +7 -1
- package/util/logic.d.ts +1 -0
- package/util/logic.js +3 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/ast.js +2 -2
- package/util/mermaid/cfg.d.ts +1 -1
- package/util/mermaid/dfg.d.ts +34 -8
- package/util/mermaid/dfg.js +99 -70
- package/util/mermaid/mermaid.d.ts +1 -1
- package/util/mermaid/mermaid.js +6 -7
- package/util/objects.js +4 -0
- package/util/quads.d.ts +3 -3
- package/util/quads.js +0 -1
- package/util/range.d.ts +27 -14
- package/util/range.js +31 -27
- package/util/version.js +1 -1
- package/core/index.d.ts +0 -4
- package/core/index.js +0 -23
- package/core/input.d.ts +0 -42
- package/core/output.d.ts +0 -15
- package/core/slicer.d.ts +0 -124
- package/core/slicer.js +0 -227
- package/core/steps.d.ts +0 -508
- package/core/steps.js +0 -100
- package/dataflow/environments/index.d.ts +0 -7
- package/dataflow/environments/index.js +0 -23
- package/dataflow/environments/register.js +0 -40
- package/dataflow/environments/scopes.d.ts +0 -6
- package/dataflow/environments/scopes.js +0 -6
- package/dataflow/graph/index.d.ts +0 -4
- package/dataflow/graph/index.js +0 -21
- package/dataflow/index.d.ts +0 -5
- package/dataflow/index.js +0 -24
- package/dataflow/internal/info.d.ts +0 -21
- package/dataflow/internal/info.js +0 -16
- package/dataflow/internal/process/access.d.ts +0 -4
- package/dataflow/internal/process/access.js +0 -53
- package/dataflow/internal/process/expression-list.d.ts +0 -8
- package/dataflow/internal/process/expression-list.js +0 -144
- package/dataflow/internal/process/functions/argument.d.ts +0 -8
- package/dataflow/internal/process/functions/exit-points.d.ts +0 -2
- package/dataflow/internal/process/functions/exit-points.js +0 -121
- package/dataflow/internal/process/functions/function-call.d.ts +0 -5
- package/dataflow/internal/process/functions/function-call.js +0 -105
- package/dataflow/internal/process/functions/function-definition.d.ts +0 -4
- package/dataflow/internal/process/functions/function-definition.js +0 -176
- package/dataflow/internal/process/functions/source.d.ts +0 -8
- package/dataflow/internal/process/functions/source.js +0 -81
- package/dataflow/internal/process/if-then-else.d.ts +0 -4
- package/dataflow/internal/process/if-then-else.js +0 -56
- package/dataflow/internal/process/loops/for-loop.d.ts +0 -4
- package/dataflow/internal/process/loops/for-loop.js +0 -54
- package/dataflow/internal/process/loops/repeat-loop.d.ts +0 -4
- package/dataflow/internal/process/loops/repeat-loop.js +0 -21
- package/dataflow/internal/process/loops/while-loop.d.ts +0 -4
- package/dataflow/internal/process/loops/while-loop.js +0 -31
- package/dataflow/internal/process/operators/assignment.d.ts +0 -4
- package/dataflow/internal/process/operators/assignment.js +0 -129
- package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +0 -4
- package/dataflow/internal/process/operators/non-assignment-binary-op.js +0 -25
- package/dataflow/internal/process/operators/pipe.d.ts +0 -4
- package/dataflow/internal/process/operators/pipe.js +0 -46
- package/dataflow/internal/process/operators/unary-op.d.ts +0 -4
- package/dataflow/internal/process/operators/unary-op.js +0 -10
- package/dataflow/internal/process/symbol.d.ts +0 -4
- package/dataflow/internal/process/symbol.js +0 -21
- package/dataflow/internal/process/uninteresting-leaf.d.ts +0 -3
- package/dataflow/internal/process/uninteresting-leaf.js +0 -9
- package/index.d.ts +0 -4
- package/index.js +0 -21
- package/r-bridge/index.d.ts +0 -11
- package/r-bridge/index.js +0 -28
- package/r-bridge/lang-4.x/ast/index.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/index.js +0 -22
- package/r-bridge/lang-4.x/ast/model/index.d.ts +0 -6
- package/r-bridge/lang-4.x/ast/model/index.js +0 -23
- package/r-bridge/lang-4.x/ast/model/nodes/index.d.ts +0 -21
- package/r-bridge/lang-4.x/ast/model/nodes/index.js +0 -38
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +0 -13
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.js +0 -27
- package/r-bridge/lang-4.x/ast/model/processing/index.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/index.js +0 -22
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +0 -292
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.js +0 -136
- package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/index.js +0 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +0 -65
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/index.js +0 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +0 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/index.js +0 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -26
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/index.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/index.js +0 -22
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +0 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/index.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/index.js +0 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +0 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.js +0 -24
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +0 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +0 -59
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +0 -11
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/index.js +0 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +0 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +0 -159
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/index.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/index.js +0 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +0 -33
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +0 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +0 -64
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/index.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/index.js +0 -20
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +0 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +0 -11
- package/r-bridge/lang-4.x/index.d.ts +0 -2
- package/r-bridge/lang-4.x/index.js +0 -19
- package/slicing/criterion/filters/index.d.ts +0 -1
- package/slicing/criterion/filters/index.js +0 -18
- package/slicing/criterion/index.d.ts +0 -3
- package/slicing/criterion/index.js +0 -20
- package/slicing/index.d.ts +0 -3
- package/slicing/index.js +0 -20
- package/slicing/static/index.d.ts +0 -1
- package/slicing/static/index.js +0 -18
- package/util/mermaid/index.d.ts +0 -3
- package/util/mermaid/index.js +0 -20
- /package/{r-bridge/lang-4.x/ast/parser/xml → benchmark/summarizer}/data.js +0 -0
package/util/cfg/cfg.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cfg2quads = exports.equalCfg = exports.extractCFG = exports.emptyControlFlowInformation = exports.ControlFlowGraph = void 0;
|
|
4
|
-
const r_bridge_1 = require("../../r-bridge");
|
|
5
4
|
const set_1 = require("../set");
|
|
6
5
|
const quads_1 = require("../quads");
|
|
7
6
|
const log_1 = require("../log");
|
|
8
7
|
const json_1 = require("../json");
|
|
8
|
+
const fold_1 = require("../../r-bridge/lang-4.x/ast/model/processing/fold");
|
|
9
|
+
const convert_values_1 = require("../../r-bridge/lang-4.x/convert-values");
|
|
10
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
9
11
|
/**
|
|
10
12
|
* This class represents the control flow graph of an R program.
|
|
11
13
|
* The control flow may be hierarchical when confronted with function definitions (see {@link CfgVertex} and {@link CFG#rootVertexIds|rootVertexIds()}).
|
|
@@ -70,19 +72,9 @@ const cfgFolds = {
|
|
|
70
72
|
foldLogical: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
71
73
|
foldSymbol: cfgLeaf("expression" /* CfgVertexType.Expression */),
|
|
72
74
|
foldAccess: cfgAccess,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
foldComparisonOp: cfgBinaryOp,
|
|
77
|
-
foldAssignment: cfgBinaryOp,
|
|
78
|
-
foldPipe: cfgBinaryOp,
|
|
79
|
-
foldModelFormula: cfgBinaryOp
|
|
80
|
-
},
|
|
81
|
-
unaryOp: {
|
|
82
|
-
foldArithmeticOp: cfgUnaryOp,
|
|
83
|
-
foldLogicalOp: cfgUnaryOp,
|
|
84
|
-
foldModelFormula: cfgUnaryOp
|
|
85
|
-
},
|
|
75
|
+
foldBinaryOp: cfgBinaryOp,
|
|
76
|
+
foldPipe: cfgBinaryOp,
|
|
77
|
+
foldUnaryOp: cfgUnaryOp,
|
|
86
78
|
other: {
|
|
87
79
|
foldComment: cfgIgnore,
|
|
88
80
|
foldLineDirective: cfgIgnore
|
|
@@ -104,7 +96,7 @@ const cfgFolds = {
|
|
|
104
96
|
}
|
|
105
97
|
};
|
|
106
98
|
function extractCFG(ast) {
|
|
107
|
-
return (0,
|
|
99
|
+
return (0, fold_1.foldAst)(ast.ast, cfgFolds);
|
|
108
100
|
}
|
|
109
101
|
exports.extractCFG = extractCFG;
|
|
110
102
|
function cfgLeaf(type) {
|
|
@@ -137,10 +129,10 @@ function cfgIfThenElse(ifNode, condition, then, otherwise) {
|
|
|
137
129
|
}
|
|
138
130
|
for (const exitPoint of condition.exitPoints) {
|
|
139
131
|
for (const entryPoint of then.entryPoints) {
|
|
140
|
-
graph.addEdge(entryPoint, exitPoint, { label: 'CD', when:
|
|
132
|
+
graph.addEdge(entryPoint, exitPoint, { label: 'CD', when: convert_values_1.RTrue });
|
|
141
133
|
}
|
|
142
134
|
for (const entryPoint of otherwise?.entryPoints ?? []) {
|
|
143
|
-
graph.addEdge(entryPoint, exitPoint, { label: 'CD', when:
|
|
135
|
+
graph.addEdge(entryPoint, exitPoint, { label: 'CD', when: convert_values_1.RFalse });
|
|
144
136
|
}
|
|
145
137
|
}
|
|
146
138
|
for (const entryPoint of condition.entryPoints) {
|
|
@@ -151,7 +143,7 @@ function cfgIfThenElse(ifNode, condition, then, otherwise) {
|
|
|
151
143
|
}
|
|
152
144
|
if (!otherwise) {
|
|
153
145
|
for (const exitPoint of condition.exitPoints) {
|
|
154
|
-
graph.addEdge(ifNode.info.id + '-exit', exitPoint, { label: 'CD', when:
|
|
146
|
+
graph.addEdge(ifNode.info.id + '-exit', exitPoint, { label: 'CD', when: convert_values_1.RFalse });
|
|
155
147
|
}
|
|
156
148
|
}
|
|
157
149
|
return {
|
|
@@ -189,7 +181,7 @@ function cfgWhile(whileLoop, condition, body) {
|
|
|
189
181
|
}
|
|
190
182
|
for (const exit of condition.exitPoints) {
|
|
191
183
|
for (const entry of body.entryPoints) {
|
|
192
|
-
graph.addEdge(entry, exit, { label: 'CD', when:
|
|
184
|
+
graph.addEdge(entry, exit, { label: 'CD', when: convert_values_1.RTrue });
|
|
193
185
|
}
|
|
194
186
|
}
|
|
195
187
|
for (const entryPoint of body.entryPoints) {
|
|
@@ -203,7 +195,7 @@ function cfgWhile(whileLoop, condition, body) {
|
|
|
203
195
|
}
|
|
204
196
|
// while can break on the condition as well
|
|
205
197
|
for (const exit of condition.exitPoints) {
|
|
206
|
-
graph.addEdge(whileLoop.info.id + '-exit', exit, { label: 'CD', when:
|
|
198
|
+
graph.addEdge(whileLoop.info.id + '-exit', exit, { label: 'CD', when: convert_values_1.RFalse });
|
|
207
199
|
}
|
|
208
200
|
return { graph, breaks: [], nexts: [], returns: body.returns, exitPoints: [whileLoop.info.id + '-exit'], entryPoints: [whileLoop.info.id] };
|
|
209
201
|
}
|
|
@@ -223,7 +215,7 @@ function cfgFor(forLoop, variable, vector, body) {
|
|
|
223
215
|
}
|
|
224
216
|
for (const exit of variable.exitPoints) {
|
|
225
217
|
for (const entry of body.entryPoints) {
|
|
226
|
-
graph.addEdge(entry, exit, { label: 'CD', when:
|
|
218
|
+
graph.addEdge(entry, exit, { label: 'CD', when: convert_values_1.RTrue });
|
|
227
219
|
}
|
|
228
220
|
}
|
|
229
221
|
for (const next of [...body.nexts, ...body.exitPoints]) {
|
|
@@ -234,7 +226,7 @@ function cfgFor(forLoop, variable, vector, body) {
|
|
|
234
226
|
}
|
|
235
227
|
// while can break on the condition as well
|
|
236
228
|
for (const exit of variable.exitPoints) {
|
|
237
|
-
graph.addEdge(forLoop.info.id + '-exit', exit, { label: 'CD', when:
|
|
229
|
+
graph.addEdge(forLoop.info.id + '-exit', exit, { label: 'CD', when: convert_values_1.RFalse });
|
|
238
230
|
}
|
|
239
231
|
return { graph, breaks: [], nexts: [], returns: body.returns, exitPoints: [forLoop.info.id + '-exit'], entryPoints: [forLoop.info.id] };
|
|
240
232
|
}
|
|
@@ -279,7 +271,7 @@ function cfgFunctionCall(call, name, args) {
|
|
|
279
271
|
graph.addVertex({ id: call.info.id + '-exit', name: 'call-exit', type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
280
272
|
let lastArgExits = [call.info.id + '-name'];
|
|
281
273
|
for (const arg of args) {
|
|
282
|
-
if (arg ===
|
|
274
|
+
if (arg === r_function_call_1.EmptyArgument) {
|
|
283
275
|
continue;
|
|
284
276
|
}
|
|
285
277
|
graph.merge(arg.graph);
|
|
@@ -368,11 +360,8 @@ function cfgAccess(access, name, accessors) {
|
|
|
368
360
|
}
|
|
369
361
|
result.entryPoints = [access.info.id];
|
|
370
362
|
result.exitPoints = [access.info.id + '-exit'];
|
|
371
|
-
if (typeof accessors === 'string') {
|
|
372
|
-
return result;
|
|
373
|
-
}
|
|
374
363
|
for (const accessor of accessors) {
|
|
375
|
-
if (accessor ===
|
|
364
|
+
if (accessor === r_function_call_1.EmptyArgument) {
|
|
376
365
|
continue;
|
|
377
366
|
}
|
|
378
367
|
graph.merge(accessor.graph);
|
|
@@ -391,7 +380,7 @@ function cfgUnaryOp(unary, operand) {
|
|
|
391
380
|
graph.addVertex({ id: unary.info.id, name: unary.type, type: "end-marker" /* CfgVertexType.EndMarker */ });
|
|
392
381
|
return result;
|
|
393
382
|
}
|
|
394
|
-
function cfgExprList(_node, expressions) {
|
|
383
|
+
function cfgExprList(_node, _grouping, expressions) {
|
|
395
384
|
const result = { graph: new ControlFlowGraph(), breaks: [], nexts: [], returns: [], exitPoints: [], entryPoints: [] };
|
|
396
385
|
let first = true;
|
|
397
386
|
for (const expression of expressions) {
|
package/util/cfg/visitor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodeId } from '../../r-bridge';
|
|
2
1
|
import type { CfgEdge, CfgVertex, ControlFlowInformation } from './cfg';
|
|
2
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
3
|
export interface NodeVisitingContext {
|
|
4
4
|
parent: {
|
|
5
5
|
vertex: NodeId;
|
package/util/defaultmap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A default map allows for a generator
|
|
2
|
+
* A default map allows for a generator producing values automatically if you want to add something to a map that does not have a value associated with a given key.
|
|
3
3
|
* This does not implement the default map interface as return types (and some future methods may) change
|
|
4
4
|
*/
|
|
5
5
|
export declare class DefaultMap<K, V = K> {
|
package/util/defaultmap.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultMap = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* A default map allows for a generator
|
|
5
|
+
* A default map allows for a generator producing values automatically if you want to add something to a map that does not have a value associated with a given key.
|
|
6
6
|
* This does not implement the default map interface as return types (and some future methods may) change
|
|
7
7
|
*/
|
|
8
8
|
class DefaultMap {
|
package/util/diff.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface DifferenceReport {
|
|
|
18
18
|
*/
|
|
19
19
|
comments(): readonly string[] | undefined;
|
|
20
20
|
/**
|
|
21
|
-
* @returns true iff the compared structures are equal
|
|
21
|
+
* @returns true iff the compared structures are equal (i.e., the diff is empty)
|
|
22
22
|
*/
|
|
23
23
|
isEqual(): boolean;
|
|
24
24
|
}
|
|
@@ -30,14 +30,14 @@ export interface WriteableDifferenceReport extends DifferenceReport {
|
|
|
30
30
|
* The `leftname` and `rightname` fields are only used to provide more useful
|
|
31
31
|
* information in the difference report.
|
|
32
32
|
*/
|
|
33
|
-
export interface GenericDifferenceInformation extends MergeableRecord {
|
|
33
|
+
export interface GenericDifferenceInformation<Report extends WriteableDifferenceReport> extends MergeableRecord {
|
|
34
34
|
/** A human-readable name for the left structure in `left == right`. */
|
|
35
35
|
readonly leftname: string;
|
|
36
36
|
/** A human-readable name for the right structure in `left == right`. */
|
|
37
37
|
readonly rightname: string;
|
|
38
38
|
/** The report on the difference of the two structures. */
|
|
39
|
-
readonly report:
|
|
39
|
+
readonly report: Report;
|
|
40
40
|
/** A human-readable indication of where we are (the prefix of the information if the structures differ) */
|
|
41
41
|
readonly position: string;
|
|
42
42
|
}
|
|
43
|
-
export declare function setDifference<T>(left: ReadonlySet<T>, right: ReadonlySet<T>, info: GenericDifferenceInformation): void;
|
|
43
|
+
export declare function setDifference<T, Report extends WriteableDifferenceReport = WriteableDifferenceReport>(left: ReadonlySet<T>, right: ReadonlySet<T>, info: GenericDifferenceInformation<Report>): void;
|
package/util/files.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { RParseRequestFromFile } from '../r-bridge';
|
|
2
|
+
import type { RParseRequestFromFile } from '../r-bridge/retriever';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a table, identified by a header and a list of rows.
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ export interface Table {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves all files in the given directory recursively
|
|
12
|
-
* @param dir - Directory
|
|
12
|
+
* @param dir - Directory path to start the search from
|
|
13
13
|
* @param suffix - Suffix of the files to be retrieved
|
|
14
14
|
* Based on {@link https://stackoverflow.com/a/45130990}
|
|
15
15
|
*/
|
package/util/files.js
CHANGED
|
@@ -33,7 +33,7 @@ const log_1 = require("./log");
|
|
|
33
33
|
const n_readlines_1 = __importDefault(require("n-readlines"));
|
|
34
34
|
/**
|
|
35
35
|
* Retrieves all files in the given directory recursively
|
|
36
|
-
* @param dir - Directory
|
|
36
|
+
* @param dir - Directory path to start the search from
|
|
37
37
|
* @param suffix - Suffix of the files to be retrieved
|
|
38
38
|
* Based on {@link https://stackoverflow.com/a/45130990}
|
|
39
39
|
*/
|
package/util/log.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ILogObj, type ISettingsParam, Logger } from 'tslog';
|
|
2
2
|
import { type Options } from 'rotating-file-stream';
|
|
3
|
+
export declare const expensiveTrace: (log: Logger<ILogObj>, supplier: () => string) => void;
|
|
3
4
|
export declare class FlowrLogger extends Logger<ILogObj> {
|
|
4
5
|
/** by keeping track of all children we can propagate updates of the settings (e.g., in tests) */
|
|
5
6
|
private readonly childLoggers;
|
package/util/log.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.log = exports.FlowrLogger = void 0;
|
|
3
|
+
exports.log = exports.FlowrLogger = exports.expensiveTrace = void 0;
|
|
4
4
|
const tslog_1 = require("tslog");
|
|
5
5
|
const rotating_file_stream_1 = require("rotating-file-stream");
|
|
6
|
+
const expensiveTrace = (log, supplier) => {
|
|
7
|
+
if (log.settings.minLevel <= 1 /* LogLevel.Trace */) {
|
|
8
|
+
log.trace(supplier());
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.expensiveTrace = expensiveTrace;
|
|
6
12
|
class FlowrLogger extends tslog_1.Logger {
|
|
7
13
|
/** by keeping track of all children we can propagate updates of the settings (e.g., in tests) */
|
|
8
14
|
childLoggers = [];
|
package/util/logic.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Ternary = 'always' | 'maybe' | 'never';
|
package/util/logic.js
ADDED
package/util/mermaid/ast.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RNodeWithParent } from '../../r-bridge';
|
|
1
|
+
import type { RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
export declare function normalizedAstToMermaid(ast: RNodeWithParent, prefix?: string): string;
|
|
3
3
|
/**
|
|
4
4
|
* Use mermaid to visualize the normalized AST.
|
package/util/mermaid/ast.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizedAstToMermaidUrl = exports.normalizedAstToMermaid = void 0;
|
|
4
|
-
const r_bridge_1 = require("../../r-bridge");
|
|
5
4
|
const mermaid_1 = require("./mermaid");
|
|
5
|
+
const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor");
|
|
6
6
|
function normalizedAstToMermaid(ast, prefix = '') {
|
|
7
7
|
let output = prefix + 'flowchart TD\n';
|
|
8
|
-
(0,
|
|
8
|
+
(0, visitor_1.visitAst)(ast, n => {
|
|
9
9
|
const name = `${n.type} (${n.info.id})\\n${n.lexeme ?? ' '}`;
|
|
10
10
|
output += ` n${n.info.id}(["${(0, mermaid_1.escapeMarkdown)(name)}"])\n`;
|
|
11
11
|
if (n.info.parent !== undefined) {
|
package/util/mermaid/cfg.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NormalizedAst } from '../../r-bridge';
|
|
2
1
|
import type { ControlFlowInformation } from '../cfg/cfg';
|
|
2
|
+
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string): string;
|
|
4
4
|
/**
|
|
5
5
|
* Use mermaid to visualize the normalized AST.
|
package/util/mermaid/dfg.d.ts
CHANGED
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
import type { NodeId } from '../../r-bridge';
|
|
2
1
|
import type { SourceRange } from '../range';
|
|
3
|
-
import type { DataflowGraph
|
|
2
|
+
import type { DataflowGraph } from '../../dataflow/graph/graph';
|
|
3
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
|
+
type MarkVertex = NodeId;
|
|
5
|
+
type MarkEdge = `${string}->${string}`;
|
|
6
|
+
type Mark = MarkVertex | MarkEdge;
|
|
7
|
+
interface MermaidGraph {
|
|
8
|
+
nodeLines: string[];
|
|
9
|
+
edgeLines: string[];
|
|
10
|
+
hasBuiltIn: boolean;
|
|
11
|
+
includeEnvironments: boolean;
|
|
12
|
+
mark: ReadonlySet<Mark> | undefined;
|
|
13
|
+
/** in the form of from-\>to because I am lazy, see {@link encodeEdge} */
|
|
14
|
+
presentEdges: Set<string>;
|
|
15
|
+
rootGraph: DataflowGraph;
|
|
16
|
+
}
|
|
4
17
|
export declare function formatRange(range: SourceRange | undefined): string;
|
|
5
|
-
|
|
18
|
+
interface MermaidGraphConfiguration {
|
|
19
|
+
graph: DataflowGraph;
|
|
20
|
+
prefix?: string | null;
|
|
21
|
+
idPrefix?: string;
|
|
22
|
+
includeEnvironments?: boolean;
|
|
23
|
+
mark?: ReadonlySet<Mark>;
|
|
24
|
+
rootGraph?: DataflowGraph;
|
|
25
|
+
presentEdges?: Set<string>;
|
|
26
|
+
}
|
|
27
|
+
export declare function graphToMermaid(config: MermaidGraphConfiguration): {
|
|
28
|
+
string: string;
|
|
29
|
+
mermaid: MermaidGraph;
|
|
30
|
+
};
|
|
6
31
|
/**
|
|
7
32
|
* Converts a dataflow graph to a mermaid url that visualizes the graph.
|
|
8
33
|
*
|
|
9
34
|
* @param graph - The graph to convert
|
|
10
|
-
* @param dataflowIdMap - ID map to use to get access to the graph id mappings
|
|
11
35
|
* @param includeEnvironments - Whether to include the environments in the mermaid graph code
|
|
12
|
-
* @param mark - Special nodes to mark (e.g
|
|
36
|
+
* @param mark - Special nodes to mark (e.g., those included in the slice)
|
|
13
37
|
*/
|
|
14
|
-
export declare function graphToMermaidUrl(graph: DataflowGraph,
|
|
38
|
+
export declare function graphToMermaidUrl(graph: DataflowGraph, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>): string;
|
|
15
39
|
export interface LabeledDiffGraph {
|
|
16
40
|
label: string;
|
|
17
41
|
graph: DataflowGraph;
|
|
42
|
+
mark?: Set<Mark>;
|
|
18
43
|
}
|
|
19
44
|
/** uses same id map but ensures, it is different from the rhs so that mermaid can work with that */
|
|
20
|
-
export declare function diffGraphsToMermaid(left: LabeledDiffGraph, right: LabeledDiffGraph,
|
|
21
|
-
export declare function diffGraphsToMermaidUrl(left: LabeledDiffGraph, right: LabeledDiffGraph,
|
|
45
|
+
export declare function diffGraphsToMermaid(left: LabeledDiffGraph, right: LabeledDiffGraph, prefix: string): string;
|
|
46
|
+
export declare function diffGraphsToMermaidUrl(left: LabeledDiffGraph, right: LabeledDiffGraph, prefix: string): string;
|
|
47
|
+
export {};
|
package/util/mermaid/dfg.js
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.diffGraphsToMermaidUrl = exports.diffGraphsToMermaid = exports.graphToMermaidUrl = exports.graphToMermaid = exports.formatRange = void 0;
|
|
4
|
-
const dataflow_1 = require("../../dataflow");
|
|
5
4
|
const assert_1 = require("../assert");
|
|
6
|
-
const json_1 = require("../json");
|
|
7
5
|
const mermaid_1 = require("./mermaid");
|
|
6
|
+
const graph_1 = require("../../dataflow/graph/graph");
|
|
7
|
+
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
8
|
+
const edge_1 = require("../../dataflow/graph/edge");
|
|
9
|
+
const environment_1 = require("../../dataflow/environments/environment");
|
|
10
|
+
const built_in_1 = require("../../dataflow/environments/built-in");
|
|
8
11
|
function formatRange(range) {
|
|
9
12
|
if (range === undefined) {
|
|
10
|
-
return '
|
|
13
|
+
return '??-??';
|
|
11
14
|
}
|
|
12
|
-
return `${range
|
|
15
|
+
return `${range[0]}.${range[1]}-${range[2]}.${range[3]}`;
|
|
13
16
|
}
|
|
14
17
|
exports.formatRange = formatRange;
|
|
15
|
-
function
|
|
16
|
-
const whenText = when === 'always' ? '' : `, ${when}`;
|
|
17
|
-
return `, *${scope.replace('<', '#lt;')}${whenText}*`;
|
|
18
|
-
}
|
|
19
|
-
function createArtificialExitPoints(exitPoints, mermaid, dataflowIdMap, idPrefix) {
|
|
20
|
-
for (const exitPoint of exitPoints) {
|
|
21
|
-
if (!mermaid.rootGraph.hasNode(exitPoint, true)) {
|
|
22
|
-
const node = dataflowIdMap.get(exitPoint);
|
|
23
|
-
(0, assert_1.guard)(node !== undefined, 'exit point not found');
|
|
24
|
-
mermaid.nodeLines.push(` ${idPrefix}${exitPoint}{{"${node.lexeme ?? '??'} (${exitPoint})\n ${formatRange(dataflowIdMap.get(exitPoint)?.location)}"}}`);
|
|
25
|
-
}
|
|
26
|
-
mermaid.nodeLines.push(` style ${idPrefix}${exitPoint} stroke-width:6.5px;`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function subflowToMermaid(nodeId, exitPoints, subflow, dataflowIdMap, mermaid, idPrefix = '') {
|
|
18
|
+
function subflowToMermaid(nodeId, exitPoints, subflow, mermaid, idPrefix = '') {
|
|
30
19
|
if (subflow === undefined) {
|
|
31
20
|
return;
|
|
32
21
|
}
|
|
33
22
|
const subflowId = `${idPrefix}flow-${nodeId}`;
|
|
34
23
|
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" [function ${nodeId}]`);
|
|
35
|
-
const subgraph = graphToMermaidGraph(subflow.graph,
|
|
24
|
+
const subgraph = graphToMermaidGraph(subflow.graph, {
|
|
25
|
+
graph: mermaid.rootGraph,
|
|
26
|
+
rootGraph: mermaid.rootGraph,
|
|
27
|
+
idPrefix,
|
|
28
|
+
includeEnvironments: mermaid.includeEnvironments,
|
|
29
|
+
mark: mermaid.mark,
|
|
30
|
+
prefix: null
|
|
31
|
+
});
|
|
36
32
|
mermaid.nodeLines.push(...subgraph.nodeLines);
|
|
37
33
|
mermaid.edgeLines.push(...subgraph.edgeLines);
|
|
38
34
|
for (const [color, pool] of [['purple', subflow.in], ['green', subflow.out], ['orange', subflow.unknownReferences]]) {
|
|
@@ -43,123 +39,156 @@ function subflowToMermaid(nodeId, exitPoints, subflow, dataflowIdMap, mermaid, i
|
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
}
|
|
46
|
-
if (dataflowIdMap !== undefined) {
|
|
47
|
-
createArtificialExitPoints(exitPoints, mermaid, dataflowIdMap, idPrefix);
|
|
48
|
-
}
|
|
49
42
|
mermaid.nodeLines.push('end');
|
|
50
43
|
mermaid.edgeLines.push(`${idPrefix}${nodeId} -.-|function| ${subflowId}\n`);
|
|
51
44
|
}
|
|
52
45
|
function printArg(arg) {
|
|
53
|
-
if (arg ===
|
|
54
|
-
return '';
|
|
46
|
+
if (arg === undefined) {
|
|
47
|
+
return '??';
|
|
48
|
+
}
|
|
49
|
+
else if (arg === r_function_call_1.EmptyArgument) {
|
|
50
|
+
return '[empty]';
|
|
51
|
+
}
|
|
52
|
+
else if ((0, graph_1.isNamedArgument)(arg)) {
|
|
53
|
+
const deps = arg.controlDependencies ? ', :maybe:' + arg.controlDependencies.join(',') : '';
|
|
54
|
+
return `${arg.name} (${arg.nodeId}${deps})`;
|
|
55
55
|
}
|
|
56
|
-
if (
|
|
56
|
+
else if ((0, graph_1.isPositionalArgument)(arg)) {
|
|
57
|
+
const deps = arg.controlDependencies ? ' (:maybe:' + arg.controlDependencies.join(',') + ')' : '';
|
|
58
|
+
return `${arg.nodeId}${deps}`;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
57
61
|
return '??';
|
|
58
62
|
}
|
|
59
|
-
return `${arg.nodeId}`;
|
|
60
63
|
}
|
|
61
64
|
function displayFunctionArgMapping(argMapping) {
|
|
62
65
|
const result = [];
|
|
63
66
|
for (const arg of argMapping) {
|
|
64
|
-
result.push(
|
|
67
|
+
result.push(printArg(arg));
|
|
65
68
|
}
|
|
66
69
|
return result.length === 0 ? '' : `\n (${result.join(', ')})`;
|
|
67
70
|
}
|
|
68
|
-
function encodeEdge(from, to, types
|
|
69
|
-
|
|
70
|
-
if (types.has(dataflow_1.EdgeType.SameReadRead) || types.has(dataflow_1.EdgeType.SameDefDef) || types.has(dataflow_1.EdgeType.Relates)) {
|
|
71
|
-
if (from > to) {
|
|
72
|
-
({ from, to } = { from: to, to: from });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return `${from}->${to}["${[...types].join(':')} (${attribute})"]`;
|
|
71
|
+
function encodeEdge(from, to, types) {
|
|
72
|
+
return `${from}->${to}["${[...types].join(':')}"]`;
|
|
76
73
|
}
|
|
77
|
-
function mermaidNodeBrackets(
|
|
74
|
+
function mermaidNodeBrackets(tag) {
|
|
78
75
|
let open;
|
|
79
76
|
let close;
|
|
80
|
-
if (
|
|
77
|
+
if (tag === 'function-definition' || tag === 'variable-definition') {
|
|
81
78
|
open = '[';
|
|
82
79
|
close = ']';
|
|
83
80
|
}
|
|
84
|
-
else if (
|
|
81
|
+
else if (tag === "function-call" /* VertexType.FunctionCall */) {
|
|
85
82
|
open = '[[';
|
|
86
83
|
close = ']]';
|
|
87
84
|
}
|
|
85
|
+
else if (tag === 'value') {
|
|
86
|
+
open = '{{';
|
|
87
|
+
close = '}}';
|
|
88
|
+
}
|
|
88
89
|
else {
|
|
89
90
|
open = '([';
|
|
90
91
|
close = '])';
|
|
91
92
|
}
|
|
92
93
|
return { open, close };
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
function printIdentifier(id) {
|
|
96
|
+
return `${id.name} (${id.nodeId}, ${id.kind},${id.controlDependencies ? ' {' + id.controlDependencies.join(',') + '},' : ''} def. @${id.definedAt})`;
|
|
97
|
+
}
|
|
98
|
+
function printEnvironmentToLines(env) {
|
|
99
|
+
if (env === undefined) {
|
|
100
|
+
return ['??'];
|
|
101
|
+
}
|
|
102
|
+
else if (env.id === environment_1.BuiltInEnvironment.id) {
|
|
103
|
+
return ['Built-in'];
|
|
104
|
+
}
|
|
105
|
+
const lines = [...printEnvironmentToLines(env.parent), `${env.id}--${env.name}${'-'.repeat(40)}`];
|
|
106
|
+
const longestName = Math.max(...[...env.memory.keys()].map(x => x.length));
|
|
107
|
+
for (const [name, defs] of env.memory.entries()) {
|
|
108
|
+
const printName = `${name}:`;
|
|
109
|
+
lines.push(` ${printName.padEnd(longestName + 1, ' ')} {${defs.map(printIdentifier).join(', ')}}`);
|
|
110
|
+
}
|
|
111
|
+
return lines;
|
|
112
|
+
}
|
|
113
|
+
function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
114
|
+
const fCall = info.tag === "function-call" /* VertexType.FunctionCall */;
|
|
115
|
+
const { open, close } = mermaidNodeBrackets(info.tag);
|
|
116
|
+
if (info.environment && mermaid.includeEnvironments) {
|
|
117
|
+
if (info.environment.level > 0 || info.environment.current.memory.size !== 0) {
|
|
118
|
+
mermaid.nodeLines.push(` %% Environment of ${id} [level: ${info.environment.level}]:`, printEnvironmentToLines(info.environment.current).map(x => ` %% ${x}`).join('\n'));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const node = mermaid.rootGraph.idMap?.get(info.id);
|
|
122
|
+
const escapedName = (0, mermaid_1.escapeMarkdown)(node ? `[${node.type}] ${node.lexeme ?? '??'}` : '??');
|
|
123
|
+
const deps = info.controlDependencies ? ', :maybe:' + info.controlDependencies.join(',') : '';
|
|
124
|
+
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps})\n *${formatRange(mermaid.rootGraph.idMap?.get(id)?.location)}*${fCall ? displayFunctionArgMapping(info.args) : ''}\`"${close}`);
|
|
103
125
|
if (mark?.has(id)) {
|
|
104
126
|
mermaid.nodeLines.push(` style ${idPrefix}${id} stroke:black,stroke-width:7px; `);
|
|
105
127
|
}
|
|
106
128
|
const edges = mermaid.rootGraph.get(id, true);
|
|
107
129
|
(0, assert_1.guard)(edges !== undefined, `node ${id} must be found`);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
130
|
+
const artificialCdEdges = (info.controlDependencies ?? []).map(x => [x, { types: new Set(['CD']) }]);
|
|
131
|
+
for (const [target, edge] of [...edges[1], ...artificialCdEdges]) {
|
|
132
|
+
const edgeTypes = typeof edge.types == 'number' ? new Set((0, edge_1.splitEdgeTypes)(edge.types)) : edge.types;
|
|
133
|
+
const edgeId = encodeEdge(idPrefix + id, idPrefix + target, edgeTypes);
|
|
111
134
|
if (!mermaid.presentEdges.has(edgeId)) {
|
|
112
135
|
mermaid.presentEdges.add(edgeId);
|
|
113
|
-
mermaid.edgeLines.push(` ${idPrefix}${id} ${
|
|
114
|
-
if (
|
|
136
|
+
mermaid.edgeLines.push(` ${idPrefix}${id} -->|"${[...edgeTypes].map(e => typeof e === 'number' ? (0, edge_1.edgeTypeToName)(e) : e).join(', ')}"| ${idPrefix}${target}`);
|
|
137
|
+
if (mermaid.mark?.has(id + '->' + target)) {
|
|
138
|
+
// who invented this syntax?!
|
|
139
|
+
mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:red,color:red,stroke-width:4px;`);
|
|
140
|
+
}
|
|
141
|
+
if (edgeTypes.has('CD')) {
|
|
142
|
+
mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:gray,color:gray;`);
|
|
143
|
+
}
|
|
144
|
+
if (target === built_in_1.BuiltIn) {
|
|
115
145
|
mermaid.hasBuiltIn = true;
|
|
116
146
|
}
|
|
117
147
|
}
|
|
118
148
|
}
|
|
119
149
|
if (info.tag === 'function-definition') {
|
|
120
|
-
subflowToMermaid(id, info.exitPoints, info.subflow,
|
|
150
|
+
subflowToMermaid(id, info.exitPoints, info.subflow, mermaid, idPrefix);
|
|
121
151
|
}
|
|
122
152
|
}
|
|
123
153
|
// make the passing of root ids more performant again
|
|
124
|
-
function graphToMermaidGraph(rootIds, graph,
|
|
125
|
-
const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges
|
|
154
|
+
function graphToMermaidGraph(rootIds, { graph, prefix = 'flowchart TD', idPrefix = '', includeEnvironments = true, mark, rootGraph, presentEdges = new Set() }) {
|
|
155
|
+
const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, hasBuiltIn: false, mark, rootGraph: rootGraph ?? graph, includeEnvironments };
|
|
126
156
|
for (const [id, info] of graph.vertices(true)) {
|
|
127
157
|
if (rootIds.has(id)) {
|
|
128
|
-
|
|
158
|
+
vertexToMermaid(info, mermaid, id, idPrefix, mark);
|
|
129
159
|
}
|
|
130
160
|
}
|
|
131
161
|
if (mermaid.hasBuiltIn) {
|
|
132
|
-
mermaid.nodeLines.push(` ${idPrefix}${
|
|
162
|
+
mermaid.nodeLines.push(` ${idPrefix}${built_in_1.BuiltIn}["Built-in"]`);
|
|
133
163
|
}
|
|
134
164
|
return mermaid;
|
|
135
165
|
}
|
|
136
|
-
function graphToMermaid(
|
|
137
|
-
const mermaid = graphToMermaidGraph(graph.rootIds(),
|
|
138
|
-
return `${mermaid.nodeLines.join('\n')}\n${mermaid.edgeLines.join('\n')}
|
|
166
|
+
function graphToMermaid(config) {
|
|
167
|
+
const mermaid = graphToMermaidGraph(config.graph.rootIds(), config);
|
|
168
|
+
return { string: `${mermaid.nodeLines.join('\n')}\n${mermaid.edgeLines.join('\n')}`, mermaid };
|
|
139
169
|
}
|
|
140
170
|
exports.graphToMermaid = graphToMermaid;
|
|
141
171
|
/**
|
|
142
172
|
* Converts a dataflow graph to a mermaid url that visualizes the graph.
|
|
143
173
|
*
|
|
144
174
|
* @param graph - The graph to convert
|
|
145
|
-
* @param dataflowIdMap - ID map to use to get access to the graph id mappings
|
|
146
175
|
* @param includeEnvironments - Whether to include the environments in the mermaid graph code
|
|
147
|
-
* @param mark - Special nodes to mark (e.g
|
|
176
|
+
* @param mark - Special nodes to mark (e.g., those included in the slice)
|
|
148
177
|
*/
|
|
149
|
-
function graphToMermaidUrl(graph,
|
|
150
|
-
return (0, mermaid_1.mermaidCodeToUrl)(graphToMermaid(graph,
|
|
178
|
+
function graphToMermaidUrl(graph, includeEnvironments, mark) {
|
|
179
|
+
return (0, mermaid_1.mermaidCodeToUrl)(graphToMermaid({ graph, includeEnvironments, mark }).string);
|
|
151
180
|
}
|
|
152
181
|
exports.graphToMermaidUrl = graphToMermaidUrl;
|
|
153
182
|
/** uses same id map but ensures, it is different from the rhs so that mermaid can work with that */
|
|
154
|
-
function diffGraphsToMermaid(left, right,
|
|
183
|
+
function diffGraphsToMermaid(left, right, prefix) {
|
|
155
184
|
// we add the prefix ourselves
|
|
156
|
-
const leftGraph = graphToMermaid(left.graph,
|
|
157
|
-
const rightGraph = graphToMermaid(right.graph,
|
|
185
|
+
const { string: leftGraph, mermaid } = graphToMermaid({ graph: left.graph, prefix: '', idPrefix: `l-${left.label}`, includeEnvironments: true, mark: left.mark });
|
|
186
|
+
const { string: rightGraph } = graphToMermaid({ graph: right.graph, prefix: '', idPrefix: `r-${right.label}`, includeEnvironments: true, mark: right.mark, presentEdges: mermaid.presentEdges });
|
|
158
187
|
return `${prefix}flowchart TD\nsubgraph "${left.label}"\n${leftGraph}\nend\nsubgraph "${right.label}"\n${rightGraph}\nend`;
|
|
159
188
|
}
|
|
160
189
|
exports.diffGraphsToMermaid = diffGraphsToMermaid;
|
|
161
|
-
function diffGraphsToMermaidUrl(left, right,
|
|
162
|
-
return (0, mermaid_1.mermaidCodeToUrl)(diffGraphsToMermaid(left, right,
|
|
190
|
+
function diffGraphsToMermaidUrl(left, right, prefix) {
|
|
191
|
+
return (0, mermaid_1.mermaidCodeToUrl)(diffGraphsToMermaid(left, right, prefix));
|
|
163
192
|
}
|
|
164
193
|
exports.diffGraphsToMermaidUrl = diffGraphsToMermaidUrl;
|
|
165
194
|
//# sourceMappingURL=dfg.js.map
|
package/util/mermaid/mermaid.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mermaidCodeToUrl = exports.escapeMarkdown = void 0;
|
|
4
4
|
function escapeMarkdown(text) {
|
|
5
|
-
return text.replaceAll(/([
|
|
5
|
+
return text.replaceAll(/([+*<>-])/g, '\\$1').replaceAll('"', '\'\'');
|
|
6
6
|
}
|
|
7
7
|
exports.escapeMarkdown = escapeMarkdown;
|
|
8
8
|
/**
|
|
@@ -10,15 +10,14 @@ exports.escapeMarkdown = escapeMarkdown;
|
|
|
10
10
|
*
|
|
11
11
|
* @param code - code to convert
|
|
12
12
|
*/
|
|
13
|
-
function mermaidCodeToUrl(code) {
|
|
13
|
+
function mermaidCodeToUrl(code, edit = false) {
|
|
14
14
|
const obj = {
|
|
15
15
|
code,
|
|
16
|
-
mermaid: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
updateDiagram: false
|
|
16
|
+
mermaid: {
|
|
17
|
+
autoSync: true
|
|
18
|
+
}
|
|
20
19
|
};
|
|
21
|
-
return `https://mermaid.live
|
|
20
|
+
return `https://mermaid.live/${edit ? 'edit' : 'view'}#base64:${Buffer.from(JSON.stringify(obj)).toString('base64')}`;
|
|
22
21
|
}
|
|
23
22
|
exports.mermaidCodeToUrl = mermaidCodeToUrl;
|
|
24
23
|
//# sourceMappingURL=mermaid.js.map
|