@eagleoutice/flowr 2.6.2 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/README.md +36 -34
  2. package/abstract-interpretation/data-frame/absint-visitor.js +3 -3
  3. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +7 -7
  4. package/abstract-interpretation/data-frame/mappers/function-mapper.js +20 -16
  5. package/abstract-interpretation/data-frame/semantics.js +8 -0
  6. package/abstract-interpretation/data-frame/shape-inference.d.ts +3 -3
  7. package/abstract-interpretation/data-frame/shape-inference.js +3 -3
  8. package/abstract-interpretation/normalized-ast-fold.d.ts +1 -1
  9. package/benchmark/slicer.d.ts +1 -0
  10. package/benchmark/slicer.js +13 -12
  11. package/benchmark/summarizer/first-phase/process.js +1 -1
  12. package/benchmark/summarizer/second-phase/graph.d.ts +3 -1
  13. package/benchmark/summarizer/second-phase/graph.js +3 -1
  14. package/cli/export-quads-app.js +1 -1
  15. package/cli/repl/commands/repl-dataflow.js +2 -1
  16. package/cli/repl/commands/repl-parse.js +16 -4
  17. package/cli/repl/commands/repl-query.js +1 -1
  18. package/cli/repl/core.js +16 -13
  19. package/cli/repl/server/connection.js +2 -1
  20. package/cli/script-core/statistics-helper-core.js +2 -1
  21. package/cli/slicer-app.js +3 -4
  22. package/cli/wiki.d.ts +4 -0
  23. package/cli/wiki.js +165 -0
  24. package/config.d.ts +4 -0
  25. package/config.js +6 -0
  26. package/control-flow/cfg-dead-code.js +13 -3
  27. package/control-flow/cfg-simplification.d.ts +5 -2
  28. package/control-flow/cfg-simplification.js +3 -0
  29. package/control-flow/extract-cfg.d.ts +9 -3
  30. package/control-flow/extract-cfg.js +44 -4
  31. package/control-flow/semantic-cfg-guided-visitor.d.ts +2 -2
  32. package/control-flow/simple-visitor.js +2 -2
  33. package/control-flow/useless-loop.d.ts +3 -3
  34. package/control-flow/useless-loop.js +14 -5
  35. package/core/pipeline-executor.d.ts +3 -6
  36. package/core/pipeline-executor.js +4 -7
  37. package/core/print/normalize-printer.d.ts +1 -1
  38. package/core/print/normalize-printer.js +2 -2
  39. package/core/steps/all/core/00-parse.d.ts +1 -1
  40. package/core/steps/all/core/00-parse.js +1 -1
  41. package/core/steps/all/core/10-normalize.d.ts +3 -9
  42. package/core/steps/all/core/10-normalize.js +1 -16
  43. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -3
  44. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -3
  45. package/core/steps/all/core/20-dataflow.d.ts +3 -4
  46. package/core/steps/all/core/20-dataflow.js +2 -2
  47. package/core/steps/all/static-slicing/00-slice.d.ts +1 -2
  48. package/core/steps/all/static-slicing/00-slice.js +1 -1
  49. package/core/steps/all/static-slicing/10-reconstruct.d.ts +8 -0
  50. package/core/steps/all/static-slicing/10-reconstruct.js +4 -1
  51. package/core/steps/pipeline/default-pipelines.d.ts +55 -56
  52. package/core/steps/pipeline/default-pipelines.js +8 -8
  53. package/dataflow/environments/clone.d.ts +0 -1
  54. package/dataflow/environments/clone.js +12 -2
  55. package/dataflow/environments/diff.js +2 -2
  56. package/dataflow/environments/overwrite.d.ts +1 -5
  57. package/dataflow/environments/overwrite.js +3 -19
  58. package/dataflow/environments/scoping.d.ts +6 -2
  59. package/dataflow/environments/scoping.js +6 -2
  60. package/dataflow/eval/resolve/resolve-argument.js +2 -2
  61. package/dataflow/eval/values/string/string-constants.d.ts +9 -3
  62. package/dataflow/eval/values/string/string-constants.js +9 -3
  63. package/dataflow/extractor.d.ts +2 -3
  64. package/dataflow/extractor.js +25 -22
  65. package/dataflow/graph/graph.d.ts +3 -9
  66. package/dataflow/graph/graph.js +0 -13
  67. package/dataflow/graph/unknown-replacement.d.ts +4 -2
  68. package/dataflow/graph/unknown-replacement.js +4 -2
  69. package/dataflow/info.d.ts +7 -0
  70. package/dataflow/info.js +21 -0
  71. package/dataflow/internal/linker.js +7 -4
  72. package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -2
  73. package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -3
  74. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
  75. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  77. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +4 -4
  78. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +6 -6
  79. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -1
  80. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  81. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
  82. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  86. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +3 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +6 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +6 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +15 -10
  91. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +78 -75
  92. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +3 -1
  93. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -1
  94. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  95. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  96. package/dataflow/internal/process/functions/call/common.d.ts +1 -1
  97. package/dataflow/internal/process/functions/call/common.js +4 -4
  98. package/dataflow/internal/process/functions/call/default-call-handling.d.ts +3 -1
  99. package/dataflow/internal/process/functions/call/default-call-handling.js +3 -1
  100. package/dataflow/internal/process/functions/call/known-call-handling.js +3 -3
  101. package/dataflow/internal/process/functions/call/named-call-handling.js +4 -4
  102. package/dataflow/internal/process/functions/process-parameter.js +4 -4
  103. package/dataflow/origin/dfg-get-symbol-refs.d.ts +1 -1
  104. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  105. package/dataflow/processor.d.ts +6 -11
  106. package/documentation/data/dfg/doc-data-dfg-util.d.ts +0 -2
  107. package/documentation/data/faq/faqs.js +27 -18
  108. package/documentation/data/faq/recommended-configs.d.ts +36 -0
  109. package/documentation/data/faq/recommended-configs.js +40 -0
  110. package/documentation/data/faq/wiki-faq-store.d.ts +1 -0
  111. package/documentation/data/faq/wiki-faq-store.js +10 -2
  112. package/documentation/data/server/doc-data-server-messages.js +1 -1
  113. package/documentation/doc-capabilities.d.ts +9 -0
  114. package/documentation/{print-capabilities-markdown.js → doc-capabilities.js} +18 -21
  115. package/documentation/doc-readme.d.ts +9 -0
  116. package/documentation/{print-readme.js → doc-readme.js} +31 -35
  117. package/documentation/doc-util/doc-benchmarks.d.ts +6 -4
  118. package/documentation/doc-util/doc-benchmarks.js +6 -4
  119. package/documentation/doc-util/doc-cfg.js +5 -8
  120. package/documentation/doc-util/doc-dfg.d.ts +7 -7
  121. package/documentation/doc-util/doc-dfg.js +13 -13
  122. package/documentation/doc-util/doc-escape.d.ts +6 -0
  123. package/documentation/doc-util/doc-escape.js +11 -0
  124. package/documentation/doc-util/doc-general.d.ts +22 -2
  125. package/documentation/doc-util/doc-general.js +22 -2
  126. package/documentation/doc-util/doc-normalized-ast.d.ts +10 -5
  127. package/documentation/doc-util/doc-normalized-ast.js +12 -9
  128. package/documentation/doc-util/doc-query.d.ts +12 -4
  129. package/documentation/doc-util/doc-query.js +18 -11
  130. package/documentation/doc-util/doc-search.d.ts +0 -30
  131. package/documentation/doc-util/doc-search.js +2 -73
  132. package/documentation/doc-util/doc-server-message.d.ts +5 -5
  133. package/documentation/doc-util/doc-server-message.js +4 -4
  134. package/documentation/doc-util/doc-types.d.ts +69 -32
  135. package/documentation/doc-util/doc-types.js +108 -61
  136. package/documentation/index.d.ts +9 -9
  137. package/documentation/index.js +9 -9
  138. package/documentation/issue-linting-rule.d.ts +9 -0
  139. package/documentation/{print-linter-issue.js → issue-linting-rule.js} +20 -23
  140. package/documentation/wiki-analyzer.d.ts +9 -0
  141. package/documentation/wiki-analyzer.js +412 -0
  142. package/documentation/wiki-cfg.d.ts +9 -0
  143. package/documentation/{print-cfg-wiki.js → wiki-cfg.js} +144 -160
  144. package/documentation/wiki-core.d.ts +14 -0
  145. package/documentation/{print-core-wiki.js → wiki-core.js} +164 -175
  146. package/documentation/wiki-dataflow-graph.d.ts +9 -0
  147. package/documentation/{print-dataflow-graph-wiki.js → wiki-dataflow-graph.js} +142 -172
  148. package/documentation/wiki-engine.d.ts +9 -0
  149. package/documentation/{print-engines-wiki.js → wiki-engine.js} +27 -42
  150. package/documentation/wiki-faq.d.ts +8 -0
  151. package/documentation/wiki-faq.js +22 -0
  152. package/documentation/wiki-interface.d.ts +9 -0
  153. package/documentation/{print-interface-wiki.js → wiki-interface.js} +59 -56
  154. package/documentation/wiki-linter.d.ts +9 -0
  155. package/documentation/{print-linter-wiki.js → wiki-linter.js} +52 -48
  156. package/documentation/wiki-linting-and-testing.d.ts +9 -0
  157. package/documentation/{print-linting-and-testing-wiki.js → wiki-linting-and-testing.js} +25 -32
  158. package/documentation/wiki-mk/doc-context.d.ts +186 -0
  159. package/documentation/wiki-mk/doc-context.js +84 -0
  160. package/documentation/wiki-mk/doc-maker.d.ts +95 -0
  161. package/documentation/wiki-mk/doc-maker.js +133 -0
  162. package/documentation/wiki-normalized-ast.d.ts +9 -0
  163. package/documentation/{print-normalized-ast-wiki.js → wiki-normalized-ast.js} +64 -47
  164. package/documentation/wiki-onboarding.d.ts +8 -0
  165. package/documentation/{print-onboarding-wiki.js → wiki-onboarding.js} +18 -15
  166. package/documentation/wiki-query.d.ts +9 -0
  167. package/documentation/{print-query-wiki.js → wiki-query.js} +62 -47
  168. package/documentation/wiki-search.d.ts +9 -0
  169. package/documentation/wiki-search.js +61 -0
  170. package/linter/linter-executor.js +3 -2
  171. package/linter/linter-format.d.ts +2 -2
  172. package/linter/linter-rules.d.ts +13 -17
  173. package/linter/rules/absolute-path.d.ts +1 -2
  174. package/linter/rules/absolute-path.js +2 -2
  175. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  176. package/linter/rules/dataframe-access-validation.js +12 -8
  177. package/linter/rules/dead-code.d.ts +1 -1
  178. package/linter/rules/deprecated-functions.d.ts +1 -5
  179. package/linter/rules/file-path-validity.d.ts +1 -1
  180. package/linter/rules/file-path-validity.js +4 -4
  181. package/linter/rules/function-finder-util.d.ts +1 -5
  182. package/linter/rules/naming-convention.d.ts +2 -2
  183. package/linter/rules/naming-convention.js +1 -1
  184. package/linter/rules/network-functions.d.ts +1 -1
  185. package/linter/rules/network-functions.js +1 -1
  186. package/linter/rules/seeded-randomness.d.ts +3 -2
  187. package/linter/rules/seeded-randomness.js +33 -13
  188. package/linter/rules/unused-definition.d.ts +1 -1
  189. package/linter/rules/useless-loop.d.ts +2 -2
  190. package/linter/rules/useless-loop.js +2 -2
  191. package/package.json +6 -17
  192. package/project/cache/flowr-analyzer-cache.d.ts +7 -10
  193. package/project/cache/flowr-analyzer-cache.js +17 -38
  194. package/project/cache/flowr-analyzer-controlflow-cache.d.ts +34 -0
  195. package/project/cache/flowr-analyzer-controlflow-cache.js +79 -0
  196. package/project/context/flowr-analyzer-context.d.ts +30 -5
  197. package/project/context/flowr-analyzer-context.js +48 -4
  198. package/project/context/flowr-analyzer-files-context.d.ts +63 -13
  199. package/project/context/flowr-analyzer-files-context.js +110 -39
  200. package/project/context/flowr-file.d.ts +32 -10
  201. package/project/context/flowr-file.js +30 -9
  202. package/project/flowr-analyzer-builder.d.ts +22 -28
  203. package/project/flowr-analyzer-builder.js +32 -70
  204. package/project/flowr-analyzer.d.ts +55 -14
  205. package/project/flowr-analyzer.js +53 -8
  206. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +7 -1
  207. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +13 -5
  208. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +3 -3
  209. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +11 -5
  210. package/project/plugins/file-plugins/flowr-description-file.d.ts +3 -3
  211. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +22 -0
  212. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +33 -0
  213. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +22 -0
  214. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +33 -0
  215. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +22 -0
  216. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +33 -0
  217. package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.d.ts +20 -0
  218. package/project/plugins/file-plugins/notebooks/flowr-jupyter-file.js +42 -0
  219. package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.d.ts +59 -0
  220. package/project/plugins/file-plugins/notebooks/flowr-rmarkdown-file.js +132 -0
  221. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  222. package/project/plugins/file-plugins/notebooks/notebook.js +2 -0
  223. package/project/plugins/flowr-analyzer-plugin-defaults.d.ts +5 -0
  224. package/project/plugins/flowr-analyzer-plugin-defaults.js +23 -0
  225. package/project/plugins/flowr-analyzer-plugin.d.ts +2 -0
  226. package/project/plugins/flowr-analyzer-plugin.js +2 -0
  227. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  228. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  229. package/project/plugins/plugin-registry.d.ts +34 -0
  230. package/project/plugins/plugin-registry.js +62 -0
  231. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  232. package/queries/catalog/call-context-query/call-context-query-executor.js +4 -2
  233. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +5 -2
  234. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +25 -18
  235. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  236. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  237. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  238. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  239. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  240. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  241. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  242. package/queries/catalog/dependencies-query/dependencies-query-format.js +1 -1
  243. package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -1
  244. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +2 -2
  245. package/queries/catalog/df-shape-query/df-shape-query-format.js +6 -5
  246. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +2 -1
  247. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  248. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  249. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  250. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +1 -1
  251. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -1
  252. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
  253. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  254. package/queries/catalog/linter-query/linter-query-format.js +13 -2
  255. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -1
  256. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  257. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  258. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  259. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  260. package/queries/catalog/project-query/project-query-executor.js +3 -1
  261. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  262. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +2 -2
  263. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  264. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  265. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  266. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  267. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  268. package/queries/catalog/static-slice-query/static-slice-query-format.js +13 -1
  269. package/queries/query.d.ts +26 -18
  270. package/queries/query.js +21 -1
  271. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -1
  272. package/r-bridge/lang-4.x/ast/model/collect.js +4 -0
  273. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +29 -0
  274. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +15 -0
  275. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +5 -7
  276. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +24 -11
  277. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  278. package/r-bridge/lang-4.x/ast/model/type.js +2 -0
  279. package/r-bridge/lang-4.x/ast/parser/json/format.js +1 -1
  280. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +9 -8
  281. package/r-bridge/lang-4.x/ast/parser/json/parser.js +11 -10
  282. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +4 -3
  283. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +20 -11
  284. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -3
  285. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +5 -4
  286. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -2
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +14 -5
  288. package/r-bridge/parser.d.ts +15 -5
  289. package/r-bridge/parser.js +27 -13
  290. package/r-bridge/retriever.d.ts +9 -15
  291. package/r-bridge/retriever.js +14 -5
  292. package/r-bridge/shell.d.ts +1 -1
  293. package/r-bridge/shell.js +1 -1
  294. package/reconstruct/auto-select/auto-select-defaults.d.ts +0 -1
  295. package/reconstruct/auto-select/magic-comments.js +1 -1
  296. package/reconstruct/reconstruct.d.ts +17 -9
  297. package/reconstruct/reconstruct.js +19 -8
  298. package/search/flowr-search.d.ts +12 -0
  299. package/search/search-executor/search-enrichers.d.ts +9 -2
  300. package/search/search-executor/search-enrichers.js +1 -3
  301. package/search/search-executor/search-generators.d.ts +1 -1
  302. package/search/search-executor/search-generators.js +9 -4
  303. package/slicing/criterion/collect-all.d.ts +3 -2
  304. package/slicing/criterion/collect-all.js +1 -1
  305. package/slicing/criterion/parse.js +4 -4
  306. package/statistics/features/supported/assignments/assignments.js +1 -1
  307. package/statistics/features/supported/control-flow/control-flow.js +1 -1
  308. package/statistics/features/supported/data-access/data-access.js +1 -1
  309. package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
  310. package/statistics/features/supported/expression-list/statistics-expression-list.js +1 -1
  311. package/statistics/features/supported/loops/loops.js +1 -1
  312. package/statistics/features/supported/used-functions/used-functions.js +1 -1
  313. package/statistics/features/supported/variables/variables.js +1 -1
  314. package/statistics/statistics.js +3 -2
  315. package/util/assert.d.ts +4 -0
  316. package/util/assert.js +4 -0
  317. package/util/files.d.ts +1 -1
  318. package/util/files.js +1 -1
  319. package/util/mermaid/ast.d.ts +4 -3
  320. package/util/mermaid/ast.js +36 -8
  321. package/util/mermaid/cfg.js +1 -1
  322. package/util/version.js +1 -1
  323. package/documentation/print-analyzer-wiki.d.ts +0 -1
  324. package/documentation/print-analyzer-wiki.js +0 -141
  325. package/documentation/print-capabilities-markdown.d.ts +0 -1
  326. package/documentation/print-cfg-wiki.d.ts +0 -1
  327. package/documentation/print-core-wiki.d.ts +0 -5
  328. package/documentation/print-dataflow-graph-wiki.d.ts +0 -1
  329. package/documentation/print-engines-wiki.d.ts +0 -1
  330. package/documentation/print-faq-wiki.d.ts +0 -1
  331. package/documentation/print-faq-wiki.js +0 -18
  332. package/documentation/print-interface-wiki.d.ts +0 -1
  333. package/documentation/print-linter-issue.d.ts +0 -1
  334. package/documentation/print-linter-wiki.d.ts +0 -1
  335. package/documentation/print-linting-and-testing-wiki.d.ts +0 -1
  336. package/documentation/print-normalized-ast-wiki.d.ts +0 -1
  337. package/documentation/print-onboarding-wiki.d.ts +0 -1
  338. package/documentation/print-query-wiki.d.ts +0 -1
  339. package/documentation/print-readme.d.ts +0 -1
  340. package/documentation/print-search-wiki.d.ts +0 -1
  341. package/documentation/print-search-wiki.js +0 -74
  342. package/util/formats/adapter-format.d.ts +0 -6
  343. package/util/formats/adapter-format.js +0 -3
  344. package/util/formats/adapter.d.ts +0 -27
  345. package/util/formats/adapter.js +0 -58
  346. package/util/formats/adapters/r-adapter.d.ts +0 -4
  347. package/util/formats/adapters/r-adapter.js +0 -7
  348. package/util/formats/adapters/rmd-adapter.d.ts +0 -35
  349. package/util/formats/adapters/rmd-adapter.js +0 -100
@@ -1,14 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const shell_1 = require("../r-bridge/shell");
7
- const log_1 = require("../../test/functionality/_helper/log");
8
- const doc_auto_gen_1 = require("./doc-util/doc-auto-gen");
9
- const doc_code_1 = require("./doc-util/doc-code");
10
- const doc_types_1 = require("./doc-util/doc-types");
11
- const path_1 = __importDefault(require("path"));
3
+ exports.WikiCfg = void 0;
12
4
  const doc_files_1 = require("./doc-util/doc-files");
13
5
  const doc_cli_option_1 = require("./doc-util/doc-cli-option");
14
6
  const doc_structure_1 = require("./doc-util/doc-structure");
@@ -32,7 +24,10 @@ const semantic_cfg_guided_visitor_1 = require("../control-flow/semantic-cfg-guid
32
24
  const doc_issue_1 = require("./doc-util/doc-issue");
33
25
  const edge_1 = require("../dataflow/graph/edge");
34
26
  const assert_1 = require("../util/assert");
35
- const config_1 = require("../config");
27
+ const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
28
+ const doc_maker_1 = require("./wiki-mk/doc-maker");
29
+ const doc_general_1 = require("./doc-util/doc-general");
30
+ const doc_code_1 = require("./doc-util/doc-code");
36
31
  const CfgLongExample = `f <- function(a, b = 3) {
37
32
  if(a > b) {
38
33
  return(a * b);
@@ -104,8 +99,8 @@ class CollectNumbersDataflowVisitor extends dfg_cfg_guided_visitor_1.DataflowAwa
104
99
  }
105
100
  class CollectSourcesSemanticVisitor extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
106
101
  sources = [];
107
- constructor(controlFlow, normalizedAst, dataflow, config) {
108
- super({ controlFlow, normalizedAst, dfg: dataflow, flowrConfig: config, defaultVisitingOrder: 'forward' });
102
+ constructor(controlFlow, normalizedAst, dataflow, ctx) {
103
+ super({ controlFlow, normalizedAst, dfg: dataflow, ctx, defaultVisitingOrder: 'forward' });
109
104
  }
110
105
  onAssignmentCall({ source }) {
111
106
  if (source) {
@@ -116,33 +111,30 @@ class CollectSourcesSemanticVisitor extends semantic_cfg_guided_visitor_1.Semant
116
111
  return this.sources;
117
112
  }
118
113
  }
119
- async function getText(shell) {
120
- const rversion = (await shell.usedRVersion())?.format() ?? 'unknown';
121
- const types = (0, doc_types_1.getTypesFromFolder)({
122
- rootFolder: path_1.default.resolve('./src'),
123
- inlineTypes: doc_types_1.mermaidHide
124
- });
125
- const testTypes = (0, doc_types_1.getTypesFromFolder)({
126
- rootFolder: path_1.default.resolve('./test'),
127
- inlineTypes: doc_types_1.mermaidHide
128
- });
129
- return `${(0, doc_auto_gen_1.autoGenHeader)({ filename: module.filename, purpose: 'control flow graph', rVersion: rversion })}
130
-
114
+ /**
115
+ * https://github.com/flowr-analysis/flowr/wiki/Control-Flow-Graph
116
+ */
117
+ class WikiCfg extends doc_maker_1.DocMaker {
118
+ constructor() {
119
+ super('wiki/Control Flow Graph.md', module.filename, 'control flow graph');
120
+ }
121
+ async text({ ctx, shell }) {
122
+ return `
131
123
  _flowR_ produces three main perspectives of the program: 1) a [normalized version of the AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST)
132
124
  and 2) a [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph), and 3) a control flow graph (CFG).
133
125
  flowR uses this CFG interweaved with its data flow analysis and for some of its queries (e.g., to link to the last call in a [Call-Context Query](${doc_files_1.FlowrWikiBaseRef}/Query-API)).
134
126
 
135
127
  Please note that, mostly due to historical reasons, the [control dependencies](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph#control-dependencies) that are stored directly within the
136
128
  DFG provide only a partial view of the CFG. While they provide you with information on the conditional execution of vertices, they do not encode the order of execution.
137
- In contrast, the CFG describes a complete view of the program's control flow.
129
+ In contrast, the CFG describes a complete view of the program's control flow.
138
130
 
139
131
  ${(0, doc_structure_1.block)({
140
- type: 'TIP',
141
- content: `If you want to investigate the Control Flow Graph,
132
+ type: 'TIP',
133
+ content: `If you want to investigate the Control Flow Graph,
142
134
  you can use the ${(0, doc_cli_option_1.getReplCommand)('controlflow*')} command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
143
135
  By default, this view does _not_ use basic blocks as, for example, R allows unconditional jumps to occur in spots where conventional languages would assume expressions (e.g., if-conditions).
144
136
  Yet, by using ${(0, doc_cli_option_1.getReplCommand)('controlflowbb*')} you can inspect the CFG with basic blocks (although you have to keep in mind that now, there can be a value flow between basic blocks)`
145
- })}
137
+ })}
146
138
 
147
139
  For readability, we structure this wiki page into various segments:
148
140
 
@@ -157,7 +149,6 @@ For readability, we structure this wiki page into various segments:
157
149
  - [Sophisticated CFG Traversal](#cfg-traversal)
158
150
  - [Working With Exit Points](#cfg-exit-points)
159
151
 
160
-
161
152
  ${(0, doc_structure_1.section)('Initial Overview', 2, 'cfg-overview')}
162
153
 
163
154
  For now, let's look at a CFG for a program without any branching:
@@ -169,9 +160,9 @@ The corresponding CFG is a directed, labeled graph with two types of edges (cont
169
160
  ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
170
161
 
171
162
  ${(0, doc_structure_1.block)({
172
- type: 'IMPORTANT',
173
- content: 'As the edges describe dependencies they point in the inverse order of execution (which is very helpful for backward analyses)! The [visitors](#cfg-working) abstract away from this and there is no harm in considering an inverted CFG. Yet, you should keep this in mind!'
174
- })}
163
+ type: 'IMPORTANT',
164
+ content: 'As the edges describe dependencies they point in the inverse order of execution (which is very helpful for backward analyses)! The [visitors](#cfg-working) abstract away from this and there is no harm in considering an inverted CFG. Yet, you should keep this in mind!'
165
+ })}
175
166
 
