@eagleoutice/flowr 2.2.12 → 2.2.14

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.
Files changed (282) hide show
  1. package/README.md +82 -20
  2. package/benchmark/slicer.js +2 -2
  3. package/benchmark/summarizer/first-phase/input.js +1 -1
  4. package/benchmark/summarizer/first-phase/process.js +3 -3
  5. package/benchmark/summarizer/second-phase/process.js +1 -1
  6. package/benchmark/summarizer/summarizer.js +1 -1
  7. package/cli/common/options.js +4 -4
  8. package/cli/common/script.js +1 -1
  9. package/cli/flowr.js +1 -1
  10. package/cli/repl/commands/repl-cfg.d.ts +2 -0
  11. package/cli/repl/commands/repl-cfg.js +38 -24
  12. package/cli/repl/commands/repl-commands.js +4 -2
  13. package/cli/repl/commands/repl-dataflow.js +3 -3
  14. package/cli/repl/commands/repl-execute.js +1 -1
  15. package/cli/repl/commands/repl-main.d.ts +1 -1
  16. package/cli/repl/commands/repl-main.js +1 -1
  17. package/cli/repl/commands/repl-normalize.js +1 -1
  18. package/cli/repl/commands/repl-query.js +2 -2
  19. package/cli/repl/core.js +1 -1
  20. package/cli/repl/prompt.js +1 -1
  21. package/cli/repl/server/connection.js +4 -4
  22. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  23. package/cli/script-core/statistics-core.js +1 -1
  24. package/cli/script-core/statistics-helper-core.js +4 -4
  25. package/config.d.ts +47 -24
  26. package/config.js +3 -3
  27. package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
  28. package/control-flow/basic-cfg-guided-visitor.js +114 -0
  29. package/control-flow/cfg-properties.d.ts +26 -0
  30. package/control-flow/cfg-properties.js +100 -0
  31. package/control-flow/cfg-simplification.d.ts +18 -0
  32. package/control-flow/cfg-simplification.js +55 -0
  33. package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
  34. package/control-flow/cfg-to-basic-blocks.js +81 -0
  35. package/control-flow/control-flow-graph.d.ts +247 -0
  36. package/control-flow/control-flow-graph.js +290 -0
  37. package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
  38. package/control-flow/dfg-cfg-guided-visitor.js +71 -0
  39. package/control-flow/diff-cfg.d.ts +11 -0
  40. package/control-flow/diff-cfg.js +161 -0
  41. package/control-flow/extract-cfg.d.ts +30 -0
  42. package/control-flow/extract-cfg.js +475 -0
  43. package/control-flow/happens-before.d.ts +7 -0
  44. package/{util/cfg → control-flow}/happens-before.js +3 -3
  45. package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
  46. package/control-flow/semantic-cfg-guided-visitor.js +492 -0
  47. package/control-flow/simple-visitor.d.ts +25 -0
  48. package/control-flow/simple-visitor.js +80 -0
  49. package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
  50. package/control-flow/syntax-cfg-guided-visitor.js +166 -0
  51. package/core/print/print.d.ts +1 -1
  52. package/core/print/slice-diff-ansi.js +1 -1
  53. package/core/steps/pipeline/create-pipeline.js +1 -1
  54. package/dataflow/environments/built-in-config.js +9 -6
  55. package/dataflow/environments/built-in.d.ts +8 -4
  56. package/dataflow/environments/built-in.js +47 -5
  57. package/dataflow/environments/default-builtin-config.d.ts +2 -0
  58. package/dataflow/environments/default-builtin-config.js +81 -14
  59. package/dataflow/environments/resolve-by-name.js +15 -4
  60. package/dataflow/extractor.js +2 -2
  61. package/dataflow/graph/dataflowgraph-builder.d.ts +3 -1
  62. package/dataflow/graph/dataflowgraph-builder.js +4 -2
  63. package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
  64. package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
  65. package/dataflow/graph/graph.d.ts +11 -3
  66. package/dataflow/graph/graph.js +27 -12
  67. package/dataflow/graph/vertex.d.ts +17 -2
  68. package/dataflow/internal/linker.d.ts +3 -2
  69. package/dataflow/internal/linker.js +33 -24
  70. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +12 -9
  73. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  74. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +84 -16
  75. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +23 -16
  76. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +5 -5
  77. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
  78. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
  79. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
  80. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
  83. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
  86. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  87. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -0
  88. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +19 -4
  89. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -4
  91. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  92. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +3 -3
  93. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  94. package/dataflow/internal/process/functions/call/common.d.ts +4 -1
  95. package/dataflow/internal/process/functions/call/common.js +5 -3
  96. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
  97. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  98. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
  99. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
  100. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  101. package/dataflow/internal/process/process-named-call.d.ts +1 -1
  102. package/dataflow/internal/process/process-named-call.js +5 -5
  103. package/dataflow/origin/dfg-get-origin.d.ts +82 -0
  104. package/dataflow/origin/dfg-get-origin.js +116 -0
  105. package/documentation/doc-util/doc-cfg.d.ts +13 -6
  106. package/documentation/doc-util/doc-cfg.js +20 -15
  107. package/documentation/doc-util/doc-cli-option.js +4 -2
  108. package/documentation/doc-util/doc-dfg.js +3 -3
  109. package/documentation/doc-util/doc-escape.d.ts +7 -0
  110. package/documentation/doc-util/doc-escape.js +19 -0
  111. package/documentation/doc-util/doc-files.d.ts +1 -0
  112. package/documentation/doc-util/doc-files.js +2 -1
  113. package/documentation/doc-util/doc-normalized-ast.js +3 -3
  114. package/documentation/doc-util/doc-query.js +2 -2
  115. package/documentation/doc-util/doc-repl.js +1 -1
  116. package/documentation/doc-util/doc-search.js +1 -1
  117. package/documentation/doc-util/doc-server-message.js +2 -2
  118. package/documentation/doc-util/doc-structure.d.ts +1 -0
  119. package/documentation/doc-util/doc-structure.js +5 -0
  120. package/documentation/doc-util/doc-types.d.ts +7 -1
  121. package/documentation/doc-util/doc-types.js +13 -2
  122. package/documentation/print-capabilities-markdown.js +27 -1
  123. package/documentation/print-cfg-wiki.js +508 -20
  124. package/documentation/print-dataflow-graph-wiki.js +180 -25
  125. package/documentation/print-engines-wiki.js +1 -1
  126. package/documentation/print-faq-wiki.d.ts +1 -0
  127. package/documentation/print-faq-wiki.js +75 -0
  128. package/documentation/print-interface-wiki.js +1 -1
  129. package/documentation/print-linter-wiki.d.ts +1 -0
  130. package/documentation/print-linter-wiki.js +76 -0
  131. package/documentation/print-linting-and-testing-wiki.js +52 -36
  132. package/documentation/print-normalized-ast-wiki.js +1 -1
  133. package/documentation/print-onboarding-wiki.d.ts +1 -0
  134. package/documentation/print-onboarding-wiki.js +42 -0
  135. package/documentation/print-query-wiki.js +21 -1
  136. package/documentation/print-readme.js +10 -3
  137. package/linter/linter-executor.d.ts +9 -0
  138. package/linter/linter-executor.js +26 -0
  139. package/linter/linter-format.d.ts +65 -0
  140. package/linter/linter-format.js +9 -0
  141. package/linter/linter-rules.d.ts +42 -0
  142. package/linter/linter-rules.js +14 -0
  143. package/linter/rules/1-deprecated-functions.d.ts +34 -0
  144. package/linter/rules/1-deprecated-functions.js +54 -0
  145. package/linter/rules/2-file-path-validity.d.ts +48 -0
  146. package/linter/rules/2-file-path-validity.js +93 -0
  147. package/package.json +10 -6
  148. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
  149. package/queries/catalog/call-context-query/call-context-query-format.d.ts +3 -3
  150. package/queries/catalog/call-context-query/call-context-query-format.js +7 -3
  151. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
  152. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
  153. package/queries/catalog/cluster-query/cluster-query-format.d.ts +3 -1
  154. package/queries/catalog/cluster-query/cluster-query-format.js +6 -2
  155. package/queries/catalog/config-query/config-query-format.d.ts +2 -1
  156. package/queries/catalog/config-query/config-query-format.js +4 -3
  157. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +2 -1
  158. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +4 -3
  159. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +3 -1
  160. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -3
  161. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -2
  162. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -1
  163. package/queries/catalog/dependencies-query/dependencies-query-format.js +12 -3
  164. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  165. package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
  166. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +2 -1
  167. package/queries/catalog/happens-before-query/happens-before-query-format.js +4 -3
  168. package/queries/catalog/id-map-query/id-map-query-format.d.ts +2 -1
  169. package/queries/catalog/id-map-query/id-map-query-format.js +4 -3
  170. package/queries/catalog/lineage-query/lineage-query-format.d.ts +2 -1
  171. package/queries/catalog/lineage-query/lineage-query-format.js +7 -3
  172. package/queries/catalog/linter-query/linter-query-executor.d.ts +3 -0
  173. package/queries/catalog/linter-query/linter-query-executor.js +28 -0
  174. package/queries/catalog/linter-query/linter-query-format.d.ts +80 -0
  175. package/queries/catalog/linter-query/linter-query-format.js +43 -0
  176. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -1
  177. package/queries/catalog/location-map-query/location-map-query-format.js +4 -3
  178. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +2 -1
  179. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +4 -3
  180. package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
  181. package/queries/catalog/origin-query/origin-query-executor.js +33 -0
  182. package/queries/catalog/origin-query/origin-query-format.d.ts +73 -0
  183. package/queries/catalog/origin-query/origin-query-format.js +31 -0
  184. package/queries/catalog/project-query/project-query-executor.js +1 -1
  185. package/queries/catalog/project-query/project-query-format.d.ts +2 -1
  186. package/queries/catalog/project-query/project-query-format.js +4 -3
  187. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -1
  188. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +4 -3
  189. package/queries/catalog/search-query/search-query-format.d.ts +2 -1
  190. package/queries/catalog/search-query/search-query-format.js +7 -3
  191. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +3 -1
  192. package/queries/catalog/static-slice-query/static-slice-query-format.js +11 -3
  193. package/queries/query-print.d.ts +1 -1
  194. package/queries/query-print.js +4 -4
  195. package/queries/query.d.ts +143 -2
  196. package/queries/query.js +5 -1
  197. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
  198. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
  199. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
  200. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
  201. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  202. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
  203. package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
  204. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  205. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  206. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
  207. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  208. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  209. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
  210. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
  211. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  212. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
  213. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  214. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  215. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
  216. package/r-bridge/retriever.js +2 -2
  217. package/search/flowr-search-builder.d.ts +31 -2
  218. package/search/flowr-search-builder.js +30 -0
  219. package/search/flowr-search.d.ts +7 -1
  220. package/search/search-executor/search-enrichers.d.ts +73 -0
  221. package/search/search-executor/search-enrichers.js +98 -0
  222. package/search/search-executor/search-generators.d.ts +7 -2
  223. package/search/search-executor/search-generators.js +21 -1
  224. package/search/search-executor/search-mappers.d.ts +19 -0
  225. package/search/search-executor/search-mappers.js +21 -0
  226. package/search/search-executor/search-transformer.d.ts +13 -1
  227. package/search/search-executor/search-transformer.js +11 -1
  228. package/slicing/criterion/collect-all.js +1 -1
  229. package/slicing/static/slice-call.js +13 -3
  230. package/statistics/features/supported/assignments/post-process.js +1 -1
  231. package/statistics/features/supported/defined-functions/post-process.js +2 -2
  232. package/statistics/features/supported/used-functions/post-process.js +1 -1
  233. package/statistics/features/supported/used-packages/post-process.js +2 -2
  234. package/statistics/features/supported/values/post-process.js +2 -2
  235. package/statistics/output/print-stats.js +2 -2
  236. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  237. package/statistics/summarizer/post-process/clusterer.js +1 -1
  238. package/statistics/summarizer/post-process/histogram.js +3 -3
  239. package/statistics/summarizer/post-process/post-process-output.js +3 -3
  240. package/statistics/summarizer/second-phase/process.js +2 -2
  241. package/statistics/summarizer/summarizer.js +2 -2
  242. package/util/assert.js +36 -1
  243. package/util/cfg/cfg.d.ts +0 -80
  244. package/util/cfg/cfg.js +0 -549
  245. package/util/{arrays.d.ts → collections/arrays.d.ts} +1 -1
  246. package/util/{arrays.js → collections/arrays.js} +3 -3
  247. package/util/collections/set.js +17 -0
  248. package/util/diff-graph.d.ts +47 -0
  249. package/util/diff-graph.js +61 -0
  250. package/util/diff.d.ts +6 -6
  251. package/util/diff.js +1 -1
  252. package/util/mermaid/cfg.d.ts +9 -2
  253. package/util/mermaid/cfg.js +64 -12
  254. package/util/mermaid/dfg.d.ts +2 -1
  255. package/util/mermaid/dfg.js +26 -10
  256. package/util/mermaid/mermaid.d.ts +2 -0
  257. package/util/mermaid/mermaid.js +6 -0
  258. package/util/quads.js +1 -1
  259. package/util/schema.d.ts +1 -1
  260. package/util/schema.js +1 -1
  261. package/util/summarizer.js +1 -1
  262. package/util/{text.js → text/text.js} +1 -1
  263. package/util/{time.js → text/time.js} +1 -1
  264. package/util/version.js +1 -1
  265. package/dataflow/graph/diff.d.ts +0 -36
  266. package/util/cfg/happens-before.d.ts +0 -7
  267. package/util/cfg/visitor.d.ts +0 -9
  268. package/util/cfg/visitor.js +0 -30
  269. package/util/set.js +0 -31
  270. /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
  271. /package/util/{bimap.js → collections/bimap.js} +0 -0
  272. /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
  273. /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
  274. /package/util/{set.d.ts → collections/set.d.ts} +0 -0
  275. /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
  276. /package/util/{ansi.js → text/ansi.js} +0 -0
  277. /package/util/{args.d.ts → text/args.d.ts} +0 -0
  278. /package/util/{args.js → text/args.js} +0 -0
  279. /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
  280. /package/util/{strings.js → text/strings.js} +0 -0
  281. /package/util/{text.d.ts → text/text.d.ts} +0 -0
  282. /package/util/{time.d.ts → text/time.d.ts} +0 -0
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphDifferenceReport = void 0;
4
+ exports.initDiffContext = initDiffContext;
5
+ /**
6
+ * To be produced by a function differencing two graphs (e.g., {@link DataflowGraph|DFGs} or {@link ControlFlowGraph|CFGs}).
7
+ *
8
+ * @see {@link GraphDifferenceReport#isEqual|isEqual} - to check whether the graphs are equal
9
+ * @see {@link GraphDifferenceReport#addComment|addComment} - to add comments to the report
10
+ * @see {@link GraphDifferenceReport#comments|comments} - to get the attached comments
11
+ * @see {@link GraphDifferenceReport#problematic|problematic} - to get the problematic vertices/edges
12
+ */
13
+ class GraphDifferenceReport {
14
+ _comments = undefined;
15
+ _problematic = undefined;
16
+ addComment(comment, ...related) {
17
+ if (this._comments === undefined) {
18
+ this._comments = [comment];
19
+ }
20
+ else {
21
+ this._comments.push(comment);
22
+ }
23
+ if (related.length > 0) {
24
+ if (this._problematic === undefined) {
25
+ this._problematic = [...related];
26
+ }
27
+ else {
28
+ this._problematic.push(...related);
29
+ }
30
+ }
31
+ }
32
+ comments() {
33
+ return this._comments;
34
+ }
35
+ problematic() {
36
+ return this._problematic;
37
+ }
38
+ isEqual() {
39
+ return this._comments === undefined;
40
+ }
41
+ }
42
+ exports.GraphDifferenceReport = GraphDifferenceReport;
43
+ /**
44
+ * Create the context for differencing two graphs
45
+ */
46
+ function initDiffContext(left, right, config) {
47
+ return {
48
+ left: left.graph,
49
+ leftname: left.name,
50
+ right: right.graph,
51
+ rightname: right.name,
52
+ report: new GraphDifferenceReport(),
53
+ position: '',
54
+ config: {
55
+ rightIsSubgraph: false,
56
+ leftIsSubgraph: false,
57
+ ...config
58
+ }
59
+ };
60
+ }
61
+ //# sourceMappingURL=diff-graph.js.map
package/util/diff.d.ts CHANGED
@@ -12,14 +12,14 @@ import type { MergeableRecord } from './objects';
12
12
  */
