@eagleoutice/flowr 2.12.3 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +38 -91
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +10 -0
  33. package/cli/common/options.js +2 -0
  34. package/cli/common/scripts-info.d.ts +10 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-query.js +42 -20
  40. package/cli/repl/commands/repl-signature.js +2 -2
  41. package/cli/repl/core.d.ts +14 -5
  42. package/cli/repl/core.js +32 -17
  43. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  44. package/cli/repl/parser/slice-query-parser.js +82 -13
  45. package/cli/repl/path-input.d.ts +6 -0
  46. package/cli/repl/path-input.js +41 -0
  47. package/cli/repl/print-version.js +3 -5
  48. package/cli/slicer-app.d.ts +2 -0
  49. package/cli/slicer-app.js +2 -1
  50. package/config.d.ts +54 -6
  51. package/config.js +133 -12
  52. package/control-flow/control-flow-graph.d.ts +3 -2
  53. package/control-flow/control-flow-graph.js +34 -14
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  56. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  57. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  58. package/data/r-base-packages.generated.d.ts +1 -1
  59. package/data/r-base-packages.generated.js +3 -3
  60. package/data/sigdb/sigdb.remote.json +53 -53
  61. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  62. package/dataflow/environments/built-in-proc-name.js +2 -0
  63. package/dataflow/environments/built-in.d.ts +2 -0
  64. package/dataflow/environments/built-in.js +2 -0
  65. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  66. package/dataflow/environments/default-builtin-config.js +2 -2
  67. package/dataflow/environments/environment.d.ts +9 -0
  68. package/dataflow/environments/environment.js +28 -7
  69. package/dataflow/environments/identifier.d.ts +1 -2
  70. package/dataflow/environments/identifier.js +1 -5
  71. package/dataflow/extractor.js +1 -2
  72. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  73. package/dataflow/graph/df-helper.d.ts +15 -0
  74. package/dataflow/graph/df-helper.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  80. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  84. package/documentation/data/faq/faqs.js +12 -1
  85. package/documentation/doc-readme.js +1 -1
  86. package/documentation/doc-util/doc-files.d.ts +2 -2
  87. package/documentation/doc-util/doc-files.js +4 -7
  88. package/documentation/doc-util/doc-query.d.ts +12 -9
  89. package/documentation/doc-util/doc-query.js +63 -28
  90. package/documentation/wiki-absint.js +1 -4
  91. package/documentation/wiki-analyzer.js +8 -3
  92. package/documentation/wiki-cfg.js +3 -2
  93. package/documentation/wiki-dataflow-graph.js +14 -4
  94. package/documentation/wiki-interface.js +29 -16
  95. package/documentation/wiki-mk/doc-maker.js +1 -1
  96. package/documentation/wiki-query.js +189 -30
  97. package/documentation/wiki-signature-database.d.ts +1 -1
  98. package/documentation/wiki-signature-database.js +53 -27
  99. package/linter/linter-output.d.ts +24 -0
  100. package/linter/linter-output.js +117 -0
  101. package/linter/linter-rules.d.ts +2 -4
  102. package/linter/rules/dataframe-access-validation.js +4 -4
  103. package/linter/rules/deprecated-functions.d.ts +2 -4
  104. package/linter/rules/deprecated-functions.js +58 -3
  105. package/linter/rules/undefined-symbol.js +18 -10
  106. package/linter/rules/unused-definition.js +24 -0
  107. package/package.json +5 -2
  108. package/project/context/flowr-analyzer-context.d.ts +59 -1
  109. package/project/context/flowr-analyzer-context.js +118 -3
  110. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  111. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  112. package/project/context/flowr-analyzer-files-context.d.ts +32 -0
  113. package/project/context/flowr-analyzer-files-context.js +132 -14
  114. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  115. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  116. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  117. package/project/context/flowr-analyzer-meta-context.js +64 -23
  118. package/project/context/flowr-file.d.ts +7 -0
  119. package/project/context/flowr-file.js +7 -0
  120. package/project/context/project-kind.d.ts +22 -0
  121. package/project/context/project-kind.js +27 -0
  122. package/project/dependency-version-space.d.ts +166 -0
  123. package/project/dependency-version-space.js +564 -0
  124. package/project/flowr-analyzer-builder.js +1 -1
  125. package/project/flowr-analyzer.d.ts +4 -0
  126. package/project/flowr-analyzer.js +5 -0
  127. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  128. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  129. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  130. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  131. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  132. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  133. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  134. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  135. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  136. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  137. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  138. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  148. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  149. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  154. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  155. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  158. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  159. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  160. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  161. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  167. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  168. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  171. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  172. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  182. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/package.js +8 -5
  184. package/project/plugins/plugin-registry.d.ts +11 -3
  185. package/project/plugins/plugin-registry.js +24 -5
  186. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  187. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  188. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  189. package/project/sigdb/build.js +12 -2
  190. package/project/sigdb/decode.d.ts +7 -0
  191. package/project/sigdb/decode.js +35 -4
  192. package/project/sigdb/decompress.d.ts +2 -0
  193. package/project/sigdb/decompress.js +5 -0
  194. package/project/sigdb/manifest.d.ts +5 -0
  195. package/project/sigdb/manifest.js +37 -6
  196. package/project/sigdb/reader.d.ts +82 -2
  197. package/project/sigdb/reader.js +226 -14
  198. package/project/sigdb/schema.d.ts +31 -5
  199. package/project/sigdb/schema.js +7 -3
  200. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  201. package/project/sigdb/sigdb-version.js +119 -0
  202. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  203. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  204. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  205. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  208. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  210. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  211. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  212. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  213. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  214. package/queries/catalog/config-query/config-query-executor.js +15 -6
  215. package/queries/catalog/config-query/config-query-format.d.ts +18 -4
  216. package/queries/catalog/config-query/config-query-format.js +246 -96
  217. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  218. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  219. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  220. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  221. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  223. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  224. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  225. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  226. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  227. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  228. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  229. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  230. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  231. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  232. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  233. package/queries/catalog/files-query/files-query-format.js +2 -0
  234. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  235. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +277 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +119 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +331 -0
  238. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  239. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  240. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  241. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  242. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  243. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  244. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  245. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  248. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  250. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  251. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  252. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  253. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  254. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  255. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  256. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  257. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  258. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  259. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  260. package/queries/catalog/project-query/project-query-executor.js +19 -62
  261. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  262. package/queries/catalog/project-query/project-query-format.js +3 -18
  263. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  264. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  265. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  266. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  267. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  268. package/queries/catalog/search-query/search-query-format.js +1 -0
  269. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  270. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  272. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  273. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  274. package/queries/catalog/slice-query-options.d.ts +49 -0
  275. package/queries/catalog/slice-query-options.js +50 -0
  276. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  277. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  278. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  279. package/queries/query-print.js +3 -1
  280. package/queries/query.d.ts +63 -3
  281. package/queries/query.js +9 -2
  282. package/r-bridge/data/data.d.ts +16 -0
  283. package/r-bridge/data/data.js +20 -0
  284. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  285. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  286. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  287. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  288. package/reconstruct/reconstruct.d.ts +18 -1
  289. package/reconstruct/reconstruct.js +42 -19
  290. package/slicing/criterion/parse.d.ts +4 -0
  291. package/slicing/criterion/parse.js +4 -0
  292. package/slicing/static/slice-call.js +17 -9
  293. package/slicing/static/static-slicer.d.ts +1 -1
  294. package/slicing/static/static-slicer.js +5 -4
  295. package/util/files.d.ts +19 -1
  296. package/util/files.js +45 -3
  297. package/util/glob.d.ts +19 -0
  298. package/util/glob.js +67 -0
  299. package/util/log.d.ts +12 -0
  300. package/util/log.js +17 -1
  301. package/util/logic.d.ts +6 -0
  302. package/util/logic.js +31 -1
  303. package/util/mermaid/dfg.js +17 -12
  304. package/util/mermaid/mermaid.js +2 -2
  305. package/util/objects.d.ts +5 -0
  306. package/util/objects.js +8 -0
  307. package/util/r-version.d.ts +9 -1
  308. package/util/r-version.js +27 -2
  309. package/util/schema.d.ts +16 -0
  310. package/util/schema.js +89 -4
  311. package/util/text/ansi.d.ts +4 -0
  312. package/util/text/ansi.js +27 -3
  313. package/util/text/strings.d.ts +9 -0
  314. package/util/text/strings.js +29 -0
  315. package/util/version.js +79 -6
  316. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  317. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  318. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  319. package/project/sigdb/version.js +0 -55
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processLoadCall = processLoadCall;
4
+ const known_call_handling_1 = require("../known-call-handling");
5
+ const identifier_1 = require("../../../../../environments/identifier");
6
+ const flowr_rda_file_1 = require("../../../../../../project/plugins/file-plugins/files/flowr-rda-file");
7
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
+ const retriever_1 = require("../../../../../../r-bridge/retriever");
9
+ const built_in_source_1 = require("./built-in-source");
10
+ const vertex_1 = require("../../../../../graph/vertex");
11
+ const logger_1 = require("../../../../../logger");
12
+ const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
13
+ const edge_1 = require("../../../../../graph/edge");
14
+ const unpack_argument_1 = require("../argument/unpack-argument");
15
+ const general_1 = require("../../../../../eval/values/general");
16
+ const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
17
+ const r_value_1 = require("../../../../../eval/values/r-value");
18
+ const assert_1 = require("../../../../../../util/assert");
19
+ const range_1 = require("../../../../../../util/range");
20
+ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
21
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
22
+ const built_in_envir_utils_1 = require("./built-in-envir-utils");
23
+ /**
24
+ * Processes a built-in 'load' function call by retrieving the names of the variables loaded by the given file.
25
+ * Example: `load(test.rda)` with two variables 'x' and 'y'. processLoadCall adds 'x' and 'y' to the dataflow graph and
26
+ * adds control dependencies between the variables and the loaded file.
27
+ */
28
+ function processLoadCall(name, args, rootId, data) {
29
+ const { fileArg, envirArg } = getArguments(args, data);
30
+ if (!fileArg) {
31
+ const fn = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'default' });
32
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(fn.information.graph, fn.information.environment, rootId);
33
+ return fn.information;
34
+ }
35
+ const fn = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Load });
36
+ if (data.ctx.config.ignoreLoadCalls) {
37
+ logger_1.dataflowLogger.warn(`Skipping load call ${JSON.stringify(fileArg)} (disabled in config file)`);
38
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(fn.information.graph, fn.information.environment, rootId);
39
+ return fn.information;
40
+ }
41
+ const envirResolution = envirArg ? (0, built_in_envir_utils_1.resolveArgToEnvir)(envirArg, data) : undefined;
42
+ if (envirResolution) {
43
+ fn.information.graph.addEdge(rootId, envirResolution.envirNodeId, edge_1.EdgeType.Reads);
44
+ }
45
+ let sourceFile;
46
+ if (fileArg.type === type_1.RType.String) {
47
+ sourceFile = [(0, retriever_1.removeRQuotes)(fileArg.lexeme)];
48
+ }
49
+ else {
50
+ const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(fileArg.info.id, { environment: envirResolution ? envirResolution.envirData.environment : data.environment, idMap: data.completeAst.idMap, resolve: data.ctx.config.solver.variables, ctx: data.ctx }));
51
+ sourceFile = resolved?.elements.map(r => r.type === 'string' && (0, r_value_1.isValue)(r.value) ? r.value.str : undefined).filter(assert_1.isNotUndefined);
52
+ }
53
+ if (sourceFile) {
54
+ for (const candidate of sourceFile) {
55
+ const path = (0, retriever_1.removeRQuotes)(candidate);
56
+ let filepath = path ? (0, built_in_source_1.findSource)(data.ctx.config.solver.resolveSource, path, data) : path;
57
+ if (Array.isArray(filepath)) {
58
+ if (filepath.length > 1) {
59
+ logger_1.dataflowLogger.warn(`Found multiple candidate files for load(${JSON.stringify(path)}): ${JSON.stringify(filepath)}, using first match`);
60
+ }
61
+ filepath = filepath.find(assert_1.isNotUndefined);
62
+ }
63
+ if (filepath === undefined) {
64
+ continue;
65
+ }
66
+ let variables;
67
+ try {
68
+ const file = data.ctx.files.resolveFile(filepath);
69
+ variables = file instanceof flowr_rda_file_1.FlowrRDAFile ? file.content() : null;
70
+ }
71
+ catch (e) {
72
+ logger_1.dataflowLogger.warn(`Failed to parse RDA file ${JSON.stringify(filepath)}: ${String(e)}`);
73
+ continue;
74
+ }
75
+ if (variables === null) {
76
+ logger_1.dataflowLogger.warn(`Could not read ${JSON.stringify(filepath)} as an RDA file, treating the load as unknown`);
77
+ continue;
78
+ }
79
+ if (variables.length === 0) {
80
+ return fn.information;
81
+ }
82
+ let envir = envirResolution ? envirResolution.envirData.environment : fn.information.environment;
83
+ const loadLocation = name.location ?? name.fullRange ?? range_1.SourceRange.invalid();
84
+ const loadCds = [...(data.cds ?? []), { id: rootId, when: true, file: filepath }];
85
+ for (const variable of variables) {
86
+ if (variable.name) {
87
+ envir = defineLoadedVariable({ ...variable, name: variable.name }, rootId, fn, envir, loadLocation, loadCds, data);
88
+ }
89
+ }
90
+ return { ...fn.information, environment: envir };
91
+ }
92
+ }
93
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(fn.information.graph, fn.information.environment, rootId);
94
+ return fn.information;
95
+ }
96
+ function defineLoadedVariable(variable, rootId, fn, envir, loadLocation, loadCds, data) {
97
+ const syntheticId = `${rootId}:loaded:${variable.name}`;
98
+ const isClosure = variable.type === flowr_rda_file_1.SexpType.CloSxp;
99
+ const rootInfo = data.completeAst.idMap.get(rootId)?.info;
100
+ data.completeAst.idMap.set(syntheticId, {
101
+ type: type_1.RType.Symbol,
102
+ content: variable.name,
103
+ lexeme: variable.name,
104
+ location: loadLocation,
105
+ namespace: undefined,
106
+ info: {
107
+ ...rootInfo,
108
+ id: syntheticId,
109
+ parent: rootId,
110
+ role: "el-c" /* RoleInParent.ExpressionListChild */,
111
+ }
112
+ });
113
+ if (isClosure) {
114
+ defineLoadedClosure(syntheticId, variable, fn, envir, loadLocation, loadCds, data, rootInfo);
115
+ }
116
+ else {
117
+ fn.information.graph.addVertex({
118
+ tag: vertex_1.VertexType.VariableDefinition,
119
+ id: syntheticId,
120
+ cds: loadCds,
121
+ }, envir);
122
+ }
123
+ const nodeToDefine = {
124
+ nodeId: syntheticId,
125
+ name: variable.name,
126
+ type: sexpTypeToReferenceType(variable.type),
127
+ definedAt: rootId,
128
+ cds: loadCds,
129
+ };
130
+ const newCurrent = envir.current.define(nodeToDefine);
131
+ return { ...envir, current: newCurrent };
132
+ }
133
+ function defineLoadedClosure(syntheticId, variable, fn, envir, loadLocation, loadCds, data, rootInfo) {
134
+ const fdefId = `${syntheticId}:fdef`;
135
+ const cleanEnv = data.ctx.env.makeCleanEnv();
136
+ const bodyId = `${fdefId}:body`;
137
+ const body = {
138
+ type: type_1.RType.ExpressionList,
139
+ lexeme: undefined,
140
+ grouping: undefined,
141
+ children: [],
142
+ location: loadLocation,
143
+ info: {
144
+ ...rootInfo,
145
+ id: bodyId,
146
+ parent: fdefId,
147
+ role: "fun-b" /* RoleInParent.FunctionDefinitionBody */,
148
+ }
149
+ };
150
+ data.completeAst.idMap.set(bodyId, body);
151
+ data.completeAst.idMap.set(fdefId, {
152
+ type: type_1.RType.FunctionDefinition,
153
+ parameters: [],
154
+ lexeme: variable.name,
155
+ location: loadLocation,
156
+ body,
157
+ info: {
158
+ ...rootInfo,
159
+ id: fdefId,
160
+ parent: syntheticId,
161
+ role: "el-c" /* RoleInParent.ExpressionListChild */,
162
+ }
163
+ });
164
+ const flow = {
165
+ entryPoint: fdefId,
166
+ graph: new Set(),
167
+ out: [],
168
+ in: [],
169
+ unknownReferences: [],
170
+ hooks: [],
171
+ environment: cleanEnv
172
+ };
173
+ fn.information.graph.addVertex({
174
+ tag: vertex_1.VertexType.FunctionDefinition,
175
+ id: fdefId,
176
+ cds: loadCds,
177
+ environment: cleanEnv,
178
+ subflow: flow,
179
+ exitPoints: [],
180
+ params: {},
181
+ }, cleanEnv);
182
+ fn.information.graph.addVertex({
183
+ tag: vertex_1.VertexType.VariableDefinition,
184
+ id: syntheticId,
185
+ cds: loadCds,
186
+ }, envir);
187
+ fn.information.graph.addEdge(syntheticId, fdefId, edge_1.EdgeType.DefinedBy);
188
+ }
189
+ function sexpTypeToReferenceType(type) {
190
+ if (type === undefined) {
191
+ return identifier_1.ReferenceType.Unknown;
192
+ }
193
+ switch (type) {
194
+ case flowr_rda_file_1.SexpType.NilSxp:
195
+ return identifier_1.ReferenceType.Unknown;
196
+ case flowr_rda_file_1.SexpType.SymSxp:
197
+ case flowr_rda_file_1.SexpType.CharSxp:
198
+ case flowr_rda_file_1.SexpType.LglSxp:
199
+ case flowr_rda_file_1.SexpType.IntSxp:
200
+ case flowr_rda_file_1.SexpType.RealSxp:
201
+ case flowr_rda_file_1.SexpType.CplxSxp:
202
+ case flowr_rda_file_1.SexpType.StrSxp:
203
+ case flowr_rda_file_1.SexpType.RawSxp:
204
+ case flowr_rda_file_1.SexpType.ListSxp:
205
+ case flowr_rda_file_1.SexpType.EnvSxp:
206
+ case flowr_rda_file_1.SexpType.PromSxp:
207
+ case flowr_rda_file_1.SexpType.LangSxp:
208
+ case flowr_rda_file_1.SexpType.DotSxp:
209
+ case flowr_rda_file_1.SexpType.VecSxp:
210
+ case flowr_rda_file_1.SexpType.ExprSxp:
211
+ case flowr_rda_file_1.SexpType.ObjSxp:
212
+ return identifier_1.ReferenceType.Variable;
213
+ case flowr_rda_file_1.SexpType.CloSxp:
214
+ return identifier_1.ReferenceType.Function;
215
+ case flowr_rda_file_1.SexpType.SpecialSxp:
216
+ case flowr_rda_file_1.SexpType.BuiltInSxp:
217
+ return identifier_1.ReferenceType.BuiltInFunction;
218
+ default:
219
+ return identifier_1.ReferenceType.Unknown;
220
+ }
221
+ }
222
+ function getArguments(args, data) {
223
+ // prefer R's real `base::load` signature from the database, falling back to the known formals when it is absent
224
+ const loadParams = (0, built_in_envir_utils_1.signatureParamNames)(data, identifier_1.Identifier.make('load', "base" /* PkgName.Base */), ['file', 'envir', 'verbose']);
225
+ const bound = (0, built_in_envir_utils_1.bindArgs)(args, loadParams);
226
+ const fileArgBound = bound.get('file');
227
+ const envirArg = bound.get('envir');
228
+ const verboseArgBound = bound.get('verbose');
229
+ const fileArg = fileArgBound && fileArgBound !== r_function_call_1.EmptyArgument ? (0, unpack_argument_1.unpackArg)(fileArgBound) : undefined;
230
+ const verboseArg = verboseArgBound && verboseArgBound !== r_function_call_1.EmptyArgument ? (0, unpack_argument_1.unpackArg)(verboseArgBound) : undefined;
231
+ return { fileArg, envirArg, verboseArg };
232
+ }
233
+ //# sourceMappingURL=built-in-load.js.map
@@ -163,6 +163,7 @@ function processSourceCall(name, args, rootId, data, config) {
163
163
  if (filepath !== undefined && filepath.length > 0) {
164
164
  let result = information;
165
165
  const origCds = data.cds?.slice() ?? [];
166
+ const maybe = !data.ctx.config.solver.resolveSource?.assumeFilesExist || filepath.length > 1;
166
167
  for (const f of filepath) {
167
168
  // check if the sourced file has already been dataflow analyzed, and if so, skip it
168
169
  const limit = data.ctx.config.solver.resolveSource?.repeatedSourceLimit ?? 0;
@@ -178,7 +179,7 @@ function processSourceCall(name, args, rootId, data, config) {
178
179
  result = sourceRequest(rootId, {
179
180
  request: 'file',
180
181
  content: f
181
- }, data, result, true, (0, decorate_1.sourcedDeterministicCountingIdGenerator)((findCount > 0 ? findCount + '::' : '') + f, name.location));
182
+ }, data, result, maybe, (0, decorate_1.sourcedDeterministicCountingIdGenerator)((findCount > 0 ? findCount + '::' : '') + data.ctx.files.relativePath(f), name.location));
182
183
  }
183
184
  return result;
184
185
  }
