@eagleoutice/flowr 2.14.4 → 2.15.1

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 (384) hide show
  1. package/README.md +77 -64
  2. package/abstract-interpretation/absint-inference.d.ts +347 -0
  3. package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
  4. package/abstract-interpretation/abstract-semantics.d.ts +246 -0
  5. package/abstract-interpretation/abstract-semantics.js +3 -0
  6. package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
  7. package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
  8. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.js +1665 -0
  10. package/abstract-interpretation/data-frame/resolve-args.js +4 -4
  11. package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
  12. package/abstract-interpretation/data-frame/semantics.js +27 -29
  13. package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
  14. package/abstract-interpretation/data-frame/shape-inference.js +14 -79
  15. package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
  16. package/abstract-interpretation/domains/interval-domain.js +25 -33
  17. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
  18. package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
  19. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
  20. package/abstract-interpretation/domains/partial-product-domain.js +26 -43
  21. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
  22. package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
  23. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  24. package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
  25. package/abstract-interpretation/domains/set-range-domain.js +29 -62
  26. package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
  27. package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
  28. package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
  29. package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
  30. package/abstract-interpretation/value-semantics.d.ts +113 -0
  31. package/abstract-interpretation/value-semantics.js +115 -0
  32. package/benchmark/slicer.js +12 -6
  33. package/benchmark/stats/feature-counts.d.ts +2 -1
  34. package/benchmark/stats/feature-counts.js +25 -1
  35. package/benchmark/stats/stats.d.ts +4 -0
  36. package/benchmark/summarizer/second-phase/graph.js +7 -0
  37. package/cli/repl/commands/repl-parse.js +11 -22
  38. package/cli/repl/parser/slice-query-parser.d.ts +2 -0
  39. package/cli/repl/parser/slice-query-parser.js +1 -0
  40. package/config.d.ts +30 -205
  41. package/config.js +37 -3
  42. package/control-flow/cfg-properties.d.ts +5 -0
  43. package/control-flow/cfg-properties.js +25 -7
  44. package/control-flow/control-flow-graph.d.ts +11 -37
  45. package/control-flow/control-flow-graph.js +33 -77
  46. package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
  47. package/control-flow/semantic-cfg-guided-visitor.js +65 -320
  48. package/dataflow/environments/built-in-config.d.ts +2 -0
  49. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  50. package/dataflow/environments/built-in-proc-name.js +4 -0
  51. package/dataflow/environments/built-in-props.d.ts +192 -82
  52. package/dataflow/environments/built-in-props.js +336 -106
  53. package/dataflow/environments/built-in.d.ts +21 -9
  54. package/dataflow/environments/built-in.js +43 -12
  55. package/dataflow/environments/default-builtin-config.d.ts +3219 -313
  56. package/dataflow/environments/default-builtin-config.js +803 -1012
  57. package/dataflow/environments/environment.d.ts +26 -49
  58. package/dataflow/environments/environment.js +34 -47
  59. package/dataflow/environments/group-generics.d.ts +11 -2
  60. package/dataflow/environments/group-generics.js +22 -3
  61. package/dataflow/environments/identifier.d.ts +106 -6
  62. package/dataflow/environments/identifier.js +19 -1
  63. package/dataflow/environments/query-fn-props.d.ts +16 -8
  64. package/dataflow/environments/query-fn-props.js +45 -21
  65. package/dataflow/environments/resolve-by-name.js +9 -2
  66. package/dataflow/environments/scoping.d.ts +5 -0
  67. package/dataflow/environments/scoping.js +11 -0
  68. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  69. package/dataflow/eval/resolve/alias-tracking.js +24 -6
  70. package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
  71. package/dataflow/eval/resolve/resolve-numbers.js +44 -9
  72. package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
  73. package/dataflow/eval/resolve/resolve-strings.js +16 -7
  74. package/dataflow/eval/resolve/resolve.d.ts +5 -22
  75. package/dataflow/eval/resolve/resolve.js +34 -34
  76. package/dataflow/eval/values/general.d.ts +9 -1
  77. package/dataflow/eval/values/general.js +22 -3
  78. package/dataflow/eval/values/sets/set-constants.d.ts +5 -0
  79. package/dataflow/eval/values/sets/set-constants.js +9 -1
  80. package/dataflow/eval/values/string/string-constants.d.ts +16 -15
  81. package/dataflow/eval/values/string/string-constants.js +59 -27
  82. package/dataflow/extractor.d.ts +2 -1
  83. package/dataflow/extractor.js +16 -4
  84. package/dataflow/fn/argument-roles.d.ts +35 -0
  85. package/dataflow/fn/argument-roles.js +252 -0
  86. package/dataflow/fn/class-declaration.d.ts +148 -0
  87. package/dataflow/fn/class-declaration.js +317 -0
  88. package/dataflow/fn/condition-handlers.d.ts +5 -0
  89. package/dataflow/fn/condition-handlers.js +13 -0
  90. package/dataflow/fn/exceptions-of-function.d.ts +21 -7
  91. package/dataflow/fn/exceptions-of-function.js +74 -43
  92. package/dataflow/fn/frame-reflection.d.ts +46 -0
  93. package/dataflow/fn/frame-reflection.js +169 -0
  94. package/dataflow/fn/function-props.d.ts +32 -0
  95. package/dataflow/fn/function-props.js +160 -0
  96. package/dataflow/fn/higher-order-function.d.ts +23 -5
  97. package/dataflow/fn/higher-order-function.js +64 -18
  98. package/dataflow/fn/strict-function.d.ts +24 -2
  99. package/dataflow/fn/strict-function.js +49 -19
  100. package/dataflow/graph/call-graph.js +10 -2
  101. package/dataflow/graph/df-helper.d.ts +1 -12
  102. package/dataflow/graph/df-helper.js +2 -19
  103. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  104. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  105. package/dataflow/graph/graph.d.ts +39 -188
  106. package/dataflow/graph/graph.js +46 -163
  107. package/dataflow/graph/match-args.d.ts +34 -2
  108. package/dataflow/graph/match-args.js +45 -12
  109. package/dataflow/graph/vertex.d.ts +8 -0
  110. package/dataflow/info.d.ts +7 -5
  111. package/dataflow/info.js +1 -5
  112. package/dataflow/internal/control-flow.js +20 -17
  113. package/dataflow/internal/linker.d.ts +8 -37
  114. package/dataflow/internal/linker.js +22 -55
  115. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
  116. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
  117. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
  118. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
  119. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
  122. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
  123. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
  124. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
  125. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  126. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
  127. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
  129. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
  130. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
  131. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
  132. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
  133. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
  134. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
  135. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
  136. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  138. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
  139. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
  140. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
  141. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
  142. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
  143. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
  144. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
  145. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
  146. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +2 -1
  148. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
  149. package/dataflow/internal/process/functions/call/common.d.ts +4 -6
  150. package/dataflow/internal/process/functions/call/common.js +2 -2
  151. package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
  152. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  153. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
  154. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
  155. package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
  156. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
  157. package/dataflow/internal/process/functions/call/quoted.js +144 -28
  158. package/dataflow/origin/dfg-get-origin.js +23 -10
  159. package/dataflow/processor.d.ts +2 -1
  160. package/dataflow/processor.js +6 -0
  161. package/documentation/data/interface/doc-writing-code.js +2 -0
  162. package/documentation/doc-util/doc-search.js +1 -1
  163. package/documentation/wiki-absint.d.ts +11 -14
  164. package/documentation/wiki-absint.js +73 -59
  165. package/documentation/wiki-core.js +64 -24
  166. package/documentation/wiki-linter.js +1 -0
  167. package/documentation/wiki-query.js +82 -264
  168. package/documentation/wiki-signature-database.js +17 -5
  169. package/gas.d.ts +91 -47
  170. package/gas.js +97 -13
  171. package/index.d.ts +31 -0
  172. package/index.js +52 -0
  173. package/linter/linter-rules.d.ts +87 -23
  174. package/linter/linter-rules.js +3 -1
  175. package/linter/rules/absolute-path.d.ts +1 -1
  176. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  177. package/linter/rules/dataframe-access-validation.js +10 -8
  178. package/linter/rules/dead-code.d.ts +1 -1
  179. package/linter/rules/deprecated-functions.js +14 -5
  180. package/linter/rules/file-path-validity.d.ts +1 -1
  181. package/linter/rules/naming-convention.d.ts +1 -1
  182. package/linter/rules/naming-convention.js +13 -2
  183. package/linter/rules/network-functions.d.ts +10 -5
  184. package/linter/rules/network-functions.js +48 -36
  185. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  186. package/linter/rules/problematic-inputs.d.ts +1 -1
  187. package/linter/rules/problematic-inputs.js +1 -1
  188. package/linter/rules/seeded-randomness.d.ts +3 -2
  189. package/linter/rules/seeded-randomness.js +7 -3
  190. package/linter/rules/software-has-license.d.ts +1 -1
  191. package/linter/rules/software-has-tests.d.ts +1 -1
  192. package/linter/rules/stop-with-call-arg.d.ts +1 -1
  193. package/linter/rules/syntactically-valid.d.ts +1 -1
  194. package/linter/rules/unclosed-connection.d.ts +3 -3
  195. package/linter/rules/unclosed-connection.js +3 -4
  196. package/linter/rules/undefined-symbol.d.ts +1 -1
  197. package/linter/rules/unescaped-arguments.d.ts +161 -0
  198. package/linter/rules/unescaped-arguments.js +293 -0
  199. package/linter/rules/unused-definition.d.ts +1 -1
  200. package/linter/rules/unused-definition.js +49 -4
  201. package/linter/rules/unused-import.d.ts +1 -1
  202. package/linter/rules/useless-loop.d.ts +1 -1
  203. package/package.json +3 -198
  204. package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
  205. package/project/context/flowr-analyzer-environment-context.js +33 -1
  206. package/project/context/flowr-analyzer-files-context.d.ts +24 -1
  207. package/project/context/flowr-analyzer-files-context.js +42 -21
  208. package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
  209. package/project/context/flowr-analyzer-functions-context.js +2 -0
  210. package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
  211. package/project/context/flowr-analyzer-gas-context.js +21 -0
  212. package/project/context/flowr-file.d.ts +16 -1
  213. package/project/context/flowr-file.js +26 -2
  214. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
  215. package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
  216. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
  217. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
  218. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
  219. package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
  220. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
  221. package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
  222. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
  223. package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
  224. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
  225. package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
  226. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
  227. package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
  228. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
  229. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
  230. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
  231. package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
  232. package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
  233. package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
  234. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
  236. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
  237. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
  238. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
  239. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
  240. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
  241. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
  242. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
  243. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
  244. package/project/plugins/package-version-plugins/package.js +2 -1
  245. package/project/plugins/plugin-registry.d.ts +3 -1
  246. package/project/plugins/plugin-registry.js +11 -0
  247. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
  248. package/project/sigdb/build.d.ts +9 -15
  249. package/project/sigdb/build.js +101 -42
  250. package/project/sigdb/decode.d.ts +10 -4
  251. package/project/sigdb/decode.js +60 -21
  252. package/project/sigdb/memory-source.d.ts +4 -0
  253. package/project/sigdb/memory-source.js +8 -0
  254. package/project/sigdb/reader.d.ts +57 -100
  255. package/project/sigdb/reader.js +157 -108
  256. package/project/sigdb/schema.d.ts +90 -26
  257. package/project/sigdb/schema.js +12 -6
  258. package/queries/base-query-format.d.ts +7 -0
  259. package/queries/base-query-format.js +29 -0
  260. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  261. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  262. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  263. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  264. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  265. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  266. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  267. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  269. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  270. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  271. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  272. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  273. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  274. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  275. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  276. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  277. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  278. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  279. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  280. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  281. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  282. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  283. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  284. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  285. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  286. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  287. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  288. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  289. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  290. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
  291. package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
  292. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
  293. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
  294. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  295. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
  296. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
  297. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
  298. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
  299. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
  300. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
  301. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
  302. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
  303. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
  304. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
  305. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
  306. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  307. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  308. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  309. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  310. package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
  311. package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
  312. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  313. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  314. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
  315. package/queries/catalog/signature-query/signature-query-executor.js +87 -93
  316. package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
  317. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  318. package/queries/catalog/signature-query/signature-query-render.js +18 -4
  319. package/queries/catalog/slice-query-options.d.ts +14 -0
  320. package/queries/catalog/slice-query-options.js +15 -0
  321. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
  322. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  323. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
  324. package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
  325. package/queries/query-function-filter.d.ts +8 -3
  326. package/queries/query-function-filter.js +16 -6
  327. package/queries/query.d.ts +38 -38
  328. package/queries/query.js +30 -4
  329. package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
  330. package/r-bridge/lang-4.x/ast/model/model.js +14 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
  353. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
  354. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
  355. package/reconstruct/reconstruct.d.ts +9 -20
  356. package/reconstruct/reconstruct.js +66 -28
  357. package/search/flowr-search-filters.d.ts +7 -6
  358. package/search/flowr-search-filters.js +6 -4
  359. package/search/search-executor/search-enrichers.d.ts +10 -10
  360. package/search/search-executor/search-enrichers.js +32 -3
  361. package/search/search-executor/search-transformer.js +15 -23
  362. package/slicing/criterion/parse.js +2 -12
  363. package/slicing/static/slice-call.js +1 -8
  364. package/slicing/static/static-slicer.js +1 -1
  365. package/util/collections/bimap.js +14 -6
  366. package/util/objects.js +16 -17
  367. package/util/r-value.d.ts +5 -4
  368. package/util/record.d.ts +38 -3
  369. package/util/record.js +48 -1
  370. package/util/simple-df/dfg-ascii.js +1 -1
  371. package/util/text/strings.d.ts +5 -0
  372. package/util/text/strings.js +10 -0
  373. package/util/version.js +2 -2
  374. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  375. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  376. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  377. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  378. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  379. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  380. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  381. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  382. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  383. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  384. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -3,7 +3,7 @@ import type { IEnvironment, REnvironmentInformation } from '../../dataflow/envir