176
167
  Every normalized node of the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) that has any relevance to the
177
168
  execution is added and automatically linked using its id (similarly to vertices of the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph)).
@@ -202,54 +193,54 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, 'f <- function() { 3 }\nf()', { showC
202
193
 
203
194
  ${(0, doc_structure_1.section)('Structure of the Control Flow Graph', 2, 'cfg-structure')}
204
195
 
205
- You can produce your very own control flow graph with ${(0, doc_types_1.shortLink)(extract_cfg_1.extractCfg.name, types.info)}.
206
- The ${(0, doc_types_1.shortLink)(control_flow_graph_1.ControlFlowGraph.name, types.info)} class describes everything required to model the control flow graph, with its edge types described by
207
- ${(0, doc_types_1.shortLink)('CfgEdge', types.info)} and its vertices by ${(0, doc_types_1.shortLink)('CfgSimpleVertex', types.info)}.
208
- However, you should be aware of the ${(0, doc_types_1.shortLink)('ControlFlowInformation', types.info)} interface which adds some additional information the CFG
196
+ You can produce your very own control flow graph with ${ctx.link(extract_cfg_1.extractCfg)}.
197
+ The ${ctx.link(control_flow_graph_1.ControlFlowGraph)} class describes everything required to model the control flow graph, with its edge types described by
198
+ ${ctx.link('CfgEdge')} and its vertices by ${ctx.link('CfgSimpleVertex')}.
199
+ However, you should be aware of the ${ctx.link('ControlFlowInformation')} interface which adds some additional information the CFG
209
200
  (and is used during the construction of the CFG as well):
210
201
 
211
- ${(0, doc_types_1.printHierarchy)({ info: types.info, root: 'ControlFlowInformation', program: types.program, openTop: true })}
202
+ ${ctx.hierarchy('ControlFlowInformation', { openTop: true })}
212
203
 
213
- To check whether the CFG has the expected shape, you can use the test function ${(0, doc_types_1.shortLink)('assertCfg', testTypes.info)} which supports testing for
214
- sub-graphs as well (it provides diffing capabilities similar to ${(0, doc_types_1.shortLink)('assertDataflow', testTypes.info)}).
215
- As the CFG may become unhandy for larger programs, there are simplifications available with ${(0, doc_types_1.shortLink)(cfg_simplification_1.simplifyControlFlowInformation.name, types.info)}
216
- (these can be passed on to the ${(0, doc_types_1.shortLink)(extract_cfg_1.extractCfg.name, types.info)} function as well).
204
+ To check whether the CFG has the expected shape, you can use the test function ${ctx.link('assertCfg')} which supports testing for
205
+ sub-graphs as well (it provides diffing capabilities similar to ${ctx.link('assertDataflow')}).
206
+ As the CFG may become unhandy for larger programs, there are simplifications available with ${ctx.link(cfg_simplification_1.simplifyControlFlowInformation)}
207
+ (these can be passed on to the ${ctx.link(extract_cfg_1.extractCfg)} function as well).
217
208
 
218
209
  ${(0, doc_structure_1.section)('CFG Vertices', 3, 'cfg-structure-vertices')}
219
210
 
220
- All vertex types are summarized in the ${(0, doc_types_1.shortLink)('CfgVertexType', types.info)} enum which currently contains the following types:
211
+ All vertex types are summarized in the ${ctx.link('CfgVertexType')} enum which currently contains the following types:
221
212
 
222
213
  ${Object.entries(control_flow_graph_1.CfgVertexType).map(([key, value]) => `- \`${key}\` (${value})`).join('\n')}
223
214
 
224
- We use the ${(0, doc_types_1.shortLink)('CfgBasicBlockVertex', types.info)} to represent [basic blocks](#cfg-basic-blocks) and separate
225
- expressions (${(0, doc_types_1.shortLink)('CfgExpressionVertex', types.info)}) and statements (${(0, doc_types_1.shortLink)('CfgStatementVertex', types.info)})
215
+ We use the ${ctx.link('CfgBasicBlockVertex')} to represent [basic blocks](#cfg-basic-blocks) and separate
216
+ expressions (${ctx.link('CfgExpressionVertex')}) and statements (${ctx.link('CfgStatementVertex')})
226
217
  as control flow units with and without side effects (if you want to, you can see view statements as effectful expressions).
227
- The markers (${(0, doc_types_1.shortLink)('CfgEndMarkerVertex', types.info)}) indicate the end of larger expressions/statements.
218
+ The markers (${ctx.link('CfgEndMarkerVertex')}) indicate the end of larger expressions/statements.
228
219
 
229
220
  To signal these links, the expressions and statements contain information about the attached markers:
230
221
 
231
- ${(0, doc_types_1.printHierarchy)({ info: types.info, root: 'CfgWithMarker', program: types.program, openTop: true })}
222
+ ${ctx.hierarchy('CfgWithMarker', { openTop: true })}
232
223
 
233
224
  Similarly, the markers contain a link to their root:
234
225
 
235
- ${(0, doc_types_1.printHierarchy)({ info: types.info, root: 'CfgWithRoot', program: types.program, openTop: true })}
226
+ ${ctx.hierarchy('CfgWithRoot', { openTop: true })}
236
227
 
237
228
  In mermaid visualizations, we use rectangles for statements, rounded rectangles for expressions and circles for exit markers.
238
229
  Blocks are visualized as boxes around the contained vertices.
239
230
 
240
231
  ${(0, doc_structure_1.block)({
241
- type: 'NOTE',
242
- content: `
243
- Every CFG vertex has a ${(0, doc_types_1.shortLink)('NodeId', types.info)} that links it to the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) (although basic blocks will find no counterpart as they are a structuring element of the CFG).
232
+ type: 'NOTE',
233
+ content: `
234
+ Every CFG vertex has a ${ctx.link('NodeId')} that links it to the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) (although basic blocks will find no counterpart as they are a structuring element of the CFG).
244
235
  Additionally, it may provide information on the called functions (in case that the current element is a function call).
245
- Have a look at the ${(0, doc_types_1.shortLink)('CfgBaseVertex', types.info)} interface for more information.
236
+ Have a look at the ${ctx.link('CfgBaseVertex')} interface for more information.
246
237
  `.trim()
247
- })}
238
+ })}
248
239
 
249
240
  ${(0, doc_structure_1.section)('CFG Edges', 3, 'cfg-structure-edges')}
250
241
 
251
- The ${(0, doc_types_1.shortLink)(control_flow_graph_1.ControlFlowGraph.name, types.info)} uses two types of edges to represent the control flow, separated by the ${(0, doc_types_1.shortLink)('CfgEdgeType', types.info)} enum
252
- and the two interfaces: ${(0, doc_types_1.shortLink)('CfgFlowDependencyEdge', types.info)} and ${(0, doc_types_1.shortLink)('CfgControlDependencyEdge', types.info)}.
242
+ The ${ctx.link(control_flow_graph_1.ControlFlowGraph)} uses two types of edges to represent the control flow, separated by the ${ctx.link('CfgEdgeType')} enum
243
+ and the two interfaces: ${ctx.link('CfgFlowDependencyEdge')} and ${ctx.link('CfgControlDependencyEdge')}.
253
244
 
254
245
  ${(0, doc_structure_1.section)('Flow Dependencies', 4, 'cfg-flow-dependency')}
255
246
 
@@ -263,20 +254,20 @@ ${(0, doc_structure_1.section)('Control Dependencies', 4, 'cfg-control-dependenc
263
254
  Control dependencies&nbsp;(CD) are used to signal that the execution of the source vertex depends on the taget vertex (which, e.g., is the condition of an \`if\` statement or \`while\` loop).
264
255
  They contain additional information to signal _when_ the source vertex is executed:
265
256
 
266
- ${(0, doc_types_1.printHierarchy)({ info: types.info, root: 'CfgControlDependencyEdge', program: types.program, openTop: true })}
257
+ ${ctx.hierarchy('CfgControlDependencyEdge', { openTop: true })}
267
258
 
268
259
  The extra \`caused\` link signals the vertex that caused the control flow influence.
269
260
 
270
261
 
271
262
  ${await (async () => {
272
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n' });
273
- return (0, doc_structure_1.details)('Example: if-else', exa);
274
- })()}
263
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'if(u) 3 else 2', { showCode: true, prefix: 'flowchart RL\n' });
264
+ return (0, doc_structure_1.details)('Example: if-else', exa);
265
+ })()}
275
266
 
276
267
  ${await (async () => {
277
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n' });
278
- return (0, doc_structure_1.details)('Example: while-loop', exa);
279
- })()}
268
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'while(u) b', { showCode: true, prefix: 'flowchart RL\n' });
269
+ return (0, doc_structure_1.details)('Example: while-loop', exa);
270
+ })()}
280
271
  <br/>
281
272
 
282
273
  Please note that repeat loops do _not_ have control dependencies, as they repeat their body unconditionally.
@@ -284,26 +275,26 @@ Additionally, the control flow graph does not have to be connected. If you use a
284
275
  the corresponding exit markers are not reachable from the entry:
285
276
 
286
277
  ${await (async () => {
287
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n' });
288
- return (0, doc_structure_1.details)('Example: repeat-loop (infinite)', exa);
289
- })()}
278
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b }; after', { showCode: true, prefix: 'flowchart RL\n' });
279
+ return (0, doc_structure_1.details)('Example: repeat-loop (infinite)', exa);
280
+ })()}
290
281
 
291
282
  ${await (async () => {
292
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n' });
293
- return (0, doc_structure_1.details)('Example: repeat-loop (with break)', exa);
294
- })()}
283
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'repeat { b; if(u) break; }; after', { showCode: true, prefix: 'flowchart RL\n' });
284
+ return (0, doc_structure_1.details)('Example: repeat-loop (with break)', exa);
285
+ })()}
295
286
  <br/>
296
287
 
297
288
  In the context of a for-loop, the control dependency refer to whether the respective vector still has values to iterate over.
298
289
 
299
290
  ${await (async () => {
300
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n' });
301
- return (0, doc_structure_1.details)('Example: for-loop', exa);
302
- })()}
291
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, 'for(i in 1:10) b', { showCode: true, prefix: 'flowchart RL\n' });
292
+ return (0, doc_structure_1.details)('Example: for-loop', exa);
293
+ })()}
303
294
 
304
295
  ${(0, doc_structure_1.section)('Extra: Call Links', 4, 'cfg-call-links')}
305
296
 
306
- If you generate the CFG with the ${(0, doc_types_1.shortLink)(extract_cfg_1.extractCfg.name, types.info)} function you can (and, if you want to gain inter-procedural information, should)
297
+ If you generate the CFG with the ${ctx.link(extract_cfg_1.extractCfg)} function you can (and, if you want to gain inter-procedural information, should)
307
298
  pass a matching [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) to it to incorporate the dataflow perspective into the CFG.
308
299
 
309
300
  The difference becomes obvious when we look at the code \`f <- function() b; f()\` first without the dataflow graph:
@@ -318,7 +309,7 @@ There are two important additions:
318
309
 
319
310
  1. A new exit marker, canonically suffixed with \`${extract_cfg_1.ResolvedCallSuffix}\` signals that we are aware of the function call target.
320
311
  This marker always follows the exit marker of the function call and links not just the call but also the exit points of the function definition.
321
- 2. A new _calls_ attribute attached to the function call vertex. This holds the ${(0, doc_types_1.shortLink)('NodeId', types.info)} of the function definitions that are called from this vertex.
312
+ 2. A new _calls_ attribute attached to the function call vertex. This holds the ${ctx.link('NodeId')} of the function definitions that are called from this vertex.
322
313
 
323
314
  For built-in functions that are provided by flowR's built-in configuration (see the [interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface)) the CFG does not contain
324
315
  the additional information directly:
@@ -334,7 +325,7 @@ ${(0, doc_structure_1.section)('Adding Basic Blocks', 3, 'cfg-basic-blocks')}
334
325
  As mentioned in the introduction, our control flow graph does not use basic blocks by default and hence simply links all vertices independent of whether they have (un-)conditional jumps or not.
335
326
  On the upside, this tells us the execution order (and, in case of promises, forcing order) of involved expressions and seamlessly handles cases like
336
327
  \`x <- return(3)\`. On the downside, this makes it hard to apply classical control flow graph algorithms and, in general, makes the graph much harder to read.
337
- Yet, we can request basic blocks or transform an existing CFG into basic blocks using the ${(0, doc_types_1.shortLink)(cfg_to_basic_blocks_1.convertCfgToBasicBlocks.name, types.info)} function.
328
+ Yet, we can request basic blocks or transform an existing CFG into basic blocks using the ${ctx.link(cfg_to_basic_blocks_1.convertCfgToBasicBlocks)} function.
338
329
 
339
330
  Any program without any (un-)conditional jumps now contains a single basic block:
340
331
 
@@ -345,7 +336,7 @@ While the CFG without basic blocks is much bigger:
345
336
  ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n' })}
346
337
 
347
338
  In a way, using the basic blocks perspective does not remove any of these vertices (we just usually visualize them compacted as their execution order should be "obvious").
348
- The vertices are still there, as elems of the ${(0, doc_types_1.shortLink)('CfgBasicBlockVertex', types.info)}:
339
+ The vertices are still there, as elems of the ${ctx.link('CfgBasicBlockVertex')}:
349
340
 
350
341
  ${await (0, doc_cfg_1.printCfgCode)(shell, 'x <- 2 * 3 + 1', { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], simplify: false })}
351
342
 
@@ -360,9 +351,9 @@ ${await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, pr
360
351
  Now, without basic blocks, this is a different story...
361
352
 
362
353
  ${await (async () => {
363
- const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n' });
364
- return (0, doc_structure_1.details)('The full CFG', exa);
365
- })()}
354
+ const exa = await (0, doc_cfg_1.printCfgCode)(shell, CfgLongExample, { showCode: false, prefix: 'flowchart RL\n' });
355
+ return (0, doc_structure_1.details)('The full CFG', exa);
356
+ })()}
366
357
 
367
358
  And again it should be noted that even though the example code is more complicated, this is still far from the average real-world script.
368
359
 
@@ -374,35 +365,35 @@ Similarly, flowR provides you with a set of utility functions and classes that y
374
365
  ${(0, doc_structure_1.section)('Simple Traversal', 3, 'cfg-simple-traversal')}
375
366
 
376
367
  If you are just interested in traversing the vertices within the cfg, two simple functions
377
- ${(0, doc_types_1.shortLink)(simple_visitor_1.visitCfgInOrder.name, types.info)} and ${(0, doc_types_1.shortLink)(simple_visitor_1.visitCfgInReverseOrder.name, types.info)} are available. For [basic blocks](#cfg-basic-blocks)
368
+ ${ctx.link(simple_visitor_1.visitCfgInOrder)} and ${ctx.link(simple_visitor_1.visitCfgInReverseOrder)} are available. For [basic blocks](#cfg-basic-blocks)
378
369
  these will automatically traverse the elements contained within the blocks (in the respective order).
379
370
  For example, the following function will return all numbers contained within the CFG:
380
371
 
381
- ${(0, doc_types_1.printCodeOfElement)(types, sampleCollectNumbers.name)}
372
+ ${ctx.code(sampleCollectNumbers)}
382
373
 
383
374
  Calling it with the CFG and AST of the expression \`x - 1 + 2L * 3\` yields the following elements (in this order):
384
375
 
385
376
  ${await (async () => {
386
- const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
387
- const collected = sampleCollectNumbers(res.info, res.ast);
388
- return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
389
- })()}
377
+ const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
378
+ const collected = sampleCollectNumbers(res.info, res.ast);
379
+ return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
380
+ })()}
390
381
 
391
- A more useful appearance of these visitors occurs with ${(0, doc_types_1.shortLink)(happens_before_1.happensBefore.name, types.info)} which uses the CFG to determine whether the execution
382
+ A more useful appearance of these visitors occurs with ${ctx.link(happens_before_1.happensBefore)} which uses the CFG to determine whether the execution
392
383
  of one vertex always, maybe, or never happens before another vertex (see the corresponding [query documentation](${doc_files_1.FlowrWikiBaseRef}/Query-API#happens-before-query) for more information).
393
384
 
394
385
 
395
386
  ${(0, doc_structure_1.section)('Diffing and Testing', 3, 'cfg-diff-and-test')}
396
387
 
397
- As mentioned above, you can use the test function ${(0, doc_types_1.shortLink)('assertCfg', testTypes.info)} to check whether the control flow graph has the desired shape.
398
- The function supports testing for sub-graphs as well (it provides diffing capabilities similar to ${(0, doc_types_1.shortLink)('assertDataflow', testTypes.info)}).
399
- If you want to diff two control flow graphs, you can use the ${(0, doc_types_1.shortLink)(diff_cfg_1.diffOfControlFlowGraphs.name, types.info)} function.
388
+ As mentioned above, you can use the test function ${ctx.link('assertCfg')} to check whether the control flow graph has the desired shape.
389
+ The function supports testing for sub-graphs as well (it provides diffing capabilities similar to ${ctx.link('assertDataflow')}).
390
+ If you want to diff two control flow graphs, you can use the ${ctx.link(diff_cfg_1.diffOfControlFlowGraphs)} function.
400
391
 
401
392
  ${(0, doc_structure_1.section)('Checking Properties', 4, 'cfg-check-properties')}
402
393
 
403
394
  To be a valid representation of the program, the CFG should satisfy a collection of properties that, in turn, you can automatically assume to hold
404
- when working with it. In general, we verify these in every unit test using ${(0, doc_types_1.shortLink)(cfg_properties_1.assertCfgSatisfiesProperties.name, types.info)},
405
- and you can have a look at the active properties by checking the ${(0, doc_types_1.shortLink)('CfgProperties', types.info)} object.
395
+ when working with it. In general, we verify these in every unit test using ${ctx.link(cfg_properties_1.assertCfgSatisfiesProperties)},
396
+ and you can have a look at the active properties by checking the ${ctx.link('CfgProperties')} object.
406
397
  In general, we check for a hammock graph (given that the program contains no definite infinite loop) and the absence of direct cycles.
407
398
 
408
399
  ${(0, doc_structure_1.section)('Sophisticated CFG Traversal', 3, 'cfg-traversal')}
@@ -422,97 +413,97 @@ visitors that incorporate various alternative perspectives:
422
413
 
423
414
  ${(0, doc_structure_1.section)('Basic CFG Visitor', 4, 'cfg-traversal-basic')}
424
415
 
425
- The ${(0, doc_types_1.shortLink)(basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor.name, types.info)} class essential provides the same functionality as the [simple traversal](#cfg-simple-traversal) functions but in a class-based version.
416
+ The ${ctx.link(basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor)} class essential provides the same functionality as the [simple traversal](#cfg-simple-traversal) functions but in a class-based version.
426
417
  Using it, you can select whether you want to traverse the CFG in order or in reverse order.
427
418
 
428
419
  To replicate the number collector from above, you can use the following code:
429
420
 
430
- ${(0, doc_types_1.printCodeOfElement)(types, CollectNumbersVisitor.name)}
421
+ ${ctx.code(CollectNumbersVisitor)}
431
422
 
432
- Instead of directly calling ${(0, doc_types_1.shortLink)(simple_visitor_1.visitCfgInOrder.name, types.info)} we pass the \`forward\` visiting order to the constructor of the visitor.
423
+ Instead of directly calling ${ctx.link(simple_visitor_1.visitCfgInOrder)} we pass the \`forward\` visiting order to the constructor of the visitor.
433
424
  Executing it with the CFG and AST of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
434
425
 
435
426
  ${await (async () => {
436
- const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
437
- const visitor = new CollectNumbersVisitor(res.info, res.ast);
438
- visitor.start();
439
- const collected = visitor.getNumbers();
440
- return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
441
- })()}
427
+ const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
428
+ const visitor = new CollectNumbersVisitor(res.info, res.ast);
429
+ visitor.start();
430
+ const collected = visitor.getNumbers();
431
+ return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
432
+ })()}
442
433
 
443
434
 
444
435
  ${(0, doc_structure_1.section)('Syntax-Aware CFG Visitor', 4, 'cfg-traversal-syntax')}
445
436
 
446
- The ${(0, doc_types_1.shortLink)(syntax_cfg_guided_visitor_1.SyntaxAwareCfgGuidedVisitor.name, types.info)} class incorporates knowledge of the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) into the CFG traversal and
437
+ The ${ctx.link(syntax_cfg_guided_visitor_1.SyntaxAwareCfgGuidedVisitor)} class incorporates knowledge of the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) into the CFG traversal and
447
438
  directly provides specialized visitors for the various node types.
448
439
  Now, our running example of collecting all numbers simplifies to this:
449
440
 
450
- ${(0, doc_types_1.printCodeOfElement)(types, CollectNumbersSyntaxVisitor.name)}
441
+ ${ctx.code(CollectNumbersSyntaxVisitor)}
451
442
 
452
443
  And again, executing it with the CFG and AST of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
453
444
 
454
445
  ${await (async () => {
455
- const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
456
- const visitor = new CollectNumbersSyntaxVisitor(res.info, res.ast);
457
- visitor.start();
458
- const collected = visitor.getNumbers();
459
- return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
460
- })()}
446
+ const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
447
+ const visitor = new CollectNumbersSyntaxVisitor(res.info, res.ast);
448
+ visitor.start();
449
+ const collected = visitor.getNumbers();
450
+ return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
451
+ })()}
461
452
 
462
453
  ${(0, doc_structure_1.section)('Dataflow-Aware CFG Visitor', 4, 'cfg-traversal-dfg')}
463
454
 
464
455
  There is a lot of benefit in incorporating the [dataflow information](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) into the CFG traversal, as it contains
465
456
  information about overwritten function calls, definition targets, and so on.
466
- Our best friend is the ${(0, doc_types_1.shortLink)(dfg_get_origin_1.getOriginInDfg.name, types.info)} function which provides the important information about the origin of a vertex in the dataflow graph.
467
- The ${(0, doc_types_1.shortLink)(dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor.name, types.info)} class does some of the basic lifting for us.
457
+ Our best friend is the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} function which provides the important information about the origin of a vertex in the dataflow graph.
458
+ The ${ctx.link(dfg_cfg_guided_visitor_1.DataflowAwareCfgGuidedVisitor)} class does some of the basic lifting for us.
468
459
  While it is not ideal for our goal of collecting all numbers, it shines in other areas such as collecting all used variables,&nbsp;...
469
460
 
470
- ${(0, doc_types_1.printCodeOfElement)(types, CollectNumbersDataflowVisitor.name)}
461
+ ${ctx.code(CollectNumbersDataflowVisitor)}
471
462
 
472
463
  Again, executing it with the CFG and Dataflow of the expression \`x - 1 + 2L * 3\`, causes the following numbers to be collected:
473
464
 
474
465
  ${await (async () => {
475
- const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
476
- const visitor = new CollectNumbersDataflowVisitor(res.info, res.dataflow.graph);
477
- visitor.start();
478
- const collected = visitor.getNumbers();
479
- return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
480
- })()}
466
+ const res = await (0, doc_cfg_1.getCfg)(shell, 'x - 1 + 2L * 3');
467
+ const visitor = new CollectNumbersDataflowVisitor(res.info, res.dataflow.graph);
468
+ visitor.start();
469
+ const collected = visitor.getNumbers();
470
+ return collected.map(n => '\n- `' + JSON.stringify(n) + '`').join('');
471
+ })()}
481
472
 
482
473
  ${(0, doc_structure_1.section)('Semantic CFG Visitor', 4, 'cfg-traversal-semantic')}
483
474
 
484
- The ${(0, doc_types_1.shortLink)(semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor.name, types.info)} class is flowR's most advanced visitor that combines the syntactic and dataflow information.
475
+ The ${ctx.link(semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor)} class is flowR's most advanced visitor that combines the syntactic and dataflow information.
485
476
  The main idea is simple, it provides special handlers for assignments, conditionals, and other R semantics but still follows
486
477
  the structure of the CFG.
487
478
 
488
479
  ${(0, doc_structure_1.block)({
489
- type: 'NOTE',
490
- content: `This visitor is still in the design phase so please open up a [new issue](${doc_issue_1.NewIssueUrl}) if you have any suggestions or find any bugs.`
491
- })}
480
+ type: 'NOTE',
481
+ content: `This visitor is still in the design phase so please open up a [new issue](${doc_issue_1.NewIssueUrl}) if you have any suggestions or find any bugs.`
482
+ })}
492
483
 
493
484
  To explore what it is capable of, let's create a visitor that prints all values that are used in assignments:
494
485
 
495
- ${(0, doc_types_1.printCodeOfElement)(types, CollectSourcesSemanticVisitor.name)}
486
+ ${ctx.code(CollectSourcesSemanticVisitor)}
496
487
 
497
488
  Executing it with the CFG and Dataflow of the expression \`x <- 2; 3 -> x; assign("x", 42 + 21)\`, causes the following values&nbsp;(/lexemes) to be collected:
498
489
 
499
490
  ${await (async () => {
500
- const res = await (0, doc_cfg_1.getCfg)(shell, 'x <- 2; 3 -> x; assign("x", 42 + 21)');
501
- const visitor = new CollectSourcesSemanticVisitor(res.info, res.ast, res.dataflow.graph, config_1.defaultConfigOptions);
502
- visitor.start();
503
- const collected = visitor.getSources();
504
- return collected.map(n => '\n- `' + n + '`').join('');
505
- })()}
491
+ const res = await (0, doc_cfg_1.getCfg)(shell, 'x <- 2; 3 -> x; assign("x", 42 + 21)');
492
+ const visitor = new CollectSourcesSemanticVisitor(res.info, res.ast, res.dataflow.graph, (0, flowr_analyzer_context_1.contextFromInput)(''));
493
+ visitor.start();
494
+ const collected = visitor.getSources();
495
+ return collected.map(n => '\n- `' + n + '`').join('');
496
+ })()}
506
497
 
507
498
  All in all, this visitor offers the following semantic events:
508
499
 
509
500
  ${
510
- /* let's iterate over all methods */
511
- Object.getOwnPropertyNames(Object.getPrototypeOf(new semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor(undefined)))
512
- .filter(n => n !== 'constructor').sort().map(key => {
513
- const doc = (0, doc_types_1.getDocumentationForType)(`SemanticCfgGuidedVisitor::${key}`, types.info, ' ');
514
- return `- ${(0, doc_types_1.shortLink)(`SemanticCfgGuidedVisitor::${key}`, types.info)}\\\n${doc ?? '_no documentation available_'}\n`;
515
- }).join('\n')}
501
+ /* let's iterate over all methods */
502
+ Object.getOwnPropertyNames(Object.getPrototypeOf(new semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor(undefined)))
503
+ .filter(n => n !== 'constructor').sort().map(key => {
504
+ const doc = (0, doc_general_1.prefixLines)(ctx.doc(`SemanticCfgGuidedVisitor::${key}`), ' ');
505
+ return `- ${ctx.link(`SemanticCfgGuidedVisitor::${key}`)}\\\n${doc ?? '_no documentation available_'}\n`;
506
+ }).join('\n')}
516
507
 
517
508
 
518
509
  ${(0, doc_structure_1.section)('Working With Exit Points', 3, 'cfg-exit-points')}
@@ -522,49 +513,42 @@ With the [Dataflow Graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) you
522
513
  But the control flow perspective gives you more! Given a simple addition like \`x + 1\`, the CFG looks like this:
523
514
 
524
515
  ${await (async function () {
525
- const cfg = await (0, doc_cfg_1.getCfg)(shell, 'x + 1');
526
- const [plusVertexId, plusVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === '+')[0];
527
- (0, assert_1.guard)(plusVertex.type === control_flow_graph_1.CfgVertexType.Expression);
528
- const numOfExits = plusVertex.end?.length ?? 0;
529
- (0, assert_1.guard)(plusVertex.end && numOfExits === 1);
530
- return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n' })}
516
+ const cfg = await (0, doc_cfg_1.getCfg)(shell, 'x + 1');
517
+ const [plusVertexId, plusVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === '+')[0];
518
+ (0, assert_1.guard)(plusVertex.type === control_flow_graph_1.CfgVertexType.Expression);
519
+ const numOfExits = plusVertex.end?.length ?? 0;
520
+ (0, assert_1.guard)(plusVertex.end && numOfExits === 1);
521
+ return `${await (0, doc_cfg_1.printCfgCode)(shell, 'x + 1', { showCode: true, prefix: 'flowchart RL\n' })}
531
522
 
532
523
  Looking at the binary operation vertex for \`+\` (with id \`${plusVertexId}\`) we see that it is linked to a single exit ("end marker") point: \`${plusVertex.end[0]}\`.
533
524
  Checking this vertex essentially reveals all exit points of the expression &dash; in this case, this simply refers to the operands of the addition.
534
525
  However, the idea transfers to more complex expressions as well...
535
526
  `;
536
- })()}
527
+ })()}
537
528
 