13
13
  export interface DifferenceReport {
14
14
  /**
15
- * A human-readable description of differences during the comparison
16
- * In combination with {@link isEqual} this can be used to provide detailed
17
- * explanation on equal structures as well (e.g., if structures _could_ be equal).
18
- */
15
+ * A human-readable description of differences during the comparison
16
+ * In combination with {@link isEqual} this can be used to provide detailed
17
+ * explanation on equal structures as well (e.g., if structures _could_ be equal).
18
+ */
19
19
  comments(): readonly string[] | undefined;
20
20
  /**
21
- * @returns true iff the compared structures are equal (i.e., the diff is empty)
22
- */
21
+ * @returns true iff the compared structures are equal (i.e., the diff is empty)
22
+ */
23
23
  isEqual(): boolean;
24
24
  }
25
25
  export interface WriteableDifferenceReport extends DifferenceReport {
package/util/diff.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.setDifference = setDifference;
10
- const set_1 = require("./set");
10
+ const set_1 = require("./collections/set");
11
11
  function setDifference(left, right, info) {
12
12
  const lWithoutR = (0, set_1.setMinus)(left, right);
13
13
  const rWithoutL = (0, set_1.setMinus)(right, left);
@@ -1,6 +1,13 @@
1
- import type { ControlFlowInformation } from '../cfg/cfg';
2
1
  import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
- export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string): string;
2
+ import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
3
+ /**
4
+ * Convert the control flow graph to a mermaid string.
5
+ * @param cfg - The control flow graph to convert.
6
+ * @param normalizedAst - The normalized AST to use for the vertex content.
7
+ * @param prefix - The prefix to use for the mermaid string.
8
+ * @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
9
+ */
10
+ export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string, simplify?: boolean): string;
4
11
  /**
5
12
  * Use mermaid to visualize the normalized AST.
6
13
  */