@@ -10,8 +10,8 @@ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-
10
10
  const common_1 = require("../common");
11
11
  const edge_1 = require("../../../../../graph/edge");
12
12
  const linker_1 = require("../../../../linker");
13
- /** Formal parameter names for `with(data, expr, ...)` and `within(data, expr, ...)`. */
14
- const withParams = ['data', 'expr'];
13
+ /** Fallback formal parameter names for `with(data, expr, ...)` / `within(data, expr, ...)` when the signature database has no `base::with`. */
14
+ const withParamsFallback = ['data', 'expr'];
15
15
  /** Normal call analysis, marking the data-masked arguments (columns of the data) as NSE. */
16
16
  function markAsMaskedFallback(name, args, rootId, data) {
17
17
  const { information, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.With });
@@ -38,7 +38,9 @@ function processWithEnv(name, args, rootId, data) {
38
38
  if (args.length < 2) {
39
39
  return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.With }).information;
40
40
  }
41
- const bound = (0, built_in_envir_utils_1.bindArgs)(args, withParams);
41
+ // prefer R's real `base::with` signature from the database, falling back to the known formals when it is absent
42
+ // use the call's own name (`with` or `within`) qualified to base, so each gets its real signature
43
+ const bound = (0, built_in_envir_utils_1.bindArgs)(args, (0, built_in_envir_utils_1.signatureParamNames)(data, identifier_1.Identifier.make(identifier_1.Identifier.getName(name.content), "base" /* PkgName.Base */), withParamsFallback));
42
44
  const dataArg = bound.get('data');
43
45
  const exprArg = bound.get('expr');
44
46
  // when we cannot resolve the data to a tracked environment, `expr` is still data-masked: its symbols name
@@ -5,6 +5,7 @@ const wiki_faq_store_1 = require("./wiki-faq-store");
5
5
  const doc_files_1 = require("../../doc-util/doc-files");
6
6
  const doc_code_1 = require("../../doc-util/doc-code");
7
7
  const recommended_configs_1 = require("./recommended-configs");
8
+ const project_kind_1 = require("../../../project/context/project-kind");
8
9
  /**
9
10
  *
10
11
  */
@@ -75,7 +76,17 @@ ${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
75
76
  For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
76
77
  If you want to create your own project using flowR as a library, check out the
77
78
  [${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
78
- `);
79
+ `)
80
+ .addFaq('How to configure flowR *per kind of project*?', `
81
+ Use ${ctx.linkConfig('specializeConfig')}: it overwrites (parts of) the configuration depending on the kind of project flowR detects (e.g. \`${project_kind_1.ProjectKind.ShinyApp}\`).
82
+ This is how a shiny app gets its ${ctx.linkConfig('project.implicitSources')} out of the box, as shiny loads these files without any \`source()\` call:
83
+ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
84
+ specializeConfig: {
85
+ [project_kind_1.ProjectKind.ShinyApp]: { project: { implicitSources: ['global.R', 'ui.R', 'server.R', 'app.R'] } }
86
+ }
87
+ }, null, 2))}
88
+ Anything you configure directly wins over the value the project kind defaults to, so setting \`project.implicitSources\` yourself overrides the list above.
89
+ `);
79
90
  wikiFaq.withTopic('r.packages')
80
91
  .addFaq('What is the R *prelude* and R *base* package?', `
81
92
  The base package contains lots of base functions like \`source\` for example.
@@ -195,7 +195,7 @@ ${await (0, doc_repl_1.documentReplSession)(treeSitter, [{
195
195
 
196
196
  * 📚 **dependency analysis**\\
197
197
  Given your analysis project, flowR offers a plethora of so-called ${ctx.linkPage('wiki/Query API', 'queries')} to get more information about your code.
198
- An important query is the ${ctx.linkPage('wiki/Query API', 'dependencies query', 'dependencies-query')}, which shows you the library your project needs,
198
+ An important query is the ${(0, doc_query_1.linkToQueryOfName)('dependencies', 'dependencies query')}, which shows you the library your project needs,
199
199
  the data files it reads, the scripts it sources, and the data it outputs.
200
200
 
201
201
  ${(0, doc_general_1.prefixLines)((0, doc_structure_1.details)('Example: Dependency Analysis with flowR', `
@@ -1,3 +1,4 @@
1
+ import { toPosixPath } from '../../util/files';
1
2
  export declare const FlowrGithubGroupName = "flowr-analysis";
2
3
  export declare const FlowrGithubBaseRef = "https://github.com/flowr-analysis";
3
4
  export declare const FlowrSiteBaseRef = "https://flowr-analysis.github.io/flowr";
@@ -11,8 +12,7 @@ export declare const FlowrVsCode = "https://marketplace.visualstudio.com/items?i
11
12
  export declare const FlowrPositron = "https://open-vsx.org/extension/code-inspect/vscode-flowr";
12
13
  export declare const FlowrRStudioAddin = "https://github.com/flowr-analysis/rstudio-addin-flowr";
13
14
  export declare const FlowrRAdapter = "https://github.com/flowr-analysis/flowr-r-adapter";
14
- /** Converts backslashes to forward slashes (Windows paths). */
15
- export declare function toPosixPath(p: string): string;
15
+ export { toPosixPath };
16
16
  /**
17
17
  * Returns a markdown link to the given file path relative to the project root.
18
18
  */
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlowrRAdapter = exports.FlowrRStudioAddin = exports.FlowrPositron = exports.FlowrVsCode = exports.FlowrCodecovRef = exports.FlowrDockerRef = exports.FlowrNpmRef = exports.FlowrGithubRef = exports.FlowrWikiBaseRef = exports.RemoteFlowrFilePathBaseRef = exports.FlowrSiteBaseRef = exports.FlowrGithubBaseRef = exports.FlowrGithubGroupName = void 0;
7
- exports.toPosixPath = toPosixPath;
6
+ exports.toPosixPath = exports.FlowrRAdapter = exports.FlowrRStudioAddin = exports.FlowrPositron = exports.FlowrVsCode = exports.FlowrCodecovRef = exports.FlowrDockerRef = exports.FlowrNpmRef = exports.FlowrGithubRef = exports.FlowrWikiBaseRef = exports.RemoteFlowrFilePathBaseRef = exports.FlowrSiteBaseRef = exports.FlowrGithubBaseRef = exports.FlowrGithubGroupName = void 0;
8
7
  exports.getFilePathMd = getFilePathMd;
9
8
  exports.getFileContentFromRoot = getFileContentFromRoot;
10
9
  exports.linkFlowRSourceFile = linkFlowRSourceFile;
11
10
  const fs_1 = __importDefault(require("fs"));
12
11
  const path_1 = __importDefault(require("path"));
12
+ const files_1 = require("../../util/files");
13
+ Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return files_1.toPosixPath; } });
13
14
  exports.FlowrGithubGroupName = 'flowr-analysis';