538
529
  ${(0, doc_structure_1.details)('Example: Exit Points for an if', await (async function () {
539
- const expr = 'if(u) 3 else 2';
540
- const cfg = await (0, doc_cfg_1.getCfg)(shell, expr);
541
- const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === 'if')[0];
542
- (0, assert_1.guard)(ifVertex.type === control_flow_graph_1.CfgVertexType.Statement);
543
- const numOfExits = ifVertex.end?.length ?? 0;
544
- (0, assert_1.guard)(ifVertex.end && numOfExits === 1);
545
- return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n' })}
530
+ const expr = 'if(u) 3 else 2';
531
+ const cfg = await (0, doc_cfg_1.getCfg)(shell, expr);
532
+ const [ifVertexId, ifVertex] = [...cfg.info.graph.vertices()].filter(([n]) => (0, node_id_1.recoverName)(n, cfg.ast.idMap) === 'if')[0];
533
+ (0, assert_1.guard)(ifVertex.type === control_flow_graph_1.CfgVertexType.Statement);
534
+ const numOfExits = ifVertex.end?.length ?? 0;
535
+ (0, assert_1.guard)(ifVertex.end && numOfExits === 1);
536
+ return `${await (0, doc_cfg_1.printCfgCode)(shell, expr, { showCode: true, prefix: 'flowchart RL\n' })}
546
537
 
547
538
  Looking at the if vertex for (with id \`${ifVertexId}\`) we see that it is again linked to a single exit point: \`${ifVertex.end[0]}\`.
548
539
  Yet, now this exit vertex is linked to the two branches of the if statement (the \`then\` and \`else\` branch).
549
540
  `;
550
- })())}
541
+ })())}
551
542
 