@@ -3,27 +3,79 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cfgToMermaid = cfgToMermaid;
4
4
  exports.cfgToMermaidUrl = cfgToMermaidUrl;
5
5
  const mermaid_1 = require("./mermaid");
6
+ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
7
+ const control_flow_graph_1 = require("../../control-flow/control-flow-graph");
8
+ const reconstruct_1 = require("../../reconstruct/reconstruct");
9
+ const auto_select_defaults_1 = require("../../reconstruct/auto-select/auto-select-defaults");
6
10
  function getLexeme(n) {
7
- return n ? n.info.fullLexeme ?? n.lexeme ?? '<unknown>' : '';
11
+ return n ? n.info.fullLexeme ?? n.lexeme ?? '' : undefined;
8
12
  }
9
- function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n') {
13
+ function cfgOfNode(vert, normalizedVertex, id, content, output) {
14
+ if (normalizedVertex && content !== undefined) {
15
+ const start = vert.type === control_flow_graph_1.CfgVertexType.Expression ? '([' : '[';
16
+ const end = vert.type === control_flow_graph_1.CfgVertexType.Expression ? '])' : ']';
17
+ const name = `"\`${(0, mermaid_1.escapeMarkdown)(normalizedVertex.type)} (${id})${content ? '\n' + (0, mermaid_1.escapeMarkdown)(JSON.stringify(content)) : ''}${vert.callTargets ? '\n calls:' + (0, mermaid_1.escapeMarkdown)(JSON.stringify([...vert.callTargets])) : ''}\`"`;
18
+ output += ` n${id}${start}${name}${end}\n`;
19
+ }
20
+ else {
21
+ output += String(id).endsWith('-exit') ? ` n${id}((${id}))\n` : ` n${id}[[${id}]]\n`;
22
+ }
23
+ return output;
24
+ }
25
+ const getDirRegex = /flowchart\s+([A-Za-z]+)/;
26
+ /**
27
+ * Convert the control flow graph to a mermaid string.
28
+ * @param cfg - The control flow graph to convert.
29
+ * @param normalizedAst - The normalized AST to use for the vertex content.
30
+ * @param prefix - The prefix to use for the mermaid string.
31
+ * @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
32
+ */
33
+ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify = false) {
10
34
  let output = prefix;
11
- for (const [id, vertex] of cfg.graph.vertices()) {
12
- const normalizedVertex = normalizedAst.idMap.get(id);
35
+ const dirIs = getDirRegex.exec(prefix)?.at(1) ?? 'LR';
36
+ for (const [id, vertex] of cfg.graph.vertices(false)) {
37
+ const normalizedVertex = normalizedAst?.idMap.get(id);
13
38
  const content = getLexeme(normalizedVertex);
14
- if (content.length > 0) {
15
- const name = `"\`${(0, mermaid_1.escapeMarkdown)(vertex.name)} (${id})\n${(0, mermaid_1.escapeMarkdown)(JSON.stringify(content))}\`"`;
16
- output += ` n${id}[${name}]\n`;
39
+ if (vertex.name === type_1.RType.ExpressionList && vertex.type === control_flow_graph_1.CfgVertexType.Expression && cfg.graph.hasVertex(id + '-exit')) {
40
+ output += ` subgraph ${type_1.RType.ExpressionList} ${normalizedVertex?.info.fullLexeme ?? id}\n`;
41
+ output += ` direction ${dirIs}\n`;
42
+ }
43
+ if (vertex.type === control_flow_graph_1.CfgVertexType.Block) {
44
+ if (simplify) {
45
+ const ids = vertex.elems?.map(e => e.id) ?? [];
46
+ const reconstruct = (0, reconstruct_1.reconstructToCode)(normalizedAst, new Set(ids), auto_select_defaults_1.doNotAutoSelect).code;
47
+ const name = `"\`Basic Block (${id})\n${(0, mermaid_1.escapeMarkdown)(reconstruct)}\`"`;
48
+ output += ` n${id}[[${name}]]\n`;
49
+ }
50
+ else {
51
+ output += ` subgraph n${vertex.id} [Block ${normalizedVertex?.info.fullLexeme ?? id}]\n`;
52
+ output += ` direction ${dirIs}\n`;
53
+ let last = undefined;
54
+ for (const element of vertex.elems ?? []) {
55
+ const childNormalizedVertex = normalizedAst?.idMap.get(element.id);
56
+ const childContent = getLexeme(childNormalizedVertex);
57
+ output = cfgOfNode(vertex, childNormalizedVertex, element.id, childContent, output);
58
+ // just to keep the order
59
+ if (last) {
60
+ output += ` ${last} -.-> n${element.id}\n`;
61
+ }
62
+ last = `n${element.id}`;
63
+ }
64
+ output += ' end\n';
65
+ }
17
66
  }
18
67
  else {
19
- output += String(id).endsWith('-exit') ? ` n${id}((${id}))\n` : ` n${id}[[${id}]]\n`;
68
+ output = cfgOfNode(vertex, normalizedVertex, id, content, output);
69
+ }
70
+ if (vertex.name === type_1.RType.ExpressionList && vertex.type === control_flow_graph_1.CfgVertexType.EndMarker) {
71
+ output += ' end\n';
20
72
  }
21
73
  }
22
74
  for (const [from, targets] of cfg.graph.edges()) {
23
75
  for (const [to, edge] of targets) {
24
- const edgeType = edge.label === 'CD' ? '-->' : '-.->';
25
- const edgeSuffix = edge.label === 'CD' ? ` (${edge.when})` : '';
26
- output += ` n${from} ${edgeType}|"${(0, mermaid_1.escapeMarkdown)(edge.label)}${edgeSuffix}"| n${to}\n`;
76
+ const edgeType = edge.label === 1 /* CfgEdgeType.Cd */ ? '-->' : '-.->';
77
+ const edgeSuffix = edge.label === 1 /* CfgEdgeType.Cd */ ? ` (${edge.when})` : '';
78
+ output += ` n${from} ${edgeType}|"${(0, mermaid_1.escapeMarkdown)((0, control_flow_graph_1.edgeTypeToString)(edge.label))}${edgeSuffix}"| n${to}\n`;
27
79
  }
28
80
  }
29
81
  for (const entryPoint of cfg.entryPoints) {
@@ -37,7 +89,7 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n') {
37
89
  /**
38
90
  * Use mermaid to visualize the normalized AST.
39
91
  */
40
- function cfgToMermaidUrl(cfg, normalizedAst, prefix = '') {
92
+ function cfgToMermaidUrl(cfg, normalizedAst, prefix = 'flowchart BT\n') {
41
93
  return (0, mermaid_1.mermaidCodeToUrl)(cfgToMermaid(cfg, normalizedAst, prefix));
42
94
  }
43
95
  //# sourceMappingURL=cfg.js.map
@@ -17,12 +17,13 @@ interface MermaidGraph {
17
17
  markStyle: MermaidMarkStyle;
18
18
  /** in the form of from-\>to because I am lazy, see {@link encodeEdge} */
19
19
  presentEdges: Set<string>;
20
+ presentVertices: Set<string>;
20
21
  rootGraph: DataflowGraph;
21
22
  /** if given, the dataflow graph will only focus on the "important" parts */
22
23
  simplified?: boolean;
23
24
  }
24
25
  /**
25
- * Prints a {@link SourceRange|range} as a human readable string.
26
+ * Prints a {@link SourceRange|range} as a human-readable string.
26
27
  */
27
28
  export declare function formatRange(range: SourceRange | undefined): string;
28
29
  export declare function printIdentifier(id: IdentifierDefinition): string;
@@ -9,14 +9,16 @@ exports.diffGraphsToMermaidUrl = diffGraphsToMermaidUrl;
9
9
  const assert_1 = require("../assert");
10
10
  const mermaid_1 = require("./mermaid");
11
11
  const graph_1 = require("../../dataflow/graph/graph");
12
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
12
13
  const identifier_1 = require("../../dataflow/environments/identifier");
13
14
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
14
15
  const edge_1 = require("../../dataflow/graph/edge");
15
16
  const vertex_1 = require("../../dataflow/graph/vertex");
16
17
  const environment_1 = require("../../dataflow/environments/environment");
17
18
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
19
+ const built_in_1 = require("../../dataflow/environments/built-in");
18
20
  /**
19
- * Prints a {@link SourceRange|range} as a human readable string.
21
+ * Prints a {@link SourceRange|range} as a human-readable string.
20
22
  */
21
23
  function formatRange(range) {
22
24
  if (range === undefined) {
@@ -36,14 +38,14 @@ function subflowToMermaid(nodeId, exitPoints, subflow, mermaid, idPrefix = '') {
36
38
  if (subflow === undefined) {
37
39
  return;
38
40
  }
39
- const subflowId = `${idPrefix}flow-${nodeId}`;
41
+ const subflowId = (0, mermaid_1.escapeId)(`${idPrefix}flow-${nodeId}`);
40
42
  if (mermaid.simplified) {
41
43
  // get parent
42
44
  const idMap = mermaid.rootGraph.idMap;
43
45
  const node = idMap?.get(nodeId);
44
- const nodeLexeme = node?.info.fullLexeme ?? node?.lexeme ?? '??';
46
+ const nodeLexeme = node?.info.fullLexeme ?? node?.lexeme ?? 'function';
45
47
  const location = node?.location?.[0] ? ` (L. ${node?.location?.[0]})` : '';
46
- mermaid.nodeLines.push(`\nsubgraph "${subflowId}" ["${(0, mermaid_1.escapeMarkdown)(nodeLexeme ?? 'function')}${location}"]`);
48
+ mermaid.nodeLines.push(`\nsubgraph "${subflowId}" ["${(0, mermaid_1.escapeMarkdown)(nodeLexeme)}${location}"]`);
47
49
  }
48
50
  else {
49
51
  mermaid.nodeLines.push(`\nsubgraph "${subflowId}" [function ${nodeId}]`);
@@ -147,6 +149,7 @@ function printEnvironmentToLines(env) {
147
149
  function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
148
150
  const fCall = info.tag === vertex_1.VertexType.FunctionCall;
149
151
  const { open, close } = mermaidNodeBrackets(info.tag);
152
+ id = (0, mermaid_1.escapeId)(id);
150
153
  if (info.environment && mermaid.includeEnvironments) {
151
154
  if (info.environment.level > 0 || info.environment.current.memory.size !== 0) {
152
155
  mermaid.nodeLines.push(` %% Environment of ${id} [level: ${info.environment.level}]:`, printEnvironmentToLines(info.environment.current).map(x => ` %% ${x}`).join('\n'));
@@ -162,24 +165,29 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
162
165
  else {
163
166
  const escapedName = (0, mermaid_1.escapeMarkdown)(node ? `[${node.type}] ${lexeme}` : '??');
164
167
  const deps = info.cds ? ', :may:' + info.cds.map(c => c.id + (c.when ? '+' : '-')).join(',') : '';
168
+ const lnks = info.link?.origin ? ', :links:' + info.link.origin.join(',') : '';
165
169
  const n = node?.info.fullRange ?? node?.location ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0].location : undefined);
166
- mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps})\n *${formatRange(n)}*${fCall ? displayFunctionArgMapping(info.args) : ''}\`"${close}`);
170
+ mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps}${lnks})\n *${formatRange(n)}*${fCall ? displayFunctionArgMapping(info.args) : ''}\`"${close}`);
167
171
  }
168
172
  if (mark?.has(id)) {
169
173
  mermaid.nodeLines.push(` style ${idPrefix}${id} ${mermaid.markStyle.vertex} `);
170
174
  }
171
- if (mermaid.rootGraph.unknownSideEffects.has(id)) {
175
+ if ([...mermaid.rootGraph.unknownSideEffects].some(l => (0, node_id_1.normalizeIdToNumberIfPossible)(l) === (0, node_id_1.normalizeIdToNumberIfPossible)(id))) {
172
176
  mermaid.nodeLines.push(` style ${idPrefix}${id} stroke:red,stroke-width:5px; `);
173
177
  }
174
- const edges = mermaid.rootGraph.get(id, true);
178
+ const edges = mermaid.rootGraph.get((0, node_id_1.normalizeIdToNumberIfPossible)(id), true);
175
179
  (0, assert_1.guard)(edges !== undefined, `node ${id} must be found`);
176
180
  const artificialCdEdges = (info.cds ?? []).map(x => [x.id, { types: new Set([x.when ? 'CD-True' : 'CD-False']) }]);
177
- for (const [target, edge] of [...edges[1], ...artificialCdEdges]) {
181
+ // eslint-disable-next-line prefer-const
182
+ for (let [target, edge] of [...edges[1], ...artificialCdEdges]) {
183
+ const originalTarget = target;
184
+ target = (0, mermaid_1.escapeId)(target);
178
185
  const edgeTypes = typeof edge.types == 'number' ? new Set((0, edge_1.splitEdgeTypes)(edge.types)) : edge.types;
179
186
  const edgeId = encodeEdge(idPrefix + id, idPrefix + target, edgeTypes);
180
187
  if (!mermaid.presentEdges.has(edgeId)) {
181
188
  mermaid.presentEdges.add(edgeId);
182
- mermaid.edgeLines.push(` ${idPrefix}${id} -->|"${[...edgeTypes].map(e => typeof e === 'number' ? (0, edge_1.edgeTypeToName)(e) : e).join(', ')}"| ${idPrefix}${target}`);
189
+ const style = (0, built_in_1.isBuiltIn)(target) ? '-.->' : '-->';
190
+ mermaid.edgeLines.push(` ${idPrefix}${id} ${style}|"${[...edgeTypes].map(e => typeof e === 'number' ? (0, edge_1.edgeTypeToName)(e) : e).join(', ')}"| ${idPrefix}${target}`);
183
191
  if (mermaid.mark?.has(id + '->' + target)) {
184
192
  // who invented this syntax?!
185
193
  mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} ${mermaid.markStyle.edge}`);
@@ -187,6 +195,14 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
187
195
  if (edgeTypes.has('CD-True') || edgeTypes.has('CD-False')) {
188
196
  mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:gray,color:gray;`);
189
197
  }
198
+ if ((0, built_in_1.isBuiltIn)(target)) {
199
+ mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:gray;`);
200
+ if (!mermaid.presentVertices.has(target)) {
201
+ mermaid.nodeLines.push(` ${idPrefix}${target}["\`Built-In:\n${(0, mermaid_1.escapeMarkdown)(String(originalTarget).replace('built-in:', ''))}\`"]`);
202
+ mermaid.nodeLines.push(` style ${idPrefix}${target} stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;`);
203
+ mermaid.presentVertices.add(target);
204
+ }
205
+ }
190
206
  }
191
207
  }
192
208
  if (info.tag === 'function-definition') {
@@ -195,7 +211,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
195
211
  }
196
212
  // make the passing of root ids more performant again
197
213
  function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart BT', idPrefix = '', includeEnvironments = !simplified, mark, rootGraph, presentEdges = new Set(), markStyle = { vertex: 'stroke:teal,stroke-width:7px,stroke-opacity:.8;', edge: 'stroke:teal,stroke-width:4.2px,stroke-opacity:.8' } }) {
198
- const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle, simplified };
214
+ const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, presentVertices: new Set(), mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle, simplified };
199
215
  for (const [id, info] of graph.vertices(true)) {
200
216
  if (rootIds.has(id)) {
201
217
  vertexToMermaid(info, mermaid, id, idPrefix, mark);
@@ -1,7 +1,9 @@
1
1
  export declare function escapeMarkdown(text: string): string;
2
+ export declare function escapeId(text: string | number): string;
2
3
  /**
3
4
  * Converts mermaid code (potentially produced by {@link graphToMermaid}) to an url that presents the graph in the mermaid editor.
4
5
  *
5
6
  * @param code - code to convert
7
+ * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
6
8
  */
7
9
  export declare function mermaidCodeToUrl(code: string, edit?: boolean): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.escapeMarkdown = escapeMarkdown;
4
+ exports.escapeId = escapeId;
4
5
  exports.mermaidCodeToUrl = mermaidCodeToUrl;
5
6
  const replacements = {
6
7
  // keep newlines
@@ -45,10 +46,15 @@ function escapeMarkdown(text) {
45
46
  }
46
47
  return text;
47
48
  }
49
+ function escapeId(text) {
50
+ text = String(text).replace(/[^a-zA-Z0-9:-]/g, '_');
51
+ return text;
52
+ }
48
53
  /**
49
54
  * Converts mermaid code (potentially produced by {@link graphToMermaid}) to an url that presents the graph in the mermaid editor.
50
55
  *
51
56
  * @param code - code to convert
57
+ * @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
52
58
  */
53
59
  function mermaidCodeToUrl(code, edit = false) {
54
60
  const obj = {
package/util/quads.js CHANGED
@@ -19,7 +19,7 @@ const namedNode = (v) => n3_1.DataFactory.namedNode(v);
19
19
  const quad = (s, p, o, g) => n3_1.DataFactory.quad(s, p, o, g);
20
20
  const objects_1 = require("./objects");
21
21
  const assert_1 = require("./assert");
22
- const defaultmap_1 = require("./defaultmap");
22
+ const defaultmap_1 = require("./collections/defaultmap");
23
23
  const literal = (v, n) => n3_1.DataFactory.literal(v, n);
24
24
  const log_1 = require("./log");
25
25
  const domain = 'https://uni-ulm.de/r-ast/';
package/util/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type Joi from 'joi';
2
- import type { OutputFormatter } from './ansi';
2
+ import type { OutputFormatter } from './text/ansi';
3
3
  interface SchemaLine {
4
4
  level: number;
5
5
  text: string;
package/util/schema.js CHANGED
@@ -4,7 +4,7 @@ exports.describeSchema = describeSchema;
4
4
  exports.genericDescription = genericDescription;
5
5
  exports.headerLine = headerLine;
6
6
  exports.describeObject = describeObject;
7
- const ansi_1 = require("./ansi");
7
+ const ansi_1 = require("./text/ansi");
8
8
  function describeSchema(schema, f = ansi_1.formatter) {
9
9
  const description = schema.describe();
10
10
  const lines = genericDescription(1, f, f.format('.', { effect: ansi_1.ColorEffect.Foreground, color: 7 /* Colors.White */ }), description);
@@ -4,7 +4,7 @@ exports.Summarizer = void 0;
4
4
  exports.summarizedMeasurement2Csv = summarizedMeasurement2Csv;
5
5
  exports.summarizedMeasurement2CsvHeader = summarizedMeasurement2CsvHeader;
6
6
  exports.summarizeMeasurement = summarizeMeasurement;
7
- const arrays_1 = require("./arrays");
7
+ const arrays_1 = require("./collections/arrays");
8
8
  class Summarizer {
9
9
  config;
10
10
  log;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nth = nth;
4
- const assert_1 = require("./assert");
4
+ const assert_1 = require("../assert");
5
5
  function nth(n) {
6
6
  (0, assert_1.guard)(isFinite(n) && n >= 1, 'n must be a non-negative number');
7
7
  const num = String(n);
@@ -13,7 +13,7 @@ function date2string(date = new Date()) {
13
13
  /**
14
14
  * Print a number of milliseconds in a human-readable format including correct spacing.
15
15
  */
16
- function printAsMs(ms, precision = 2) {
16
+ function printAsMs(ms, precision = 1) {
17
17
  /* eslint-disable-next-line no-irregular-whitespace*/
18
18
  return `${ms.toFixed(precision)} ms`;
19
19
  }
package/util/version.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrVersion = flowrVersion;
4
4
  const semver_1 = require("semver");
5
5
  // this is automatically replaced with the current version by release-it
6
- const version = '2.2.12';
6
+ const version = '2.2.14';
7
7
  function flowrVersion() {
8
8
  return new semver_1.SemVer(version);
9
9
  }
@@ -1,36 +0,0 @@
1
- import type { DataflowGraph, FunctionArgument, OutgoingEdges } from './graph';
2
- import type { GenericDiffConfiguration, GenericDifferenceInformation, WriteableDifferenceReport } from '../../util/diff';
3
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
- interface ProblematicVertex {
5
- tag: 'vertex';
6
- id: NodeId;
7
- }
8
- interface ProblematicEdge {
9
- tag: 'edge';
10
- from: NodeId;
11
- to: NodeId;
12
- }
13
- export type ProblematicDiffInfo = ProblematicVertex | ProblematicEdge;
14
- export declare class DataflowDifferenceReport implements WriteableDifferenceReport {
15
- _comments: string[] | undefined;
16
- _problematic: ProblematicDiffInfo[] | undefined;
17
- addComment(comment: string, ...related: readonly ProblematicDiffInfo[]): void;
18
- comments(): readonly string[] | undefined;
19
- problematic(): readonly ProblematicDiffInfo[] | undefined;
20
- isEqual(): boolean;
21
- }
22
- export interface NamedGraph {
23
- name: string;
24
- graph: DataflowGraph;
25
- }
26
- interface DataflowDiffContext extends GenericDifferenceInformation<DataflowDifferenceReport> {
27
- left: DataflowGraph;
28
- right: DataflowGraph;
29
- config: GenericDiffConfiguration;
30
- }
31
- export declare function diffOfDataflowGraphs(left: NamedGraph, right: NamedGraph, config?: Partial<GenericDiffConfiguration>): DataflowDifferenceReport;
32
- export declare function equalFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[]): boolean;
33
- export declare function diffFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[], ctx: GenericDifferenceInformation<DataflowDifferenceReport>): void;
34
- export declare function diffVertices(ctx: DataflowDiffContext): void;
35
- export declare function diffEdges(ctx: DataflowDiffContext, id: NodeId, lEdges: OutgoingEdges | undefined, rEdges: OutgoingEdges | undefined): void;
36
- export {};
@@ -1,7 +0,0 @@
1
- import type { ControlFlowGraph } from './cfg';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
- import { Ternary } from '../logic';
4
- /**
5
- * Determines if node `a` happens before node `b` in the control flow graph.
6
- */
7
- export declare function happensBefore(cfg: ControlFlowGraph, a: NodeId, b: NodeId): Ternary;
@@ -1,9 +0,0 @@
1
- import type { ControlFlowGraph } from './cfg';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
- /**
4
- * Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
5
- * @param graph - The control flow graph.
6
- * @param startNode - The node to start the traversal from.
7
- * @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
8
- */
9
- export declare function visitCfgInReverseOrder(graph: ControlFlowGraph, startNode: NodeId, visitor: (node: NodeId) => boolean | void): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.visitCfgInReverseOrder = visitCfgInReverseOrder;
4
- /**
5
- * Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
6
- * @param graph - The control flow graph.
7
- * @param startNode - The node to start the traversal from.
8
- * @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
9
- */
10
- function visitCfgInReverseOrder(graph, startNode,
11
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- void is used to indicate that the return value is ignored/we never stop
12
- visitor) {
13
- const visited = new Set();
14
- const queue = [startNode];
15
- while (queue.length > 0) {
16
- const current = queue.pop();
17
- if (visited.has(current)) {
18
- continue;
19
- }
20
- visited.add(current);
21
- if (visitor(current)) {
22
- continue;
23
- }
24
- const incoming = graph.outgoing(current) ?? [];
25
- for (const [from] of incoming) {
26
- queue.push(from);
27
- }
28
- }
29
- }
30
- //# sourceMappingURL=visitor.js.map
package/util/set.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setEquals = setEquals;
4
- exports.setMinus = setMinus;
5
- /**
6
- * Given both sets, this checks if they contain the same elements.
7
- */
8
- function setEquals(a, b) {
9
- if (a.size !== b.size) {
10
- return false;
11
- }
12
- for (const item of a) {
13
- if (!b.has(item)) {
14
- return false;
15
- }
16
- }
17
- return true;
18
- }
19
- /**
20
- * Returns `A – B`
21
- */
22
- function setMinus(a, b) {
23
- const result = new Set();
24
- for (const item of a) {
25
- if (!b.has(item)) {
26
- result.add(item);
27
- }
28
- }
29
- return result;
30
- }
31
- //# sourceMappingURL=set.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes