@eagleoutice/flowr 2.14.3 → 2.15.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 (385) hide show
  1. package/README.md +76 -63
  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 +1656 -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 -328
  56. package/dataflow/environments/default-builtin-config.js +804 -1031
  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 +36 -0
  60. package/dataflow/environments/group-generics.js +58 -0
  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 +20 -2
  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 +24 -34
  76. package/dataflow/eval/values/general.d.ts +7 -1
  77. package/dataflow/eval/values/general.js +17 -3
  78. package/dataflow/eval/values/string/string-constants.d.ts +16 -15
  79. package/dataflow/eval/values/string/string-constants.js +59 -27
  80. package/dataflow/extractor.d.ts +2 -1
  81. package/dataflow/extractor.js +16 -4
  82. package/dataflow/fn/argument-roles.d.ts +35 -0
  83. package/dataflow/fn/argument-roles.js +252 -0
  84. package/dataflow/fn/class-declaration.d.ts +148 -0
  85. package/dataflow/fn/class-declaration.js +317 -0
  86. package/dataflow/fn/condition-handlers.d.ts +5 -0
  87. package/dataflow/fn/condition-handlers.js +13 -0
  88. package/dataflow/fn/exceptions-of-function.d.ts +21 -7
  89. package/dataflow/fn/exceptions-of-function.js +74 -43
  90. package/dataflow/fn/frame-reflection.d.ts +46 -0
  91. package/dataflow/fn/frame-reflection.js +169 -0
  92. package/dataflow/fn/function-props.d.ts +32 -0
  93. package/dataflow/fn/function-props.js +160 -0
  94. package/dataflow/fn/higher-order-function.d.ts +23 -5
  95. package/dataflow/fn/higher-order-function.js +64 -18
  96. package/dataflow/fn/strict-function.d.ts +24 -2
  97. package/dataflow/fn/strict-function.js +49 -19
  98. package/dataflow/graph/call-graph.js +10 -2
  99. package/dataflow/graph/df-helper.d.ts +1 -12
  100. package/dataflow/graph/df-helper.js +2 -19
  101. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  102. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  103. package/dataflow/graph/graph.d.ts +39 -188
  104. package/dataflow/graph/graph.js +46 -163
  105. package/dataflow/graph/match-args.d.ts +34 -2
  106. package/dataflow/graph/match-args.js +45 -12
  107. package/dataflow/graph/vertex.d.ts +8 -0
  108. package/dataflow/info.d.ts +7 -5
  109. package/dataflow/info.js +1 -5
  110. package/dataflow/internal/control-flow.js +20 -17
  111. package/dataflow/internal/linker.d.ts +8 -37
  112. package/dataflow/internal/linker.js +22 -55
  113. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
  114. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
  115. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
  116. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
  117. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
  118. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
  119. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
  122. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
  123. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  124. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
  125. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
  126. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
  127. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
  128. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
  129. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
  130. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
  131. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
  132. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
  133. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
  134. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  135. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  136. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
  138. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
  139. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
  140. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
  141. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
  142. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
  143. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
  144. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
  145. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
  146. package/dataflow/internal/process/functions/call/common.d.ts +4 -6
  147. package/dataflow/internal/process/functions/call/common.js +2 -2
  148. package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
  149. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  150. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
  151. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
  152. package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
  153. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
  154. package/dataflow/internal/process/functions/call/quoted.js +144 -28
  155. package/dataflow/origin/dfg-get-origin.js +23 -10
  156. package/dataflow/processor.d.ts +2 -1
  157. package/dataflow/processor.js +6 -0
  158. package/documentation/data/interface/doc-writing-code.js +2 -0
  159. package/documentation/doc-util/doc-search.js +1 -1
  160. package/documentation/wiki-absint.d.ts +11 -14
  161. package/documentation/wiki-absint.js +73 -59
  162. package/documentation/wiki-core.js +64 -24
  163. package/documentation/wiki-linter.js +1 -0
  164. package/documentation/wiki-query.js +82 -264
  165. package/documentation/wiki-signature-database.js +23 -6
  166. package/gas.d.ts +91 -47
  167. package/gas.js +97 -13
  168. package/index.d.ts +31 -0
  169. package/index.js +52 -0
  170. package/linter/linter-rules.d.ts +87 -23
  171. package/linter/linter-rules.js +3 -1
  172. package/linter/rules/absolute-path.d.ts +1 -1
  173. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  174. package/linter/rules/dataframe-access-validation.js +10 -8
  175. package/linter/rules/dead-code.d.ts +1 -1
  176. package/linter/rules/deprecated-functions.js +14 -5
  177. package/linter/rules/file-path-validity.d.ts +1 -1
  178. package/linter/rules/naming-convention.d.ts +1 -1
  179. package/linter/rules/naming-convention.js +13 -2
  180. package/linter/rules/network-functions.d.ts +10 -5
  181. package/linter/rules/network-functions.js +48 -36
  182. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  183. package/linter/rules/problematic-inputs.d.ts +1 -1
  184. package/linter/rules/problematic-inputs.js +1 -1
  185. package/linter/rules/seeded-randomness.d.ts +3 -2
  186. package/linter/rules/seeded-randomness.js +7 -3
  187. package/linter/rules/software-has-license.d.ts +1 -1
  188. package/linter/rules/software-has-tests.d.ts +1 -1
  189. package/linter/rules/stop-with-call-arg.d.ts +1 -1
  190. package/linter/rules/syntactically-valid.d.ts +1 -1
  191. package/linter/rules/unclosed-connection.d.ts +3 -3
  192. package/linter/rules/unclosed-connection.js +3 -4
  193. package/linter/rules/undefined-symbol.d.ts +1 -1
  194. package/linter/rules/unescaped-arguments.d.ts +161 -0
  195. package/linter/rules/unescaped-arguments.js +293 -0
  196. package/linter/rules/unused-definition.d.ts +1 -1
  197. package/linter/rules/unused-definition.js +51 -6
  198. package/linter/rules/unused-import.d.ts +1 -1
  199. package/linter/rules/useless-loop.d.ts +1 -1
  200. package/package.json +3 -198
  201. package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
  202. package/project/context/flowr-analyzer-environment-context.js +33 -1
  203. package/project/context/flowr-analyzer-files-context.d.ts +24 -1
  204. package/project/context/flowr-analyzer-files-context.js +42 -21
  205. package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
  206. package/project/context/flowr-analyzer-functions-context.js +2 -0
  207. package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
  208. package/project/context/flowr-analyzer-gas-context.js +21 -0
  209. package/project/context/flowr-file.d.ts +16 -1
  210. package/project/context/flowr-file.js +26 -2
  211. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
  212. package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
  213. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
  214. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
  215. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
  216. package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
  217. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
  218. package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
  219. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
  220. package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
  221. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
  222. package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
  223. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
  224. package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
  225. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
  226. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
  227. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
  228. package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
  229. package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
  230. package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
  231. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
  232. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
  233. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
  234. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
  236. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
  237. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
  238. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
  239. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
  240. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
  241. package/project/plugins/package-version-plugins/package.js +2 -1
  242. package/project/plugins/plugin-registry.d.ts +3 -1
  243. package/project/plugins/plugin-registry.js +11 -0
  244. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
  245. package/project/sigdb/build.d.ts +9 -15
  246. package/project/sigdb/build.js +63 -42
  247. package/project/sigdb/decode.d.ts +10 -4
  248. package/project/sigdb/decode.js +60 -21
  249. package/project/sigdb/memory-source.d.ts +4 -0
  250. package/project/sigdb/memory-source.js +8 -0
  251. package/project/sigdb/reader.d.ts +50 -100
  252. package/project/sigdb/reader.js +84 -105
  253. package/project/sigdb/schema.d.ts +102 -26
  254. package/project/sigdb/schema.js +14 -6
  255. package/project/sigdb/signature-db.d.ts +4 -0
  256. package/project/sigdb/signature-db.js +8 -1
  257. package/queries/base-query-format.d.ts +7 -0
  258. package/queries/base-query-format.js +29 -0
  259. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  260. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  261. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  262. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  263. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  264. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  265. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  266. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  267. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  268. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  269. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  270. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  271. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  272. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  273. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  274. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  275. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  276. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  277. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  278. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  279. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  280. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  281. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  282. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  283. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  284. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  285. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  286. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  287. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +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 +9 -9
  315. package/queries/catalog/signature-query/signature-query-executor.js +104 -95
  316. package/queries/catalog/signature-query/signature-query-format.d.ts +34 -8
  317. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  318. package/queries/catalog/signature-query/signature-query-render.js +24 -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/name-rank.js +8 -2
  372. package/util/text/strings.d.ts +5 -0
  373. package/util/text/strings.js +10 -0
  374. package/util/version.js +2 -2
  375. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  376. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  377. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  378. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  379. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  380. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  381. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  382. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  383. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  384. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  385. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -238,20 +238,37 @@ Every function is a ${ctx.link('DecodedFunction')}:
238
238
  | field | holds |
239
239
  |-------|-------|
240
240
  | ${ctx.link('DecodedFunction::exported')} | whether the name is a package export |
241
- | ${ctx.link('DecodedFunction::signature')} | the parameters, with defaults and forced or optional flags |
241
+ | ${ctx.link('DecodedFunction::signature')} | the parameters, with their defaults and their ${ctx.link('ArgProp')} mask |
242
242
  | ${ctx.link('DecodedFunction::callees')} | the function's own local calls |
243
243
  | ${ctx.link('DecodedFunction::topic')} | the Rd help topic when it differs from the name |
244
244
  | ${ctx.link('DecodedFunction::file')}, ${ctx.link('DecodedFunction::line')} | source location |
245
245
  | ${ctx.link('DecodedFunction::props')} | flags like higher-order, recursive, deprecated |
246
246
 
247
- Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), and the versions it carries (${ctx.link('AvailableVersion')}).
247
+ The parameter mask is the one flowR states its own built-ins with, so a parameter carries
248
+ ${ctx.linkE('ArgProp', 'NoDefault')} when it has no default, ${ctx.linkE('ArgProp', 'Forced')}
249
+ when the function always evaluates it, and whichever roles the extractor could infer
250
+ (${ctx.linkE('ArgProp', 'Alias')}, ${ctx.linkE('ArgProp', 'Presence')},
251
+ ${ctx.linkE('ArgProp', 'Callee')}, ...). Every bit it cannot see stays unset, so an unset bit
252
+ reads as "unknown" rather than "no"; ${ctx.link('fnInfoFromSignature')} hands the mask on unchanged, which is
253
+ what lets a package function answer the same questions a built-in does.
254
+
255
+ Per version the source also answers declared dependencies (${ctx.link('ResolvedDependency')}), release dates, the plain export view (${ctx.link('LibraryExports')}), the versions it carries (${ctx.link('AvailableVersion')}), and its class relations (${ctx.link('SigClassInfo')}, via ${ctx.linkM(reader_1.SigDatabase, 'classes')}).
256
+
257
+ A class record states what a declaration does: its direct superclasses, its slots with the types they were declared with, whether it is virtual, and whether it is a \`setClassUnion\` (whose supers are the members it unites). ${ctx.link('SigClassInfo::package')} names the package *defining* a class the record only relates to, which is what tells a class the package owns from one it inherits -- something the flat name list of ${ctx.link('LibraryExports::s4Classes')} has nowhere to hang. The same shape carries Reference classes, S7 and R6, since all four declare a name, a parent and a set of members. On the analysis side ${ctx.link('declaredClasses')} reads these off \`setClass\`/\`setClassUnion\`/\`setIs\`/\`setRefClass\`/\`new_class\`/\`R6Class\` calls and ${ctx.link('toSigClasses')} hands them over in this form.
248
258
 
249
259
  Beyond the flags above, ${ctx.link('DecodedFunction::props')} also carry ${ctx.linkE('FnProp', 'NoDoc')} (a documented package has no help page for this name), ${ctx.linkE('FnProp', 'S3Method')} (a registered S3 method, from the package NAMESPACE or base R's method table), and ${ctx.linkE('FnProp', 'S3Owner')} (an exported constructor for an S3 class this package OWNS: it also registers at least one S3 method for that class). The owned classes of a version are ${ctx.link('LibraryExports::s3Classes')}, and ${ctx.linkM(reader_1.SigDatabase, 'classOwner')} answers, for a class name, which package owns it (backed by a reverse index built once). This lets ${ctx.linkPage('wiki/Query API', 'version guessing')} mark a package used when the analyzed project's own NAMESPACE registers an S3 method for a class it owns, even with no direct call, e.g. tseries's \`S3method("as.irts","zoo")\` marks \`zoo\` used.
250
260
 
261
+ The S4 side has ${ctx.linkE('FnProp', 'S4Owner')} for an exported class and ${ctx.linkE('FnProp', 'S4Method')} for a name a package exports because it answered a generic for one of its classes (\`setMethod("sin", "float32", ...)\` plus \`exportMethods(sin)\`), rather than because it defines a function of its own. Such a name is often documented only under its \`sin,float32-method\` Rd alias, so it also carries ${ctx.linkE('FnProp', 'NoDoc')}. Because \`setMethod("Math", ...)\` answers every member of a group at once, ${ctx.link('SignatureDb::functionOf')} falls back to the group entry for a member it finds nothing for: \`pkg::sin\` is served by \`pkg\`'s \`Math\`, which is what the call would dispatch to. ${ctx.link('groupGenericOf')} maps a member to its group.
262
+
263
+ ${ctx.linkE('FnProp', 'Generic')} says the definition is one others dispatch on: an S3 generic whose body calls \`UseMethod\`, an S4 one from \`setGeneric\`, or an S7 \`new_generic\`. The call graph shows the same for the S3 case, but only while a bundle carries one, and never for a generic built without an R body -- which is why the bit exists next to it. ${ctx.link('fnInfoFromSignature')} reads it, falling back to the dispatching callee for a bundle written before it.
264
+
265
+ ${ctx.linkE('FnProp', 'Value')} says the export binds a value rather than a function (\`pi\`, \`LETTERS\`, ggplot2's \`class_gg\`). Only the extractor can tell: an entry without a definition location is as likely to be a function nothing wrote down, an S4 generic \`setGeneric\` builds or a \`Vectorize\` result, so a reader that has only the location to go on can say no more than that there is none.
266
+
251
267
  These are derived on demand by the ${ctx.linkPage('wiki/Query API', 'signature query')}, not stored:
252
- - the rdrr.io documentation link ${ctx.link('SignatureFunctionView::docUrl')} (base R \`/r/<pkg>/<topic>\`, CRAN \`/cran/<pkg>/man/<topic>\`), omitted for a ${ctx.linkE('FnProp', 'NoDoc')} function
268
+ - the documentation link ${ctx.link('SignatureFunctionView::docUrl')}, omitted for a ${ctx.linkE('FnProp', 'NoDoc')} function: R's own manual for a base package, rdrr.io's \`/cran/<pkg>/man/<topic>\` for CRAN. rdrr.io serves an older R, so everything R has gained since (\`sort_by\`, \`array2DF\`, ...) is a dead link there
253
269
  - ${ctx.link('SignatureFunctionView::sourceUrl')} and ${ctx.link('SignatureFunctionView::manUrl')}: the definition and its \`.Rd\` help page at the queried version, on \`github.com/cran/<pkg>\` (CRAN) or \`github.com/wch/r-source\` (base R)
254
270
  - the S3 method to generic backlink ${ctx.link('SignatureFunctionView::s3method')}, for a ${ctx.linkE('FnProp', 'S3Method')} function, resolving its generic
271
+ - the S4 group ${ctx.link('SignatureFunctionView::s4group')}, for a name that is a member of one (\`sin\` of \`Math\`), saying whether the view was answered by the package's entry for the group rather than by one for the name itself
255
272
  - the transitive call graph ${ctx.linkM(reader_1.SigDatabase, 'transitiveCallees')}, expanding the stored local callees inside one version
256
273
 
257
274
  ## Reading It From an Analyzer
@@ -333,15 +350,15 @@ Every shard, dictionary, and manifest is published in both brotli (\`.br\`) and
333
350
  ## Format
334
351
 
335
352
  The on-disk format is \`flowr-sigdb\` (schema ${schema_1.SigDbSchema}). Beyond each version's exports it records, per
336
- version, every function's signature (parameters, whether each is forced or optional, and its default) and
337
- call graph, together with that version's declared dependencies (\`Depends\`, \`Imports\`, ... with their
353
+ version, every function's signature (the parameters, each with its default and its ${ctx.link('ArgProp')} mask)
354
+ and call graph, together with that version's declared dependencies (\`Depends\`, \`Imports\`, ... with their
338
355
  version qualifiers). The layout is NDJSON: a header, then a shared string dictionary, then one
339
356
  self-contained blob per package, next to a sidecar \`.idx\`. A reader (${ctx.link(reader_1.SigDatabase)}) therefore
340
357
  loads the dictionary once and then **seeks straight to the packages it needs**, never reading the rest.
341
358
  The bundle is written by ${ctx.link('SigDbBuilder')} and can be split into several small shards (current-only
342
359
  versus full history, top-N versus the rest) that a \`flowr-sigdb-manifest\` routes transparently
343
360
  (${ctx.link(reader_1.SigDatabaseSet)}), and which information gets stored is selectable (${ctx.link('SigDbFeatures')}).
344
- crawlr produces the bundle from its analysis of CRAN.
361
+ The extractor produces the bundle from its analysis of CRAN.
345
362
 
346
363
  ## Performance
347
364
 
package/gas.d.ts CHANGED
@@ -4,7 +4,6 @@ export declare const GasWikiRef = "https://github.com/flowr-analysis/flowr/wiki/
4
4
  /**
5
5
  * Resource-pressure level returned by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
6
6
  * Numeric ordering lets callers use `>=` for threshold comparisons at zero cost.
7
- * See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section for details.
8
7
  */
9
8
  export declare const enum GasLevel {
10
9
  /** Safe to continue, all resources are within bounds. */
@@ -14,23 +13,18 @@ export declare const enum GasLevel {
14
13
  /** Threshold exceeded. The caller should skip the expensive work. */
15
14
  Critical = 2
16
15
  }
17
- /**
18
- * Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
19
- * Each key corresponds to a sensitivity factor in {@link FlowrGasConfig.features}.
20
- */
16
+ /** Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each a sensitivity factor in {@link FlowrGasConfig.features}. */
21
17
  export declare const GasFeatureKey: {
22
18
  /** Gas key for built-in `source()` file analysis. */
23
19
  readonly Source: "source";
24
- /** Gas key for the side-effect link resolution phase of the dataflow extractor, which matches unknown side effects against call sites via the CFG and can be expensive for large scripts. */
20
+ /** Gas key for the side-effect link resolution phase of the dataflow extractor (matches unknown side effects against call sites via the CFG). */
25
21
  readonly SideEffectLinking: "side-effect-linking";
26
- /** Gas key for the linter, checked once per linting rule. Under critical pressure, remaining rules are skipped. */
22
+ /** Gas key for the linter, checked once per rule; remaining rules are skipped under critical pressure. */
27
23
  readonly Linter: "linter";
28
- /**
29
- * Gas key for the static slicer, checked while traversing the dataflow graph. Under critical pressure the
30
- * traversal stops and the slice is returned as far as it got (`SliceResult.stoppedEarly`), which is the only
31
- * way to bound the otherwise synchronous traversal from the outside.
32
- */
24
+ /** Gas key for the static slicer, checked while traversing the dataflow graph; a hit stops traversal early (`SliceResult.stoppedEarly`). */
33
25
  readonly Slicer: "slicer";
26
+ /** Gas key for dataflow extraction. Unlike the keys above it is *armed* once per run (see {@link ReadOnlyFlowrAnalyzerGasContext.budget}) and counted as the fold goes. */
27
+ readonly Dataflow: "dataflow";
34
28
  };
35
29
  export type GasFeatureKey = typeof GasFeatureKey[keyof typeof GasFeatureKey];
36
30
  /** Paired low/high thresholds used inside {@link GasThresholdSpec}. */
@@ -41,37 +35,29 @@ export interface GasThresholdPair extends MergeableRecord {
41
35
  readonly critical: number;
42
36
  }
43
37
  /**
44
- * Thresholds for one gas dimension, either as one pair for every feature or split per {@link GasFeatureKey}:
45
- *
46
- * ```ts
47
- * timeMs: {
48
- * default: { problematic: 60_000, critical: 120_000 },
49
- * slicer: { problematic: 24_000, critical: 30_000 }
50
- * }
51
- * ```
52
- *
53
- * Per bound, a feature entry wins over `default`, which wins over the direct pair. A bound nowhere given never triggers.
38
+ * Thresholds for one gas dimension, either as one pair for every feature or split per {@link GasFeatureKey}. Per
39
+ * bound, a feature entry wins over `default`, which wins over the direct pair. A bound nowhere given never triggers.
54
40
  */
55
41
  export interface GasThresholdSpec extends MergeableRecord {
56
- /** Shared bound, for every feature without a more specific entry. */
42
+ /** the shared *problematic* bound, for every feature without a more specific entry */
57
43
  readonly problematic?: number;
58
- /** Shared bound, for every feature without a more specific entry. */
44
+ /** the shared *critical* bound, for every feature without a more specific entry */
59
45
  readonly critical?: number;
60
46
  /** Bounds for the features that have no entry of their own. */
61
47
  readonly default?: Partial<GasThresholdPair>;
62
48
  /** Bounds for one {@link GasFeatureKey}. */
63
49
  readonly [feature: string]: number | Partial<GasThresholdPair> | undefined;
64
50
  }
65
- /**
66
- * Thresholds for {@link GasLevel} transitions used by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each
67
- * dimension boundable per feature (see {@link GasThresholdSpec}).
68
- * See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section.
69
- */
51
+ /** Thresholds for {@link GasLevel} transitions used by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each dimension boundable per feature (see {@link GasThresholdSpec}). */
70
52
  export interface FlowrGasThresholds extends MergeableRecord {
71
53
  /** Heap-usage fraction thresholds (0-1, before factor scaling). */
72
54
  readonly memory: GasThresholdSpec;
73
55
  /** Elapsed analysis time thresholds in milliseconds (before factor scaling). */
74
56
  readonly timeMs: GasThresholdSpec;
57
+ /** Processed-AST-node thresholds, counted rather than sampled. Only read by keys that arm a budget (i.e. {@link GasFeatureKey.Dataflow}); absent means unbounded. */
58
+ readonly steps?: GasThresholdSpec;
59
+ /** Created-dataflow-vertex thresholds, counted like {@link FlowrGasThresholds.steps}. */
60
+ readonly vertices?: GasThresholdSpec;
75
61
  }
76
62
  /** Gas bounds for one feature within a single call, see {@link GasOverrides}. */
77
63
  export interface GasFeatureOverride extends MergeableRecord {
@@ -83,17 +69,16 @@ export interface GasFeatureOverride extends MergeableRecord {
83
69
  readonly timeMs?: Partial<GasThresholdPair>;
84
70
  /** Overrides `config.gas.thresholds.memory` for this call. */
85
71
  readonly memory?: Partial<GasThresholdPair>;
72
+ /** Overrides `config.gas.thresholds.steps` for this call, for a key that arms a budget. */
73
+ readonly steps?: Partial<GasThresholdPair>;
74
+ /** Overrides `config.gas.thresholds.vertices` for this call, for a key that arms a budget. */
75
+ readonly vertices?: Partial<GasThresholdPair>;
86
76
  /** Sensitivity factor, defaulting to the configured one, or `1` if the feature is disabled. */
87
77
  readonly factor?: number;
88
78
  }
89
79
  /**
90
- * Gas bounds for a single call, keyed by {@link GasFeatureKey}, measured from that call:
91
- *
92
- * ```ts
93
- * analyzer.query([...], { gas: { slicer: { critical: 30_000 } } });
94
- * ```
95
- *
96
- * Naming a feature enables gas for it even when `config.gas.features` disables it; pass `factor: 0` to keep it off.
80
+ * Gas bounds for a single call, keyed by {@link GasFeatureKey}, measured from that call. Naming a feature enables
81
+ * gas for it even when `config.gas.features` disables it; pass `factor: 0` to keep it off.
97
82
  */
98
83
  export type GasOverrides = {
99
84
  /** Bounds for the features that have no entry of their own. */
@@ -107,15 +92,9 @@ export interface GasHeapStatistics {
107
92
  readonly heap_size_limit: number;
108
93
  }
109
94
  /**
110
- * Gas configuration embedded in {@link FlowrConfig.gas}.
111
- *
112
- * Each entry in `features` is a sensitivity factor for a named analysis feature
113
- * (see {@link GasFeatureKey} for the recognised keys):
114
- * - `0` / absent - disabled for that feature, zero overhead.
115
- * - `1` - normal sensitivity, thresholds in {@link thresholds} apply as-is.
116
- * - `N` - N times as sensitive, effectively divides each threshold by N.
117
- *
118
- * See the [Gas (Resource Guard)](https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard) wiki section.
95
+ * Gas configuration embedded in {@link FlowrConfig.gas}. Each entry in `features` is a sensitivity factor for a
96
+ * named feature (see {@link GasFeatureKey}): `0`/absent disables it at zero overhead, `1` is normal sensitivity,
97
+ * `N` divides each threshold by N.
119
98
  */
120
99
  export interface FlowrGasConfig extends MergeableRecord {
121
100
  /** Thresholds scaled by each feature factor before comparison, optionally bounded per feature (see {@link GasThresholdSpec}). */
@@ -123,8 +102,73 @@ export interface FlowrGasConfig extends MergeableRecord {
123
102
  /** Per-feature sensitivity factors. Missing or `0` disables checking with zero overhead. */
124
103
  readonly features: Record<string, number | undefined>;
125
104
  /**
126
- * Custom heap statistics source (programmatic configs only), overriding the built-in
127
- * detection (v8 module, then Chromium's performance.memory). Return undefined to skip the memory check.
105
+ * How many calls one accounting of an armed budget covers (default `DefaultCountedCheckEvery`). Trades how far
106
+ * a run may overshoot a bound against what the guard costs per node: `1` counts exactly, larger counts coarsely.
128
107
  */
108
+ readonly countedCheckEvery?: number;
109
+ /** Custom heap statistics source (programmatic configs only), overriding the built-in v8/performance.memory detection. Return undefined to skip the memory check. */
129
110
  readonly heapProvider?: () => GasHeapStatistics | undefined;
130
111
  }
112
+ /** The dimension a {@link DataflowBudget} ran out in. */
113
+ export declare const enum BudgetDimension {
114
+ /** processed AST nodes (see `processDataflowFor`) */
115
+ Steps = "steps",
116
+ /** vertices added to any graph of the extraction */
117
+ Vertices = "vertices",
118
+ /** elapsed wall-clock time */
119
+ Time = "time"
120
+ }
121
+ /** The bounds of one extraction, as {@link ReadOnlyFlowrAnalyzerGasContext.budget} resolves them (already factor-scaled). A dimension the configuration leaves out arrives as `0`, meaning unbounded. */
122
+ export interface DataflowBudget {
123
+ /** Maximum number of AST nodes to process. */
124
+ readonly steps?: number;
125
+ /** Maximum number of dataflow vertices to create. */
126
+ readonly vertices?: number;
127
+ /** Maximum wall-clock time of the extraction, in milliseconds, measured from the gas contingent's start. */
128
+ readonly timeMs?: number;
129
+ }
130
+ /** What ended an extraction early, attached to the partial result as {@link DataflowInformation.cutShort}. */
131
+ export interface DataflowBudgetExhaustion {
132
+ /** which bound was hit */
133
+ readonly dimension: BudgetDimension;
134
+ /** the bound as it applied, i.e. after the gas feature factor scaled it */
135
+ readonly limit: number;
136
+ /** what the dimension stood at when the bound was seen to be past; may overshoot by up to one {@link FlowrGasConfig.countedCheckEvery} block */
137
+ readonly reached: number;
138
+ }
139
+ /** Whether `budget` bounds anything at all; an unbounded one is never armed. */
140
+ export declare function isBoundedBudget(budget: DataflowBudget | undefined): budget is DataflowBudget;
141
+ /**
142
+ * Counts what one extraction spends and reports when its {@link DataflowBudget} is used up. Both counters are
143
+ * **sampled, not exact**: the hot paths only decrement a countdown, and accounting runs once every
144
+ * {@link FlowrGasConfig.countedCheckEvery} calls, so a bound may be overshot by up to that many steps or vertices.
145
+ */
146
+ export declare class DataflowBudgetTracker {
147
+ private readonly stepLimit;
148
+ private readonly vertexLimit;
149
+ private readonly deadline;
150
+ private readonly every;
151
+ /** steps left before the next accounting; the only thing {@link step} touches while the budget holds */
152
+ private untilStep;
153
+ /** vertices left before the next accounting, see {@link untilStep} */
154
+ private untilVertex;
155
+ private steps;
156
+ private vertices;
157
+ private hit;
158
+ /** `since` is what the elapsed-time bound is measured from; `every` is how many calls one accounting covers (see {@link FlowrGasConfig.countedCheckEvery}). */
159
+ constructor(budget: DataflowBudget, since: number, every: number);
160
+ /** What ended the extraction early, `undefined` while the budget holds. */
161
+ get exhausted(): DataflowBudgetExhaustion | undefined;
162
+ /** Books one processed node, returning whether the budget is used up (so the caller must not descend). Only every {@link FlowrGasConfig.countedCheckEvery}-th call does more than count down. */
163
+ step(): boolean;
164
+ /** Books one created vertex, sampled like {@link step}. Billed as *created*, so the count bounds the work done rather than the size of the final (possibly merged-away) graph. */
165
+ vertex(): void;
166
+ private exceed;
167
+ }
168
+ /**
169
+ * The tracker of the extraction currently running, or `undefined` when the gas context armed none. A live binding
170
+ * rather than a getter, so an unarmed run pays only a null check. Set it only through {@link withDataflowBudget}.
171
+ */
172
+ export declare let activeDataflowBudget: DataflowBudgetTracker | undefined;
173
+ /** Runs `fn` with `tracker` as the {@link activeDataflowBudget}, restoring whatever was active before (so a nested extraction bills the budget it was started under). */
174
+ export declare function withDataflowBudget<T>(tracker: DataflowBudgetTracker | undefined, fn: () => T): T;
package/gas.js CHANGED
@@ -1,24 +1,108 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GasFeatureKey = exports.GasWikiRef = void 0;
3
+ exports.activeDataflowBudget = exports.DataflowBudgetTracker = exports.GasFeatureKey = exports.GasWikiRef = void 0;
4
+ exports.isBoundedBudget = isBoundedBudget;
5
+ exports.withDataflowBudget = withDataflowBudget;
4
6
  /** Wiki reference for the gas resource guard, use this in user-facing warnings. */
5
7
  exports.GasWikiRef = 'https://github.com/flowr-analysis/flowr/wiki/Core#gas-resource-guard';
6
- /**
7
- * Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}.
8
- * Each key corresponds to a sensitivity factor in {@link FlowrGasConfig.features}.
9
- */
8
+ /** Known feature keys accepted by {@link ReadOnlyFlowrAnalyzerGasContext.checkGas}, each a sensitivity factor in {@link FlowrGasConfig.features}. */
10
9
  exports.GasFeatureKey = {
11
10
  /** Gas key for built-in `source()` file analysis. */
12
11
  Source: 'source',
13
- /** Gas key for the side-effect link resolution phase of the dataflow extractor, which matches unknown side effects against call sites via the CFG and can be expensive for large scripts. */
12
+ /** Gas key for the side-effect link resolution phase of the dataflow extractor (matches unknown side effects against call sites via the CFG). */
14
13
  SideEffectLinking: 'side-effect-linking',
15
- /** Gas key for the linter, checked once per linting rule. Under critical pressure, remaining rules are skipped. */
14
+ /** Gas key for the linter, checked once per rule; remaining rules are skipped under critical pressure. */
16
15
  Linter: 'linter',
17
- /**
18
- * Gas key for the static slicer, checked while traversing the dataflow graph. Under critical pressure the
19
- * traversal stops and the slice is returned as far as it got (`SliceResult.stoppedEarly`), which is the only
20
- * way to bound the otherwise synchronous traversal from the outside.
21
- */
22
- Slicer: 'slicer'
16
+ /** Gas key for the static slicer, checked while traversing the dataflow graph; a hit stops traversal early (`SliceResult.stoppedEarly`). */
17
+ Slicer: 'slicer',
18
+ /** Gas key for dataflow extraction. Unlike the keys above it is *armed* once per run (see {@link ReadOnlyFlowrAnalyzerGasContext.budget}) and counted as the fold goes. */
19
+ Dataflow: 'dataflow'
23
20
  };
21
+ /** Whether `budget` bounds anything at all; an unbounded one is never armed. */
22
+ function isBoundedBudget(budget) {
23
+ return budget !== undefined && ((budget.steps ?? 0) > 0 || (budget.vertices ?? 0) > 0 || (budget.timeMs ?? 0) > 0);
24
+ }
25
+ /**
26
+ * Counts what one extraction spends and reports when its {@link DataflowBudget} is used up. Both counters are
27
+ * **sampled, not exact**: the hot paths only decrement a countdown, and accounting runs once every
28
+ * {@link FlowrGasConfig.countedCheckEvery} calls, so a bound may be overshot by up to that many steps or vertices.
29
+ */
30
+ class DataflowBudgetTracker {
31
+ stepLimit;
32
+ vertexLimit;
33
+ deadline;
34
+ every;
35
+ /** steps left before the next accounting; the only thing {@link step} touches while the budget holds */
36
+ untilStep;
37
+ /** vertices left before the next accounting, see {@link untilStep} */
38
+ untilVertex;
39
+ steps = 0;
40
+ vertices = 0;
41
+ hit;
42
+ /** `since` is what the elapsed-time bound is measured from; `every` is how many calls one accounting covers (see {@link FlowrGasConfig.countedCheckEvery}). */
43
+ constructor(budget, since, every) {
44
+ this.stepLimit = budget.steps ?? 0;
45
+ this.vertexLimit = budget.vertices ?? 0;
46
+ this.deadline = (budget.timeMs ?? 0) > 0 ? since + budget.timeMs : Number.POSITIVE_INFINITY;
47
+ this.every = Math.max(1, every);
48
+ this.untilStep = this.every;
49
+ this.untilVertex = this.every;
50
+ }
51
+ /** What ended the extraction early, `undefined` while the budget holds. */
52
+ get exhausted() {
53
+ return this.hit;
54
+ }
55
+ /** Books one processed node, returning whether the budget is used up (so the caller must not descend). Only every {@link FlowrGasConfig.countedCheckEvery}-th call does more than count down. */
56
+ step() {
57
+ if (--this.untilStep > 0) {
58
+ return false;
59
+ }
60
+ /* an exhausted budget answers on every call from here on, so the fold stops at the next node */
61
+ this.untilStep = 1;
62
+ if (this.hit !== undefined) {
63
+ return true;
64
+ }
65
+ this.untilStep = this.every;
66
+ this.steps += this.every;
67
+ if (this.stepLimit > 0 && this.steps > this.stepLimit) {
68
+ return this.exceed("steps" /* BudgetDimension.Steps */, this.stepLimit, this.steps);
69
+ }
70
+ if (this.deadline !== Number.POSITIVE_INFINITY && Date.now() > this.deadline) {
71
+ return this.exceed("time" /* BudgetDimension.Time */, this.deadline, Date.now());
72
+ }
73
+ return false;
74
+ }
75
+ /** Books one created vertex, sampled like {@link step}. Billed as *created*, so the count bounds the work done rather than the size of the final (possibly merged-away) graph. */
76
+ vertex() {
77
+ if (--this.untilVertex > 0) {
78
+ return;
79
+ }
80
+ this.untilVertex = this.every;
81
+ this.vertices += this.every;
82
+ if (this.hit === undefined && this.vertexLimit > 0 && this.vertices > this.vertexLimit) {
83
+ this.exceed("vertices" /* BudgetDimension.Vertices */, this.vertexLimit, this.vertices);
84
+ }
85
+ }
86
+ exceed(dimension, limit, reached) {
87
+ this.hit = { dimension, limit, reached };
88
+ return true;
89
+ }
90
+ }
91
+ exports.DataflowBudgetTracker = DataflowBudgetTracker;
92
+ /**
93
+ * The tracker of the extraction currently running, or `undefined` when the gas context armed none. A live binding
94
+ * rather than a getter, so an unarmed run pays only a null check. Set it only through {@link withDataflowBudget}.
95
+ */
96
+ exports.activeDataflowBudget = undefined;
97
+ /** Runs `fn` with `tracker` as the {@link activeDataflowBudget}, restoring whatever was active before (so a nested extraction bills the budget it was started under). */
98
+ function withDataflowBudget(tracker, fn) {
99
+ const previous = exports.activeDataflowBudget;
100
+ exports.activeDataflowBudget = tracker ?? previous;
101
+ try {
102
+ return fn();
103
+ }
104
+ finally {
105
+ exports.activeDataflowBudget = previous;
106
+ }
107
+ }
24
108
  //# sourceMappingURL=gas.js.map
package/index.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What `import ... from '@eagleoutice/flowr'` gives you: the entry points an analysis is written against.
3
+ *
4
+ * Everything flowR has stays reachable under its own path (`@eagleoutice/flowr/dataflow/graph/graph` and its
5
+ * kin), which is what the wiki links to. This module only spares the common case from knowing where a name
6
+ * lives, so it re-exports rather than defines.
7
+ * @example
8
+ * ```ts
9
+ * import { FlowrAnalyzerBuilder } from '@eagleoutice/flowr';
10
+ *
11
+ * const analyzer = await new FlowrAnalyzerBuilder().setEngine('tree-sitter').build();
12
+ * analyzer.addRequest('x <- 1\ny <- x\nx');
13
+ * const slice = await analyzer.query([{ type: 'static-slice', criteria: ['3@x'] }]);
14
+ * ```
15
+ * @module
16
+ */
17
+ export { FlowrAnalyzer } from './project/flowr-analyzer';
18
+ export type { FlowrAnalysisOptions, FlowrAnalysisProvider, ReadonlyFlowrAnalysisProvider } from './project/flowr-analyzer';
19
+ export { FlowrAnalyzerBuilder } from './project/flowr-analyzer-builder';
20
+ export type { Query, QueryResults, SupportedQueryTypes } from './queries/query';
21
+ export { SlicingCriteria, SlicingCriterion } from './slicing/criterion/parse';
22
+ export { requestFromInput } from './r-bridge/retriever';
23
+ export type { RParseRequest, RParseRequests } from './r-bridge/retriever';
24
+ export type { KnownParser } from './r-bridge/parser';
25
+ export { RShell } from './r-bridge/shell';
26
+ export { TreeSitterExecutor } from './r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
27
+ export { FlowrConfig } from './config';
28
+ export { PipelineExecutor } from './core/pipeline-executor';
29
+ export { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICING_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE, TREE_SITTER_DATAFLOW_PIPELINE, TREE_SITTER_SLICING_PIPELINE, TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE } from './core/steps/pipeline/default-pipelines';
30
+ export { flowrVersion, retrieveVersionInformation } from './util/version';
31
+ export type { VersionInformation } from './util/version';
package/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * What `import ... from '@eagleoutice/flowr'` gives you: the entry points an analysis is written against.
4
+ *
5
+ * Everything flowR has stays reachable under its own path (`@eagleoutice/flowr/dataflow/graph/graph` and its
6
+ * kin), which is what the wiki links to. This module only spares the common case from knowing where a name
7
+ * lives, so it re-exports rather than defines.
8
+ * @example
9
+ * ```ts
10
+ * import { FlowrAnalyzerBuilder } from '@eagleoutice/flowr';
11
+ *
12
+ * const analyzer = await new FlowrAnalyzerBuilder().setEngine('tree-sitter').build();
13
+ * analyzer.addRequest('x <- 1\ny <- x\nx');
14
+ * const slice = await analyzer.query([{ type: 'static-slice', criteria: ['3@x'] }]);
15
+ * ```
16
+ * @module
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.retrieveVersionInformation = exports.flowrVersion = exports.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = exports.TREE_SITTER_SLICING_PIPELINE = exports.TREE_SITTER_DATAFLOW_PIPELINE = exports.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = exports.DEFAULT_SLICING_PIPELINE = exports.DEFAULT_DATAFLOW_PIPELINE = exports.PipelineExecutor = exports.FlowrConfig = exports.TreeSitterExecutor = exports.RShell = exports.requestFromInput = exports.SlicingCriterion = exports.SlicingCriteria = exports.FlowrAnalyzerBuilder = exports.FlowrAnalyzer = void 0;
20
+ /* the analyzer, which is the front door: everything else here is what its methods hand you or take */
21
+ var flowr_analyzer_1 = require("./project/flowr-analyzer");
22
+ Object.defineProperty(exports, "FlowrAnalyzer", { enumerable: true, get: function () { return flowr_analyzer_1.FlowrAnalyzer; } });
23
+ var flowr_analyzer_builder_1 = require("./project/flowr-analyzer-builder");
24
+ Object.defineProperty(exports, "FlowrAnalyzerBuilder", { enumerable: true, get: function () { return flowr_analyzer_builder_1.FlowrAnalyzerBuilder; } });
25
+ var parse_1 = require("./slicing/criterion/parse");
26
+ Object.defineProperty(exports, "SlicingCriteria", { enumerable: true, get: function () { return parse_1.SlicingCriteria; } });
27
+ Object.defineProperty(exports, "SlicingCriterion", { enumerable: true, get: function () { return parse_1.SlicingCriterion; } });
28
+ /* what to analyze, and what reads it */
29
+ var retriever_1 = require("./r-bridge/retriever");
30
+ Object.defineProperty(exports, "requestFromInput", { enumerable: true, get: function () { return retriever_1.requestFromInput; } });
31
+ var shell_1 = require("./r-bridge/shell");
32
+ Object.defineProperty(exports, "RShell", { enumerable: true, get: function () { return shell_1.RShell; } });
33
+ var tree_sitter_executor_1 = require("./r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
34
+ Object.defineProperty(exports, "TreeSitterExecutor", { enumerable: true, get: function () { return tree_sitter_executor_1.TreeSitterExecutor; } });
35
+ /* how it is configured */
36
+ var config_1 = require("./config");
37
+ Object.defineProperty(exports, "FlowrConfig", { enumerable: true, get: function () { return config_1.FlowrConfig; } });
38
+ /* the low-level interface the analyzer is built on, for anyone assembling their own pipeline */
39
+ var pipeline_executor_1 = require("./core/pipeline-executor");
40
+ Object.defineProperty(exports, "PipelineExecutor", { enumerable: true, get: function () { return pipeline_executor_1.PipelineExecutor; } });
41
+ var default_pipelines_1 = require("./core/steps/pipeline/default-pipelines");
42
+ Object.defineProperty(exports, "DEFAULT_DATAFLOW_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_DATAFLOW_PIPELINE; } });
43
+ Object.defineProperty(exports, "DEFAULT_SLICING_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_SLICING_PIPELINE; } });
44
+ Object.defineProperty(exports, "DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE; } });
45
+ Object.defineProperty(exports, "TREE_SITTER_DATAFLOW_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_DATAFLOW_PIPELINE; } });
46
+ Object.defineProperty(exports, "TREE_SITTER_SLICING_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_SLICING_PIPELINE; } });
47
+ Object.defineProperty(exports, "TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE", { enumerable: true, get: function () { return default_pipelines_1.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE; } });
48
+ /* which flowR this is */
49
+ var version_1 = require("./util/version");
50
+ Object.defineProperty(exports, "flowrVersion", { enumerable: true, get: function () { return version_1.flowrVersion; } });
51
+ Object.defineProperty(exports, "retrieveVersionInformation", { enumerable: true, get: function () { return version_1.retrieveVersionInformation; } });
52
+ //# sourceMappingURL=index.js.map