552
543
  Hence, you may rely on the corresponding exit point(s) to identify all exits of a given expression (in a way, these exit-points are merely super-sinks trying to ensure the hammock graph property).
553
544
 
554
545
  ${(0, doc_structure_1.block)({
555
- type: 'WARNING',
556
- content: 'Using basic blocks, this works just the same. However, please keep in mind that the corresponding exit markers do not (and for control statements usually will not) be part of the same basic block.'
557
- })}
546
+ type: 'WARNING',
547
+ content: 'Using basic blocks, this works just the same. However, please keep in mind that the corresponding exit markers do not (and for control statements usually will not) be part of the same basic block.'
548
+ })}
558
549
 
559
550
  `;
551
+ }
560
552
  }
561
- if (require.main === module) {
562
- (0, log_1.setMinLevelOfAllLogs)(6 /* LogLevel.Fatal */);
563
- const shell = new shell_1.RShell();
564
- void getText(shell).then(str => {
565
- console.log(str);
566
- }).finally(() => {
567
- shell.close();
568
- });
569
- }
570
- //# sourceMappingURL=print-cfg-wiki.js.map
553
+ exports.WikiCfg = WikiCfg;
554
+ //# sourceMappingURL=wiki-cfg.js.map
@@ -0,0 +1,14 @@
1
+ import { FlowrAnalyzer } from '../project/flowr-analyzer';
2
+ import type { DocMakerArgs } from './wiki-mk/doc-maker';
3
+ import { DocMaker } from './wiki-mk/doc-maker';
4
+ /**
5
+ * Shows how to inspect the context of an analyzer instance.
6
+ */
7
+ export declare function inspectContextExample(analyzer: FlowrAnalyzer): void;
8
+ /**
9
+ * https://github.com/flowr-analysis/flowr/wiki/Core
10
+ */
11
+ export declare class WikiCore extends DocMaker {
12
+ constructor();
13
+ text({ shell, treeSitter, ctx }: DocMakerArgs): Promise<string>;
14
+ }