@eagleoutice/flowr 2.6.3 → 2.7.2

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 (276) hide show
  1. package/README.md +22 -22
  2. package/abstract-interpretation/absint-visitor.d.ts +160 -0
  3. package/abstract-interpretation/absint-visitor.js +279 -0
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +4 -7
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +26 -16
  6. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -4
  7. package/abstract-interpretation/data-frame/mappers/access-mapper.js +11 -14
  8. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +10 -9
  9. package/abstract-interpretation/data-frame/mappers/arguments.js +8 -5
  10. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +18 -18
  11. package/abstract-interpretation/data-frame/mappers/function-mapper.js +53 -58
  12. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -5
  13. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +26 -29
  14. package/abstract-interpretation/data-frame/semantics.js +48 -44
  15. package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
  16. package/abstract-interpretation/data-frame/shape-inference.js +67 -90
  17. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -0
  18. package/abstract-interpretation/domains/abstract-domain.js +3 -2
  19. package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
  20. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  21. package/abstract-interpretation/domains/interval-domain.d.ts +4 -4
  22. package/abstract-interpretation/domains/interval-domain.js +3 -6
  23. package/abstract-interpretation/domains/lattice.d.ts +2 -0
  24. package/abstract-interpretation/domains/lattice.js +3 -1
  25. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -1
  26. package/abstract-interpretation/domains/positive-interval-domain.js +1 -1
  27. package/abstract-interpretation/domains/satisfiable-domain.d.ts +2 -2
  28. package/abstract-interpretation/domains/satisfiable-domain.js +2 -2
  29. package/abstract-interpretation/domains/set-range-domain.d.ts +104 -0
  30. package/abstract-interpretation/domains/set-range-domain.js +406 -0
  31. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
  32. package/abstract-interpretation/domains/set-upper-bound-domain.js +2 -2
  33. package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
  34. package/abstract-interpretation/domains/singleton-domain.js +2 -2
  35. package/benchmark/slicer.d.ts +2 -1
  36. package/benchmark/slicer.js +50 -29
  37. package/benchmark/stats/print.js +8 -5
  38. package/benchmark/stats/stats.d.ts +3 -2
  39. package/benchmark/summarizer/data.d.ts +11 -8
  40. package/benchmark/summarizer/first-phase/process.js +11 -8
  41. package/benchmark/summarizer/second-phase/process.js +24 -18
  42. package/cli/common/options.d.ts +431 -8
  43. package/cli/common/options.js +1 -1
  44. package/cli/common/scripts-info.d.ts +431 -7
  45. package/cli/flowr-main-options.d.ts +102 -2
  46. package/cli/flowr.d.ts +102 -2
  47. package/cli/repl/commands/repl-commands.d.ts +25 -0
  48. package/cli/repl/commands/repl-query.js +17 -5
  49. package/cli/wiki.d.ts +13 -0
  50. package/cli/wiki.js +7 -2
  51. package/config.d.ts +4 -4
  52. package/config.js +1 -1
  53. package/control-flow/basic-cfg-guided-visitor.js +7 -8
  54. package/control-flow/cfg-dead-code.js +3 -2
  55. package/control-flow/control-flow-graph.d.ts +1 -1
  56. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  57. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  58. package/control-flow/useless-loop.js +4 -2
  59. package/core/steps/all/static-slicing/00-slice.d.ts +3 -0
  60. package/core/steps/all/static-slicing/00-slice.js +2 -1
  61. package/core/steps/pipeline/default-pipelines.d.ts +42 -42
  62. package/dataflow/cluster.js +2 -2
  63. package/dataflow/environments/append.d.ts +5 -0
  64. package/dataflow/environments/append.js +6 -20
  65. package/dataflow/environments/built-in.d.ts +2 -1
  66. package/dataflow/environments/clone.d.ts +1 -1
  67. package/dataflow/environments/clone.js +3 -27
  68. package/dataflow/environments/define.d.ts +7 -3
  69. package/dataflow/environments/define.js +9 -56
  70. package/dataflow/environments/diff.js +1 -1
  71. package/dataflow/environments/environment.d.ts +48 -28
  72. package/dataflow/environments/environment.js +187 -62
  73. package/dataflow/environments/overwrite.js +2 -45
  74. package/dataflow/environments/reference-to-maybe.d.ts +13 -0
  75. package/dataflow/environments/reference-to-maybe.js +54 -0
  76. package/dataflow/environments/resolve-by-name.d.ts +6 -1
  77. package/dataflow/environments/resolve-by-name.js +56 -4
  78. package/dataflow/environments/scoping.d.ts +2 -2
  79. package/dataflow/environments/scoping.js +7 -7
  80. package/dataflow/eval/resolve/alias-tracking.d.ts +10 -4
  81. package/dataflow/eval/resolve/alias-tracking.js +16 -14
  82. package/dataflow/eval/resolve/resolve-argument.d.ts +2 -1
  83. package/dataflow/eval/resolve/resolve-argument.js +8 -8
  84. package/dataflow/eval/resolve/resolve.d.ts +13 -11
  85. package/dataflow/eval/resolve/resolve.js +16 -15
  86. package/dataflow/extractor.js +1 -7
  87. package/dataflow/fn/higher-order-function.d.ts +2 -1
  88. package/dataflow/fn/higher-order-function.js +4 -4
  89. package/dataflow/graph/dataflowgraph-builder.d.ts +9 -5
  90. package/dataflow/graph/dataflowgraph-builder.js +21 -11
  91. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  92. package/dataflow/graph/graph.d.ts +10 -2
  93. package/dataflow/graph/graph.js +41 -12
  94. package/dataflow/graph/invert-dfg.d.ts +3 -2
  95. package/dataflow/graph/invert-dfg.js +3 -3
  96. package/dataflow/graph/resolve-graph.d.ts +2 -1
  97. package/dataflow/graph/resolve-graph.js +2 -2
  98. package/dataflow/graph/vertex.d.ts +3 -3
  99. package/dataflow/graph/vertex.js +3 -3
  100. package/dataflow/info.d.ts +1 -1
  101. package/dataflow/internal/linker.d.ts +2 -0
  102. package/dataflow/internal/linker.js +13 -19
  103. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +7 -1
  104. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +12 -3
  105. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +3 -3
  106. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +2 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
  108. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +3 -3
  109. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +9 -9
  110. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -7
  111. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -3
  112. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -1
  113. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +9 -13
  114. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
  115. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.d.ts +3 -1
  116. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +8 -6
  117. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -1
  118. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  120. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +3 -3
  121. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +6 -4
  122. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  123. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -5
  124. package/dataflow/internal/process/functions/call/common.js +2 -3
  125. package/dataflow/internal/process/functions/call/known-call-handling.js +1 -1
  126. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +1 -1
  127. package/dataflow/internal/process/functions/process-argument.js +1 -1
  128. package/dataflow/internal/process/process-symbol.js +1 -1
  129. package/dataflow/internal/process/process-value.d.ts +1 -1
  130. package/dataflow/internal/process/process-value.js +7 -7
  131. package/dataflow/processor.d.ts +1 -5
  132. package/documentation/doc-capabilities.d.ts +1 -1
  133. package/documentation/doc-readme.d.ts +1 -1
  134. package/documentation/doc-util/doc-cfg.js +1 -1
  135. package/documentation/doc-util/doc-cli-option.d.ts +6 -6
  136. package/documentation/doc-util/doc-cli-option.js +3 -3
  137. package/documentation/doc-util/doc-dfg.d.ts +1 -1
  138. package/documentation/doc-util/doc-dfg.js +3 -2
  139. package/documentation/doc-util/doc-files.d.ts +3 -0
  140. package/documentation/doc-util/doc-files.js +4 -1
  141. package/documentation/doc-util/doc-normalized-ast.js +5 -4
  142. package/documentation/doc-util/doc-types.d.ts +1 -1
  143. package/documentation/doc-util/doc-types.js +2 -2
  144. package/documentation/issue-linting-rule.d.ts +1 -1
  145. package/documentation/wiki-analyzer.d.ts +1 -1
  146. package/documentation/wiki-analyzer.js +14 -1
  147. package/documentation/wiki-cfg.d.ts +1 -1
  148. package/documentation/wiki-core.d.ts +1 -1
  149. package/documentation/wiki-dataflow-graph.d.ts +1 -1
  150. package/documentation/wiki-dataflow-graph.js +10 -11
  151. package/documentation/wiki-engine.d.ts +1 -1
  152. package/documentation/wiki-engine.js +9 -10
  153. package/documentation/wiki-faq.d.ts +1 -1
  154. package/documentation/wiki-faq.js +0 -1
  155. package/documentation/wiki-interface.d.ts +1 -1
  156. package/documentation/wiki-interface.js +12 -13
  157. package/documentation/wiki-linter.d.ts +1 -1
  158. package/documentation/wiki-linter.js +1 -1
  159. package/documentation/wiki-linting-and-testing.d.ts +1 -1
  160. package/documentation/wiki-mk/doc-context.d.ts +54 -1
  161. package/documentation/wiki-mk/doc-context.js +17 -0
  162. package/documentation/wiki-mk/doc-maker.d.ts +5 -5
  163. package/documentation/wiki-mk/doc-maker.js +5 -2
  164. package/documentation/wiki-normalized-ast.d.ts +1 -1
  165. package/documentation/wiki-onboarding.d.ts +1 -1
  166. package/documentation/wiki-overview.d.ts +9 -0
  167. package/documentation/wiki-overview.js +248 -0
  168. package/documentation/wiki-query.d.ts +1 -1
  169. package/documentation/wiki-query.js +17 -1
  170. package/documentation/wiki-search.d.ts +1 -1
  171. package/documentation/wiki-setup.d.ts +9 -0
  172. package/documentation/wiki-setup.js +122 -0
  173. package/linter/linter-rules.d.ts +2 -2
  174. package/linter/rules/absolute-path.js +4 -4
  175. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  176. package/linter/rules/dataframe-access-validation.js +9 -11
  177. package/linter/rules/function-finder-util.d.ts +2 -2
  178. package/linter/rules/function-finder-util.js +1 -1
  179. package/linter/rules/network-functions.js +1 -1
  180. package/linter/rules/seeded-randomness.d.ts +1 -1
  181. package/linter/rules/seeded-randomness.js +5 -5
  182. package/linter/rules/unused-definition.js +1 -1
  183. package/package.json +1 -2
  184. package/project/context/flowr-analyzer-context.d.ts +11 -0
  185. package/project/context/flowr-analyzer-context.js +3 -0
  186. package/project/context/flowr-analyzer-environment-context.d.ts +47 -0
  187. package/project/context/flowr-analyzer-environment-context.js +50 -0
  188. package/project/context/flowr-analyzer-files-context.d.ts +9 -1
  189. package/project/context/flowr-analyzer-files-context.js +4 -0
  190. package/project/context/flowr-file.d.ts +2 -0
  191. package/project/context/flowr-file.js +2 -0
  192. package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
  193. package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
  194. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
  195. package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
  196. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  197. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  198. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
  199. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
  200. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
  201. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
  202. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  203. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
  204. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  205. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
  206. package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
  207. package/project/plugins/plugin-registry.d.ts +2 -1
  208. package/project/plugins/plugin-registry.js +2 -0
  209. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  210. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -4
  211. package/queries/catalog/control-flow-query/control-flow-query-format.js +3 -2
  212. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  213. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -4
  214. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  215. package/queries/catalog/df-shape-query/df-shape-query-executor.js +5 -3
  216. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +4 -4
  217. package/queries/catalog/df-shape-query/df-shape-query-format.js +2 -2
  218. package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
  219. package/queries/catalog/files-query/files-query-executor.js +49 -0
  220. package/queries/catalog/files-query/files-query-format.d.ts +36 -0
  221. package/queries/catalog/files-query/files-query-format.js +114 -0
  222. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  223. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  224. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
  225. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  226. package/queries/query.d.ts +10 -1
  227. package/queries/query.js +3 -1
  228. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
  229. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
  230. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
  232. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
  233. package/slicing/static/slice-call.d.ts +3 -2
  234. package/slicing/static/slice-call.js +4 -4
  235. package/slicing/static/static-slicer.d.ts +3 -1
  236. package/slicing/static/static-slicer.js +6 -7
  237. package/statistics/features/supported/control-flow/control-flow.js +1 -1
  238. package/statistics/features/supported/data-access/data-access.js +1 -1
  239. package/statistics/features/supported/used-functions/used-functions.js +1 -1
  240. package/statistics/features/supported/variables/variables.js +2 -1
  241. package/util/containers.js +2 -2
  242. package/util/files.d.ts +0 -7
  243. package/util/files.js +0 -41
  244. package/util/mermaid/ast.d.ts +3 -2
  245. package/util/mermaid/ast.js +13 -7
  246. package/util/mermaid/cfg.d.ts +3 -2
  247. package/util/mermaid/cfg.js +26 -6
  248. package/util/mermaid/dfg.d.ts +2 -7
  249. package/util/mermaid/dfg.js +10 -6
  250. package/util/mermaid/info.d.ts +17 -0
  251. package/util/mermaid/info.js +5 -0
  252. package/util/prefix.d.ts +9 -5
  253. package/util/prefix.js +14 -6
  254. package/util/r-regex.d.ts +21 -0
  255. package/util/r-regex.js +25 -0
  256. package/util/simple-df/dfg-view.d.ts +2 -1
  257. package/util/simple-df/dfg-view.js +2 -2
  258. package/util/text/args.js +12 -3
  259. package/util/version.js +1 -1
  260. package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
  261. package/abstract-interpretation/data-frame/absint-info.js +0 -31
  262. package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
  263. package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
  264. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -19
  265. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -33
  266. package/dataflow/environments/remove.d.ts +0 -12
  267. package/dataflow/environments/remove.js +0 -52
  268. package/documentation/doc-util/doc-print.d.ts +0 -5
  269. package/documentation/doc-util/doc-print.js +0 -36
  270. package/project/plugins/file-plugins/flowr-description-file.js +0 -37
  271. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  272. package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
  273. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
  274. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
  275. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
  276. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