14
15
  exports.FlowrGithubBaseRef = `https://github.com/${exports.FlowrGithubGroupName}`;
15
16
  exports.FlowrSiteBaseRef = `https://${exports.FlowrGithubGroupName}.github.io/flowr`;
@@ -23,17 +24,13 @@ exports.FlowrVsCode = 'https://marketplace.visualstudio.com/items?itemName=code-
23
24
  exports.FlowrPositron = 'https://open-vsx.org/extension/code-inspect/vscode-flowr';
24
25
  exports.FlowrRStudioAddin = `${exports.FlowrGithubBaseRef}/rstudio-addin-flowr`;
25
26
  exports.FlowrRAdapter = `${exports.FlowrGithubBaseRef}/flowr-r-adapter`;
26
- /** Converts backslashes to forward slashes (Windows paths). */
27
- function toPosixPath(p) {
28
- return p.replaceAll('\\', '/');
29
- }
30
27
  /**
31
28
  * Returns a markdown link to the given file path relative to the project root.
32
29
  */
33
30
  function getFilePathMd(filePath) {
34
31
  // we go one up as we are in doc-util now :D #convenience
35
32
  const fullpath = require.resolve('../' + filePath);
36
- const relative = './' + toPosixPath(path_1.default.relative(process.cwd(), fullpath));
33
+ const relative = './' + (0, files_1.toPosixPath)(path_1.default.relative(process.cwd(), fullpath));
37
34
  return `[\`${relative}\`](${exports.RemoteFlowrFilePathBaseRef}${relative})`;
38
35
  }