3
3
  import type { DeepReadonly } from 'ts-essentials';
4
4
  import type { IdentifierDefinition } from '../../dataflow/environments/identifier';
5
5
  import { Identifier } from '../../dataflow/environments/identifier';
6
- import type { BuiltInIdentifierDefinition } from '../../dataflow/environments/built-in';
6
+ import type { BuiltInIdentifierDefinition, BuiltInMemory } from '../../dataflow/environments/built-in';
7
7
  import type { Fingerprint } from '../../slicing/static/fingerprint';
8
8
  /**
9
9
  * Read-only interface to the {@link FlowrAnalyzerEnvironmentContext}.
@@ -35,6 +35,7 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
35
35
  get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
36
36
  /**
37
37
  * Create a new {@link REnvironmentInformation|environment} with the configured built-in environment as base.
38
+ * Knows only the built-ins, no attached package, so prefer {@link cleanEnvOf} wherever an environment is at hand.
38
39
  */
39
40
  makeCleanEnv(): REnvironmentInformation;
40
41
  /**
@@ -49,6 +50,10 @@ export interface ReadOnlyFlowrAnalyzerEnvironmentContext {
49
50
  * A completely empty {@link REnvironmentInformation|environment}.
50
51
  */
51
52
  makeEmptyEnv(): REnvironmentInformation;
53
+ /** What the configuration states about `pkg`'s exports, `undefined` when it states nothing (these are not in the built-in environment: attaching the package brings them into scope). */
54
+ statedFor(pkg: string): BuiltInMemory | undefined;
55
+ /** The definitions the configuration states for `name` without any package attached: its namespace's when it names one, otherwise what every package together states for the bare name. */
56
+ statedDefinitionsOf(name: Identifier): readonly IdentifierDefinition[] | undefined;
52
57
  }
53
58
  /**
54
59
  * Provides the built-in environment, created from the {@link FlowrAnalyzerContext} configuration.
@@ -57,10 +62,16 @@ export declare class FlowrAnalyzerEnvironmentContext implements ReadOnlyFlowrAna
57
62
  readonly name = "flowr-analyzer-environment-context";
58
63
  private readonly builtInEnv;
59
64
  private readonly emptyBuiltInEnv;
65
+ /** what the configuration states about packages R does not attach on startup, see {@link statedFor} */
66
+ private readonly stated;
60
67
  private builtInEnvFingerprint;
61
68
  /** the packages {@link knowsPackage} answers for, collected from the built-in environment on first use */
62
69
  private knownPackages;
70
+ /** {@link stated} by bare name across all packages, for {@link statedDefinitionsOf}; built on first use */
71
+ private statedByName;
63
72
  constructor(ctx: FlowrAnalyzerContext);
73
+ statedFor(pkg: string): BuiltInMemory | undefined;
74
+ statedDefinitionsOf(name: Identifier): readonly IdentifierDefinition[] | undefined;
64
75
  get builtInEnvironment(): DeepReadonly<IEnvironment>;
65
76
  get emptyBuiltInEnvironment(): DeepReadonly<IEnvironment>;
66
77
  builtInDefinitionsOf(name: Identifier): readonly IdentifierDefinition[];
@@ -12,9 +12,13 @@ class FlowrAnalyzerEnvironmentContext {
12
12
  name = 'flowr-analyzer-environment-context';
13
13
  builtInEnv;
14
14
  emptyBuiltInEnv;
15
+ /** what the configuration states about packages R does not attach on startup, see {@link statedFor} */
16
+ stated;
15
17
  builtInEnvFingerprint;
16
18
  /** the packages {@link knowsPackage} answers for, collected from the built-in environment on first use */
17
19
  knownPackages;
20
+ /** {@link stated} by bare name across all packages, for {@link statedDefinitionsOf}; built on first use */
21
+ statedByName;
18
22
  constructor(ctx) {
19
23
  const builtInsConfig = ctx.config.semantics.environment.overwriteBuiltIns;
20
24
  const builtIns = (0, built_in_config_1.getBuiltInDefinitions)(builtInsConfig.definitions, builtInsConfig.loadDefaults);
@@ -22,6 +26,34 @@ class FlowrAnalyzerEnvironmentContext {
22
26
  this.builtInEnv.memory = builtIns.builtInMemory;
23
27
  this.emptyBuiltInEnv = new environment_1.Environment(undefined, true);
24
28
  this.emptyBuiltInEnv.memory = builtIns.emptyBuiltInMemory;
29
+ this.stated = builtIns.packageMemory;
30
+ /* `pkg::fn` resolves whether or not the package is attached, so the built-in env answers for it */
31
+ this.builtInEnv.namespaces = builtIns.packageMemory;
32
+ }
33
+ statedFor(pkg) {
34
+ return this.stated.get(pkg);
35
+ }
36
+ statedDefinitionsOf(name) {
37
+ const bare = identifier_1.Identifier.getName(name);
38
+ const namespace = identifier_1.Identifier.getNamespace(name);
39
+ if (namespace !== undefined) {
40
+ return this.stated.get(String(namespace))?.get(bare);
41
+ }
42
+ if (this.statedByName === undefined) {
43
+ this.statedByName = new Map();
44
+ for (const memory of this.stated.values()) {
45
+ for (const [key, definitions] of memory) {
46
+ const known = this.statedByName.get(key);
47
+ if (known === undefined) {
48
+ this.statedByName.set(key, [...definitions]);
49
+ }
50
+ else {
51
+ known.push(...definitions);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ return this.statedByName.get(bare);
25
57
  }
26
58
  get builtInEnvironment() {
27
59
  return this.builtInEnv;
@@ -30,7 +62,7 @@ class FlowrAnalyzerEnvironmentContext {
30
62
  return this.emptyBuiltInEnv;
31
63
  }
32
64
  builtInDefinitionsOf(name) {
33
- return this.builtInEnv.memory.get(identifier_1.Identifier.getName(name)) ?? [];
65
+ return this.builtInEnv.memory.get(identifier_1.Identifier.getName(name)) ?? this.statedDefinitionsOf(name) ?? [];
34
66
  }
35
67
  knowsPackage(pkg) {
36
68
  if (this.knownPackages === undefined) {
@@ -8,6 +8,10 @@ import type { FlowrDescriptionFile } from '../plugins/file-plugins/files/flowr-d
8
8
  import type { FlowrNewsFile } from '../plugins/file-plugins/files/flowr-news-file';
9
9
  import type { FlowrNamespaceFile } from '../plugins/file-plugins/files/flowr-namespace-file';
10
10
  import type { FlowrManifestFile } from '../plugins/file-plugins/files/flowr-manifest-files';
11
+ import type { FlowrRdFile, FlowrRdIndexFile, FlowrRdMacroFile, FlowrRdMetaFile, FlowrRdTopicIndexFile, RdIndex } from '../plugins/file-plugins/files/flowr-rd-file';
12
+ import { FlowrDataListFile } from '../plugins/file-plugins/files/flowr-rd-file';
13
+ import type { SysdataObject } from '../plugins/file-plugins/files/flowr-sysdata-file';
14
+ import { FlowrSysdataFile } from '../plugins/file-plugins/files/flowr-sysdata-file';
11
15
  import type { ProjectKind } from './project-kind';
12
16
  import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
13
17
  import type { InvalidationEvent, InvalidationEventReceiver } from '../cache/flowr-cache';
@@ -27,6 +31,8 @@ export type RoleBasedFiles = {
27
31
  [FileRole.News]: FlowrNewsFile[];
28
32
  [FileRole.Namespace]: FlowrNamespaceFile[];
29
33
  [FileRole.Manifest]: FlowrManifestFile[];
34
+ /** what states which manual page documents a name: the `man/` pages and macros, an `INDEX`, and an installed package's `help/AnIndex` or `Meta/Rd.rds` */
35
+ [FileRole.Documentation]: (FlowrRdFile | FlowrRdIndexFile | FlowrRdMacroFile | FlowrRdTopicIndexFile | FlowrRdMetaFile)[];
30
36
  [FileRole.Vignette]: FlowrFileProvider[];
31
37
  [FileRole.Test]: FlowrFileProvider[];
32
38
  [FileRole.Install]: FlowrFileProvider[];
@@ -35,7 +41,8 @@ export type RoleBasedFiles = {
35
41
  [FileRole.Startup]: FlowrFileProvider[];
36
42
  [FileRole.Environment]: FlowrFileProvider[];
37
43
  [FileRole.Source]: FlowrFileProvider[];
38
- [FileRole.Data]: FlowrFileProvider[];
44
+ /** a `data/datalist` ({@link FlowrDataListFile}), a package's system data ({@link FlowrSysdataFile}), or any other data file, which has no special support */
45
+ [FileRole.Data]: (FlowrDataListFile | FlowrSysdataFile | FlowrFileProvider)[];
39
46
  [FileRole.Other]: FlowrFileProvider[];
40
47
  };
41
48
  /**
@@ -60,6 +67,15 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
60
67
  * ```
61
68
  */
62
69
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
70
+ /**
71
+ * The project's manual, built from every {@link FileRole.Documentation} file loaded, answering which page
72
+ * documents a name. Built on each call rather than kept, so hold on to the result instead of asking per name.
73
+ */
74
+ documentation(): RdIndex;
75
+ /** The R objects `data(dataset)` brings into scope, per the project's `data/datalist`. Empty when no list mentions `dataset`, including projects that ship none. */
76
+ datasetObjects(dataset: string): readonly string[];
77
+ /** The objects a package's system data (`R/sysdata.rda`/`.rdx`) lazy-loads into its namespace: available package-internally, neither exported nor reachable through `data()`. Empty for a project that ships none. */
78
+ sysdataObjects(): readonly SysdataObject[];
63
79
  /**
64
80
  * Get all files known to this context.
65
81
  * @returns An array of all files.
@@ -185,6 +201,10 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
185
201
  * User-registered discovery plugins replace the built-in default; if none are registered, the default runs.
186
202
  */
187
203
  private addRequest;
204
+ /** The registered discovery plugins, or the built-in default when none are registered. */
205
+ private activeDiscoveryPlugins;
206
+ /** Adds a request a discovery plugin produced: expands it further if it is itself a parse request, otherwise adds the file directly. */
207
+ private addDiscovered;
188
208
  /**
189
209
  * A single-file request otherwise skips project discovery entirely, so a sibling `project.implicitSources`
190
210
  * entry (e.g. a shiny app's `s.R` next to the analyzed `t.R`) would never be found. If `implicitSources` is
@@ -217,6 +237,9 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
217
237
  * This is a convenience method that calls {@link FlowrAnalyzerLoadingOrderContext.getLoadingOrder}.
218
238
  */
219
239
  computeLoadingOrder(): readonly RParseRequest[];
240
+ documentation(): RdIndex;
241
+ datasetObjects(dataset: string): readonly string[];
242
+ sysdataObjects(): readonly SysdataObject[];
220
243
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
221
244
  getAllFiles(): FlowrFileProvider[];
222
245
  getFileByPath(path: string): FlowrFileProvider | undefined;
@@ -15,6 +15,8 @@ const fs_1 = __importDefault(require("fs"));
15
15
  const path_1 = __importDefault(require("path"));
16
16
  const files_1 = require("../../util/files");
17
17
  const glob_1 = require("../../util/glob");
18
+ const flowr_rd_file_1 = require("../plugins/file-plugins/files/flowr-rd-file");
19
+ const flowr_sysdata_file_1 = require("../plugins/file-plugins/files/flowr-sysdata-file");
18
20
  const classify_project_kind_1 = require("./classify-project-kind");
19
21
  const flowr_cache_1 = require("../cache/flowr-cache");
20
22
  const fileLog = log_1.log.getSubLogger({ name: 'flowr-analyzer-files-context' });
@@ -177,17 +179,21 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
177
179
  return;
178
180
  }
179
181
  this.requestedRoots.push(request.content);
180
- const active = this.discoveryPlugins.length > 0
181
- ? this.discoveryPlugins
182
- : [flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()];
183
- const expandedRequests = active.flatMap(p => p.processor(this.ctx, request));
184
- for (const req of expandedRequests) {
185
- if ((0, retriever_1.isParseRequest)(req)) {
186
- this.addRequest(req);
187
- }
188
- else {
189
- this.addFile(req, req.roles);
190
- }
182
+ for (const req of this.activeDiscoveryPlugins().flatMap(p => p.processor(this.ctx, request))) {
183
+ this.addDiscovered(req);
184
+ }
185
+ }
186
+ /** The registered discovery plugins, or the built-in default when none are registered. */
187
+ activeDiscoveryPlugins() {
188
+ return this.discoveryPlugins.length > 0 ? this.discoveryPlugins : [flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()];
189
+ }
190
+ /** Adds a request a discovery plugin produced: expands it further if it is itself a parse request, otherwise adds the file directly. */
191
+ addDiscovered(req) {
192
+ if ((0, retriever_1.isParseRequest)(req)) {
193
+ this.addRequest(req);
194
+ }
195
+ else {
196
+ this.addFile(req, req.roles);
191
197
  }
192
198
  }
193
199
  /**
@@ -209,20 +215,12 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
209
215
  return;
210
216
  }
211
217
  const matchers = implicit.map(entry => (0, glob_1.globMatcher)(entry));
212
- const active = this.discoveryPlugins.length > 0
213
- ? this.discoveryPlugins
214
- : [flowr_analyzer_project_discovery_plugin_1.FlowrAnalyzerProjectDiscoveryPlugin.defaultPlugin()];
215
- for (const req of active.flatMap(p => p.processor(this.ctx, { request: 'project', content: dir }))) {
218
+ for (const req of this.activeDiscoveryPlugins().flatMap(p => p.processor(this.ctx, { request: 'project', content: dir }))) {
216
219
  const filePath = (0, retriever_1.isParseRequest)(req) ? (req.request === 'file' ? req.content : undefined) : req.path();
217
220
  if (filePath === undefined || filePath === fileContent || !matchers.some(m => m(filePath))) {
218
221
  continue;
219
222
  }
220
- if ((0, retriever_1.isParseRequest)(req)) {
221
- this.addRequest(req);
222
- }
223
- else {
224
- this.addFile(req, req.roles);
225
- }
223
+ this.addDiscovered(req);
226
224
  }
227
225
  }
228
226
  /**
@@ -368,6 +366,29 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
368
366
  computeLoadingOrder() {
369
367
  return this.loadingOrder.getLoadingOrder();
370
368
  }
369
+ documentation() {
370
+ return (0, flowr_rd_file_1.rdIndexOf)(this.getFilesByRole(flowr_file_1.FileRole.Documentation));
371
+ }
372
+ datasetObjects(dataset) {
373
+ for (const file of this.getFilesByRole(flowr_file_1.FileRole.Data)) {
374
+ if (file instanceof flowr_rd_file_1.FlowrDataListFile) {
375
+ const objects = file.objectsOf(dataset);
376
+ if (objects.length > 0) {
377
+ return objects;
378
+ }
379
+ }
380
+ }
381
+ return [];
382
+ }
383
+ sysdataObjects() {
384
+ const objects = [];
385
+ for (const file of this.getFilesByRole(flowr_file_1.FileRole.Data)) {
386
+ if (file instanceof flowr_sysdata_file_1.FlowrSysdataFile) {
387
+ objects.push(...file.content());
388
+ }
389
+ }
390
+ return objects;
391
+ }
371
392
  getFilesByRole(role) {
372
393
  return this.byRole[role];
373
394
  }
@@ -12,6 +12,14 @@ export interface FunctionInfo {
12
12
  isExported: boolean;
13
13
  isS3Generic: boolean;
14
14
  s3TypeDispatch?: string;
15
+ /**
16
+ * The name is an S4 method the package registered (its NAMESPACE `exportMethods()`): it is exported because
17
+ * the package answers a generic for one of its classes, not because it defines a function of its own.
18
+ * The S4 counterpart of {@link isS3Generic}/{@link s3TypeDispatch}.
19
+ */
20
+ isS4Method?: boolean;
21
+ /** The name is an S4 class the package owns, i.e. its NAMESPACE lists it in `exportClasses()`. */
22
+ isS4Class?: boolean;
15
23
  inferredType?: string;
16
24
  }
17
25
  /**
@@ -51,6 +51,8 @@ class FlowrAnalyzerFunctionsContext extends abstract_flowr_analyzer_context_1.Ab
51
51
  }
52
52
  functionInfo.isExported ||= other.isExported;
53
53
  functionInfo.isS3Generic ||= other.isS3Generic;
54
+ functionInfo.isS4Method ||= other.isS4Method;
55
+ functionInfo.isS4Class ||= other.isS4Class;
54
56
  }
55
57
  getFunctionInfo(pkg, name, s3TypeDispatch) {
56
58
  if (s3TypeDispatch) {
@@ -1,4 +1,4 @@
1
- import { type FlowrGasConfig, GasLevel, type GasOverrides } from '../../gas';
1
+ import { type FlowrGasConfig, GasLevel, type GasOverrides, DataflowBudgetTracker } from '../../gas';
2
2
  import type { FlowrAnalyzerGasPlugin } from '../plugins/gas-plugins/flowr-analyzer-gas-plugin';
3
3
  import type { FlowrAnalyzerContext } from './flowr-analyzer-context';
4
4
  import type { InvalidationEvent, InvalidationEventReceiver } from '../cache/flowr-cache';
@@ -14,6 +14,11 @@ export interface ReadOnlyFlowrAnalyzerGasContext {
14
14
  * (see {@link GasThresholdSpec}), not one allowance shared by everything the analyzer does.
15
15
  */
16
16
  checkGas(key: string): GasLevel;
17
+ /**
18
+ * The counted bounds of `key`, resolved once against the current contingent, or `undefined` when disabled or
19
+ * unbounded. Arming counterpart of {@link checkGas} for the dataflow fold, see {@link GasFeatureKey.Dataflow}.
20
+ */
21
+ budget(key: string): DataflowBudgetTracker | undefined;
17
22
  /**
18
23
  * A view with a fresh contingent, measured from this call, for one operation to run against.
19
24
  * The enclosing bounds still apply, `overrides` winning over them. Derives a new object rather than
@@ -78,5 +83,8 @@ export declare class FlowrAnalyzerGasContext implements WriteableFlowrAnalyzerGa
78
83
  private static maxLevel;
79
84
  private timeLevel;
80
85
  checkGas(key: string): GasLevel;
86
+ budget(key: string): DataflowBudgetTracker | undefined;
87
+ /** The bounds `key` is armed with, pre-divided by its factor so the tracker only ever compares, never multiplies. */
88
+ private budgetFor;
81
89
  private levelFor;
82
90
  }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowrAnalyzerGasContext = void 0;
4
+ const gas_1 = require("../../gas");
5
+ const config_1 = require("../../config");
4
6
  const log_1 = require("../../util/log");
5
7
  let heapStatisticsProvider = undefined;
6
8
  /**
@@ -127,6 +129,7 @@ class FlowrAnalyzerGasContext {
127
129
  return {
128
130
  name: `${this.name}:scope`,
129
131
  checkGas: key => this.levelFor(key, scope),
132
+ budget: key => this.budgetFor(key, scope),
130
133
  scope: o => this.viewOf(this.derive(o, scope))
131
134
  };
132
135
  }
@@ -195,6 +198,24 @@ class FlowrAnalyzerGasContext {
195
198
  checkGas(key) {
196
199
  return this.levelFor(key, this.activeScope());
197
200
  }
201
+ budget(key) {
202
+ return this.budgetFor(key, this.activeScope());
203
+ }
204
+ /** The bounds `key` is armed with, pre-divided by its factor so the tracker only ever compares, never multiplies. */
205
+ budgetFor(key, scope) {
206
+ const factor = this.factorFor(scope, key);
207
+ if (!factor) {
208
+ return undefined; // disabled, which is what keeps an unarmed run free of the guard entirely
209
+ }
210
+ const cap = (dim) => {
211
+ const bound = this.bound(scope, key, dim, 'critical');
212
+ return Number.isFinite(bound) ? Math.max(1, Math.floor(bound / factor)) : 0;
213
+ };
214
+ const budget = { steps: cap('steps'), vertices: cap('vertices'), timeMs: cap('timeMs') };
215
+ return (0, gas_1.isBoundedBudget)(budget)
216
+ ? new gas_1.DataflowBudgetTracker(budget, scope.startTime, this.config?.countedCheckEvery ?? config_1.DefaultCountedCheckEvery)
217
+ : undefined;
218
+ }
198
219
  levelFor(key, scope) {
199
220
  const factor = this.factorFor(scope, key);
200
221
  if (!factor && this.plugins.length === 0) {
@@ -27,8 +27,13 @@ export declare enum FileRole {
27
27
  * These are not part of the package namespace source, so tooling may want to treat them separately.
28
28
  */
29
29
  Install = "install",
30
- /** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
30
+ /**
31
+ * Data files: a `data/datalist`, a package's system data (`R/sysdata.rda`, or the `R/sysdata.rdx` of an
32
+ * installed package), and any other data file, which has no special support.
33
+ */
31
34
  Data = "data",
35
+ /** Manual pages (`man/*.Rd`) and an installed package's `help/AnIndex`, i.e. what documents a name. */
36
+ Documentation = "documentation",
32
37
  /** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
33
38
  License = "license",
34
39
  /** Files describing a project's virtual/pinned package environment, e.g., `renv.lock`, `rv.lock` or `uvr.lock`. */
@@ -163,3 +168,13 @@ export declare class FlowrInlineTextFile extends FlowrFile<string> {
163
168
  */
164
169
  updateInlineContent(newContent: string): void;
165
170
  }
171
+ /**
172
+ * A {@link FlowrFile} that decorates another file to expose its raw content as something parsed.
173
+ * Prefer the static {@link FlowrWrappedFile.from|from}, which avoids re-wrapping and handles roles.
174
+ */
175
+ export declare abstract class FlowrWrappedFile<Content extends StringableContent = StringableContent> extends FlowrFile<Content> {
176
+ protected readonly wrapped: FlowrFileProvider;
177
+ constructor(wrapped: FlowrFileProvider);
178
+ /** Lifts a file to the class this is called on, reusing it if already one and assigning `role`. */
179
+ static from<T>(this: new (file: FlowrFileProvider) => T, file: FlowrFileProvider, role?: FileRole): T;
180
+ }
@@ -3,7 +3,7 @@ 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.FlowrInlineTextFile = exports.FlowrTextFile = exports.FlowrFile = exports.FileRole = void 0;
6
+ exports.FlowrWrappedFile = exports.FlowrInlineTextFile = exports.FlowrTextFile = exports.FlowrFile = exports.FileRole = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  /**
9
9
  * Some files have a special meaning in R projects, e.g., the `DESCRIPTION` file in R packages.
@@ -27,8 +27,13 @@ var FileRole;
27
27
  * These are not part of the package namespace source, so tooling may want to treat them separately.
28
28
  */
29
29
  FileRole["Install"] = "install";
30
- /** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
30
+ /**
31
+ * Data files: a `data/datalist`, a package's system data (`R/sysdata.rda`, or the `R/sysdata.rdx` of an
32
+ * installed package), and any other data file, which has no special support.
33
+ */
31
34
  FileRole["Data"] = "data";
35
+ /** Manual pages (`man/*.Rd`) and an installed package's `help/AnIndex`, i.e. what documents a name. */
36
+ FileRole["Documentation"] = "documentation";
32
37
  /** Signals separate license files, but please note, that DESCRIPTION files may contain license info too */
33
38
  FileRole["License"] = "license";
34
39
  /** Files describing a project's virtual/pinned package environment, e.g., `renv.lock`, `rv.lock` or `uvr.lock`. */
@@ -162,4 +167,23 @@ class FlowrInlineTextFile extends FlowrFile {
162
167
  }
163
168
  }
164
169
  exports.FlowrInlineTextFile = FlowrInlineTextFile;
170
+ /**
171
+ * A {@link FlowrFile} that decorates another file to expose its raw content as something parsed.
172
+ * Prefer the static {@link FlowrWrappedFile.from|from}, which avoids re-wrapping and handles roles.
173
+ */
174
+ class FlowrWrappedFile extends FlowrFile {
175
+ wrapped;
176
+ constructor(wrapped) {
177
+ super(wrapped.path(), wrapped.roles);
178
+ this.wrapped = wrapped;
179
+ }
180
+ /** Lifts a file to the class this is called on, reusing it if already one and assigning `role`. */
181
+ static from(file, role) {
182
+ if (role) {
183
+ file.assignRole(role);
184
+ }
185
+ return file instanceof this ? file : new this(file);
186
+ }
187
+ }
188
+ exports.FlowrWrappedFile = FlowrWrappedFile;
165
189
  //# sourceMappingURL=flowr-file.js.map
@@ -1,4 +1,4 @@
1
- import { type FlowrFileProvider, type FileRole, FlowrFile } from '../../../context/flowr-file';
1
+ import { type FlowrFileProvider, type FileRole, FlowrWrappedFile } from '../../../context/flowr-file';
2
2
  import type { RAuthorInfo } from '../../../../util/r-author';
3
3
  import type { DeepReadonly } from 'ts-essentials';
4
4
  import type { RLicenseElementInfo } from '../../../../util/r-license';
@@ -12,27 +12,11 @@ export type DCF = Map<string, string[]>;
12
12
  * These methods parse and return the relevant information in structured formats.
13
13
  * To access raw fields, use the {@link content} method inherited from {@link FlowrFile}.
14
14
  */
15
- export declare class FlowrDescriptionFile extends FlowrFile<DeepReadonly<DCF>> {
16
- private readonly wrapped;
17
- /**
18
- * Prefer the static {@link FlowrDescriptionFile.from} method to create instances of this class as it will not re-create if already a description file
19
- * and handle role assignments.
20
- */
21
- constructor(file: FlowrFileProvider);
22
- /**
23
- * Loads and parses the content of the wrapped file as a DCF structure.
24
- * @see {@link parseDCF} for details on the parsing logic.
25
- */
15
+ export declare class FlowrDescriptionFile extends FlowrWrappedFile<DeepReadonly<DCF>> {
16
+ /** @see {@link parseDCF} for details on the parsing logic. */
26
17
  protected loadContent(): DCF;
27
- /**
28
- * Creates a FlowrDescriptionFile from given DCF content, path, and optional roles.
29
- * This is useful if you already have the DCF content parsed and want to create a description file instance without re-parsing.
30
- */
18
+ /** Creates a FlowrDescriptionFile from already-parsed DCF content, without re-parsing. */
31
19
  static fromDCF(dcf: DCF, path: string, roles?: FileRole[]): FlowrDescriptionFile;
32
- /**
33
- * Description file lifter, this does not re-create if already a description file
34
- */
35
- static from(file: FlowrFileProvider | FlowrDescriptionFile, role?: FileRole): FlowrDescriptionFile;
36
20
  /**
37
21
  * Returns the parsed license information from the 'License' field in the DESCRIPTION file.
38
22
  */
@@ -91,6 +75,21 @@ export declare class FlowrDescriptionFile extends FlowrFile<DeepReadonly<DCF>> {
91
75
  * @returns An array of SPDX license information objects if parsing was successful.
92
76
  */
93
77
  export declare function parseRLicenseField(...licenseField: string[]): RLicenseElementInfo[];
78
+ /**
79
+ * Parses the given file in the 'Debian Control Format' as a single record, the shape of a `DESCRIPTION`:
80
+ * blank lines do not separate, and a key given more than once keeps its last value.
81
+ * @param file - The file (or raw text) to parse
82
+ * @see {@link parseDCFRecords} - for control files that hold many records
83
+ */
84
+ export declare function parseDCF(file: FlowrFileProvider | string): DCF;
85
+ /**
86
+ * Parses a control file that holds **many** records in the 'Debian Control Format', e.g. a repository
87
+ * `PACKAGES` index or a `packrat.lock`, where each record describes one package and must not be merged
88
+ * with its neighbors.
89
+ * @param file - The file (or raw text) to parse
90
+ * @see {@link parseDCF} - for the single-record shape of a `DESCRIPTION`
91
+ */
92
+ export declare function parseDCFRecords(file: FlowrFileProvider | string): DCF[];
94
93
  /**
95
94
  * Parses package strings with optional version constraints into Package objects.
96
95
  * @param packageStrings - The package strings to parse
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowrDescriptionFile = void 0;
4
4
  exports.parseRLicenseField = parseRLicenseField;
5
+ exports.parseDCF = parseDCF;
6
+ exports.parseDCFRecords = parseDCFRecords;
5
7
  exports.parsePackagesWithVersions = parsePackagesWithVersions;
6
8
  const flowr_file_1 = require("../../../context/flowr-file");
7
9
  const r_author_1 = require("../../../../util/r-author");
@@ -17,41 +19,17 @@ const r_version_1 = require("../../../../util/r-version");
17
19
  * These methods parse and return the relevant information in structured formats.
18
20
  * To access raw fields, use the {@link content} method inherited from {@link FlowrFile}.
19
21
  */
20
- class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
21
- wrapped;
22
- /**
23
- * Prefer the static {@link FlowrDescriptionFile.from} method to create instances of this class as it will not re-create if already a description file
24
- * and handle role assignments.
25
- */
26
- constructor(file) {
27
- super(file.path(), file.roles);
28
- this.wrapped = file;
29
- }
30
- /**
31
- * Loads and parses the content of the wrapped file as a DCF structure.
32
- * @see {@link parseDCF} for details on the parsing logic.
33
- */
22
+ class FlowrDescriptionFile extends flowr_file_1.FlowrWrappedFile {
23
+ /** @see {@link parseDCF} for details on the parsing logic. */
34
24
  loadContent() {
35
25
  return parseDCF(this.wrapped);
36
26
  }
37
- /**
38
- * Creates a FlowrDescriptionFile from given DCF content, path, and optional roles.
39
- * This is useful if you already have the DCF content parsed and want to create a description file instance without re-parsing.
40
- */
27
+ /** Creates a FlowrDescriptionFile from already-parsed DCF content, without re-parsing. */
41
28
  static fromDCF(dcf, path, roles) {
42
29
  const file = new FlowrDescriptionFile(new flowr_file_1.FlowrTextFile(path, roles));
43
30
  file.setContent(dcf);
44
31
  return file;
45
32
  }
46
- /**
47
- * Description file lifter, this does not re-create if already a description file
48
- */
49
- static from(file, role) {
50
- if (role) {
51
- file.assignRole(role);
52
- }
53
- return file instanceof FlowrDescriptionFile ? file : new FlowrDescriptionFile(file);
54
- }
55
33
  /**
56
34
  * Returns the parsed license information from the 'License' field in the DESCRIPTION file.
57
35
  */
@@ -173,33 +151,69 @@ function emplaceDCF(key, val, result) {
173
151
  }
174
152
  result.set(key, values);
175
153
  }
154
+ const dcfIndentRegex = /^\s/;
155
+ const dcfFirstColonRegex = /:(.*)/s;
156
+ /** a line that separates two records: empty, or the `.`-only line the format also allows */
157
+ const dcfRecordBreakRegex = /^\s*\.?\s*$/;
176
158
  /**
177
- * Parses the given file in the 'Debian Control Format'.
178
- * @param file - The file to parse
159
+ * Walks `content` in the 'Debian Control Format', emitting one {@link DCF} per record. Records are separated
160
+ * by blank (or `.`-only) lines, which is what makes a repository `PACKAGES` index differ from a `DESCRIPTION`.
161
+ * @param content - The raw text to parse
162
+ * @param singleRecord - Ignore the separators and fold everything into one record (what a `DESCRIPTION` wants)
179
163
  */
180
- function parseDCF(file) {
181
- const result = new Map();
164
+ function walkDCF(content, singleRecord) {
165
+ const records = [];
166
+ // strip a leading UTF-8 BOM (U+FEFF): it matches the indent test (JS `\s` includes U+FEFF), so without this
167
+ // the first field (typically `Package:`) would be misread as a continuation line and silently dropped
168
+ const lines = (content.charCodeAt(0) === 0xFEFF ? content.slice(1) : content).split(/\r?\n/);
169
+ let result = new Map();
182
170
  let currentKey = '';
183
171
  let currentValue = '';
184
- const indentRegex = new RegExp(/^\s/);
185
- const firstColonRegex = new RegExp(/:(.*)/s);
186
- // strip a leading UTF-8 BOM (U+FEFF): it matches `indentRegex` (JS `\s` includes U+FEFF), so without this
187
- // the first field (typically `Package:`) would be misread as a continuation line and silently dropped
188
- const raw = file.content().toString();
189
- const fileContent = (raw.charCodeAt(0) === 0xFEFF ? raw.slice(1) : raw).split(/\r?\n/);
190
- for (const line of fileContent) {
191
- if (indentRegex.test(line)) {
172
+ for (const line of lines) {
173
+ if (!singleRecord && dcfRecordBreakRegex.test(line)) {
174
+ emplaceDCF(currentKey, currentValue, result);
175
+ currentKey = '';
176
+ currentValue = '';
177
+ if (result.size > 0) {
178
+ records.push(result);
179
+ result = new Map();
180
+ }
181
+ }
182
+ else if (dcfIndentRegex.test(line)) {
192
183
  currentValue += '\n' + line.trim();
193
184
  }
194
185
  else {
195
186
  emplaceDCF(currentKey, currentValue, result);
196
- const [key, rest] = line.split(firstColonRegex).map(s => s.trim());
187
+ const [key, rest] = line.split(dcfFirstColonRegex).map(s => s.trim());
197
188
  currentKey = key?.trim() ?? '';
198
189
  currentValue = rest?.trim() ?? '';
199
190
  }
200
191
  }
201
192
  emplaceDCF(currentKey, currentValue, result);
202
- return result;
193
+ if (result.size > 0 || records.length === 0) {
194
+ records.push(result);
195
+ }
196
+ return records;
197
+ }
198
+ /**
199
+ * Parses the given file in the 'Debian Control Format' as a single record, the shape of a `DESCRIPTION`:
200
+ * blank lines do not separate, and a key given more than once keeps its last value.
201
+ * @param file - The file (or raw text) to parse
202
+ * @see {@link parseDCFRecords} - for control files that hold many records
203
+ */
204
+ function parseDCF(file) {
205
+ return walkDCF(typeof file === 'string' ? file : file.content().toString(), true)[0];
206
+ }
207
+ /**
208
+ * Parses a control file that holds **many** records in the 'Debian Control Format', e.g. a repository
209
+ * `PACKAGES` index or a `packrat.lock`, where each record describes one package and must not be merged
210
+ * with its neighbors.
211
+ * @param file - The file (or raw text) to parse
212
+ * @see {@link parseDCF} - for the single-record shape of a `DESCRIPTION`
213
+ */
214
+ function parseDCFRecords(file) {
215
+ return walkDCF(typeof file === 'string' ? file : file.content().toString(), false)
216
+ .filter(r => r.size > 0);
203
217
  }
204
218
  const splitRegex = /[\n\r]+/g;
205
219
  function cleanValues(values) {