@@ -7,6 +7,7 @@ const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor"
7
7
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
8
8
  const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
9
  const flowr_file_1 = require("../../project/context/flowr-file");
10
+ const info_1 = require("./info");
10
11
  function identifyMermaidDirection(prefix) {
11
12
  const directionMatch = prefix.match(/flowchart (TD|LR|RL|BT)/);
12
13
  if (directionMatch) {
@@ -17,14 +18,20 @@ function identifyMermaidDirection(prefix) {
17
18
  /**
18
19
  * Serialize the normalized AST to mermaid format
19
20
  */
20
- function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
21
+ function normalizedAstToMermaid(ast, { prefix = 'flowchart TD\n', markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds, mark } = {}) {
21
22
  let output = prefix;
22
23
  function showNode(n) {
24
+ if (includeOnlyIds && !includeOnlyIds.has(n.info.id)) {
25
+ return;
26
+ }
23
27
  const name = `${n.type} (${n.info.id})\\n${n.lexeme ?? ' '}`;
24
28
  output += ` n${n.info.id}(["${(0, mermaid_1.escapeMarkdown)(name)}"])\n`;
25
- if (n.info.parent !== undefined) {
29
+ if (mark?.has(n.info.id)) {
30
+ output += ` style n${n.info.id} ${markStyle.vertex}\n`;
31
+ }
32
+ if (n.info.parent !== undefined && (!includeOnlyIds || includeOnlyIds.has(n.info.parent))) {
26
33
  const context = n.info;
27
- const roleSuffix = context.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ || context.role === "call-argument" /* RoleInParent.FunctionCallArgument */ || context.role === "function-def-param" /* RoleInParent.FunctionDefinitionParameter */ ? `-${context.index}` : '';
34
+ const roleSuffix = context.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ || context.role === "call-arg" /* RoleInParent.FunctionCallArgument */ || context.role === "param" /* RoleInParent.FunctionDefinitionParameter */ ? `-${context.index}` : '';
28
35
  output += ` n${n.info.parent} -->|"${context.role}${roleSuffix}"| n${n.info.id}\n`;
29
36
  }
30
37
  if (n.type === type_1.RType.ExpressionList && n.grouping !== undefined) {
@@ -49,9 +56,8 @@ function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
49
56
  for (const f of ast.files) {
50
57
  // add a subgraph for each file
51
58
  if (ast.files.length !== 1 || (f.filePath && f.filePath !== flowr_file_1.FlowrFile.INLINE_PATH)) {
52
- output += ` subgraph "File: ${(0, mermaid_1.escapeMarkdown)(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}"\n`;
53
59
  const direction = identifyMermaidDirection(prefix);
54
- output += ` direction ${direction}\n`;
60
+ output += ` subgraph "File: ${(0, mermaid_1.escapeMarkdown)(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}" direction ${direction}\n`;
55
61
  showAst(f.root);
56
62
  output += ' end\n';
57
63
  }
@@ -68,7 +74,7 @@ function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
68
74
  /**
69
75
  * Use mermaid to visualize the normalized AST.
70
76
  */
71
- function normalizedAstToMermaidUrl(ast, prefix = 'flowchart TD\n') {
72
- return (0, mermaid_1.mermaidCodeToUrl)(normalizedAstToMermaid(ast, prefix));
77
+ function normalizedAstToMermaidUrl(ast, info) {
78
+ return (0, mermaid_1.mermaidCodeToUrl)(normalizedAstToMermaid(ast, info ?? {}));
73
79
  }
74
80
  //# sourceMappingURL=ast.js.map
@@ -1,5 +1,6 @@
1
1
  import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
2
2
  import { type ControlFlowInformation } from '../../control-flow/control-flow-graph';
3
+ import { type MermaidGraphPrinterInfo } from './info';
3
4
  /**
4
5
  * Convert the control flow graph to a mermaid string.
5
6
  * @param cfg - The control flow graph to convert.
@@ -7,8 +8,8 @@ import { type ControlFlowInformation } from '../../control-flow/control-flow-gra
7
8
  * @param prefix - The prefix to use for the mermaid string.
8
9
  * @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
9
10
  */
10
- export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string, simplify?: boolean): string;
11
+ export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, { prefix, simplify, markStyle, includeOnlyIds, mark }?: MermaidGraphPrinterInfo): string;
11
12
  /**
12
13
  * Use mermaid to visualize the normalized AST.
13
14
  */
14
- export declare function cfgToMermaidUrl(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string): string;
15
+ export declare function cfgToMermaidUrl(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, info?: MermaidGraphPrinterInfo): string;
@@ -7,6 +7,7 @@ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
7
7
  const control_flow_graph_1 = require("../../control-flow/control-flow-graph");
8
8
  const reconstruct_1 = require("../../reconstruct/reconstruct");
9
9
  const auto_select_defaults_1 = require("../../reconstruct/auto-select/auto-select-defaults");
10
+ const info_1 = require("./info");
10
11
  function getLexeme(n) {
11
12
  return n ? n.info.fullLexeme ?? n.lexeme ?? '' : undefined;
12
13
  }
@@ -30,7 +31,7 @@ const getDirRegex = /flowchart\s+([A-Za-z]+)/;
30
31
  * @param prefix - The prefix to use for the mermaid string.
31
32
  * @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
32
33
  */
33
- function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify = false) {
34
+ function cfgToMermaid(cfg, normalizedAst, { prefix = 'flowchart BT\n', simplify = false, markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds, mark } = {}) {
34
35
  let output = prefix;
35
36
  const dirIs = getDirRegex.exec(prefix)?.at(1) ?? 'LR';
36
37
  for (const [id, vertex] of cfg.graph.vertices(false)) {
@@ -52,6 +53,10 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
52
53
  output += ` direction ${dirIs}\n`;
53
54
  let last = undefined;
54
55
  for (const element of vertex.elems ?? []) {
56
+ if (includeOnlyIds && !includeOnlyIds.has(element.id)) {
57
+ last = undefined;
58
+ continue;
59
+ }
55
60
  const childNormalizedVertex = normalizedAst?.idMap.get(element.id);
56
61
  const childContent = getLexeme(childNormalizedVertex);
57
62
  output = cfgOfNode(vertex, childNormalizedVertex, element.id, childContent, output);
@@ -64,7 +69,7 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
64
69
  output += ' end\n';
65
70
  }
66
71
  }
67
- else {
72
+ else if (!includeOnlyIds || includeOnlyIds.has(id)) {
68
73
  output = cfgOfNode(vertex, normalizedVertex, id, content, output);
69
74
  }
70
75
  if (vertex.name === type_1.RType.ExpressionList && vertex.type === control_flow_graph_1.CfgVertexType.EndMarker) {
@@ -72,24 +77,39 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
72
77
  }
73
78
  }
74
79
  for (const [from, targets] of cfg.graph.edges()) {
80
+ if (includeOnlyIds && !includeOnlyIds.has(from)) {
81
+ continue;
82
+ }
75
83
  for (const [to, edge] of targets) {
84
+ if (includeOnlyIds && !includeOnlyIds.has(to)) {
85
+ continue;
86
+ }
76
87
  const edgeType = edge.label === 1 /* CfgEdgeType.Cd */ ? '-->' : '-.->';
77
88
  const edgeSuffix = edge.label === 1 /* CfgEdgeType.Cd */ ? ` (${edge.when})` : '';
78
89
  output += ` n${from} ${edgeType}|"${(0, mermaid_1.escapeMarkdown)((0, control_flow_graph_1.edgeTypeToString)(edge.label))}${edgeSuffix}"| n${to}\n`;
79
90
  }
80
91
  }
81
92
  for (const entryPoint of cfg.entryPoints) {
82
- output += ` style n${entryPoint} stroke:cyan,stroke-width:6.5px;`;
93
+ if (!includeOnlyIds || includeOnlyIds.has(entryPoint)) {
94
+ output += ` style n${entryPoint} stroke:cyan,stroke-width:6.5px;`;
95
+ }
83
96
  }
84
97
  for (const exitPoint of cfg.exitPoints) {
85
- output += ` style n${exitPoint} stroke:green,stroke-width:6.5px;`;
98
+ if (!includeOnlyIds || includeOnlyIds.has(exitPoint)) {
99
+ output += ` style n${exitPoint} stroke:green,stroke-width:6.5px;`;
100
+ }
101
+ }
102
+ if (mark) {
103
+ for (const id of mark.values()) {
104
+ output += ` style n${id} ${markStyle.vertex}`;
105
+ }
86
106
  }
87
107
  return output;
88
108
  }
89
109
  /**
90
110
  * Use mermaid to visualize the normalized AST.
91
111
  */
92
- function cfgToMermaidUrl(cfg, normalizedAst, prefix = 'flowchart BT\n') {
93
- return (0, mermaid_1.mermaidCodeToUrl)(cfgToMermaid(cfg, normalizedAst, prefix));
112
+ function cfgToMermaidUrl(cfg, normalizedAst, info) {
113
+ return (0, mermaid_1.mermaidCodeToUrl)(cfgToMermaid(cfg, normalizedAst, info ?? {}));
94
114
  }
95
115
  //# sourceMappingURL=cfg.js.map
@@ -2,13 +2,7 @@ import type { SourceRange } from '../range';
2
2
  import { type DataflowGraph } from '../../dataflow/graph/graph';
3
3
  import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
4
  import { type IdentifierDefinition } from '../../dataflow/environments/identifier';
5
- type MarkVertex = NodeId;
6
- type MarkEdge = `${string}->${string}`;
7
- export type MermaidMarkdownMark = MarkVertex | MarkEdge;
8
- export interface MermaidMarkStyle {
9
- readonly vertex: string;
10
- readonly edge: string;
11
- }
5
+ import { type MermaidMarkdownMark, type MermaidMarkStyle } from './info';
12
6
  interface MermaidGraph {
13
7
  nodeLines: string[];
14
8
  edgeLines: string[];
@@ -40,6 +34,7 @@ interface MermaidGraphConfiguration {
40
34
  rootGraph?: DataflowGraph;
41
35
  presentEdges?: Set<string>;
42
36
  simplified?: boolean;
37
+ includeOnlyIds?: ReadonlySet<NodeId>;
43
38
  }
44
39
  /**
45
40
  * Converts a dataflow graph to mermaid graph code that visualizes the graph.
@@ -15,6 +15,7 @@ const edge_1 = require("../../dataflow/graph/edge");
15
15
  const vertex_1 = require("../../dataflow/graph/vertex");
16
16
  const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
17
17
  const built_in_1 = require("../../dataflow/environments/built-in");
18
+ const info_1 = require("./info");
18
19
  /**
19
20
  * Prints a {@link SourceRange|range} as a human-readable string.
20
21
  */
@@ -108,7 +109,7 @@ function encodeEdge(from, to, types) {
108
109
  function mermaidNodeBrackets(tag) {
109
110
  let open;
110
111
  let close;
111
- if (tag === 'function-definition' || tag === 'variable-definition') {
112
+ if (tag === vertex_1.VertexType.FunctionDefinition || tag === vertex_1.VertexType.VariableDefinition) {
112
113
  open = '[';
113
114
  close = ']';
114
115
  }
@@ -147,7 +148,7 @@ function printEnvironmentToLines(env) {
147
148
  }
148
149
  return lines;
149
150
  }
150
- function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
151
+ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
151
152
  const fCall = info.tag === vertex_1.VertexType.FunctionCall;
152
153
  const { open, close } = mermaidNodeBrackets(info.tag);
153
154
  id = (0, mermaid_1.escapeId)(id);
@@ -184,6 +185,9 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
184
185
  const artificialCdEdges = (info.cds ?? []).map(x => [x.id, { types: new Set([x.when ? 'CD-True' : 'CD-False']) }]);
185
186
  // eslint-disable-next-line prefer-const
186
187
  for (let [target, edge] of [...edges[1], ...artificialCdEdges]) {
188
+ if (includeOnlyIds && !includeOnlyIds.has(target)) {
189
+ continue;
190
+ }
187
191
  const originalTarget = target;
188
192
  target = (0, mermaid_1.escapeId)(target);
189
193
  const edgeTypes = typeof edge.types == 'number' ? new Set((0, edge_1.splitEdgeTypes)(edge.types)) : edge.types;
@@ -209,16 +213,16 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
209
213
  }
210
214
  }
211
215
  }
212
- if (info.tag === 'function-definition') {
216
+ if (info.tag === vertex_1.VertexType.FunctionDefinition) {
213
217
  subflowToMermaid(id, info.exitPoints, info.subflow, mermaid, idPrefix);
214
218
  }
215
219
  }
216
220
  // make the passing of root ids more performant again
217
- 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' } }) {
221
+ function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart BT', idPrefix = '', includeEnvironments = !simplified, mark, rootGraph, presentEdges = new Set(), markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds }) {
218
222
  const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, presentVertices: new Set(), mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle, simplified };
219
223
  for (const [id, info] of graph.vertices(true)) {
220
224
  if (rootIds.has(id)) {
221
- vertexToMermaid(info, mermaid, id, idPrefix, mark);
225
+ vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds);
222
226
  }
223
227
  }
224
228
  return mermaid;
@@ -227,7 +231,7 @@ function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart B
227
231
  * Converts a dataflow graph to mermaid graph code that visualizes the graph.
228
232
  */
229
233
  function graphToMermaid(config) {
230
- const mermaid = graphToMermaidGraph(config.graph.rootIds(), config);
234
+ const mermaid = graphToMermaidGraph(config.includeOnlyIds ? config.includeOnlyIds : config.graph.rootIds(), config);
231
235
  return { string: `${mermaid.nodeLines.join('\n')}\n${mermaid.edgeLines.join('\n')}`, mermaid };
232
236
  }
233
237
  /**
@@ -0,0 +1,17 @@
1
+ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ type MarkVertex = NodeId;
3
+ type MarkEdge = `${string}->${string}`;
4
+ export type MermaidMarkdownMark = MarkVertex | MarkEdge;
5
+ export interface MermaidMarkStyle {
6
+ readonly vertex: string;
7
+ readonly edge: string;
8
+ }
9
+ export interface MermaidGraphPrinterInfo {
10
+ includeOnlyIds?: ReadonlySet<NodeId>;
11
+ mark?: ReadonlySet<MermaidMarkdownMark>;
12
+ markStyle?: MermaidMarkStyle;
13
+ prefix?: string;
14
+ simplify?: boolean;
15
+ }
16
+ export declare const MermaidDefaultMarkStyle: MermaidMarkStyle;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MermaidDefaultMarkStyle = void 0;
4
+ exports.MermaidDefaultMarkStyle = { vertex: 'stroke:teal,stroke-width:7px,stroke-opacity:.8;', edge: 'stroke:teal,stroke-width:4.2px,stroke-opacity:.8' };
5
+ //# sourceMappingURL=info.js.map
package/util/prefix.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  /**
2
- * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
2
+ * Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
3
3
  * if it is unique!
4
+ * Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
5
+ * following R's pmatch semantics.
4
6
  * @example
5
7
  * ```typescript
6
- * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
7
- * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
8
- * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
9
- * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
8
+ * findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
9
+ * findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
10
+ * findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
11
+ * findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
12
+ * findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
13
+ * findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
10
14
  * ```
11
15
  */
12
16
  export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[] | MapIterator<string>): string | undefined;
package/util/prefix.js CHANGED
@@ -2,14 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findByPrefixIfUnique = findByPrefixIfUnique;
4
4
  /**
5
- * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
5
+ * Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
6
6
  * if it is unique!
7
+ * Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
8
+ * following R's pmatch semantics.
7
9
  * @example
8
10
  * ```typescript
9
- * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
10
- * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
11
- * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
12
- * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
11
+ * findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
12
+ * findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
13
+ * findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
14
+ * findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
15
+ * findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
16
+ * findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
13
17
  * ```
14
18
  */
15
19
  function findByPrefixIfUnique(prefix, keys) {
@@ -17,11 +21,15 @@ function findByPrefixIfUnique(prefix, keys) {
17
21
  return undefined;
18
22
  }
19
23
  let found = undefined;
24
+ let matchPartial = true;
20
25
  for (const key of keys) {
21
26
  if (key === prefix) {
22
27
  return key;
23
28
  }
24
- if (key.startsWith(prefix)) {
29
+ if (key === '...') {
30
+ matchPartial = false;
31
+ }
32
+ else if (matchPartial && key.startsWith(prefix)) {
25
33
  if (found) {
26
34
  return undefined;
27
35
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Represents R's `.standard_regexps` definitions.
3
+ * @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
4
+ */
5
+ export declare const RStandardRegexp: {
6
+ /** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
7
+ ValidPackageName: RegExp;
8
+ /** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
9
+ ValidPackageVersion: RegExp;
10
+ /** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
11
+ ValidRSystemVersion: RegExp;
12
+ /** `([[:digit:]]+[.-])*[[:digit:]]+` */
13
+ ValidNumericVersion: RegExp;
14
+ };
15
+ /**
16
+ * Based on the C-definition:
17
+ * ```txt
18
+ * !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
19
+ * ```
20
+ */
21
+ export declare const RPunctuationChars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RPunctuationChars = exports.RStandardRegexp = void 0;
4
+ /**
5
+ * Represents R's `.standard_regexps` definitions.
6
+ * @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
7
+ */
8
+ exports.RStandardRegexp = {
9
+ /** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
10
+ ValidPackageName: (/[A-Za-z][A-Za-z0-9._]*[A-Za-z0-9]/),
11
+ /** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
12
+ ValidPackageVersion: (/([0-9]+[.-])+[0-9]+/),
13
+ /** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
14
+ ValidRSystemVersion: (/[0-9]+\.[0-9]+\.[0-9]+/),
15
+ /** `([[:digit:]]+[.-])*[[:digit:]]+` */
16
+ ValidNumericVersion: /([0-9]+[.-])*[0-9]+/
17
+ };
18
+ /**
19
+ * Based on the C-definition:
20
+ * ```txt
21
+ * !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
22
+ * ```
23
+ */
24
+ exports.RPunctuationChars = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~';
25
+ //# sourceMappingURL=r-regex.js.map
@@ -2,6 +2,7 @@ import { DataflowGraph } from '../../dataflow/graph/graph';
2
2
  import { VertexType } from '../../dataflow/graph/vertex';
3
3
  import { type MergeableRecord } from '../objects';
4
4
  import type { DeepPartial } from 'ts-essentials';
5
+ import type { REnvironmentInformation } from '../../dataflow/environments/environment';
5
6
  export interface ReduceVertexOptions extends MergeableRecord {
6
7
  tags: VertexType[];
7
8
  nameRegex: string;
@@ -16,4 +17,4 @@ export interface ReduceOptions extends MergeableRecord {
16
17
  /**
17
18
  * Produces a reduced version of the given dataflow graph according to the given options.
18
19
  */
19
- export declare function reduceDfg(dfg: DataflowGraph, options: DeepPartial<ReduceOptions>): DataflowGraph;
20
+ export declare function reduceDfg(dfg: DataflowGraph, options: DeepPartial<ReduceOptions>, cleanEnv: REnvironmentInformation): DataflowGraph;
@@ -36,7 +36,7 @@ function makeFilter(options, idMap) {
36
36
  /**
37
37
  * Produces a reduced version of the given dataflow graph according to the given options.
38
38
  */
39
- function reduceDfg(dfg, options) {
39
+ function reduceDfg(dfg, options, cleanEnv) {
40
40
  const newDfg = new graph_1.DataflowGraph(dfg.idMap);
41
41
  const applyOptions = (0, objects_1.deepMergeObject)(defaultReduceOptions, options);
42
42
  // overwrite the tag set if possible
@@ -48,7 +48,7 @@ function reduceDfg(dfg, options) {
48
48
  for (const [id, info] of dfg.vertices(!applyOptions)) {
49
49
  const result = applyFilter(info);
50
50
  if (result) {
51
- newDfg.addVertex(result, dfg.isRoot(id));
51
+ newDfg.addVertex(result, cleanEnv, dfg.isRoot(id));
52
52
  }
53
53
  }
54
54
  for (const [from, out] of dfg.edges()) {
package/util/text/args.js CHANGED
@@ -55,10 +55,19 @@ function splitAtEscapeSensitive(inputString, escapeQuote = true, split = ' ') {
55
55
  current = '';
56
56
  }
57
57
  else if (c === '"' || c === "'") {
58
- inQuotes = !inQuotes;
59
- if (!escapeQuote) {
60
- current += c;
58
+ if (!inQuotes) {
59
+ inQuotes = c;
60
+ if (escapeQuote) {
61
+ continue;
62
+ }
61
63
  }
64
+ else if (inQuotes === c) {
65
+ inQuotes = false;
66
+ if (escapeQuote) {
67
+ continue;
68
+ }
69
+ }
70
+ current += c;
62
71
  }
63
72
  else if (c === '\\' && escapeQuote) {
64
73
  escaped = true;
package/util/version.js CHANGED
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
8
  // this is automatically replaced with the current version by release-it
9
- const version = '2.6.3';
9
+ const version = '2.7.2';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */
@@ -1,109 +0,0 @@
1
- import type { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
2
- import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
- import type { DataFrameStateDomain } from './dataframe-domain';
5
- import type { ConstraintType, DataFrameOperationArgs, DataFrameOperationName, DataFrameOperationOptions } from './semantics';
6
- /**
7
- * An abstract data frame operation without additional options.
8
- * - `operation` contains the type of the abstract operation (see {@link DataFrameOperationName})
9
- * - `operand` contains the ID of the data frame operand of the operation (may be `undefined`)
10
- * - `...args` contains the arguments of the abstract operation (see {@link DataFrameOperationArgs})
11
- */
12
- export type DataFrameOperationType<OperationName extends DataFrameOperationName = DataFrameOperationName> = {
13
- [Name in OperationName]: {
14
- operation: Name;
15
- operand: NodeId | undefined;
16
- } & DataFrameOperationArgs<Name>;
17
- }[OperationName];
18
- /**
19
- * An abstract data frame operation.
20
- * - `operation` contains the type of the abstract operation (see {@link DataFrameOperationName})
21
- * - `operand` contains the ID of the data frame operand of the operation (may be `undefined`)
22
- * - `type` optionally contains the constraint type to overwrite the default type of the operation (see {@link ConstraintType})
23
- * - `options` optionally contains additional options for the abstract operation (see {@link DataFrameOperationOptions})
24
- * - `...args` contains the arguments of the abstract operation (see {@link DataFrameOperationArgs})
25
- */
26
- export type DataFrameOperation<OperationName extends DataFrameOperationName = DataFrameOperationName> = {
27
- [Name in OperationName]: {
28
- operation: Name;
29
- operand: NodeId | undefined;
30
- type?: ConstraintType;
31
- options?: DataFrameOperationOptions<Name>;
32
- } & DataFrameOperationArgs<Name>;
33
- }[OperationName];
34
- /**
35
- * Represents the base data frame information stored in the abstract interpretation info of an AST node.
36
- * - `type` optionally defines the type of the extra information stored in the data frame info
37
- * - `domain` contains the abstract data frame shape state of the node
38
- * This may not be present if the data frame shape inference has not been executed yet or the program contains no data frames
39
- */
40
- interface DataFrameInfoBase {
41
- type?: string;
42
- domain?: DataFrameStateDomain;
43
- }
44
- /** Enum to mark nodes during the data frame shape inference */
45
- export declare enum DataFrameInfoMarker {
46
- /** Marks the target symbol of assignments as "unassigned" until the assigned expression is evaluated */
47
- Unassigned = "unassigned"
48
- }
49
- /**
50
- * Represents the data frame information for a node without extra data frame information,
51
- * i.e. for all nodes that do not represent a data frame assignment or data frame operation (this is the default).
52
- *
53
- * The `marker` can be used to mark nodes during the data frame shape inference.
54
- */
55
- interface DataFrameEmptyInfo extends DataFrameInfoBase {
56
- type?: never;
57
- marker?: DataFrameInfoMarker;
58
- }
59
- /**
60
- * Represents the data frame information for a data frame assignment with a target identifier (symbol/string) and an assigned expression.
61
- * This is used during data frame shape inference to mark assignments of data frame expressions to an identifier.
62
- *
63
- * Use {@link hasDataFrameAssignmentInfo} to check whether an AST node has attached data frame assignment information.
64
- */
65
- export interface DataFrameAssignmentInfo extends DataFrameInfoBase {
66
- type: 'assignment';
67
- identifier: NodeId;
68
- expression: NodeId;
69
- }
70
- /**
71
- * Represents the data frame information for a data frame function/operation with mapped abstract operations.
72
- * This is used during data frame shape inference to store the abstract operations a data frame function/operation is mapped to.
73
- *
74
- * The order of the abstract operations is the order in which their semantics are applied (for example, access operations are typically before other operations in the list).
75
- * Moreover, abstract operations that take the result of previous abstract operation as data frame operand must have the `operand` set to `undefined`.
76
- *
77
- * Use {@link hasDataFrameExpressionInfo} to check whether an AST node has attached data frame expression information.
78
- */
79
- export interface DataFrameExpressionInfo extends DataFrameInfoBase {
80
- type: 'expression';
81
- operations: DataFrameOperation[];
82
- }
83
- /**
84
- * Represents the data frame shape inference information stored in the abstract interpretation info of AST nodes.
85
- */
86
- export type DataFrameInfo = DataFrameEmptyInfo | DataFrameAssignmentInfo | DataFrameExpressionInfo;
87
- /**
88
- * Represents the abstract interpretation information attached to AST nodes.
89
- */
90
- export interface AbstractInterpretationInfo {
91
- dataFrame?: DataFrameInfo;
92
- }
93
- /**
94
- * Checks whether an AST node has attached data frame assignment information.
95
- */
96
- export declare function hasDataFrameAssignmentInfo<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>): node is RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo & {
97
- dataFrame: DataFrameAssignmentInfo;
98
- }>;
99
- /**
100
- * Checks whether an AST node has attached data frame expression information.
101
- */
102
- export declare function hasDataFrameExpressionInfo<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>): node is RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo & {
103
- dataFrame: DataFrameExpressionInfo;
104
- }>;
105
- /**
106
- * Checks whether an AST node has an attached data frame info marker.
107
- */
108
- export declare function hasDataFrameInfoMarker<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>, marker: DataFrameInfoMarker): boolean;
109
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataFrameInfoMarker = void 0;
4
- exports.hasDataFrameAssignmentInfo = hasDataFrameAssignmentInfo;
5
- exports.hasDataFrameExpressionInfo = hasDataFrameExpressionInfo;
6
- exports.hasDataFrameInfoMarker = hasDataFrameInfoMarker;
7
- /** Enum to mark nodes during the data frame shape inference */
8
- var DataFrameInfoMarker;
9
- (function (DataFrameInfoMarker) {
10
- /** Marks the target symbol of assignments as "unassigned" until the assigned expression is evaluated */
11
- DataFrameInfoMarker["Unassigned"] = "unassigned";
12
- })(DataFrameInfoMarker || (exports.DataFrameInfoMarker = DataFrameInfoMarker = {}));
13
- /**
14
- * Checks whether an AST node has attached data frame assignment information.
15
- */
16
- function hasDataFrameAssignmentInfo(node) {
17
- return node.info.dataFrame?.type === 'assignment';
18
- }
19
- /**
20
- * Checks whether an AST node has attached data frame expression information.
21
- */
22
- function hasDataFrameExpressionInfo(node) {
23
- return node.info.dataFrame?.type === 'expression';
24
- }
25
- /**
26
- * Checks whether an AST node has an attached data frame info marker.
27
- */
28
- function hasDataFrameInfoMarker(node, marker) {
29
- return node.info.dataFrame?.type === undefined && node.info.dataFrame?.marker === marker;
30
- }
31
- //# sourceMappingURL=absint-info.js.map