39
36
  /**
@@ -22,7 +22,8 @@ export interface ShowQueryOptions {
22
22
  */
23
23
  export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(parser: KnownParser, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery, shorthand, ctx, files }?: ShowQueryOptions): Promise<string>;
24
24
  export interface QueryDocumentation {
25
- readonly name: string;
25
+ /** only for virtual queries, active ones carry their {@link SupportedQuery.title} */
26
+ readonly name?: string;
26
27
  readonly type: 'virtual' | 'active';
27
28
  readonly shortDescription: string;
28
29
  readonly functionName: string;
@@ -43,15 +44,17 @@ export declare function registerQueryDocumentation(query: SupportedQueryTypes |
43
44
  * `i` inlines resolvable `source()` calls into the reconstruction; the flags may be combined as `fi`).
44
45
  */
45
46
  export declare function sliceQueryShorthand(criteria: SlicingCriteria, code: string, forward?: boolean, inline?: boolean): string;
46
- /**
47
- *
48
- */
49
- export declare function linkToQueryOfName(id: SupportedQueryTypes | SupportedVirtualQueryTypes): string;
47
+ /** The display name of a query, from its definition or, for a virtual query, its documentation. */
48
+ export declare function getQueryTitle(id: string): string;
49
+ /** Mirrors the `[Linting Rule] ...` pages, see `getPageNameForLintingRule`. */
50
+ export declare function getPageNameForQuery(id: string): string;
51
+ /** `linkText` defaults to the query's title. */
52
+ export declare function linkToQueryOfName(id: SupportedQueryTypes | SupportedVirtualQueryTypes, linkText?: string): string;
50
53
  /**
51
54
  *
52
55
  */
53
56
  export declare function tocForQueryType(type: 'active' | 'virtual'): string;
54
- /**
55
- *
56
- */
57
- export declare function explainQueries(shell: RShell, ctx: GeneralDocContext, type: 'active' | 'virtual'): Promise<string>;
57
+ /** Keyed by the file path each page is written to. */
58
+ export declare function queryPages(shell: RShell, ctx: GeneralDocContext, type: 'active' | 'virtual'): Promise<Record<string, string>>;
59
+ /** Without this, a new query would silently end up without a wiki page. */
60
+ export declare function assertAllQueriesDocumented(): void;
@@ -1,12 +1,24 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.RegisteredQueries = void 0;
4
7
  exports.showQuery = showQuery;
5
8
  exports.registerQueryDocumentation = registerQueryDocumentation;
6
9
  exports.sliceQueryShorthand = sliceQueryShorthand;
10
+ exports.getQueryTitle = getQueryTitle;
11
+ exports.getPageNameForQuery = getPageNameForQuery;
7
12
  exports.linkToQueryOfName = linkToQueryOfName;
8
13
  exports.tocForQueryType = tocForQueryType;
9
- exports.explainQueries = explainQueries;
14
+ exports.queryPages = queryPages;
15
+ exports.assertAllQueriesDocumented = assertAllQueriesDocumented;
16
+ const query_1 = require("../../queries/query");
17
+ const virtual_queries_1 = require("../../queries/virtual-query/virtual-queries");
18
+ const doc_auto_gen_1 = require("./doc-auto-gen");
19
+ const doc_structure_1 = require("./doc-structure");
20
+ const assert_1 = require("../../util/assert");
21
+ const path_1 = __importDefault(require("path"));
10
22
  const json_1 = require("../../util/json");
11
23
  const ansi_1 = require("../../util/text/ansi");
12
24
  const doc_files_1 = require("./doc-files");
@@ -17,6 +29,7 @@ const query_print_1 = require("../../queries/query-print");
17
29
  const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
18
30
  const flowr_file_1 = require("../../project/context/flowr-file");
19
31
  const doc_cli_option_1 = require("./doc-cli-option");
32
+ const QueryDocFile = 'src/documentation/wiki-query.ts';
20
33
  /**
21
34
  * Visualizes a query and its results in markdown format.
22
35
  */
@@ -96,37 +109,48 @@ function registerQueryDocumentation(query, doc) {
96
109
  function sliceQueryShorthand(criteria, code, forward, inline) {
97
110
  return `(${(criteria.join(';'))})${forward ? 'f' : ''}${inline ? 'i' : ''} "${code}"`;
98
111
  }
99
- function linkify(name) {
100
- return name.toLowerCase().replace(/ /g, '-');
112
+ /** The display name of a query, from its definition or, for a virtual query, its documentation. */
113
+ function getQueryTitle(id) {
114
+ const title = query_1.SupportedQueries[id]?.title
115
+ ?? exports.RegisteredQueries.virtual.get(id)?.name;
116
+ (0, assert_1.guard)(title !== undefined, () => `Query ${id} is not documented!`);
117
+ return title;
101
118
  }
102
- /**
103
- *
104
- */
105
- function linkToQueryOfName(id) {
106
- const query = exports.RegisteredQueries.active.get(id) ?? exports.RegisteredQueries.virtual.get(id);
107
- if (!query) {
108
- throw new Error(`Query ${id} not found`);
109
- }
110
- return `[${query.name}](#${linkify(query.name)})`;
119
+ /** Mirrors the `[Linting Rule] ...` pages, see `getPageNameForLintingRule`. */
120
+ function getPageNameForQuery(id) {
121
+ return (0, query_1.queryWikiPage)(getQueryTitle(id));
122
+ }
123
+ function queryPageUrl(id) {
124
+ return `${doc_files_1.FlowrWikiBaseRef}/${encodeURIComponent(getPageNameForQuery(id).replaceAll(' ', '-'))}`;
125
+ }
126
+ /** `linkText` defaults to the query's title. */
127
+ function linkToQueryOfName(id, linkText) {
128
+ return `[${linkText ?? getQueryTitle(id)}](${queryPageUrl(id)})`;
111
129
  }
112
130
  /**
113
131
  *
114
132
  */
115
133
  function tocForQueryType(type) {
116
- const queries = [...exports.RegisteredQueries[type].entries()].sort(([, { name: a }], [, { name: b }]) => a.localeCompare(b));
134
+ const queries = [...exports.RegisteredQueries[type].keys()].sort((a, b) => getQueryTitle(a).localeCompare(getQueryTitle(b)));
117
135
  const result = [];
118
- for (const [id, { name, shortDescription }] of queries) {
119
- result.push(`1. [${name}](#${linkify(name)}) (\`${id}\`):\\\n ${shortDescription}`);
136
+ for (const id of queries) {
137
+ result.push(`1. ${linkToQueryOfName(id)} (\`${id}\`):\\\n ${exports.RegisteredQueries[type].get(id)?.shortDescription}`);
120
138
  }
121
139
  return result.join('\n');
122
140
  }
123
- async function explainQuery(shell, ctx, { name, functionName, functionFile, buildExplanation }) {
141
+ async function explainQuery(shell, ctx, id, { shortDescription, functionName, functionFile, buildExplanation }) {
142
+ const name = getQueryTitle(id);
143
+ const syntax = query_1.SupportedQueries[id]?.syntax;
124
144
  return `
125
- ### ${name}
145
+ ${(0, doc_auto_gen_1.autoGenHeader)({ filename: QueryDocFile, purpose: 'query API' })}
146
+ ${(0, doc_structure_1.section)(name + `&emsp;<sup>[<a href="${doc_files_1.FlowrWikiBaseRef}/Query-API">overview</a>]</sup>`, 2, name)}
147
+
148
+ ${shortDescription}\\
149
+ _This query is requested with the type \`${id}\`._${syntax ? `\\\nRun in the REPL: \`:query ${syntax}\`` : ''}
126
150
 
127
151
  ${await buildExplanation(shell, ctx)}
128
152
 
129
- <details>
153
+ <details>
130
154
 
131
155
  <summary style="color:gray">Implementation Details</summary>
132
156
 
@@ -134,17 +158,28 @@ Responsible for the execution of the ${name} query is \`${functionName}\` in ${(
134
158
 
135
159
  </details>
136
160
 
137
- `;
161
+ `.trim();
138
162
  }
139
- /**
140
- *
141
- */
142
- async function explainQueries(shell, ctx, type) {
143
- const queries = [...exports.RegisteredQueries[type].entries()].sort(([, { name: a }], [, { name: b }]) => a.localeCompare(b));
144
- const result = [];
145
- for (const [, doc] of queries) {
146
- result.push(await explainQuery(shell, ctx, doc));
163
+ /** Keyed by the file path each page is written to. */
164
+ async function queryPages(shell, ctx, type) {
165
+ const result = {};
166
+ for (const [id, doc] of exports.RegisteredQueries[type].entries()) {
167
+ result[path_1.default.join('wiki', `${getPageNameForQuery(id)}.md`)] = await explainQuery(shell, ctx, id, doc);
147
168
  }
148
- return result.join(`\n${'-'.repeat(5)}\n\n`);
169
+ return result;
170
+ }
171
+ /** Without this, a new query would silently end up without a wiki page. */
172
+ function assertAllQueriesDocumented() {
173
+ const undocumented = [
174
+ ...Object.keys(query_1.SupportedQueries).filter(q => !exports.RegisteredQueries.active.has(q)),
175
+ ...Object.keys(virtual_queries_1.SupportedVirtualQueries).filter(q => !exports.RegisteredQueries.virtual.has(q))
176
+ ];
177
+ (0, assert_1.guard)(undocumented.length === 0, () => `The quer${undocumented.length === 1 ? 'y' : 'ies'} ${undocumented.map(q => `'${q}'`).join(', ')} ${undocumented.length === 1 ? 'has' : 'have'} no documentation! `
178
+ + `Please add a 'registerQueryDocumentation' entry in ${QueryDocFile}.`);
179
+ const stale = [
180
+ ...[...exports.RegisteredQueries.active.keys()].filter(q => !(q in query_1.SupportedQueries)),
181
+ ...[...exports.RegisteredQueries.virtual.keys()].filter(q => !(q in virtual_queries_1.SupportedVirtualQueries))
182
+ ];
183
+ (0, assert_1.guard)(stale.length === 0, () => `The documentation of ${stale.map(q => `'${q}'`).join(', ')} refers to (a) query type(s) that no longer exist(s).`);
149
184
  }
150
185
  //# sourceMappingURL=doc-query.js.map
@@ -116,9 +116,6 @@ In _flowR_, an abstract domain is represented by the class ${ctx.link(abstract_d
116
116
  * ${ctx.linkM(abstract_domain_1.AbstractDomain, 'widen')} to perform widening with another abstract value to ensure termination of the fixpoint iteration
117
117
  * ${ctx.linkM(abstract_domain_1.AbstractDomain, 'narrow')} to perform narrowing with another abstract value to refine the abstract value after widening
118
118
 
119
- - ${ctx.linkM(abstract_domain_1.AbstractDomain, 'concretize')} representing the concretization function of the abstract domain
120
- - ${ctx.linkM(abstract_domain_1.AbstractDomain, 'abstract')} representing the abstraction function of the abstract domain
121
-
122
119
  ${(0, doc_structure_1.details)('Class Diagram', `
123
120
  All boxes link to their respective implementation in the source code.
124
121
  ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(abstract_domain_1.AbstractDomain))}
@@ -137,7 +134,7 @@ ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(abstract_domain_1.AbstractDom
137
134
 
138
135
  Multiple abstract domains can be combined using a ${ctx.link(multi_value_state_domain_1.MultiValueDomain)} (for example, to use an interval domain for numbers and bounded set domain for strings at the same time). A multi-value state domain (${ctx.link(multi_value_state_domain_1.MultiValueStateDomain)}) as state domain of a multi-value domain can be used to track the state of multiple value domains in a program. Additionally, is enables to define reductions on the multi-value domain to refine the inferred value for a value domain based on the other value domains in the multi-value domain. For example, the following example shows how a multi-value state domain can be defined to track numbers and strings at the same time with a simple reduction that sets both domains to bottom if one domain is bottom.
139
136
 
140
- ${ctx.code(multiValueExample, { dropLinesStart: 1, dropLinesEnd: 1 })}
137
+ ${ctx.code(multiValueExample, { dropLinesStart: 1, dropLinesEnd: 1, hideDefinedAt: true })}
141
138
 
142
139
  ${(0, doc_structure_1.section)('Abstract Interpretation', 2, 'abstract-interpretation')}
143
140
 
@@ -256,9 +256,14 @@ However, if you want to _create_ new plugins, you should be aware of the differe
256
256
 
257
257
  Currently, flowR supports the following plugin types built-in:
258
258
 
259
- | Name | Class | Type | Description |
260
- |------|-------|------|-------------|
261
- ${plugin_registry_1.BuiltInPlugins.sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `| ${(0, doc_code_1.codeInline)(key)} | ${ctx.link(`${value.name}`)} | ${new value().type} | ${ctx.doc(`${value.name}`).replaceAll('|', '&#124;').replaceAll('\n', ' ')} |`).join('\n')}
259
+ | Name | Type | What it does | Class |
260
+ |------|------|--------------|-------|
261
+ ${plugin_registry_1.BuiltInPlugins.sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => {
262
+ const plugin = new value();
263
+ /* the plugin states what it does in one line, the class doc is the fallback for the ones that do not */
264
+ const describe = plugin.description || ctx.doc(`${value.name}`);
265
+ return `| ${(0, doc_code_1.codeInline)(key)} | ${(0, doc_code_1.codeInline)(plugin.type)} | ${describe.replaceAll('|', '&#124;').replaceAll('\n', ' ').trim()} | ${ctx.link(`${value.name}`)} |`;
266
+ }).join('\n')}
262
267
 
263
268
 
264
269
  ${(0, doc_structure_1.section)('Plugin Types', 3)}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WikiCfg = void 0;
4
4
  const doc_cli_option_1 = require("./doc-util/doc-cli-option");
5
+ const doc_query_1 = require("./doc-util/doc-query");
5
6
  const doc_structure_1 = require("./doc-util/doc-structure");
6
7
  const doc_cfg_1 = require("./doc-util/doc-cfg");
7
8
  const simple_visitor_1 = require("../control-flow/simple-visitor");
@@ -121,7 +122,7 @@ class WikiCfg extends doc_maker_1.DocMaker {
121
122
  return `
122
123
  _flowR_ produces three main perspectives of the program: 1) a ${ctx.linkPage('wiki/Normalized AST', 'normalized version of the AST')}
123
124
  and 2) a ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')}, and 3) a control flow graph (CFG).
124
- 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 ${ctx.linkPage('wiki/Query API', 'Call-Context Query', 'call-context-query')}).
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 ${(0, doc_query_1.linkToQueryOfName)('call-context')}).
125
126
 
126
127
  Please note that, mostly due to historical reasons, the ${ctx.linkPage('wiki/Dataflow Graph', 'control dependencies', 'control-dependencies')} that are stored directly within the
127
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.
@@ -391,7 +392,7 @@ ${await (async () => {
391
392
  })()}
392
393
 
393
394
  A more useful appearance of these visitors occurs with ${ctx.link(happens_before_1.happensBefore)} which uses the CFG to determine whether the execution
394
- of one vertex always, maybe, or never happens before another vertex (see the corresponding ${ctx.linkPage('wiki/Query API', 'query documentation', 'happens-before-query')} for more information).
395
+ of one vertex always, maybe, or never happens before another vertex (see the corresponding ${(0, doc_query_1.linkToQueryOfName)('happens-before', 'query documentation')} for more information).
395
396
 
396
397
 
397
398
  ${(0, doc_structure_1.section)('Diffing and Testing', 3, 'cfg-diff-and-test')}